diff --git a/Sources/epoch_code/System/player_login.fsm b/Sources/epoch_code/System/player_login.fsm index f75a4fc6..57cee406 100644 --- a/Sources/epoch_code/System/player_login.fsm +++ b/Sources/epoch_code/System/player_login.fsm @@ -1,8 +1,8 @@ -/*%FSM*/ +/*%FSM*/ /*%FSM*/ /* item0[] = {"INIT",0,250,-25.000000,-375.000000,75.000000,-325.000000,0.000000,"INIT"}; -item1[] = {"FINISH",1,4346,-149.463196,1518.792480,-49.463196,1568.792480,0.000000,"FINISH"}; +item1[] = {"FINISH",1,250,-149.463196,1518.792480,-49.463196,1568.792480,0.000000,"FINISH"}; item2[] = {"true",8,218,-150.000000,-125.000000,-50.000000,-75.000000,0.000000,"true"}; item3[] = {"Version_Check",2,250,-25.000000,-75.000000,75.000000,-25.000000,0.000000,"Version Check"}; item4[] = {"Player_Object_Re",4,218,-150.000000,75.000000,-50.000000,125.000000,0.000000,"Player" \n "Object Ready"}; @@ -17,7 +17,7 @@ item12[] = {"Empty_PlayerUID",4,218,125.000000,125.000000,225.000000,175.000000, item13[] = {"ERROR_PlayerUID",2,250,275.000000,125.000000,375.000000,175.000000,0.000000,"ERROR" \n "PlayerUID Empty"}; item14[] = {"",7,210,471.000061,145.999908,478.999939,154.000092,0.000000,""}; item15[] = {"Timeout_No_Respo",4,218,125.000000,875.000000,225.000000,925.000000,0.000000,"Timeout" \n "No Response"}; -item16[] = {"Response",4,218,-150.000000,825.000000,-50.000000,875.000000,0.000000,"Response"}; +item16[] = {"Response",4,4314,-150.000000,825.000000,-50.000000,875.000000,0.000000,"Response"}; item17[] = {"Setup_Player_Var",2,250,-25.000000,1075.000000,75.000000,1125.000000,0.000000,"Setup Player" \n "Variables"}; item18[] = {"Request_Hive",2,250,-25.000000,575.000000,75.000000,625.000000,0.000000,"Request Hive"}; item19[] = {"Timeout_No_Respo",4,218,125.000000,575.000000,225.000000,625.000000,0.000000,"Timeout" \n "No Response"}; @@ -183,8 +183,8 @@ link93[] = {82,76}; link94[] = {83,16}; link95[] = {83,22}; link96[] = {84,31}; -globals[] = {0.000000,0,0,0,0,640,480,1,247,6316128,1,-346.821808,275.273865,1776.441162,823.351685,577,884,1}; -window[] = {2,-1,-1,-1,-1,923,156,1140,156,3,595}; +globals[] = {0.000000,0,0,0,0,640,480,1,247,6316128,1,-618.033569,546.485168,2139.147705,423.870514,573,844,1}; +window[] = {2,-1,-1,-1,-1,959,-1728,-744,192,3,595}; *//*%FSM*/ class FSM { @@ -1391,6 +1391,7 @@ class FSM "_mass = _C_SET deleteAt 0;" \n "" \n "Epoch_my_GroupUID = _C_SET deleteAt 0;" \n + "Epoch_my_tempGroupUID = """";" \n "Epoch_canBeRevived = _C_SET deleteAt 0;" \n "Epoch_personalToken = _C_SET deleteAt 0;" \n "Epoch_my_Group = _C_SET deleteAt 0;" \n diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_cTempGroup_BtnCreate.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_cTempGroup_BtnCreate.sqf new file mode 100644 index 00000000..244871e9 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_cTempGroup_BtnCreate.sqf @@ -0,0 +1,47 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_cTempGroup_BtnCreate.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_array","_groupName","_ret","_timeout","_txt","_txtCtrl","_upgradePrice"]; +//[[[end]]] +disableSerialization; +_txtCtrl = (findDisplay -1200) displayCtrl 21; +_array = toArray(ctrlText _txtCtrl); + +if (count _array > 24) then { + _array resize 24; +}; + +if (count (_array-[32]) == 0) then { //32 = SPACE + ["Your group need a name!","Epoch Temp Group Menu",true,false] spawn BIS_fnc_GUImessage; +} else { + _groupName = toString(_array); + _txtCtrl ctrlSetText _groupName; + + _groupName spawn { + _txt = format["Do you want to create your temp group called %1? You can disband/leave this group to create a new one!",_this]; + _ret = [_txt,"Epoch Temp Group Menu",true,true] call BIS_fnc_GUImessage; + if (_ret) then { + [player,_this,Epoch_personalToken] remoteExec ["EPOCH_server_createTempGroup",2]; + _timeout = diag_tickTime+10; + waitUntil { + ((Epoch_my_tempGroupUID != "") && !(Epoch_my_tempGroup isEqualTo [])) || ((_timeout - diag_tickTime) <= 0) + }; + (findDisplay -1200) closeDisplay 0; + if ((Epoch_my_tempGroupUID != "") && !(Epoch_my_tempGroup isEqualTo [])) then { + createDialog "Epoch_myTempGroup"; + }; + }; + }; +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_cTempGroup_onLoad.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_cTempGroup_onLoad.sqf new file mode 100644 index 00000000..7c938060 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_cTempGroup_onLoad.sqf @@ -0,0 +1,21 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_cTempGroup_onLoad.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_textCtrl"]; +//[[[end]]] +if!(Epoch_my_tempGroup isEqualTo [])exitWith {(findDisplay -1200) closeDisplay 0}; +disableSerialization; +_textCtrl = (findDisplay -1200) displayCtrl 22; +_textCtrl CtrlSetText format ["%1, Temp Groups are free forever",name player]; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_acceptInvite.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_acceptInvite.sqf new file mode 100644 index 00000000..3b83e46e --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_acceptInvite.sqf @@ -0,0 +1,18 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_itempGroup_acceptInvite.sqf +*/ +if (Epoch_invited_tempGroupUID != "") then { + [Epoch_invited_tempGroupUID,getPlayerUID player,true,false,player,Epoch_personalToken] remoteExec ["EPOCH_server_updatePlayerTempGroup",2]; +}; +(findDisplay -1500) closeDisplay 0; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_onLoad.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_onLoad.sqf new file mode 100644 index 00000000..91160404 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_onLoad.sqf @@ -0,0 +1,22 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_iTempGroup_onLoad.sqf +*/ +disableSerialization; +//[[[cog import generate_private_arrays ]]] +private ["_display","_text"]; +//[[[end]]] +_display = findDisplay -1400; +if (Epoch_invited_tempGroupUID == "" || Epoch_invited_tempGroupName == "") exitWith { _display closeDisplay 0}; +_text = _display displayCtrl 21; +_text ctrlSetText format ["Join the temp group called %1?",Epoch_invited_tempGroupName]; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_refresh.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_refresh.sqf new file mode 100644 index 00000000..743016f0 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_iTempGroup_refresh.sqf @@ -0,0 +1,25 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_iTempGroup_refresh.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_index"]; +//[[[end]]] +if !(Epoch_invited_tempGroupUIDs isEqualTo []) then { + Epoch_invited_tempGroupUIDsPrev = Epoch_invited_tempGroupUIDs; + lbClear 1500; + { + _index = lbAdd[1500, _x select 1]; + lbSetData[1500, _index, _x select 0]; + } forEach Epoch_invited_tempGroupUIDs; +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnInvite.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnInvite.sqf new file mode 100644 index 00000000..071f6427 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnInvite.sqf @@ -0,0 +1,50 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_tempGroup_BtnInvite.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_BtnInvite","_InvitePlayerCombo","_groupSize","_currentMember","_found","_playerName","_playerUID","_ret","_txt","_upgradePrice","_upgradeSlots"]; +//[[[end]]] +disableSerialization; +_BtnInvite = (findDisplay -1300) displayCtrl 30; +_playerUID = getPlayerUID player; + +Epoch_my_tempGroup params [ + ["_groupName",""], + ["_leaderName",""], + ["_groupSize",0], + ["_modArray",[]], + ["_memberArray",[]] +]; + +if (_playerUID == Epoch_my_tempGroupUID || {_x select 0 == _playerUID}count (_modArray) > 0) then { + _currentMember = count(_modArray) + count(_memberArray) + 1; + if (_currentMember < _groupSize) then { + _InvitePlayerCombo = (findDisplay -1300) displayCtrl 41; + _playerUID = _InvitePlayerCombo lbData (lbCurSel _InvitePlayerCombo); + _playerName = _InvitePlayerCombo lbText (lbCurSel _InvitePlayerCombo); + if (_playerUID != "" && _playerName != "" && ({_playerUID in _x} count (_modArray) == 0) && ({_playerUID in _x} count (_memberArray) == 0) && !(_playerUID == Epoch_my_tempGroupUID)) then { + _txt = format["Do you want to add %1 to your Temp Group?",_playerName]; + [_playerUID,_txt,_groupName] spawn { + params ["_playerUID","_txt","_groupName"]; + _ret = [_txt,"Epoch Temp Group Menu",true,true] call BIS_fnc_GUImessage; + if (_ret) then { + [_playerUID,Epoch_my_tempGroupUID,_groupName,player,Epoch_personalToken] remoteExec ["EPOCH_server_invitePlayerTemp",2]; + }; + }; + }; + }; + true +} else { + false +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnKick.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnKick.sqf new file mode 100644 index 00000000..d951af2f --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnKick.sqf @@ -0,0 +1,48 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_tempGroup_BtnKick.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_BtnKick","_group","_playerName","_playerUID","_ret","_selected","_txt"]; +//[[[end]]] +disableSerialization; +_BtnKick = (findDisplay -1300) displayCtrl 33; + +_playerUID = getPlayerUID player; + +Epoch_my_tempGroup params [ + ["_groupName",""], + ["_leaderName",""], + ["_groupSize",0], + ["_modArray",[]], + ["_memberArray",[]] +]; + +if (_playerUID == Epoch_my_tempGroupUID || {_x select 0 == _playerUID}count (_modArray) > 0) then { + _group = (findDisplay -1300) displayCtrl 40; + _selected = lbCurSel _group; + if (_selected >= 0) then { + _playerUID = _group lbData _selected; + _playerName = _group lbText _selected; + if (_playerUID != "" && _playerName != "") then { + _txt = format["Do you want to kick %1 from your Temp Group?",_playerName]; + [_playerUID,_txt] spawn { + params ["_playerUID","_txt"]; + _ret = [_txt,"Epoch Temp Group Menu",true,true] call BIS_fnc_GUImessage; + if (_ret) then { + [Epoch_my_tempGroupUID,_playerUID,false,false,player,Epoch_personalToken] remoteExec ["EPOCH_server_updatePlayerTempGroup",2]; + }; + }; + }; + }; +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnLeave.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnLeave.sqf new file mode 100644 index 00000000..16ecedd5 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnLeave.sqf @@ -0,0 +1,42 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_tempGroup_BtnLeave.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_BtnLeave","_ret","_txt"]; +//[[[end]]] +disableSerialization; +Epoch_my_tempGroup params [ + ["_groupName",""], + ["_leaderName",""], + ["_groupSize",0], + ["_modArray",[]], + ["_memberArray",[]] +]; +if (getPlayerUID player == Epoch_my_tempGroupUID) then { + _txt = format["Do you want to delete your Temp Group called %1?",_groupName]; + _txt spawn { + _ret = [_this,"Epoch Temp Group Menu",true,true] call BIS_fnc_GUImessage; + if (_ret) then { + [player,Epoch_personalToken] remoteExec ["EPOCH_server_deleteTempGroup",2]; + }; + }; +} else { + _txt = format["Do you want to leave the %1 Temp Group?",_groupName]; + _txt spawn { + _ret = [_this,"Epoch Temp Group Menu",true,true] call BIS_fnc_GUImessage; + if (_ret) then { + [Epoch_my_tempGroupUID,getPlayerUID player,false,false,player,Epoch_personalToken] remoteExec ["EPOCH_server_updatePlayerTempGroup",2]; + }; + }; +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnMod.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnMod.sqf new file mode 100644 index 00000000..d60cbb51 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_BtnMod.sqf @@ -0,0 +1,46 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/group/EPOCH_Group_BtnMod.sqf +*/ +disableSerialization; +//[[[cog import generate_private_arrays ]]] +private ["_group","_isMember","_playerUID","_ret","_selected","_txt"]; +//[[[end]]] +if (getPlayerUID player == Epoch_my_tempGroupUID) then { + _group = (findDisplay -1300) displayCtrl 40; + _selected = lbCurSel _group; + if (_selected >= 0) then { + _playerUID = _group lbData _selected; + if (_playerUID != "") then { + _isMember = (_group lbPicture _selected) == (EPOCH_group_level_img select 2); + _txt = if (_isMember) then { + format["Do you want to give %1 moderator permissions?",_group lbText _selected]; + } else { + format["Do you want to remove %1 moderator permissions?",_group lbText _selected]; + }; + + [_playerUID,_isMember,_txt] spawn { + params ["_playerUID","_isMember","_txt"]; + _ret = [_txt,"Epoch Temp Group Menu",true,true] call BIS_fnc_GUImessage; + if (_ret) then { + [Epoch_my_tempGroupUID,_playerUID,true,_isMember,player,Epoch_personalToken] remoteExec ["EPOCH_server_updatePlayerTempGroup",2]; + }; + }; + }; + } else { + ["You need to select a player!", 5] call Epoch_message; + }; + true +} else { + false +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_Combo.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_Combo.sqf new file mode 100644 index 00000000..057443da --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_Combo.sqf @@ -0,0 +1,43 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/group/EPOCH_Group_Combo.sqf +*/ +disableSerialization; +//[[[cog import generate_private_arrays ]]] +private ["_BtnInvite","_ctrl","_currentMember","_playerUID","_selected"]; +//[[[end]]] + +Epoch_my_tempGroup params [ + ["_groupName",""], + ["_leaderName",""], + ["_groupSize",0], + ["_modArray",[]], + ["_memberArray",[]] +]; + +_ctrl = _this select 0; +_selected = _this select 1; +_playerUID = getPlayerUID player; +if (_playerUID == Epoch_my_tempGroupUID || {_x select 0 == _playerUID}count (_modArray) > 0) then { + _BtnInvite = (findDisplay -1300) displayCtrl 30; + _currentMember = count(_modArray) + count(_memberArray) + 1; + if (_currentMember < _groupSize) then { + _BtnInvite ctrlSetText format ["Invite %1",_ctrl lbtext _selected]; + }; + true +} else { + if (_selected != -1) then { + _ctrl lbSetCurSel -1; + }; + false +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_List.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_List.sqf new file mode 100644 index 00000000..2c51b38b --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_List.sqf @@ -0,0 +1,39 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_tempGroup_List.sqf +*/ +disableSerialization; +//[[[cog import generate_private_arrays ]]] +private ["_BtnKick","_BtnSetMod","_img"]; +//[[[end]]] +params ["_ctrl","_selected"]; + +if (getPlayerUID player == Epoch_my_tempGroupUID) then { + _img = _ctrl lbPicture _selected; + + _BtnSetMod = (findDisplay -1300) displayCtrl 32; + _BtnKick = (findDisplay -1300) displayCtrl 33; + + switch _img do { + case {getPlayerUID player == _ctrl lbData _selected}:{_BtnSetMod ctrlEnable false;_BtnKick ctrlEnable false}; + case(EPOCH_group_level_img select 0) : {_BtnSetMod ctrlEnable false; _BtnKick ctrlEnable false}; + case(EPOCH_group_level_img select 1) : {_BtnSetMod ctrlEnable true; _BtnKick ctrlEnable true; _BtnSetMod ctrlSetText "Remove Mod"}; + case(EPOCH_group_level_img select 2) : {_BtnSetMod ctrlEnable true; _BtnKick ctrlEnable true; _BtnSetMod ctrlSetText "Set Mod"}; + }; + true +} else { + if (_selected != -1) then { + _ctrl lbSetCurSel -1; + }; + false +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_invitePlayer.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_invitePlayer.sqf new file mode 100644 index 00000000..7370452f --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_invitePlayer.sqf @@ -0,0 +1,18 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/group/EPOCH_Group_invitePlayer.sqf +*/ +if !(_this in Epoch_invited_tempGroupUIDs) then { + Epoch_invited_tempGroupUIDs pushBack _this; + ["Temp Group request received", 5] call Epoch_message; +}; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_onLoad.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_onLoad.sqf new file mode 100644 index 00000000..72a3ec1f --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_onLoad.sqf @@ -0,0 +1,94 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_tempGroup_onLoad.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_BtnInvite","_GroupMemberList","_InvitePlayerCombo","_currentMaxMember","_display","_found","_index","_myPlayerUID","_onlinePUID","_picture","_playerIsLeader","_playerIsMod","_playerUID","_players"]; +//[[[end]]] +disableSerialization; +_display = findDisplay -1300; +_BtnInvite = _display displayCtrl 30; + +_GroupMemberList = _display displayCtrl 40; +_InvitePlayerCombo = _display displayCtrl 41; + +Epoch_my_tempGroup params [ + ["_groupName",""], + ["_leaderName",""], + ["_groupSize",0], + ["_modArray",[]], + ["_memberArray",[]] +]; + +_currentMaxMember = count(_modArray) + count(_memberArray) + 1; + +(_display displayCtrl 21) ctrlSetText format["Temp Name: %1 (%2/%3 Slots)",_groupName,_currentMaxMember,_groupSize]; + +_myPlayerUID = getPlayerUID player; +_playerIsLeader = _myPlayerUID == Epoch_my_tempGroupUID; +_playerIsMod = {_x select 0 == _myPlayerUID}count (_modArray) > 0; +(_display displayCtrl 32) ctrlEnable false; +(_display displayCtrl 33) ctrlEnable false; + +_onlinePUID = []; +{ + _onlinePUID pushBack (getPlayerUID _x); +}forEach (units group player); + +if (_currentMaxMember < _groupSize) then { + _players = player nearEntities [["Epoch_Male_F","Epoch_Female_F","LandVehicle","Ship","Air","Tank"], 10]; + + if (_playerIsLeader || _playerIsMod) then { + { + if (!isNull _x) then { + if (isPlayer _x && alive _x) then { + _index = _InvitePlayerCombo lbAdd format["%1",name _x]; + _InvitePlayerCombo lbSetData [_index,getPlayerUID _x]; + }; + }; + }forEach (_players-(units group player)); + }; + + if ((lbSize _InvitePlayerCombo) == 0) then { + _InvitePlayerCombo ctrlEnable false; + _BtnInvite ctrlEnable false; + _BtnInvite ctrlSetText (if (_playerIsLeader || _playerIsMod) then {"No one nearby to invite."} else {"Must be an Owner or a Mod to invite!"}); + } else { + _InvitePlayerCombo lbSetCurSel 0; + lbsort _InvitePlayerCombo; + }; +}; + +if (getPlayerUID player == Epoch_my_tempGroupUID) then { + (findDisplay -1300) displayCtrl 31 ctrlSetText "Delete TempGrp"; +}; + +{ + _picture = EPOCH_group_level_img select _forEachIndex; //0 = lead / 1 = mod / 2 = member + { + _playerUID = _x select 0; + + _index = _GroupMemberList lbAdd format["%1",_x select 1]; + _GroupMemberList lbSetColor [_index,if (_playerUID in _onlinePUID) then {[1,1,1,1]}else{[1,1,1,0.45]}]; + _GroupMemberList lbSetPicture [_index, _picture]; + + if (_playerIsLeader || _playerIsMod) then { + _GroupMemberList lbSetData [_index,_playerUID]; + }; + }forEach _x; +}forEach +[ + [[Epoch_my_tempGroupUID,_leaderName]], + _modArray, + _memberArray +]; diff --git a/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_update.sqf b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_update.sqf new file mode 100644 index 00000000..da19de8e --- /dev/null +++ b/Sources/epoch_code/gui/scripts/groupTemp/EPOCH_tempGroup_update.sqf @@ -0,0 +1,19 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/groupTemp/EPOCH_tempGroup_update.sqf +*/ +if (!isNull (findDisplay -1300)) then { + (findDisplay -1300) closeDisplay 0; + uisleep 0.2; + createDialog "Epoch_myTempGroup"; +}; diff --git a/Sources/epoch_code/gui/scripts/inventory/EPOCH_Inventory_itempGroup.sqf b/Sources/epoch_code/gui/scripts/inventory/EPOCH_Inventory_itempGroup.sqf new file mode 100644 index 00000000..d873f74e --- /dev/null +++ b/Sources/epoch_code/gui/scripts/inventory/EPOCH_Inventory_itempGroup.sqf @@ -0,0 +1,20 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/inventory/EPOCH_Inventory_itempGroup.sqf +*/ +disableSerialization; +(findDisplay 602) closeDisplay 0; +if !(Epoch_invited_tempGroupUIDs isEqualTo[]) exitWith { + createDialog "tempGroupRequests"; +}; +["No pending requests", 5] call Epoch_message; diff --git a/Sources/epoch_code/gui/scripts/inventory/EPOCH_Inventory_tempGroup.sqf b/Sources/epoch_code/gui/scripts/inventory/EPOCH_Inventory_tempGroup.sqf new file mode 100644 index 00000000..3199aacc --- /dev/null +++ b/Sources/epoch_code/gui/scripts/inventory/EPOCH_Inventory_tempGroup.sqf @@ -0,0 +1,17 @@ +/* + Author: Niklas Wagner - EpochMod.com + + Contributors: Aaron Clark + + Description: + TODO: DESC-TBA + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/inventory/EPOCH_Inventory_tempGroup.sqf +*/ +disableSerialization; +(findDisplay 602) closeDisplay 0; +createDialog (if ((Epoch_my_tempGroupUID == "") && (Epoch_my_tempGroup isEqualTo [])) then {"EPOCH_createTempGrp"} else {"Epoch_myTempGroup"}); diff --git a/Sources/epoch_code/init/client_init.sqf b/Sources/epoch_code/init/client_init.sqf index 8f7fd5c0..93e79177 100644 --- a/Sources/epoch_code/init/client_init.sqf +++ b/Sources/epoch_code/init/client_init.sqf @@ -42,6 +42,11 @@ Epoch_invited_GroupName = ""; Epoch_invited_GroupUIDs = []; Epoch_invited_GroupUIDsPrev = []; Epoch_my_Group = []; +Epoch_invited_tempGroupUID = ""; +Epoch_invited_tempGroupName = ""; +Epoch_invited_tempGroupUIDs = []; +Epoch_invited_tempGroupUIDsPrev = []; +Epoch_my_tempGroup = []; EPOCH_lastPlayerPos = [0,0,0]; EPOCH_prevOffer = []; EPOCH_drawIcon3d = false; diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp index 7f1a9a0d..d6b01299 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp @@ -34,12 +34,26 @@ class player_inspect icon = "x\addons\a3_epoch_code\Data\UI\buttons\player_inspect.paa"; tooltip = "Examine"; }; -class player_group_menu +class Groups { condition = "true"; - action = "call EPOCH_Inventory_Group;"; + action = ""; icon = "x\addons\a3_epoch_code\Data\UI\buttons\group_menu_ca.paa"; - tooltip = "Group Menu"; + tooltip = "Groups Menu"; + class Group + { + condition = "true"; + action = "call EPOCH_Inventory_Group;"; + icon = "perm_group_menu_ca.paa";//"x\addons\a3_epoch_code\Data\UI\buttons\perm_group_menu_ca.paa"; + tooltip = "Perm Group Menu"; + }; + class TempGroup + { + condition = "true"; + action = "call EPOCH_Inventory_TempGroup;"; + icon = "temp_group_menu_ca.paa";//"x\addons\a3_epoch_code\Data\UI\buttons\temp_group_menu_ca.paa"; + tooltip = "Temp Group Menu"; + }; }; class player_group_requests { @@ -48,6 +62,13 @@ class player_group_requests icon = "x\addons\a3_epoch_code\Data\UI\buttons\group_requests_ca.paa"; tooltip = "Group Requests"; }; +class player_tempGroup_requests +{ + condition = "!(Epoch_invited_tempGroupUIDs isEqualTo[])"; + action = "call EPOCH_Inventory_itempGroup;"; + icon = "x\addons\a3_epoch_code\Data\UI\buttons\group_requests_ca.paa"; + tooltip = "Temp Group Requests"; +}; class base_mode_enable { diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index d65b93db..5edf9f9e 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -295,11 +295,31 @@ class CfgClientFunctions class iGroup_refresh {}; class Group_update {}; }; + class groupTemp + { + file = "epoch_code\gui\scripts\groupTemp"; + class tempGroup_invitePlayer {}; + class tempGroup_BtnMod {}; + class tempGroup_BtnInvite {}; + class tempGroup_onLoad {}; + class tempGroup_List {}; + class tempGroup_Combo {}; + class tempGroup_BtnLeave {}; + class tempGroup_BtnKick {}; + class cTempGroup_onLoad {}; + class cTempGroup_BtnCreate {}; + class iTempGroup_acceptInvite {}; + class iTempGroup_onLoad {}; + class iTempGroup_refresh {}; + class tempGroup_update {}; + }; class gui_inventory { file = "epoch_code\gui\scripts\inventory"; class Inventory_Group {}; class Inventory_iGroup {}; + class Inventory_tempGroup {}; + class Inventory_itempGroup {}; }; class gui_missions { diff --git a/Sources/epoch_config/Configs/CfgRemoteExec.hpp b/Sources/epoch_config/Configs/CfgRemoteExec.hpp index 8a5c5dec..143592fa 100644 --- a/Sources/epoch_config/Configs/CfgRemoteExec.hpp +++ b/Sources/epoch_config/Configs/CfgRemoteExec.hpp @@ -315,6 +315,31 @@ class CfgRemoteExec { allowedTargets = 1; jip = 0; + }; + class EPOCH_server_createTempGroup + { + allowedTargets = 2; + jip = 0; + }; + class EPOCH_server_invitePlayerTemp + { + allowedTargets = 2; + jip = 0; + }; + class EPOCH_server_updatePlayerTempGroup + { + allowedTargets = 2; + jip = 0; + }; + class EPOCH_server_deleteTempGroup + { + allowedTargets = 2; + jip = 0; + }; + class EPOCH_server_upgradeTempGroup + { + allowedTargets = 2; + jip = 0; }; }; class Commands diff --git a/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_createTempGroup.sqf b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_createTempGroup.sqf new file mode 100644 index 00000000..2ff2f93c --- /dev/null +++ b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_createTempGroup.sqf @@ -0,0 +1,56 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Add HiveFunction: Create Group / Set Data + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_createTempGroup.sqf + + Return: + + true = group has been created and / or successfully saved! + false = group exist already and hasn't been saved! +*/ +//[[[cog import generate_private_arrays ]]] +private ["_cIndex","_contentArray","_current_crypto","_groupID","_groupName","_leaderName","_playerCryptoLimit","_return","_textArr","_upgradePrice","_vars"]; +//[[[end]]] +params ["_leader", "_groupName", ["_token","",[""]] ]; +if !([_leader, _token] call EPOCH_server_getPToken) exitWith{}; + +_return = false; +_textArr = toArray(_groupName); + +if (count _textArr > 24) exitWith{}; +// remove any disallowed chars in group name "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -_" +{ + if !(_x in [97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,49,50,51,52,53,54,55,56,57,48,32,45,95]) then { + _textArr = _textArr - [_x]; + }; +} forEach _textArr; +_groupName = toString _textArr; + +if (_groupName != "") then { + + _groupID = getPlayerUID _leader; + + _leaderName = if (alive _leader) then {name _leader} else {"Dead Player"}; + + _contentArray = [_groupName, _leaderName, EPOCH_group_upgrade_lvl_SEPXVar select 0, [], []]; + + [["tempGroupUpdate", _contentArray], _leader] call EPOCH_sendRemoteExecClient; + [["tempGroupUidUpdate", _groupID], _leader] call EPOCH_sendRemoteExecClient; + + _leader setVariable ["TEMPGROUP", _groupID]; + _leader setVariable ["TEMPGROUPARRAY",_contentArray]; + + // Save Group Data + //["TempGroup", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET; + _return = true; +}; +_return diff --git a/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_deleteTempGroup.sqf b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_deleteTempGroup.sqf new file mode 100644 index 00000000..ced8febb --- /dev/null +++ b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_deleteTempGroup.sqf @@ -0,0 +1,50 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Delete Group + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_deleteTempGroup.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_groupID","_return"]; +//[[[end]]] +params ["_player",["_token","",[""]] ]; + +if !([_player, _token] call EPOCH_server_getPToken) exitWith{}; + +_return = false; +_groupID = getPlayerUID _player; +if (_groupID != "") then { + + { + _group = grpNull; + _permGroup = _x getVariable["GROUP",""]; + if !(_permGroup isEqualTo "")then + { + { + if ((_x getVariable["GROUP",""]) == _groupID) exitWith { + _group = group _x; + }; + } forEach _allPlayers; + }; + + _x setVariable ["TEMPGROUP", nil]; + [["resetTempGroup", true], _x] call EPOCH_sendRemoteExecClient; + [["tempGroupUpdate", []], _x] call EPOCH_sendRemoteExecClient; + if (isNull _group) then { + _group = createGroup [west, true]; + }; + [_x] joinSilent _group; + } forEach (allPlayers select {(_x getVariable["TEMPGROUP", ""]) == _groupID}); + + //_return = ["TempGroup", _groupID] call EPOCH_fnc_server_hiveDEL; + _return = true; +}; +_return diff --git a/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_invitePlayerTemp.sqf b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_invitePlayerTemp.sqf new file mode 100644 index 00000000..2639e02e --- /dev/null +++ b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_invitePlayerTemp.sqf @@ -0,0 +1,20 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Invite Player + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_inviteTempPlayer.sqf +*/ +params ["_playerUID","_var1","_var2","_player",["_token","",[""]]]; +if !([_player, _token] call EPOCH_server_getPToken) exitWith{}; + +{ + [_var1, _var2] remoteExec ['EPOCH_tempGroup_invitePlayer',_x]; +} forEach (allPlayers select {getPlayerUID _x == _playerUID}); diff --git a/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_updatePlayerTempGroup.sqf b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_updatePlayerTempGroup.sqf new file mode 100644 index 00000000..e8f772b9 --- /dev/null +++ b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_updatePlayerTempGroup.sqf @@ -0,0 +1,140 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Add or remove members from a group + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_updatePlayerTempGroup.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_allPlayers","_contentArray","_found","_group","_memberrange","_modOrMember","_modOrMemberArray","_modOrMemberRevert","_removePlayerArray","_response","_selectedPlayerName","_playerObj"]; +//[[[end]]] +params [["_groupID",""],["_selectedPlayerUID",""],["_addOrRemove",false],["_modOrMemberVar",true],["_player",objnull],["_token",""]]; + +if !([_player, _token] call EPOCH_server_getPToken) exitWith {}; + +if (_groupID == "") exitWith{ diag_log format["Epoch: GROUP: No Temp Group Selected %1", _this]; }; + +diag_log format["Epoch: Temp GROUP: Update %1", _this]; + +_modOrMember = if (_modOrMemberVar) then [{3},{4}]; +_modOrMemberRevert = if (_modOrMemberVar) then [{4},{3}]; +_contentArray = []; +{ + _contentArray = _x getVariable ["TEMPGROUPARRAY",[]]; +} forEach (allPlayers select {getPlayerUID _x == _groupID}); +diag_log format["eXpochDEBUG:1 _contentArray:%1",_contentArray]; + +//_response = ["TempGroup", _groupID] call EPOCH_fnc_server_hiveGETRANGE; +if !(_contentArray isEqualTo []) then { + + _contentArray params ["_groupName","_leaderName","_groupSize","_modArray","_memberArray"]; + _allPlayers = allPlayers select {alive _x}; + + if (_addOrRemove) then { //Add + _selectedPlayerName = "Dead Player"; + + { + _selectedPlayerName = if (alive _x) then {name _x}; + if ((_x getVariable ["TEMPGROUP",""]) != _groupID) then { + _group = grpNull; + { + if ((_x getVariable["TEMPGROUP",""]) == _groupID) exitWith { + _group = group _x; + }; + } forEach _allPlayers; + + if (isNull _group) then { + _group = createGroup [west, true]; + }; + _x setVariable ["TEMPGROUP", _groupID]; + [["tempGroupUidUpdate", _groupID], _x] call EPOCH_sendRemoteExecClient; + [_x] joinSilent _group; + }; + } forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID}); + + // find player name from DB + if (_selectedPlayerName == "Dead Player") then { + _memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE; + if (count (_memberrange select 1) > 0) then { + if (typename (_memberrange select 1 select 0) == "STRING") then { + _selectedPlayerName = _memberrange select 1 select 0; + }; + }; + }; + + _removePlayerArray = _contentArray select _modOrMemberRevert; + + { + if (_x select 0 == _selectedPlayerUID) exitWith { + _removePlayerArray deleteAt _forEachIndex; + _contentArray set [_modOrMemberRevert, _removePlayerArray]; + }; + } forEach _removePlayerArray; + + _modOrMemberArray = _contentArray select _modOrMember; + _modOrMemberArray pushBack [_selectedPlayerUID, _selectedPlayerName]; + + _contentArray set [_modOrMember, _modOrMemberArray]; + + } else { + + //Remove + _found = false; + _group = grpNull; + { + _permGroup = _x getVariable["GROUP",""]; + _playerObj = _x; + } forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID}); + if !(_permGroup isEqualTo "")then + { + { + if ((_x getVariable["GROUP",""]) == _groupID) exitWith { + _group = group _x; + }; + } forEach _allPlayers; + }; + _playerObj setVariable ["TEMPGROUP", nil]; + if (isNull _group) then { + _group = createGroup [west, true]; + }; + [_playerObj] joinSilent _group; + [["resetTempGroup", true], _playerObj] call EPOCH_sendRemoteExecClient; + [["tempGroupUpdate", []], _playerObj] call EPOCH_sendRemoteExecClient; + { + if (_x select 0 == _selectedPlayerUID) exitWith { + _memberArray deleteAt _forEachIndex; + _found = true; + }; + } forEach _memberArray; + + if (_found) then { + _contentArray set [4, _memberArray]; + } else { + { + if (_x select 0 == _selectedPlayerUID) exitWith { + _modArray deleteAt _forEachIndex; + _found = true; + }; + } forEach _modArray; + _contentArray set [3, _modArray]; + }; + + if (!_found) then { + diag_log format ["Epoch: %1 cannot remove Player! (%1)", __FILE__, _this] + }; + }; + + { + [["tempGroupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient; + } forEach (_allPlayers select {(_x getVariable["TEMPGROUP", ""]) == _groupID}); + + // Save Group Data + //["TempGroup", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET; +}; diff --git a/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_upgradeTempGroup.sqf b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_upgradeTempGroup.sqf new file mode 100644 index 00000000..208463d5 --- /dev/null +++ b/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_upgradeTempGroup.sqf @@ -0,0 +1,52 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Upgrade group size + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_grouptemp/EPOCH_server_upgradeTempGroup.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_cIndex","_contentArray","_current_crypto","_found","_groupMemberPUID","_newGroupSize","_playerCryptoLimit","_response","_return","_upgradePrice","_vars"]; +//[[[end]]] +params ["_groupID","_player",["_token","",[""]] ]; +if !([_player, _token] call EPOCH_server_getPToken) exitWith{}; + +_return = false; + +// [_groupName, _leaderName, _groupSize, _modArray, _memberArray] +//_response = ["TempGroup", _groupID] call EPOCH_fnc_server_hiveGETRANGE; +if ((_response select 0) == 1 && (_response select 1) isEqualType []) then { + _contentArray = (_response select 1); + _found = EPOCH_group_upgrade_lvl_SEPXVar find (_contentArray select 2); + + if ((_found != -1) && count EPOCH_group_upgrade_lvl_SEPXVar >= (_found + 3)) then { + _newGroupSize = EPOCH_group_upgrade_lvl_SEPXVar select (_found + 2); + + _upgradePrice = parseNumber (EPOCH_group_upgrade_lvl_SEPXVar select (_found+3)); + + _contentArray set [2, _newGroupSize]; + + _groupMemberPUID = [_groupID]; + { + { + _groupMemberPUID pushback(_x select 0); + } forEach _x; + } forEach [_contentArray select 3, _contentArray select 4]; + + { + [["tempGroupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient; + } forEach (allPlayers select {getPlayerUID _x in _groupMemberPUID}); + + // Save Group Data + //_return = ["TempGroup", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET; + _return = true; + }; +}; +_return diff --git a/Sources/epoch_server/config.cpp b/Sources/epoch_server/config.cpp index 872391ba..4aefbf34 100644 --- a/Sources/epoch_server/config.cpp +++ b/Sources/epoch_server/config.cpp @@ -27,6 +27,13 @@ class CfgServerFunctions class server_deleteGroup {}; class server_invitePlayer {}; }; + class epoch_grouptemp { + class server_upgradeTempGroup {}; + class server_updatePlayerTempGroup {}; + class server_createTempGroup {}; + class server_deleteTempGroup {}; + class server_invitePlayerTemp {}; + }; class epoch_bases { class swapBuilding {}; class saveBuilding {}; diff --git a/Sources/epoch_server_settings/configs/security/security_checks.h b/Sources/epoch_server_settings/configs/security/security_checks.h index 26caadc2..de8285fd 100644 --- a/Sources/epoch_server_settings/configs/security/security_checks.h +++ b/Sources/epoch_server_settings/configs/security/security_checks.h @@ -21,12 +21,15 @@ class CfgSecConf }; class remoteExecClient{ - functions[] = {"bankBalance", "resetGroup", "groupUpdate", "groupUidUpdate", "healPlayer","tradeComplete"}; + functions[] = {"bankBalance", "resetGroup", "groupUpdate", "groupUidUpdate", "healPlayer","tradeComplete","resetTempGroup","tempGroupUpdate","tempGroupUidUpdate"}; // code bankBalance = "EPOCH_bankBalance = _this;"; resetGroup = "Epoch_my_Group = []; Epoch_my_GroupUID = '';"; groupUpdate = "Epoch_my_Group = _this; call EPOCH_Group_update;"; groupUidUpdate = "Epoch_my_GroupUID = _this;"; + resetTempGroup = "Epoch_my_tempGroup = []; Epoch_my_tempGroupUID = '';"; + tempGroupUpdate = "Epoch_my_tempGroup = _this; call EPOCH_tempGroup_update;"; + tempGroupUidUpdate = "Epoch_my_tempGroupUID = _this;"; healPlayer = "{missionNamespace setVariable[format['EPOCH_player%1', _x], EPOCH_defaultVars select(EPOCH_customVars find _x)]} forEach['Temp','Hunger','Thirst','Toxicity','Stamina','HitPoints','BloodP','Alcohol','Radiation'];"; tradeComplete = "EPOCH_TRADE_COMPLETE = _this;"; };