summaryrefslogtreecommitdiffstats
path: root/Client/GUI
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
commite670b4ed55c459a21090bd0178ceaaaf12d87989 (patch)
treeb6833d5e842475f0ee27f5f617096445fdd4e4a1 /Client/GUI
downloada2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.gz
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.bz2
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.zip
init
Diffstat (limited to '')
-rw-r--r--Client/GUI/GUI_ArtilleryMenu.sqf649
-rw-r--r--Client/GUI/GUI_BuyUnits.sqf453
-rw-r--r--Client/GUI/GUI_ClearCurrentCutDisplay.sqf1
-rw-r--r--Client/GUI/GUI_CommandMenu.sqf53
-rw-r--r--Client/GUI/GUI_CommanderMenu.sqf159
-rw-r--r--Client/GUI/GUI_Display_Parameters.sqf30
-rw-r--r--Client/GUI/GUI_EASA.sqf50
-rw-r--r--Client/GUI/GUI_EndOfGameStats.sqf184
-rw-r--r--Client/GUI/GUI_GearAce.sqf1415
-rw-r--r--Client/GUI/GUI_GearBeta.sqf1057
-rw-r--r--Client/GUI/GUI_GearV.sqf774
-rw-r--r--Client/GUI/GUI_Menu.sqf161
-rw-r--r--Client/GUI/GUI_Menu_BuyUnits.sqf466
-rw-r--r--Client/GUI/GUI_Menu_Command.sqf532
-rw-r--r--Client/GUI/GUI_Menu_EASA.sqf48
-rw-r--r--Client/GUI/GUI_Menu_Economy.sqf239
-rw-r--r--Client/GUI/GUI_Menu_Respawn.sqf161
-rw-r--r--Client/GUI/GUI_Menu_Service.sqf254
-rw-r--r--Client/GUI/GUI_Menu_Tactical.sqf659
-rw-r--r--Client/GUI/GUI_Menu_Team.sqf145
-rw-r--r--Client/GUI/GUI_Menu_UnitCamera.sqf89
-rw-r--r--Client/GUI/GUI_Menu_Upgrade.sqf223
-rw-r--r--Client/GUI/GUI_Menu_Voting.sqf75
-rw-r--r--Client/GUI/GUI_MissionTasks.sqf65
-rw-r--r--Client/GUI/GUI_Parameters.sqf23
-rw-r--r--Client/GUI/GUI_Respawn.sqf156
-rw-r--r--Client/GUI/GUI_SetCurrentCutDisplay.sqf1
-rw-r--r--Client/GUI/GUI_SupportMenu.sqf271
-rw-r--r--Client/GUI/GUI_TeamMenu.sqf174
-rw-r--r--Client/GUI/GUI_TeamOrders.sqf571
-rw-r--r--Client/GUI/GUI_UnitsCamera.sqf91
-rw-r--r--Client/GUI/GUI_UpdateCommanderVoteMenu.sqf74
-rw-r--r--Client/GUI/GUI_Upgrade.sqf198
33 files changed, 9501 insertions, 0 deletions
diff --git a/Client/GUI/GUI_ArtilleryMenu.sqf b/Client/GUI/GUI_ArtilleryMenu.sqf
new file mode 100644
index 0000000..82aec12
--- /dev/null
+++ b/Client/GUI/GUI_ArtilleryMenu.sqf
@@ -0,0 +1,649 @@
+
+private ["_canFT","_startPoint","_closest","_sorted","_buildings","_checks","_sideID","_camps","_allCamps","_locations","_skip","_FTLocations","_markerName","_markers","_i","_lastUpdate","_base","_isDeployed","_currentLevel","_commander","_enable","_callPos","_travelingWith","_destination","_compass","_GPS","_pad","_radio","_watch","_locationPosition","_camera","_delay","_obj","_nukeMarker","_fireTime","_status","_txt","_units","_currentUpgrades","_funds","_lastRange","_display","_ftr","_marker","_area","_map","_pard","_IDCS"];
+disableSerialization;
+
+_display = _this select 0;
+_lastRange = artyRange;
+_lastUpdate = 0;
+_listBox = 17019;
+
+sliderSetRange[17005,10,'WFBE_MAXARTILLERYAREA' Call GetNamespace];
+sliderSetPosition[17005,artyRange];
+
+ctrlSetText [17025,localize "STR_WF_ArtilleryOverview" + " :"];
+
+_markers = [];
+_FTLocations = [];
+_checks = [];
+_fireTime = 0;
+_status = 0;
+_canFT = false;
+_forceReload = true;
+_ft = 'WFBE_FASTTRAVEL' Call GetNamespace;
+_ftr = 'WFBE_FASTTRAVELRANGE' Call GetNamespace;
+_startPoint = objNull;
+
+_marker = "artilleryMarker";
+createMarkerLocal [_marker,artyPos];
+_marker setMarkerTypeLocal "mil_destroy";
+_marker setMarkerColorLocal "ColorRed";
+_marker setMarkerSizeLocal [1,1];
+
+_area = "artilleryAreaMarker";
+createMarkerLocal [_area,artyPos];
+_area setMarkerShapeLocal "Ellipse";
+_area setMarkerColorLocal "ColorRed";
+_area setMarkerSizeLocal [artyRange,artyRange];
+
+_map = _display DisplayCtrl 17002;
+_listboxControl = _display DisplayCtrl _listBox;
+
+_pard = 'WFBE_PARADELAY' Call GetNamespace;
+{lbAdd[17008,_x]} forEach (Format ["WFBE_%1_ARTILLERY_DESC",sideJoinedText] Call GetNamespace);
+lbSetCurSel[17008,0];
+
+_IDCS = [17005,17006,17007,17008];
+if !(paramArty) then {{ctrlEnable [_x,false]} forEach _IDCS};
+
+{ctrlEnable [_x, false]} forEach [17010,17011,17012,17013,17014,17015,17017,17018,17020];
+
+MenuAction = -1;
+mouseButtonUp = -1;
+_currentValue = -1;
+_currentFee = -1;
+_currentSpecial = "";
+_currentFee = -1;
+
+//--- Support List.
+_lastSel = -1;
+_addToList = [localize 'STR_WF_FastTravel',localize 'STR_WF_ICBM',localize 'STR_WF_Paradrop_Ammo',localize 'STR_WF_Paradrop_Vehicle',localize 'STR_WF_Paratroop',localize 'STR_WF_UnitCam',localize 'STR_WF_UAV',localize 'STR_WF_UAV_Destroy',localize 'STR_WF_UAV_RemoteControl'];
+_addToListID = ["Fast_Travel","ICBM","Paradrop_Ammo","Paradrop_Vehicle","Paratroopers","Units_Camera","UAV","UAV_Destroy","UAV_Remote_Control"];
+_addToListFee = [0,150000,9500,3500,8500,0,12500,0,0];
+_addToListInterval = [0,1000,800,600,900,0,0,0,0];
+
+for '_i' from 0 to count(_addToList)-1 do {
+ lbAdd [_listBox,_addToList select _i];
+ lbSetValue [_listBox, _i, _i];
+};
+
+lbSort _listboxControl;
+
+//--- Artillery Mode.
+_mode = 'WFBE_V_ARTILLERYMINMAP' Call GetNamespace;
+if (isNil '_mode') then {_mode = 2;['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace};
+_trackingArray = [];
+_trackingArrayID = [];
+_lastArtyUpdate = -60;
+_minRange = 100;
+_maxRange = 200;
+_requestMarkerTransition = false;
+_requestRangedList = true;
+_startLoad = true;
+
+//--- Startup coloration.
+with uinamespace do {
+ currentBEDialog = _display;
+ switch (_mode) do {
+ case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]};
+ case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]};
+ case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]};
+ };
+};
+
+lbSetCurSel[_listbox, 0];
+
+_textAnimHandler = [] spawn {};
+
+while {alive player && dialog} do {
+ if (side player != sideJoined) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers;closeDialog 0};
+ if (!dialog) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers};
+
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+
+ if (_ft > 0) then {
+ //--- TODO: Travel fee, mod parameter > FT free or pay, do a clt fct.
+ _currentLevel = _currentUpgrades select 12;
+ if (time - _lastUpdate > 15 && _currentLevel > 0) then {
+ {deleteMarkerLocal _x} forEach _markers;
+ _markers = [];
+ _FTLocations = [];
+ _canFT = false;
+ _startPoint = objNull;
+ _lastUpdate = time;
+ _base = (sideJoinedText) Call GetSideHQ;
+ _isDeployed = (sideJoinedText) Call GetSideHQDeployed;
+ if (player distance _base < _ftr && alive _base && vehicle player != _base && _isDeployed) then {
+ _canFT = true;
+ _startPoint = _base;
+ } else {
+ _sorted = [player,towns] Call SortByDistance;
+ _closest = _sorted select 0;
+ _sideID = _closest getVariable "sideID";
+ _camps = [_closest,sideJoined] Call GetFriendlyCamps;
+ _allCamps = _closest getVariable "camps";
+ if (_sideID == sideID && player distance _closest < _ftr && (count _camps == count _allCamps)) then {_canFT = true;_startPoint = _closest} else {
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;
+ if (count _checks > 0) then {
+ _sorted = [player,_checks] Call SortByDistance;
+ _closest = _sorted select 0;
+ if (player distance _closest < _ftr) then {
+ _canFT = true;
+ _closest = _sorted select 0;
+ _startPoint = _closest;
+ };
+ };
+ };
+ };
+ if (!canMove (vehicle player)) then {_canFT = false};
+ if (_canFT) then {
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;
+ _locations = towns + _checks;
+ if (alive _base && _isDeployed) then {_locations = _locations + [_base]};
+ _i = 0;
+ _fee = 0;
+ _funds = if (_ft == 2) then {Call GetPlayerFunds} else {0};
+ {
+ if (_x distance player <= ('WFBE_FASTTRAVELMAXRANGE' Call GetNamespace) && _x distance player > _ftr) then {
+ _skip = false;
+ if (_x in towns) then {
+ _sideID = _x getVariable "sideID";
+ _camps = [_x,sideJoined] Call GetFriendlyCamps;
+ _allCamps = _x getVariable "camps";
+ if (_sideID != sideID || (count _camps != count _allCamps)) then {_skip = true};
+ if (_ft == 2) then {
+ _fee = round(((_x distance player)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace));
+ if (_funds < _fee) then {_skip = true};
+ };
+ };
+ if !(_skip) then {
+ _FTLocations = _FTLocations + [_x];
+ _markerName = Format ["FTMarker%1",_i];
+ _markers = _markers + [_markerName];
+ createMarkerLocal [_markerName,getPos _x];
+ _markerName setMarkerTypeLocal "mil_circle";
+ _markerName setMarkerColorLocal "ColorYellow";
+ _markerName setMarkerSizeLocal [1,1];
+ //--- Fee, Cheap marker stuff, TBD: Add prompt or something.
+ if (_ft == 2) then {
+ _markerName = Format ["FTMarker%1%1",_i];
+ _markers = _markers + [_markerName];
+ createMarkerLocal [_markerName,[(getPos _x select 0)-5,(getPos _x select 1)+75]];
+ _markerName setMarkerTypeLocal "mil_circle";
+ _markerName setMarkerColorLocal "ColorYellow";
+ _markerName setMarkerSizeLocal [0,0];
+ _markerName setMarkerTextLocal Format ["$ %1.",_fee];
+ };
+ _i = _i + 1;
+ };
+ };
+ } forEach _locations;
+ };
+ };
+ };
+
+ _currentSel = lbCurSel(_listBox);
+
+ //--- Special changed or a reload is requested.
+ if (_currentSel != _lastSel || _forceReload) then {
+ _currentValue = lbValue[_listBox, _currentSel];
+
+ _currentSpecial = _addToListID select _currentValue;
+ _currentFee = _addToListFee select _currentValue;
+ _currentInterval = _addToListInterval select _currentValue;
+
+ _forceReload = false;
+ _controlEnable = false;
+
+ _funds = Call GetPlayerFunds;
+
+ ctrlSetText[17021,Format ["%1: $%2.",localize 'STR_WF_Price',_currentFee]];
+
+ //--- Enabled or disabled?
+ switch (_currentSpecial) do {
+ case "Fast_Travel": {
+ if (_ft > 0) then {
+ _currentLevel = _currentUpgrades select 12;
+ _controlEnable = if (count _FTLocations > 0 && _currentLevel > 0) then {true} else {false};
+ };
+ };
+ case "ICBM": {
+ if (paramICBM) then {
+ _commander = false;
+ if (!isNull(commanderTeam)) then {
+ if (commanderTeam == group player) then {_commander = true};
+ };
+ _currentLevel = _currentUpgrades select 11;
+ _controlEnable = if (_currentLevel > 0 && _commander && _funds >= _currentFee) then {true} else {false};
+ };
+ };
+ case "Paratroopers": {
+ _currentLevel = _currentUpgrades select 4;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastParaCall > _currentInterval) then {true} else {false};
+ };
+ case "Paradrop_Ammo": {
+ _currentLevel = _currentUpgrades select 16;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false};
+ };
+ case "Paradrop_Vehicle": {
+ _currentLevel = _currentUpgrades select 16;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false};
+ };
+ case "UAV": {
+ _currentLevel = _currentUpgrades select 5;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && !(alive playerUAV)) then {true} else {false};
+ };
+ case "UAV_Destroy": {
+ _controlEnable = if (alive playerUAV) then {true} else {false};
+ };
+ case "UAV_Remote_Control": {
+ _controlEnable = if (alive playerUAV) then {true} else {false};
+ };
+ case "Units_Camera": {
+ _controlEnable = commandInRange;
+ };
+ };
+
+ ctrlEnable[17020, _controlEnable];
+ };
+
+ //--- Action triggered.
+ if (MenuAction == 20) then {
+ MenuAction = -1;
+
+ //--- Output.
+ switch (_currentSpecial) do {
+ case "Fast_Travel": {
+ MenuAction = 7;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim;
+ };
+ case "ICBM": {
+ MenuAction = 8;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim;
+ };
+ case "Paratroopers": {
+ MenuAction = 3;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim;
+ };
+ case "Paradrop_Ammo": {
+ MenuAction = 10;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim;
+ };
+ case "Paradrop_Vehicle": {
+ MenuAction = 9;
+
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim;
+ };
+ case "UAV": {
+ closeDialog 0;
+ ExecVM "Client\Module\UAV\uav.sqf";
+ };
+ case "UAV_Destroy": {
+ if !(isNull playerUAV) then {
+ {_x setDammage 1} forEach (crew playerUAV);
+ playerUAV setDammage 1;
+ playerUAV = objNull;
+ };
+ };
+ case "UAV_Remote_Control": {
+ closeDialog 0;
+ ExecVM "Client\Module\UAV\uav.sqf";
+ };
+ case "Units_Camera": {
+ closeDialog 0;
+ createDialog "RscUnitCamera";
+ };
+ };
+
+ _forceReload = true;
+ };
+
+ artyRange = floor (sliderPosition 17005);
+ if (_lastRange != artyRange) then {_area setMarkerSizeLocal [artyRange,artyRange];};
+
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ //--- Set Artillery Marker on map.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ artyPos = _map posScreenToWorld[mouseX,mouseY];
+ _marker setMarkerPosLocal artyPos;
+ _area setMarkerPosLocal artyPos;
+ _requestRangedList = true;
+ };
+ //--- Paratroops.
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ _callPos = _map posScreenToWorld[mouseX,mouseY];
+ if (!surfaceIsWater _callPos) then {
+ lastParaCall = time;
+ -(_currentFee) Call ChangePlayerFunds;
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF};
+ hint (localize "STR_WF_Paratroop_Info");
+ };
+ };
+ //--- Fast Travel.
+ if (MenuAction == 7) then {
+ MenuAction = -1;
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ _sorted = [_callPos,_FTLocations] Call SortByDistance;
+ if (_callPos distance (_sorted select 0) < 500) then {
+ closeDialog 0;
+ deleteMarkerLocal _marker;
+ deleteMarkerLocal _area;
+
+ _destination = _sorted select 0;
+
+ if (_ft == 2) then {
+ _fee = round(((player distance _destination)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace));
+ -(_fee) Call ChangePlayerFunds;
+ };
+
+ _travelingWith = [];
+ {if (_x distance _startPoint < _ftr && !(_x in _travelingWith) && canMove _x && !(vehicle _x isKindOf "StaticWeapon") && !stopped _x && !((currentCommand _x) in ["WAIT","STOP"])) then {_travelingWith = _travelingWith + [vehicle _x]}} forEach units (group player);
+
+ ForceMap true;
+ _compass = shownCompass;
+ _GPS = shownGPS;
+ _pad = shownPad;
+ _radio = shownRadio;
+ _watch = shownWatch;
+
+ showCompass false;
+ showGPS false;
+ showPad false;
+ showRadio false;
+ showWatch false;
+
+ mapAnimClear;
+ mapAnimCommit;
+
+ _locationPosition = getPos _destination;
+ _camera = "camera" camCreate _locationPosition;
+ _camera camSetDir 0;
+ _camera camSetFov 1;
+ _camera cameraEffect["Internal","TOP"];
+
+ _camera camSetTarget _locationPosition;
+ _camera camSetPos [_locationPosition select 0,(_locationPosition select 1) + 2,100];
+ _camera camCommit 0;
+
+ mapAnimAdd [0,0.05,GetPos _startPoint];
+ mapAnimCommit;
+
+ _delay = ((_startPoint distance _destination) / 50) * ('WFBE_FASTTRAVELTIMECOEF' Call GetNamespace);
+ mapAnimAdd [_delay,.18,getPos _destination];
+ mapAnimCommit;
+
+ waitUntil {mapAnimDone || !alive player};
+ _skip = false;
+ if (!alive player) then {_skip = true};
+ if (!_skip) then {
+ {[_x,_locationPosition,120] Call PlaceSafe} forEach _travelingWith;
+ };
+ sleep 1;
+
+ ForceMap false;
+ showCompass _compass;
+ showGPS _GPS;
+ showPad _pad;
+ showRadio _radio;
+ showWatch _watch;
+
+ _camera cameraEffect["TERMINATE","BACK"];
+ camDestroy _camera;
+ };
+ };
+ //--- ICBM Strike.
+ if (MenuAction == 8) then {
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ MenuAction = -1;
+ -_currentFee Call ChangePlayerFunds;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ _obj = "HeliHEmpty" createVehicle _callPos;
+ _nukeMarker = createMarkerLocal ["icbmstrike", position _obj];
+ _nukeMarker setMarkerTypeLocal "mil_warning";
+ _nukeMarker setMarkerTextLocal "ICBM";
+ _nukeMarker setMarkerColorLocal "ColorRed";
+ [_obj,_nukeMarker] Spawn NukeIncomming;
+ };
+ //--- Vehicle Paradrop.
+ if (MenuAction == 9) then {
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ MenuAction = -1;
+ lastSupplyCall = time;
+ -_currentFee Call ChangePlayerFunds;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF};
+ };
+ //--- Ammo Paradrop.
+ if (MenuAction == 10) then {
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ MenuAction = -1;
+ lastSupplyCall = time;
+ -_currentFee Call ChangePlayerFunds;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF};
+ };
+ };
+
+ //--- Update the Artillery Status.
+ if (paramArty) then {
+ _fireTime = (Format["WFBE_FIREMISSIONTIMEOUT%1",(_currentUpgrades select 10)] Call GetNamespace);
+ _status = round(_fireTime - (time - fireMissionTime));
+ _txt = if (time - fireMissionTime > _fireTime) then {Format['%1: <br /> %2',localize 'STR_WF_Status',localize 'STR_WF_Available']} else {Format ['%1: <br /> %2 %3',localize 'STR_WF_Status',_status,localize 'STR_WF_Seconds']};
+ (_display displayCtrl 17016) ctrlSetStructuredText (parseText _txt);
+ _enable = if (_status > 0) then {false} else {true};
+ ctrlEnable [17007,_enable];
+ };
+
+ //--- Request Fire Mission.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ _units = [Group player,false,lbCurSel(17008),sideJoinedText] Call GetTeamArtillery;
+ if (Count _units > 0) then {
+ fireMissionTime = time;
+ [GetMarkerPos "artilleryMarker",lbCurSel(17008)] Spawn RequestFireMission;
+ } else {
+ hint (localize "STR_WF_NoArty");
+ };
+ };
+
+ //--- Arty Combo Change or Script init.
+ if (MenuAction == 200 || _startLoad) then {
+ MenuAction = -1;
+
+ _index = lbCurSel(17008);
+ _minRange = (Format ["WFBE_%1_ARTILLERY_MINRANGES",sideJoined] Call GetNamespace) select _index;
+ _maxRange = (Format ["WFBE_%1_ARTILLERY_MAXRANGES",sideJoined] Call GetNamespace) select _index;
+
+ _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery;
+
+ _requestMarkerTransition = true;
+ _requestRangedList = true;
+ _startLoad = false;
+ };
+
+ //--- Focus on an artillery cannon.
+ if (MenuAction == 60) then {
+ MenuAction = -1;
+
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [1,.475,getPos(_trackingArray select (lnbCurSelRow 17024))];
+ ctrlMapAnimCommit _map;
+ };
+
+ //--- Flush on change.
+ if (_requestMarkerTransition) then {
+ _requestMarkerTransition = false;
+
+ {
+ _track = (_x select 0);
+ _vehicle = (_x select 1);
+
+ _vehicle setVariable ['WFBE_A_Tracked', nil];
+ deleteMarkerLocal Format ["WFBE_A_Large%1",_track];
+ deleteMarkerLocal Format ["WFBE_A_Small%1",_track];
+ } forEach _trackingArrayID;
+ _trackingArrayID = [];
+ };
+
+ //--- Artillery List.
+ if (paramArty && (_requestRangedList || time - _lastArtyUpdate > 3)) then {
+ _requestRangedList = false;
+
+ //--- No need to update the list all the time.
+ if (time - _lastArtyUpdate > 5) then {
+ _lastArtyUpdate = time;
+ _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery;
+ };
+
+ //--- Clear & Fill;
+ lnbClear 17024;
+ _i = 0;
+ {
+ _distance = _x distance (getMarkerPos _marker);
+ _color = [0, 0.875, 0, 0.8];
+ _text = "In Range";
+ if (_distance > _maxRange) then {_color = [0.875, 0, 0, 0.8];_text = "Out of Range"};
+ if (_distance <= _minRange) then {_color = [0.875, 0.5, 0, 0.8];_text = "Too close"};
+ lnbAddRow [17024,[[typeOf _x, 'displayName'] Call GetConfigInfo,_text]];
+ lnbSetPicture [17024,[_i,0],[typeOf _x, 'picture'] Call GetConfigInfo];
+
+ lnbSetColor [17024,[_i,0],_color];
+ lnbSetColor [17024,[_i,1],_color];
+
+ _i = _i + 1;
+ } forEach _trackingArray;
+ };
+
+ //--- Artillery map toggle.
+ if (MenuAction == 40) then {
+ MenuAction = -1;
+ if (_mode == -1) then {_mode = 0};
+ _mode = if (_mode == 2) then {0} else {_mode + 1};
+ with uinamespace do {
+ switch (_mode) do {
+ case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]};
+ case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]};
+ case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]};
+ };
+ };
+
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_ArtilleryMinimapInfo',7,"f05555"] spawn SetControlFadeAnim;
+
+ ['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace;
+
+ _requestMarkerTransition = true;
+ };
+
+ //--- Update artillery display.
+ if (_mode != -1) then {
+
+ //--- Nothing.
+ if (_mode == 0) then {
+ _requestMarkerTransition = true;
+ _mode = -1;
+ };
+
+ //--- Filled Content.
+ if (_mode == 1 || _mode == 2) then {
+ //--- Remove if dead or null or sel changed.
+ {
+ _track = (_x select 0);
+ _vehicle = (_x select 1);
+
+ if !(alive _vehicle) then {
+ deleteMarkerLocal Format ["WFBE_A_Large%1",_track];
+ deleteMarkerLocal Format ["WFBE_A_Small%1",_track];
+ };
+ } forEach _trackingArrayID;
+
+ //--- No need to update the marker all the time.
+ if (time - _lastArtyUpdate > 5) then {
+ _lastArtyUpdate = time;
+ _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery;
+ };
+
+ //--- Live Feed.
+ _trackingArrayID = [];
+ {
+ _track = _x getVariable 'WFBE_A_Tracked';
+ if (isNil '_track') then {
+ _track = buildingMarker;
+ buildingMarker = buildingMarker + 1;
+ _x setVariable ['WFBE_A_Tracked', _track];
+ _dmarker = Format ["WFBE_A_Large%1",_track];
+ createMarkerLocal [_dmarker, getPos _x];
+ _dmarker setMarkerColorLocal "ColorBlue";
+ _dmarker setMarkerShapeLocal "ELLIPSE";
+ _brush = "SOLID";
+ if (_mode == 1) then {_brush = "SOLID"};
+ if (_mode == 2) then {_brush = "BORDER"};
+ _dmarker setMarkerBrushLocal _brush;
+ _dmarker setMarkerAlphaLocal 0.4;
+ _dmarker setMarkerSizeLocal [_maxRange,_maxRange];
+ _dmarker = Format ["WFBE_A_Small%1",_track];
+ createMarkerLocal [_dmarker, getPos _x];
+ _dmarker setMarkerColorLocal "ColorBlack";
+ _dmarker setMarkerShapeLocal "ELLIPSE";
+ _dmarker setMarkerBrushLocal "SOLID";
+ _dmarker setMarkerAlphaLocal 0.4;
+ _dmarker setMarkerSizeLocal [_minRange,_minRange];
+ } else {
+ _dmarker = Format ["WFBE_A_Large%1",_track];
+ _dmarker setMarkerPosLocal (getPos _x);
+ _dmarker = Format ["WFBE_A_Small%1",_track];
+ _dmarker setMarkerPosLocal (getPos _x);
+ };
+ _trackingArrayID = _trackingArrayID + [[_track,_x]];
+ } forEach _trackingArray;
+ };
+ };
+
+ _lastRange = artyRange;
+ _lastSel = lbCurSel(_listbox);
+ sleep 0.1;
+};
+
+deleteMarkerLocal _marker;
+deleteMarkerLocal _area;
+{deleteMarkerLocal _x} forEach _markers;
+
+if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+
+//--- Remove Markers.
+{
+ _track = (_x select 0);
+ _vehicle = (_x select 1);
+
+ _vehicle setVariable ['WFBE_A_Tracked', nil];
+
+ deleteMarkerLocal Format ["WFBE_A_Large%1",_track];
+ deleteMarkerLocal Format ["WFBE_A_Small%1",_track];
+} forEach _trackingArrayID; \ No newline at end of file
diff --git a/Client/GUI/GUI_BuyUnits.sqf b/Client/GUI/GUI_BuyUnits.sqf
new file mode 100644
index 0000000..7f4799f
--- /dev/null
+++ b/Client/GUI/GUI_BuyUnits.sqf
@@ -0,0 +1,453 @@
+
+private ["_i","_break","_currentIDC","_type","_val","_con","_extra","_currentCost","_skip","_cpt","_size","_txt","_queu","_params","_funds","_currentRow","_currentValue","_unit","_currentUnit","_update","_driver","_updateDetails","_gunner","_commander","_factSel","_closest","_updateMap","_isLocked","_listUnits","_IDCS","_updateList","_nObjects","_sorted","_buildings","_factories","_countAlive","_nearest","_nearTown","_maxOut","_show","_c","_color","_slots","_isInfantry","_utype","_lastCheck","_value","_lastSel","_lastType","_disabledColor","_display","_enabledColor","_IDCLock","_IDCSVehi","_listBox","_comboFaction","_map","_mbu","_status","_statusLabel","_statusVals","_fillList","_changeFactionCombo"];
+disableSerialization;
+
+//--- Init.
+MenuAction = -1;
+
+_listUnits = [];
+
+_closest = objNull;
+_commander = false;
+_extracrew = false;
+_countAlive = 0;
+_currentCost = 0;
+_currentIDC = 0;
+_disabledColor = [0.4, 0.4, 0.4, 1];
+_display = _this select 0;
+_driver = false;
+_enabledColor = [1, 1, 1, 0.75];
+_gunner = false;
+_IDCLock = 12023;
+_IDCS = [12005,12006,12007,12008,12020,12021];
+_IDCSVehi = [12012,12013,12014,12041];
+_isInfantry = false;
+_isLocked = true;
+_lastCheck = 0;
+_lastSel = -1;
+_lastType = 'nil';
+_listBox = 12001;
+_comboFaction = 12026;
+_map = _display displayCtrl 12015;
+_sorted = [];
+_type = 'nil';
+_update = true;
+_updateDetails = true;
+_updateList = true;
+_updateMap = true;
+_val = 0;
+_mbu = 'WFBE_MAXGROUPSIZE' Call GetNamespace;
+
+ctrlSetText[12025,localize 'STR_WF_Faction' + ":"];
+
+//--- Get the closest Factory Type in range.
+_break = false;
+_status = [barracksInRange,lightInRange,heavyInRange,aircraftInRange,depotInRange,hangarInRange];
+_statusLabel = ['Barracks','Light','Heavy','Aircraft','Depot','Airport'];
+_statusVals = [0,1,2,3,4,3];
+for [{_i = 0},{(_i < 6) && !_break},{_i = _i + 1}] do {
+ if (_status select _i) then {
+ _break = true;
+ _currentIDC = _IDCS select _i;
+ _type = _statusLabel select _i;
+ _val = _statusVals select _i;
+ };
+};
+
+if (_type == 'nil') exitWith {closeDialog 0};
+
+//--- Destroy local variables.
+_break = nil;
+_status = nil;
+_statusLabel = nil;
+_statusVals = nil;
+
+//--- Enable the current IDC.
+_IDCS = _IDCS - [_currentIDC];
+{
+ _con = _display DisplayCtrl _x;
+ _con ctrlSetTextColor [0.4, 0.4, 0.4, 1];
+} forEach _IDCS;
+
+//--- Loop.
+while {alive player && dialog} do {
+ //--- Nothing in range? exit!.
+ if (!barracksInRange && !lightInRange && !heavyInRange && !aircraftInRange && !hangarInRange && !depotInRange) exitWith {closeDialog 0};
+ if (side player != sideJoined || !dialog) exitWith {closeDialog 0};
+
+ //--- Purchase.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ _currentRow = lnbCurSelRow _listBox;
+ _currentValue = lnbValue[_listBox,[_currentRow,0]];
+ _unit = _listUnits select _currentValue;
+ _currentUnit = _unit Call GetNamespace;
+ _currentCost = _currentUnit select QUERYUNITPRICE;
+ _cpt = 1;
+ if !(_isInfantry) then {
+ _extra = 0;
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ if (_commander) then {_extra = _extra + 1};
+ if (_extracrew) then {_extra = _extra + ((_currentUnit select QUERYUNITCREW) select 3)};
+ _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra);
+ };
+ if ((_currentRow) != -1) then {
+ _funds = Call GetPlayerFunds;
+ _skip = false;
+ if (_funds < _currentCost) then {_skip = true;hint parseText(Format[localize 'STR_WF_Funds_Missing',_currentCost - _funds,_currentUnit select QUERYUNITLABEL])};
+ if !(_skip) then {
+ _size = Count ((Units (group player)) Call GetLiveUnits);
+ //--- Get the infantry limit based off the infantry upgrade.
+ _realSize = ((sideJoined) Call GetSideUpgrades) select 0;
+ switch (_realSize) do {
+ case 0: {_realSize = round(_mbu / 4)};
+ case 1: {_realSize = round(_mbu / 4)*2};
+ case 2: {_realSize = round(_mbu / 4)*3};
+ case 3: {_realSize = _mbu};
+ default {_realSize = _mbu};
+ };
+ if (_isInfantry) then {if ((unitQueu + _size + 1) > _realSize) then {_skip = true;hint parseText(Format [localize 'STR_WF_MaxGroup',_realSize])}};
+
+ if (!_isInfantry && !_skip) then {
+ _cpt = 0;
+ if (_driver) then {_cpt = _cpt + 1};
+ if (_gunner) then {_cpt = _cpt + 1};
+ if (_commander) then {_cpt = _cpt + 1};
+ if (_extracrew) then {_cpt = _cpt + ((_currentUnit select QUERYUNITCREW) select 3)};
+ if ((unitQueu + _size + _cpt) > _realSize && _cpt != 0) then {_skip = true;hint parseText(Format [localize 'STR_WF_MaxGroup',_realSize])};
+ };
+ };
+ if !(_skip) then {
+ //--- Check the max queu.
+ if ((Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace) < (Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace)) then {
+ [Format["WFBE_C_QUEUE_%1",_type],(Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace)+1,true] Call SetNamespace;
+
+ _queu = _closest getVariable 'queu';
+ _txt = parseText(Format [localize 'STR_WF_BuyEffective',_currentUnit select QUERYUNITLABEL]);
+ if (!isNil '_queu') then {if (count _queu > 0) then {_txt = parseText(Format [localize 'STR_WF_Queu',_currentUnit select QUERYUNITLABEL])}};
+ hint _txt;
+ _params = if (_isInfantry) then {[_closest,_unit,[],_type,_cpt]} else {[_closest,_unit,[_driver,_gunner,_commander,_extracrew,_isLocked],_type,_cpt]};
+ _params Spawn BuildUnit;
+ -(_currentCost) Call ChangePlayerFunds;
+ } else {
+ hint parseText(Format [localize 'STR_WF_Queu_Max',Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace]);
+ };
+ };
+ };
+ };
+
+ //--- Tabs selection.
+ if (MenuAction == 101) then {MenuAction = -1;if (barracksInRange) then {_currentIDC = 12005;_type = 'Barracks';_val = 0;_update = true}};
+ if (MenuAction == 102) then {MenuAction = -1;if (lightInRange) then {_currentIDC = 12006;_type = 'Light';_val = 1;_update = true}};
+ if (MenuAction == 103) then {MenuAction = -1;if (heavyInRange) then {_currentIDC = 12007;_type = 'Heavy';_val = 2;_update = true}};
+ if (MenuAction == 104) then {MenuAction = -1;if (aircraftInRange) then {_currentIDC = 12008;_type = 'Aircraft';_val = 3;_update = true}};
+ if (MenuAction == 105) then {MenuAction = -1;if (depotInRange) then {_currentIDC = 12020;_type = 'Depot';_val = 4;_update = true}};
+ if (MenuAction == 106) then {MenuAction = -1;if (hangarInRange) then {_currentIDC = 12021;_type = 'Airport';_val = 3;_update = true}};
+
+ //--- driver-gunner-commander icons.
+ if (MenuAction == 201) then {MenuAction = -1;_driver = if (_driver) then {false} else {true};_updateDetails = true};
+ if (MenuAction == 202) then {MenuAction = -1;_gunner = if (_gunner) then {false} else {true};_updateDetails = true};
+ if (MenuAction == 203) then {MenuAction = -1;_commander = if (_commander) then {false} else {true};_updateDetails = true};
+ if (MenuAction == 204) then {MenuAction = -1;_extracrew = if (_extracrew) then {false} else {true};_updateDetails = true};
+
+ //--- Factory DropDown list value has changed.
+ if (MenuAction == 301) then {MenuAction = -1;_factSel = lbCurSel 12018;_closest = _sorted select _factSel;_updateMap = true};
+
+ //--- Selection change, we update the details.
+ if (MenuAction == 302) then {MenuAction = -1;_updateDetails = true};
+
+ //--- Faction Filter changed.
+ if (MenuAction == 303) then {MenuAction = -1;_update = true;[Format["WFBE_%1%2CURRENTFACTIONSELECTED",sideJoinedText,_type],(lbCurSel _comboFaction),true] Call SetNamespace};
+
+ //--- Lock icon.
+ if (MenuAction == 401) then {MenuAction = -1;_isLocked = if (_isLocked) then {false} else {true};_updateDetails = true};
+
+ //--- Player funds.
+ ctrlSetText [12019,Format [localize 'STR_WF_Cash',Call GetPlayerFunds]];
+
+ //--- Update tabs.
+ if (_update) then {
+ _listUnits = Format ['WFBE_%1%2UNITS',sideJoinedText,_type] Call GetNamespace;
+
+ [_comboFaction,_type] Call UIChangeComboBuyUnits;
+ [_listUnits,_type,_listBox,_val] Call UIFillListBuyUnits;
+
+ //--- Update tabs icons.
+ _IDCS = [12005,12006,12007,12008,12020,12021];
+ _IDCS = _IDCS - [_currentIDC];
+ _con = _display DisplayCtrl _currentIDC;
+ _con ctrlSetTextColor [0.75,0.75,0.75,1];
+ {_con = _display DisplayCtrl _x;_con ctrlSetTextColor [0.4, 0.4, 0.4, 1]} forEach _IDCS;
+
+ _update = false;
+ _updateList = true;
+ _updateDetails = true;
+ };
+
+ //--- Update factories.
+ if (_updateList) then {
+ switch (_type) do {
+ //--- Specials.
+ case 'Depot': {
+ _nObjects = nearestObjects [(vehicle player), WFDEPOT,('WFBE_TOWNPURCHASERANGE' Call GetNamespace)];
+ _closest = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};
+ _sorted = [_closest];
+ };
+ case 'Airport': {
+ _sorted = [(vehicle player),Airfields] Call SortByDistance;
+ _closest = _sorted select 0;
+ _sorted = [_closest];
+ };
+ //--- Factories
+ default {
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories;
+ _sorted = [(vehicle player),_factories] Call SortByDistance;
+ _closest = _sorted select 0;
+ _countAlive = count _factories;
+ };
+ };
+
+ //--- Refresh the Factory DropDown list.
+ lbClear 12018;
+ {
+ _nearest = [_x,towns] Call SortByDistance;
+ _nearTown = (_nearest select 0) getVariable 'name';
+ _txt = _type + ' ' + _nearTown + ' ' + str (round((vehicle player) distance _x)) + 'M';
+ lbAdd[12018,_txt];
+ } forEach _sorted;
+ lbSetCurSel [12018,0];
+
+ _updateList = false;
+ _updateMap = true;
+ };
+
+ //--- Display Factory Queu.
+ _queu = _closest getVariable "queu";
+ _value = if (isNil '_queu') then {0} else {count (_closest getVariable "queu")};
+ ctrlSetText[12024,Format[localize 'STR_WF_Queued',str _value]];
+
+ //--- List selection changed.
+ if (_updateDetails) then {
+ _currentRow = lnbCurSelRow _listBox;
+ //--- Our list is not empty.
+ if (_currentRow != -1) then {
+ _currentValue = lnbValue[_listBox,[_currentRow,0]];
+ _unit = _listUnits select _currentValue;
+ _currentUnit = _unit Call GetNamespace;
+ ctrlSetText [12009,_currentUnit select QUERYUNITPICTURE];
+ ctrlSetText [12033,_currentUnit select QUERYUNITFACTION];
+ ctrlSetText [12035,str (_currentUnit select QUERYUNITTIME)];
+ _currentCost = _currentUnit select QUERYUNITPRICE;
+
+ _isInfantry = if (_unit isKindOf 'Man') then {true} else {false};
+
+ //--- Update driver-gunner-commander icons.
+ if !(_isInfantry) then {
+ ctrlSetText [12036,"N/A"];
+ ctrlSetText [12037,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'transportSoldier'))];
+ ctrlSetText [12038,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'maxSpeed'))];
+ ctrlSetText [12039,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'armor'))];
+ if (_type != 'Depot') then {
+ _slots = _currentUnit select QUERYUNITCREW;
+
+ if (typeName _slots == "ARRAY") then {
+ _hasCommander = _slots select 0;
+ _hasGunner = _slots select 1;
+ _turretsCount = _slots select 3;
+ _extra = 0;
+
+ _maxOut = false;
+ if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true};
+
+ if (_maxOut) then {
+ _driver = true;
+ _gunner = true;
+ _commander = true;
+ _extracrew = false;
+ };
+
+ if !(_hasGunner) then {_gunner = false};
+
+ if !(_hasCommander) then {_commander = false};
+
+ if (_turretsCount == 0) then {_extracrew = false};
+
+ ctrlShow[_IDCSVehi select 0, true];
+ ctrlShow[_IDCSVehi select 1, _hasGunner];
+ ctrlShow[_IDCSVehi select 2, _hasCommander];
+ ctrlShow[_IDCSVehi select 3, if (_turretsCount == 0) then {false} else {true}];
+
+ _c = 0;
+ {
+ _color = if (_x) then {_enabledColor} else {_disabledColor};
+ _con = _display displayCtrl (_IDCSVehi select _c);
+ _con ctrlSetTextColor _color;
+
+ _c = _c + 1;
+ } forEach [_driver,_gunner,_commander,_extracrew];
+
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ if (_commander) then {_extra = _extra + 1};
+ if (_extracrew) then {_extra = _extra + _turretsCount};
+
+ //--- Set the 'extra' price.
+ _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra);
+ } else {//--- Backward compability.
+ _c = 0;
+ _extra = 0;
+
+ //--- Enabled AI by default.
+ _extracrew = false;
+ _maxOut = false;
+ if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true};
+
+ switch (_slots) do {
+ case 1: {
+ if (_maxOut) then {_driver = true};
+ if (_driver) then {_extra = _extra + 1};
+ _gunner = false;
+ _commander = false;
+ };
+ case 2: {
+ if (_maxOut) then {_driver = true;_gunner = true};
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ _commander = false;
+ };
+ case 3: {
+ if (_maxOut) then {_driver = true;_gunner = true;_commander = true};
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ if (_commander) then {_extra = _extra + 1};
+ };
+ };
+
+ //--- Show the icons.
+ {
+ _show = false;
+ if (_c < _slots) then {_show = true};
+ ctrlShow [_x,_show];
+ _c = _c + 1;
+ } forEach _IDCSVehi;
+
+ //--- Mask extra crew.
+ ctrlShow[_IDCSVehi select 3, false];
+
+ _i = 0;
+
+ //--- Set the icons.
+ {
+ _color = if (_x) then {_enabledColor} else {_disabledColor};
+ _con = _display displayCtrl (_IDCSVehi select _i);
+ _con ctrlSetTextColor _color;
+ _i = _i + 1;
+ } forEach [_driver,_gunner,_commander,_extracrew];
+
+ //--- Set the 'extra' price.
+ _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra);
+ };
+ } else {
+ {ctrlShow [_x,false]} forEach (_IDCSVehi);
+ _driver = false;
+ _gunner = false;
+ _commander = false;
+ _extracrew = false;
+ };
+ } else {
+ ctrlSetText [12036,Format ["%1/100",(_currentUnit select QUERYUNITSKILL) * 100]];
+ ctrlSetText [12037,"N/A"];
+ ctrlSetText [12038,"N/A"];
+ ctrlSetText [12039,"N/A"];
+
+ {ctrlShow [_x,false]} forEach (_IDCSVehi);
+ _driver = false;
+ _gunner = false;
+ _commander = false;
+ _extracrew = false;
+
+ //--- Display a unit's loadout.
+ _weapons = (getArray (configFile >> 'CfgVehicles' >> _unit >> 'weapons')) - ['Put','Throw'];
+ _magazines = getArray (configFile >> 'CfgVehicles' >> _unit >> 'magazines');
+
+ _classMags = [];
+ _classMagsAmount = [];
+ _MagsLabel = [];
+
+ {
+ _findAt = _classMags find _x;
+ if (_findAt == -1) then {
+ _classMags = _classMags + [_x];
+ _classMagsAmount = _classMagsAmount + [1];
+ _MagsLabel = _MagsLabel + [[_x,'displayName','CfgMagazines'] Call GetConfigInfo];
+ } else {
+ _classMagsAmount set [_findAt, (_classMagsAmount select _findAt) + 1];
+ };
+ } forEach _magazines;
+ _txt = "<t color='#A7F04F' shadow='2'>" + (localize 'STR_WF_Weapons') + " :</t><br /> <t color='#D3A119' shadow='2'>{</t>";
+ for [{_i = 0},{_i < count _weapons},{_i = _i + 1}] do {
+ _txt = _txt + "<t color='#86C8FF' shadow='2'>" + ([(_weapons select _i),'displayName','CfgWeapons'] Call GetConfigInfo) + "</t>";
+ if ((_i+1) < count _weapons) then {_txt = _txt + "<t color='#D3A119' shadow='2'>,</t> "};
+ };
+ _txt = _txt + "<t color='#D3A119' shadow='2'>}</t><br /><br />";
+ _txt = _txt + "<t color='#A7F04F' shadow='2'>" + (localize 'STR_WF_Magazines') + " :</t><br /> <t color='#D3A119' shadow='2'>{</t>";
+ for [{_i = 0},{_i < count _MagsLabel},{_i = _i + 1}] do {
+ _txt = _txt + "<t color='#86C8FF' shadow='2'>" + ((_MagsLabel select _i) + "</t> <t color='#D057F8' shadow='2'>x</t> <t color='#FB7E7E' shadow='2'>" + str (_classMagsAmount select _i)) + "</t>";
+ if ((_i+1) < count _MagsLabel) then {_txt = _txt + "<t color='#D3A119' shadow='2'>,</t> "};
+ };
+ _txt = _txt + "<t color='#D3A119' shadow='2'>}</t>";
+
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt);
+ };
+
+ //--- Lock Icon.
+ if !(_isInfantry) then {
+ ctrlShow[_IDCLock,true];
+ _color = if (_isLocked) then {_enabledColor} else {_disabledColor};
+ _con = _display displayCtrl _IDCLock;
+ _con ctrlSetTextColor _color;
+ } else {
+ ctrlShow[_IDCLock,false];
+ };
+
+ //--- Long description.
+ if !(_isInfantry) then {
+ if (isClass (configFile >> 'CfgVehicles' >> _unit >> 'Library')) then {
+ _txt = getText (configFile >> 'CfgVehicles' >> _unit >> 'Library' >> 'libTextDesc');
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt);
+ } else {
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText '');
+ };
+ };
+
+ ctrlSetText [12034,Format ["$ %1.",_currentCost]];
+ _updateDetails = false;
+ } else {
+ {ctrlSetText [_x , ""]} forEach [12009,12010,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037,12038,12039];
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText '');
+ };
+ };
+
+ //--- Update the Factory Minimap position.
+ if (_updateMap) then {
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [2,.075,getPos _closest];
+ ctrlMapAnimCommit _map;
+ _updateMap = false;
+ };
+
+ //--- Check that the factories of the current type are still alive.
+ _lastCheck = _lastCheck + 0.1;
+ if (_lastCheck > 2 && _type != 'Depot' && _type != 'Airport') then {
+ _lastCheck = 0;
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories;
+ if (count _factories != _countAlive) then {_updateList = true};
+ };
+
+ _lastSel = lnbCurSelRow _listBox;
+ _lastType = _type;
+ sleep 0.1;
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_ClearCurrentCutDisplay.sqf b/Client/GUI/GUI_ClearCurrentCutDisplay.sqf
new file mode 100644
index 0000000..610fbfe
--- /dev/null
+++ b/Client/GUI/GUI_ClearCurrentCutDisplay.sqf
@@ -0,0 +1 @@
+["currentCutDisplay", displayNull] call BIS_FNC_GUIset; \ No newline at end of file
diff --git a/Client/GUI/GUI_CommandMenu.sqf b/Client/GUI/GUI_CommandMenu.sqf
new file mode 100644
index 0000000..c373036
--- /dev/null
+++ b/Client/GUI/GUI_CommandMenu.sqf
@@ -0,0 +1,53 @@
+
+private ["_enable","_exited"];
+MenuAction = -1;
+
+while {alive player && dialog} do {
+ //--- Command AI.
+ _enable = false;
+ if (!isNull(commanderTeam)) then {if (commanderTeam == group player) then {_enable = true}};
+ ctrlEnable [13001,_enable]; //--- Team Orders
+ ctrlEnable [13004,_enable]; //--- Commander Menu
+ ctrlEnable [13002,commandInRange]; //--- Special Menu
+ ctrlEnable [13003,commandInRange]; //--- Upgrade Menu
+
+ sleep 0.1;
+
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ //--- Command AI.
+ if (MenuAction == 1) exitWith {
+ MenuAction = -1;
+ CloseDialog 0;
+ CreateDialog "RscOrderMenu";
+ };
+
+ //--- Artillery Menu.
+ if (MenuAction == 2) exitWith {
+ MenuAction = -1;
+ CloseDialog 0;
+ CreateDialog "RscArtilleryMenu";
+ };
+
+ //--- Upgrade Menu.
+ if (MenuAction == 3) exitWith {
+ MenuAction = -1;
+ CloseDialog 0;
+ CreateDialog "RscUpgradeMenu";
+ };
+
+ //--- Commander Menu.
+ if (MenuAction == 4) exitWith {
+ MenuAction = -1;
+ CloseDialog 0;
+ CreateDialog "RscCommanderMenu";
+ };
+
+ //--- Support Menu.
+ if (MenuAction == 5) exitWith {
+ MenuAction = -1;
+ CloseDialog 0;
+ CreateDialog "RscSupportMenu";
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_CommanderMenu.sqf b/Client/GUI/GUI_CommanderMenu.sqf
new file mode 100644
index 0000000..20864e3
--- /dev/null
+++ b/Client/GUI/GUI_CommanderMenu.sqf
@@ -0,0 +1,159 @@
+disableSerialization;
+
+_display = _this select 0;
+_map = _display DisplayCtrl 23002;
+
+_hqDeployed = (sideJoined) Call GetSideHQDeployed;
+if (!_hqDeployed || !paramUseWorkers) then {ctrlEnable [23004, false];ctrlEnable [23006, false]};
+if !(paramUseWorkers) then {ctrlSetText[23005, localize 'STR_WF_Disabled']};
+
+MenuAction = -1;
+
+_maxWorkers = 'WFBE_WORKERS_MAX' Call GetNamespace;
+_workerPrice = 'WFBE_WORKERS_PRICE' Call GetNamespace;
+_incomeSystem = 'WFBE_INCOMESYSTEM' Call GetNamespace;
+_incomeDividision = 'WFBE_INC_DIVIDE_COM' Call GetNamespace;
+_aliveWorkers = [];
+_workers = [];
+_lastWorkersUpdate = -10;
+_lastComboUpdate = -30;
+_lastPurchase = -5;
+_income = 0;
+_updateComboWorker = true;
+_hasStarted = true;
+
+if (_incomeSystem in [3,4]) then {
+ sliderSetRange[23010,0,100];
+ _income = Call Compile Format["%1CommanderPercent",sideJoined];
+ sliderSetPosition[23010, _income];
+} else {
+ ctrlEnable [23012, false];
+};
+
+while {alive player && dialog} do {
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ _funds = Call GetPlayerFunds;
+
+ //--- Income System.
+ if (_incomeSystem in [3,4]) then {
+ ctrlSetText[23011, Format["%1%2",_income,"%"]];
+ _currentPercent = Call Compile Format["%1CommanderPercent",sideJoined];
+
+ _income = floor(sliderPosition 23010);
+
+ sliderSetPosition[23010, _income];
+
+ _calInc = (sideJoined) Call GetTownsIncome;
+
+ if (_currentPercent != _income || _hasStarted) then {
+ if (_hasStarted) then {_hasStarted = false};
+
+ _income_players = 0;
+ _income_commander = 0;
+ switch (_incomeSystem) do {
+ case 3: {
+ _income_players = round(_calInc * (((100 - _income)/100)/maxPlayers));
+ _income_commander = round((_calInc * (_income/100)) / _incomeDividision) + _income_players;
+ };
+ case 4: {
+ _income_players = round(_calInc * (100 - _income) / 100);
+ _income_commander = round((_calInc - _income_players)*maxPlayers) + _income_players;
+ };
+ };
+
+ ctrlSetText [23013, localize 'STR_WF_Income_Sys_Com' + ": $" + str(_income_commander) + "."];
+ ctrlSetText [23014, localize 'STR_WF_Income_Sys_Ply' + ": $" + str(_income_players) + "."];
+ };
+
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+
+ if (_currentPercent != _income) then {
+ Call Compile Format["%1CommanderPercent = _income; publicVariable '%1CommanderPercent';",sideJoined];
+ };
+ };
+ };
+
+ //--- Workers System.
+ if (paramUseWorkers) then {
+ if (time - _lastComboUpdate > 5) then {
+ _updateComboWorker = true;
+ _lastComboUpdate = time;
+ };
+
+ _workers = Call Compile Format ["WF_%1Workers",sideJoinedText];
+ if (time - _lastWorkersUpdate > 5) then {_aliveWorkers = (_workers) Call GetLiveUnits;_lastWorkersUpdate = time};
+ _hqDeployed = (sideJoined) Call GetSideHQDeployed;
+
+ if (!_hqDeployed || time - _lastPurchase < 3 || count _aliveWorkers >= _maxWorkers || _funds < _workerPrice) then {ctrlEnable [23004, false]} else {ctrlEnable [23004, true]};
+
+ //--- Workers tracker.
+ if (_updateComboWorker) then {
+ _updateComboWorker = false;
+ lbClear 23007;
+
+ for '_i' from 0 to count(_aliveWorkers)-1 do {
+ lbAdd [23007, localize "STR_WF_Workers" + " " + str(_i+1)];
+ };
+ };
+
+ ctrlSetText [23005, Format ["$%1. (%2/%3)",_workerPrice,count _aliveWorkers,_maxWorkers]];
+ };
+
+ //--- Hire Workers.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+
+ //--- Which index.
+ _index = 0;
+ for '_i' from 0 to count(_workers)-1 do {
+ if (isNull (_workers select _i)) exitWith {_index = _i};
+ };
+
+ if (_index == 0 && count(_workers) > 0) then {_index = count _workers};
+
+ if (count _aliveWorkers <= _maxWorkers && _hqDeployed) then {
+ -(_workerPrice) Call ChangePlayerFunds;
+
+ WFBE_RequestWorker = ['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]];
+ publicVariable 'WFBE_RequestWorker';
+ if (isHostedServer) then {['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]] Spawn HandleSPVF};
+
+ _workers set [_index, WF_Logic];
+ Call Compile Format ["WF_%1Workers = _workers; publicVariable 'WF_%1Workers';",sideJoinedText];
+
+ _lastPurchase = time;
+ _lastWorkersUpdate = -10;
+ _updateComboWorker = true;
+ };
+ };
+
+ //--- Disband Worker.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+
+ _value = lbCurSel 23007;
+
+ if (_value != -1) then {
+ (_aliveWorkers select _value) setDammage 1;
+ _lastWorkersUpdate = -10;
+ _updateComboWorker = true;
+ };
+ };
+
+ //--- Minimap update.
+ if (MenuAction == 100) then {
+ MenuAction = -1;
+ _value = lbCurSel 23007;
+
+ if (_value != -1) then {
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [1,.175,getPos(_aliveWorkers select _value)];
+ ctrlMapAnimCommit _map;
+ };
+ };
+
+ sleep 0.1;
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Display_Parameters.sqf b/Client/GUI/GUI_Display_Parameters.sqf
new file mode 100644
index 0000000..84e7956
--- /dev/null
+++ b/Client/GUI/GUI_Display_Parameters.sqf
@@ -0,0 +1,30 @@
+/* Ingame parameters dump. */
+
+for [{_i = 0},{_i < (count (missionConfigFile/"Params"))},{_i = _i + 1}] do {
+ _paramName = (configName ((missionConfigFile >> "Params") select _i));
+ _text = getText (missionConfigFile >> "Params" >> _paramName >> "title");
+ _values = getArray (missionConfigFile >> "Params" >> _paramName >> "values");
+ _texts = getArray (missionConfigFile >> "Params" >> _paramName >> "texts");
+
+ _value = if (isMultiplayer) then {paramsArray select _i} else {getNumber (missionConfigFile >> "Params" >> _paramName >> "default")};
+ _status = _texts select (_values find _value);
+
+ lnbAddRow [22003,[_text,_status]];
+};
+
+while {alive player && dialog} do {
+/*---it is in the Main Menu now //MrNiceGuy
+ _uptime = Call GetTime;
+ ctrlSetText [22005,Format[localize 'STR_WF_MAIN_Uptime',_uptime select 0,_uptime select 1,_uptime select 2, _uptime select 3]];
+*/
+ sleep 0.1;
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+
+ //--- Back Button.
+ if (MenuAction == 1) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_EASA.sqf b/Client/GUI/GUI_EASA.sqf
new file mode 100644
index 0000000..590a019
--- /dev/null
+++ b/Client/GUI/GUI_EASA.sqf
@@ -0,0 +1,50 @@
+
+private ["_i","_j","_listPrice","_listDesc","_cdata","_funds","_iddx","_type","_data","_listBox"];
+MenuAction = -1;
+
+_type = ('WFBE_EASA_Vehicles' Call GetNamespace) find (typeOf (vehicle player));
+if (_type == -1) exitWith {diag_log Format['[WFBE (ERROR)][frameno:%2 | ticktime:%3] GUI_EASA: The player vehicle was not found within the list (%1)',_type,diag_frameno,diag_tickTime]};
+_data = (('WFBE_EASA_Loadouts' Call GetNamespace) select _type);
+
+
+_listPrice = [];
+_listDesc = [];
+_listBox = 23003;
+for [{_i = 0},{_i < count(_data)},{_i = _i + 1}] do {
+ _cdata = _data select _i;
+ for [{_j = 0},{_j < count(_cdata)},{_j = _j + 1}] do {
+ if (_j == 0) then {_listPrice = _listPrice + [(_cdata select 0) select 0]};
+ if (_j == 1) then {
+ _listDesc = _listDesc + [(_cdata select 1) select 0];
+ lnbAddRow [_listBox,["$"+str((_cdata select 0) select 0)+".",(_cdata select 1) select 0]]};
+ if (_j > 1) then {
+ };
+ };
+};
+
+if (count _listPrice > 0) then {lnbSetCurSelRow [_listBox,0]} else {lnbSetCurSelRow [_listBox,-1]};
+
+while {alive player && dialog} do {
+ sleep 0.1;
+
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ //--- Command AI.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ _funds = Call GetPlayerFunds;
+
+ _iddx = lnbCurSelRow _listBox;
+ if (_iddx != -1) then {
+ if (_funds > (_listPrice select _iddx)) then {
+ [vehicle player, _iddx, true] Call EASA_Equip;
+ -(_listPrice select _iddx) Call ChangePlayerFunds;
+ hint parseText(Format[localize 'STR_WF_EASA_Purchase',(_listDesc select _iddx)]);
+ closeDialog 0;
+ } else {
+ hint parseText(Format[localize 'STR_WF_Funds_Missing',(_listPrice select _iddx) - _funds,_listDesc select _iddx]);
+ };
+ };
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_EndOfGameStats.sqf b/Client/GUI/GUI_EndOfGameStats.sqf
new file mode 100644
index 0000000..af224cb
--- /dev/null
+++ b/Client/GUI/GUI_EndOfGameStats.sqf
@@ -0,0 +1,184 @@
+
+private ["_sideText","_recruited","_casualties","_created","_lost","_eastRecruitedCount","_eastCasualtyCount","_eastCreatedCount","_eastLostCount","_westRecruitedCount","_westCasualtyCount","_westCreatedCount","_westLostCount","_timePassed","_side","_sideName","_width","_eastUnitsCreated","_eastCasualties","_eastVehiclesCreated","_eastVehiclesLost","_westUnitsCreated","_westCasualties","_westVehiclesCreated","_westVehiclesLost","_eastCreatedRate","_eastLostRate","_eastRecruitedRate","_eastCasualtiesRate","_westCreatedRate","_westLostRate","_westRecruitedRate","_westCasualtiesRate","_westRecruitedCounter","_westRecruitedBar","_westCasualtyCounter","_westCasualtyBar","_westCreatedCounter","_westCreatedBar","_westLostCounter","_westLostBar","_position","_eastRecruitedCounter","_eastRecruitedBar","_eastCasualtyCounter","_eastCasualtyBar","_eastCreatedCounter","_eastCreatedBar","_eastLostCounter","_eastLostBar"];
+disableSerialization;
+
+12450 cutText ["","PLAIN",0];
+
+_side = _this Select 0;
+_sideText = Localize "STR_WF_PARAMETER_Side_East";
+if (_side == West) then {_sideText = Localize "STR_WF_PARAMETER_Side_West"};
+_sideName = Format[Localize "STR_WF_END_Victory",_sideText];
+
+_width = 0.4;
+TitleText["","PLAIN"];
+sleep 0.5;
+CutRsc["EndOfGameStats","PLAIN",0];
+
+_eastUnitsCreated = WF_Logic getVariable "eastUnitsCreated";
+_eastCasualties = WF_Logic getVariable "eastCasualties";
+_eastVehiclesCreated = WF_Logic getVariable "eastVehiclesCreated";
+_eastVehiclesLost = WF_Logic getVariable "eastVehiclesLost";
+_westUnitsCreated = WF_Logic getVariable "westUnitsCreated";
+_westCasualties = WF_Logic getVariable "westCasualties";
+_westVehiclesCreated = WF_Logic getVariable "westVehiclesCreated";
+_westVehiclesLost = WF_Logic getVariable "westVehiclesLost";
+
+_eastCreatedRate = _eastVehiclesCreated / 5 * .1;
+_eastLostRate = _eastVehiclesLost / 5 * .1;
+_eastRecruitedRate = _eastUnitsCreated / 5 * .1;
+_eastCasualtiesRate = _eastCasualties / 5 * .1;
+
+_westCreatedRate = _westVehiclesCreated / 5 * .1;
+_westLostRate = _westVehiclesLost / 5 * .1;
+_westRecruitedRate = _westUnitsCreated / 5 * .1;
+_westCasualtiesRate = _westCasualties / 5 * .1;
+
+waitUntil {!isNull (["currentCutDisplay"] call BIS_FNC_GUIget)};
+((["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90001) CtrlSetText _sideName;
+
+_westRecruitedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90200;
+_westRecruitedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90201;
+_westCasualtyCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90202;
+_westCasualtyBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90203;
+_westCreatedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90204;
+_westCreatedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90205;
+_westLostCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90206;
+_westLostBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90207;
+
+_position = CtrlPosition _westRecruitedBar;
+_recruited = _width * (_westUnitsCreated / 500);
+if (_recruited > _width) then {_recruited = _width};
+_position Set[2,0];
+_westRecruitedBar CtrlSetPosition _position;
+_westRecruitedBar CtrlCommit 0;
+_position Set[2,_recruited];
+_westRecruitedBar CtrlSetPosition _position;
+_westRecruitedBar CtrlCommit 8;
+
+_position = CtrlPosition _westCasualtyBar;
+_casualties = _width * (_westCasualties / 500);
+if (_casualties > _width) then {_casualties = _width};
+_position Set[2,0];
+_westCasualtyBar CtrlSetPosition _position;
+_westCasualtyBar CtrlCommit 0;
+_position Set[2,_casualties];
+_westCasualtyBar CtrlSetPosition _position;
+_westCasualtyBar CtrlCommit 8;
+
+_position = CtrlPosition _westCreatedBar;
+_created = _width * (_westVehiclesCreated / 150);
+if (_created > _width) then {_created = _width};
+_position Set[2,0];
+_westCreatedBar CtrlSetPosition _position;
+_westCreatedBar CtrlCommit 0;
+_position Set[2,_created];
+_westCreatedBar CtrlSetPosition _position;
+_westCreatedBar CtrlCommit 8;
+
+_position = CtrlPosition _westLostBar;
+_lost = _width * (_westVehiclesLost / 150);
+if (_lost > _width) then {_lost = _width};
+_position Set[2,0];
+_westLostBar CtrlSetPosition _position;
+_westLostBar CtrlCommit 0;
+_position Set[2,_lost];
+_westLostBar CtrlSetPosition _position;
+_westLostBar CtrlCommit 8;
+
+_eastRecruitedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90101;
+_eastRecruitedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90102;
+_eastCasualtyCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90103;
+_eastCasualtyBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90104;
+_eastCreatedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90105;
+_eastCreatedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90106;
+_eastLostCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90107;
+_eastLostBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90108;
+
+_position = CtrlPosition _eastRecruitedBar;
+_recruited = _width * (_eastUnitsCreated / 500);
+if (_recruited > _width) then {_recruited = _width};
+_position Set[2,0];
+_eastRecruitedBar CtrlSetPosition _position;
+_eastRecruitedBar CtrlCommit 0;
+_position Set[2,_recruited];
+_eastRecruitedBar CtrlSetPosition _position;
+_eastRecruitedBar CtrlCommit 8;
+
+_position = CtrlPosition _eastCasualtyBar;
+_casualties = _width * (_eastCasualties / 500);
+if (_casualties > _width) then {_casualties = _width};
+_position Set[2,0];
+_eastCasualtyBar CtrlSetPosition _position;
+_eastCasualtyBar CtrlCommit 0;
+_position Set[2,_casualties];
+_eastCasualtyBar CtrlSetPosition _position;
+_eastCasualtyBar CtrlCommit 8;
+
+_position = CtrlPosition _eastCreatedBar;
+_created = _width * (_eastVehiclesCreated / 150);
+if (_created > _width) then {_created = _width};
+_position Set[2,0];
+_eastCreatedBar CtrlSetPosition _position;
+_eastCreatedBar CtrlCommit 0;
+_position Set[2,_created];
+_eastCreatedBar CtrlSetPosition _position;
+_eastCreatedBar CtrlCommit 8;
+
+_position = CtrlPosition _eastLostBar;
+_lost = _width * (_eastVehiclesLost / 150);
+if (_lost > _width) then {_lost = _width};
+_position Set[2,0];
+_eastLostBar CtrlSetPosition _position;
+_eastLostBar CtrlCommit 0;
+_position Set[2,_lost];
+_eastLostBar CtrlSetPosition _position;
+_eastLostBar CtrlCommit 8;
+
+_timePassed = 0;
+_eastCasualtyCount = 0;
+_eastRecruitedCount = 0;
+_eastCreatedCount = 0;
+_eastLostCount = 0;
+
+_westCasualtyCount = 0;
+_westRecruitedCount = 0;
+_westCreatedCount = 0;
+_westLostCount = 0;
+
+while {_timePassed < 8} do {
+ sleep 0.1;
+
+ _eastRecruitedCount = _eastRecruitedCount + _eastRecruitedRate;
+ if (_eastRecruitedCount > _eastUnitsCreated) then {_eastRecruitedCount = _eastUnitsCreated};
+ _eastRecruitedCounter CtrlSetText Format["%1",_eastRecruitedCount - (_eastRecruitedCount % 1)];
+
+ _eastCasualtyCount = _eastCasualtyCount + _eastCasualtiesRate;
+ if (_eastCasualtyCount > _eastCasualties) then {_eastCasualtyCount = _eastCasualties};
+ _eastCasualtyCounter CtrlSetText Format["%1",_eastCasualtyCount - (_eastCasualtyCount % 1)];
+
+ _eastCreatedCount = _eastCreatedCount + _eastCreatedRate;
+ if (_eastCreatedCount > _eastVehiclesCreated) then {_eastCreatedCount = _eastVehiclesCreated};
+ _eastCreatedCounter CtrlSetText Format["%1",_eastCreatedCount - (_eastCreatedCount % 1)];
+
+ _eastLostCount = _eastLostCount + _eastLostRate;
+ if (_eastLostCount > _eastVehiclesLost) then {_eastLostCount = _eastVehiclesLost};
+ _eastLostCounter CtrlSetText Format["%1",_eastLostCount - (_eastLostCount % 1)];
+
+ _westRecruitedCount = _westRecruitedCount + _westRecruitedRate;
+ if (_westRecruitedCount > _westUnitsCreated) then {_westRecruitedCount = _westUnitsCreated};
+ _westRecruitedCounter CtrlSetText Format["%1",_westRecruitedCount - (_westRecruitedCount % 1)];
+
+ _westCasualtyCount = _westCasualtyCount + _westCasualtiesRate;
+ if (_westCasualtyCount > _westCasualties) then {_westCasualtyCount = _westCasualties};
+ _westCasualtyCounter CtrlSetText Format["%1",_westCasualtyCount - (_westCasualtyCount % 1)];
+
+ _westCreatedCount = _westCreatedCount + _westCreatedRate;
+ if (_westCreatedCount > _westVehiclesCreated) then {_westCreatedCount = _westVehiclesCreated};
+ _westCreatedCounter CtrlSetText Format["%1",_westCreatedCount - (_westCreatedCount % 1)];
+
+ _westLostCount = _westLostCount + _westLostRate;
+ if (_westLostCount > _westVehiclesLost) then {_westLostCount = _westVehiclesLost};
+ _westLostCounter CtrlSetText Format["%1",_westLostCount - (_westLostCount % 1)];
+
+ _timePassed = _timePassed + 0.1;
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_GearAce.sqf b/Client/GUI/GUI_GearAce.sqf
new file mode 100644
index 0000000..e92a7e2
--- /dev/null
+++ b/Client/GUI/GUI_GearAce.sqf
@@ -0,0 +1,1415 @@
+private ["_indexWeapons", "_indexMagazines", "_indexOnBack", "_indexRuckWeapons", "_indexRuckMags", "_indexPrimary", "_indexSecondary", "_indexSidearm", "_typesIFAK", "_filterNames", "_primary", "_secondary", "_sidearm", "_misc", "_magazine", "_all", "_primaryBackpack", "_secondaryBackpack", "_sidearmBackpack", "_miscBackpack", "_allBackpack", "_currentGear", "_currentWeaponUIState", "_currentMagazineUIState", "_getCompatibleMagazines", "_weapon", "_weaponMags", "_mags", "_muzzles", "_getItemDataByConfigType", "_data", "_configType", "_item", "_W", "_getItemDataByFilterType", "_filter", "_get", "_inventoryToGear", "_ret", "_unit", "_backwep", "_current", "_ruckmags", "_ruckweapons", "_safeArray", "_getItemCost", "_itemName", "_getItemWeight", "_getRuckItemsVolume", "_gear", "_volume", "_getGearCost", "_price", "_cost", "_getGearWeight", "_weight", "_totalWeight", "_fillInBlankImages", "_i", "_renderGear", "_pic", "_itemIndex", "_specialIndex", "_mainMagIndex", "_sideMagIndex", "_ifakCount", "_isIFAK", "_wob", "_weaponUIState", "_magazineUIState", "_magazineSpace", "_forEachIndex", "_getItemCountByType", "_count", "_itemType", "_countThisOne", "_renderRuckContents", "_u", "_capacity", "_getGearRuck", "_getMagazineCountByPool", "_handgunpool", "_addMagazineToGear", "_magCount", "_magLimit", "_magSize", "_oldMagazines", "_applyGearToUnit", "_maybeRuck", "_addItemToRuck", "_ruck", "_size", "_added", "_packable", "_currentUnit", "_initialCost", "_updateGear", "_updateMainList", "_updateSecondaryList", "_updateUnit", "_backpackSelected", "_selectedWeapon", "_currentFilter", "_defaultWeap", "_defaultAmmo", "_defaultLoadoutCost", "_lbSelChanged", "_mainCommand", "_inventoryClick", "_gearAction", "_weaponList", "_magazineList", "_funds", "_respawnCost", "_mag", "_ruckIndex", "_ruckItemClass", "_ruckItem", "_add", "_itemCount", "_temp", "_respawnPenalty","_divisor"];
+
+_indexWeapons = 0;
+_indexMagazines = 1;
+_indexOnBack = 2;
+_indexRuckWeapons = 3;
+_indexRuckMags = 4;
+_indexPrimary = 5;
+_indexSecondary = 6;
+_indexSidearm = 7;
+_typesIFAK = [ "ACE_Morphine", "ACE_Bandage", "ACE_Epinephrine" ];
+_filterNames = [ "all", "primary", "secondary", "sidearm", "misc" ];
+
+_primary = +(WF_Logic getVariable 'primaryClasses');
+_secondary = +(WF_Logic getVariable 'secondaryClasses');
+_sidearm = +(WF_Logic getVariable 'sidearmClasses');
+_misc = +(WF_Logic getVariable 'miscClasses');
+_magazine = +(WF_Logic getVariable 'magazineClasses');
+
+_all = _primary + _secondary + _sidearm + _misc;
+
+_primaryBackpack = [];
+_secondaryBackpack = [];
+_sidearmBackpack = _sidearm;
+_miscBackpack = _misc + _magazine;
+_allBackpack = _misc + _sidearm + _magazine;
+
+// Gear Array. Many methods use this format. It is:
+// 0: Weapons
+// 1: Magazines
+// 2: ACE weapon on back
+// 3: Weapons in rucksack as a sequence of doubles: [ item, quantity ]
+// 4: Magazines in rucksack as a sequence of doubles: [ item, quantity ]
+// 5: Current primary weapon
+// 6: Current secondary weapon
+// 7: Current sidearm
+_currentGear = [ [], [], "", [], [], "", "", "" ];
+
+// The following twe are arrays of doubles. Each double is [id, index] that maps
+// UI controls to gear in the _currentGear structure.
+//
+// id: Control ID of a control in the gear dialog.
+// index: index into the magazine or weapon array in _currentGear that corresponds to the
+// weapon or magazine represented by the control in question.
+_currentWeaponUIState = [];
+_currentMagazineUIState = [];
+
+// Given a weapon class, get the magazines that will fit in it.
+_getCompatibleMagazines =
+{
+ private ["_weapon","_weaponMags","_mags","_muzzles","_supportedMags","_csw"];
+
+ _weapon = _this;
+ _weaponMags = [];
+ _supportedMags = _magazine + _misc;
+
+ _csw = "";
+
+ if(isText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewmgtype")) then
+ {
+ _csw = getText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewmgtype");
+ };
+
+ if(_csw == "" && isText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewtripodtype")) then
+ {
+ _csw = getText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewtripodtype");
+ };
+
+ if(_csw != "") then
+ {
+ _mags = getArray(configFile >> "CfgVehicles" >> _csw >> "ace_crewdummymags");
+ if(!isNil "_mags") then
+ {
+ {
+ if(!(_x in _weaponMags) && _x in _supportedMags) then
+ {
+ _weaponMags = _weaponMags + [ _x ];
+ };
+ } forEach(_mags);
+ };
+ }
+ else
+ {
+ // Disposable weapons have no magazines.
+ if(getNumber(configFile >> "CfgWeapons" >> _weapon >> "ace_disposable") != 1) then
+ {
+ // Main muzzle magazines...
+ _mags = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
+ if (!isNil "_mags") then
+ {
+ {
+ if(!(_x in _weaponMags) && _x in _supportedMags) then
+ {
+ _weaponMags = _weaponMags + [ _x ];
+ };
+ } forEach(_mags);
+ };
+
+ _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
+ if(!isNil "_muzzles") then
+ {
+ {
+ if ((typeName _x) == "STRING") then
+ {
+ _mags = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
+ if (!isNil "_mags") then
+ {
+ {
+ if(!(_x in _weaponMags) && _x in _supportedMags) then
+ {
+ _weaponMags = _weaponMags + [_x];
+ };
+ } forEach(_mags);
+ };
+ };
+ } forEach(_muzzles);
+ };
+ };
+ };
+ _weaponMags
+};
+
+// arg 0: item class
+// arg 1: true if weapon, false if magazine
+// returns item data
+_getItemDataByConfigType =
+{
+ private ["_data", "_configType", "_item"];
+
+ _item = _this select 0;
+ _configType = _this select 1;
+ _data = nil;
+ if(_configType && !(isNil "_item")) then
+ {
+ _data = (_item+'_W') Call GetNamespace;
+ };
+ if(isNil "_data") then
+ {
+ _data = _item Call GetNamespace;
+ };
+ _data
+};
+
+// arg 0: item class
+// arg 1: filter type e.g. "all" or "sidearm"
+// returns item data
+_getItemDataByFilterType =
+{
+ private [ "_item", "_filter", "_get" ];
+
+ _item = _this select 0;
+ _filter = _this select 1;
+
+ if (_filter == 'secondary' || _filter == 'all') then {
+ _get = (_item+'_W') Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _item Call GetNamespace;
+ };
+ } else {
+ _get = _item Call GetNamespace;
+ };
+ _get
+};
+
+// Argument 0: a unit
+//
+// Takes that unit's inventory and returns a gear array from it (see above).
+_inventoryToGear = {
+ private ["_ret","_unit","_backwep","_get","_current","_ruckmags","_ruckweapons","_temp"];
+
+ _unit = _this select 0;
+
+ _ret = [ [], [], "", [], [], "", "", "" ];
+
+ _backwep = _unit getVariable "ACE_weapononback";
+ if (!isNil "_backwep") then
+ {
+ if ((typeName _backwep) == "STRING") then
+ {
+ _ret set [ _indexOnBack, _backwep ];
+ };
+ };
+
+ _temp = [];
+ {
+ _get = [ _x, true ] call _getItemDataByConfigType;
+ if(!isNil "_get") then
+ {
+ _temp = _temp + [_x];
+ };
+ } forEach(weapons _unit);
+ _ret set [ _indexWeapons, _temp ];
+
+ _temp = [];
+ {
+ _get = [ _x, false ] call _getItemDataByConfigType;
+ if(!isNil "_get") then
+ {
+ _temp = _temp + [_x];
+ };
+ } forEach(magazines _unit);
+ _ret set [ _indexMagazines, _temp ];
+
+ _get = [ primaryWeapon _unit, true ] call _getItemDataByConfigType;
+ if(!isNil "_get") then
+ {
+ _ret set [ _indexPrimary, primaryWeapon _unit ];
+ }
+ else
+ {
+ _ret set [ _indexPrimary, "" ];
+ };
+
+ _get = [ secondaryWeapon _unit, true ] call _getItemDataByConfigType;
+ if(!isNil "_get") then
+ {
+ _ret set [ _indexSecondary, secondaryWeapon _unit ];
+ }
+ else
+ {
+ _ret set [ _indexSecondary, "" ];
+ };
+
+ {
+ if (_x in _sidearm) exitWith
+ {
+ _ret set [ _indexSidearm, _x ];
+ };
+ } forEach(_ret select _indexWeapons);
+
+ if ([_unit] call ACE_fnc_HasRuck) then {
+ _ruckmags = _unit getVariable "ACE_RuckMagContents";
+ _ruckweapons = _unit getVariable "ACE_RuckWepContents";
+ if(!isNil "_ruckweapons") then
+ {
+ _temp = [];
+ {
+ _get = [ _x select 0, true ] call _getItemDataByConfigType;
+ if(!isNil "_get") then
+ {
+ _temp = _temp + [_x];
+ };
+ } forEach(_ruckweapons);
+ _ret set [ _indexRuckWeapons, _temp ];
+ };
+ if(!isNil "_ruckmags") then
+ {
+ _temp = [];
+ {
+ _get = [ _x select 0, false ] call _getItemDataByConfigType;
+ if(!isNil "_get") then
+ {
+ _temp = _temp + [_x];
+ };
+ } forEach(_ruckmags);
+ _ret set [ _indexRuckMags, _temp ];
+ };
+ };
+
+ _ret
+};
+
+// Get an item's cost.
+// Arguments [ item-name, is-weapon ]
+// is-weapon is true for weapons or false for magazines
+_getItemCost =
+{
+ private ["_itemName", "_configType","_ret","_get"];
+ _itemName = _this select 0;
+ _configType = _this select 1;
+ _get = [ _itemName, _configType] call _getItemDataByConfigType;
+ _ret = 0;
+ if(!isNil "_get") then
+ {
+ _ret = _get select QUERYGEARCOST;
+ };
+ _ret
+};
+
+// Get an item's weight
+// Arguments [ item-name, config-type ]
+// config-type is usually CfgWeapons or CfgMagazines.
+_getItemWeight =
+{
+ private ["_itemName", "_configType","_ret"];
+ _itemName = _this select 0;
+ _configType = _this select 1;
+ _ret = getNumber (configFile >> _configType >> _itemName >> "ACE_Weight");
+ _ret
+};
+
+// arg: gear array
+// returns: total volume of gear in ruck sack
+_getRuckItemsVolume =
+{
+ private ["_gear", "_volume"];
+
+ _gear = _this;
+ _volume = 0;
+
+ {
+ _volume = _volume +
+ (getNumber(configFile >> "CfgWeapons" >> (_x select 0) >> "ACE_size") * (_x select 1));
+ } forEach(_gear select _indexRuckWeapons);
+
+ {
+ _volume = _volume +
+ (getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_size") * (_x select 1));
+ } forEach(_gear select _indexRuckMags);
+ _volume
+};
+
+// Takes a gear array for an argument and returns its cost.
+_getGearCost =
+{
+ private ["_gear","_get","_price","_cost"];
+
+ _gear = _this;
+ _price = 0;
+
+ {
+ _cost = [_x, true] call _getItemCost;
+ if(!isNil "_cost") then
+ {
+ _price = _price + _cost;
+ };
+ } forEach(_gear select _indexWeapons);
+
+ {
+ _cost = [_x, false] call _getItemCost;
+ if(!isNil "_cost") then
+ {
+ _price = _price + _cost;
+ };
+ } forEach(_gear select _indexMagazines);
+
+ if((_gear select _indexOnBack) != "") then
+ {
+ _cost = [_gear select _indexOnBack, true] call _getItemCost;
+ if(!isNil "_cost") then
+ {
+ _price = _price + _cost;
+ };
+ };
+
+ {
+ _cost = [_x select 0, true] call _getItemCost;
+ if(!isNil "_cost") then
+ {
+ _price = _price + (_cost * (_x select 1));
+ };
+ } forEach(_gear select _indexRuckWeapons);
+
+ {
+ _cost = [_x select 0, false] call _getItemCost;
+ if(!isNil "_cost") then
+ {
+ _price = _price + (_cost * (_x select 1));
+ };
+ } forEach(_gear select _indexRuckMags);
+ _price
+};
+
+// Takes a gear array for an argument and returns its totalweight.
+_getGearWeight =
+{
+ private ["_gear","_get","_weight","_totalWeight"];
+
+ _gear = _this;
+ _totalWeight = 0;
+
+ {
+ _weight = [_x, "CfgWeapons"] call _getItemWeight;
+ if(!isNil "_weight") then
+ {
+ _totalWeight = _totalWeight + _weight;
+ };
+ } forEach(_gear select _indexWeapons);
+
+ {
+ _weight = [_x, "CfgMagazines"] call _getItemWeight;
+ if(!isNil "_weight") then
+ {
+ _totalWeight = _totalWeight + _weight;
+ };
+ } forEach(_gear select _indexMagazines);
+
+ _weight = [_gear select _indexOnBack, "CfgWeapons"] call _getItemWeight;
+ if(!isNil "_weight") then
+ {
+ _totalWeight = _totalWeight + _weight;
+ };
+
+ {
+ _weight = [_x select 0, "CfgWeapons"] call _getItemWeight;
+ if(!isNil "_weight") then
+ {
+ _totalWeight = _totalWeight + (_weight * (_x select 1));
+ };
+ } forEach(_gear select _indexRuckWeapons);
+
+ {
+ _weight = [_x select 0, "CfgMagazines"] call _getItemWeight;
+ if(!isNil "_weight") then
+ {
+ _totalWeight = _totalWeight + (_weight * (_x select 1));
+ };
+ } forEach(_gear select _indexRuckMags);
+ _totalWeight
+};
+
+// Fill in base blank-slot images to the UI
+_fillInBlankImages =
+{
+ ctrlSetText [107, "\ca\ui\data\ui_gear_gun_gs.paa"];
+ ctrlSetText [108, "\ca\ui\data\ui_gear_sec_gs.paa"];
+
+ for "_i" from 109 to 120 do
+ {
+ ctrlSetText [_i, "\ca\ui\data\ui_gear_mag_gs.paa"];
+ };
+
+ ctrlSetText [121, "\ca\ui\data\ui_gear_hgun_gs.paa"];
+
+ for "_i" from 122 to 129 do
+ {
+ ctrlSetText [_i, "\ca\ui\data\ui_gear_hgunmag_gs.paa"];
+ };
+
+ for "_i" from 130 to 131 do
+ {
+ ctrlSetText [_i, "\ca\ui\data\ui_gear_eq_gs.paa"];
+ };
+
+ for "_i" from 134 to 145 do
+ {
+ ctrlSetText [_i, "\ca\ui\data\ui_gear_eq_gs.paa"];
+ };
+
+ ctrlSetText [90020, "\ca\ui\data\ui_gear_gun_gs.paa"];
+ ctrlSetText [90104, "\x\ace\addons\sys_wounds\data\equip\m_morphine_ca.paa"];
+ ctrlSetText [90105, "\x\ace\addons\sys_wounds\data\equip\m_bandage_ca.paa"];
+ ctrlSetText [90106, "\x\ace\addons\sys_wounds\data\equip\m_epi_ca.paa"];
+};
+
+// Takes a gear array and renders it to the UI
+// Returns an array of 2 arrays. The 2 arrays returned are of the format of
+// _currentWeaponUIState and _currentMagazineUIState respectively. See top of file
+// for details.
+_renderGear =
+{
+ private ["_gear","_get","_pic","_itemIndex","_specialIndex","_mainMagIndex","_sideMagIndex","_ifakCount","_item","_isIFAK","_wob",
+ "_weight","_weaponUIState", "_magazineUIState","_magazineSpace"];
+ _gear = _this;
+
+ call _fillInBlankImages;
+
+ _specialIndex = 0;
+ _mainMagIndex = 0;
+ _sideMagIndex = 0;
+ _itemIndex = 0;
+ _ifakCount = [ 0, 0, 0 ];
+ _isIFAK = false;
+ _weaponUIState = [];
+ _magazineUIState = [];
+
+ {
+ _get = [_x, true] call _getItemDataByConfigType;
+ if (!isNil "_get") then
+ {
+ _pic = _get select QUERYGEARPICTURE;
+ if((_get select QUERYGEARTYPE) == "Item" && _itemIndex < 12) then
+ {
+ ctrlSetText [134+_itemIndex, _pic];
+ _weaponUIState = _weaponUIState + [ [134+_itemIndex, _forEachIndex] ];
+ _itemIndex = _itemIndex + 1;
+ }
+ else
+ {
+ if (_x == (_gear select _indexPrimary)) then
+ {
+ ctrlSetText [107, _pic];
+ _weaponUIState = _weaponUIState + [ [107, _forEachIndex] ];
+ }
+ else
+ {
+ if(_x == (_gear select _indexSecondary)) then
+ {
+ _weaponUIState = _weaponUIState + [ [108, _forEachIndex] ];
+ ctrlSetText [108, _pic];
+ }
+ else
+ {
+ if(_x == (_gear select _indexSidearm)) then
+ {
+ _weaponUIState = _weaponUIState + [ [121, _forEachIndex] ];
+ ctrlSetText [121, _pic];
+ }
+ else
+ {
+ ctrlSetText [130+_specialIndex, _pic];
+ _weaponUIState = _weaponUIState + [ [130+_specialIndex, _forEachIndex] ];
+ _specialIndex = _specialIndex + 1;
+ };
+ };
+ };
+ };
+ };
+ } forEach(_gear select _indexWeapons);
+
+ {
+ _get = [_x, false] call _getItemDataByConfigType;
+ if (!isNil "_get") then
+ {
+ _item = _x;
+ _isIFAK = false;
+ {
+ if(_x == _item &&
+ (_ifakCount select _forEachIndex) < 2) exitWith
+ {
+ _ifakCount set [_forEachIndex, (_ifakCount select _forEachIndex) + 1];
+ _isIFAK = true;
+ };
+ } forEach(_typesIFAK);
+
+ if(!_isIFAK) then
+ {
+ _pic = _get select QUERYGEARPICTURE;
+ _magazineSpace = _get select QUERYGEARSPACE;
+ if(_magazineSpace < 1) then
+ {
+ _magazineSpace = 1;
+ };
+ if(!(_get select QUERYGEARHANDGUNPOOL)) then
+ {
+ if((_mainMagIndex + _magazineSpace) <= 12) then
+ {
+ ctrlSetText [109+_mainMagIndex, _pic];
+ _magazineUIState = _magazineUIState + [ [109+_mainMagIndex, _forEachIndex] ];
+ _mainMagIndex = _mainMagIndex + 1;
+
+ _magazineSpace = _magazineSpace - 1;
+ while { _magazineSpace > 0 } do
+ {
+ ctrlSetText [109+_mainMagIndex, ""];
+ _magazineSpace = _magazineSpace - 1;
+ _mainMagIndex = _mainMagIndex + 1;
+ };
+ };
+ }
+ else
+ {
+ if((_sideMagIndex + _magazineSpace) <= 8) then
+ {
+ ctrlSetText [122+_sideMagIndex, _pic];
+ _magazineUIState = _magazineUIState + [ [122+_sideMagIndex, _forEachIndex] ];
+ _sideMagIndex = _sideMagIndex + 1;
+
+ _magazineSpace = _magazineSpace - 1;
+ while { _magazineSpace > 0 } do
+ {
+ ctrlSetText [122+_sideMagIndex, ""];
+ _magazineSpace = _magazineSpace - 1;
+ _sideMagIndex = _sideMagIndex + 1;
+ };
+ };
+ };
+ };
+ };
+ } forEach(_gear select _indexMagazines);
+
+ {
+ ctrlSetText [90107 + _forEachIndex, str _x];
+ } forEach(_ifakCount);
+
+ _wob = _gear select _indexOnBack;
+
+ if(!isNil "_wob" && _wob != '') then
+ {
+ _get = [_wob, true] call _getItemDataByConfigType;
+ ctrlSetText [90020, _get select QUERYGEARPICTURE];
+ };
+
+ _weight = _gear call _getGearWeight;
+ ctrlSetText [90009, format ["%1 kg", _weight]];
+
+ [ _weaponUIState, _magazineUIState ]
+};
+
+// Given a gear array, get the number of "special" items (binocs, rangefinder, etc.) in it.
+// arg0: gear array
+// arg1: type of item e.g. "Special"
+// returns: number of that type contained in gear array.
+_getItemCountByType =
+{
+ private [ "_gear", "_count", "_get", "_itemType", "_countThisOne" ];
+
+ _gear = _this select 0;
+ _itemType = _this select 1;
+
+ _count =
+ {
+ _countThisOne = false;
+ _get = [ _x, true ] call _getItemDataByConfigType;
+ if (!isNil "_get" && (_get select QUERYGEARTYPE) == _itemType) then
+ {
+ _countThisOne = true;
+ }
+ else
+ {
+ _countThisOne = false;
+ };
+ _countThisOne
+ } count (_gear select _indexWeapons);
+ _count
+};
+
+_renderRuckContents =
+{
+ private [ "_gear", "_get", "_i", "_u", "_capacity", "_volume" ];
+ _gear = _this;
+
+ lnbClear 3701;
+ _i = 0;
+ _u = 0;
+ _volume = 0;
+ {
+ _get = [ _x select 0, true ] call _getItemDataByConfigType;
+ if (!isNil "_get") then
+ {
+ lnbAddRow [3701,[str (_x select 1) + "x",(_get select QUERYGEARLABEL)]];
+ lnbSetPicture [3701,[_i,0],_get select QUERYGEARPICTURE];
+ lnbSetData [3701,[_i,0],"CfgWeapons"];
+ lnbSetValue [3701,[_i,0],_u];
+ _i = _i + 1;
+ _u = _u + 1;
+ _volume = _volume + getNumber(configFile >> "CfgWeapons" >> (_x select 0) >> "ACE_size") * (_x select 1);
+ };
+ } forEach(_gear select _indexRuckWeapons);
+
+ _u = 0;
+ {
+ _get = [ _x select 0, false ] call _getItemDataByConfigType;
+ if (!isNil "_get") then
+ {
+ lnbAddRow [3701,[str (_x select 1) + "x",(_get select QUERYGEARLABEL)]];
+ lnbSetPicture [3701,[_i,0],_get select QUERYGEARPICTURE];
+ lnbSetData [3701,[_i,0],"CfgMagazines"];
+ lnbSetValue [3701,[_i,0],_u];
+ _i = _i + 1;
+ _u = _u + 1;
+ _volume = _volume + getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_size") * (_x select 1);
+ };
+ } forEach(_gear select _indexRuckMags);
+
+ _capacity = getNumber(configFile >> "CfgWeapons" >> (_gear call _getGearRuck) >> "ACE_PackSize");
+ ctrlSetText [90000, format [localize "STR_WF_Ruck_Space_Free", _capacity - _volume]];
+};
+
+// arg0: gear array
+// arg1: true if we are looking at handgun magazines
+// returns number of magazines slots consumed (taking magazine size into account)
+// in handgun pool or main pool (according to arg1)
+_getMagazineCountByPool =
+{
+ private [ "_gear", "_get", "_handgunpool", "_count", "_isIFAK", "_ifakCount", "_item" ];
+
+ _gear = _this select 0;
+ _handgunpool = _this select 1;
+ _count = 0;
+ _ifakCount = [ 0, 0, 0 ];
+
+ {
+ _isIFAK = false;
+ _item = _x;
+ {
+ if(_x == _item &&
+ (_ifakCount select _forEachIndex) < 2) exitWith
+ {
+ _ifakCount set [_forEachIndex, (_ifakCount select _forEachIndex) + 1];
+ _isIFAK = true;
+ };
+ } forEach(_typesIFAK);
+
+ if (!_isIFAK) then
+ {
+ _get = [_item, false] call _getItemDataByConfigType;
+ if((_handgunpool && (_get select QUERYGEARHANDGUNPOOL)) ||
+ (!_handgunpool && !(_get select QUERYGEARHANDGUNPOOL))) then
+ {
+ if((_get select QUERYGEARSPACE) == 0) then
+ {
+ _count = _count + 1;
+ }
+ else
+ {
+ _count = _count + (_get select QUERYGEARSPACE);
+ };
+ };
+ };
+ } forEach(_gear select _indexMagazines);
+ _count
+};
+
+// arg0: gear array
+// arg1: magazine to add
+// arg2: (optional) item data on the magazine we are adding.
+// Will only succeed if the magazine fits.
+_addMagazineToGear =
+{
+ private [ "_gear", "_magazine", "_get", "_magCount", "_magLimit", "_magSize", "_oldMagazines" ];
+
+ _gear = _this select 0;
+ _magazine = _this select 1;
+
+ if ((count _this) >= 3) then
+ {
+ _get = _this select 2;
+ }
+ else
+ {
+ _get = [_magazine, false] call _getItemDataByConfigType;
+ };
+
+ // Add magazines to a temporary copy of the gear array, and see if it's too much.
+ // This handles the IFAK stuff (infantry first aid kit) for us.
+ _oldMagazines = _gear select _indexMagazines;
+ _gear set [_indexMagazines,
+ _oldMagazines + [ _magazine ] ];
+ _magCount = [ _gear, _get select QUERYGEARHANDGUNPOOL] call _getMagazineCountByPool;
+ _magLimit = if(_get select QUERYGEARHANDGUNPOOL) then { 8 } else { 12 };
+
+ // DEBUG
+ diag_log format ["WFBE (AceGear): magCount: %1 magLimit: %2 mag: ", _magCount, _magLimit, _magazine ];
+
+ if(_magCount > _magLimit) then
+ {
+ // Doesn't fit; revert back
+ _gear set [ _indexMagazines, _oldMagazines ];
+ };
+};
+
+// arg0: unit
+// arg1: gear array
+// equip that gear to the unit.
+_applyGearToUnit =
+{
+ private ["_gear","_unit","_muzzles"];
+
+ _unit = _this select 0;
+ _gear = _this select 1;
+
+ removeAllWeapons _unit;
+ removeAllItems _unit;
+ removeBackpack _unit;
+ {_unit addMagazine _x} foreach (_gear select _indexMagazines);
+ {_unit addWeapon _x} foreach (_gear select _indexWeapons);
+ if (primaryWeapon _unit != "") then
+ {
+ _unit selectWeapon (primaryWeapon _unit);
+ _muzzles = getArray(configFile>>"cfgWeapons" >> primaryWeapon _unit >> "muzzles");
+ _unit selectWeapon (_muzzles select 0);
+ };
+
+ _safeArray = _gear select _indexRuckMags;
+ _unit setVariable ["ACE_RuckMagContents", +_safeArray];
+ _safeArray = _gear select _indexRuckWeapons;
+ _unit setVariable ["ACE_RuckWepContents", +_safeArray];
+
+ if((_gear select _indexOnBack) != "") then
+ {
+ _unit setVariable ["ACE_weapononback", _gear select _indexOnBack];
+ }
+ else
+ {
+ _unit setVariable ["ACE_weapononback", ""];
+ };
+};
+
+// arg: gear array
+// returns: rucksack in gear or ""
+_getGearRuck =
+{
+ private ["_gear","_maybeRuck"];
+
+ _gear = _this;
+ _maybeRuck = _gear select _indexSecondary;
+ if(!isNumber(configFile >> "CfgWeapons" >> _maybeRuck >> "ACE_PackSize")) then
+ {
+ _maybeRuck = _gear select _indexOnBack;
+ if(isClass(configFile >> "CfgWeapons" >> _maybeRuck)) then
+ {
+ if(!isNumber(configFile >> "CfgWeapons" >> _maybeRuck >> "ACE_PackSize")) then
+ {
+ _maybeRuck = "";
+ };
+ }
+ else
+ {
+ _maybeRuck = "";
+ };
+ };
+ _maybeRuck
+};
+
+// arg 0: item
+// arg 1: config type (CfgWeapons, etc.)
+// arg 2: gear array
+_addItemToRuck =
+{
+ private [ "_item", "_gear", "_configType", "_ruck", "_capacity", "_size", "_added", "_packable" ];
+
+ _item = _this select 0;
+ _configType = _this select 1;
+ _gear = _this select 2;
+ _packable = true;
+
+ if(getNumber(configFile >> _configType >> _item >> "ACE_NoPack") == 1 ||
+ getNumber(configFile >> _configType >> _item >> "ACE_disposable") == 1) then
+ {
+ _packable = false;
+ };
+
+ _ruck = _gear call _getGearRuck;
+ _capacity = 0;
+ if(_ruck != "") then
+ {
+ _capacity = getNumber(configFile >> "CfgWeapons" >> _ruck >> "ACE_PackSize");
+ };
+ _size = getNumber(configFile >> _configType >> _item >> "ACE_size");
+ _size = _size + (_gear call _getRuckItemsVolume);
+ if(_packable && _size <= _capacity) then
+ {
+ if(_configType == "CfgWeapons") then
+ {
+ _added = false;
+ {
+ if((_x select 0) == _item) exitWith
+ {
+ _added = true;
+ _x set [1, (_x select 1) + 1];
+ };
+ } forEach(_gear select _indexRuckWeapons);
+ if(!_added) then
+ {
+ _gear set [_indexRuckWeapons,
+ (_gear select _indexRuckWeapons) +
+ [ [ _item, 1 ] ] ];
+ };
+ }
+ else
+ {
+ _added = false;
+ {
+ if((_x select 0) == _item) exitWith
+ {
+ _added = true;
+ _x set [1, (_x select 1) + 1];
+ };
+ } forEach(_gear select _indexRuckMags);
+ if(!_added) then
+ {
+ _gear set [_indexRuckMags,
+ (_gear select _indexRuckMags) +
+ [ [ _item, 1 ] ] ];
+ };
+ };
+ };
+};
+
+_currentUnit = 0;
+{
+ if(isPlayer _x) exitWith
+ {
+ _currentUnit = _forEachIndex;
+ };
+} forEach(units group player);
+
+_currentGear = [player] call _inventoryToGear;
+_initialCost = _currentGear call _getGearCost;
+_updateGear = true;
+_updateMainList = true;
+_updateSecondaryList = true;
+_updateUnit = true;
+_backpackSelected = false;
+_selectedWeapon = '';
+_currentMagazineUIState = [];
+_currentWeaponUIState = [];
+_currentFilter = 0;
+_updateCosts = true;
+
+_defaultWeap = Format ["WFBE_%1DEFAULTWEAPONS",sideJoinedText] Call GetNamespace;
+_defaultAmmo = Format ["WFBE_%1DEFAULTAMMO",sideJoinedText] Call GetNamespace;
+
+if (paramAceWounds) then
+{
+ _defaultAmmo = _defaultAmmo + [ 'ACE_Morphine', 'ACE_Morphine', 'ACE_Bandage', 'ACE_Bandage' ];
+ if(getNumber(configFile >> "CfgVehicles" >> (typeOf player) >> "attendant") == 1) then
+ {
+ _defaultAmmo = _defaultAmmo + [ 'ACE_Epinephrine', 'ACE_Epinephrine', 'ACE_Medkit', 'ACE_Medkit' ];
+ };
+};
+
+_defaultLoadoutCost = [ _defaultWeap, _defaultAmmo, "", [], [], "", "", "" ] call _getGearCost;
+
+WF_Logic setVariable ['InventoryClick',-1];
+WF_Logic setVariable ['lbMainAction',''];
+WF_Logic setVariable ['lbChange',false];
+WF_Logic setVariable ['WF_Gear_Action',""];
+
+call _fillInBlankImages;
+
+// And now the main UI loop.
+while {alive player && dialog} do {
+ _lbSelChanged = WF_Logic getVariable 'lbChange';
+ _mainCommand = WF_Logic getVariable 'lbMainAction';
+ _inventoryClick = WF_Logic getVariable 'InventoryClick';
+ _gearAction = WF_Logic getVariable 'WF_Gear_Action';
+
+ if (_lbSelChanged) then
+ {
+ WF_Logic setVariable ['lbChange',false];
+ _weaponList = call compile format ["_%1%2", _filterNames select _currentFilter,
+ if(_backpackSelected) then { "Backpack" } else { "" }];
+ _selectedWeapon = _weaponList select lnbValue [3700, [lnbCurSelRow 3700, 0]];
+ _get = [_selectedWeapon, _filterNames select _currentFilter] call _getItemDataByFilterType;
+ _configType = _get select QUERYGEARCLASS;
+
+ if(!_backpackSelected) then
+ {
+ _weight = getNumber(configFile >> _configType >> _selectedWeapon >> "ACE_weight");
+ ctrlSetText [ 90005, format [ "%1 kg", _weight ]];
+ _updateSecondaryList = true;
+ };
+ };
+
+ if (_inventoryClick != -1) then
+ {
+ WF_Logic setVariable ['InventoryClick',-1];
+ if(_inventoryClick == 90020) then
+ {
+ _currentGear set [_indexOnBack, ""];
+ _updateGear = true;
+ }
+ else
+ {
+ {
+ if(_inventoryClick == (_x select 0)) exitWith
+ {
+ _weapon = (_currentGear select _indexWeapons) select (_x select 1);
+
+ if (_weapon == (_currentGear select _indexPrimary)) then
+ {
+ _currentGear set [_indexPrimary, ""];
+ };
+ if (_weapon == (_currentGear select _indexSecondary)) then
+ {
+ _currentGear set [_indexSecondary, ""];
+ };
+ if (_weapon == (_currentGear select _indexSidearm)) then
+ {
+ _currentGear set [_indexSidearm, ""];
+ };
+ if (_weapon == (_currentGear select _indexOnBack)) then
+ {
+ _currentGear set [_indexOnBack, ""];
+ };
+
+ (_currentGear select _indexWeapons) set [_x select 1, 0];
+ _currentGear set [_indexWeapons,
+ (_currentGear select _indexWeapons) - [ 0 ]];
+ };
+ } forEach(_currentWeaponUIState);
+ };
+
+ {
+ if(_inventoryClick == (_x select 0)) exitWith
+ {
+ (_currentGear select _indexMagazines) set [_x select 1, 0];
+ _currentGear set [_indexMagazines,
+ (_currentGear select _indexMagazines) - [ 0 ]];
+ };
+ } forEach(_currentMagazineUIState);
+
+ // If ruck was removed, remove contents too.
+ if ((_currentGear call _getGearRuck) == "") then
+ {
+ _currentGear set [_indexRuckWeapons, []];
+ _currentGear set [_indexRuckMags, []];
+ if(_backpackSelected) then
+ {
+ _backpackSelected = false;
+ _updateSecondaryList = true;
+ };
+ };
+ _updateGear = true;
+ };
+
+ if (_mainCommand != '') then
+ {
+ WF_Logic setVariable ['lbMainAction',''];
+ _weaponList = call compile format ["_%1%2", _filterNames select _currentFilter,
+ if(_backpackSelected) then { "Backpack" } else { "" }];
+ if (_selectedWeapon != '') then
+ {
+ _magazineList = _selectedWeapon call _getCompatibleMagazines;
+ }
+ else
+ {
+ _magazineList = [];
+ };
+
+ switch (_mainCommand) do
+ {
+ case 'unitPlus': {
+ _currentUnit = _currentUnit + 1;
+ if(_currentUnit >= (count units group player)) then
+ {
+ _currentUnit = 0;
+ };
+ _updateUnit = true;
+ };
+
+ case 'unitMinus': {
+ _currentUnit = _currentUnit - 1;
+ if(_currentUnit < 0) then
+ {
+ _currentUnit = (count units group player) - 1;
+ };
+ _updateUnit = true;
+ };
+
+ case 'filterPlus': {
+ _currentFilter = _currentFilter + 1;
+ if(_currentFilter >= 5) then
+ {
+ _currentFilter = 0;
+ };
+ ctrlSetText [148, format ["\ca\ui\data\igui_gear_filter_%1_ca.paa",
+ _currentFilter+1]];
+ _updateMainList = true;
+ };
+
+ case 'filterMinus': {
+ _currentFilter = _currentFilter - 1;
+ if(_currentFilter < 0) then
+ {
+ _currentFilter = 4;
+ };
+ ctrlSetText [148, format ["\ca\ui\data\igui_gear_filter_%1_ca.paa",
+ _currentFilter+1]];
+ _updateMainList = true;
+ };
+
+ case 'buy': {
+ _funds = call GetPlayerFunds;
+ _cost = (_currentGear call _getGearCost) - _initialCost;
+ if(_funds >= _cost) then
+ {
+ (-_cost) Call ChangePlayerFunds;
+ _unit = (units group player) select _currentUnit;
+ if(isNil "_unit" || !alive _unit) then
+ {
+ _currentUnit = 0;
+ _updateUnit = true;
+ }
+ else
+ {
+ [ _unit, _currentGear] call _applyGearToUnit;
+ if (isPlayer _unit) then
+ {
+ respawnGearCost = _respawnCost;
+ respawnWeapons = _currentGear select _indexWeapons;
+ respawnAmmo = _currentGear select _indexMagazines;
+ respawnWeaponOnBack = _currentGear select _indexOnBack;
+ respawnAceRuckContents = [ _currentGear select _indexRuckWeapons,
+ _currentGear select _indexRuckMags ];
+ };
+ _initialCost = (_currentGear call _getGearCost);
+ _updateGear = true;
+ };
+ }
+ else
+ {
+ hint parseText(Format [localize "STR_WF_Funds_Missing_Gear",_cost - _funds]);
+ };
+ };
+
+ case 'addMagazine': {
+ if(!_backpackSelected) then
+ {
+ _mag = _magazineList select lnbValue [3701, [lnbCurSelRow 3701, 0]];
+ [ _currentGear, _mag ] call _addMagazineToGear;
+ _updateGear = true;
+ }
+ else
+ {
+ // A double click in ruck mode actually means remove from inventory.
+ _ruckIndex = lnbValue [3701, [lnbCurSelRow 3701, 0]];
+ _ruckItemClass = lnbData [3701, [lnbCurSelRow 3701, 0]];
+
+ if(_ruckItemClass == "CfgWeapons") then
+ {
+ _ruckItem = (_currentGear select _indexRuckWeapons) select _ruckIndex;
+ if((_ruckItem select 1) > 1) then
+ {
+ _ruckItem set [1, (_ruckItem select 1) - 1];
+ }
+ else
+ {
+ (_currentGear select _indexRuckWeapons) set [_ruckIndex, 0];
+ _currentGear set [_indexRuckWeapons,
+ (_currentGear select _indexRuckWeapons) - [ 0 ]];
+ };
+ }
+ else
+ {
+ _ruckItem = (_currentGear select _indexRuckMags) select _ruckIndex;
+ if((_ruckItem select 1) > 1) then
+ {
+ _ruckItem set [1, (_ruckItem select 1) - 1];
+ }
+ else
+ {
+ (_currentGear select _indexRuckMags) set [_ruckIndex, 0];
+ _currentGear set [_indexRuckMags,
+ (_currentGear select _indexRuckMags) - [ 0 ]];
+ };
+ };
+ _updateSecondaryList = true;
+ _updateCosts = true;
+ };
+ };
+
+ case 'addMainItem': {
+ _weapon = _weaponList select lnbValue [3700, [lnbCurSelRow 3700, 0]];
+ _get = [_weapon, _filterNames select _currentFilter] call _getItemDataByFilterType;
+
+ if ((_get select QUERYGEARCLASS) == "CfgMagazines") then
+ {
+ if(_backpackSelected) then
+ {
+ [_weapon, "CfgMagazines", _currentGear] call _addItemToRuck;
+ _updateSecondaryList = true;
+ _updateCosts = true;
+ }
+ else
+ {
+ [_currentGear, _weapon, _get] call _addMagazineToGear;
+ _updateGear = true;
+ };
+ }
+ else
+ {
+ if(_backpackSelected) then
+ {
+ [_weapon, "CfgWeapons", _currentGear] call _addItemToRuck;
+ _updateSecondaryList = true;
+ _updateCosts = true;
+ }
+ else
+ {
+ _add = false;
+ if (_weapon in _primary) then
+ {
+ if ((_currentGear select _indexPrimary) != '') then
+ {
+ _currentGear set [ _indexWeapons,
+ (_currentGear select _indexWeapons) - [ _currentGear select _indexPrimary ] ];
+ };
+ _currentGear set [_indexPrimary, _weapon];
+ _add = true;
+ }
+ else
+ {
+ if (_weapon in _secondary) then
+ {
+ if ((_currentGear select _indexSecondary) != '') then
+ {
+ _currentGear set [ _indexWeapons,
+ (_currentGear select _indexWeapons) - [ _currentGear select _indexSecondary ] ];
+ };
+ _currentGear set [_indexSecondary, _weapon];
+ _add = true;
+ }
+ else
+ {
+ if (_weapon in _sidearm) then
+ {
+ if ((_currentGear select _indexSidearm) != '') then
+ {
+ _currentGear set [ _indexWeapons,
+ (_currentGear select _indexWeapons) - [ _currentGear select _indexSidearm ] ];
+ };
+ _currentGear set [_indexSidearm, _weapon];
+ _add = true;
+ }
+ else
+ {
+ if ((_get select QUERYGEARTYPE) == "Special") then
+ {
+ _itemCount = [_currentGear, "Special"] call _getItemCountByType;
+ if(_itemCount < 2) then
+ {
+ _add = true;
+ };
+ };
+
+ if((_get select QUERYGEARTYPE) == "Item") then
+ {
+ _itemCount = [_currentGear, "Item"] call _getItemCountByType;
+ if(_itemCount < 12) then
+ {
+ _add = true;
+ };
+ };
+ };
+ };
+ };
+
+ if(_add) then
+ {
+ _currentGear set [ _indexWeapons,
+ (_currentGear select _indexWeapons) + [ _weapon ]];
+ _updateGear = true;
+ };
+ };
+ };
+ };
+ };
+ };
+
+ if(_gearAction != "") then
+ {
+ WF_Logic setVariable ["WF_Gear_Action",""];
+ switch(_gearAction) do
+ {
+ case 'backpack': {
+ if(_backpackSelected) then
+ {
+ _backpackSelected = false;
+ _updateSecondaryList = true;
+ _updateMainList = true;
+ }
+ else
+ {
+ if((_currentGear call _getGearRuck) != "") then
+ {
+ _backpackSelected = true;
+ _updateSecondaryList = true;
+ _updateMainList = true;
+ };
+ };
+ };
+
+ case 'reload': {
+ if(!isNil "respawnWeapons") then
+ {
+ _currentGear set [_indexWeapons, respawnWeapons];
+ _currentGear set [_indexMagazines, respawnAmmo];
+ _currentGear set [_indexOnBack, respawnWeaponOnBack];
+ _currentGear set [_indexRuckWeapons, respawnAceRuckContents select 0];
+ _currentGear set [_indexRuckMags, respawnAceRuckContents select 1];
+ }
+ else
+ {
+ _currentGear set [_indexWeapons, Format ["WFBE_%1DEFAULTWEAPONS",sideJoinedText] Call GetNamespace];
+ _currentGear set [_indexMagazines, Format ["WFBE_%1DEFAULTAMMO",sideJoinedText] Call GetNamespace];
+ _currentGear set [_indexOnBack, ""];
+ _currentGear set [_indexRuckWeapons, []];
+ _currentGear set [_indexRuckMags, []];
+ };
+
+ {
+ if(_x in _primary) then
+ {
+ _currentGear set [_indexPrimary, _x];
+ };
+
+ if(_x in _secondary) then
+ {
+ _currentGear set [_indexSecondary, _x];
+ };
+
+ if(_x in _sidearm) then
+ {
+ _currentGear set [_indexSidearm, _x];
+ };
+ } forEach(_currentGear select _indexWeapons);
+
+ _updateGear = true;
+ };
+
+ case 'clear': {
+ _currentGear = [ [], [], "", [], [], "", "", "" ];
+ _updateGear = true;
+ };
+
+ case 'primary_onback': {
+ if ((_currentGear select _indexPrimary) != '') then
+ {
+ _weapon = _currentGear select _indexPrimary;
+ _currentGear set [ _indexWeapons,
+ (_currentGear select _indexWeapons) - [ _currentGear select _indexPrimary ] ];
+ _currentGear set [_indexPrimary, ""];
+ _currentGear set [_indexOnBack, _weapon];
+ _updateGear = true;
+ };
+ };
+
+ case 'secondary_onback': {
+ if ((_currentGear select _indexSecondary) != '') then
+ {
+ _weapon = _currentGear select _indexSecondary;
+ _currentGear set [ _indexWeapons,
+ (_currentGear select _indexWeapons) - [ _currentGear select _indexSecondary ] ];
+ _currentGear set [_indexSecondary, ""];
+ _currentGear set [_indexOnBack, _weapon];
+ _updateGear = true;
+ };
+ };
+ };
+ };
+
+ if (_updateUnit) then
+ {
+ _unit = (units group player) select _currentUnit;
+ _backpackSelected = false;
+ _currentGear = [_unit] call _inventoryToGear;
+ _updateGear = true;
+ _updateMainList = true;
+ _updateSecondaryList = true;
+ ctrlSetText [101, format ["[%1] " + name _unit, _currentUnit]];
+ _initialCost = _currentGear call _getGearCost;
+ _updateUnit = false;
+ };
+
+ if (_updateGear) then
+ {
+ _temp = _currentGear call _renderGear;
+ _currentWeaponUIState = _temp select 0;
+ _currentMagazineUIState = _temp select 1;
+ _updateGear = false;
+ _updateCosts = true;
+ };
+
+ if(_updateCosts) then
+ {
+ _updateCosts = false;
+ _cost = _currentGear call _getGearCost;
+ ctrlSetText [152, (localize "STR_WF_GEAR_CostLabel") + " " + (format [localize "STR_WF_GEAR_Cost", _cost - _initialCost])];
+ ctrlSetText [150, (localize "STR_WF_GEAR_CashLabel") + " " + (format [localize "STR_WF_GEAR_Cost", call GetPlayerFunds])];
+
+ _respawnCost = _cost - _defaultLoadoutCost;
+ if(_respawnCost < 0) then
+ {
+ _respawnCost = 0;
+ };
+
+ _respawnPenalty = 'WFBE_RESPAWNPENALTY' Call GetNamespace;
+
+ if (isPlayer (units group player select _currentUnit) && _respawnPenalty in [2,3,4,5]) then
+ {
+ _divisor = 1;
+ switch (_respawnPenalty) do
+ {
+ case 3: {_divisor = 2};
+ case 4: {_divisor = 4};
+ };
+ ctrlSetText [151, format [localize "STR_WF_Respawn_Cost", round (_respawnCost / _divisor) ]];
+ }
+ else
+ {
+ ctrlSetText [151, ""];
+ };
+ };
+
+ if(_updateMainList) then
+ {
+ lnbClear 3700;
+ _weaponList = call compile format ["_%1%2", _filterNames select _currentFilter,
+ if(_backpackSelected) then { "Backpack" } else { "" }];
+ [_weaponList, _filterNames select _currentFilter, 3700] call UIGearFillList;
+ _updateMainList = false;
+ _selectedWeapon = "";
+ _updateSecondaryList = true;
+ };
+
+ if(_updateSecondaryList) then
+ {
+ lnbClear 3701;
+ if (_backpackSelected) then
+ {
+ _currentGear call _renderRuckContents;
+ ctrlSetText [90009, format ["%1 kg", _currentGear call _getGearWeight]];
+ }
+ else
+ {
+ ctrlSetText [90000,localize "STR_WF_Magazines"];
+ ctrlSetText [90005, ""];
+ ctrlSetText [90007, ""];
+ if (_selectedWeapon != '') then
+ {
+ _magazineList = _selectedWeapon call _getCompatibleMagazines;
+ [_magazineList, "magazine", 3701] call UIGearFillList;
+ };
+ };
+ _updateSecondaryList = false;
+ };
+ sleep 0.05;
+};
+
+WF_Logic setVariable ['InventoryClick',nil];
+WF_Logic setVariable ['lbMainAction',nil];
+WF_Logic setVariable ['lbChange',nil]; \ No newline at end of file
diff --git a/Client/GUI/GUI_GearBeta.sqf b/Client/GUI/GUI_GearBeta.sqf
new file mode 100644
index 0000000..c0d8c64
--- /dev/null
+++ b/Client/GUI/GUI_GearBeta.sqf
@@ -0,0 +1,1057 @@
+/* Important, use +array if you plan to use Setters */
+
+
+private ["_backpack","_get","_u","_unitBP","_inRange","_sideID","_nObjects","_nObject","_unitList",
+"_text","_amount","_val","_val2","_ainumber","_txt","_type","_check","_updateFiller","_manageBackpack",
+"_list","_id","_changed","_currentMags","_currentRow","_currentData","_currentValue","_currentItem",
+"_skip","_backpackloadout","_bpcost","_get2","_oldMags","_currentMagazines","_slist","_index",
+"_currentWeapons","_displayInv","_arrayType","_arrayAmount","_currentBPRow","_currentBPValue",
+"_currentBPItem","_hasSpace","_updateBackpack","_zt","_currentSpecialCost","_currentSpecials",
+"_currentItems","_currentUpgrades","_getnum","_currentPrimary","_currentPrimaryCost","_currentSecondary",
+"_currentSecondaryCost","_currentSidearm","_currentSidearmCost","_cwep","_x","_tempWeapons",
+"_tempItems","_tempMags","_tempSpecs","_currentBackpackLoadout","_currentBackpackLoadoutAmount",
+"_tfil","_currentMagValue","_currentMag","_currentBPItemValue","_itemAmount","_currentUnit","_updateUnit",
+"_currentCost","_sideGear","_found","_show","_data","_inventorySlots","_sidearmInventorySlots",
+"_miscItemSlots","_cost","_slot","_upgradeCost","_currentBackpackLoadoutCost","_currentBackpackLoadoutPictures",
+"_currentBackpackLoadoutNames","_currentBackpackLoadoutUpgrades","_currentBackpackLoadoutAllowed",
+"_temp","_weaps","_add","_funds","_template","_templateCosts","_templatePictures","_templateNames",
+"_templateMags","_templateItems","_templateSpecs","_templateUpgrades","_templateAllowed","_cAllow",
+"_desc","_pict","_upgr","_addin","_filler","_mainAction","_inventoryClick","_unitSwap","_actionSE",
+"_lastFiller","_primary","_secondary","_sidearm","_misc","_magazine","_returnProperBag","_listbp",
+"_all","_lb","_lbm","_primaryIDC","_secondaryIDC","_sidearmIDC","_specialIDC","_display","_totalWeapons",
+"_fillerIDC","_fillerTypes","_old","_disp","_buildings","_getpp","_isPrimAllowTwo","_getss","_isSecoAllowTwo",
+"_sskip","_query","_pallow","_sallow","_secondarySlotIDC"];
+
+_primary = +(WF_Logic getVariable 'primaryClasses');
+_secondary = +(WF_Logic getVariable 'secondaryClasses');
+_sidearm = +(WF_Logic getVariable 'sidearmClasses');
+_misc = +(WF_Logic getVariable 'miscClasses');
+_magazine = +(WF_Logic getVariable 'magazineClasses');
+
+_template = +(WF_Logic getVariable 'templateClasses');
+_templateCosts = +(WF_Logic getVariable 'templateCosts');
+_templatePictures = +(WF_Logic getVariable 'templatePictures');
+_templateNames = +(WF_Logic getVariable 'templateNames');
+_templateMags = +(WF_Logic getVariable 'templateMags');
+_templateItems = +(WF_Logic getVariable 'templateItems');
+_templateSpecs = +(WF_Logic getVariable 'templateSpecs');
+_templateUpgrades = +(WF_Logic getVariable 'templateUpgrades');
+_templateAllowed = +(WF_Logic getVariable 'templateAllowed');
+
+_currentUnit = player;
+_secondarySlotIDC = 3501;
+
+_returnProperBag = {
+ Private ['_bag'];
+ _bag = _this select 0;
+
+ if (_bag in ['US_Assault_Pack_Ammo_EP1','US_Assault_Pack_AmmoSAW_EP1','US_Assault_Pack_AT_EP1','US_Assault_Pack_Explosives_EP1']) then {_bag = 'US_Assault_Pack_EP1'};
+ if (_bag in ['US_Patrol_Pack_Ammo_EP1','US_Patrol_Pack_Specops_EP1']) then {_bag = 'US_Patrol_Pack_EP1'};
+ if (_bag in ['US_Backpack_AmmoMG_EP1','US_Backpack_AT_EP1','US_Backpack_Specops_EP1']) then {_bag = 'US_Backpack_EP1'};
+ if (_bag in ['TK_ALICE_Pack_Explosives_EP1','TK_ALICE_Pack_AmmoMG_EP1','TKA_ALICE_Pack_Ammo_EP1','TKG_ALICE_Pack_AmmoAK47_EP1','TKG_ALICE_Pack_AmmoAK74_EP1']) then {_bag = 'TK_ALICE_Pack_EP1'};
+ if (_bag in ['TK_Assault_Pack_RPK_EP1','TKA_Assault_Pack_Ammo_EP1']) then {_bag = 'TK_Assault_Pack_EP1'};
+ if (paramDLCBAF) then {if (_bag in ['BAF_AssaultPack_ARAmmo','BAF_AssaultPack_MGAmmo','BAF_AssaultPack_ATAmmo','BAF_AssaultPack_HATAmmo','BAF_AssaultPack_Special','BAF_AssaultPack_FAC','BAF_AssaultPack_HAAAmmo','BAF_AssaultPack_LRRAmmo']) then {_bag = 'BAF_AssaultPack_RifleAmmo'}};
+
+ _bag
+};
+
+/* Backpack management - Init */
+_backpackloadout = [];
+_backpack = [];
+
+_currentBackpackLoadout = [];
+_currentBackpackLoadoutAmount = [];
+_currentBackpackLoadoutCost = [];
+_currentBackpackLoadoutPictures = [];
+_currentBackpackLoadoutNames = [];
+_currentBackpackLoadoutUpgrades = [];
+_currentBackpackLoadoutAllowed = [];
+_unitBP = "";
+_bpcost = 0;
+_listbp = 'WFBE_BACKPACKS' Call GetNamespace;
+if !(WF_A2_Vanilla) then {
+ _u = 0;
+ _backpack = _magazine;
+ {
+ _get = '_x' Call GetNamespace;
+ if ((_get select QUERYGEARTYPE) == 'CfgMagazines') then {
+ _backpack = _backpack + [_x];
+ };
+ _u = _u + 1;
+ } forEach _misc;
+
+ if !(isNull (unitBackpack _currentUnit)) then {
+ _unitBP = typeOf (unitBackpack _currentUnit);
+ _unitBP = [_unitBP] Call _returnProperBag;
+ };
+};
+
+_all = _primary + _secondary + _sidearm + _misc;
+
+WF_Logic setVariable ['lbChange',false];
+WF_Logic setVariable ['lbMainAction',''];
+WF_Logic setVariable ['InventoryClick',-1];
+WF_Logic setVariable ['WF_GEAR_Swap',false];
+WF_Logic setVariable ['WF_Gear_Action',''];
+
+primClicked = false;
+secoClicked = false;
+sideClicked = false;
+deleteLoadout = false;
+saveLoadout = false;
+buyLoadout = false;
+_displayInv = false;
+_updateUnit = true;
+_updateFiller = false;
+_manageBackpack = false;
+_updateBackpack = false;
+
+disableSerialization;
+_lb = 3700;
+_lbm = 3701;
+_primaryIDC = 3500;
+_secondaryIDC = 3501;
+_sidearmIDC = 3502;
+_specialIDC = 3535;
+_display = _this select 0;
+
+_totalWeapons = count _primary + count _secondary + count _sidearm;
+
+_fillerIDC = [3400,3401,3402,3403,3404,3405];
+_fillerTypes = ['template','all','primary','secondary','sidearm','misc'];
+_inventorySlots = [];
+_lastFiller = 'nil';
+_id = _fillerTypes find 'primary';
+_list = [];
+_miscItemSlots = [];
+_sidearmInventorySlots = [];
+(_display DisplayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1];
+
+_currentItem = '';
+_currentMags = [];
+_currentData = '';
+_currentValue = '';
+_currentCost = 0;
+_cost = 0;
+
+_currentPrimary = '';
+_currentSecondary = '';
+_currentSidearm = '';
+_currentPrimaryCost = 0;
+_currentSecondaryCost = 0;
+_currentSidearmCost = 0;
+_currentSpecialCost = 0;
+
+_old = '';
+
+_currentWeapons = [];
+_currentSpecials = [];
+_currentItems = [];
+_currentMagazines = [];
+
+_disp = (findDisplay 16000) displayAddEventHandler ['KeyDown','_this Call WF_Gear_Hotkeys'];
+_buygearfrom = missionNamespace getVariable "WFBE_TOWNGEAR";
+
+//--- Fill the available units list.
+_unitList = [];
+_buildings = (sideJoinedText) Call GetSideStructures;
+_i = 0;
+{
+ _check = ['BARRACKSTYPE',_buildings,'WFBE_PURCHASEGEARRANGE' Call GetNamespace,sideJoined,_x] Call BuildingInRange;
+ _inRange = if (isNull _check) then {false} else {true};
+
+ if (!_inRange && _buygearfrom in [1,2,3]) then {
+ _lookfor = switch (_buygearfrom) do { case 1:{WFCAMP}; case 2:{WFDEPOT}; case 3:{WFCAMP + WFDEPOT}; default{[]}};
+ _nObjects = nearestObjects [_x, _lookfor, 25];
+ _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};
+ if !(isNull _nObject) then {
+ _sideID = _nObject getVariable "sideID";
+ if !(isNil "_sideID") then {
+ if (_sideID == sideID) then {_inRange = true};
+ };
+ };
+ };
+
+ if (_inRange) then {
+ _txt = (_x) Call GetAIDigit;
+ _unitList = _unitList + [_x];
+
+ _type = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ lbAdd [3854,Format["[%1] %2 (%3)",_txt,name _x,_type]];
+
+ if (_currentUnit == _x) then {lbSetCurSel[3854,_i]};
+ _i = _i + 1;
+ };
+} forEach units(group player);
+
+while {alive player && dialog} do {
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+
+ //--- Something changed since the last time?
+ _filler = WF_Logic getVariable 'filler';
+ _changed = WF_Logic getVariable 'lbChange';
+ _mainAction = WF_Logic getVariable 'lbMainAction';
+ _inventoryClick = WF_Logic getVariable 'InventoryClick';
+ _unitSwap = WF_Logic getVariable 'WF_GEAR_Swap';
+ _actionSE = WF_Logic getVariable 'WF_Gear_Action';
+
+ //--- Filter Changed.
+ if (_filler != _lastFiller || _updateFiller) then {
+ _updateFiller = false;
+ _manageBackpack = false;
+ _list = Call Compile Format ['_%1',_filler];
+ lnbClear _lb;
+ if (_filler != 'template') then {
+ [_list,_filler,_lb] Call UIGearFillList;
+ } else {
+ [_templateCosts,_templateNames,_templatePictures,_templateUpgrades,_templateAllowed,_filler,_lb] Call UIGearFillTemplateList;
+ };
+ _id = _fillerTypes find _filler;
+ {(_display displayCtrl _x) ctrlSetTextColor [0.7490, 0.7490, 0.7490, 0.7]} forEach _fillerIDC;
+ (_display displayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1];
+ //--- Update the list since the filler changed.
+ _changed = true;
+ };
+
+ //--- List Selection Changed.
+ if (_changed) then {
+ if !(_manageBackpack) then {
+ WF_Logic setVariable ['lbChange',false];
+ _currentRow = lnbCurSelRow _lb;
+ _currentData = lnbData[_lb,[_currentRow,0]];
+ _currentValue = lnbValue[_lb,[_currentRow,0]];
+ _currentItem = _list select _currentValue;
+ lnbClear _lbm;
+ _get = [];
+
+ /* Get */
+ if (_filler != 'template') then {
+ if (_filler == 'secondary' || _filler == 'all') then {
+ _get = (_currentItem+'_W') Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _currentItem Call GetNamespace;
+ };
+ } else {
+ _get = _currentItem Call GetNamespace;
+ };
+
+ if !(isNil '_get') then {
+ _currentMags = _get select QUERYGEARMAGAZINES;
+ if (typeName _currentMags != 'SCALAR') then {
+ if (count _currentMags > 0) then {
+ [_currentMags,'magazine',_lbm] Call UIGearFillList;
+ };
+ };
+ };
+ };
+ };
+ WF_Logic setVariable ['lbChange',false];
+ };
+
+ //--- Player have clicked on one of the listbox.
+ if (_mainAction != '') then {
+ switch (_mainAction) do {
+ case 'addWeapon': {
+ _skip = true;
+ _sskip = false;
+ _get = [];
+
+ if (_filler != 'template') then {
+ _get = (_currentItem+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _currentItem Call GetNamespace;
+ };
+ };
+
+
+ _tfil = if (_manageBackpack) then {'backpack'} else {_filler};
+ if (_tfil == 'primary' || _tfil == 'secondary' || _tfil == 'sidearm' || _tfil == 'all') then {
+ if (_currentItem in _misc) then {_skip = false;_currentValue = _currentValue - _totalWeapons};
+ if (_skip) then {
+ _slist = Call Compile Format ['_%1',_currentData];
+ _index = _slist find _currentItem;
+ if (_index != -1) then {
+ if (_filler == 'all') then {
+ if (_currentItem in _primary) then {_currentData = 'primary'} else {
+ if (_currentItem in _secondary) then {_currentData = 'secondary'} else {
+ if (_currentItem in _sidearm) then {_currentData = 'sidearm'};
+ };
+ };
+ };
+
+ /* Handle the extended inventory system if disabled */
+ _isSecoAllowTwo = true;
+ _isPrimAllowTwo = true;
+ if (paramExtendedInventory && (_tfil == 'primary' || _tfil == 'secondary' || _tfil == 'all')) then {
+ _getpp = [];
+ _getss = [];
+
+ _query = if (_currentData == 'primary') then {_currentItem} else {_currentPrimary};
+ if (_query != '') then {
+ _getpp = (_query+"_W") Call GetNamespace;
+ if (isNil '_getpp') then {
+ _getpp = _query Call GetNamespace;
+ };
+ };
+ if (_query != '') then {_isPrimAllowTwo = _getpp select QUERYGEARALLOWTWO};
+
+ _query = if (_currentData == 'secondary') then {_currentItem} else {_currentSecondary};
+ if (_query != '') then {
+ _getss = (_query+"_W") Call GetNamespace;
+ if (isNil '_getss') then {
+ _getss = _query Call GetNamespace;
+ };
+ };
+ if (_query != '') then {_isSecoAllowTwo = _getss select QUERYGEARALLOWTWO};
+
+ if (!_isSecoAllowTwo && !_isPrimAllowTwo) then {
+ _sskip = true;
+ hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo');
+ };
+ };
+
+ if !(_sskip) then {
+ if (_currentData == 'secondary') then {
+ if (_currentItem in _listbp) then {
+ _unitBP = _currentItem;
+ };
+ _backpackloadout = [[],[]];
+ _bpcost = 0;
+ };
+ Call Compile Format ['_old = _current%1;_currentWeapons = _currentWeapons - [_current%1]; _current%1Cost = %2; _current%1 = "%3";ctrlSetText[_%1IDC,"%4"]',_currentData,_get select QUERYGEARCOST,_currentItem,_get select QUERYGEARPICTURE];
+ //--- New Magazines.
+ _currentMags = _get select QUERYGEARMAGAZINES;
+ //--- Old Magazines.
+ _get2 = (_old+"_W") Call GetNamespace;
+ if (isNil '_get2') then {
+ _get2 = _old Call GetNamespace;
+ };
+ if !(isNil '_get2') then {
+ if (typeName (_get2 select QUERYGEARMAGAZINES) != 'SCALAR' && typeName (_get select QUERYGEARMAGAZINES) != 'SCALAR') then {
+ _oldMags = _get2 select QUERYGEARMAGAZINES;
+ _currentMagazines = [_currentMags select 0,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo;
+ };
+ if !(isNil '_get2') then {
+ if (typeName (_get2 select QUERYGEARMAGAZINES) != 'SCALAR' && typeName (_get select QUERYGEARMAGAZINES) != 'SCALAR') then {
+ _oldMags = _get2 select QUERYGEARMAGAZINES;
+ _use = "";
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ {
+ _upgr = (missionNamespace getVariable _x) select QUERYGEARUPGRADE;
+ if ((_currentUpgrades select 13) >= _upgr) exitWith {_use = _x};
+ } forEach _currentMags;
+ _currentMagazines = [_use,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo;
+ };
+ };
+ };
+ };
+ };
+ if (!_sskip) then {
+ _currentWeapons = _currentWeapons + [_currentItem];
+ _displayInv = true;
+ };
+ };
+ };
+ if (_tfil == 'backpack') then {
+ _currentBPRow = lnbCurSelRow _lb;
+ _currentBPValue = lnbValue[_lb,[_currentBPRow,0]];
+ _currentBPItem = _backpack select _currentBPValue;
+
+ _hasSpace = [_unitBP,_backpackloadout,_currentBPItem] Call BackpackHasSpace;
+
+ if (_hasSpace) then {
+ _id = (_backpackloadout select 0) find _currentBPItem;
+ if (_id == -1) then {
+ _arrayType = (_backpackloadout select 0) + [_currentBPItem];
+ _arrayAmount = (_backpackloadout select 1) + [1];
+ _backpackloadout set[0, _arrayType];
+ _backpackloadout set[1, _arrayAmount];
+ } else {
+ _arrayAmount = (_backpackloadout select 1) set [_id,((_backpackloadout select 1) select _id)+1];
+ };
+ };
+
+ _updateBackpack = true;
+ };
+ if (_filler == 'misc' || !_skip) then {
+ _type = _get select QUERYGEARTYPE;
+ if (_type == 'CfgMagazines') then {
+ _currentMagazines = [_currentMagazines,_currentItem] Call UIAddMagazine;
+ _displayInv = true;
+ };
+ if (_type == 'Special' && count _currentSpecials < 3 && !(_currentItem in _currentSpecials)) then {
+ _currentSpecials = _currentSpecials + [_currentItem];
+ _currentSpecialCost = 0;
+ _u = 0;
+ {
+ _zt = _x Call GetNamespace;
+ ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE];
+ _currentSpecialCost = _currentSpecialCost + (_zt select QUERYGEARCOST);
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ _displayInv = true;
+ };
+ if (_type == 'Item') then {
+ if (!(_currentItem in _currentItems)) then {
+ _currentItems = [_currentItems,_currentItem] Call UIAddItem;
+ _displayInv = true;
+ };
+ };
+ };
+ if (_tfil == 'template') then {
+ _tempWeapons = _template select _currentValue;
+ _tempItems = _templateItems select _currentValue;
+ _tempMags = _templateMags select _currentValue;
+ _tempSpecs = _templateSpecs select _currentValue;
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _getnum = 0;
+ _currentWeapons = [];
+ _currentItems = [];
+ _backpackloadout = [[],[]];
+ {
+ if (typeName _x == 'STRING') then {_currentItems = _currentItems + [_x]};
+ if (typeName _x == 'ARRAY') then {_backpackloadout = _x};
+ } forEach _tempItems;
+ _bpcost = 0;
+
+ if (count (_backpackloadout select 0) > 0) then {
+ _getnum = getNumber(configFile >> 'CfgVehicles' >> typeOf _currentUnit >> 'canCarryBackPack');
+ if (_getnum == 1) then {
+ _u = 0;
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ {
+ _get = _x Call GetNamespace;
+ if !(isNil '_get') then {
+ if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then {
+ _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u));
+ };
+ };
+ _u = _u + 1;
+ } forEach (_backpackloadout select 0);
+ };
+ };
+ _currentBackpackLoadout = (_backpackloadout select 0);
+ _currentBackpackLoadoutAmount = (_backpackloadout select 1);
+ {
+ _cwep = _x;
+ _get = (_x+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _x Call GetNamespace;
+ };
+
+ if (({_x == _cwep} count _primary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else {
+ if (({_x == _cwep} count _secondary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else {
+ if (({_x == _cwep} count _sidearm) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]};
+ };
+ };
+ } forEach _tempWeapons;
+ if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']};
+ if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']};
+ if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']};
+ if (_currentSecondary in _listbp && _getnum == 1) then {_unitBP = _currentSecondary} else {_unitBP = ""};
+ _currentMagazines = _tempMags;
+ _currentSpecials = _tempSpecs;
+ _currentSpecialCost = 0;
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+ _u = 0;
+ {
+ _get = _x Call GetNamespace;
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ _displayInv = true;
+ };
+ };
+
+ case 'addMagazine': {
+ if !(_manageBackpack) then {
+ _currentMagValue = lnbValue[_lbm,[lnbCurSelRow _lbm,0]];
+ _currentMag = _currentMags select _currentMagValue;
+ _currentMagazines = [_currentMagazines,_currentMag] Call UIAddMagazine;
+ _displayInv = true;
+ } else {
+ _currentBPItemValue = lnbValue[_lbm,[lnbCurSelRow _lbm,0]];
+ //--- todo find
+ _arrayType = _backpackloadout select 0;
+ _arrayAmount = _backpackloadout select 1;
+ _itemAmount = _arrayAmount select _currentBPItemValue;
+ if ((_itemAmount -1) <= 0) then {
+ _arrayType set [_currentBPItemValue, 'nil'];
+ _arrayAmount set [_currentBPItemValue, 'nil'];
+ _arrayType = _arrayType - ['nil'];
+ _arrayAmount = _arrayAmount - ['nil'];
+ } else {
+ _arrayAmount set [_currentBPItemValue, (_arrayAmount select _currentBPItemValue)-1];
+ };
+ _backpackloadout set [0, _arrayType];
+ _backpackloadout set [1, _arrayAmount];
+ _updateBackpack = true;
+ };
+ };
+ };
+ WF_Logic setVariable ['lbMainAction',''];
+ };
+
+ //--- Remove a weapon by clicking on it.
+ if (primClicked) then {primClicked = false;if (_currentPrimary != '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];_index = _primary find _currentPrimary;_currentPrimaryCost = 0;_currentWeapons = _currentWeapons - [_currentPrimary];_currentPrimary = '';_displayInv = true}};
+ if (secoClicked) then {secoClicked = false;if (_currentSecondary != '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];_index = _secondary find _currentSecondary;_currentSecondaryCost = 0;_currentWeapons = _currentWeapons - [_currentSecondary];_currentSecondary = '';_displayInv = true;_backpackloadout = [[],[]];_bpcost = 0;_unitBP = ""}};
+ if (sideClicked) then {sideClicked = false;if (_currentSidearm != '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];_index = _sidearm find _currentSidearm;_currentSidearmCost = 0;_currentWeapons = _currentWeapons - [_currentSidearm];_currentSidearm = '';_displayInv = true}};
+
+ if (_unitSwap) then {
+ WF_Logic setVariable ['WF_GEAR_Swap',false];
+ if (count _unitList > 0) then {_currentUnit = _unitList select (lbCurSel 3854)} else {_currentUnit = player};
+ _updateUnit = true;
+ };
+
+ if (_updateUnit) then {
+ _currentWeapons = weapons _currentUnit;
+ _currentCost = 0;
+ _unitBP = "";
+ if !(isNull(unitBackpack _currentUnit)) then {
+ _unitBP = typeOf(unitBackpack _currentUnit);
+ _unitBP = [_unitBP] Call _returnProperBag;
+ _currentWeapons = _currentWeapons + [_unitBP];
+
+ //--- Retrieve the backpack content cost.
+ _backpackloadout = getMagazineCargo (unitBackPack _currentUnit);
+ _currentCost = _currentCost - _bpcost;
+ _bpcost = 0;
+ if (count (_backpackloadout select 0) > 0) then {
+ _u = 0;
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ {
+ _get = _x Call GetNamespace;
+ if !(isNil '_get') then {
+ if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then {
+ _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u));
+ };
+ };
+ _u = _u + 1;
+ } forEach (_backpackloadout select 0);
+ };
+ _currentCost = _currentCost + _bpcost;
+ };
+
+ _get = getNumber(configFile >> 'CfgVehicles' >> typeOf _currentUnit >> 'canCarryBackPack');
+ _show = if (_get == 1) then {true} else {false};
+ ctrlShow [3802,_show];
+
+ if (_manageBackpack) then {_updateFiller = true};
+
+ _currentSpecials = [];
+ _currentItems = [];
+ _currentMagazines = magazines _currentUnit;
+
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+
+ _sideGear = _currentWeapons;
+ {if (!(_x in _all)) then {_sideGear = _sideGear - [_x]}} forEach _currentWeapons;
+ _currentWeapons = _sideGear;
+
+ _sideGear = _currentMagazines;
+ {if (!(_x in _misc) && !(_x in _magazine)) then {_sideGear = _sideGear - [_x]}} forEach _currentMagazines;
+ _currentMagazines = _sideGear;
+
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentSpecialCost = 0;
+
+ ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];
+ ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];
+ ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];
+ ctrlSetText [3535,'\Ca\UI\Data\ui_gear_eq_gs.paa'];
+ ctrlSetText [3536,'\Ca\UI\Data\ui_gear_eq_gs.paa'];
+
+ {
+ _cwep = _x;
+ _get = (_cwep+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _cwep Call GetNamespace;
+ };
+
+ if !(isNil '_get') then {
+ _found = false;
+ _index = {_x == _cwep} count _primary;
+ if (_index > 0) then {_currentPrimary = _cwep;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE];_found = true};
+ if !(_found) then {
+ _index = {_x == _cwep} count _secondary;
+ if (_index > 0) then {_currentSecondary = _cwep;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE];_found = true};
+ if !(_found) then {
+ _index = {_x == _cwep} count _sidearm;
+ if (_index > 0) then {_currentSidearm = _cwep;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE];_found = true};
+ if !(_found) then {
+ _index = {_x == _cwep} count _misc;
+ if (_index > 0) then {
+ switch (_get select QUERYGEARTYPE) do {
+ case 'Special': {
+ _currentSpecials = _currentSpecials + [_x];
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ _u = 0;
+ {
+ _zt = _x Call GetNamespace;
+ ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ };
+ case 'Item': {
+ _currentItems = _currentItems + [_x];
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ } forEach _currentWeapons;
+
+ _currentWeapons = _currentWeapons - _misc;
+ _data = [_currentMagazines,_currentItems] Call DisplayInventory;
+ _inventorySlots = _data select 0;
+ _sidearmInventorySlots = _data select 1;
+ _miscItemSlots = _data select 2;
+ _currentCost = _currentCost + (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost;
+ _cost = 0;
+ _updateUnit = false;
+ };
+
+ //--- Remove a magazine by clicking on it.
+ if (_inventoryClick != -1) then {
+ //--- Main Inventory.
+ if (_inventoryClick > 3502 && _inventoryClick < 3515) then {
+ _slot = _inventoryClick - 3503;
+ if (_slot < Count _inventorySlots) then {
+ _index = _currentMagazines find (_inventorySlots Select _slot);
+ if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray};
+ };
+ };
+ //--- Handgun Inventory
+ if (_inventoryClick > 3514 && _inventoryClick < 3523) then {
+ _slot = _inventoryClick - 3515;
+ if (_slot < Count _sidearmInventorySlots) then {
+ _index = _currentMagazines find (_sidearmInventorySlots Select _slot);
+ if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray};
+ };
+ };
+ //--- Misc Inventory
+ if (_inventoryClick > 3522 && _inventoryClick < 3535) then {
+ _slot = _inventoryClick - 3523;
+ if (_slot < Count _miscItemSlots) then {
+ _index = _currentItems find (_miscItemSlots Select _slot);
+ if (_index != -1) then {_currentItems = [_currentItems,_index] Call ReplaceArray};
+ };
+ };
+ //--- Remove a special item.
+ if (_inventoryClick == 3535 || _inventoryClick == 3536) then {
+ _slot = _inventoryClick - 3535;
+ if (_slot < Count _currentSpecials) then {
+ _currentSpecialCost = 0;
+ _currentSpecials = _currentSpecials - [_currentSpecials select _slot];
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+ _u = 0;
+ {
+ _get = _x Call GetNamespace;
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ };
+ };
+ WF_Logic setVariable ['InventoryClick',-1];
+ _displayInv = true;
+ };
+
+ //--- Custom UA.
+ if (_actionSE != '') then {
+ switch (_actionSE) do {
+ case 'reload': {
+ if !(isNil 'respawnWeapons') then {
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentWeapons = [];
+ _currentItems = [];
+ _currentSpecials = [];
+ _backpackloadout = [[],[]];
+
+ {
+ _cwep = _x;
+ _get = (_cwep+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _cwep Call GetNamespace;
+ };
+
+ if !(isNil '_get') then {
+ _index = {_x == _cwep} count _primary;
+ if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else {
+ _index = {_x == _cwep} count _secondary;
+ if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else {
+ _index = {_x == _cwep} count _sidearm;
+ if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]} else {
+ _index = {_x == _cwep} count _misc;
+ if (_index > 0) then {
+ switch (_get select QUERYGEARTYPE) do {
+ case 'Special': {
+ _currentSpecials = _currentSpecials + [_x];
+ };
+ case 'Item': {
+ _currentItems = _currentItems + [_x];
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ } forEach respawnWeapons;
+
+ if !(isNil 'respawnBagContent') then {
+ if (count (respawnBagContent select 0) > 0) then {
+ _backpackloadout = [respawnBagContent select 0,respawnBagContent select 1];
+ _bpcost = 0;
+
+ if (count (_backpackloadout select 0) > 0) then {
+ _u = 0;
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ {
+ _get = _x Call GetNamespace;
+ if !(isNil '_get') then {
+ if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then {
+ _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u));
+ };
+ };
+ _u = _u + 1;
+ } forEach (_backpackloadout select 0);
+ };
+ _currentBackpackLoadout = (_backpackloadout select 0);
+ _currentBackpackLoadoutAmount = (_backpackloadout select 1);
+ };
+ };
+
+ if (_currentSecondary in _listbp) then {
+ _unitBP = _currentSecondary;
+ };
+
+ if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']};
+ if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']};
+ if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']};
+
+ _currentMagazines = respawnAmmo;
+ _currentSpecialCost = 0;
+
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+
+ _u = 0;
+ {
+ _get = _x Call GetNamespace;
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+
+ _displayInv = true;
+ };
+ };
+ case 'clear': {
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+ _unitBP = "";
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentSpecialCost = 0;
+ _bpcost = 0;
+ _currentWeapons = [];
+ _currentItems = [];
+ _currentSpecials = [];
+ _currentMagazines = [];
+ ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];
+ ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];
+ ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+ _displayInv = true;
+ };
+ case 'backpack': {
+ if (_unitBP != "") then {
+ lnbClear _lb;
+ [_backpack,'backpack',_lb] Call UIGearFillList;
+ _manageBackpack = true;
+ _updateBackpack = true;
+ };
+ };
+ };
+ WF_Logic setVariable ['WF_Gear_Action',''];
+ };
+
+ //--- Show inventory (Icons).
+ if (_displayInv) then {
+ _displayInv = false;
+ _upgradeCost = _currentSpecialCost;
+ _data = [_currentMagazines,_currentItems] Call DisplayInventory;
+ _inventorySlots = _data select 0;
+ _sidearmInventorySlots = _data select 1;
+ _miscItemSlots = _data select 2;
+ _upgradeCost = _upgradeCost + (_data select 3);
+ if (_currentPrimary != '') then {_upgradeCost = _upgradeCost + _currentPrimaryCost};
+ if (_currentSecondary != '') then {_upgradeCost = _upgradeCost + _currentSecondaryCost};
+ if (_currentSidearm != '') then {_upgradeCost = _upgradeCost + _currentSidearmCost};
+ if !(_currentSecondary in _listbp) then {_unitBP = ""};
+ _cost = (_upgradeCost+_bpcost) - _currentCost;
+ };
+
+ //--- Update the backpack
+ if (_updateBackpack) then {
+ _updateBackpack = false;
+
+ _currentBackpackLoadout = [];
+ _currentBackpackLoadoutAmount = [];
+ _currentBackpackLoadoutCost = [];
+ _currentBackpackLoadoutPictures = [];
+ _currentBackpackLoadoutNames = [];
+ _currentBackpackLoadoutUpgrades = [];
+ _currentBackpackLoadoutAllowed = [];
+ _u = 0;
+ _cost = _cost - _bpcost;
+ _bpcost = 0;
+ if (count (_backpackloadout select 0) > 0) then {
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ {
+ _get = _x Call GetNamespace;
+ if !(isNil '_x') then {
+ if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then {
+ _currentBackpackLoadout = _currentBackpackLoadout + [_x];
+ _currentBackpackLoadoutAmount = _currentBackpackLoadoutAmount + [(_backpackloadout select 1) select _u];
+ _currentBackpackLoadoutCost = _currentBackpackLoadoutCost + [_get select QUERYGEARCOST];
+ _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u));
+ _currentBackpackLoadoutPictures = _currentBackpackLoadoutPictures + [_get select QUERYGEARPICTURE];
+ _currentBackpackLoadoutNames = _currentBackpackLoadoutNames + [str((_backpackloadout select 1) select _u)+"x "+(_get select QUERYGEARLABEL)];
+ _currentBackpackLoadoutUpgrades = _currentBackpackLoadoutUpgrades + [_get select QUERYGEARUPGRADE];
+ _currentBackpackLoadoutAllowed = _currentBackpackLoadoutAllowed + [_get select QUERYGEARALLOWED];
+ };
+ };
+ _u = _u + 1;
+ } forEach (_backpackloadout select 0);
+ };
+ _cost = _cost + _bpcost;
+ lnbClear _lbm;
+ [_currentBackpackLoadoutCost,_currentBackpackLoadoutNames,_currentBackpackLoadoutPictures,_currentBackpackLoadoutUpgrades,_currentBackpackLoadoutAllowed,'backpack',_lbm] Call UIGearFillTemplateList;
+ };
+
+ //--- Buy a loadout.
+ if (buyLoadout) then {
+ buyLoadout = false;
+ _funds = Call GetPlayerFunds;
+ if (_funds >= _cost) then {
+ (-_cost) Call ChangePlayerFunds;
+ //--- Player's respawn loadout.
+ if (_currentUnit == player && (vehicleVarName player == clientIdentification)) then {
+ respawnWeapons = _currentWeapons + _currentSpecials + _currentItems;
+ respawnAmmo = _currentMagazines;
+ if (_unitBP != '') then {
+ respawnBag = _unitBP;
+ respawnBagContent = [_currentBackpackLoadout,_currentBackpackLoadoutAmount];
+ } else {
+ respawnBag = nil;
+ respawnBagContent = [[],[]];
+ };
+ };
+
+ /* Equip the core before the backpack */
+ _weaps = _currentWeapons;
+ if !(WF_A2_Vanilla) then {
+ _temp = _weaps;
+ {
+ if (_x in _listbp) then {_temp = _temp - [_x]};
+ } forEach _weaps;
+ _weaps = _temp;
+ };
+ [_currentUnit,(_weaps + _currentSpecials + _currentItems),_currentMagazines] Call EquipLoadout;
+
+ /* Equip backpack if needed */
+ if !(WF_A2_Vanilla) then {
+ if (_unitBP != "" || !isNull (unitBackpack _currentUnit)) then {
+ _add = true;
+ if ((_unitBP == "" && !isNull (unitBackpack _currentUnit)) || (_unitBP != "" && !isNull (unitBackpack _currentUnit))) then {removeBackpack _currentUnit;};
+ if !(isNull (unitBackpack _currentUnit)) then {
+ if (typeOf (unitBackpack _currentUnit) == _unitBP) then {_add = false};
+ };
+
+ if (_add && _unitBP != "") then {
+ _currentUnit addBackpack _unitBP;
+ };
+
+ [unitBackpack _currentUnit,[_currentBackpackLoadout,_currentBackpackLoadoutAmount]] Call EquipBackpack;
+ };
+ };
+ _data = [_currentMagazines,_currentItems] Call DisplayInventory;
+ _inventorySlots = _data select 0;
+ _sidearmInventorySlots = _data select 1;
+ _miscItemSlots = _data select 2;
+ _currentCost = (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost + _bpcost;
+ respawnGearCost = _currentCost;
+ _cost = 0;
+ } else {
+ hint parseText(Format [localize "STR_WF_INFO_Funds_Missing_Gear",_cost - _funds]);
+ };
+ };
+
+ //--- Remove an existing template.
+ if (deleteLoadout) then {
+ deleteLoadout = false;
+ //--- Behave only on template filler.
+ if (_filler == 'template') then {
+ _currentRow = lnbCurSelRow _lb;
+ _currentValue = lnbValue[_lb,[_currentRow,0]];
+ //--- Update the templates.
+ _template set [_currentValue, "DELETE"];
+ _template = _template - ["DELETE"];
+ WF_Logic setVariable["templateClasses",_template];
+ _templateCosts set [_currentValue, "DELETE"];
+ _templateCosts = _templateCosts - ["DELETE"];
+ WF_Logic setVariable["templateCosts",_templateCosts];
+ _templatePictures set [_currentValue, "DELETE"];
+ _templatePictures = _templatePictures - ["DELETE"];
+ WF_Logic setVariable["templatePictures",_templatePictures];
+ _templateNames set [_currentValue, "DELETE"];
+ _templateNames = _templateNames - ["DELETE"];
+ WF_Logic setVariable["templateNames",_templateNames];
+ _templateMags set [_currentValue, "DELETE"];
+ _templateMags = _templateMags - ["DELETE"];
+ WF_Logic setVariable["templateMags",_templateMags];
+ _templateItems set [_currentValue, "DELETE"];
+ _templateItems = _templateItems - ["DELETE"];
+ WF_Logic setVariable["templateItems",_templateItems];
+ _templateSpecs set [_currentValue, "DELETE"];
+ _templateSpecs = _templateSpecs - ["DELETE"];
+ WF_Logic setVariable["templateSpecs",_templateSpecs];
+ _templateUpgrades set [_currentValue, "DELETE"];
+ _templateUpgrades = _templateUpgrades - ["DELETE"];
+ WF_Logic setVariable["templateUpgrades",_templateUpgrades];
+ _templateAllowed set [_currentValue, "DELETE"];
+ _templateAllowed = _templateAllowed - ["DELETE"];
+ WF_Logic setVariable["templateAllowed",_templateAllowed];
+ _updateFiller = true;
+ };
+ };
+
+ if (saveLoadout) then {
+ saveLoadout = false;
+ //--- Behave only on template filler.
+ if (_filler == 'template') then {
+ //--- Update the templates.
+ _desc = '';
+ _pict = '';
+ _temp = [];
+ _cAllow = true;
+ _upgr = 0;
+ _pallow = true;
+ _sallow = true;
+
+ if (_currentPrimary != '') then {
+ _get = _currentPrimary Call GetNamespace;
+ _temp = _temp + [_currentPrimary];
+ _desc = _desc + (_get select QUERYGEARLABEL);
+ _pict = (_get select QUERYGEARPICTURE);
+ if !(_get select QUERYGEARALLOWED) then {_cAllow = false};
+ _upgr = _get select QUERYGEARUPGRADE;
+ _pallow = _get select QUERYGEARALLOWTWO;
+ };
+ if (_currentSecondary != '') then {
+ _get = (_currentSecondary+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _currentSecondary Call GetNamespace;
+ };
+ _temp = _temp + [_currentSecondary];
+ if (_desc != '') then { _desc = _desc + "/"};
+ //--- Needless to check if the primary is prohibed.
+ _desc = _desc + (_get select QUERYGEARLABEL);
+ if (_pict == '') then {_pict = _get select QUERYGEARPICTURE};
+ if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}};
+ if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)};
+ _sallow = _get select QUERYGEARALLOWTWO;
+ };
+ if (_currentSidearm != '') then {
+ _get = _currentSidearm Call GetNamespace;
+ _temp = _temp + [_currentSidearm];
+ if (_desc != '') then { _desc = _desc + "/"};
+ //--- Needless to check if the secondary is prohibed.
+ _desc = _desc + (_get select QUERYGEARLABEL);
+ if (_pict == '') then {_pict = _get select QUERYGEARPICTURE};
+ if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}};
+ if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)};
+ };
+ //--- Handle Backpack Content.
+ _addin = [_currentItems];
+ if (_unitBP != '') then {
+ _extra = [_currentBackpackLoadout,_currentBackpackLoadoutAmount];
+ _addin = [_currentItems + [_extra]];
+ };
+ if (_pallow || _sallow || !paramExtendedInventory) then {
+ _template = _template + [_temp];
+ WF_Logic setVariable["templateClasses",_template];
+ _templateCosts = _templateCosts + [(_cost + _currentCost)];
+ WF_Logic setVariable["templateCosts",_templateCosts];
+ _templatePictures = _templatePictures + [_pict];
+ WF_Logic setVariable["templatePictures",_templatePictures];
+ _templateNames = _templateNames + [_desc];
+ WF_Logic setVariable["templateNames",_templateNames];
+ _templateMags = _templateMags + [_currentMagazines];
+ WF_Logic setVariable["templateMags",_templateMags];
+ _templateItems = _templateItems + _addin;
+ WF_Logic setVariable["templateItems",_templateItems];
+ _templateSpecs = _templateSpecs + [_currentSpecials];
+ WF_Logic setVariable["templateSpecs",_templateSpecs];
+ _templateUpgrades = _templateUpgrades + [_upgr];
+ WF_Logic setVariable["templateUpgrades",_templateUpgrades];
+ _templateAllowed = _templateAllowed + [_cAllow];
+ WF_Logic setVariable["templateAllowed",_templateAllowed];
+ _updateFiller = true;
+ } else {
+ hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo');
+ };
+ };
+ };
+
+ //--- Loadout Cost.
+ ctrlSetText[3850,Format[localize 'STR_WF_GEAR_Cost',_cost]];
+ //--- Player's Cash.
+ //ctrlSetText[3851,Format["%1 $ %2.",localize 'STR_WF_GEAR_CashLabel',Call GetPlayerFunds]];
+ ctrlSetText[3851,Format["$%1",Call GetPlayerFunds]]; //---changes-MrNiceGuy
+
+ _lastFiller = _filler;
+ sleep 0.05;
+
+ //--- Back Button.
+ if (MenuAction == 1) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+};
+
+//--- Variables destruction.
+WF_Logic setVariable ['lbChange',nil];
+WF_Logic setVariable ['lbMainAction',nil];
+WF_Logic setVariable ['InventoryClick',nil];
+WF_Gear_Hotkeys = nil;
+primClicked = nil;
+secoClicked = nil;
+sideClicked = nil;
+buyLoadout = nil;
+saveLoadout = nil;
+deleteLoadout = nil;
+
+(findDisplay 16000) displayRemoveEventHandler ['KeyDown',_disp]; \ No newline at end of file
diff --git a/Client/GUI/GUI_GearV.sqf b/Client/GUI/GUI_GearV.sqf
new file mode 100644
index 0000000..ef8114d
--- /dev/null
+++ b/Client/GUI/GUI_GearV.sqf
@@ -0,0 +1,774 @@
+/* Important, use +array if you plan to use Setters */
+
+private ["_inRange","_sideID","_nObjects","_nObject","_unitList","_text","_amount","_val","_val2",
+"_ainumber","_txt","_type","_check","_updateFiller","_list","_id","_changed","_get","_currentMags",
+"_currentRow","_currentData","_currentValue","_currentItem","_skip","_get2","_oldMags","_currentMagazines",
+"_slist","_index","_currentWeapons","_displayInv","_zt","_currentSpecialCost","_u",
+"_currentSpecials","_currentItems","_currentPrimary","_currentPrimaryCost","_currentSecondary",
+"_currentSecondaryCost","_currentSidearm","_currentSidearmCost","_cwep","_x","_tempWeapons",
+"_tempItems","_tempMags","_tempSpecs","_currentMagValue","_currentMag","_currentUnit","_updateUnit",
+"_sideGear","_found","_data","_inventorySlots","_sidearmInventorySlots","_miscItemSlots","_currentCost",
+"_cost","_slot","_upgradeCost","_funds","_template","_templateCosts","_templatePictures","_templateNames",
+"_templateMags","_templateItems","_templateSpecs","_templateUpgrades","_templateAllowed",
+"_cAllow","_temp","_desc","_pict","_upgr","_filler","_mainAction","_inventoryClick","_unitSwap",
+"_actionSE","_lastFiller","_primary","_secondary","_sidearm","_misc","_magazine","_all","_lb",
+"_lbm","_primaryIDC","_secondaryIDC","_sidearmIDC","_specialIDC","_display","_totalWeapons",
+"_fillerIDC","_fillerTypes","_old","_disp","_buildings","_getpp","_isPrimAllowTwo","_getss","_isSecoAllowTwo",
+"_sskip","_query","_tfil","_pallow","_sallow"];
+
+_primary = +(WF_Logic getVariable 'primaryClasses');
+_secondary = +(WF_Logic getVariable 'secondaryClasses');
+_sidearm = +(WF_Logic getVariable 'sidearmClasses');
+_misc = +(WF_Logic getVariable 'miscClasses');
+_magazine = +(WF_Logic getVariable 'magazineClasses');
+
+_template = +(WF_Logic getVariable 'templateClasses');
+_templateCosts = +(WF_Logic getVariable 'templateCosts');
+_templatePictures = +(WF_Logic getVariable 'templatePictures');
+_templateNames = +(WF_Logic getVariable 'templateNames');
+_templateMags = +(WF_Logic getVariable 'templateMags');
+_templateItems = +(WF_Logic getVariable 'templateItems');
+_templateSpecs = +(WF_Logic getVariable 'templateSpecs');
+_templateUpgrades = +(WF_Logic getVariable 'templateUpgrades');
+_templateAllowed = +(WF_Logic getVariable 'templateAllowed');
+
+_all = _primary + _secondary + _sidearm + _misc;
+
+WF_Logic setVariable ['lbChange',false];
+WF_Logic setVariable ['lbMainAction',''];
+WF_Logic setVariable ['InventoryClick',-1];
+WF_Logic setVariable ['WF_GEAR_Swap',false];
+WF_Logic setVariable ['WF_Gear_Action',''];
+
+ctrlShow[3802,false];
+
+primClicked = false;
+secoClicked = false;
+sideClicked = false;
+deleteLoadout = false;
+saveLoadout = false;
+buyLoadout = false;
+_displayInv = false;
+_updateUnit = true;
+_updateFiller = false;
+
+disableSerialization;
+_lb = 3700;
+_lbm = 3701;
+_primaryIDC = 3500;
+_secondaryIDC = 3501;
+_sidearmIDC = 3502;
+_specialIDC = 3535;
+_display = _this select 0;
+
+_totalWeapons = count _primary + count _secondary + count _sidearm;
+
+_fillerIDC = [3400,3401,3402,3403,3404,3405];
+_fillerTypes = ['template','all','primary','secondary','sidearm','misc'];
+_inventorySlots = [];
+_lastFiller = 'nil';
+_id = _fillerTypes find 'primary';
+_list = [];
+_miscItemSlots = [];
+_sidearmInventorySlots = [];
+(_display DisplayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1];
+
+_currentItem = '';
+_currentMags = [];
+_currentData = '';
+_currentValue = '';
+_currentCost = 0;
+_cost = 0;
+
+_currentPrimary = '';
+_currentSecondary = '';
+_currentSidearm = '';
+_currentPrimaryCost = 0;
+_currentSecondaryCost = 0;
+_currentSidearmCost = 0;
+_currentSpecialCost = 0;
+
+_old = '';
+
+_currentWeapons = [];
+_currentSpecials = [];
+_currentItems = [];
+_currentMagazines = [];
+
+_disp = (findDisplay 16000) displayAddEventHandler ['KeyDown','_this Call WF_Gear_Hotkeys'];
+_buygearfrom = missionNamespace getVariable "WFBE_TOWNGEAR";
+
+//--- Fill the available units list.
+_unitList = [];
+_buildings = (sideJoinedText) Call GetSideStructures;
+_i = 0;
+{
+ _check = ['BARRACKSTYPE',_buildings,'WFBE_PURCHASEGEARRANGE' Call GetNamespace,sideJoined,_x] Call BuildingInRange;
+ _inRange = if (isNull _check) then {false} else {true};
+
+ if (!_inRange && _buygearfrom in [1,2,3]) then {
+ _lookfor = switch (_buygearfrom) do { case 1:{WFCAMP}; case 2:{WFDEPOT}; case 3:{WFCAMP + WFDEPOT}; default{[]}};
+ _nObjects = nearestObjects [_x, _lookfor, 25];
+ _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};
+ if !(isNull _nObject) then {
+ _sideID = _nObject getVariable "sideID";
+ if !(isNil "_sideID") then {
+ if (_sideID == sideID) then {_inRange = true};
+ };
+ };
+ };
+
+ if (_inRange) then {
+ _txt = (_x) Call GetAIDigit;
+ _unitList = _unitList + [_x];
+
+ _type = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ lbAdd [3854,Format["[%1] %2 (%3)",_txt,name _x,_type]];
+
+ if (_currentUnit == _x) then {lbSetCurSel[3854,_i]};
+ _i = _i + 1;
+ };
+} forEach units(group player);
+
+_currentUnit = player;
+
+while {alive player && dialog} do {
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+
+ //--- Something changed since the last time?
+ _filler = WF_Logic getVariable 'filler';
+ _changed = WF_Logic getVariable 'lbChange';
+ _mainAction = WF_Logic getVariable 'lbMainAction';
+ _inventoryClick = WF_Logic getVariable 'InventoryClick';
+ _unitSwap = WF_Logic getVariable 'WF_GEAR_Swap';
+ _actionSE = WF_Logic getVariable 'WF_Gear_Action';
+
+ //--- Filter Changed.
+ if (_filler != _lastFiller || _updateFiller) then {
+ _updateFiller = false;
+ _list = Call Compile Format ['_%1',_filler];
+ lnbClear _lb;
+ if (_filler != 'template') then {
+ [_list,_filler,_lb] Call UIGearFillList;
+ } else {
+ [_templateCosts,_templateNames,_templatePictures,_templateUpgrades,_templateAllowed,_filler,_lb] Call UIGearFillTemplateList;
+ };
+ _id = _fillerTypes find _filler;
+ {(_display displayCtrl _x) ctrlSetTextColor [0.7490, 0.7490, 0.7490, 0.7]} forEach _fillerIDC;
+ (_display displayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1];
+ //--- Update the list since the filler changed.
+ _changed = true;
+ };
+
+ //--- List Selection Changed.
+ if (_changed) then {
+ WF_Logic setVariable ['lbChange',false];
+ _currentRow = lnbCurSelRow _lb;
+ _currentData = lnbData[_lb,[_currentRow,0]];
+ _currentValue = lnbValue[_lb,[_currentRow,0]];
+ _currentItem = _list select _currentValue;
+ lnbClear _lbm;
+ _get = [];
+
+ /* Get */
+ if (_filler != 'template') then {
+ if (_filler == 'secondary' || _filler == 'all') then {
+ _get = (_currentItem+'_W') Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _currentItem Call GetNamespace;
+ };
+ } else {
+ _get = _currentItem Call GetNamespace;
+ };
+
+ if !(isNil '_get') then {
+ _currentMags = _get select QUERYGEARMAGAZINES;
+ if (typeName _currentMags != 'SCALAR') then {
+ if (count _currentMags > 0) then {
+ [_currentMags,'magazine',_lbm] Call UIGearFillList;
+ };
+ };
+ };
+ };
+ };
+
+ //--- Player have clicked on one of the listbox.
+ if (_mainAction != '') then {
+ switch (_mainAction) do {
+ case 'addWeapon': {
+ _skip = true;
+ _sskip = false;
+ _get = [];
+
+ if (_filler != 'template') then {
+ _get = (_currentItem+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _currentItem Call GetNamespace;
+ };
+ };
+
+ if (_filler == 'primary' || _filler == 'secondary' || _filler == 'sidearm' || _filler == 'all') then {
+ if (_currentItem in _misc) then {_skip = false;_currentValue = _currentValue - _totalWeapons};
+ if (_skip) then {
+ _slist = Call Compile Format ['_%1',_currentData];
+ _index = _slist find _currentItem;
+ if (_index != -1) then {
+ if (_filler == 'all') then {
+ if (_currentItem in _primary) then {_currentData = 'primary'} else {
+ if (_currentItem in _secondary) then {_currentData = 'secondary'} else {
+ if (_currentItem in _sidearm) then {_currentData = 'sidearm'};
+ };
+ };
+ };
+
+ /* Handle the extended inventory system if disabled */
+ _isSecoAllowTwo = true;
+ _isPrimAllowTwo = true;
+ if (paramExtendedInventory && (_filler == 'primary' || _filler == 'secondary' || _filler == 'all')) then {
+ _getpp = [];
+ _getss = [];
+
+ _query = if (_currentData == 'primary') then {_currentItem} else {_currentPrimary};
+ if (_query != '') then {
+ _getpp = (_query+"_W") Call GetNamespace;
+ if (isNil '_getpp') then {
+ _getpp = _query Call GetNamespace;
+ };
+ };
+ if (_query != '') then {_isPrimAllowTwo = _getpp select QUERYGEARALLOWTWO};
+
+ _query = if (_currentData == 'secondary') then {_currentItem} else {_currentSecondary};
+ if (_query != '') then {
+ _getss = (_query+"_W") Call GetNamespace;
+ if (isNil '_getss') then {
+ _getss = _query Call GetNamespace;
+ };
+ };
+ if (_query != '') then {_isSecoAllowTwo = _getss select QUERYGEARALLOWTWO};
+
+ if (!_isSecoAllowTwo && !_isPrimAllowTwo) then {
+ _sskip = true;
+ hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo');
+ };
+ };
+
+ if (!_sskip) then {
+ Call Compile Format ['_old = _current%1;_currentWeapons = _currentWeapons - [_current%1]; _current%1Cost = %2; _current%1 = "%3";ctrlSetText[_%1IDC,"%4"]',_currentData,_get select QUERYGEARCOST,_currentItem,_get select QUERYGEARPICTURE];
+ //--- New Magazines.
+ _currentMags = _get select QUERYGEARMAGAZINES;
+ //--- Old Magazines.
+ _get2 = (_old+"_W") Call GetNamespace;
+ if (isNil '_get2') then {
+ _get2 = _old Call GetNamespace;
+ };
+ if !(isNil '_get2') then {
+ _oldMags = _get2 select QUERYGEARMAGAZINES;
+ _use = "";
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ {
+ _upgr = (missionNamespace getVariable _x) select QUERYGEARUPGRADE;
+ if ((_currentUpgrades select 13) >= _upgr) exitWith {_use = _x};
+ } forEach _currentMags;
+ _currentMagazines = [_use,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo;
+ };
+ };
+ if !(isNil '_get2') then {
+ _oldMags = _get2 select QUERYGEARMAGAZINES;
+ _currentMagazines = [_currentMags select 0,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo;
+ };
+ };
+ };
+ if (!_sskip) then {
+ _currentWeapons = _currentWeapons + [_currentItem];
+ _displayInv = true;
+ };
+ };
+ };
+ if (_filler == 'misc' || !_skip) then {
+ _type = _get select QUERYGEARTYPE;
+ if (_type == 'CfgMagazines') then {
+ _currentMagazines = [_currentMagazines,_currentItem] Call UIAddMagazine;
+ _displayInv = true;
+ };
+ if (_type == 'Special' && count _currentSpecials < 3 && !(_currentItem in _currentSpecials)) then {
+ _currentSpecials = _currentSpecials + [_currentItem];
+ _currentSpecialCost = 0;
+ _u = 0;
+ {
+ _zt = _x Call GetNamespace;
+ ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE];
+ _currentSpecialCost = _currentSpecialCost + (_zt select QUERYGEARCOST);
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ _displayInv = true;
+ };
+ if (_type == 'Item') then {
+ if (!(_currentItem in _currentItems)) then {
+ _currentItems = [_currentItems,_currentItem] Call UIAddItem;
+ _displayInv = true;
+ };
+ };
+ };
+ /* TODO */
+ if (_filler == 'template') then {
+ _tempWeapons = _template select _currentValue;
+ _tempItems = _templateItems select _currentValue;
+ _tempMags = _templateMags select _currentValue;
+ _tempSpecs = _templateSpecs select _currentValue;
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentWeapons = [];
+ _currentItems = _tempItems;
+ {
+ _cwep = _x;
+ _get = (_x+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _x Call GetNamespace;
+ };
+
+ if (({_x == _cwep} count _primary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else {
+ if (({_x == _cwep} count _secondary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else {
+ if (({_x == _cwep} count _sidearm) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]};
+ };
+ };
+ } forEach _tempWeapons;
+ if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']};
+ if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']};
+ if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']};
+ _currentMagazines = _tempMags;
+ _currentSpecials = _tempSpecs;
+ _currentSpecialCost = 0;
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+ _u = 0;
+ {
+ _get = _x Call GetNamespace;
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ _displayInv = true;
+ };
+ };
+
+ case 'addMagazine': {
+ _currentMagValue = lnbValue[_lbm,[lnbCurSelRow _lbm,0]];
+ _currentMag = _currentMags select _currentMagValue;
+ _currentMagazines = [_currentMagazines,_currentMag] Call UIAddMagazine;
+ _displayInv = true;
+ };
+ };
+ WF_Logic setVariable ['lbMainAction',''];
+ };
+
+ //--- Remove a weapon by clicking on it.
+ if (primClicked) then {primClicked = false;if (_currentPrimary != '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];_index = _primary find _currentPrimary;_currentPrimaryCost = 0;_currentWeapons = _currentWeapons - [_currentPrimary];_currentPrimary = '';_displayInv = true}};
+ if (secoClicked) then {secoClicked = false;if (_currentSecondary != '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];_index = _secondary find _currentSecondary;_currentSecondaryCost = 0;_currentWeapons = _currentWeapons - [_currentSecondary];_currentSecondary = '';_displayInv = true}};
+ if (sideClicked) then {sideClicked = false;if (_currentSidearm != '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];_index = _sidearm find _currentSidearm;_currentSidearmCost = 0;_currentWeapons = _currentWeapons - [_currentSidearm];_currentSidearm = '';_displayInv = true}};
+
+ if (_unitSwap) then {
+ WF_Logic setVariable ['WF_GEAR_Swap',false];
+ if (count _unitList > 0) then {_currentUnit = _unitList select (lbCurSel 3854)} else {_currentUnit = player};
+ _updateUnit = true;
+ };
+
+ if (_updateUnit) then {
+ _currentWeapons = weapons _currentUnit;
+ _currentSpecials = [];
+ _currentItems = [];
+ _currentMagazines = magazines _currentUnit;
+
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+
+ _sideGear = _currentWeapons;
+ {if (!(_x in _all)) then {_sideGear = _sideGear - [_x]}} forEach _currentWeapons;
+ _currentWeapons = _sideGear;
+
+ _sideGear = _currentMagazines;
+ {if (!(_x in _misc) && !(_x in _magazine)) then {_sideGear = _sideGear - [_x]}} forEach _currentMagazines;
+ _currentMagazines = _sideGear;
+
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentSpecialCost = 0;
+
+ ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];
+ ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];
+ ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];
+ ctrlSetText [3535,'\Ca\UI\Data\ui_gear_eq_gs.paa'];
+ ctrlSetText [3536,'\Ca\UI\Data\ui_gear_eq_gs.paa'];
+
+ {
+ _cwep = _x;
+ _get = (_cwep+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _cwep Call GetNamespace;
+ };
+
+ if !(isNil '_get') then {
+ _found = false;
+ _index = {_x == _cwep} count _primary;
+ if (_index > 0) then {_currentPrimary = _cwep;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE];_found = true};
+ if !(_found) then {
+ _index = {_x == _cwep} count _secondary;
+ if (_index > 0) then {_currentSecondary = _cwep;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE];_found = true};
+ if !(_found) then {
+ _index = {_x == _cwep} count _sidearm;
+ if (_index > 0) then {_currentSidearm = _cwep;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE];_found = true};
+ if !(_found) then {
+ _index = {_x == _cwep} count _misc;
+ if (_index > 0) then {
+ switch (_get select QUERYGEARTYPE) do {
+ case 'Special': {
+ _currentSpecials = _currentSpecials + [_x];
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ _u = 0;
+ {
+ _zt = _x Call GetNamespace;
+ ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ };
+ case 'Item': {
+ _currentItems = _currentItems + [_x];
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ } forEach _currentWeapons;
+
+ _currentWeapons = _currentWeapons - _misc;
+ _data = [_currentMagazines,_currentItems] Call DisplayInventory;
+ _inventorySlots = _data select 0;
+ _sidearmInventorySlots = _data select 1;
+ _miscItemSlots = _data select 2;
+ _currentCost = (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost;
+ _cost = 0;
+ _updateUnit = false;
+ };
+
+ //--- Remove a magazine by clicking on it.
+ if (_inventoryClick != -1) then {
+ //--- Main Inventory.
+ if (_inventoryClick > 3502 && _inventoryClick < 3515) then {
+ _slot = _inventoryClick - 3503;
+ if (_slot < Count _inventorySlots) then {
+ _index = _currentMagazines find (_inventorySlots select _slot);
+ if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray};
+ };
+ };
+ //--- Handgun Inventory
+ if (_inventoryClick > 3514 && _inventoryClick < 3523) then {
+ _slot = _inventoryClick - 3515;
+ if (_slot < Count _sidearmInventorySlots) then {
+ _index = _currentMagazines find (_sidearmInventorySlots select _slot);
+ if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray};
+ };
+ };
+ //--- Misc Inventory
+ if (_inventoryClick > 3522 && _inventoryClick < 3535) then {
+ _slot = _inventoryClick - 3523;
+ if (_slot < Count _miscItemSlots) then {
+ _index = _currentItems find (_miscItemSlots select _slot);
+ if (_index != -1) then {_currentItems = [_currentItems,_index] Call ReplaceArray};
+ };
+ };
+ //--- Remove a special item.
+ if (_inventoryClick == 3535 || _inventoryClick == 3536) then {
+ _slot = _inventoryClick - 3535;
+ if (_slot < Count _currentSpecials) then {
+ _currentSpecialCost = 0;
+ _currentSpecials = _currentSpecials - [_currentSpecials select _slot];
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+ _u = 0;
+ {
+ _get = _x Call GetNamespace;
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+ };
+ };
+ WF_Logic setVariable ['InventoryClick',-1];
+ _displayInv = true;
+ };
+
+ //--- Custom UA.
+ if (_actionSE != '') then {
+ switch (_actionSE) do {
+ case 'reload': {
+ if !(isNil 'respawnWeapons') then {
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentWeapons = [];
+ _currentItems = [];
+ _currentSpecials = [];
+ {
+ _cwep = _x;
+ _get = (_cwep+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _cwep Call GetNamespace;
+ };
+
+ if !(isNil '_get') then {
+ _index = {_x == _cwep} count _primary;
+ if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else {
+ _index = {_x == _cwep} count _secondary;
+ if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else {
+ _index = {_x == _cwep} count _sidearm;
+ if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]} else {
+ _index = {_x == _cwep} count _misc;
+ if (_index > 0) then {
+ switch (_get select QUERYGEARTYPE) do {
+ case 'Special': {
+ _currentSpecials = _currentSpecials + [_x];
+ };
+ case 'Item': {
+ _currentItems = _currentItems + [_x];
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ } forEach respawnWeapons;
+
+ if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']};
+ if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']};
+ if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']};
+
+ _currentMagazines = respawnAmmo;
+ _currentSpecialCost = 0;
+
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+
+ _u = 0;
+ {
+ _get = _x Call GetNamespace;
+ _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST);
+ ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE];
+ _u = _u + 1;
+ } forEach _currentSpecials;
+
+ _displayInv = true;
+ };
+ };
+
+ case 'clear': {
+ _currentPrimary = '';
+ _currentSecondary = '';
+ _currentSidearm = '';
+ _currentPrimaryCost = 0;
+ _currentSecondaryCost = 0;
+ _currentSidearmCost = 0;
+ _currentSpecialCost = 0;
+ _currentWeapons = [];
+ _currentItems = [];
+ _currentSpecials = [];
+ _currentMagazines = [];
+ ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];
+ ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];
+ ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];
+ for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']};
+ _displayInv = true;
+ };
+ };
+ WF_Logic setVariable ['WF_Gear_Action',''];
+ };
+
+ //--- Show inventory (Icons).
+ if (_displayInv) then {
+ _displayInv = false;
+ _upgradeCost = _currentSpecialCost;
+ _data = [_currentMagazines,_currentItems] Call DisplayInventory;
+ _inventorySlots = _data select 0;
+ _sidearmInventorySlots = _data select 1;
+ _miscItemSlots = _data select 2;
+ _upgradeCost = _upgradeCost + (_data select 3);
+ if (_currentPrimary != '') then {_upgradeCost = _upgradeCost + _currentPrimaryCost};
+ if (_currentSecondary != '') then {_upgradeCost = _upgradeCost + _currentSecondaryCost};
+ if (_currentSidearm != '') then {_upgradeCost = _upgradeCost + _currentSidearmCost};
+ _cost = _upgradeCost - _currentCost;
+ };
+
+ //--- Buy a loadout.
+ if (buyLoadout) then {
+ buyLoadout = false;
+ _funds = Call GetPlayerFunds;
+ if (_funds >= _cost) then {
+ (-_cost) Call ChangePlayerFunds;
+ //--- Player's respawn loadout.
+ if (_currentUnit == player && (vehicleVarName player == clientIdentification)) then {
+ respawnWeapons = _currentWeapons + _currentSpecials + _currentItems;
+ respawnAmmo = _currentMagazines;
+ };
+ [_currentUnit,(_currentWeapons + _currentSpecials + _currentItems),_currentMagazines] Call EquipLoadout;
+ _data = [_currentMagazines,_currentItems] Call DisplayInventory;
+ _inventorySlots = _data select 0;
+ _sidearmInventorySlots = _data select 1;
+ _miscItemSlots = _data select 2;
+ _currentCost = (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost;
+ respawnGearCost = _currentCost;
+ _cost = 0;
+ } else {
+ hint parseText(Format [localize "STR_WF_INFO_Funds_Missing_Gear",_cost - _funds]);
+ };
+ };
+
+ //--- Remove an existing template.
+ if (deleteLoadout) then {
+ deleteLoadout = false;
+ //--- Behave only on template filler.
+ if (_filler == 'template') then {
+ _currentRow = lnbCurSelRow _lb;
+ _currentValue = lnbValue[_lb,[_currentRow,0]];
+ //--- Update the templates.
+ _template set [_currentValue, "DELETE"];
+ _template = _template - ["DELETE"];
+ WF_Logic setVariable["templateClasses",_template];
+ _templateCosts set [_currentValue, "DELETE"];
+ _templateCosts = _templateCosts - ["DELETE"];
+ WF_Logic setVariable["templateCosts",_templateCosts];
+ _templatePictures set [_currentValue, "DELETE"];
+ _templatePictures = _templatePictures - ["DELETE"];
+ WF_Logic setVariable["templatePictures",_templatePictures];
+ _templateNames set [_currentValue, "DELETE"];
+ _templateNames = _templateNames - ["DELETE"];
+ WF_Logic setVariable["templateNames",_templateNames];
+ _templateMags set [_currentValue, "DELETE"];
+ _templateMags = _templateMags - ["DELETE"];
+ WF_Logic setVariable["templateMags",_templateMags];
+ _templateItems set [_currentValue, "DELETE"];
+ _templateItems = _templateItems - ["DELETE"];
+ WF_Logic setVariable["templateItems",_templateItems];
+ _templateSpecs set [_currentValue, "DELETE"];
+ _templateSpecs = _templateSpecs - ["DELETE"];
+ WF_Logic setVariable["templateSpecs",_templateSpecs];
+ _templateUpgrades set [_currentValue, "DELETE"];
+ _templateUpgrades = _templateUpgrades - ["DELETE"];
+ WF_Logic setVariable["templateUpgrades",_templateUpgrades];
+ _templateAllowed set [_currentValue, "DELETE"];
+ _templateAllowed = _templateAllowed - ["DELETE"];
+ WF_Logic setVariable["templateAllowed",_templateAllowed];
+ _updateFiller = true;
+ };
+ };
+
+ //--- TODO
+ if (saveLoadout) then {
+ saveLoadout = false;
+ //--- Behave only on template filler.
+ if (_filler == 'template') then {
+ //--- Update the templates.
+ _desc = '';
+ _pict = '';
+ _temp = [];
+ _cAllow = true;
+ _upgr = 0;
+ _pallow = true;
+ _sallow = true;
+
+ if (_currentPrimary != '') then {
+ _get = _currentPrimary Call GetNamespace;
+ _temp = _temp + [_currentPrimary];
+ _desc = _desc + (_get select QUERYGEARLABEL);
+ _pict = (_get select QUERYGEARPICTURE);
+ if !(_get select QUERYGEARALLOWED) then {_cAllow = false};
+ _upgr = _get select QUERYGEARUPGRADE;
+ _pallow = _get select QUERYGEARALLOWTWO;
+ };
+ if (_currentSecondary != '') then {
+ _get = (_currentSecondary+"_W") Call GetNamespace;
+ if (isNil '_get') then {
+ _get = _currentSecondary Call GetNamespace;
+ };
+ _temp = _temp + [_currentSecondary];
+ if (_desc != '') then { _desc = _desc + "/"};
+ //--- Needless to check if the primary is prohibed.
+ _desc = _desc + (_get select QUERYGEARLABEL);
+ if (_pict == '') then {_pict = _get select QUERYGEARPICTURE};
+ if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}};
+ if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)};
+ _sallow = _get select QUERYGEARALLOWTWO;
+ };
+ if (_currentSidearm != '') then {
+ _get = _currentSidearm Call GetNamespace;
+ _temp = _temp + [_currentSidearm];
+ if (_desc != '') then { _desc = _desc + "/"};
+ //--- Needless to check if the secondary is prohibed.
+ _desc = _desc + (_get select QUERYGEARLABEL);
+ if (_pict == '') then {_pict = _get select QUERYGEARPICTURE};
+ if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}};
+ if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)};
+ };
+ if (_pallow || _sallow || !paramExtendedInventory) then {
+ _template = _template + [_temp];
+ WF_Logic setVariable["templateClasses",_template];
+ _templateCosts = _templateCosts + [(_cost + _currentCost)];
+ WF_Logic setVariable["templateCosts",_templateCosts];
+ _templatePictures = _templatePictures + [_pict];
+ WF_Logic setVariable["templatePictures",_templatePictures];
+ _templateNames = _templateNames + [_desc];
+ WF_Logic setVariable["templateNames",_templateNames];
+ _templateMags = _templateMags + [_currentMagazines];
+ WF_Logic setVariable["templateMags",_templateMags];
+ _templateItems = _templateItems + [_currentItems];
+ WF_Logic setVariable["templateItems",_templateItems];
+ _templateSpecs = _templateSpecs + [_currentSpecials];
+ WF_Logic setVariable["templateSpecs",_templateSpecs];
+ _templateUpgrades = _templateUpgrades + [_upgr];
+ WF_Logic setVariable["templateUpgrades",_templateUpgrades];
+ _templateAllowed = _templateAllowed + [_cAllow];
+ WF_Logic setVariable["templateAllowed",_templateAllowed];
+ _updateFiller = true;
+ } else {
+ hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo');
+ };
+ };
+ };
+
+ //--- Loadout Cost.
+ ctrlSetText[3850,Format[localize 'STR_WF_GEAR_Cost',_cost]];
+ //--- Player's Cash.
+ //ctrlSetText[3851,Format["%1 $ %2.",localize 'STR_WF_GEAR_CashLabel',Call GetPlayerFunds]];
+ ctrlSetText[3851,Format["$%1",Call GetPlayerFunds]]; //---changed-MrNiceGuy
+
+ _lastFiller = _filler;
+ sleep 0.05;
+
+ //--- Back Button.
+ if (MenuAction == 1) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+};
+
+//--- Variables destruction.
+WF_Logic setVariable ['lbChange',nil];
+WF_Logic setVariable ['lbMainAction',nil];
+WF_Logic setVariable ['InventoryClick',nil];
+WF_Gear_Hotkeys = nil;
+primClicked = nil;
+secoClicked = nil;
+sideClicked = nil;
+buyLoadout = nil;
+saveLoadout = nil;
+deleteLoadout = nil;
+
+(findDisplay 16000) displayRemoveEventHandler ['KeyDown',_disp]; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu.sqf b/Client/GUI/GUI_Menu.sqf
new file mode 100644
index 0000000..c21ad4a
--- /dev/null
+++ b/Client/GUI/GUI_Menu.sqf
@@ -0,0 +1,161 @@
+
+private ["_enable","_exited","_skip","_voteTime","_timer"];
+MenuAction = -1;
+_exited = false;
+_timer = 3;
+
+WFBE_ForceUpdate = true;
+
+while {alive player && dialog} do {
+ //--- Build Units.
+ _enable = false;
+ if (barracksInRange || lightInRange || heavyInRange || aircraftInRange || hangarInRange || depotInRange) then {_enable = true};
+ ctrlEnable [11001,_enable];
+ ctrlEnable [11002,gearInRange];
+
+ _timer = _timer + 0.1;
+
+ sleep 0.1;
+
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog || _exited) exitWith {};
+
+ //--- Buy Units.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_BuyUnits";
+ _exited = true;
+ };
+
+ //--- Buy Gear.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ CloseDialog 0;
+ CreateDialog "RscAceGear";
+ _exited = true;
+ };
+
+ //--- Team Menu.
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_Team";
+ _exited = true;
+ };
+
+ //--- Voting Menu.
+ if (MenuAction == 4) then {
+ MenuAction = -1;
+ _skip = false;
+ _voteTime = WF_Logic getVariable Format["%1CommanderVoteTime",sideJoinedText];
+ if (_voteTime <= 0) then {_skip = true};
+ if (!_skip) then {
+ CloseDialog 0;
+ CreateDialog "RscMenu_Voting";
+ if !(_skip) exitWith {};
+ };
+ WFBE_RequestCommanderVote = ['SRVFNCREQUESTCOMMANDERVOTE',sideJoined];
+ publicVariable 'WFBE_RequestCommanderVote';
+ if (isHostedServer) then {['SRVFNCREQUESTCOMMANDERVOTE',sideJoined] Spawn HandleSPVF};
+ voted = true;
+ waitUntil {((WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText])>0) || !dialog || !alive player};
+ if (!alive player || !dialog) exitWith {_exited = true};
+ closeDialog 0;
+ createDialog "RscMenu_Voting";
+ _exited = true;
+ };
+
+ //--- Unflip Vehicle.
+ if (MenuAction == 10) then { //added-MrNiceGuy
+ MenuAction = -1;
+ _vehicle = vehicle player;
+ if (player != _vehicle) then {
+ if (getPos _vehicle select 2 > 3 && !surfaceIsWater (getPos _x)) then {
+ [_vehicle, getPos _vehicle, 15] Call PlaceSafe;
+ } else {
+ _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 0.5];
+ _vehicle setVelocity [0,0,-0.5];
+ };
+ };
+ if (player == _vehicle) then {
+ _objects = player nearEntities[["Car","Motorcycle","Tank"],10];
+ if (count _objects > 0) then {
+ {
+ if (getPos _x select 2 > 3 && !surfaceIsWater (getPos _x)) then {
+ [_x, getPos _x, 15] Call PlaceSafe;
+ } else {
+ _x setPos [getPos _x select 0, getPos _x select 1, 0.5];
+ _x setVelocity [0,0,-0.5];
+ };
+ } forEach _objects;
+ };
+ };
+ };
+
+ //--- Headbug Fix.
+ if (MenuAction == 11) then { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ titleCut["","BLACK FADED",0];
+ _pos = position player;
+ _vehi = "Lada1" createVehicle [0,0,0];
+ player moveInCargo _vehi;
+ deleteVehicle _vehi;
+ player setPos _pos;
+ titleCut["","BLACK IN",5];
+ };
+
+ //--- Display Parameters.
+ if (MenuAction == 12) exitWith { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscDisplay_Parameters";
+ };
+
+ //--- Uptime.
+ _uptime = Call GetTime; //added-MrNiceGuy
+ ctrlSetText [11015,Format[localize 'STR_WF_MAIN_Uptime',_uptime select 0,_uptime select 1,_uptime select 2, _uptime select 3]];
+
+ _enable = false; //added-MrNiceGuy
+ if (!isNull(commanderTeam)) then {if (commanderTeam == group player) then {_enable = true}};
+ ctrlEnable [11005,_enable]; //--- Team Orders
+ ctrlEnable [11008,_enable]; //--- Commander Menu
+ ctrlEnable [11006,commandInRange]; //--- Special Menu
+ ctrlEnable [11007,commandInRange]; //--- Upgrade Menu
+
+ //--- Command Menu.
+ if (MenuAction == 5) exitWith { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_Command";
+ };
+
+ //--- Tactical Menu.
+ if (MenuAction == 6) exitWith { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_Tactical";
+ };
+
+ //--- Upgrade Menu.
+ if (MenuAction == 7) exitWith { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_Upgrade";
+ };
+
+ //--- Economy Menu.
+ if (MenuAction == 8) exitWith { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_Economy";
+ };
+
+ //--- Service Menu.
+ if (MenuAction == 9) exitWith { //added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_Service";
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_BuyUnits.sqf b/Client/GUI/GUI_Menu_BuyUnits.sqf
new file mode 100644
index 0000000..75e367f
--- /dev/null
+++ b/Client/GUI/GUI_Menu_BuyUnits.sqf
@@ -0,0 +1,466 @@
+disableSerialization;
+
+//--- Init.
+MenuAction = -1;
+
+_listUnits = [];
+
+_closest = objNull;
+_commander = false;
+_extracrew = false;
+_countAlive = 0;
+_currentCost = 0;
+_currentIDC = 0;
+_disabledColor = [0.7961, 0.8000, 0.7961, 1];
+_display = _this select 0;
+_driver = false;
+_enabledColor = [0, 1, 0, 1];
+_enabledColor2 = [1, 0, 0, 1]; //---NEW (LOCK)
+_gunner = false;
+_IDCLock = 12023;
+_IDCS = [12005,12006,12007,12008,12020,12021];
+_IDCSVehi = [12012,12013,12014,12041];
+_isInfantry = false;
+_isLocked = true;
+_lastCheck = 0;
+_lastSel = -1;
+_lastType = 'nil';
+_listBox = 12001;
+_comboFaction = 12026;
+_map = _display displayCtrl 12015;
+_sorted = [];
+_type = 'nil';
+_update = true;
+_updateDetails = true;
+_updateList = true;
+_updateMap = true;
+_val = 0;
+_mbu = 'WFBE_MAXGROUPSIZE' Call GetNamespace;
+
+ctrlSetText[12025,localize 'STR_WF_UNITS_FactionChoiceLabel' + ":"]; // changed-MrNiceGuy
+
+//--- Get the closest Factory Type in range.
+_break = false;
+_status = [barracksInRange,lightInRange,heavyInRange,aircraftInRange,depotInRange,hangarInRange];
+_statusLabel = ['Barracks','Light','Heavy','Aircraft','Depot','Airport'];
+_statusVals = [0,1,2,3,4,3];
+for [{_i = 0},{(_i < 6) && !_break},{_i = _i + 1}] do {
+ if (_status select _i) then {
+ _break = true;
+ _currentIDC = _IDCS select _i;
+ _type = _statusLabel select _i;
+ _val = _statusVals select _i;
+ };
+};
+
+if (_type == 'nil') exitWith {closeDialog 0};
+
+//--- Destroy local variables.
+_break = nil;
+_status = nil;
+_statusLabel = nil;
+_statusVals = nil;
+
+//--- Enable the current IDC.
+_IDCS = _IDCS - [_currentIDC];
+{
+ _con = _display DisplayCtrl _x;
+ _con ctrlSetTextColor [0.4, 0.4, 0.4, 1];
+} forEach _IDCS;
+
+//--- Loop.
+while {alive player && dialog} do {
+ //--- Nothing in range? exit!.
+ if (!barracksInRange && !lightInRange && !heavyInRange && !aircraftInRange && !hangarInRange && !depotInRange) exitWith {closeDialog 0};
+ if (side player != sideJoined || !dialog) exitWith {closeDialog 0};
+
+ //--- Purchase.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ _currentRow = lnbCurSelRow _listBox;
+ _currentValue = lnbValue[_listBox,[_currentRow,0]];
+ _unit = _listUnits select _currentValue;
+ _currentUnit = _unit Call GetNamespace;
+ _currentCost = _currentUnit select QUERYUNITPRICE;
+ _cpt = 1;
+ _isInfantry = if (_unit isKindOf 'Man') then {true} else {false};
+ if !(_isInfantry) then {
+ _extra = 0;
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ if (_commander) then {_extra = _extra + 1};
+ if (_extracrew) then {_extra = _extra + ((_currentUnit select QUERYUNITCREW) select 3)};
+ _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra);
+ };
+ if ((_currentRow) != -1) then {
+ _funds = Call GetPlayerFunds;
+ _skip = false;
+ if (_funds < _currentCost) then {_skip = true;hint parseText(Format[localize 'STR_WF_INFO_Funds_Missing',_currentCost - _funds,_currentUnit select QUERYUNITLABEL])};
+ //--- Make sure that we own all camps before being able to purchase infantry.
+ if (_type == "Depot" && _isInfantry) then {
+ _totalCamps = _closest Call GetTotalCamps;
+ _campsSide = [_closest,sideJoined] Call GetTotalCampsOnSide;
+ if (_totalCamps != _campsSide) then {_skip = true; hint parseText(localize 'STR_WF_INFO_Camps_Purchase')};
+ };
+ if !(_skip) then {
+ _size = Count ((Units (group player)) Call GetLiveUnits);
+ //--- Get the infantry limit based off the infantry upgrade.
+ _realSize = ((sideJoined) Call GetSideUpgrades) select 0;
+ switch (_realSize) do {
+ case 0: {_realSize = round(_mbu / 4)};
+ case 1: {_realSize = round(_mbu / 4)*2};
+ case 2: {_realSize = round(_mbu / 4)*3};
+ case 3: {_realSize = _mbu};
+ default {_realSize = _mbu};
+ };
+ if (_isInfantry) then {if ((unitQueu + _size + 1) > _realSize) then {_skip = true;hint parseText(Format [localize 'STR_WF_INFO_MaxGroup',_realSize])}};
+
+ if (!_isInfantry && !_skip) then {
+ _cpt = 0;
+ if (_driver) then {_cpt = _cpt + 1};
+ if (_gunner) then {_cpt = _cpt + 1};
+ if (_commander) then {_cpt = _cpt + 1};
+ if (_extracrew) then {_cpt = _cpt + ((_currentUnit select QUERYUNITCREW) select 3)};
+ if ((unitQueu + _size + _cpt) > _realSize && _cpt != 0) then {_skip = true;hint parseText(Format [localize 'STR_WF_INFO_MaxGroup',_realSize])};
+ };
+ };
+ if !(_skip) then {
+ //--- Check the max queu.
+ if ((Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace) < (Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace)) then {
+ [Format["WFBE_C_QUEUE_%1",_type],(Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace)+1,true] Call SetNamespace;
+
+ _queu = _closest getVariable 'queu';
+ _txt = parseText(Format [localize 'STR_WF_INFO_BuyEffective',_currentUnit select QUERYUNITLABEL]);
+ if (!isNil '_queu') then {if (count _queu > 0) then {_txt = parseText(Format [localize 'STR_WF_INFO_Queu',_currentUnit select QUERYUNITLABEL])}};
+ hint _txt;
+ _params = if (_isInfantry) then {[_closest,_unit,[],_type,_cpt]} else {[_closest,_unit,[_driver,_gunner,_commander,_extracrew,_isLocked],_type,_cpt]};
+ _params Spawn BuildUnit;
+ -(_currentCost) Call ChangePlayerFunds;
+ } else {
+ hint parseText(Format [localize 'STR_WF_INFO_Queu_Max',Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace]);
+ };
+ };
+ };
+ };
+
+ //--- Tabs selection.
+ if (MenuAction == 101) then {MenuAction = -1;if (barracksInRange) then {_currentIDC = 12005;_type = 'Barracks';_val = 0;_update = true}};
+ if (MenuAction == 102) then {MenuAction = -1;if (lightInRange) then {_currentIDC = 12006;_type = 'Light';_val = 1;_update = true}};
+ if (MenuAction == 103) then {MenuAction = -1;if (heavyInRange) then {_currentIDC = 12007;_type = 'Heavy';_val = 2;_update = true}};
+ if (MenuAction == 104) then {MenuAction = -1;if (aircraftInRange) then {_currentIDC = 12008;_type = 'Aircraft';_val = 3;_update = true}};
+ if (MenuAction == 105) then {MenuAction = -1;if (depotInRange) then {_currentIDC = 12020;_type = 'Depot';_val = 4;_update = true}};
+ if (MenuAction == 106) then {MenuAction = -1;if (hangarInRange) then {_currentIDC = 12021;_type = 'Airport';_val = 3;_update = true}};
+
+ //--- driver-gunner-commander icons.
+ if (MenuAction == 201) then {MenuAction = -1;_driver = if (_driver) then {false} else {true};_updateDetails = true};
+ if (MenuAction == 202) then {MenuAction = -1;_gunner = if (_gunner) then {false} else {true};_updateDetails = true};
+ if (MenuAction == 203) then {MenuAction = -1;_commander = if (_commander) then {false} else {true};_updateDetails = true};
+ if (MenuAction == 204) then {MenuAction = -1;_extracrew = if (_extracrew) then {false} else {true};_updateDetails = true};
+
+ //--- Factory DropDown list value has changed.
+ if (MenuAction == 301) then {MenuAction = -1;_factSel = lbCurSel 12018;_closest = _sorted select _factSel;_updateMap = true};
+
+ //--- Selection change, we update the details.
+ if (MenuAction == 302) then {MenuAction = -1;_updateDetails = true};
+
+ //--- Faction Filter changed.
+ if (MenuAction == 303) then {MenuAction = -1;_update = true;[Format["WFBE_%1%2CURRENTFACTIONSELECTED",sideJoinedText,_type],(lbCurSel _comboFaction),true] Call SetNamespace};
+
+ //--- Lock icon.
+ if (MenuAction == 401) then {MenuAction = -1;_isLocked = if (_isLocked) then {false} else {true};_updateDetails = true};
+
+ //--- Player funds.
+ ctrlSetText [12019,Format [localize 'STR_WF_UNITS_Cash',Call GetPlayerFunds]];
+
+ //--- Update tabs.
+ if (_update) then {
+ _listUnits = Format ['WFBE_%1%2UNITS',sideJoinedText,_type] Call GetNamespace;
+
+ [_comboFaction,_type] Call UIChangeComboBuyUnits;
+ [_listUnits,_type,_listBox,_val] Call UIFillListBuyUnits;
+
+ //--- Update tabs icons.
+ _IDCS = [12005,12006,12007,12008,12020,12021];
+ _IDCS = _IDCS - [_currentIDC];
+ _con = _display DisplayCtrl _currentIDC;
+ _con ctrlSetTextColor [1, 1, 1, 1];
+ {_con = _display DisplayCtrl _x;_con ctrlSetTextColor [0.4, 0.4, 0.4, 1]} forEach _IDCS;
+
+ _update = false;
+ _updateList = true;
+ _updateDetails = true;
+ };
+
+ //--- Update factories.
+ if (_updateList) then {
+ switch (_type) do {
+ //--- Specials.
+ case 'Depot': {
+ _nObjects = nearestObjects [(vehicle player), WFDEPOT,('WFBE_TOWNPURCHASERANGE' Call GetNamespace)];
+ _closest = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};
+ _sorted = [_closest];
+ };
+ case 'Airport': {
+ _sorted = [(vehicle player),Airfields] Call SortByDistance;
+ _closest = _sorted select 0;
+ _sorted = [_closest];
+ };
+ //--- Factories
+ default {
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories;
+ _sorted = [(vehicle player),_factories] Call SortByDistance;
+ _closest = _sorted select 0;
+ _countAlive = count _factories;
+ };
+ };
+
+ //--- Refresh the Factory DropDown list.
+ lbClear 12018;
+ {
+ _nearest = [_x,towns] Call SortByDistance;
+ _nearTown = (_nearest select 0) getVariable 'name';
+ _txt = _type + ' ' + _nearTown + ' ' + str (round((vehicle player) distance _x)) + 'M';
+ lbAdd[12018,_txt];
+ } forEach _sorted;
+ lbSetCurSel [12018,0];
+
+ _updateList = false;
+ _updateMap = true;
+ };
+
+ //--- Display Factory Queu.
+ _queu = _closest getVariable "queu";
+ _value = if (isNil '_queu') then {0} else {count (_closest getVariable "queu")};
+ ctrlSetText[12024,Format[localize 'STR_WF_UNITS_QueuedLabel',str _value]];
+
+ //--- List selection changed.
+ if (_updateDetails) then {
+ _currentRow = lnbCurSelRow _listBox;
+ //--- Our list is not empty.
+ if (_currentRow != -1) then {
+ _currentValue = lnbValue[_listBox,[_currentRow,0]];
+ _unit = _listUnits select _currentValue;
+ _currentUnit = _unit Call GetNamespace;
+ ctrlSetText [12009,_currentUnit select QUERYUNITPICTURE];
+ ctrlSetText [12033,_currentUnit select QUERYUNITFACTION];
+ ctrlSetText [12035,str (_currentUnit select QUERYUNITTIME)];
+ _currentCost = _currentUnit select QUERYUNITPRICE;
+
+ _isInfantry = if (_unit isKindOf 'Man') then {true} else {false};
+
+ //--- Update driver-gunner-commander icons.
+ if !(_isInfantry) then {
+ ctrlSetText [12036,"N/A"];
+ ctrlSetText [12037,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'transportSoldier'))];
+ ctrlSetText [12038,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'maxSpeed'))];
+ ctrlSetText [12039,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'armor'))];
+ if (_type != 'Depot') then {
+ _slots = _currentUnit select QUERYUNITCREW;
+
+ if (typeName _slots == "ARRAY") then {
+ _hasCommander = _slots select 0;
+ _hasGunner = _slots select 1;
+ _turretsCount = _slots select 3;
+ _extra = 0;
+
+ _maxOut = false;
+ if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true};
+
+ if (_maxOut) then {
+ _driver = true;
+ _gunner = true;
+ _commander = true;
+ _extracrew = false;
+ };
+
+ if !(_hasGunner) then {_gunner = false};
+
+ if !(_hasCommander) then {_commander = false};
+
+ if (_turretsCount == 0) then {_extracrew = false};
+
+ ctrlShow[_IDCSVehi select 0, true];
+ ctrlShow[_IDCSVehi select 1, _hasGunner];
+ ctrlShow[_IDCSVehi select 2, _hasCommander];
+ ctrlShow[_IDCSVehi select 3, if (_turretsCount == 0) then {false} else {true}];
+
+ _c = 0;
+ {
+ _color = if (_x) then {_enabledColor} else {_disabledColor};
+ _con = _display displayCtrl (_IDCSVehi select _c);
+ _con ctrlSetTextColor _color;
+
+ _c = _c + 1;
+ } forEach [_driver,_gunner,_commander,_extracrew];
+
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ if (_commander) then {_extra = _extra + 1};
+ if (_extracrew) then {_extra = _extra + _turretsCount};
+
+ //--- Set the 'extra' price.
+ _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra);
+ } else {//--- Backward compability.
+ _c = 0;
+ _extra = 0;
+
+ //--- Enabled AI by default.
+ _extracrew = false;
+ _maxOut = false;
+ if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true};
+
+ switch (_slots) do {
+ case 1: {
+ if (_maxOut) then {_driver = true};
+ if (_driver) then {_extra = _extra + 1};
+ _gunner = false;
+ _commander = false;
+ };
+ case 2: {
+ if (_maxOut) then {_driver = true;_gunner = true};
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ _commander = false;
+ };
+ case 3: {
+ if (_maxOut) then {_driver = true;_gunner = true;_commander = true};
+ if (_driver) then {_extra = _extra + 1};
+ if (_gunner) then {_extra = _extra + 1};
+ if (_commander) then {_extra = _extra + 1};
+ };
+ };
+
+ //--- Show the icons.
+ {
+ _show = false;
+ if (_c < _slots) then {_show = true};
+ ctrlShow [_x,_show];
+ _c = _c + 1;
+ } forEach _IDCSVehi;
+
+ //--- Mask extra crew.
+ ctrlShow[_IDCSVehi select 3, false];
+
+ _i = 0;
+
+ //--- Set the icons.
+ {
+ _color = if (_x) then {_enabledColor} else {_disabledColor};
+ _con = _display displayCtrl (_IDCSVehi select _i);
+ _con ctrlSetTextColor _color;
+ _i = _i + 1;
+ } forEach [_driver,_gunner,_commander,_extracrew];
+
+ //--- Set the 'extra' price.
+ _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra);
+ };
+ } else {
+ {ctrlShow [_x,false]} forEach (_IDCSVehi);
+ _driver = false;
+ _gunner = false;
+ _commander = false;
+ _extracrew = false;
+ };
+ } else {
+ ctrlSetText [12036,Format ["%1/100",(_currentUnit select QUERYUNITSKILL) * 100]];
+ ctrlSetText [12037,"N/A"];
+ ctrlSetText [12038,"N/A"];
+ ctrlSetText [12039,"N/A"];
+
+ {ctrlShow [_x,false]} forEach (_IDCSVehi);
+ _driver = false;
+ _gunner = false;
+ _commander = false;
+ _extracrew = false;
+
+ //--- Display a unit's loadout.
+ _weapons = (getArray (configFile >> 'CfgVehicles' >> _unit >> 'weapons')) - ['Put','Throw'];
+ _magazines = getArray (configFile >> 'CfgVehicles' >> _unit >> 'magazines');
+
+ _classMags = [];
+ _classMagsAmount = [];
+ _MagsLabel = [];
+
+ {
+ _findAt = _classMags find _x;
+ if (_findAt == -1) then {
+ _classMags = _classMags + [_x];
+ _classMagsAmount = _classMagsAmount + [1];
+ _MagsLabel = _MagsLabel + [[_x,'displayName','CfgMagazines'] Call GetConfigInfo];
+ } else {
+ _classMagsAmount set [_findAt, (_classMagsAmount select _findAt) + 1];
+ };
+ } forEach _magazines;
+ _txt = "<t color='#42b6ff' shadow='1'>" + (localize 'STR_WF_UNITS_Weapons') + ":</t><br />";
+ for [{_i = 0},{_i < count _weapons},{_i = _i + 1}] do {
+ _txt = _txt + "<t color='#eee58b' shadow='2'>" + ([(_weapons select _i),'displayName','CfgWeapons'] Call GetConfigInfo) + "</t>";
+ if ((_i+1) < count _weapons) then {_txt = _txt + "<t color='#D3A119' shadow='2'>,</t> "};
+ };
+ _txt = _txt + "<t color='#D3A119' shadow='2'></t><br /><br />";
+ _txt = _txt + "<t color='#42b6ff' shadow='1'>" + (localize 'STR_WF_UNITS_Magazines') + ":</t><br />";
+ for [{_i = 0},{_i < count _MagsLabel},{_i = _i + 1}] do {
+ _txt = _txt + "<t color='#eee58b' shadow='2'>" + ((_MagsLabel select _i) + "</t> <t color='#42b6ff' shadow='1'>x</t><t color='#42b6ff' shadow='1'>" + str (_classMagsAmount select _i)) + "</t>";
+ if ((_i+1) < count _MagsLabel) then {_txt = _txt + "<t color='#D3A119' shadow='2'>,</t> "};
+ };
+ _txt = _txt + "<t color='#D3A119' shadow='2'></t>";
+
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt);
+ };
+
+ //--- Lock Icon.
+ if !(_isInfantry) then {
+ ctrlShow[_IDCLock,true];
+ _color = if (_isLocked) then {_enabledColor2} else {_disabledColor};
+ _con = _display displayCtrl _IDCLock;
+ _con ctrlSetTextColor _color;
+ } else {
+ ctrlShow[_IDCLock,false];
+ };
+
+ //--- Long description.
+ if !(_isInfantry) then {
+ if (isClass (configFile >> 'CfgVehicles' >> _unit >> 'Library')) then {
+ _txt = getText (configFile >> 'CfgVehicles' >> _unit >> 'Library' >> 'libTextDesc');
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt);
+ } else {
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText '');
+ };
+ };
+
+ ctrlSetText [12034,Format ["$ %1",_currentCost]];
+ _updateDetails = false;
+ } else {
+ {ctrlSetText [_x , ""]} forEach [12009,12010,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037,12038,12039];
+ (_display displayCtrl 12022) ctrlSetStructuredText (parseText '');
+ };
+ };
+
+ //--- Update the Factory Minimap position.
+ if (_updateMap) then {
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [2,.075,getPos _closest];
+ ctrlMapAnimCommit _map;
+ _updateMap = false;
+ };
+
+ //--- Check that the factories of the current type are still alive.
+ _lastCheck = _lastCheck + 0.1;
+ if (_lastCheck > 2 && _type != 'Depot' && _type != 'Airport') then {
+ _lastCheck = 0;
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories;
+ if (count _factories != _countAlive) then {_updateList = true};
+ };
+
+ _lastSel = lnbCurSelRow _listBox;
+ _lastType = _type;
+ sleep 0.1;
+
+ //--- Back Button.
+ if (MenuAction == 2) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Command.sqf b/Client/GUI/GUI_Menu_Command.sqf
new file mode 100644
index 0000000..a85003b
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Command.sqf
@@ -0,0 +1,532 @@
+disableSerialization;
+
+MenuAction = -1;
+mouseButtonUp = -1;
+_display = _this select 0;
+
+//--- Alt.
+_mode = 0; //--- Team properties.
+
+_updateProperties = true;
+_updateRespawn = true;
+_updateTab = true;
+
+_IDCTeam = [14009,14010,14016,14017,14018,14019,14020,14021,14022,14023,14024,14025,14026,14027,14030,14031,14901,14902];
+_IDCTasks = [14017,14018,14021,14022,14030,14032];
+_IDCDetails = [14030,14041,14042,14043];
+{ctrlShow[_x,false]} forEach (_IDCTasks + _IDCDetails);
+{ctrlShow[_x,true]} forEach _IDCTeam;
+_TaskTypes = ["Assist","Attack","Defend","Destroy","Guard","Hold","Patrol","Move","Search and Destroy","Seize","Support"];
+_TaskDuration = [1,2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60];
+_TaskDurationLabel = ["1 Min","2 Min","3 Min","4 Min","5 Min","6 Min","7 Min","8 Min","9 Min","10 Min","15 Min","20 Min","25 Min","30 Min","35 Min","40 Min","45 Min","50 Min","55 Min","60 Min"];
+_detailGroup = [];
+
+ctrlSetText [14026,localize "STR_WF_COMMAND_Respawn" + ":"];
+
+_listbox_teams = _display displayCtrl 14012;
+_u = 1;
+lbAdd[14012,localize "STR_WF_COMMAND_All"];
+{lbAdd [14012,Format["[%1] %2",_u,name (leader _x)]];_u = _u + 1} forEach clientTeams;
+lbSetCurSel [14012,1];
+
+_radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu","Razor","Fatman","StarForce","Frostbite","Battlemage","Manhattan","Firefly","Swordsman","Sabre","Hammer","Reaper","Anvil","Fortune"];
+
+_templates = Format["WFBE_%1AITEAMTEMPLATEDESCRIPTIONS",sideJoinedText] Call GetNamespace;
+_templates_upgrades = Format["WFBE_%1AITEAMUPGRADES",sideJoinedText] Call GetNamespace;
+_upgrades = (sideJoined) Call GetSideUpgrades;
+_u = 0;
+_i = 0;
+{
+ _temp_upgr = _templates_upgrades select _i;
+
+ _canAdd = true;
+ for '_k' from 0 to 3 do {
+ if ((_temp_upgr select _k) > (_upgrades select _k)) exitWith {_canAdd = false};
+ };
+
+ if (_canAdd) then {
+ lbAdd [14010,_x];
+ lbSetValue [14010, _u, _i];
+ _u = _u + 1;
+ };
+ _i = _i + 1;
+} forEach _templates;
+lbSort (_display displayCtrl 14010);
+
+_curSel = lbCurSel 14012;
+_teams = [];
+_team = if (_curSel != 0) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)};
+
+_index = (_team) Call GetTeamType;
+if (_index == -1) then {_index = 1};
+lbSetCurSel [14010,[14010,_index] Call UIFindLBValue];
+
+_txt = (_team) Call GetTeamMoveMode;
+if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_TakeTowns"};
+if (_txt == "move") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Move"};
+if (_txt == "patrol") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Patrol"};
+if (_txt == "defense") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Defense"};
+ctrlSetText [14013,_txt];
+
+_map = _display displayCtrl 14002;
+//_map ctrlMapAnimAdd [1,.075,getPos (leader(clientTeams select 0))];
+//ctrlMapAnimCommit _map;
+
+ctrlEnable [14015,false];
+ctrlEnable [14014,false];
+
+//--- Set the combo properties.
+_behaviors = ["AWARE","CARELESS","COMBAT","SAFE","STEALTH"];
+_combatModes = ["BLUE","GREEN","RED","WHITE","YELLOW"];
+_formations = ["COLUMN","DIAMOND","ECH LEFT","ECH RIGHT","FILE","LINE","STAG COLUMN","VEE","WEDGE"];
+_speeds = ["LIMITED","FULL","NORMAL"];
+
+{lbAdd [14017, _x]} forEach _behaviors;
+{lbAdd [14018, _x]} forEach _combatModes;
+{lbAdd [14019, _x]} forEach _formations;
+{lbAdd [14020, _x]} forEach _speeds;
+
+_structures = [""];
+_hq = (sideJoinedText) Call GetSideHQ;
+if (alive _hq) then {_structures = _structures + [_hq]};
+_structures = _structures + ((sideJoinedText) Call GetSideStructures);
+_structuresLbl = ["Default"];
+lbAdd[14025,"Default"];
+
+{
+ if (typeName _x == "OBJECT") then {
+ _nearest = [_x,towns] Call SortByDistance;
+ _nearTown = (_nearest select 0) getVariable 'name';
+ _type = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _lbl = _type + ' ' + _nearTown + ' ' + str (round(player distance _x)) + 'M';
+ _structuresLbl = _structuresLbl + [_lbl];
+ lbAdd[14025,_lbl];
+ };
+} forEach _structures;
+
+while {alive player && dialog} do {
+ sleep 0.1;
+ if (side player != sideJoined) exitWith {activeAnimMarker = false;closeDialog 0};
+ if (!dialog) exitWith {activeAnimMarker = false};
+
+ if (MenuAction == 601) then {if (_mode != 0) then {_updateTab = true};_mode = 0};//--- Team properties.
+ if (MenuAction == 602) then {if (_mode != 1) then {_updateTab = true};_mode = 1};//--- Task.
+ if (MenuAction == 603) then {if (_mode != 2) then {_updateTab = true};_mode = 2};//--- Task.
+
+ _curSel = lbCurSel 14012;
+ _isAll = if (_curSel == 0 || (0 in _teams)) then {true} else {false};
+ _team = if !(_isAll) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)};
+ _teams = lbSelection _listbox_teams;
+
+ if (_updateTab) then {
+ _currentIDC = 0;
+ switch (_mode) do {
+ case 0: {
+ {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTasks);
+ {ctrlShow[_x,true]} forEach _IDCTeam;
+ ctrlSetText[14021,localize "STR_WF_COMMAND_Behavior"];
+ ctrlSetText[14022,localize "STR_WF_COMMAND_CombatMode"];
+ ctrlSetText[14030,localize "STR_WF_COMMAND_SquadSettingsLabel"];
+ lbClear 14017;
+ lbClear 14018;
+ {lbAdd [14017, _x]} forEach _behaviors;
+ {lbAdd [14018, _x]} forEach _combatModes;
+ _updateProperties = true;
+ _currentIDC = 14500;
+ };
+ case 1: {
+ {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTeam);
+ {ctrlShow[_x,true]} forEach _IDCTasks;
+ lbClear 14017;
+ lbClear 14018;
+ {lbAdd [14017, _x]} forEach _TaskTypes;
+ {lbAdd [14018, _x]} forEach _TaskDurationLabel;
+ ctrlSetText[14021,localize "STR_WF_COMMAND_TaskTO_Do" + ":"];
+ ctrlSetText[14022,localize "STR_WF_COMMAND_TaskTO_Time" + ":"];
+ ctrlSetText[14030,localize "STR_WF_COMMAND_Tasks"];
+ lbSetCurSel[14017,0];
+ lbSetCurSel[14018,0];
+ _currentIDC = 14501;
+ };
+ case 2: {
+ {ctrlShow[_x,false]} forEach (_IDCTasks + _IDCTeam);
+ {ctrlShow[_x,true]} forEach _IDCDetails;
+ ctrlSetText[14030,localize "STR_WF_COMMAND_SquadManagmentLabel"];
+ _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ _enable = if !(isPlayer leader _team) then {true} else {false};
+ ctrlEnable [14043,_enable];
+ _enable = if !(isPlayer (vehicle leader _team) && vehicle leader _team != leader _team) then {true} else {false};
+ ctrlEnable [14042,_enable];
+ _currentIDC = 14502;
+ };
+ };
+ _hidc = [14500,14502,14501];
+ _hidc = _hidc - [_currentIDC];
+ _con = _display DisplayCtrl _currentIDC;
+ _con ctrlSetTextColor [1, 1, 1, 1];
+ {_con = _display DisplayCtrl _x;_con ctrlSetTextColor [0.4, 0.4, 0.4, 1]} forEach _hidc;
+ _updateTab = false;
+ };
+
+ _txt = (_team) Call GetTeamMoveMode;
+ if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_TakeTowns"};
+ if (_txt == "move") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Move"};
+ if (_txt == "patrol") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Patrol"};
+ if (_txt == "defense") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Defense"};
+ ctrlSetText [14013,_txt];
+
+ //--- Team Funds.
+ ctrlSetText [14028,Format [localize 'STR_WF_COMMAND_Cash',str ((_team) Call GetTeamFunds)]];
+
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ activeAnimMarker = false;
+
+ _index = (_team) Call GetTeamType;
+ _currentCoord = (_team) Call GetTeamMovePos;
+ _currentMission = (_team) Call GetTeamMoveMode;
+ if (typeName _currentCoord == "ARRAY") then {
+ if (count _currentCoord > 0) then {
+ _position = _currentCoord;
+ if (_currentMission == "move") then {["TempAnim",_position,"selector_selectedMission",1,"ColorOrange",1,1.2] Spawn MarkerAnim};
+ if (_currentMission == "patrol") then {["TempAnim",_position,"selector_selectedMission",1,"ColorYellow",1,1.2,"areaPatrol"] Spawn MarkerAnim};
+ if (_currentMission == "defense") then {["TempAnim",_position,"selector_selectedMission",1,"ColorRed",1,1.2] Spawn MarkerAnim};
+ };
+ };
+ if (typeName _currentCoord == "OBJECT") then {
+ if (_currentMission == "towns") then {["TempAnim",getPos _currentCoord,"selector_selectedMission",1,"ColorBlue",1,1.2] Spawn MarkerAnim};
+ };
+
+ _enable = if (isPlayer(leader _team)) then {false} else {true};
+ _special = if (_isAll) then {false} else {if !(isPlayer(leader _team)) then {true} else {false}};
+ ctrlEnable [14011,_special];
+ ctrlEnable [14014,_enable];
+ ctrlEnable [14015,_enable];
+
+ if (_enable) then {
+ _isDisabled = (_team) Call GetTeamAutonomous;
+ if (_isDisabled) then {
+ ctrlEnable [14014,true];
+ ctrlEnable [14015,false];
+ } else {
+ ctrlEnable [14015,true];
+ ctrlEnable [14014,false];
+ };
+ };
+ if (_index == -1) then {_index = 1};
+ lbSetCurSel [14010,[14010,_index] Call UIFindLBValue];
+ if (_mode == 0) then {
+ _updateProperties = true;
+ _updateRespawn = true;
+ };
+ if (_mode == 2) then {
+ _detailGroup = if !(_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ _enable = if !(isPlayer leader _team) then {true} else {false};
+ ctrlEnable [14043,_enable];
+ };
+ };
+
+ //--- Focus.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [2,.075,getPos(leader _team)];
+ ctrlMapAnimCommit _map;
+ };
+
+ //--- Focus (AI Sub).
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _map ctrlMapAnimAdd [1,.095,getPos (_detailGroup select _iddx)];
+ ctrlMapAnimCommit _map;
+ };
+ };
+
+ //--- Take Towns.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ if (!_isAll) then {
+ [_team,'towns'] Call SetTeamMoveMode;
+ } else {
+ {[_x,'towns'] Call SetTeamMoveMode} forEach clientTeams;
+ };
+ activeAnimMarker = false;
+ };
+
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ //--- Move | Patrol | Defend.
+ if (MenuAction == 102 || MenuAction == 103 || MenuAction == 104) then {
+ _color = "";
+ _order = "";
+ _isAdded = "";
+ switch (MenuAction) do {
+ case 102: {_color = "ColorOrange";_order = "MOVE"};
+ case 103: {_color = "ColorYellow";_order = "PATROL";_isAdded = "areaPatrol"};
+ case 104: {_color = "ColorRed";_order = "DEFENSE"};
+ };
+ MenuAction = -1;
+ _position = _map posScreenToWorld[mouseX,mouseY];
+
+ [_curSel,_position,_order,_isAll,_teams] Spawn {
+ Private ["_curSel","_isAll","_order","_position","_radio","_radioLabel","_sideTeam","_teams"];
+ _curSel = _this select 0;
+ _position = _this select 1;
+ _order = _this select 2;
+ _isAll = _this select 3;
+ _teams = _this select 4;
+ //_radio = ["all","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","yankee","zulu"];
+ _radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu","Razor","Fatman","StarForce","Frostbite","Battlemage","Manhattan","Firefly","Swordsman","Sabre","Hammer","Reaper","Anvil","Fortune"];
+
+ if (!_isAll) then {
+ _sideTeam = "Team ";
+ for '_i' from 0 to count _teams-1 do {
+ _selected = clientTeams select ((_teams select _i) - 1);
+ _sideTeam = _sideTeam + (_radioLabel select (_teams select _i));
+ if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "};
+ };
+
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,_position] Call SetTeamMovePos;
+ [_selected,_order] Call SetTeamMoveMode;
+ } forEach _teams;
+ } else {
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+ {
+ [_x,_position] Call SetTeamMovePos;
+ [_x,_order] Call SetTeamMoveMode;
+ } forEach clientTeams;
+ };
+ };
+
+ activeAnimMarker = false;
+ _array = if (_isAdded == "") then {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2]} else {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2,_isAdded]};
+ _array Spawn MarkerAnim;
+ };
+
+ //--- Set a Task.
+ if (MenuAction == 306) then {
+ MenuAction = -1;
+ _taskType = _TaskTypes select (lbCurSel 14017);
+ _taskTime = _TaskDuration select (lbCurSel 14018);
+ _taskTimeLabel = _TaskDurationLabel select (lbCurSel 14018);
+ _position = _map posScreenToWorld[mouseX,mouseY];
+ if (!_isAll) then {
+ _sideTeam = "Team ";
+ for '_i' from 0 to count _teams-1 do {
+ _selected = clientTeams select ((_teams select _i) - 1);
+ _sideTeam = _sideTeam + (_radioLabel select (_teams select _i));
+ if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "};
+ };
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+
+ {
+ _selected = clientTeams select (_x - 1);
+ if (alive (leader _selected)) then {
+ WFBE_SetTask = [vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]];
+ publicVariable 'WFBE_SetTask';
+ if (isHostedServer) then {[vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF};
+ };
+ } forEach _teams;
+ } else {
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+ WFBE_SetTask = [sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]];
+ publicVariable 'WFBE_SetTask';
+ if (isHostedServer) then {[sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF};
+ };
+ };
+ };
+
+ //--- Respawn.
+ if (MenuAction == 201) then {
+ MenuAction = -1;
+ [_team] Spawn {
+ Private ["_team"];
+ _team = _this select 0;
+ _units = Units _team;
+ if (paramMobileRespawn || (('WFBE_RESPAWNCAMPSMODE' Call GetNamespace) > 0)) then {//--- Make sure that the unit won't spawn back at a camp/ambu.
+ [_team,"forceRespawn"] Call SetTeamRespawn;
+ sleep 2;
+ };
+ _units = _units + ([_team,false] Call GetTeamVehicles);
+ {_x setDammage 1} forEach _units;
+ };
+ };
+
+ //--- Auto AI.
+ if (MenuAction == 301) then {
+ MenuAction = -1;
+ _isDisabled = (_team) Call GetTeamAutonomous;
+ if (_isDisabled) then {
+ ctrlEnable [14015,true];
+ ctrlEnable [14014,false];
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,false] Call SetTeamAutonomous;
+ } forEach _teams;
+ } else {
+ {[_x,false] Call SetTeamAutonomous} forEach clientTeams;
+ };
+ } else {
+ ctrlEnable [14014,true];
+ ctrlEnable [14015,false];
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,true] Call SetTeamAutonomous;
+ } forEach _teams;
+ } else {
+ {[_x,true] Call SetTeamAutonomous} forEach clientTeams;
+ };
+ };
+ };
+
+ //--- Set buy Type
+ if (MenuAction == 302) then {
+ MenuAction = -1;
+ _curType = lbValue [14010, lbCurSel(14010)];
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,_curType] Call SetTeamType;
+ } forEach _teams;
+ } else {
+ {[_x,_curType] Call SetTeamType} forEach clientTeams;
+ };
+ };
+
+ //--- Set property to team.
+ if (MenuAction == 303) then {
+ MenuAction = -1;
+ _behavior = _behaviors select (lbCurSel(14017));
+ _combat = _combatModes select (lbCurSel(14018));
+ _formation = _formations select (lbCurSel(14019));
+ _speed = _speeds select (lbCurSel(14020));
+
+ //--- Locality, process on server.
+ _to = sideJoined;
+ if (!_isAll) then {
+ _to = [];
+ {
+ _selected = clientTeams select (_x - 1);
+ _to = _to + [_selected];
+ } foreach _teams;
+ };
+
+ WFBE_RequestTeamUpdate = ['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]];
+ publicVariable 'WFBE_RequestTeamUpdate';
+ if (isHostedServer) then {['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]] Spawn HandleSPVF};
+ };
+
+ //--- Set respawn.
+ if (MenuAction == 304) then {
+ MenuAction = -1;
+ _curSel = lbCurSel 14025;
+ if (_curSel == -1) then {_curSel = 0};
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,(_structures select _curSel)] Call SetTeamRespawn;
+ } forEach _teams;
+ } else {
+ {[_x,(_structures select _curSel)] Call SetTeamRespawn} forEach clientTeams;
+ };
+ };
+
+ //--- Update the respawn info.
+ if (_updateRespawn) then {
+ _updateRespawn = false;
+ _respawn = (_team) Call GetTeamRespawn;
+ _id = _structures find _respawn;
+ if (_id != -1) then {lbSetCurSel [14025,_id]} else {lbSetCurSel[14025,0]};
+ };
+
+ //--- Minimap update (Only refresh when the combo is selected).
+ if (MenuAction == 305 && _updateProperties) then {MenuAction = -1};
+ if (MenuAction == 305) then {
+ MenuAction = -1;
+ _curSel = lbCurSel 14025;
+ if (_curSel == -1) then {_curSel = 0};
+ if (typeName (_structures select _curSel) == "OBJECT") then {
+ _map ctrlMapAnimAdd [1,.095,getPos (_structures select _curSel)];
+ ctrlMapAnimCommit _map;
+ };
+ };
+
+ //--- Units Details.
+ if (MenuAction == 401) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _unit = _detailGroup select _iddx;
+ _enable = if (!(isPlayer (vehicle _unit)) && vehicle _unit != _unit) then {true} else {false};
+ ctrlEnable [14042,_enable];
+ };
+ };
+
+ //--- Units Details (Unflip)
+ if (MenuAction == 402) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _unit = _detailGroup select _iddx;
+ if ((getPos _unit select 2) < 5) then {
+ _unit setPos [getPos _unit select 0,getpos _unit select 1,0.5];
+ _unit setVelocity [0,0,-1];
+ _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ };
+ };
+ };
+
+ //--- Units Details (Disband)
+ if (MenuAction == 403) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _unit = _detailGroup select _iddx;
+ _unit setDamage 1;
+ _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ };
+ };
+
+ //--- Update team properties.
+ if (_updateProperties) then {
+ _updateProperties = false;
+ _behavior = behaviour (leader _team);
+ _combat = combatMode (leader _team);
+ _formation = formation (leader _team);
+ _speed = speedMode (leader _team);
+
+ //--- Behavior.
+ _id =_behaviors find _behavior;
+ if (_id != -1) then {lbSetCurSel [14017,_id]};
+ //--- Combat Mode.
+ _id =_combatModes find _combat;
+ if (_id != -1) then {lbSetCurSel [14018,_id]};
+ //--- Formation.
+ _id =_formations find _formation;
+ if (_id != -1) then {lbSetCurSel [14019,_id]};
+ //--- Speed.
+ _id =_speeds find _speed;
+ if (_id != -1) then {lbSetCurSel [14020,_id]};
+ };
+
+ //--- Back Button.
+ if (MenuAction == 4) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+};
+
+activeAnimMarker = false;
diff --git a/Client/GUI/GUI_Menu_EASA.sqf b/Client/GUI/GUI_Menu_EASA.sqf
new file mode 100644
index 0000000..66f929e
--- /dev/null
+++ b/Client/GUI/GUI_Menu_EASA.sqf
@@ -0,0 +1,48 @@
+MenuAction = -1;
+
+_type = ('WFBE_EASA_Vehicles' Call GetNamespace) find (typeOf (vehicle player));
+if (_type == -1) exitWith {diag_log Format['[WFBE (ERROR)][frameno:%2 | ticktime:%3] GUI_EASA: The player vehicle was not found within the list (%1)',_type,diag_frameno,diag_tickTime]};
+_data = (('WFBE_EASA_Loadouts' Call GetNamespace) select _type);
+
+
+_listPrice = [];
+_listDesc = [];
+_listBox = 23003;
+for [{_i = 0},{_i < count(_data)},{_i = _i + 1}] do {
+ _cdata = _data select _i;
+ for [{_j = 0},{_j < count(_cdata)},{_j = _j + 1}] do {
+ if (_j == 0) then {_listPrice = _listPrice + [(_cdata select 0) select 0]};
+ if (_j == 1) then {
+ _listDesc = _listDesc + [(_cdata select 1) select 0];
+ lnbAddRow [_listBox,["$"+str((_cdata select 0) select 0)+".",(_cdata select 1) select 0]]};
+ if (_j > 1) then {
+ };
+ };
+};
+
+if (count _listPrice > 0) then {lnbSetCurSelRow [_listBox,0]} else {lnbSetCurSelRow [_listBox,-1]};
+
+while {alive player && dialog} do {
+ sleep 0.1;
+
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ //--- Command AI.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ _funds = Call GetPlayerFunds;
+
+ _iddx = lnbCurSelRow _listBox;
+ if (_iddx != -1) then {
+ if (_funds > (_listPrice select _iddx)) then {
+ [vehicle player, _iddx, true] Call EASA_Equip;
+ -(_listPrice select _iddx) Call ChangePlayerFunds;
+ hint parseText(Format[localize 'STR_WF_INFO_EASA_Purchase',(_listDesc select _iddx)]);
+ closeDialog 0;
+ } else {
+ hint parseText(Format[localize 'STR_WF_INFO_Funds_Missing',(_listPrice select _iddx) - _funds,_listDesc select _iddx]);
+ };
+ };
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Economy.sqf b/Client/GUI/GUI_Menu_Economy.sqf
new file mode 100644
index 0000000..aa0fac0
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Economy.sqf
@@ -0,0 +1,239 @@
+disableSerialization;
+
+_display = _this select 0;
+_map = _display DisplayCtrl 23002;
+
+_hqDeployed = (sideJoined) Call GetSideHQDeployed;
+if (!_hqDeployed || !paramUseWorkers) then {ctrlEnable [23004, false];ctrlEnable [23006, false]};
+if !(paramUseWorkers) then {ctrlSetText[23005, localize 'STR_WF_Disabled']};
+
+MenuAction = -1;
+
+_maxWorkers = 'WFBE_WORKERS_MAX' Call GetNamespace;
+_workerPrice = 'WFBE_WORKERS_PRICE' Call GetNamespace;
+_incomeSystem = 'WFBE_INCOMESYSTEM' Call GetNamespace;
+_incomeDividision = 'WFBE_INC_DIVIDE_COM' Call GetNamespace;
+_supplySystem = 'WFBE_SUPPLYSYSTEM' Call GetNamespace;
+_aliveWorkers = [];
+_workers = [];
+_lastWorkersUpdate = -10;
+_lastComboUpdate = -30;
+_lastPurchase = -5;
+_income = 0;
+_updateComboWorker = true;
+_hasStarted = true;
+
+_lastUse = 0;
+ctrlEnable [23016,false];
+if (_supplySystem != 0) then {ctrlShow [23016, false]};
+
+if (_incomeSystem in [3,4]) then {
+ sliderSetRange[23010,0,100];
+ _income = Call Compile Format["%1CommanderPercent",sideJoined];
+ sliderSetPosition[23010, _income];
+} else {
+ ctrlEnable [23012, false];
+};
+
+while {alive player && dialog} do {
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ _funds = Call GetPlayerFunds;
+
+ //--- Income System.
+ if (_incomeSystem in [3,4]) then {
+ ctrlSetText[23011, Format["%1%2",_income,"%"]];
+ _currentPercent = Call Compile Format["%1CommanderPercent",sideJoined];
+
+ _income = floor(sliderPosition 23010);
+
+ sliderSetPosition[23010, _income];
+
+ _calInc = (sideJoined) Call GetTownsIncome;
+
+ if (_currentPercent != _income || _hasStarted) then {
+ if (_hasStarted) then {_hasStarted = false};
+
+ _income_players = 0;
+ _income_commander = 0;
+ switch (_incomeSystem) do {
+ case 3: {
+ _income_players = round(_calInc * (((100 - _income)/100)/maxPlayers));
+ _income_commander = round((_calInc * (_income/100)) / _incomeDividision) + _income_players;
+ };
+ case 4: {
+ _income_players = round(_calInc * (100 - _income) / 100);
+ _income_commander = round((_calInc - _income_players)*maxPlayers) + _income_players;
+ };
+ };
+
+ ctrlSetText [23013, localize 'STR_WF_ECONOMY_Income_Sys_Com' + ": $" + str(_income_commander)];
+ ctrlSetText [23014, localize 'STR_WF_ECONOMY_Income_Sys_Ply' + ": $" + str(_income_players)];
+ };
+
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+
+ if (_currentPercent != _income) then {
+ Call Compile Format["%1CommanderPercent = _income; publicVariable '%1CommanderPercent';",sideJoined];
+ };
+ };
+ };
+
+ //--- Workers System.
+ if (paramUseWorkers) then {
+ if (time - _lastComboUpdate > 5) then {
+ _updateComboWorker = true;
+ _lastComboUpdate = time;
+ };
+
+ _workers = Call Compile Format ["WF_%1Workers",sideJoinedText];
+ if (time - _lastWorkersUpdate > 5) then {_aliveWorkers = (_workers) Call GetLiveUnits;_lastWorkersUpdate = time};
+ _hqDeployed = (sideJoined) Call GetSideHQDeployed;
+
+ if (!_hqDeployed || time - _lastPurchase < 3 || count _aliveWorkers >= _maxWorkers || _funds < _workerPrice) then {ctrlEnable [23004, false]} else {ctrlEnable [23004, true]};
+
+ //--- Workers tracker.
+ if (_updateComboWorker) then {
+ _updateComboWorker = false;
+ lbClear 23007;
+
+ for '_i' from 0 to count(_aliveWorkers)-1 do {
+ lbAdd [23007, localize "STR_WF_ECONOMY_Workers" + " " + str(_i+1)];
+ };
+ };
+
+ ctrlSetText [23005, Format ["$%1 (%2/%3)",_workerPrice,count _aliveWorkers,_maxWorkers]];
+ };
+
+ //--- Hire Workers.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+
+ //--- Which index.
+ _index = 0;
+ for '_i' from 0 to count(_workers)-1 do {
+ if (isNull (_workers select _i)) exitWith {_index = _i};
+ };
+
+ if (_index == 0 && count(_workers) > 0) then {_index = count _workers};
+
+ if (count _aliveWorkers <= _maxWorkers && _hqDeployed) then {
+ -(_workerPrice) Call ChangePlayerFunds;
+
+ WFBE_RequestWorker = ['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]];
+ publicVariable 'WFBE_RequestWorker';
+ if (isHostedServer) then {['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]] Spawn HandleSPVF};
+
+ _workers set [_index, WF_Logic];
+ Call Compile Format ["WF_%1Workers = _workers; publicVariable 'WF_%1Workers';",sideJoinedText];
+
+ _lastPurchase = time;
+ _lastWorkersUpdate = -10;
+ _updateComboWorker = true;
+ };
+ };
+
+ //--- Disband Worker.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+
+ _value = lbCurSel 23007;
+
+ if (_value != -1) then {
+ (_aliveWorkers select _value) setDammage 1;
+ _lastWorkersUpdate = -10;
+ _updateComboWorker = true;
+ };
+ };
+
+ //--- ST Handler.
+ if (_supplySystem == 0) then {
+ _isCommander = false;
+ if (!isNull(commanderTeam)) then {if (commanderTeam == group player) then {_isCommander = true}};
+ ctrlEnable [23016,if (time - _lastUse > 5 && _isCommander) then {true} else {false}];
+ };
+
+ //--- Respawn Supply Trucks.
+ if (MenuAction == 4) then {
+ MenuAction = -1;
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]] Spawn HandleSPVF};
+ _lastUse = time;
+ };
+
+ //--- Minimap update.
+ if (MenuAction == 100) then {
+ MenuAction = -1;
+ _value = lbCurSel 23007;
+
+ if (_value != -1) then {
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [1,.175,getPos(_aliveWorkers select _value)];
+ ctrlMapAnimCommit _map;
+ };
+ };
+
+ //added-MrNiceGuy
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ //--- Sell Building.
+ if (MenuAction == 105) then {
+ MenuAction = -1;
+ _position = _map posScreenToWorld[mouseX,mouseY];
+ _structures = (sideJoinedText) Call GetSideStructures;
+ _existingStruct = [_position,_structures] Call SortByDistance;
+ if (count _existingStruct > 0) then {
+ _closest = _existingStruct select 0;
+ //--- 100 meters close only.
+ if (_closest distance _position < 100 && isNil {_closest getVariable "WFBE_SOLD"}) then {
+ //--- Spawn a sell thread.
+ (_closest) Spawn {
+ Private ["_closest","_delay","_id","_supplyB","_type"];
+ _closest = _this;
+ _closest setVariable ["WFBE_SOLD", true];
+ _delay = 'WFBE_BUILDINGSELLDELAY' Call GetNamespace;
+ _type = typeOf _closest;
+
+ //--- Inform the side (before).
+ WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSell',_type,_delay]];
+ publicVariable 'WFBE_LocalizeMessage';
+ ['StructureSell',_type,_delay] Spawn CLTFNCLocalizeMessage;
+
+ sleep _delay;
+
+ if !(alive _closest) exitWith {};
+
+ _id = (Format ["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace) find _type;
+
+ //--- TODO: Change the find system with a getvar system.
+ if (_id > 0) then {
+ _supplyB = (Format ["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace) select _id;
+ _supplyB = round((_supplyB * ('WFBE_STRUCTURESELLPERCENT' Call GetNamespace)) / 100);
+
+ if !(paramMoneyOnly) then {[sideJoined, _supplyB] Call ChangeSideSupply} else {(_supplyB) Call ChangePlayerFunds};
+ };
+
+ //--- Inform the side.
+ WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSold',_type]];
+ publicVariable 'WFBE_LocalizeMessage';
+ ['StructureSold',_type] Spawn CLTFNCLocalizeMessage;
+ if (paramUseWorkers) then {_closest setVariable ["sold",true,true]};
+ _closest setDammage 1;
+ };
+ };
+ };
+ };
+ };
+
+ sleep 0.1;
+
+ //--- Back Button.
+ if (MenuAction == 5) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Respawn.sqf b/Client/GUI/GUI_Menu_Respawn.sqf
new file mode 100644
index 0000000..4425fab
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Respawn.sqf
@@ -0,0 +1,161 @@
+disableSerialization;
+
+MenuAction = -1;
+mouseButtonUp = -1;
+_display = _this select 0;
+_map = _display displayCtrl 15001;
+
+_spawn = objNull;
+_availableSpawn = [];
+_markers = [];
+_markerIndex = 0;
+_ta = "";
+_lastSpawnUpdate = 0;
+
+//--- Prevent AI from moving to the temp spawn.
+{_x disableAI "MOVE"} forEach (units clientTeam);
+
+//--- Wait until the player respawned.
+waitUntil {alive player};
+
+//--- Position the player at the temp location during his respawn.
+player setPos ([getMarkerPos Format["%1TempRespawnMarker",sideJoinedText],1,10] Call GetRandomPosition);
+if (leader(group player) != player) then {(group player) selectLeader player};
+
+//--- Call the pre respawn routine.
+(player) Call PreRespawnHandler;
+
+//--- Spawn a countdown thread.
+respawnDone = false;
+_handleTimer = [] Spawn {
+ if (isNil 'respawnStatus') then {respawnStatus = 'WFBE_RESPAWNDELAY' Call GetNamespace};
+ while {respawnStatus >= 0} do {
+ sleep 1;
+ respawnStatus = respawnStatus - 1;
+ };
+ respawnDone = true;
+};
+
+//--- Run the main respawn thread.
+while {!respawnDone} do {
+ //--- Exit the thread if the client died.
+ if !(alive player) exitWith {};
+
+ //--- Loadout Selection.
+ ctrlSetText [15004, if (WFBE_RespawnDefaultGear) then {localize "STR_WF_RESPAWN_GearDefault"} else {localize "STR_WF_RESPAWN_GearCurrent"}]; //changed-MrNiceGuy
+
+ //--- Preloading Status.
+ ctrlSetText [15005, if (WFBE_EnablePreload) then {localize "STR_WF_RESPAWN_PreloadYes"} else {localize "STR_WF_RESPAWN_PreloadNo"}]; //changed-MrNiceGuy
+
+ //--- Update the respawn info.
+ if (time - _lastSpawnUpdate > 2) then {
+ _lastSpawnUpdate = time;
+ _lastAvailableSpawn = _availableSpawn;
+ _availableSpawn = [sideJoined,deathLocation] Call GetRespawnAvailable;
+
+ //--- First launch.
+ if (isNull _spawn) then {
+ _spawn = _availableSpawn select 0;
+ _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim;
+ respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo;
+ };
+
+ //--- Properly update the client's map - Update removal.
+ _found = false;
+ {
+ if !(_x in _availableSpawn) then {
+ _mid = _x getVariable 'WFBE_IDRMarker';
+ _markers = _markers - [_mid];
+ deleteMarkerLocal _mid;
+ _x setVariable ['WFBE_IDRMarker',nil];
+ if (_x == _spawn && !_found) then {
+ _found = true;
+ _spawn = ([_x, _availableSpawn] Call SortByDistance) select 0;
+ terminate _ta;
+ deleteMarkerLocal "TempAnim";
+ _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim;
+ respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo;
+ };
+ };
+ } forEach _lastAvailableSpawn;
+
+ //--- Properly update the client's map - Update add.
+ {
+ if !(_x in _lastAvailableSpawn) then {
+ _markerName = Format ["respawnMarker%1",_markerIndex];
+ _markers = _markers + [_markerName];
+ createMarkerLocal [_markerName,getPos _x];
+ _markerName setMarkerTypeLocal "Select";
+ _markerName setMarkerColorLocal "ColorYellow";
+ _markerName setMarkerSizeLocal [1,1];
+ _markerIndex = _markerIndex + 1;
+ _x setVariable ['WFBE_IDRMarker',_markerName];
+ };
+ } forEach _availableSpawn;
+ };
+
+ //--- Update the respawn timer.
+ ctrlSetText [15003,Format [localize "STR_WF_RESPAWN_Status",respawnStatus,respawnName]];
+
+ //--- The client has clicked on the map.
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ if (count _availableSpawn > 1) then {
+ _position = _map PosScreenToWorld[mouseX,mouseY];
+ _sorted = [_position,_availableSpawn] Call SortByDistance;
+ if ((_sorted select 0) distance _position < 500) then {
+ _spawn = _sorted select 0;
+ activeAnimMarker = false;
+ terminate _ta;
+ deleteMarkerLocal "TempAnim";
+ _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim;
+ respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo;
+ };
+ };
+ };
+
+ sleep 0.1;
+};
+
+//--- If the spawn is null, we use the HQ.
+if (isNull _spawn) then {
+ _hq = (sideJoinedText) Call GetSideHQ;
+ _spawn = _hq;
+};
+
+//--- Pre-render.
+if (WFBE_EnablePreload) then {
+ ctrlSetText [15003,localize 'STR_WF_RESPAWN_Preload'];
+ waitUntil{preloadCamera (getPos _spawn) || !(alive player)};
+};
+
+//--- Execute on respawn code only if the player's alive.
+if (alive player) then {
+ [player,_spawn] Call OnRespawnHandler;
+};
+
+//--- Terminate the threads & cleaning.
+{deleteMarkerLocal _x} forEach _markers;
+{_x setVariable ['WFBE_IDRMarker',nil]} forEach _availableSpawn;
+if !(isNil "DeathCamera") then {
+ DeathCamera cameraEffect["TERMINATE","BACK"];
+ camDestroy DeathCamera;
+};
+
+"dynamicBlur" ppEffectEnable false;
+"colorCorrections" ppEffectEnable false;
+[currentFX] Spawn FX;
+terminate _ta;
+if !(scriptDone _handleTimer) then {terminate _handleTimer};
+deleteMarkerLocal "TempAnim";
+activeAnimMarker = false;
+playerDead = false;
+respawnDone = nil;
+respawnName = nil;
+respawnStatus = nil;
+closeDialog 0;
+
+//--- Enable AI movement again.
+{_x enableAI "MOVE"} forEach (units clientTeam);
+
+hint (localize "STR_WF_INFO_RespawnInfo"); \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Service.sqf b/Client/GUI/GUI_Menu_Service.sqf
new file mode 100644
index 0000000..5917c35
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Service.sqf
@@ -0,0 +1,254 @@
+MenuAction = -1;
+
+_vehi = [group player,false] Call GetTeamVehicles;
+_alives = (units group player) Call GetLiveUnits;
+{if (vehicle _x == _x) then {_vehi = _vehi + [_x]}} forEach _alives;
+_lastUse = 0;
+_typeRepair = Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace;
+_sheal = 'WFBE_SUPPORTHEALTIME' Call GetNamespace;
+_srearm = 'WFBE_SUPPORTREARMTIME' Call GetNamespace;
+_srefuel = 'WFBE_SUPPORTREFUELTIME' Call GetNamespace;
+_srepair = 'WFBE_SUPPORTREPAIRTIME' Call GetNamespace;
+
+_healPrice = 0;
+_repairPrice = 0;
+_refuelPrice = 0;
+_rearmPrice = 0;
+_lastVeh = objNull;
+_lastDmg = 0;
+_lastFue = 0;
+
+_buildings = (sideJoinedText) Call GetSideStructures;
+
+//--- Service Point.
+_csp = objNull;
+_sp = [sideJoined, Format ["WFBE_%1SERVICEPOINTTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;
+if (count _sp > 0) then {
+ _sorted = [player,_sp] Call SortByDistance;
+ _csp = _sorted select 0;
+};
+
+if (paramEASA) then {
+ _enable = false;
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ _easaLevel = _currentUpgrades select 15;
+ if (!(isNull _csp) && _easaLevel > 0) then {
+ if (player distance _csp < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then {
+ if (typeOf(vehicle player) in ('WFBE_EASA_Vehicles' Call GetNamespace)) then {
+ if (driver (vehicle player) == player) then {_enable = true};
+ };
+ };
+ };
+ ctrlEnable [20010,_enable];
+} else {
+ ctrlEnable [20010,false];
+};
+
+_effective = [];
+_nearSupport = [];
+_spType = Call Compile Format ["%1SP",sideJoinedText];
+_i = 0;
+{
+ _closestSP = objNull;
+ _add = false;
+
+ _nearSupport set [_i, []];
+
+ //--- Service Point.
+ if (count _sp > 0) then {
+ _sorted = [_x,_sp] Call SortByDistance;
+ _closestSP = _sorted select 0;
+ if !(isNull _closestSP) then {
+ if (_x distance _closestSP < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then {
+ _add = true;
+ _nearSupport set [_i,(_nearSupport select _i) + [_closestSP]];
+ };
+ };
+ };
+
+ //--- Depots.
+ _nObjects = nearestObjects [_x, WFDEPOT,('WFBE_SUPPORTRANGE' Call GetNamespace)];
+ _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};
+ if !(isNull _nObject) then {
+ _sideID = _nObject getVariable "sideID";
+ if !(isNil "_sideID") then {
+ if (_sideID == sideID) then {
+ _add = true;
+ _nearSupport set [_i,(_nearSupport select _i) + [_nObject]];
+ };
+ };
+ };
+
+ //--- Repairs Trucks.
+ _checks = (getPos _x) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace];
+ if (count _checks > 0) then {
+ _add = true;
+ _nearSupport set [_i,(_nearSupport select _i) + _checks];
+ };
+
+ //--- Add the vehicle ?
+ if (_add) then {
+ _effective = _effective + [_x];
+ _desc = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _finalNumber = (_x) Call GetAIDigit;
+ _isInVehicle = "";
+ if (_x != vehicle _x) then {
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ _isInVehicle = " [" + _descVehi + "] ";
+ };
+ _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle;
+ lbAdd[20002,_txt];
+
+ _i = _i + 1;
+ };
+} forEach _vehi;
+
+_checks = (getPos player) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace];
+if (count _checks > 0) then {
+ _repair = _checks select 0;
+ _vehi = ((getPos _repair) nearEntities[["Car","Motorcycle","Tank","Air","Ship","StaticWeapon"],100]) - [_repair];
+ {
+ if !(_x in _effective) then {
+ _effective = _effective + [_x];
+ _nearSupport set [_i,[_repair]];
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ lbAdd[20002,_descVehi];
+
+ _i = _i + 1;
+ };
+ } forEach _vehi;
+};
+
+if (count _effective > 0) then {lbSetCurSel[20002,0]};
+
+while {true} do {
+ sleep 0.1;
+
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+ _curSel = lbCurSel(20002);
+
+ if (_curSel != -1) then {
+ _veh = (vehicle (_effective select _curSel));
+ _funds = Call GetPlayerFunds;
+
+ if (_veh isKindOf "Man") then {
+ {ctrlEnable [_x,false]} forEach [20003,20004,20005];
+ _enabled = if (_funds >= _healPrice) then {true} else {false};
+ ctrlEnable [20008,_enabled];
+ //--- Healing.
+ _healPrice = round((getDammage _veh)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace));
+ ctrlSetText [20011,"$0"];
+ ctrlSetText [20012,"$0"];
+ ctrlSetText [20013,"$0"];
+ ctrlSetText [20014,"$"+str(_healPrice)];
+ } else {
+ //--- Prevent on the air re-supply.
+ _canBeUsed = if ((getPos _veh) select 2 <= 2 && speed _veh <= 20) then {true} else {false};
+ _enabled = if (_canBeUsed && _funds >= _rearmPrice) then {true} else {false};
+ ctrlEnable [20003,_enabled];
+ _enabled = if (_canBeUsed && _funds >= _repairPrice) then {true} else {false};
+ ctrlEnable [20004,_enabled];
+ _enabled = if (_canBeUsed && _funds >= _refuelPrice) then {true} else {false};
+ ctrlEnable [20005,_enabled];
+ _enabled = if (_canBeUsed && _funds >= _healPrice) then {true} else {false};
+ ctrlEnable [20008,_enabled];
+ //--- Healing.
+ _healPrice = 0;
+ {
+ if (alive _x) then {_healPrice = _healPrice + round((getDammage _x)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace))};
+ } forEach (crew _veh);
+ ctrlSetText [20014,"$"+str(_healPrice)];
+ //--- Repair.
+ if (_veh != _lastVeh || getDammage _veh != _lastDmg) then {
+ _type = typeOf _veh;
+ _lastDmg = getDammage _veh;
+ _get = _type Call GetNamespace;
+ if !(isNil '_get') then {
+ _repairPrice = round((getDammage _veh)*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREPAIRPRICE' Call GetNamespace)));
+ } else {
+ _repairPrice = 500;
+ };
+ };
+ ctrlSetText [20012,"$"+str(_repairPrice)];
+ //--- Rearm.
+ if (_veh != _lastVeh) then {
+ _type = typeOf _veh;
+ _get = _type Call GetNamespace;
+ if !(isNil '_get') then {
+ _rearmPrice = round((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREARMPRICE' Call GetNamespace));
+ } else {
+ _rearmPrice = 500;
+ };
+ };
+ ctrlSetText [20011,"$"+str(_rearmPrice)];
+ //--- Refuel.
+ if (_veh != _lastVeh || fuel _veh != _lastFue) then {
+ _type = typeOf _veh;
+ _lastFue = fuel _veh;
+ _get = _type Call GetNamespace;
+ if !(isNil '_get') then {
+ _fuel = ((fuel _veh) -1) * -1;
+ _refuelPrice = round(_fuel*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREFUELPRICE' Call GetNamespace)));
+ } else {
+ _refuelPrice = 200;
+ };
+ };
+ ctrlSetText [20013,"$"+str(_refuelPrice)];
+ };
+
+ _lastVeh = _veh;
+
+ //--- Rearm.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ -_rearmPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Rearm thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRearm;
+ };
+
+ //--- Repair.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ -_repairPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Repair thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRepair;
+ };
+
+ //--- Refuel.
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ -_refuelPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Refuel thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRefuel;
+ };
+
+ //--- Heal.
+ if (MenuAction == 5) then {
+ MenuAction = -1;
+ -_healPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Healing thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportHeal;
+ };
+ } else {
+ {ctrlEnable[_x,false]} forEach [20003,20004,20005,20008];
+ };
+
+ //--- EASA. TBD: Add dialog;
+ if (MenuAction == 7) then {
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscMenu_EASA";
+ };
+
+ //--- Back Button.
+ if (MenuAction == 8) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+};
diff --git a/Client/GUI/GUI_Menu_Tactical.sqf b/Client/GUI/GUI_Menu_Tactical.sqf
new file mode 100644
index 0000000..3aea39f
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Tactical.sqf
@@ -0,0 +1,659 @@
+disableSerialization;
+
+_display = _this select 0;
+_lastRange = artyRange;
+_lastUpdate = 0;
+_listBox = 17019;
+
+sliderSetRange[17005,10,'WFBE_MAXARTILLERYAREA' Call GetNamespace];
+sliderSetPosition[17005,artyRange];
+
+ctrlSetText [17025,localize "STR_WF_TACTICAL_ArtilleryOverview" + ":"];
+
+_markers = [];
+_FTLocations = [];
+_checks = [];
+_fireTime = 0;
+_status = 0;
+_canFT = false;
+_forceReload = true;
+_ft = 'WFBE_FASTTRAVEL' Call GetNamespace;
+_ftr = 'WFBE_FASTTRAVELRANGE' Call GetNamespace;
+_startPoint = objNull;
+
+_marker = "artilleryMarker";
+createMarkerLocal [_marker,artyPos];
+_marker setMarkerTypeLocal "mil_destroy";
+_marker setMarkerColorLocal "ColorRed";
+_marker setMarkerSizeLocal [1,1];
+
+_area = "artilleryAreaMarker";
+createMarkerLocal [_area,artyPos];
+_area setMarkerShapeLocal "Ellipse";
+_area setMarkerColorLocal "ColorRed";
+_area setMarkerSizeLocal [artyRange,artyRange];
+
+_map = _display DisplayCtrl 17002;
+_listboxControl = _display DisplayCtrl _listBox;
+
+_pard = 'WFBE_PARADELAY' Call GetNamespace;
+{lbAdd[17008,_x]} forEach (Format ["WFBE_%1_ARTILLERY_DESC",sideJoinedText] Call GetNamespace);
+lbSetCurSel[17008,0];
+
+_IDCS = [17005,17006,17007,17008];
+if !(paramArty) then {{ctrlEnable [_x,false]} forEach _IDCS};
+
+{ctrlEnable [_x, false]} forEach [17010,17011,17012,17013,17014,17015,17017,17018,17020];
+
+MenuAction = -1;
+mouseButtonUp = -1;
+_currentValue = -1;
+_currentFee = -1;
+_currentSpecial = "";
+_currentFee = -1;
+
+//--- Support List.
+_lastSel = -1;
+_addToList = [localize 'STR_WF_TACTICAL_FastTravel',localize 'STR_WF_ICBM',localize 'STR_WF_TACTICAL_ParadropAmmo',localize 'STR_WF_TACTICAL_ParadropVehicle',localize 'STR_WF_TACTICAL_Paratroop',localize 'STR_WF_TACTICAL_UnitCam',localize 'STR_WF_TACTICAL_UAV',localize 'STR_WF_TACTICAL_UAVDestroy',localize 'STR_WF_TACTICAL_UAVRemoteControl'];
+_addToListID = ["Fast_Travel","ICBM","Paradrop_Ammo","Paradrop_Vehicle","Paratroopers","Units_Camera","UAV","UAV_Destroy","UAV_Remote_Control"];
+_addToListFee = [0,150000,9500,3500,8500,0,12500,0,0];
+_addToListInterval = [0,1000,800,600,900,0,0,0,0];
+
+for '_i' from 0 to count(_addToList)-1 do {
+ lbAdd [_listBox,_addToList select _i];
+ lbSetValue [_listBox, _i, _i];
+};
+
+lbSort _listboxControl;
+
+//--- Artillery Mode.
+_mode = 'WFBE_V_ARTILLERYMINMAP' Call GetNamespace;
+if (isNil '_mode') then {_mode = 2;['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace};
+_trackingArray = [];
+_trackingArrayID = [];
+_lastArtyUpdate = -60;
+_minRange = 100;
+_maxRange = 200;
+_requestMarkerTransition = false;
+_requestRangedList = true;
+_startLoad = true;
+
+//--- Startup coloration.
+with uinamespace do {
+ currentBEDialog = _display;
+ switch (_mode) do {
+ case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]};
+ case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]};
+ case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]};
+ };
+};
+
+lbSetCurSel[_listbox, 0];
+
+if (!paramArty) then {
+ (_display displayCtrl 17016) ctrlSetStructuredText (parseText Format['<t align="right" color="#FF4747">%1</t>',localize 'STR_WF_Disabled']);
+};
+
+_textAnimHandler = [] spawn {};
+
+while {alive player && dialog} do {
+ if (side player != sideJoined) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers;closeDialog 0};
+ if (!dialog) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers};
+
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+
+ if (_ft > 0) then {
+ //--- TODO: Travel fee, mod parameter > FT free or pay, do a clt fct.
+ _currentLevel = _currentUpgrades select 12;
+ if (time - _lastUpdate > 15 && _currentLevel > 0) then {
+ {deleteMarkerLocal _x} forEach _markers;
+ _markers = [];
+ _FTLocations = [];
+ _canFT = false;
+ _startPoint = objNull;
+ _lastUpdate = time;
+ _base = (sideJoinedText) Call GetSideHQ;
+ _isDeployed = (sideJoinedText) Call GetSideHQDeployed;
+ if (player distance _base < _ftr && alive _base && vehicle player != _base && _isDeployed) then {
+ _canFT = true;
+ _startPoint = _base;
+ } else {
+ _sorted = [player,towns] Call SortByDistance;
+ _closest = _sorted select 0;
+ _sideID = _closest getVariable "sideID";
+ _camps = [_closest,sideJoined] Call GetFriendlyCamps;
+ _allCamps = _closest getVariable "camps";
+ if (_sideID == sideID && player distance _closest < _ftr && (count _camps == count _allCamps)) then {_canFT = true;_startPoint = _closest} else {
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;
+ if (count _checks > 0) then {
+ _sorted = [player,_checks] Call SortByDistance;
+ _closest = _sorted select 0;
+ if (player distance _closest < _ftr) then {
+ _canFT = true;
+ _closest = _sorted select 0;
+ _startPoint = _closest;
+ };
+ };
+ };
+ };
+ if (!canMove (vehicle player)) then {_canFT = false};
+ if (_canFT) then {
+ _buildings = (sideJoinedText) Call GetSideStructures;
+ _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;
+ _locations = towns + _checks;
+ if (alive _base && _isDeployed) then {_locations = _locations + [_base]};
+ _i = 0;
+ _fee = 0;
+ _funds = if (_ft == 2) then {Call GetPlayerFunds} else {0};
+ {
+ if (_x distance player <= ('WFBE_FASTTRAVELMAXRANGE' Call GetNamespace) && _x distance player > _ftr) then {
+ _skip = false;
+ if (_x in towns) then {
+ _sideID = _x getVariable "sideID";
+ _camps = [_x,sideJoined] Call GetFriendlyCamps;
+ _allCamps = _x getVariable "camps";
+ if (_sideID != sideID || (count _camps != count _allCamps)) then {_skip = true};
+ if (_ft == 2) then {
+ _fee = round(((_x distance player)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace));
+ if (_funds < _fee) then {_skip = true};
+ };
+ };
+ if !(_skip) then {
+ _FTLocations = _FTLocations + [_x];
+ _markerName = Format ["FTMarker%1",_i];
+ _markers = _markers + [_markerName];
+ createMarkerLocal [_markerName,getPos _x];
+ _markerName setMarkerTypeLocal "mil_circle";
+ _markerName setMarkerColorLocal "ColorYellow";
+ _markerName setMarkerSizeLocal [1,1];
+ //--- Fee, Cheap marker stuff, TBD: Add prompt or something.
+ if (_ft == 2) then {
+ _markerName = Format ["FTMarker%1%1",_i];
+ _markers = _markers + [_markerName];
+ createMarkerLocal [_markerName,[(getPos _x select 0)-5,(getPos _x select 1)+75]];
+ _markerName setMarkerTypeLocal "mil_circle";
+ _markerName setMarkerColorLocal "ColorYellow";
+ _markerName setMarkerSizeLocal [0,0];
+ _markerName setMarkerTextLocal Format ["$%1",_fee];
+ };
+ _i = _i + 1;
+ };
+ };
+ } forEach _locations;
+ };
+ };
+ };
+
+ _currentSel = lbCurSel(_listBox);
+
+ //--- Special changed or a reload is requested.
+ if (_currentSel != _lastSel || _forceReload) then {
+ _currentValue = lbValue[_listBox, _currentSel];
+
+ _currentSpecial = _addToListID select _currentValue;
+ _currentFee = _addToListFee select _currentValue;
+ _currentInterval = _addToListInterval select _currentValue;
+
+ _forceReload = false;
+ _controlEnable = false;
+
+ _funds = Call GetPlayerFunds;
+
+ //ctrlSetText[17021,Format ["%1: $%2",localize 'STR_WF_Price',_currentFee]]; //---old
+ ctrlSetText[17021,Format ["$%1",_currentFee]]; //---added-MrNiceGuy
+
+ //--- Enabled or disabled?
+ switch (_currentSpecial) do {
+ case "Fast_Travel": {
+ if (_ft > 0) then {
+ _currentLevel = _currentUpgrades select 12;
+ _controlEnable = if (count _FTLocations > 0 && _currentLevel > 0) then {true} else {false};
+ };
+ };
+ case "ICBM": {
+ if (paramICBM) then {
+ _commander = false;
+ if (!isNull(commanderTeam)) then {
+ if (commanderTeam == group player) then {_commander = true};
+ };
+ _currentLevel = _currentUpgrades select 11;
+ _controlEnable = if (_currentLevel > 0 && _commander && _funds >= _currentFee) then {true} else {false};
+ };
+ };
+ case "Paratroopers": {
+ _currentLevel = _currentUpgrades select 4;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastParaCall > _currentInterval) then {true} else {false};
+ };
+ case "Paradrop_Ammo": {
+ _currentLevel = _currentUpgrades select 16;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false};
+ };
+ case "Paradrop_Vehicle": {
+ _currentLevel = _currentUpgrades select 16;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false};
+ };
+ case "UAV": {
+ _currentLevel = _currentUpgrades select 5;
+ _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && !(alive playerUAV)) then {true} else {false};
+ };
+ case "UAV_Destroy": {
+ _controlEnable = if (alive playerUAV) then {true} else {false};
+ };
+ case "UAV_Remote_Control": {
+ _controlEnable = if (alive playerUAV) then {true} else {false};
+ };
+ case "Units_Camera": {
+ _controlEnable = commandInRange;
+ };
+ };
+
+ ctrlEnable[17020, _controlEnable];
+ };
+
+ //--- Action triggered.
+ if (MenuAction == 20) then {
+ MenuAction = -1;
+
+ //--- Output.
+ switch (_currentSpecial) do {
+ case "Fast_Travel": {
+ MenuAction = 7;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim;
+ };
+ case "ICBM": {
+ MenuAction = 8;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim;
+ };
+ case "Paratroopers": {
+ MenuAction = 3;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim;
+ };
+ case "Paradrop_Ammo": {
+ MenuAction = 10;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim;
+ };
+ case "Paradrop_Vehicle": {
+ MenuAction = 9;
+
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim;
+ };
+ case "UAV": {
+ closeDialog 0;
+ ExecVM "Client\Module\UAV\uav.sqf";
+ };
+ case "UAV_Destroy": {
+ if !(isNull playerUAV) then {
+ {_x setDammage 1} forEach (crew playerUAV);
+ playerUAV setDammage 1;
+ playerUAV = objNull;
+ };
+ };
+ case "UAV_Remote_Control": {
+ closeDialog 0;
+ ExecVM "Client\Module\UAV\uav.sqf";
+ };
+ case "Units_Camera": {
+ closeDialog 0;
+ createDialog "RscMenu_UnitCamera";
+ };
+ };
+
+ _forceReload = true;
+ };
+
+ artyRange = floor (sliderPosition 17005);
+ if (_lastRange != artyRange) then {_area setMarkerSizeLocal [artyRange,artyRange];};
+
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ //--- Set Artillery Marker on map.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ artyPos = _map posScreenToWorld[mouseX,mouseY];
+ _marker setMarkerPosLocal artyPos;
+ _area setMarkerPosLocal artyPos;
+ _requestRangedList = true;
+ };
+ //--- Paratroops.
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ _callPos = _map posScreenToWorld[mouseX,mouseY];
+ if (!surfaceIsWater _callPos) then {
+ lastParaCall = time;
+ -(_currentFee) Call ChangePlayerFunds;
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF};
+ hint (localize "STR_WF_INFO_Paratroop_Info");
+ };
+ };
+ //--- Fast Travel.
+ if (MenuAction == 7) then {
+ MenuAction = -1;
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ _sorted = [_callPos,_FTLocations] Call SortByDistance;
+ if (_callPos distance (_sorted select 0) < 500) then {
+ closeDialog 0;
+ deleteMarkerLocal _marker;
+ deleteMarkerLocal _area;
+
+ _destination = _sorted select 0;
+
+ if (_ft == 2) then {
+ _fee = round(((player distance _destination)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace));
+ -(_fee) Call ChangePlayerFunds;
+ };
+
+ _travelingWith = [];
+ {if (_x distance _startPoint < _ftr && !(_x in _travelingWith) && canMove _x && !(vehicle _x isKindOf "StaticWeapon") && !stopped _x && !((currentCommand _x) in ["WAIT","STOP"])) then {_travelingWith = _travelingWith + [vehicle _x]}} forEach units (group player);
+
+ ForceMap true;
+ _compass = shownCompass;
+ _GPS = shownGPS;
+ _pad = shownPad;
+ _radio = shownRadio;
+ _watch = shownWatch;
+
+ showCompass false;
+ showGPS false;
+ showPad false;
+ showRadio false;
+ showWatch false;
+
+ mapAnimClear;
+ mapAnimCommit;
+
+ _locationPosition = getPos _destination;
+ _camera = "camera" camCreate _locationPosition;
+ _camera camSetDir 0;
+ _camera camSetFov 1;
+ _camera cameraEffect["Internal","TOP"];
+
+ _camera camSetTarget _locationPosition;
+ _camera camSetPos [_locationPosition select 0,(_locationPosition select 1) + 2,100];
+ _camera camCommit 0;
+
+ mapAnimAdd [0,0.05,GetPos _startPoint];
+ mapAnimCommit;
+
+ _delay = ((_startPoint distance _destination) / 50) * ('WFBE_FASTTRAVELTIMECOEF' Call GetNamespace);
+ mapAnimAdd [_delay,.18,getPos _destination];
+ mapAnimCommit;
+
+ waitUntil {mapAnimDone || !alive player};
+ _skip = false;
+ if (!alive player) then {_skip = true};
+ if (!_skip) then {
+ {[_x,_locationPosition,120] Call PlaceSafe} forEach _travelingWith;
+ };
+ sleep 1;
+
+ ForceMap false;
+ showCompass _compass;
+ showGPS _GPS;
+ showPad _pad;
+ showRadio _radio;
+ showWatch _watch;
+
+ _camera cameraEffect["TERMINATE","BACK"];
+ camDestroy _camera;
+ };
+ };
+ //--- ICBM Strike.
+ if (MenuAction == 8) then {
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ MenuAction = -1;
+ -_currentFee Call ChangePlayerFunds;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ _obj = "HeliHEmpty" createVehicle _callPos;
+ _nukeMarker = createMarkerLocal ["icbmstrike", position _obj];
+ _nukeMarker setMarkerTypeLocal "mil_warning";
+ _nukeMarker setMarkerTextLocal "ICBM";
+ _nukeMarker setMarkerColorLocal "ColorRed";
+ [_obj,_nukeMarker] Spawn NukeIncomming;
+ };
+ //--- Vehicle Paradrop.
+ if (MenuAction == 9) then {
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ MenuAction = -1;
+ lastSupplyCall = time;
+ -_currentFee Call ChangePlayerFunds;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF};
+ };
+ //--- Ammo Paradrop.
+ if (MenuAction == 10) then {
+ _forceReload = true;
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ [17022] Call SetControlFadeAnimStop;
+ MenuAction = -1;
+ lastSupplyCall = time;
+ -_currentFee Call ChangePlayerFunds;
+ _callPos = _map PosScreenToWorld[mouseX,mouseY];
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF};
+ };
+ };
+
+ //--- Update the Artillery Status.
+ if (paramArty) then {
+ _fireTime = (Format["WFBE_FIREMISSIONTIMEOUT%1",(_currentUpgrades select 10)] Call GetNamespace);
+ _status = round(_fireTime - (time - fireMissionTime));
+ _txt = if (time - fireMissionTime > _fireTime) then {Format['<t align="left" color="#73FF47">%1</t>',localize 'STR_WF_TACTICAL_Available']} else {Format ['<t align="left" color="#4782FF">%1 %2</t>',_status,localize 'STR_WF_Seconds']};
+ (_display displayCtrl 17016) ctrlSetStructuredText (parseText _txt);
+ _enable = if (_status > 0) then {false} else {true};
+ ctrlEnable [17007,_enable];
+ };
+
+ //--- Request Fire Mission.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ _units = [Group player,false,lbCurSel(17008),sideJoinedText] Call GetTeamArtillery;
+ if (Count _units > 0) then {
+ fireMissionTime = time;
+ [GetMarkerPos "artilleryMarker",lbCurSel(17008)] Spawn RequestFireMission;
+ } else {
+ hint (localize "STR_WF_INFO_NoArty");
+ };
+ };
+
+ //--- Arty Combo Change or Script init.
+ if (MenuAction == 200 || _startLoad) then {
+ MenuAction = -1;
+
+ _index = lbCurSel(17008);
+ _minRange = (Format ["WFBE_%1_ARTILLERY_MINRANGES",sideJoined] Call GetNamespace) select _index;
+ _maxRange = (Format ["WFBE_%1_ARTILLERY_MAXRANGES",sideJoined] Call GetNamespace) select _index;
+
+ _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery;
+
+ _requestMarkerTransition = true;
+ _requestRangedList = true;
+ _startLoad = false;
+ };
+
+ //--- Focus on an artillery cannon.
+ if (MenuAction == 60) then {
+ MenuAction = -1;
+
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [1,.475,getPos(_trackingArray select (lnbCurSelRow 17024))];
+ ctrlMapAnimCommit _map;
+ };
+
+ //--- Flush on change.
+ if (_requestMarkerTransition) then {
+ _requestMarkerTransition = false;
+
+ {
+ _track = (_x select 0);
+ _vehicle = (_x select 1);
+
+ _vehicle setVariable ['WFBE_A_Tracked', nil];
+ deleteMarkerLocal Format ["WFBE_A_Large%1",_track];
+ deleteMarkerLocal Format ["WFBE_A_Small%1",_track];
+ } forEach _trackingArrayID;
+ _trackingArrayID = [];
+ };
+
+ //--- Artillery List.
+ if (paramArty && (_requestRangedList || time - _lastArtyUpdate > 3)) then {
+ _requestRangedList = false;
+
+ //--- No need to update the list all the time.
+ if (time - _lastArtyUpdate > 5) then {
+ _lastArtyUpdate = time;
+ _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery;
+ };
+
+ //--- Clear & Fill;
+ lnbClear 17024;
+ _i = 0;
+ {
+ _distance = _x distance (getMarkerPos _marker);
+ _color = [0, 0.875, 0, 0.8];
+ _text = localize 'STR_WF_TACTICAL_ArtilleryInRange'; //---changed-MrNiceGuy //"In Range";
+ if (_distance > _maxRange) then {_color = [0.875, 0, 0, 0.8];_text = localize 'STR_WF_TACTICAL_ArtilleryOutOfRange'}; //---changed-MrNiceGuy //"Out of Range"};
+ if (_distance <= _minRange) then {_color = [0.875, 0.5, 0, 0.8];_text = localize 'STR_WF_TACTICAL_ArtilleryRangeTooClose'}; //---changed-MrNiceGuy //"Too close"};
+ lnbAddRow [17024,[[typeOf _x, 'displayName'] Call GetConfigInfo,_text]];
+ lnbSetPicture [17024,[_i,0],[typeOf _x, 'picture'] Call GetConfigInfo];
+
+ lnbSetColor [17024,[_i,0],_color];
+ lnbSetColor [17024,[_i,1],_color];
+
+ _i = _i + 1;
+ } forEach _trackingArray;
+ };
+
+ //--- Artillery map toggle.
+ if (MenuAction == 40) then {
+ MenuAction = -1;
+ if (_mode == -1) then {_mode = 0};
+ _mode = if (_mode == 2) then {0} else {_mode + 1};
+ with uinamespace do {
+ switch (_mode) do {
+ case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]};
+ case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]};
+ case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]};
+ };
+ };
+
+ if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+ _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ArtilleryMinimapInfo',7,"ff9900"] spawn SetControlFadeAnim;
+
+ ['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace;
+
+ _requestMarkerTransition = true;
+ };
+
+ //--- Update artillery display.
+ if (_mode != -1) then {
+
+ //--- Nothing.
+ if (_mode == 0) then {
+ _requestMarkerTransition = true;
+ _mode = -1;
+ };
+
+ //--- Filled Content.
+ if (_mode == 1 || _mode == 2) then {
+ //--- Remove if dead or null or sel changed.
+ {
+ _track = (_x select 0);
+ _vehicle = (_x select 1);
+
+ if !(alive _vehicle) then {
+ deleteMarkerLocal Format ["WFBE_A_Large%1",_track];
+ deleteMarkerLocal Format ["WFBE_A_Small%1",_track];
+ };
+ } forEach _trackingArrayID;
+
+ //--- No need to update the marker all the time.
+ if (time - _lastArtyUpdate > 5) then {
+ _lastArtyUpdate = time;
+ _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery;
+ };
+
+ //--- Live Feed.
+ _trackingArrayID = [];
+ {
+ _track = _x getVariable 'WFBE_A_Tracked';
+ if (isNil '_track') then {
+ _track = buildingMarker;
+ buildingMarker = buildingMarker + 1;
+ _x setVariable ['WFBE_A_Tracked', _track];
+ _dmarker = Format ["WFBE_A_Large%1",_track];
+ createMarkerLocal [_dmarker, getPos _x];
+ _dmarker setMarkerColorLocal "ColorBlue";
+ _dmarker setMarkerShapeLocal "ELLIPSE";
+ _brush = "SOLID";
+ if (_mode == 1) then {_brush = "SOLID"};
+ if (_mode == 2) then {_brush = "BORDER"};
+ _dmarker setMarkerBrushLocal _brush;
+ _dmarker setMarkerAlphaLocal 0.4;
+ _dmarker setMarkerSizeLocal [_maxRange,_maxRange];
+ _dmarker = Format ["WFBE_A_Small%1",_track];
+ createMarkerLocal [_dmarker, getPos _x];
+ _dmarker setMarkerColorLocal "ColorBlack";
+ _dmarker setMarkerShapeLocal "ELLIPSE";
+ _dmarker setMarkerBrushLocal "SOLID";
+ _dmarker setMarkerAlphaLocal 0.4;
+ _dmarker setMarkerSizeLocal [_minRange,_minRange];
+ } else {
+ _dmarker = Format ["WFBE_A_Large%1",_track];
+ _dmarker setMarkerPosLocal (getPos _x);
+ _dmarker = Format ["WFBE_A_Small%1",_track];
+ _dmarker setMarkerPosLocal (getPos _x);
+ };
+ _trackingArrayID = _trackingArrayID + [[_track,_x]];
+ } forEach _trackingArray;
+ };
+ };
+
+ _lastRange = artyRange;
+ _lastSel = lbCurSel(_listbox);
+ sleep 0.1;
+
+ //--- Back Button.
+ if (MenuAction == 30) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+};
+
+deleteMarkerLocal _marker;
+deleteMarkerLocal _area;
+{deleteMarkerLocal _x} forEach _markers;
+
+if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler};
+
+//--- Remove Markers.
+{
+ _track = (_x select 0);
+ _vehicle = (_x select 1);
+
+ _vehicle setVariable ['WFBE_A_Tracked', nil];
+
+ deleteMarkerLocal Format ["WFBE_A_Large%1",_track];
+ deleteMarkerLocal Format ["WFBE_A_Small%1",_track];
+} forEach _trackingArrayID; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Team.sqf b/Client/GUI/GUI_Menu_Team.sqf
new file mode 100644
index 0000000..e243b4b
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Team.sqf
@@ -0,0 +1,145 @@
+disableSerialization;
+
+_display = _this select 0;
+MenuAction = -1;
+
+_currentVD = viewDistance;
+_funds = Call GetPlayerFunds;
+
+if (votePopUp) then {
+ ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOffButton"];
+} else {
+ ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOnButton"];
+};
+
+ctrlSetText [13002, Format [localize "STR_WF_TEAM_ViewDistanceLabel",_currentVD]];
+ctrlSetText [13004, Format [localize "STR_WF_TEAM_TerrainGridLabel",currentTG]];
+ctrlSetText [13006, Format [localize "STR_WF_TEAM_MoneyTransfer",0]];
+ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]];
+
+SliderSetRange[13003,1,('WFBE_MAXVIEWDISTANCE' Call GetNamespace)];
+SliderSetRange[13005,1,('WFBE_MAXCLUTTERDISTANCE' Call GetNamespace)];
+SliderSetRange[13007,0,_funds];
+SliderSetPosition[13003,_currentVD];
+SliderSetPosition[13005,currentTG];
+_lastvd = _currentVD;
+_lasttg = currentTG;
+_timer = 0;
+
+_i = 1;
+{
+ _xtra = if (isPlayer (leader _x)) then {name (leader _x)} else {"AI"};
+ lbAdd[13008,Format ["[%1] %2",_i,_xtra]];
+ _i = _i + 1;
+} forEach clientTeams;
+lbSetCurSel[13008,0];
+
+_units = ((Units Group player) Call GetLiveUnits);
+_units = _units - [player];
+{
+ _desc = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _finalNumber = (_x) Call GetAIDigit;
+ _isInVehicle = "";
+ if (_x != vehicle _x) then {
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ _isInVehicle = " [" + _descVehi + "] ";
+ };
+ _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle;
+ lbAdd[13013,_txt];
+} forEach _units;
+lbSetCurSel[13013,0];
+
+{lbAdd[13018,_x]} forEach ["None","FX 1","FX 2","FX 3","FX 4","FX 5"];
+lbSetCurSel[13018,currentFX];
+
+while {alive player && dialog} do {
+ sleep 0.05;
+
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+
+ _curSel = lbCurSel 13008;
+ _currentVD = Floor (SliderPosition 13003);
+ currentTG = Floor (SliderPosition 13005);
+ _transferAmount = Floor (SliderPosition 13007);
+
+ ctrlSetText [13002, Format [localize "STR_WF_TEAM_ViewDistanceLabel",_currentVD]];
+ ctrlSetText [13004, Format [localize "STR_WF_TEAM_TerrainGridLabel",currentTG]];
+ ctrlSetText [13006, Format [localize "STR_WF_TEAM_MoneyTransfer",_transferAmount]];
+
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ if ((_transferAmount != 0)&&((clientTeams select _curSel) != group player)) then {
+ [(clientTeams select _curSel),_transferAmount] Call ChangeTeamFunds;
+ -_transferAmount Call ChangePlayerFunds;
+ _funds = Call GetPlayerFunds;
+ WFBE_LocalizeMessage = [vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]];
+ publicVariable 'WFBE_LocalizeMessage';
+ if (isHostedServer) then {[vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]] Spawn HandlePVF};
+ sliderSetRange[13007,0,_funds];
+ };
+ };
+
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ _curUnitSel = lbCurSel 13013;
+ if (_curUnitSel != -1) then {
+ _vehicle = vehicle (_units select _curUnitSel);
+ _destroy = [(_units select _curUnitSel)];
+ if (_vehicle != (_units select _curUnitSel)) then {_destroy = _destroy + [_vehicle]};
+ {
+ if (_x isKindOf 'Man') then {removeAllWeapons _x};
+ _x setDammage 1;
+ } forEach _destroy;
+
+ _units = ((Units Group player) Call GetLiveUnits);
+ _units = _units - [leader group player];
+ lbClear 13013;
+ {
+ _desc = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _finalNumber = (_x) Call GetAIDigit;
+ _isInVehicle = "";
+ if (_x != vehicle _x) then {
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ _isInVehicle = " [" + _descVehi + "] ";
+ };
+ _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle;
+ lbAdd[13013,_txt];
+ } forEach _units;
+ lbSetCurSel[13013,0];
+ };
+ };
+
+ if (MenuAction == 6) then {
+ MenuAction = -1;
+ currentFX = lbCurSel 13018;
+ [currentFX] Spawn FX;
+ };
+
+ //--- Vote Pop-Up //added-MrNiceGuy
+ if (MenuAction == 13) then {
+ MenuAction = -1;
+ if (votePopUp) then {
+ votePopUp = false;
+ ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOnButton"];
+ } else {
+ votePopUp = true;
+ ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOffButton"];
+ };
+ };
+
+ if (_currentVD != _lastvd) then {setViewDistance _currentVD};
+ if (currentTG != _lasttg) then {setTerrainGrid currentTG};
+ _lastvd = _currentVD;
+ _lasttg = currentTG;
+
+ if (_timer > 2) then {ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]];_timer = 0};
+ _timer = _timer + 0.05;
+
+ //--- Back Button.
+ if (MenuAction == 8) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+};
diff --git a/Client/GUI/GUI_Menu_UnitCamera.sqf b/Client/GUI/GUI_Menu_UnitCamera.sqf
new file mode 100644
index 0000000..a019ad7
--- /dev/null
+++ b/Client/GUI/GUI_Menu_UnitCamera.sqf
@@ -0,0 +1,89 @@
+disableSerialization;
+_display = _this select 0;
+MenuAction = -1;
+mouseButtonUp = -1;
+
+_cameraModes = ["Internal","External","Gunner","Group"];
+
+_n = 1;
+{lbAdd[21002,Format["[%1] %2",_n,name (leader _x)]];_n = _n + 1} forEach clientTeams;
+_id = clientTeams find playerTeam;
+lbSetCurSel[21002,_id];
+_currentUnit = (player) Call GetUnitVehicle;
+_currentMode = "Internal";
+_currentUnit switchCamera _currentMode;
+_units = (Units (group player) - [player]) Call GetLiveUnits;
+{lbAdd[21004,Format["(%1) %2",getText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units;
+
+_type = if (!(difficultyEnabled "3rdPersonView")) then {["Internal"]} else {["Internal","External","Ironsight","Group"]};
+{lbAdd[21006,_x]} forEach _type;
+lbSetCurSel[21006,0];
+
+_map = _display displayCtrl 21007;
+_map ctrlMapAnimAdd [0,.25,getPos _currentUnit];
+ctrlMapAnimCommit _map;
+
+while {true} do {
+ sleep 0.1;
+
+ _cameraSwap = false;
+ if (Side player != sideJoined || !dialog) exitWith {};
+
+ //--- Map click.
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ _near = _map PosScreenToWorld[mouseX,mouseY];
+ _list = _near nearEntities [["Man","Car","Motorcycle","Ship","Tank","Air"],200];
+ if (count _list > 0) then {
+ _objects = [];
+ {if (!(_x isKindOf "Man") && side _x != sideJoined) then {if (count (crew _x) == 0) then {_objects = _objects - [_x]}};if (side _x == sideJoined) then {_objects = _objects + [_x]}} forEach _list;
+ if (count _objects > 0) then {
+ _units = [_near,_objects] Call SortByDistance;
+ _currentUnit = (_units select 0) Call GetUnitVehicle;
+ _cameraSwap = true;
+ };
+ };
+ };
+
+ //--- Leader Selection.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ _selected = leader (clientTeams select (lbCurSel 21002));
+ _currentUnit = (_selected) Call GetUnitVehicle;
+ _n = 0;
+ _units = (Units (group _selected) - [_selected]) Call GetLiveUnits;
+ lbClear 21004;
+ {lbAdd[21004,Format["(%1) %2",GetText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units;
+ _cameraSwap = true;
+ };
+
+ //--- Leader commands AIs.
+ if (MenuAction == 102) then {
+ MenuAction = -1;
+ _currentUnit = (_units select (lbCurSel 21004)) Call GetUnitVehicle;
+ _cameraSwap = true;
+ };
+
+ //--- Camera Modes
+ if (MenuAction == 103) then {
+ MenuAction = -1;
+ _currentMode = (_cameraModes select (lbCurSel 21006));
+ _cameraSwap = true;
+ };
+
+ if !(alive _currentUnit) then {
+ _currentUnit = (player) Call GetUnitVehicle;
+ _cameraSwap = true;
+ };
+
+ //--- Update the Camera.
+ if (_cameraSwap) then {
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [1,.25,getPos _currentUnit];
+ ctrlMapAnimCommit _map;
+ _currentUnit switchCamera _currentMode;
+ };
+};
+
+closeDialog 0;
+((player) Call GetUnitVehicle) switchCamera _currentMode; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Upgrade.sqf b/Client/GUI/GUI_Menu_Upgrade.sqf
new file mode 100644
index 0000000..1ceb51e
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Upgrade.sqf
@@ -0,0 +1,223 @@
+disableSerialization;
+
+_display = _this select 0;
+displayUpgrade = "";
+
+MenuAction = -1;
+mouseX = -1;
+mouseY = -1;
+
+_requiredFunds = 0;
+_requiredSupply = 0;
+
+_tooltip = _display DisplayCtrl 18998;
+_tooltip_text = _display DisplayCtrl 18999;
+
+_controls = [];
+_u = 18001;
+_curIDC = _display DisplayCtrl _u;
+while {!isNull _curIDC} do {_controls = _controls + [_curIDC];_u = _u + 1;_curIDC = _display DisplayCtrl _u};
+
+_level = 0;
+_val = 0;
+_time = 0;
+_name = '';
+_tooltip_text_content = '';
+_canUpgrade = false;
+_dependent = false;
+_isUpgrading = false;
+_lastTimerUpdate = -5;
+_upgr = 'WFBE_UPGRADELABELS' Call GetNamespace;
+_upgrlev = 'WFBE_UPGRADELEVELS' Call GetNamespace;
+_upgrdep = 'WFBE_UPGRADEDEPENDENCIES' Call GetNamespace;
+_upgrcond = 'WFBE_UPGRADECONDITION' Call GetNamespace;
+_upgrdesc = 'WFBE_UPGRADEDESCRIPTION' Call GetNamespace; //---added MrNiceGuy
+
+
+while {alive player && dialog} do {
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ _upgrades = (sideJoinedText) Call GetSideUpgrades;
+
+ if (time - _lastTimerUpdate > 1) then {_lastTimerUpdate = time;_isUpgrading = Call Compile Format ["WFBE_%1_Upgrading",sideJoinedText]};
+
+ _u = 0;
+ {
+ _level = _upgrades select _u;
+ _maxLevel = _upgrlev select _u;
+ _dependencie = _upgrdep select _u;
+ _condition = _upgrcond select _u;
+ if (_level == _maxLevel) then {_x ctrlSetTextColor [0, 1, 0, 1]};
+ if (!_condition) then {_x ctrlSetTextColor [1, 0, 0, 1]};
+ if (count _dependencie > 0 && _level != _maxLevel && _condition) then {
+ if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then {
+ _x ctrlSetTextColor [1, 0, 0, 1];
+ } else {
+ if (_level != _maxLevel) then {
+ _x ctrlSetTextColor [0.75,0.75,0.75,1];
+ };
+ };
+ };
+ _u = _u + 1;
+ } forEach _controls;
+
+ //--- Tooltips.
+ if (displayUpgrade != "") then {
+
+ switch (displayUpgrade) do {
+ case "infantry": {_val = 0};
+ case "light": {_val = 1};
+ case "heavy": {_val = 2};
+ case "air": {_val = 3};
+ case "parachutist": {_val = 4};
+ case "uav": {_val = 5};
+ case "supply": {_val = 6};
+ case "ambuSpawn": {_val = 7};
+ case "airlift": {_val = 8};
+ case "flares": {_val = 9};
+ case "artillery": {_val = 10};
+ case "icbm": {_val = 11};
+ case "fasttravel": {_val = 12};
+ case "gear": {_val = 13};
+ case "ammo": {_val = 14};
+ case "easa": {_val = 15};
+ case "paradrop": {_val = 16};
+ case "shells": {_val = 17};
+ };
+
+ ctrlSetFocus (_controls select _val);
+
+ _dependencie = _upgrdep select _val;
+ _condition = _upgrcond select _val;
+ _maxLevel = _upgrlev select _val;
+ _name = _upgr select _val;
+ _level = _upgrades select _val;
+ _desc = _upgrdesc select _val; //---added MrNiceGuy
+
+
+ _enabled = true;
+ if (!_condition) then {_enabled = false};
+ if (count _dependencie > 0 && _enabled) then {
+ if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then {
+ _dependent = true;
+ } else {_dependent = false};
+ } else {_dependent = false};
+
+ _bpath = if (_level == _maxLevel) then {_level} else {_level + 1};
+ _time = (Format["WFBE_UPGRADETIMESLEVEL%1",_bpath] Call GetNamespace) select _val;
+ _needed = (Format["WFBE_UPGRADEPRICESLEVEL%1",_bpath] Call GetNamespace) select _val;
+ _requiredSupply = _needed select 0;
+ _requiredFunds = _needed select 1;
+
+ _currentSupply = (sideJoined) Call GetSideSupply;
+ _currentFunds = Call GetPlayerfunds;
+
+ _colorSupply = "'#ff9900'";
+ _colorFunds = "'#ff9900'";
+ _hasFunds = true;
+ if !(paramMoneyOnly) then {if (_currentSupply < _requiredSupply) then {_colorSupply = "'#ff0033'";_hasFunds = false}};
+ if (_currentFunds < _requiredFunds) then {_colorFunds = "'#ff0033'";_hasFunds = false};
+
+ if (!_isUpgrading && _level < _maxLevel && !_dependent && _enabled && _hasFunds) then {_canUpgrade = true} else {_canUpgrade = false};
+
+ _tooltip_w = 0.30;
+ _tooltip_h = 0.50;
+ _tooltip_x = if ((1 - mouseX) < _tooltip_w) then {mouseX - _tooltip_w - 0.02} else {mouseX + 0.02};
+ _tooltip_y = if (mouseY > 0.5) then {mouseY - _tooltip_h - 0.02} else {mouseY + 0.02};
+
+ if (_level != _maxLevel) then {
+ _supplyCd = if !(paramMoneyOnly) then {Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br />",Format [localize 'STR_WF_UPGRADE_Cost',"<t color=" + _colorSupply + ">" + str(_requiredSupply) + '</t>' + '/' + "<t color='#ff9900'>" + str(_currentSupply) + '</t> S']]} else {""};
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#338dcc' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br /><br />",Format [localize 'STR_WF_UPGRADE_Level',"<t color='#ff9900'>" + str(_level) + '</t>' + "/<t color='#ff9900'>" + str(_maxLevel) + '</t>']] +
+ _supplyCd +
+ Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br />",Format [localize 'STR_WF_UPGRADE_Cost',"<t color=" + _colorFunds + ">" + str(_requiredFunds) + '</t>' + '/' + "<t color='#ff9900'>" + str(_currentFunds) + '</t> $']] +
+ Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br /><br />",Format [localize 'STR_WF_UPGRADE_Duration',"<t color='#ff9900'>" + str(_time) + ' </t>' + localize 'STR_WF_Seconds']] +
+ Format ["<t size='0.8' color='#ff9900' shadow='0'>%1</t><br />",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#338dcc' shadow='2'>%1</t><br />",_desc] /* added MrNiceGuy */
+ );
+
+ if (_isUpgrading) then {
+ //_tooltip_h = 0.12;
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#338dcc' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br /><br />",Format [localize 'STR_WF_UPGRADE_Level',"<t color='#ff9900'>" + str(_level) + '</t>' + "/<t color='#ff9900'>" + str(_maxLevel) + '</t>']] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#ff9900' font='Zeppelin33'>%1</t><br /><br />",localize 'STR_WF_UPGRADE_AlreadyRunning']+
+ Format ["<t size='0.8' color='#ff9900' shadow='0'>%1</t><br />",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#338dcc' shadow='0'>%1</t><br />",_desc] /* added MrNiceGuy */
+ );
+ };
+ if (!_enabled) then {
+ //_tooltip_h = 0.12; /* added MrNiceGuy */
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#338dcc' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#ff0033' font='Zeppelin33'>%1</t><br /><br />",localize 'STR_WF_UPGRADE_Condition'] +
+ Format ["<t size='0.8' color='#ff9900' shadow='0'>%1</t><br />",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#338dcc' shadow='0'>%1</t><br />",_desc] /* added MrNiceGuy */
+ );
+ };
+ if (_dependent && !_isUpgrading && _enabled) then {
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#338dcc' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br /><br />",Format [localize 'STR_WF_UPGRADE_Level',"<t color='#ff9900'>" + str(_level) + '</t>' + "/<t color='#ff9900'>" + str(_maxLevel) + '</t>']] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#ff9900' font='Zeppelin33'>%1</t><br /><br />",Format[localize 'STR_WF_UPGRADE_Dependent',_upgr select (_dependencie select 0),_dependencie select 1]] +
+ Format ["<t size='0.8' color='#ff9900' shadow='0'>%1</t><br />",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#338dcc' shadow='0'>%1</t><br />",_desc] /* added MrNiceGuy */
+ );
+ };
+ } else {
+ //_tooltip_h = 0.12;
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#338dcc' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#bfbfbf' font='Zeppelin33'>%1</t><br /><br />",Format [localize 'STR_WF_UPGRADE_Level',"<t color='#ff9900'>" + str(_level) + '</t>' + "/<t color='#ff9900'>" + str(_maxLevel) + '</t>']] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#00ff33' font='Zeppelin33'>%1</t><br /><br />",localize 'STR_WF_UPGRADE_Maximum'] +
+ Format ["<t size='0.8' color='#ff9900' shadow='0'>%1</t><br />",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */
+ Format ["<t size='0.8' color='#338dcc' shadow='0'>%1</t><br />",_desc] /* added MrNiceGuy */
+
+ );
+ };
+
+ if ((ctrlPosition _tooltip select 0) == 0 || true) then {_tooltip ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]};
+ _tooltip ctrlCommit 0;
+
+ _tooltip_text ctrlSetStructuredText _tooltip_text_content;
+ if ((ctrlPosition _tooltip_text select 0) == 0 || true) then {_tooltip_text ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]};
+ _tooltip_text ctrlCommit 0;
+
+ } else {
+ if ((ctrlPosition _tooltip select 0) != 0) then {_tooltip ctrlSetPosition [0,0,0,0];_tooltip ctrlCommit 0};
+ if ((ctrlPosition _tooltip_text select 0) != 0) then {_tooltip_text ctrlSetPosition [0,0,0,0];_tooltip_text ctrlCommit 0};
+ };
+
+ _commander = false;
+ if (!isNull(commanderTeam)) then {
+ if (commanderTeam == group player) then {_commander = true};
+ };
+
+ if (MenuAction == 1 && _canUpgrade && _commander) then {
+ MenuAction = -1;
+ -(_requiredFunds) Call ChangePlayerFunds;
+ if !(paramMoneyOnly) then {[sideJoined, -_requiredSupply] Call ChangeSideSupply};
+
+ WFBE_RequestUpgrade = ['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]];
+ publicVariable 'WFBE_RequestUpgrade';
+ if (isHostedServer) then {['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]] Spawn HandleSPVF};
+
+ Call Compile Format ["WFBE_%1_Upgrading = true;",sideJoinedText];
+ _isUpgrading = true;
+ hint Format [localize "STR_WF_INFO_Upgrade_Start",_name];
+ } else {MenuAction = -1};
+
+ _txt = if (_isUpgrading) then {localize "STR_WF_UPGRADE_RunningInfo" + "..."} else {""};
+ ctrlSetText[18802,_txt];
+
+ sleep 0.05;
+
+ //--- Back Button.
+ if (MenuAction == 2) exitWith { //---added-MrNiceGuy
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "WF_Menu";
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Menu_Voting.sqf b/Client/GUI/GUI_Menu_Voting.sqf
new file mode 100644
index 0000000..987f40e
--- /dev/null
+++ b/Client/GUI/GUI_Menu_Voting.sqf
@@ -0,0 +1,75 @@
+MenuAction = -1; //added-MrNiceGuy - Benny`s solution
+
+_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];
+if (_voteTime <= 0) exitWith {};
+
+_name = "";
+_lastTeams = [];
+_lastTeam = -2;
+
+_lastVotes = [sideJoined] Call GetCommanderVotes;
+
+while {true} do {
+ sleep 0.1;
+
+ if (!(alive player) || Side player != sideJoined) exitWith {CloseDialog 0;_exit = true};
+ if !(dialog) exitWith {};
+
+ _commanderTeam = [sideJoined] Call GetCommanderFromVotes;
+ if (IsNull _commanderTeam) then {_name = Localize "STR_WF_AI"} else {_name = name leader _commanderTeam};
+
+ _voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];
+ ctrlSetText [10007,Format ["%1",_name]]; //changed-MrNiceGuy
+ ctrlSetText [10008,Format ["%2: %3",_name,Localize "STR_WF_VOTING_TimeLeft",_voteTime]]; //added-MrNiceGuy
+
+ if (_voteTime <= 0) exitWith {CloseDialog 0};
+
+ _refresh = false;
+ _playerSlots = [];
+ {
+ if !(isNil '_x') then {if (isPlayer (leader _x)) then {_playerSlots = _playerSlots + [_x]}};
+ } forEach clientTeams;
+
+ _count = 0;
+ _votes = [sideJoined] Call GetCommanderVotes;
+
+ {if (_x != (_votes Select _count)) then {_refresh = true};_count = _count + 1} ForEach _lastVotes;
+ {if !(_x In _lastTeams) then {_refresh = true}} ForEach _playerSlots;
+ {if !(_x In _playerSlots) then {_refresh = true}} ForEach _lastTeams;
+
+ if (_refresh) then {
+
+ _reselect = false;
+ _selected = lbCurSel 10006;
+ _selectedTeam = lbValue[10006,_selected];
+ _selectedText = lbText[10006,_selected];
+ _lastVotes = _votes;
+
+ if (_selected != -1) then {_reselect = true};
+
+ lbClear 10006;
+ _AI = lbAdd[10006,Format["%1 %2",_votes select 0,Localize "STR_WF_AI"]];
+ lbSetValue [10006,_AI,-1];
+
+ _count = 0;
+ _total = 1;
+
+ {
+ if !(isNil '_x') then {if (_x In _playerSlots) then {_total = _total + 1;_selection = lbAdd[10006,Format ["%1 %2",_votes select _count+1,name (leader _x)]];lbSetValue [10006,_selection,_count]}};_count = _count + 1;
+ } forEach clientTeams;
+ _lastTeams = +_playerSlots;
+
+ if (_reselect) then {
+ _selected = 0;
+ for [{_count = 0},{_count < _total},{_count = _count + 1}] do {if (lbValue[10006,_count] == _selectedTeam) then {_selected = _count}};
+ lbSetCurSel[10006,_selected];
+ };
+ };
+
+ _selected = lbCurSel 10006;
+ if (_selected != -1) then {
+ _selectedTeam = lbValue[10006,_selected];
+ if (_selectedTeam != _lastTeam) then {Call Compile Format["%1Team%2Vote = _selectedTeam;publicVariable '%1Team%2Vote';",sideJoinedText,clientID]};
+ _lastTeam = _selectedTeam;
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_MissionTasks.sqf b/Client/GUI/GUI_MissionTasks.sqf
new file mode 100644
index 0000000..e5700b6
--- /dev/null
+++ b/Client/GUI/GUI_MissionTasks.sqf
@@ -0,0 +1,65 @@
+
+private ["_locations","_sideID","_names","_skip","_curSel","_display","_map","_sorted"];
+disableSerialization;
+
+MenuAction = -1;
+mouseButtonUp = -1;
+
+_display = _this select 0;
+_map = _display DisplayCtrl 19002;
+
+if (isNull currentMission) then {ctrlSetText [19007,Format [localize "STR_WF_CurrentMission","N/A"]]} else {ctrlSetText [19007,Format [localize "STR_WF_CurrentMission",currentMission getVariable "name"]];};
+
+_names = [];
+_locations = [];
+{_sideID = _x getVariable "sideID"; if (_sideID != sideID) then {_locations = _locations + [_x]}} forEach towns;
+_sorted = [player,_locations] Call SortByDistance;
+{_names = _names + [_x getVariable "name"]} forEach _sorted;
+
+{lbAdd[19005,_x]} forEach _names;
+if (count _sorted > 0) then {
+ lbSetCurSel[19005,0];
+ _map CtrlMapAnimAdd [2,.140,GetPos (_sorted select 0)];
+ CtrlMapAnimCommit _map;
+};
+
+while {alive player && dialog} do {
+ sleep 0.1;
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+
+ //--- Accept Mision.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ _skip = false;
+ if (!isNil "townTask") then {if (taskState townTask == "Succeeded") then {["TownRemove",currentMission] Call TaskSystem;currentMission = objNull}} ;
+ if (!isNull currentMission) then {hint (localize "STR_WF_Mission_Running");_skip = true};
+ if (!_skip) then {
+ _curSel = lbCurSel (19005);
+ currentMission = _sorted select _curSel;
+ ctrlSetText [19007,Format [localize "STR_WF_CurrentMission",currentMission getVariable "name"]];
+ //--- Task System.
+ ["TownAdd",currentMission] Spawn TaskSystem;
+ };
+ };
+
+ //--- Abort Mision.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ if (!isNull currentMission) then {
+ ["TownRemove",currentMission] Call TaskSystem;
+ ctrlSetText [19007,Format [localize "STR_WF_CurrentMission","N/A"]];
+ currentMission = objNull;
+ hint (localize "STR_WF_Mission_Abort");
+ };
+ };
+
+ //--- Other Town selected.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ _curSel = lbCurSel (19005);
+ CtrlMapAnimClear _map;
+ _map CtrlMapAnimAdd [2,.140,GetPos (_sorted select _curSel)];
+ CtrlMapAnimCommit _map;
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Parameters.sqf b/Client/GUI/GUI_Parameters.sqf
new file mode 100644
index 0000000..4f93ce9
--- /dev/null
+++ b/Client/GUI/GUI_Parameters.sqf
@@ -0,0 +1,23 @@
+/* Ingame parameters dump. */
+private ["_i","_paramName","_text","_values","_texts","_value","_status","_uptime","_getTime"];
+
+for [{_i = 0},{_i < (count (missionConfigFile/"Params"))},{_i = _i + 1}] do {
+ _paramName = (configName ((missionConfigFile >> "Params") select _i));
+ _text = getText (missionConfigFile >> "Params" >> _paramName >> "title");
+ _values = getArray (missionConfigFile >> "Params" >> _paramName >> "values");
+ _texts = getArray (missionConfigFile >> "Params" >> _paramName >> "texts");
+
+ _value = if (isMultiplayer) then {paramsArray select _i} else {getNumber (missionConfigFile >> "Params" >> _paramName >> "default")};
+ _status = _texts select (_values find _value);
+
+ lnbAddRow [22003,[_text,_status]];
+};
+
+while {alive player && dialog} do {
+ _uptime = Call GetTime;
+ ctrlSetText [22005,Format[localize 'STR_WF_Uptime',_uptime select 0,_uptime select 1,_uptime select 2, _uptime select 3]];
+
+ sleep 0.1;
+ if (side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Respawn.sqf b/Client/GUI/GUI_Respawn.sqf
new file mode 100644
index 0000000..897080a
--- /dev/null
+++ b/Client/GUI/GUI_Respawn.sqf
@@ -0,0 +1,156 @@
+private ["_display", "_map", "_hq", "_respawnCampsRuleMode", "_availableSpawn", "_buildings", "_checks", "_mobileRespawns", "_upgrades", "_range", "_farps", "_markers", "_markerIndex", "_markerName", "_spawn", "_ta", "_position", "_sorted", "_loadDefault", "_mode", "_skip", "_price", "_funds", "_safeArray", "_temp", "_listbp", "_weaps"];
+disableSerialization;
+
+MenuAction = -1;
+mouseButtonUp = -1;
+_display = _this select 0;
+_map = _display displayCtrl 15001;
+
+_spawn = objNull;
+_availableSpawn = [];
+_markers = [];
+_markerIndex = 0;
+_ta = "";
+_lastSpawnUpdate = 0;
+
+//--- Wait until the player respawned.
+waitUntil {alive player};
+
+//--- Position the player at the temp location during his respawn.
+player setPos ([getMarkerPos Format["%1TempRespawnMarker",sideJoinedText],1,10] Call GetRandomPosition);
+if (leader(group player) != player) then {(group player) selectLeader player};
+
+//--- Call the pre respawn routine.
+(player) Call PreRespawnHandler;
+
+//--- Spawn a countdown thread.
+respawnDone = false;
+_handleTimer = [] Spawn {
+ if (isNil 'respawnStatus') then {respawnStatus = 'WFBE_RESPAWNDELAY' Call GetNamespace};
+ while {respawnStatus >= 0} do {
+ sleep 1;
+ respawnStatus = respawnStatus - 1;
+ };
+ respawnDone = true;
+};
+
+//--- Run the main respawn thread.
+while {!respawnDone} do {
+ //--- Exit the thread if the client died.
+ if !(alive player) exitWith {};
+
+ //--- Loadout Selection.
+ ctrlSetText [15004, if (WFBE_RespawnDefaultGear) then {"D"} else {"C"}];
+
+ //--- Preloading Status.
+ ctrlSetText [15005, if (WFBE_EnablePreload) then {"P"} else {"N"}];
+
+ //--- Update the respawn info.
+ if (time - _lastSpawnUpdate > 2) then {
+ _lastSpawnUpdate = time;
+ _lastAvailableSpawn = _availableSpawn;
+ _availableSpawn = [sideJoined,deathLocation] Call GetRespawnAvailable;
+
+ //--- First launch.
+ if (isNull _spawn) then {
+ _spawn = _availableSpawn select 0;
+ _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim;
+ respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo;
+ };
+
+ //--- Properly update the client's map - Update removal.
+ _found = false;
+ {
+ if !(_x in _availableSpawn) then {
+ _mid = _x getVariable 'WFBE_IDRMarker';
+ _markers = _markers - [_mid];
+ deleteMarkerLocal _mid;
+ _x setVariable ['WFBE_IDRMarker',nil];
+ if (_x == _spawn && !_found) then {
+ _found = true;
+ _spawn = ([_x, _availableSpawn] Call SortByDistance) select 0;
+ terminate _ta;
+ deleteMarkerLocal "TempAnim";
+ _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim;
+ respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo;
+ };
+ };
+ } forEach _lastAvailableSpawn;
+
+ //--- Properly update the client's map - Update add.
+ {
+ if !(_x in _lastAvailableSpawn) then {
+ _markerName = Format ["respawnMarker%1",_markerIndex];
+ _markers = _markers + [_markerName];
+ createMarkerLocal [_markerName,getPos _x];
+ _markerName setMarkerTypeLocal "Select";
+ _markerName setMarkerColorLocal "ColorYellow";
+ _markerName setMarkerSizeLocal [1,1];
+ _markerIndex = _markerIndex + 1;
+ _x setVariable ['WFBE_IDRMarker',_markerName];
+ };
+ } forEach _availableSpawn;
+ };
+
+ //--- Update the respawn timer.
+ ctrlSetText [15003,Format [localize "STR_WF_RespawnStatus",respawnStatus,respawnName]];
+
+ //--- The client has clicked on the map.
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ if (count _availableSpawn > 1) then {
+ _position = _map PosScreenToWorld[mouseX,mouseY];
+ _sorted = [_position,_availableSpawn] Call SortByDistance;
+ if ((_sorted select 0) distance _position < 500) then {
+ _spawn = _sorted select 0;
+ activeAnimMarker = false;
+ terminate _ta;
+ deleteMarkerLocal "TempAnim";
+ _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim;
+ respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo;
+ };
+ };
+ };
+
+ sleep 0.1;
+};
+
+//--- If the spawn is null, we use the HQ.
+if (isNull _spawn) then {
+ _hq = (sideJoinedText) Call GetSideHQ;
+ _spawn = _hq;
+};
+
+//--- Pre-render.
+if (WFBE_EnablePreload) then {
+ ctrlSetText [15003,localize 'STR_WF_Preload'];
+ waitUntil{preloadCamera (getPos _spawn) || !(alive player)};
+};
+
+//--- Execute on respawn code only if the player's alive.
+if (alive player) then {
+ [player,_spawn] Call OnRespawnHandler;
+};
+
+//--- Terminate the threads & cleaning.
+{deleteMarkerLocal _x} forEach _markers;
+{_x setVariable ['WFBE_IDRMarker',nil]} forEach _availableSpawn;
+if !(isNil "DeathCamera") then {
+ DeathCamera cameraEffect["TERMINATE","BACK"];
+ camDestroy DeathCamera;
+};
+
+"dynamicBlur" ppEffectEnable false;
+"colorCorrections" ppEffectEnable false;
+[currentFX] Spawn FX;
+terminate _ta;
+if !(scriptDone _handleTimer) then {terminate _handleTimer};
+deleteMarkerLocal "TempAnim";
+activeAnimMarker = false;
+playerDead = false;
+respawnDone = nil;
+respawnName = nil;
+respawnStatus = nil;
+closeDialog 0;
+
+hint (localize "STR_WF_RespawnInfo"); \ No newline at end of file
diff --git a/Client/GUI/GUI_SetCurrentCutDisplay.sqf b/Client/GUI/GUI_SetCurrentCutDisplay.sqf
new file mode 100644
index 0000000..546a648
--- /dev/null
+++ b/Client/GUI/GUI_SetCurrentCutDisplay.sqf
@@ -0,0 +1 @@
+["currentCutDisplay", _this Select 0] call BIS_FNC_GUIset; \ No newline at end of file
diff --git a/Client/GUI/GUI_SupportMenu.sqf b/Client/GUI/GUI_SupportMenu.sqf
new file mode 100644
index 0000000..282ee37
--- /dev/null
+++ b/Client/GUI/GUI_SupportMenu.sqf
@@ -0,0 +1,271 @@
+MenuAction = -1;
+
+_vehi = [group player,false] Call GetTeamVehicles;
+_alives = (units group player) Call GetLiveUnits;
+{if (vehicle _x == _x) then {_vehi = _vehi + [_x]}} forEach _alives;
+_lastUse = 0;
+ctrlEnable [20007,false];
+_typeRepair = Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace;
+_ss = 'WFBE_SUPPLYSYSTEM' Call GetNamespace;
+_sheal = 'WFBE_SUPPORTHEALTIME' Call GetNamespace;
+_srearm = 'WFBE_SUPPORTREARMTIME' Call GetNamespace;
+_srefuel = 'WFBE_SUPPORTREFUELTIME' Call GetNamespace;
+_srepair = 'WFBE_SUPPORTREPAIRTIME' Call GetNamespace;
+
+_healPrice = 0;
+_repairPrice = 0;
+_refuelPrice = 0;
+_rearmPrice = 0;
+_lastVeh = objNull;
+_lastDmg = 0;
+_lastFue = 0;
+
+_buildings = (sideJoinedText) Call GetSideStructures;
+
+//--- Service Point.
+_csp = objNull;
+_sp = [sideJoined, Format ["WFBE_%1SERVICEPOINTTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;
+if (count _sp > 0) then {
+ _sorted = [player,_sp] Call SortByDistance;
+ _csp = _sorted select 0;
+};
+
+if (paramEASA) then {
+ _enable = false;
+ _currentUpgrades = (sideJoinedText) Call GetSideUpgrades;
+ _easaLevel = _currentUpgrades select 15;
+ if (!(isNull _csp) && _easaLevel > 0) then {
+ if (player distance _csp < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then {
+ if (typeOf(vehicle player) in ('WFBE_EASA_Vehicles' Call GetNamespace)) then {
+ if (driver (vehicle player) == player) then {_enable = true};
+ };
+ };
+ };
+ ctrlEnable [20010,_enable];
+} else {
+ ctrlEnable [20010,false];
+};
+
+_effective = [];
+_nearSupport = [];
+_spType = Call Compile Format ["%1SP",sideJoinedText];
+_i = 0;
+{
+ _closestSP = objNull;
+ _add = false;
+
+ _nearSupport set [_i, []];
+
+ //--- Service Point.
+ if (count _sp > 0) then {
+ _sorted = [_x,_sp] Call SortByDistance;
+ _closestSP = _sorted select 0;
+ if !(isNull _closestSP) then {
+ if (_x distance _closestSP < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then {
+ _add = true;
+ _nearSupport set [_i,(_nearSupport select _i) + [_closestSP]];
+ };
+ };
+ };
+
+ //--- Depots.
+ _nObjects = nearestObjects [_x, WFDEPOT,('WFBE_SUPPORTRANGE' Call GetNamespace)];
+ _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};
+ if !(isNull _nObject) then {
+ _sideID = _nObject getVariable "sideID";
+ if !(isNil "_sideID") then {
+ if (_sideID == sideID) then {
+ _add = true;
+ _nearSupport set [_i,(_nearSupport select _i) + [_nObject]];
+ };
+ };
+ };
+
+ //--- Repairs Trucks.
+ _checks = (getPos _x) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace];
+ if (count _checks > 0) then {
+ _add = true;
+ _nearSupport set [_i,(_nearSupport select _i) + _checks];
+ };
+
+ //--- Add the vehicle ?
+ if (_add) then {
+ _effective = _effective + [_x];
+ _desc = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _finalNumber = (_x) Call GetAIDigit;
+ _isInVehicle = "";
+ if (_x != vehicle _x) then {
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ _isInVehicle = " [" + _descVehi + "] ";
+ };
+ _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle;
+ lbAdd[20002,_txt];
+
+ _i = _i + 1;
+ };
+} forEach _vehi;
+
+_checks = (getPos player) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace];
+if (count _checks > 0) then {
+ _repair = _checks select 0;
+ _vehi = ((getPos _repair) nearEntities[["Car","Motorcycle","Tank","Air","Ship","StaticWeapon"],100]) - [_repair];
+ {
+ if !(_x in _effective) then {
+ _effective = _effective + [_x];
+ _nearSupport set [_i,[_repair]];
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ lbAdd[20002,_descVehi];
+
+ _i = _i + 1;
+ };
+ } forEach _vehi;
+};
+
+if (count _effective > 0) then {lbSetCurSel[20002,0]};
+
+while {true} do {
+ sleep 0.1;
+
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+ _curSel = lbCurSel(20002);
+
+ _isCommander = false;
+
+ if (!isNull(commanderTeam)) then {if (commanderTeam == Group player) then {_isCommander = true}};
+ _enabled = if (time - _lastUse > 5 && _isCommander && _ss == 0) then {true} else {false};
+ ctrlEnable [20007,_enabled];
+
+ if (_curSel != -1) then {
+ _veh = (vehicle (_effective select _curSel));
+ _funds = Call GetPlayerFunds;
+
+ if (_veh isKindOf "Man") then {
+ {ctrlEnable [_x,false]} forEach [20003,20004,20005];
+ _enabled = if (_funds >= _healPrice) then {true} else {false};
+ ctrlEnable [20008,_enabled];
+ //--- Healing.
+ _healPrice = round((getDammage _veh)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace));
+ ctrlSetText [20011,"$0."];
+ ctrlSetText [20012,"$0."];
+ ctrlSetText [20013,"$0."];
+ ctrlSetText [20014,"$"+str(_healPrice)+"."];
+ } else {
+ //--- Prevent on the air re-supply.
+ _canBeUsed = if ((getPos _veh) select 2 <= 2 && speed _veh <= 20) then {true} else {false};
+ _enabled = if (_canBeUsed && _funds >= _rearmPrice) then {true} else {false};
+ ctrlEnable [20003,_enabled];
+ _enabled = if (_canBeUsed && _funds >= _repairPrice) then {true} else {false};
+ ctrlEnable [20004,_enabled];
+ _enabled = if (_canBeUsed && _funds >= _refuelPrice) then {true} else {false};
+ ctrlEnable [20005,_enabled];
+ _enabled = if (_canBeUsed && _funds >= _healPrice) then {true} else {false};
+ ctrlEnable [20008,_enabled];
+ //--- Healing.
+ _healPrice = 0;
+ {
+ if (alive _x) then {_healPrice = _healPrice + round((getDammage _x)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace))};
+ } forEach (crew _veh);
+ ctrlSetText [20014,"$"+str(_healPrice)+"."];
+ //--- Repair.
+ if (_veh != _lastVeh || getDammage _veh != _lastDmg) then {
+ _type = typeOf _veh;
+ _lastDmg = getDammage _veh;
+ _get = _type Call GetNamespace;
+ if !(isNil '_get') then {
+ _repairPrice = round((getDammage _veh)*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREPAIRPRICE' Call GetNamespace)));
+ } else {
+ _repairPrice = 500;
+ };
+ };
+ ctrlSetText [20012,"$"+str(_repairPrice)+"."];
+ //--- Rearm.
+ if (_veh != _lastVeh) then {
+ _type = typeOf _veh;
+ _get = _type Call GetNamespace;
+ if !(isNil '_get') then {
+ _rearmPrice = round((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREARMPRICE' Call GetNamespace));
+ } else {
+ _rearmPrice = 500;
+ };
+ };
+ ctrlSetText [20011,"$"+str(_rearmPrice)+"."];
+ //--- Refuel.
+ if (_veh != _lastVeh || fuel _veh != _lastFue) then {
+ _type = typeOf _veh;
+ _lastFue = fuel _veh;
+ _get = _type Call GetNamespace;
+ if !(isNil '_get') then {
+ _fuel = ((fuel _veh) -1) * -1;
+ _refuelPrice = round(_fuel*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREFUELPRICE' Call GetNamespace)));
+ } else {
+ _refuelPrice = 200;
+ };
+ };
+ ctrlSetText [20013,"$"+str(_refuelPrice)+"."];
+ };
+
+ _lastVeh = _veh;
+
+ //--- Rearm.
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ -_rearmPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Rearm thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRearm;
+ };
+
+ //--- Repair.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ -_repairPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Repair thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRepair;
+ };
+
+ //--- Refuel.
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ -_refuelPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Refuel thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRefuel;
+ };
+
+ //--- Heal.
+ if (MenuAction == 5) then {
+ MenuAction = -1;
+ -_healPrice Call ChangePlayerFunds;
+
+ //--- Spawn a Healing thread.
+ [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportHeal;
+ };
+ } else {
+ {ctrlEnable[_x,false]} forEach [20003,20004,20005,20008];
+ };
+
+ //--- Respawn Supply Trucks.
+ if (MenuAction == 4) then {
+ MenuAction = -1;
+ WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]];
+ publicVariable 'WFBE_RequestSpecial';
+ if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]] Spawn HandleSPVF};
+ _lastUse = time;
+ };
+
+ //--- EASA. TBD: Add dialog;
+ if (MenuAction == 7) then {
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscDisplayEASA";
+ };
+
+ //--- Parameters.
+ if (MenuAction == 6) exitWith {
+ MenuAction = -1;
+ closeDialog 0;
+ createDialog "RscDisplayIngameParameters";
+ };
+};
diff --git a/Client/GUI/GUI_TeamMenu.sqf b/Client/GUI/GUI_TeamMenu.sqf
new file mode 100644
index 0000000..2206ad3
--- /dev/null
+++ b/Client/GUI/GUI_TeamMenu.sqf
@@ -0,0 +1,174 @@
+
+private ["_xtra","_i","_descVehi","_isInVehicle","_desc","_text","_amount","_val","_val2",
+"_ainumber","_finalNumber","_txt","_funds","_objects","_vehicle","_destroy","_units","_curUnitSel",
+"_pos","_vehi","_timer","_curSel","_currentVD","_transferAmount","_lastvd","_lasttg","_is","_x"];
+disableSerialization;
+
+MenuAction = -1;
+
+switch (votePopUp) do {
+ case true: {CtrlShow [13017,false]};
+ case false: {CtrlShow [13016,false]};
+};
+
+_currentVD = viewDistance;
+_funds = Call GetPlayerFunds;
+ctrlSetText [13002, Format [localize "STR_WF_ViewDistance",_currentVD]];
+ctrlSetText [13004, Format [localize "STR_WF_TerrainGrid",currentTG]];
+ctrlSetText [13006, Format [localize "STR_WF_MoneyTransfer",0]];
+ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]];
+
+SliderSetRange[13003,1,('WFBE_MAXVIEWDISTANCE' Call GetNamespace)];
+SliderSetRange[13005,1,('WFBE_MAXCLUTTERDISTANCE' Call GetNamespace)];
+SliderSetRange[13007,0,_funds];
+SliderSetPosition[13003,_currentVD];
+SliderSetPosition[13005,currentTG];
+_lastvd = _currentVD;
+_lasttg = currentTG;
+_timer = 0;
+
+_i = 1;
+{
+ _xtra = if (isPlayer (leader _x)) then {name (leader _x)} else {"AI"};
+ lbAdd[13008,Format ["[%1] %2",_i,_xtra]];
+ _i = _i + 1;
+} forEach clientTeams;
+lbSetCurSel[13008,0];
+
+_units = ((Units Group player) Call GetLiveUnits);
+_units = _units - [player];
+{
+ _desc = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _finalNumber = (_x) Call GetAIDigit;
+ _isInVehicle = "";
+ if (_x != vehicle _x) then {
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ _isInVehicle = " [" + _descVehi + "] ";
+ };
+ _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle;
+ lbAdd[13013,_txt];
+} forEach _units;
+lbSetCurSel[13013,0];
+
+{lbAdd[13018,_x]} forEach ["None","FX 1","FX 2","FX 3","FX 4","FX 5"];
+lbSetCurSel[13018,currentFX];
+
+while {alive player && dialog} do {
+ sleep 0.05;
+
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if (!dialog) exitWith {};
+
+ _curSel = lbCurSel 13008;
+ _currentVD = Floor (SliderPosition 13003);
+ currentTG = Floor (SliderPosition 13005);
+ _transferAmount = Floor (SliderPosition 13007);
+
+ ctrlSetText [13002, Format [localize "STR_WF_ViewDistance",_currentVD]];
+ ctrlSetText [13004, Format [localize "STR_WF_TerrainGrid",currentTG]];
+ ctrlSetText [13006, Format [localize "STR_WF_MoneyTransfer",_transferAmount]];
+
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ if ((_transferAmount != 0)&&((clientTeams select _curSel) != group player)) then {
+ [(clientTeams select _curSel),_transferAmount] Call ChangeTeamFunds;
+ -_transferAmount Call ChangePlayerFunds;
+ _funds = Call GetPlayerFunds;
+ WFBE_LocalizeMessage = [vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]];
+ publicVariable 'WFBE_LocalizeMessage';
+ if (isHostedServer) then {[vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]] Spawn HandlePVF};
+ sliderSetRange[13007,0,_funds];
+ };
+ };
+
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+ _vehicle = vehicle player;
+ if (player != _vehicle) then {
+ if (getPos _vehicle select 2 > 3 && !surfaceIsWater (getPos _x)) then {
+ [_vehicle, getPos _vehicle, 15] Call PlaceSafe;
+ } else {
+ _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 0.5];
+ _vehicle setVelocity [0,0,-0.5];
+ };
+ };
+ if (player == _vehicle) then {
+ _objects = player nearEntities[["Car","Motorcycle","Tank"],10];
+ if (count _objects > 0) then {
+ {
+ if (getPos _x select 2 > 3 && !surfaceIsWater (getPos _x)) then {
+ [_x, getPos _x, 15] Call PlaceSafe;
+ } else {
+ _x setPos [getPos _x select 0, getPos _x select 1, 0.5];
+ _x setVelocity [0,0,-0.5];
+ };
+ } forEach _objects;
+ };
+ };
+ };
+
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ _curUnitSel = lbCurSel 13013;
+ if (_curUnitSel != -1) then {
+ _vehicle = vehicle (_units select _curUnitSel);
+ _destroy = [(_units select _curUnitSel)];
+ if (_vehicle != (_units select _curUnitSel)) then {_destroy = _destroy + [_vehicle]};
+ {
+ if (_x isKindOf 'Man') then {removeAllWeapons _x};
+ _x setDammage 1;
+ } forEach _destroy;
+
+ _units = ((Units Group player) Call GetLiveUnits);
+ _units = _units - [leader group player];
+ lbClear 13013;
+ {
+ _desc = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _finalNumber = (_x) Call GetAIDigit;
+ _isInVehicle = "";
+ if (_x != vehicle _x) then {
+ _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo;
+ _isInVehicle = " [" + _descVehi + "] ";
+ };
+ _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle;
+ lbAdd[13013,_txt];
+ } forEach _units;
+ lbSetCurSel[13013,0];
+ };
+ };
+
+ if (MenuAction == 4) then {
+ MenuAction = -1;
+ closeDialog 0;
+ titleCut["","BLACK FADED",0];
+ _pos = position player;
+ _vehi = "Lada1" createVehicle [0,0,0];
+ player moveInCargo _vehi;
+ deleteVehicle _vehi;
+ player setPos _pos;
+ titleCut["","BLACK IN",5];
+ };
+
+ if (MenuAction == 5) then {
+ MenuAction = -1;
+ if (votePopUp) then {votePopUp = false} else {votePopUp = true};
+ switch (votePopUp) do {
+ case true: {CtrlShow [13017,false];CtrlShow [13016,true]};
+ case false: {CtrlShow [13016,false];CtrlShow [13017,true]};
+ };
+ };
+
+ if (MenuAction == 6) then {
+ MenuAction = -1;
+ currentFX = lbCurSel 13018;
+ [currentFX] Spawn FX;
+ };
+
+ if (_currentVD != _lastvd) then {setViewDistance _currentVD};
+ if (currentTG != _lasttg) then {setTerrainGrid currentTG};
+ _lastvd = _currentVD;
+ _lasttg = currentTG;
+
+ if (_timer > 2) then {ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]];_timer = 0};
+ _timer = _timer + 0.05;
+};
diff --git a/Client/GUI/GUI_TeamOrders.sqf b/Client/GUI/GUI_TeamOrders.sqf
new file mode 100644
index 0000000..3b67594
--- /dev/null
+++ b/Client/GUI/GUI_TeamOrders.sqf
@@ -0,0 +1,571 @@
+private ["_display","_mode","_updateProperties","_updateRespawn","_updateTab","_IDCTeam",
+"_IDCTasks","_IDCDetails","_TaskTypes","_TaskDuration","_TaskDurationLabel","_radio","_radioLabel",
+"_detailGroup","_u","_templates","_curSel","_team","_index","_txt","_map","_behaviors","_combatModes",
+"_formations","_speeds","_structures","_hq","_structuresLbl","_nearest","_nearTown","_type","_lbl",
+"_fillList","_isAll","_enable","_currentCoord","_currentMission","_position","_special","_isDisabled","_color",
+"_order","_isAdded","_array","_existingStruct","_closest","_id","_supplyB","_supply","_taskType",
+"_taskTime","_taskTimeLabel","_curType","_behavior","_combat","_formation","_speed","_to","_respawn","_iddx","_unit"];
+
+disableSerialization;
+
+MenuAction = -1;
+mouseButtonUp = -1;
+_display = _this select 0;
+
+//--- Alt.
+_mode = 0; //--- Team properties.
+
+_updateProperties = true;
+_updateRespawn = true;
+_updateTab = false;
+
+_IDCTeam = [14009,14010,14016,14017,14018,14019,14020,14021,14022,14023,14024,14025,14026,14027,14030,14031,14901,14902];
+_IDCTasks = [14017,14018,14021,14022,14030,14032];
+_IDCDetails = [14030,14041,14042,14043];
+{ctrlShow[_x,false]} forEach (_IDCTasks + _IDCDetails);
+{ctrlShow[_x,true]} forEach _IDCTeam;
+_TaskTypes = ["Assist","Attack","Defend","Destroy","Guard","Hold","Patrol","Move","Search and Destroy","Seize","Support"];
+_TaskDuration = [1,2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60];
+_TaskDurationLabel = ["1 Min","2 Min","3 Min","4 Min","5 Min","6 Min","7 Min","8 Min","9 Min","10 Min","15 Min","20 Min","25 Min","30 Min","35 Min","40 Min","45 Min","50 Min","55 Min","60 Min"];
+_radio = ["all","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa"];
+_radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa"];
+_detailGroup = [];
+
+ctrlSetText [14026,localize "STR_WF_Respawn" + " :"];
+
+_listbox_teams = _display displayCtrl 14012;
+_u = 1;
+lbAdd[14012,localize "STR_WF_All"];
+{lbAdd [14012,Format["[%1] %2",_u,name (leader _x)]];_u = _u + 1} forEach clientTeams;
+lbSetCurSel [14012,1];
+
+_templates = Format["WFBE_%1AITEAMTEMPLATEDESCRIPTIONS",sideJoinedText] Call GetNamespace;
+_templates_upgrades = Format["WFBE_%1AITEAMUPGRADES",sideJoinedText] Call GetNamespace;
+_upgrades = (sideJoined) Call GetSideUpgrades;
+_u = 0;
+_i = 0;
+{
+ _temp_upgr = _templates_upgrades select _i;
+
+ _canAdd = true;
+ for '_k' from 0 to 3 do {
+ if ((_temp_upgr select _k) > (_upgrades select _k)) exitWith {_canAdd = false};
+ };
+
+ if (_canAdd) then {
+ lbAdd [14010,_x];
+ lbSetValue [14010, _u, _i];
+ _u = _u + 1;
+ };
+ _i = _i + 1;
+} forEach _templates;
+lbSort (_display displayCtrl 14010);
+
+_curSel = lbCurSel 14012;
+_teams = [];
+_team = if (_curSel != 0) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)};
+
+_index = (_team) Call GetTeamType;
+if (_index == -1) then {_index = 1};
+lbSetCurSel [14010,[14010,_index] Call UIFindLBValue];
+
+_txt = (_team) Call GetTeamMoveMode;
+if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_TakeTowns"};
+if (_txt == "move") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Move"};
+if (_txt == "patrol") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Patrol"};
+if (_txt == "defense") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Defense"};
+ctrlSetText [14013,_txt];
+
+_map = _display displayCtrl 14002;
+//_map ctrlMapAnimAdd [1,.075,getPos (leader(clientTeams select 0))];
+//ctrlMapAnimCommit _map;
+
+ctrlEnable [14015,false];
+ctrlEnable [14014,false];
+
+//--- Set the combo properties.
+_behaviors = ["AWARE","CARELESS","COMBAT","SAFE","STEALTH"];
+_combatModes = ["BLUE","GREEN","RED","WHITE","YELLOW"];
+_formations = ["COLUMN","DIAMOND","ECH LEFT","ECH RIGHT","FILE","LINE","STAG COLUMN","VEE","WEDGE"];
+_speeds = ["LIMITED","FULL","NORMAL"];
+
+{lbAdd [14017, _x]} forEach _behaviors;
+{lbAdd [14018, _x]} forEach _combatModes;
+{lbAdd [14019, _x]} forEach _formations;
+{lbAdd [14020, _x]} forEach _speeds;
+
+_structures = [""];
+_hq = (sideJoinedText) Call GetSideHQ;
+if (alive _hq) then {_structures = _structures + [_hq]};
+_structures = _structures + ((sideJoinedText) Call GetSideStructures);
+_structuresLbl = ["Default"];
+lbAdd[14025,"Default"];
+
+{
+ if (typeName _x == "OBJECT") then {
+ _nearest = [_x,towns] Call SortByDistance;
+ _nearTown = (_nearest select 0) getVariable 'name';
+ _type = [typeOf _x, 'displayName'] Call GetConfigInfo;
+ _lbl = _type + ' ' + _nearTown + ' ' + str (round(player distance _x)) + 'M';
+ _structuresLbl = _structuresLbl + [_lbl];
+ lbAdd[14025,_lbl];
+ };
+} forEach _structures;
+
+while {alive player && dialog} do {
+ sleep 0.1;
+ if (side player != sideJoined) exitWith {activeAnimMarker = false;closeDialog 0};
+ if (!dialog) exitWith {activeAnimMarker = false};
+
+ if (MenuAction == 601) then {if (_mode != 0) then {_updateTab = true};_mode = 0};//--- Team properties.
+ if (MenuAction == 602) then {if (_mode != 1) then {_updateTab = true};_mode = 1};//--- Task.
+ if (MenuAction == 603) then {if (_mode != 2) then {_updateTab = true};_mode = 2};//--- Task.
+
+ _curSel = lbCurSel 14012;
+ _isAll = if (_curSel == 0 || (0 in _teams)) then {true} else {false};
+ _team = if !(_isAll) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)};
+ _teams = lbSelection _listbox_teams;
+
+ if (_updateTab) then {
+ switch (_mode) do {
+ case 0: {
+ {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTasks);
+ {ctrlShow[_x,true]} forEach _IDCTeam;
+ ctrlSetText[14021,localize "STR_WF_Behavior"];
+ ctrlSetText[14022,localize "STR_WF_CombatMode"];
+ ctrlSetText[14030,localize "STR_WF_TeamsSetting"];
+ lbClear 14017;
+ lbClear 14018;
+ {lbAdd [14017, _x]} forEach _behaviors;
+ {lbAdd [14018, _x]} forEach _combatModes;
+ _updateProperties = true;
+ };
+ case 1: {
+ {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTeam);
+ {ctrlShow[_x,true]} forEach _IDCTasks;
+ lbClear 14017;
+ lbClear 14018;
+ {lbAdd [14017, _x]} forEach _TaskTypes;
+ {lbAdd [14018, _x]} forEach _TaskDurationLabel;
+ ctrlSetText[14021,localize "STR_WF_TaskTO" + " :"];
+ ctrlSetText[14022,localize "STR_WF_TaskTO_Time" + " :"];
+ ctrlSetText[14030,localize "STR_WF_Tasks"];
+ lbSetCurSel[14017,0];
+ lbSetCurSel[14018,0];
+ };
+ case 2: {
+ {ctrlShow[_x,false]} forEach (_IDCTasks + _IDCTeam);
+ {ctrlShow[_x,true]} forEach _IDCDetails;
+ ctrlSetText[14030,localize "STR_WF_TeamsDetails"];
+ _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ _enable = if !(isPlayer leader _team) then {true} else {false};
+ ctrlEnable [14043,_enable];
+ _enable = if !(isPlayer (vehicle leader _team) && vehicle leader _team != leader _team) then {true} else {false};
+ ctrlEnable [14042,_enable];
+ };
+ };
+ _updateTab = false;
+ };
+
+ _txt = (_team) Call GetTeamMoveMode;
+ if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_TakeTowns"};
+ if (_txt == "move") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Move"};
+ if (_txt == "patrol") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Patrol"};
+ if (_txt == "defense") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Defense"};
+ ctrlSetText [14013,_txt];
+
+ //--- Team Funds.
+ ctrlSetText [14028,Format [localize 'STR_WF_Cash',str ((_team) Call GetTeamFunds)]];
+
+ if (MenuAction == 1) then {
+ MenuAction = -1;
+ activeAnimMarker = false;
+
+ _index = (_team) Call GetTeamType;
+ _currentCoord = (_team) Call GetTeamMovePos;
+ _currentMission = (_team) Call GetTeamMoveMode;
+ if (typeName _currentCoord == "ARRAY") then {
+ if (count _currentCoord > 0) then {
+ _position = _currentCoord;
+ if (_currentMission == "move") then {["TempAnim",_position,"selector_selectedMission",1,"ColorOrange",1,1.2] Spawn MarkerAnim};
+ if (_currentMission == "patrol") then {["TempAnim",_position,"selector_selectedMission",1,"ColorYellow",1,1.2,"areaPatrol"] Spawn MarkerAnim};
+ if (_currentMission == "defense") then {["TempAnim",_position,"selector_selectedMission",1,"ColorRed",1,1.2] Spawn MarkerAnim};
+ };
+ };
+ if (typeName _currentCoord == "OBJECT") then {
+ if (_currentMission == "towns") then {["TempAnim",getPos _currentCoord,"selector_selectedMission",1,"ColorBlue",1,1.2] Spawn MarkerAnim};
+ };
+
+ _enable = if (isPlayer(leader _team)) then {false} else {true};
+ _special = if (_isAll) then {false} else {if !(isPlayer(leader _team)) then {true} else {false}};
+ ctrlEnable [14011,_special];
+ ctrlEnable [14014,_enable];
+ ctrlEnable [14015,_enable];
+
+ if (_enable) then {
+ _isDisabled = (_team) Call GetTeamAutonomous;
+ if (_isDisabled) then {
+ ctrlEnable [14014,true];
+ ctrlEnable [14015,false];
+ } else {
+ ctrlEnable [14015,true];
+ ctrlEnable [14014,false];
+ };
+ };
+ if (_index == -1) then {_index = 1};
+ lbSetCurSel [14010,[14010,_index] Call UIFindLBValue];
+ if (_mode == 0) then {
+ _updateProperties = true;
+ _updateRespawn = true;
+ };
+ if (_mode == 2) then {
+ _detailGroup = if !(_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ _enable = if !(isPlayer leader _team) then {true} else {false};
+ ctrlEnable [14043,_enable];
+ };
+ };
+
+ //--- Focus.
+ if (MenuAction == 2) then {
+ MenuAction = -1;
+
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [2,.075,getPos(leader _team)];
+ ctrlMapAnimCommit _map;
+ };
+
+ //--- Focus (AI Sub).
+ if (MenuAction == 3) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _map ctrlMapAnimAdd [1,.095,getPos (_detailGroup select _iddx)];
+ ctrlMapAnimCommit _map;
+ };
+ };
+
+ //--- Take Towns.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ if (!_isAll) then {
+ [_team,'towns'] Call SetTeamMoveMode;
+ } else {
+ {[_x,'towns'] Call SetTeamMoveMode} forEach clientTeams;
+ };
+ activeAnimMarker = false;
+ };
+
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ //--- Move | Patrol | Defend.
+ if (MenuAction == 102 || MenuAction == 103 || MenuAction == 104) then {
+ _color = "";
+ _order = "";
+ _isAdded = "";
+ switch (MenuAction) do {
+ case 102: {_color = "ColorOrange";_order = "MOVE"};
+ case 103: {_color = "ColorYellow";_order = "PATROL";_isAdded = "areaPatrol"};
+ case 104: {_color = "ColorRed";_order = "DEFENSE"};
+ };
+ MenuAction = -1;
+ _position = _map posScreenToWorld[mouseX,mouseY];
+
+ [_curSel,_position,_order,_isAll,_teams] Spawn {
+ Private ["_curSel","_isAll","_order","_position","_radio","_radioLabel","_sideTeam","_teams"];
+ _curSel = _this select 0;
+ _position = _this select 1;
+ _order = _this select 2;
+ _isAll = _this select 3;
+ _teams = _this select 4;
+ //_radio = ["all","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","yankee","zulu"];
+ _radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu"];
+ if (!_isAll) then {
+ _sideTeam = "Team ";
+ for '_i' from 0 to count _teams-1 do {
+ _selected = clientTeams select ((_teams select _i) - 1);
+ _sideTeam = _sideTeam + (_radioLabel select (_teams select _i));
+ if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "};
+ };
+
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,_position] Call SetTeamMovePos;
+ [_selected,_order] Call SetTeamMoveMode;
+ } forEach _teams;
+ } else {
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+ {
+ [_x,_position] Call SetTeamMovePos;
+ [_x,_order] Call SetTeamMoveMode;
+ } forEach clientTeams;
+ };
+ };
+
+ activeAnimMarker = false;
+ _array = if (_isAdded == "") then {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2]} else {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2,_isAdded]};
+ _array Spawn MarkerAnim;
+ };
+
+ //--- Sell Building.
+ if (MenuAction == 105) then {
+ MenuAction = -1;
+ _position = _map posScreenToWorld[mouseX,mouseY];
+ _structures = (sideJoinedText) Call GetSideStructures;
+ _existingStruct = [_position,_structures] Call SortByDistance;
+ if (count _existingStruct > 0) then {
+ _closest = _existingStruct select 0;
+ //--- 100 meters close only.
+ if (_closest distance _position < 100 && isNil {_closest getVariable "WFBE_SOLD"}) then {
+ //--- Spawn a sell thread.
+ (_closest) Spawn {
+ Private ["_closest","_delay","_id","_supplyB","_type"];
+ _closest = _this;
+ _closest setVariable ["WFBE_SOLD", true];
+ _delay = 'WFBE_BUILDINGSELLDELAY' Call GetNamespace;
+ _type = typeOf _closest;
+
+ //--- Inform the side (before).
+ WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSell',_type,_delay]];
+ publicVariable 'WFBE_LocalizeMessage';
+ ['StructureSell',_type,_delay] Spawn CLTFNCLocalizeMessage;
+
+ sleep _delay;
+
+ if !(alive _closest) exitWith {};
+
+ _id = (Format ["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace) find _type;
+
+ //--- TODO: Change the find system with a getvar system.
+ if (_id > 0) then {
+ _supplyB = (Format ["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace) select _id;
+ _supplyB = round((_supplyB * ('WFBE_STRUCTURESELLPERCENT' Call GetNamespace)) / 100);
+
+ if !(paramMoneyOnly) then {[sideJoined, _supplyB] Call ChangeSideSupply} else {(_supplyB) Call ChangePlayerFunds};
+ };
+
+ //--- Inform the side.
+ WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSold',_type]];
+ publicVariable 'WFBE_LocalizeMessage';
+ ['StructureSold',_type] Spawn CLTFNCLocalizeMessage;
+ if (paramUseWorkers) then {_closest setVariable ["sold",true,true]};
+ _closest setDammage 1;
+ };
+ };
+ };
+ };
+
+ //--- Set a Task.
+ if (MenuAction == 306) then {
+ MenuAction = -1;
+ _taskType = _TaskTypes select (lbCurSel 14017);
+ _taskTime = _TaskDuration select (lbCurSel 14018);
+ _taskTimeLabel = _TaskDurationLabel select (lbCurSel 14018);
+ _position = _map posScreenToWorld[mouseX,mouseY];
+ if (!_isAll) then {
+ _sideTeam = "Team ";
+ for '_i' from 0 to count _teams-1 do {
+ _selected = clientTeams select ((_teams select _i) - 1);
+ _sideTeam = _sideTeam + (_radioLabel select (_teams select _i));
+ if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "};
+ };
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+
+ {
+ _selected = clientTeams select (_x - 1);
+ if (alive (leader _selected)) then {
+ WFBE_SetTask = [vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]];
+ publicVariable 'WFBE_SetTask';
+ if (isHostedServer) then {[vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF};
+ };
+ } forEach _teams;
+ } else {
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true];
+ WFBE_SetTask = [sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]];
+ publicVariable 'WFBE_SetTask';
+ if (isHostedServer) then {[sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF};
+ };
+ };
+ };
+
+ //--- Respawn.
+ if (MenuAction == 201) then {
+ MenuAction = -1;
+ [_team] Spawn {
+ Private ["_team","_units"];
+ _team = _this select 0;
+ _units = Units _team;
+ if (paramMobileRespawn || (('WFBE_RESPAWNCAMPSMODE' Call GetNamespace) > 0)) then {//--- Make sure that the unit won't spawn back at a camp/ambu.
+ [_team,"forceRespawn"] Call SetTeamRespawn;
+ sleep 2;
+ };
+ _units = _units + ([_team,false] Call GetTeamVehicles);
+ {_x setDammage 1} forEach _units;
+ };
+ };
+
+ //--- Auto AI.
+ if (MenuAction == 301) then {
+ MenuAction = -1;
+ _isDisabled = (_team) Call GetTeamAutonomous;
+ if (_isDisabled) then {
+ ctrlEnable [14015,true];
+ ctrlEnable [14014,false];
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,false] Call SetTeamAutonomous;
+ } forEach _teams;
+ } else {
+ {[_x,false] Call SetTeamAutonomous} forEach clientTeams;
+ };
+ } else {
+ ctrlEnable [14014,true];
+ ctrlEnable [14015,false];
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,true] Call SetTeamAutonomous;
+ } forEach _teams;
+ } else {
+ {[_x,true] Call SetTeamAutonomous} forEach clientTeams;
+ };
+ };
+ };
+
+ //--- Set buy Type
+ if (MenuAction == 302) then {
+ MenuAction = -1;
+ _curType = lbValue [14010, lbCurSel(14010)];
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,_curType] Call SetTeamType;
+ } forEach _teams;
+ } else {
+ {[_x,_curType] Call SetTeamType} forEach clientTeams;
+ };
+ };
+
+ //--- Set property to team.
+ if (MenuAction == 303) then {
+ MenuAction = -1;
+ _behavior = _behaviors select (lbCurSel(14017));
+ _combat = _combatModes select (lbCurSel(14018));
+ _formation = _formations select (lbCurSel(14019));
+ _speed = _speeds select (lbCurSel(14020));
+
+ //--- Locality, process on server.
+ _to = sideJoined;
+ if (!_isAll) then {
+ _to = [];
+ {
+ _selected = clientTeams select (_x - 1);
+ _to = _to + [_selected];
+ } foreach _teams;
+ };
+
+ WFBE_RequestTeamUpdate = ['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]];
+ publicVariable 'WFBE_RequestTeamUpdate';
+ if (isHostedServer) then {['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]] Spawn HandleSPVF};
+ };
+
+ //--- Set respawn.
+ if (MenuAction == 304) then {
+ MenuAction = -1;
+ _curSel = lbCurSel 14025;
+ if (_curSel == -1) then {_curSel = 0};
+ if (!_isAll) then {
+ {
+ _selected = clientTeams select (_x - 1);
+ [_selected,(_structures select _curSel)] Call SetTeamRespawn;
+ } forEach _teams;
+ } else {
+ {[_x,(_structures select _curSel)] Call SetTeamRespawn} forEach clientTeams;
+ };
+ };
+
+ //--- Update the respawn info.
+ if (_updateRespawn) then {
+ _updateRespawn = false;
+ _respawn = (_team) Call GetTeamRespawn;
+ _id = _structures find _respawn;
+ if (_id != -1) then {lbSetCurSel [14025,_id]} else {lbSetCurSel[14025,0]};
+ };
+
+ //--- Minimap update (Only refresh when the combo is selected).
+ if (MenuAction == 305 && _updateProperties) then {MenuAction = -1};
+ if (MenuAction == 305) then {
+ MenuAction = -1;
+ _curSel = lbCurSel 14025;
+ if (_curSel == -1) then {_curSel = 0};
+ if (typeName (_structures select _curSel) == "OBJECT") then {
+ _map ctrlMapAnimAdd [1,.095,getPos (_structures select _curSel)];
+ ctrlMapAnimCommit _map;
+ };
+ };
+
+ //--- Units Details.
+ if (MenuAction == 401) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _unit = _detailGroup select _iddx;
+ _enable = if (!(isPlayer (vehicle _unit)) && vehicle _unit != _unit) then {true} else {false};
+ ctrlEnable [14042,_enable];
+ };
+ };
+
+ //--- Units Details (Unflip)
+ if (MenuAction == 402) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _unit = _detailGroup select _iddx;
+ if ((getPos _unit select 2) < 5) then {
+ _unit setPos [getPos _unit select 0,getpos _unit select 1,0.5];
+ _unit setVelocity [0,0,-1];
+ _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ };
+ };
+ };
+
+ //--- Units Details (Disband)
+ if (MenuAction == 403) then {
+ MenuAction = -1;
+ _iddx = lnbCurSelRow 14041;
+ if (_iddx != -1) then {
+ _unit = _detailGroup select _iddx;
+ _unit setDamage 1;
+ _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]};
+ [_detailGroup,14041] Call UIFillListTeamOrders;
+ };
+ };
+
+ //--- Update team properties.
+ if (_updateProperties) then {
+ _updateProperties = false;
+ _behavior = behaviour (leader _team);
+ _combat = combatMode (leader _team);
+ _formation = formation (leader _team);
+ _speed = speedMode (leader _team);
+
+ //--- Behavior.
+ _id =_behaviors find _behavior;
+ if (_id != -1) then {lbSetCurSel [14017,_id]};
+ //--- Combat Mode.
+ _id =_combatModes find _combat;
+ if (_id != -1) then {lbSetCurSel [14018,_id]};
+ //--- Formation.
+ _id =_formations find _formation;
+ if (_id != -1) then {lbSetCurSel [14019,_id]};
+ //--- Speed.
+ _id =_speeds find _speed;
+ if (_id != -1) then {lbSetCurSel [14020,_id]};
+ };
+};
+
+activeAnimMarker = false;
diff --git a/Client/GUI/GUI_UnitsCamera.sqf b/Client/GUI/GUI_UnitsCamera.sqf
new file mode 100644
index 0000000..2a71926
--- /dev/null
+++ b/Client/GUI/GUI_UnitsCamera.sqf
@@ -0,0 +1,91 @@
+
+private ["_n","_objects","_units","_currentUnit","_cameraSwap","_near","_list","_selected","_currentMode","_display","_cameraModes","_id","_type","_map"];
+disableSerialization;
+_display = _this select 0;
+MenuAction = -1;
+mouseButtonUp = -1;
+
+_cameraModes = ["Internal","External","Gunner","Group"];
+
+_n = 1;
+{lbAdd[21002,Format["[%1] %2",_n,name (leader _x)]];_n = _n + 1} forEach clientTeams;
+_id = clientTeams find playerTeam;
+lbSetCurSel[21002,_id];
+_currentUnit = (player) Call GetUnitVehicle;
+_currentMode = "Internal";
+_currentUnit switchCamera _currentMode;
+_units = (Units (group player) - [player]) Call GetLiveUnits;
+{lbAdd[21004,Format["(%1) %2",getText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units;
+
+_type = if (!(difficultyEnabled "3rdPersonView")) then {["Internal"]} else {["Internal","External","Ironsight","Group"]};
+{lbAdd[21006,_x]} forEach _type;
+lbSetCurSel[21006,0];
+
+_map = _display displayCtrl 21007;
+_map ctrlMapAnimAdd [0,.25,getPos _currentUnit];
+ctrlMapAnimCommit _map;
+
+while {true} do {
+ sleep 0.1;
+
+ _cameraSwap = false;
+ if (Side player != sideJoined || !dialog) exitWith {};
+
+ //--- Map click.
+ if (mouseButtonUp == 0) then {
+ mouseButtonUp = -1;
+ _near = _map PosScreenToWorld[mouseX,mouseY];
+ _list = _near nearEntities [["Man","Car","Motorcycle","Ship","Tank","Air"],200];
+ if (count _list > 0) then {
+ _objects = [];
+ {if (!(_x isKindOf "Man") && side _x != sideJoined) then {if (count (crew _x) == 0) then {_objects = _objects - [_x]}};if (side _x == sideJoined) then {_objects = _objects + [_x]}} forEach _list;
+ if (count _objects > 0) then {
+ _units = [_near,_objects] Call SortByDistance;
+ _currentUnit = (_units select 0) Call GetUnitVehicle;
+ _cameraSwap = true;
+ };
+ };
+ };
+
+ //--- Leader Selection.
+ if (MenuAction == 101) then {
+ MenuAction = -1;
+ _selected = leader (clientTeams select (lbCurSel 21002));
+ _currentUnit = (_selected) Call GetUnitVehicle;
+ _n = 0;
+ _units = (Units (group _selected) - [_selected]) Call GetLiveUnits;
+ lbClear 21004;
+ {lbAdd[21004,Format["(%1) %2",GetText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units;
+ _cameraSwap = true;
+ };
+
+ //--- Leader commands AIs.
+ if (MenuAction == 102) then {
+ MenuAction = -1;
+ _currentUnit = (_units select (lbCurSel 21004)) Call GetUnitVehicle;
+ _cameraSwap = true;
+ };
+
+ //--- Camera Modes
+ if (MenuAction == 103) then {
+ MenuAction = -1;
+ _currentMode = (_cameraModes select (lbCurSel 21006));
+ _cameraSwap = true;
+ };
+
+ if !(alive _currentUnit) then {
+ _currentUnit = (player) Call GetUnitVehicle;
+ _cameraSwap = true;
+ };
+
+ //--- Update the Camera.
+ if (_cameraSwap) then {
+ ctrlMapAnimClear _map;
+ _map ctrlMapAnimAdd [1,.25,getPos _currentUnit];
+ ctrlMapAnimCommit _map;
+ _currentUnit switchCamera _currentMode;
+ };
+};
+
+closeDialog 0;
+((player) Call GetUnitVehicle) switchCamera _currentMode; \ No newline at end of file
diff --git a/Client/GUI/GUI_UpdateCommanderVoteMenu.sqf b/Client/GUI/GUI_UpdateCommanderVoteMenu.sqf
new file mode 100644
index 0000000..b710999
--- /dev/null
+++ b/Client/GUI/GUI_UpdateCommanderVoteMenu.sqf
@@ -0,0 +1,74 @@
+
+private ["_exit","_name","_playerSlots","_refresh","_count","_reselect","_total","_selection","_selected","_selectedTeam",
+"_lastVotes","_AI","_lastTeams","_lastTeam","_commanderTeam","_voteTime","_votes"];
+_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];
+if (_voteTime <= 0) exitWith {};
+
+_name = "";
+_lastTeams = [];
+_lastTeam = -2;
+
+_lastVotes = [sideJoined] Call GetCommanderVotes;
+
+while {true} do {
+ sleep 0.1;
+
+ if (!(alive player) || Side player != sideJoined) exitWith {CloseDialog 0;_exit = true};
+ if !(dialog) exitWith {};
+
+ _commanderTeam = [sideJoined] Call GetCommanderFromVotes;
+ if (IsNull _commanderTeam) then {_name = Localize "STR_WF_AI"} else {_name = name leader _commanderTeam};
+
+ _voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];
+ ctrlSetText [10007,Format ["(%1) %2: %3",_name,Localize "STR_WF_TimeLeft",_voteTime]];
+
+ if (_voteTime <= 0) exitWith {CloseDialog 0};
+
+ _refresh = false;
+ _playerSlots = [];
+ {
+ if !(isNil '_x') then {if (isPlayer (leader _x)) then {_playerSlots = _playerSlots + [_x]}};
+ } forEach clientTeams;
+
+ _count = 0;
+ _votes = [sideJoined] Call GetCommanderVotes;
+
+ {if (_x != (_votes Select _count)) then {_refresh = true};_count = _count + 1} ForEach _lastVotes;
+ {if !(_x In _lastTeams) then {_refresh = true}} ForEach _playerSlots;
+ {if !(_x In _playerSlots) then {_refresh = true}} ForEach _lastTeams;
+
+ if (_refresh) then {
+
+ _reselect = false;
+ _selected = lbCurSel 10006;
+ _selectedTeam = lbValue[10006,_selected];
+ _lastVotes = _votes;
+
+ if (_selected != -1) then {_reselect = true};
+
+ lbClear 10006;
+ _AI = lbAdd[10006,Format["%1 [%2]",_votes select 0,Localize "STR_WF_AI"]];
+ lbSetValue [10006,_AI,-1];
+
+ _count = 0;
+ _total = 1;
+
+ {
+ if !(isNil '_x') then {if (_x In _playerSlots) then {_total = _total + 1;_selection = lbAdd[10006,Format ["%1 %2",_votes select _count+1,name (leader _x)]];lbSetValue [10006,_selection,_count]}};_count = _count + 1;
+ } forEach clientTeams;
+ _lastTeams = +_playerSlots;
+
+ if (_reselect) then {
+ _selected = 0;
+ for [{_count = 0},{_count < _total},{_count = _count + 1}] do {if (lbValue[10006,_count] == _selectedTeam) then {_selected = _count}};
+ lbSetCurSel[10006,_selected];
+ };
+ };
+
+ _selected = lbCurSel 10006;
+ if (_selected != -1) then {
+ _selectedTeam = lbValue[10006,_selected];
+ if (_selectedTeam != _lastTeam) then {Call Compile Format["%1Team%2Vote = %3;publicVariable '%1Team%2Vote';",sideJoinedText,clientID,_selectedTeam]};
+ _lastTeam = _selectedTeam;
+ };
+}; \ No newline at end of file
diff --git a/Client/GUI/GUI_Upgrade.sqf b/Client/GUI/GUI_Upgrade.sqf
new file mode 100644
index 0000000..8f5b4ba
--- /dev/null
+++ b/Client/GUI/GUI_Upgrade.sqf
@@ -0,0 +1,198 @@
+
+private ["_controls","_u","_curIDC","_level","_maxLevel","_dependencie","_condition","_val","_enabled","_dependent","_colorSupply","_hasFunds","_colorFunds","_canUpgrade","_tooltip_h","_tooltip_text_content","_name","_bpath","_time","_needed","_requiredSupply","_requiredFunds","_currentSupply","_currentFunds","_tooltip_w","_tooltip_x","_tooltip_y","_commander","_supply","_upgrades","_txt","_display","_tooltip","_tooltip_text","_upgr","_upgrlev","_upgrdep","_upgrcond"];
+disableSerialization;
+
+_display = _this select 0;
+displayUpgrade = "";
+
+MenuAction = -1;
+mouseX = -1;
+mouseY = -1;
+
+_requiredFunds = 0;
+_requiredSupply = 0;
+
+_tooltip = _display DisplayCtrl 18998;
+_tooltip_text = _display DisplayCtrl 18999;
+
+_controls = [];
+_u = 18001;
+_curIDC = _display DisplayCtrl _u;
+while {!isNull _curIDC} do {_controls = _controls + [_curIDC];_u = _u + 1;_curIDC = _display DisplayCtrl _u};
+
+_level = 0;
+_val = 0;
+_time = 0;
+_name = '';
+_tooltip_text_content = '';
+_canUpgrade = false;
+_dependent = false;
+_isUpgrading = false;
+_lastTimerUpdate = -5;
+_upgr = 'WFBE_UPGRADELABELS' Call GetNamespace;
+_upgrlev = 'WFBE_UPGRADELEVELS' Call GetNamespace;
+_upgrdep = 'WFBE_UPGRADEDEPENDENCIES' Call GetNamespace;
+_upgrcond = 'WFBE_UPGRADECONDITION' Call GetNamespace;
+
+while {alive player && dialog} do {
+ if (Side player != sideJoined) exitWith {closeDialog 0};
+ if !(dialog) exitWith {};
+
+ _upgrades = (sideJoinedText) Call GetSideUpgrades;
+
+ if (time - _lastTimerUpdate > 1) then {_lastTimerUpdate = time;_isUpgrading = Call Compile Format ["WFBE_%1_Upgrading",sideJoinedText]};
+
+ _u = 0;
+ {
+ _level = _upgrades select _u;
+ _maxLevel = _upgrlev select _u;
+ _dependencie = _upgrdep select _u;
+ _condition = _upgrcond select _u;
+ if (_level == _maxLevel) then {_x ctrlSetTextColor [0, 1, 0, 1]};
+ if (!_condition) then {_x ctrlSetTextColor [1, 0, 0, 1]};
+ if (count _dependencie > 0 && _level != _maxLevel && _condition) then {
+ if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then {
+ _x ctrlSetTextColor [1, 0, 0, 1];
+ } else {
+ if (_level != _maxLevel) then {
+ _x ctrlSetTextColor [0.75,0.75,0.75,1];
+ };
+ };
+ };
+ _u = _u + 1;
+ } forEach _controls;
+
+ //--- Tooltips.
+ if (displayUpgrade != "") then {
+
+ switch (displayUpgrade) do {
+ case "infantry": {_val = 0};
+ case "light": {_val = 1};
+ case "heavy": {_val = 2};
+ case "air": {_val = 3};
+ case "parachutist": {_val = 4};
+ case "uav": {_val = 5};
+ case "supply": {_val = 6};
+ case "ambuSpawn": {_val = 7};
+ case "airlift": {_val = 8};
+ case "flares": {_val = 9};
+ case "artillery": {_val = 10};
+ case "icbm": {_val = 11};
+ case "fasttravel": {_val = 12};
+ case "gear": {_val = 13};
+ case "ammo": {_val = 14};
+ case "easa": {_val = 15};
+ case "paradrop": {_val = 16};
+ case "shells": {_val = 17};
+ };
+
+ ctrlSetFocus (_controls select _val);
+
+ _dependencie = _upgrdep select _val;
+ _condition = _upgrcond select _val;
+ _maxLevel = _upgrlev select _val;
+ _name = _upgr select _val;
+ _level = _upgrades select _val;
+
+ _enabled = true;
+ if (!_condition) then {_enabled = false};
+ if (count _dependencie > 0 && _enabled) then {
+ if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then {
+ _dependent = true;
+ } else {_dependent = false};
+ } else {_dependent = false};
+
+ _bpath = if (_level == _maxLevel) then {_level} else {_level + 1};
+ _time = (Format["WFBE_UPGRADETIMESLEVEL%1",_bpath] Call GetNamespace) select _val;
+ _needed = (Format["WFBE_UPGRADEPRICESLEVEL%1",_bpath] Call GetNamespace) select _val;
+ _requiredSupply = _needed select 0;
+ _requiredFunds = _needed select 1;
+
+ _currentSupply = (sideJoined) Call GetSideSupply;
+ _currentFunds = Call GetPlayerfunds;
+
+ _colorSupply = "'#3366cc'";
+ _colorFunds = "'#3366cc'";
+ _hasFunds = true;
+ if !(paramMoneyOnly) then {if (_currentSupply < _requiredSupply) then {_colorSupply = "'#ff0033'";_hasFunds = false}};
+ if (_currentFunds < _requiredFunds) then {_colorFunds = "'#ff0033'";_hasFunds = false};
+
+ if (!_isUpgrading && _level < _maxLevel && !_dependent && _enabled && _hasFunds) then {_canUpgrade = true} else {_canUpgrade = false};
+
+ _tooltip_w = 0.28;
+ _tooltip_h = 0.18;
+ _tooltip_x = if ((1 - mouseX) < _tooltip_w) then {mouseX - _tooltip_w - 0.02} else {mouseX + 0.02};
+ _tooltip_y = if (mouseY > 0.5) then {mouseY - _tooltip_h - 0.02} else {mouseY + 0.02};
+
+ if (_level != _maxLevel) then {
+ _supplyCd = if !(paramMoneyOnly) then {Format ["<t size='0.8' color='#ffffff' font='Zeppelin33'> %1</t><br />",Format [localize 'STR_WF_Require',"<t color=" + _colorSupply + ">" + str(_requiredSupply) + '</t>' + '/' + "<t color='#3366cc'>" + str(_currentSupply) + '</t> S']]} else {""};
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#ff9900' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#ffffff' font='Zeppelin33'> %1</t><br />",Format [localize 'STR_WF_Level',"<t color='#3366cc'>" + str(_level) + '</t>' + "/<t color='#3366cc'>" + str(_maxLevel) + '</t>']] +
+ _supplyCd +
+ Format ["<t size='0.8' color='#ffffff' font='Zeppelin33'> %1</t><br />",Format [localize 'STR_WF_Require',"<t color=" + _colorFunds + ">" + str(_requiredFunds) + '</t>' + '/' + "<t color='#3366cc'>" + str(_currentFunds) + '</t> $']] +
+ Format ["<t size='0.8' color='#ffffff' font='Zeppelin33'> %1</t><br />",Format [localize 'STR_WF_Require',"<t color='#3366cc'>" + str(_time) + ' </t>' + localize 'STR_WF_Seconds']]
+ );
+
+ if (_isUpgrading) then {
+ _tooltip_h = 0.12;
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#ff9900' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#ff0033' font='Zeppelin33'> %1</t><br />",localize 'STR_WF_Upgrade_Running']
+ );
+ };
+ if (!_enabled) then {
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#ff9900' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#ff0033' font='Zeppelin33'> %1</t><br />",localize 'STR_WF_Upgrade_Condition']
+ );
+ };
+ if (_dependent && !_isUpgrading && _enabled) then {
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#ff9900' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#ff0033' font='Zeppelin33'> %1</t><br />",Format[localize 'STR_WF_Upgrade_Dependent',_upgr select (_dependencie select 0),_dependencie select 1]]
+ );
+ };
+ } else {
+ _tooltip_h = 0.12;
+ _tooltip_text_content = parsetext (
+ Format ["<t size='1.2' color='#ff9900' shadow='0'>%1:</t><br />",_name] +
+ Format ["<t size='0.8' color='#ff0033' font='Zeppelin33'> %1</t><br />",localize 'STR_WF_Upgrade_Maximum']
+ );
+ };
+
+ if ((ctrlPosition _tooltip select 0) == 0 || true) then {_tooltip ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]};
+ _tooltip ctrlCommit 0;
+
+ _tooltip_text ctrlSetStructuredText _tooltip_text_content;
+ if ((ctrlPosition _tooltip_text select 0) == 0 || true) then {_tooltip_text ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]};
+ _tooltip_text ctrlCommit 0;
+
+ } else {
+ if ((ctrlPosition _tooltip select 0) != 0) then {_tooltip ctrlSetPosition [0,0,0,0];_tooltip ctrlCommit 0};
+ if ((ctrlPosition _tooltip_text select 0) != 0) then {_tooltip_text ctrlSetPosition [0,0,0,0];_tooltip_text ctrlCommit 0};
+ };
+
+ _commander = false;
+ if (!isNull(commanderTeam)) then {
+ if (commanderTeam == group player) then {_commander = true};
+ };
+
+ if (MenuAction == 1 && _canUpgrade && _commander) then {
+ MenuAction = -1;
+ -(_requiredFunds) Call ChangePlayerFunds;
+ if !(paramMoneyOnly) then {[sideJoined, -_requiredSupply] Call ChangeSideSupply};
+
+ WFBE_RequestUpgrade = ['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]];
+ publicVariable 'WFBE_RequestUpgrade';
+ if (isHostedServer) then {['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]] Spawn HandleSPVF};
+
+ Call Compile Format ["WFBE_%1_Upgrading = false;",sideJoinedText];
+ hint Format [localize "STR_WF_Upgrade_Start",_name];
+ } else {MenuAction = -1};
+
+ _txt = if (_isUpgrading) then {localize "STR_WF_Upgrade_Running_Info" + "..."} else {""};
+ ctrlSetText[18802,_txt];
+
+ sleep 0.05;
+}; \ No newline at end of file