From 628d33984d9228f1781d13a65fbb80f35facc899 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:24 +0300 Subject: init --- Client/PVFunctions/AllCampsCaptured.sqf | 20 ++++++ Client/PVFunctions/AwardBounty.sqf | 19 ++++++ Client/PVFunctions/CampCaptured.sqf | 42 +++++++++++++ Client/PVFunctions/CanJoin.sqf | 7 +++ Client/PVFunctions/ChangeScore.sqf | 8 +++ Client/PVFunctions/CommanderVote.sqf | 11 ++++ Client/PVFunctions/DisplayICBM.sqf | 6 ++ Client/PVFunctions/EndGame.sqf | 9 +++ Client/PVFunctions/ISIS_AddAction.sqf | 5 ++ Client/PVFunctions/LocalizeMessage.sqf | 23 +++++++ Client/PVFunctions/M_BASE_Attack.sqf | 85 +++++++++++++++++++++++++ Client/PVFunctions/M_PLAYERS_Attack_Air.sqf | 28 +++++++++ Client/PVFunctions/M_TOWN_Attack.sqf | 84 +++++++++++++++++++++++++ Client/PVFunctions/M_UAV_RetrieveModule.sqf | 65 +++++++++++++++++++ Client/PVFunctions/Penalty.sqf | 9 +++ Client/PVFunctions/PerformAction.sqf | 10 +++ Client/PVFunctions/SetHQStatus.sqf | 5 ++ Client/PVFunctions/SetTask.sqf | 36 +++++++++++ Client/PVFunctions/SetVehicleLock.sqf | 1 + Client/PVFunctions/TownCaptured.sqf | 98 +++++++++++++++++++++++++++++ Client/PVFunctions/TownCapturedPublic.sqf | 96 ++++++++++++++++++++++++++++ Client/PVFunctions/UAV_Reveal.sqf | 27 ++++++++ Client/PVFunctions/VoteForCommander.sqf | 9 +++ 23 files changed, 703 insertions(+) create mode 100644 Client/PVFunctions/AllCampsCaptured.sqf create mode 100644 Client/PVFunctions/AwardBounty.sqf create mode 100644 Client/PVFunctions/CampCaptured.sqf create mode 100644 Client/PVFunctions/CanJoin.sqf create mode 100644 Client/PVFunctions/ChangeScore.sqf create mode 100644 Client/PVFunctions/CommanderVote.sqf create mode 100644 Client/PVFunctions/DisplayICBM.sqf create mode 100644 Client/PVFunctions/EndGame.sqf create mode 100644 Client/PVFunctions/ISIS_AddAction.sqf create mode 100644 Client/PVFunctions/LocalizeMessage.sqf create mode 100644 Client/PVFunctions/M_BASE_Attack.sqf create mode 100644 Client/PVFunctions/M_PLAYERS_Attack_Air.sqf create mode 100644 Client/PVFunctions/M_TOWN_Attack.sqf create mode 100644 Client/PVFunctions/M_UAV_RetrieveModule.sqf create mode 100644 Client/PVFunctions/Penalty.sqf create mode 100644 Client/PVFunctions/PerformAction.sqf create mode 100644 Client/PVFunctions/SetHQStatus.sqf create mode 100644 Client/PVFunctions/SetTask.sqf create mode 100644 Client/PVFunctions/SetVehicleLock.sqf create mode 100644 Client/PVFunctions/TownCaptured.sqf create mode 100644 Client/PVFunctions/TownCapturedPublic.sqf create mode 100644 Client/PVFunctions/UAV_Reveal.sqf create mode 100644 Client/PVFunctions/VoteForCommander.sqf (limited to 'Client/PVFunctions') diff --git a/Client/PVFunctions/AllCampsCaptured.sqf b/Client/PVFunctions/AllCampsCaptured.sqf new file mode 100644 index 0000000..f11973e --- /dev/null +++ b/Client/PVFunctions/AllCampsCaptured.sqf @@ -0,0 +1,20 @@ +Private ["_alertOtherSide","_camp","_camps","_count","_marker","_sideID","_town"]; + +_town = _this Select 0; +_sideID = _this Select 1; +_alertOtherSide = _this Select 2; + +_camps = _town getVariable "camps"; + +for [{_count = count _camps - 1},{_count >= 0},{_count = _count - 1}] do { + _camp = _camps select _count; + _marker = Format["%1Camp%2",str _town,_camps find _camp]; + + if (sideID == _sideID) then { + _marker setMarkerColorLocal ("Friendly" Call GetMarkerColoration); + } else { + if (_alertOtherSide || getMarkerColor _marker == ("Friendly" Call GetMarkerColoration)) then { + _marker setMarkerColorLocal ("Enemy" Call GetMarkerColoration); + }; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/AwardBounty.sqf b/Client/PVFunctions/AwardBounty.sqf new file mode 100644 index 0000000..6e80016 --- /dev/null +++ b/Client/PVFunctions/AwardBounty.sqf @@ -0,0 +1,19 @@ +Private["_assist","_bounty","_get","_name","_type"]; + +_type = _this select 0; +_assist = _this select 1; + +_get = _type Call GetNamespace; + +_name = _get select QUERYUNITLABEL; +_bounty = round((_get select QUERYUNITPRICE) * ('WFBE_BOUNTYMODIFIER' Call GetNamespace)); + +//--- Are we dealing with a kill assist or a full kill. +if (_assist) then { + _bounty = _bounty * ('WFBE_BOUNTYMODIFIERASSIST' Call GetNamespace); + Format[Localize "STR_WF_CHAT_Award_Bounty_Assist",_bounty,_name] Call GroupChatMessage; +} else { + Format[Localize "STR_WF_CHAT_Award_Bounty",_bounty,_name] Call GroupChatMessage; +}; + +_bounty Call ChangePlayerFunds; \ No newline at end of file diff --git a/Client/PVFunctions/CampCaptured.sqf b/Client/PVFunctions/CampCaptured.sqf new file mode 100644 index 0000000..0894a5e --- /dev/null +++ b/Client/PVFunctions/CampCaptured.sqf @@ -0,0 +1,42 @@ +Private ["_award","_camp","_camps","_index","_marker","_name","_captureSideID","_town","_townSideID","_units"]; + +_town = _this Select 0; +_captureSideID = _this Select 1; +_camp = _this Select 2; + +if !(clientInitComplete) exitWith {}; + +_camps = _town getVariable "camps"; +_name = _town getVariable "name"; +_townSideID = _town getVariable "sideID"; +_index = _camps find _camp; + +if (_index != -1) then { + _marker = Format["%1Camp%2",str _town,_index]; + if (sideID == _captureSideID) then { + _award = false; + if (Leader Group player == player) then { + _units = units group player; + {if (_x distance _camp < 5) then {_award = true}} forEach _units; + }; + + if (player Distance _camp < 5 || _award) then { + ('WFBE_CAMPCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURECAMP' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURECAMP' Call GetNamespace)]] Spawn HandleSPVF}; + Format[localize "STR_WF_CHAT_Camp_Captured_Bounty",_name,'WFBE_CAMPCAPTUREBOUNTY' Call GetNamespace] Call CommandChatMessage; + if (mysql) then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA§WFBE_Update§%1§%2§campcaptured§%3",getPlayerUID(player),name player,worldName]],true]; + }; + } else { + Format[localize "STR_WF_CHAT_Camp_Captured",_name] Call CommandChatMessage; + }; + _marker setMarkerColorLocal ("Friendly" Call GetMarkerColoration); + } else { + if (_townSideID == sideID || getMarkerColor _marker == ("Friendly" Call GetMarkerColoration)) then { + Format[localize "STRWFCAMPCAPTUREDBYENEMY",_name] Call CommandChatMessage; + _marker setMarkerColorLocal ("Enemy" Call GetMarkerColoration); + }; + }; +}; diff --git a/Client/PVFunctions/CanJoin.sqf b/Client/PVFunctions/CanJoin.sqf new file mode 100644 index 0000000..ad90ed8 --- /dev/null +++ b/Client/PVFunctions/CanJoin.sqf @@ -0,0 +1,7 @@ +Private ['_canjoin','_name']; +_name = _this select 0; +_canjoin = _this select 1; + +if (!_canjoin && vehicleVarName player != _name) then {_canjoin = true}; + +['WFBE_P_CANJOIN',_canjoin,true] Call SetNamespace; \ No newline at end of file diff --git a/Client/PVFunctions/ChangeScore.sqf b/Client/PVFunctions/ChangeScore.sqf new file mode 100644 index 0000000..583b4c1 --- /dev/null +++ b/Client/PVFunctions/ChangeScore.sqf @@ -0,0 +1,8 @@ +Private ["_newScore","_playerChanged","_oldScore"]; + +_playerChanged = _this select 0; +_newScore = _this select 1; + +_oldScore = score _playerChanged; +_playerChanged addScore -(_oldScore); +_playerChanged addScore _newScore; \ No newline at end of file diff --git a/Client/PVFunctions/CommanderVote.sqf b/Client/PVFunctions/CommanderVote.sqf new file mode 100644 index 0000000..30702ff --- /dev/null +++ b/Client/PVFunctions/CommanderVote.sqf @@ -0,0 +1,11 @@ +Private["_commanderTeam","_text"]; + +_commanderTeam = _this; + +_text = Localize "STR_WF_CHAT_AI_Commander"; +if (!IsNull _commanderTeam) then { + _text = Format[localize "STR_WF_CHAT_VoteForNewCommander",name (leader _commanderTeam)]; + if (group player == _commanderTeam) then {_text = localize "STR_WF_CHAT_PlayerCommander"}; +}; + +[_text] Call TitleTextMessage; \ No newline at end of file diff --git a/Client/PVFunctions/DisplayICBM.sqf b/Client/PVFunctions/DisplayICBM.sqf new file mode 100644 index 0000000..170c5a9 --- /dev/null +++ b/Client/PVFunctions/DisplayICBM.sqf @@ -0,0 +1,6 @@ +Private ["_cruise","_obj"]; + +_obj = _this select 0; +_cruise = _this select 1; +waitUntil {!alive _cruise || isNull _cruise}; +[_obj] Spawn Nuke; \ No newline at end of file diff --git a/Client/PVFunctions/EndGame.sqf b/Client/PVFunctions/EndGame.sqf new file mode 100644 index 0000000..890850e --- /dev/null +++ b/Client/PVFunctions/EndGame.sqf @@ -0,0 +1,9 @@ +Private["_blist","_side","_sideValue"]; + +_sideValue = _this select 0; +_blist = _this select 1; +gameOver = true; +_side = east; +if (_sideValue == WESTID) then {_side = west}; + +[_side,_blist] ExecVM "Client\Client_EndGame.sqf"; \ No newline at end of file diff --git a/Client/PVFunctions/ISIS_AddAction.sqf b/Client/PVFunctions/ISIS_AddAction.sqf new file mode 100644 index 0000000..26bd186 --- /dev/null +++ b/Client/PVFunctions/ISIS_AddAction.sqf @@ -0,0 +1,5 @@ +Private ["_unit"]; +_unit = _this; + +_unit setVariable ['hasAction',true]; +_unit addAction ["First Aid","Client\Module\ISIS\ISIS_Action.sqf", "", 2, false, true, "", "(_target getVariable 'stunned') && alive _target && _this != _target"]; \ No newline at end of file diff --git a/Client/PVFunctions/LocalizeMessage.sqf b/Client/PVFunctions/LocalizeMessage.sqf new file mode 100644 index 0000000..0dfbe80 --- /dev/null +++ b/Client/PVFunctions/LocalizeMessage.sqf @@ -0,0 +1,23 @@ +Private["_localize","_txt"]; + +_localize = _this select 0; + +_txt = ""; +switch (_localize) do { + case "BuildingTeamkill": {_txt = Format [Localize "STR_WF_CHAT_Teamkill_Building",_this select 1, _this select 2, _this select 3]}; + case "Teamswap": {_txt = Format [Localize "STR_WF_CHAT_Teamswap",_this select 1, _this select 2, _this select 3, _this select 4]}; + case "UpgradeComplete": {_txt = Format [Localize "STR_WF_CHAT_Upgrade_Complete_Message",('WFBE_UPGRADELABELS' Call GetNamespace) select (_this select 1), _this select 2]}; + case "CommanderDisconnected": {_txt = Localize "strwfcommanderdisconnected"}; + case "TacticalLaunch": {_txt = Localize "STR_WF_CHAT_ICBM_Launch"}; + case "Teamkill": {_txt = Format [Localize "STR_WF_CHAT_Teamkill",('WFBE_TEAMKILLPENALTY' Call GetNamespace)]; -('WFBE_TEAMKILLPENALTY' Call GetNamespace) Call ChangePlayerFunds}; + case "FundsTransfer": {_txt = Format [Localize "STR_WF_CHAT_FundsTransfer",_this select 1,_this select 2]}; + case "StructureSold": {_txt = Format [Localize "STR_WF_CHAT_Structure_Sold",([_this select 1,'displayName'] Call GetConfigInfo)]}; + case "StructureSell": {_txt = Format [Localize "STR_WF_CHAT_Structure_Sell",([_this select 1,'displayName'] Call GetConfigInfo),_this select 2]}; + case "SecondaryAward": {_txt = Format [Localize "STR_WF_CHAT_Secondary_Award",_this select 1, _this select 2];(_this select 2) Call ChangePlayerFunds}; +}; + +if (_localize != 'FundsTransfer') then { + _txt Call CommandChatMessage; +} else { + _txt Call GroupChatMessage; +}; \ No newline at end of file diff --git a/Client/PVFunctions/M_BASE_Attack.sqf b/Client/PVFunctions/M_BASE_Attack.sqf new file mode 100644 index 0000000..280505b --- /dev/null +++ b/Client/PVFunctions/M_BASE_Attack.sqf @@ -0,0 +1,85 @@ +Private ['_cpt','_exit','_groups','_id','_label','_marker','_markers','_properPos','_ranpos','_size','_target','_task','_tpos']; + +_size = _this select 0; +_label = _this select 1; +_id = _this select 2; +_target = _this select 3; +_groups = _this select 4; + +_marker = Format["%1%2",_label,_id]; +//--- Does the client already have the mission (jip handler, some client joining won't have it running)? +if (((getMarkerPos _marker) select 0) != 0 && ((getMarkerPos _marker) select 1) != 0) exitWith {}; + +_tpos = getPos _target; +_ranpos = [(_tpos select 0)-(random 50)+(random 50),(_tpos select 1)-(random 50)+(random 50)]; +_properPos = [(_ranpos select 0)-(_size / 2),(_ranpos select 1)-(_size / 2)]; + +//--- Inform the player about a new task. +taskHint [format [localize "str_taskNew" + "\n%1",localize 'STR_WF_M_BASE_Attack'], [1,1,1,1], "taskNew"]; + +//--- Task. +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +_task setSimpleTaskDescription [localize 'STR_WF_M_BASE_Attack_Description', localize 'STR_WF_M_BASE_Attack', localize 'STR_WF_M_BASE_Attack']; +_task setSimpleTaskDestination _ranpos; + +//--- Marker part. +_markers = [_marker]; +createMarkerLocal [_marker, _ranpos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "BORDER"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["0%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _ranpos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "FDIAGONAL"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["00%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _properPos]; +_marker setMarkerColorLocal "ColorRedAlpha"; +_marker setMarkerTypeLocal "mil_marker"; +_marker setMarkerSizeLocal [0.5,0.5]; +_marker setMarkerTextLocal "Targetted Area"; + +//--- Wait for the unit to be spawned. +waitUntil { + sleep 1; + + _exit = false; + { + if (count (units _x) > 0) then {_exit = true}; + } forEach _groups; + + _exit +}; + +//--- Mission run while the enemies are here. +waitUntil { + sleep 1; + + _cpt = 0; + { + if !(isNil '_x') then { + _cpt = _cpt + (count ((units _x) Call GetLiveUnits)); + }; + } forEach _groups; + + _cpt == 0 +}; + +sleep 10; + +//--- Validate the mission for the player. +_task setTaskState 'Succeeded'; +taskHint [format [localize "str_taskAccomplished" + "\n%1",localize 'STR_WF_M_BASE_Attack'], [1,1,1,1], "taskDone"]; + +{_x setMarkerColorLocal "ColorGreenAlpha"} forEach _markers; + +sleep 30; + +//--- Remove the task & markers. +player removeSimpleTask _task; +{deleteMarkerLocal _x} forEach _markers; \ No newline at end of file diff --git a/Client/PVFunctions/M_PLAYERS_Attack_Air.sqf b/Client/PVFunctions/M_PLAYERS_Attack_Air.sqf new file mode 100644 index 0000000..6f14195 --- /dev/null +++ b/Client/PVFunctions/M_PLAYERS_Attack_Air.sqf @@ -0,0 +1,28 @@ +Private ['_get','_id','_label','_marker','_task']; + +_chopper = _this select 0; +_label = _this select 1; +_id = _this select 2; + +_get = Format["WFBE_TSK_M_%1%2",_label,_id] Call GetNamespace; +if !(isNil '_get') exitWith {}; + +taskHint [format [localize "str_taskNew" + "\n%1",localize 'STR_WF_M_PLAYERS_Attack_Air'], [1,1,1,1], "taskNew"]; + +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +[Format["WFBE_TSK_M_%1%2",_label,_id],true,true] Call SetNamespace; +_task setSimpleTaskDescription [localize 'STR_WF_M_PLAYERS_Attack_Air_Description', localize 'STR_WF_M_PLAYERS_Attack_Air', localize 'STR_WF_M_PLAYERS_Attack_Air']; +_task setSimpleTaskTarget [_chopper, false]; + +//--- Wait for the result. +waitUntil {sleep 5; !alive _chopper}; + +_task setTaskState "Succeeded"; +taskHint [format [localize "str_taskAccomplished" + "\n%1",localize 'STR_WF_M_PLAYERS_Attack_Air'], [1,1,1,1], "taskDone"]; + +sleep 30; + +[Format["WFBE_TSK_M_%1%2",_label,_id],nil,true] Call SetNamespace; + +//--- Remove the task & markers. +player removeSimpleTask _task; \ No newline at end of file diff --git a/Client/PVFunctions/M_TOWN_Attack.sqf b/Client/PVFunctions/M_TOWN_Attack.sqf new file mode 100644 index 0000000..1f3dbd3 --- /dev/null +++ b/Client/PVFunctions/M_TOWN_Attack.sqf @@ -0,0 +1,84 @@ +Private ['_cpt','_exit','_groups','_id','_label','_marker','_markers','_properPos','_size','_task','_town','_townPos']; + +_size = _this select 0; +_label = _this select 1; +_id = _this select 2; +_town = _this select 3; +_groups = _this select 4; + +_marker = Format["%1%2",_label,_id]; +//--- Does the client already have the mission (jip handler, some client joining won't have it running)? +if (((getMarkerPos _marker) select 0) != 0 && ((getMarkerPos _marker) select 1) != 0) exitWith {}; + +_townPos = getPos _town; +_properPos = [(_townPos select 0)-(_size / 2),(_townPos select 1)-(_size / 2)]; + +//--- Inform the player about a new task. +taskHint [format [localize "str_taskNew" + "\n%1",Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"]], [1,1,1,1], "taskNew"]; + +//--- Task. +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +_task setSimpleTaskDescription [Format[localize 'STR_WF_M_TOWN_Attack_Description',_town getVariable "name"], Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"], Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"]]; +_task setSimpleTaskDestination _properPos; + +//--- Marker part. +_markers = [_marker]; +createMarkerLocal [_marker, _townPos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "BORDER"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["0%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _townPos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "FDIAGONAL"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["00%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _properPos]; +_marker setMarkerColorLocal "ColorRedAlpha"; +_marker setMarkerTypeLocal "mil_marker"; +_marker setMarkerSizeLocal [0.5,0.5]; +_marker setMarkerTextLocal "Targetted Area"; + +//--- Wait for the unit to be spawned. +waitUntil { + sleep 1; + + _exit = false; + { + if (count (units _x) > 0) then {_exit = true}; + } forEach _groups; + + _exit +}; + +//--- Mission run while the enemies are here. +waitUntil { + sleep 1; + + _cpt = 0; + { + if !(isNil '_x') then { + _cpt = _cpt + (count ((units _x) Call GetLiveUnits)); + }; + } forEach _groups; + + _cpt == 0 +}; + +sleep 10; + +//--- Validate the mission for the player. +_task setTaskState 'Succeeded'; +taskHint [format [localize "str_taskAccomplished" + "\n%1", Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"]], [1,1,1,1], "taskDone"]; + +{_x setMarkerColorLocal "ColorGreenAlpha"} forEach _markers; + +sleep 30; + +//--- Remove the task & markers. +player removeSimpleTask _task; +{deleteMarkerLocal _x} forEach _markers; \ No newline at end of file diff --git a/Client/PVFunctions/M_UAV_RetrieveModule.sqf b/Client/PVFunctions/M_UAV_RetrieveModule.sqf new file mode 100644 index 0000000..60f734f --- /dev/null +++ b/Client/PVFunctions/M_UAV_RetrieveModule.sqf @@ -0,0 +1,65 @@ +Private ['_id','_label','_marker','_markerRanPos','_markers','_randomPos','_searchArea','_sideWin','_size','_task','_taskState','_uav']; + +_size = _this select 0; +_label = _this select 1; +_id = _this select 2; +_uav = _this select 3; + +_marker = Format["%1%2",_label,_id]; +//--- Does the client already have the mission (jip handler, some client joining won't have it running)? +if (((getMarkerPos _marker) select 0) != 0 && ((getMarkerPos _marker) select 1) != 0) exitWith {}; + +taskHint [format [localize "str_taskNew" + "\n%1",localize 'STR_WF_M_UAV_RetrieveModule'], [1,1,1,1], "taskNew"]; + +_randomPos = getPos _uav; + +//--- Determine the marker random area. +_searchArea = (_size/1.5); +_markerRanPos = [(_randomPos select 0)+random(_searchArea)-random(_searchArea),(_randomPos select 1)+random(_searchArea)-random(_searchArea)]; + +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +_task setSimpleTaskDescription [localize 'STR_WF_M_UAV_RetrieveModule_Description', localize 'STR_WF_M_UAV_RetrieveModule', localize 'STR_WF_M_UAV_RetrieveModule']; +_task setSimpleTaskDestination _markerRanPos; + +//--- Marker part. +_markers = [_marker]; +createMarkerLocal [_marker, _markerRanPos]; +_marker setMarkerColorLocal "ColorYellow"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "BORDER"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["0%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _markerRanPos]; +_marker setMarkerColorLocal "ColorYellow"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "FDIAGONAL"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["00%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _markerRanPos]; +_marker setMarkerColorLocal "ColorYellow"; +_marker setMarkerTypeLocal "pickup"; +_marker setMarkerSizeLocal [0.5,0.5]; +_marker setMarkerTextLocal "UAV Crash Site"; + +//--- Wait for the result. +waitUntil {sleep 5; _sideWin = _uav getVariable 'side'; !(isNil '_sideWin')}; +_taskState = if (side player == (_uav getVariable 'side')) then {"Succeeded"} else {"Failed"}; + +//--- Wait for mission completion. +waitUntil {sleep 5; (isNull _uav)}; + +_task setTaskState _taskState; + +if (_taskState == 'Succeeded') then { + taskHint [format [localize "str_taskAccomplished" + "\n%1",localize 'STR_WF_M_UAV_RetrieveModule'], [1,1,1,1], "taskDone"]; +} else { + taskHint [format [localize "str_taskFailed" + "\n%1",localize 'STR_WF_M_UAV_RetrieveModule'], [1,1,1,1], "taskFailed"]; +}; + +sleep 30; + +//--- Remove the task & markers. +player removeSimpleTask _task; +{deleteMarkerLocal _x} forEach _markers; \ No newline at end of file diff --git a/Client/PVFunctions/Penalty.sqf b/Client/PVFunctions/Penalty.sqf new file mode 100644 index 0000000..2ae2291 --- /dev/null +++ b/Client/PVFunctions/Penalty.sqf @@ -0,0 +1,9 @@ +Private['_fee','_pfunds','_result']; + +_fee = 'WFBE_CIVILIANPENALTY' Call GetNamespace; +Format[Localize "STR_WF_CHAT_Penalty",_fee] Call GroupChatMessage; + +_pfunds = Call GetPlayerFunds; +_result = _pfunds - _fee; +if (_result < 0) then {_fee = _fee + _result}; +-(_fee) Call ChangePlayerFunds; \ No newline at end of file diff --git a/Client/PVFunctions/PerformAction.sqf b/Client/PVFunctions/PerformAction.sqf new file mode 100644 index 0000000..b57bfad --- /dev/null +++ b/Client/PVFunctions/PerformAction.sqf @@ -0,0 +1,10 @@ +Private ['_action','_from','_unit']; +_unit = _this select 0; +_action = _this select 1; +_from = _this select 2; + +_unit action [_action, _from]; + +switch (_action) do { + case "EJECT": {unassignVehicle _unit}; +}; diff --git a/Client/PVFunctions/SetHQStatus.sqf b/Client/PVFunctions/SetHQStatus.sqf new file mode 100644 index 0000000..8970dd8 --- /dev/null +++ b/Client/PVFunctions/SetHQStatus.sqf @@ -0,0 +1,5 @@ +if (_this) then { + ['WFBE_AREAHQDEPLOYED' Call GetNamespace,true,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; +} else { + ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; +}; \ No newline at end of file diff --git a/Client/PVFunctions/SetTask.sqf b/Client/PVFunctions/SetTask.sqf new file mode 100644 index 0000000..fa33e86 --- /dev/null +++ b/Client/PVFunctions/SetTask.sqf @@ -0,0 +1,36 @@ +Private ["_task","_taskPos","_taskTime","_taskTimeLabel"]; + +_task = _this select 0; +_taskTime = _this select 1; +_taskTimeLabel = _this select 2; +_taskPos = _this select 3; + +if (!isNull(comTask)) then {player removeSimpleTask comTask}; +comTask = player createSimpleTask ["CommanderOrder"]; +comTask setSimpleTaskDescription [Format[localize "STR_WF_CHAT_TaskTO_Display",_task,_taskTimeLabel], _task, _task]; +comTask setSimpleTaskDestination _taskPos; +player setCurrentTask comTask; + +taskHint [format [localize "str_taskNew" + "\n%1",_task], [1,1,1,1], "taskNew"]; + +[comTask,_taskTime,_taskPos,_task] Spawn { + Private ["_duration","_pos","_succeed","_task","_timer","_type"]; + _task = _this select 0; + _duration = (_this select 1)*60; //--- Converts to seconds. + _pos = _this select 2; + _type = _this select 3; + + _timer = 0; + _succeed = false; + while {(taskDestination _task) select 0 == (_pos select 0) && !_succeed} do { + sleep 5; + if (player distance _pos < 250) then {_timer = _timer + 5}; + if (_timer > _duration) then {_succeed = true}; + }; + + if (_succeed) then { + taskHint [format [localize "str_taskAccomplished" + "\n%1",_type], [1,1,1,1], "taskDone"]; + _task setTaskState "Succeeded"; + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderDone",["1","","HQ",["HQ"]],["2","","We are",["WeAre"]],["3","","ready for orders",["ReadyForOrders"]],["4","","over.",["Over1"]],true]; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/SetVehicleLock.sqf b/Client/PVFunctions/SetVehicleLock.sqf new file mode 100644 index 0000000..880533d --- /dev/null +++ b/Client/PVFunctions/SetVehicleLock.sqf @@ -0,0 +1 @@ +(_this select 0) lock (_this select 1); \ No newline at end of file diff --git a/Client/PVFunctions/TownCaptured.sqf b/Client/PVFunctions/TownCaptured.sqf new file mode 100644 index 0000000..4254ea2 --- /dev/null +++ b/Client/PVFunctions/TownCaptured.sqf @@ -0,0 +1,98 @@ +Private ["_award","_bounty","_location","_locationName","_marker1","_mysqlUpdate","_name","_newScore","_objective","_ptask","_range","_sideName","_sideToValue","_sideValue","_task","_units"]; + +_location = _this Select 0; +_sideValue = _this Select 1; +_sideToValue = _this Select 2; +_name = str _location; +_mysqlUpdate = ""; + +if (_sideToValue != sideID || !clientInitComplete) exitWith {}; + +_task = _location getVariable 'taskLink'; +_ptask = currentTask player; +if (isNil '_task') then {_task = objNull}; +_locationName = _location getVariable "name"; + +_marker1 = Format["%1Depot",_name]; +_sideName = localize "STR_WF_Side_Resistance"; + +if (_sideValue == WESTID) then {_sideName = localize "STR_WF_PARAMETER_Side_West"}; +if (_sideValue == EASTID) then {_sideName = localize "STR_WF_PARAMETER_Side_East"}; +if (_sideValue == sideID) then {_marker1 setMarkerColorLocal ("Friendly" Call GetMarkerColoration)} else {_marker1 setMarkerColorLocal ("Enemy" Call GetMarkerColoration)}; +if (_sideValue == RESISTANCEID) then {_marker1 setMarkerColorLocal ("Resistance" Call GetMarkerColoration)}; + +if (time > 10) then {[Format[Localize "STR_WF_CHAT_Town_Captured",_locationName,_sideName]] Call TitleTextMessage}; + +if (_sideValue == sideID) then { + _award = false; + if ((leader group player) == player) then { + _units = units group player; + {if (vehicle _x distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace)) then {_award = true}} forEach _units; + }; + + if (player distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace) || _award) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + } else { + ('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + }; + } else { + _range = (_location getVariable "range") * ('WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace); + if (player distance _location < _range) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + } else { + ('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Assist",_locationName,('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + }; + }; + }; +}; + +if (mysql) then { + if (_mysqlUpdate != "") then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA?WFBE_Update?%1?%2?%3?%4",getPlayerUID(player),name player,_mysqlUpdate,worldName]],true]; + }; +}; + +if (!isNull commanderTeam && sideID == _sideValue) then { + if (commanderTeam == group player) then { + _bounty = (_location getVariable "startingSupplyValue") * ('WFBE_COMMANDERTOWNCAPTURECOEF' Call GetNamespace); + _bounty Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Commander_Bounty_Town",_bounty,_locationName] Call CommandChatMessage; + }; +}; + +/* Task Handling */ +["TownUpdate",_location] Spawn TaskSystem; +if (sideID == _sideValue) then { + if !(isNull _task) then { + if (_ptask == _task) then { + ["TownAssignClosest"] Spawn TaskSystem; + }; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/TownCapturedPublic.sqf b/Client/PVFunctions/TownCapturedPublic.sqf new file mode 100644 index 0000000..4d9df03 --- /dev/null +++ b/Client/PVFunctions/TownCapturedPublic.sqf @@ -0,0 +1,96 @@ +Private ["_award","_bounty","_location","_locationName","_marker1","_mysqlUpdate","_name","_locations","_objective","_ptask","_range","_side","_sideName","_sideValue","_task","_units"]; + +_location = _this select 0; +_sideValue = _this select 1; + +if !(clientInitComplete) exitWith {}; + +_name = str _location; +_mysqlUpdate = ""; + +_task = _location getVariable 'taskLink'; +_ptask = currentTask player; +if (isNil '_task') then {_task = objNull}; +_locationName = _location getVariable "name"; + +_sideName = localize "STR_WF_PARAMETER_Side_East"; +if (_sideValue == WESTID) then {_sideName = localize "STR_WF_PARAMETER_Side_West"}; + +[Format[Localize "STR_WF_CHAT_Town_Captured",_locationName,_sideName]] Call TitleTextMessage; +_marker1 = Format["%1Depot",_name]; + +if (_sideValue == sideID) then {_marker1 setMarkerColorLocal ("Friendly" Call GetMarkerColoration)} else {_marker1 setMarkerColorLocal ("Enemy" Call GetMarkerColoration)}; + +if (_sideValue == sideID) then { + _award = false; + if ((Leader Group player) == player) then { + _units = Units Group player; + {if (vehicle _x distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace)) then {_award = true};} ForEach _units; + }; + + if (player distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace) || _award) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + } else { + ('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + }; + } else { + _range = (_location getVariable "range") * ('WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace); + if (player distance _location < _range) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + } else { + ('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Assist",_locationName,('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + }; + }; + }; +}; + +if (mysql) then { + if (_mysqlUpdate != "") then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA?WFBE_Update?%1?%2?%3?%4",getPlayerUID(player),name player,_mysqlUpdate,worldName]],true]; + }; +}; + +if (!isNull commanderTeam && sideID == _sideValue) then { + if (commanderTeam == Group player) then { + _bounty = (_location getVariable "startingSupplyValue") * ('WFBE_COMMANDERTOWNCAPTURECOEF' Call GetNamespace); + _bounty Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Commander_Bounty_Town",_bounty,_locationName] Call CommandChatMessage; + }; +}; + +/* Task Handling */ +["TownUpdate",_location] Spawn TaskSystem; +if (sideID == _sideValue) then { + if !(isNull _task) then { + if (_ptask == _task) then { + ["TownAssignClosest"] Spawn TaskSystem; + }; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/UAV_Reveal.sqf b/Client/PVFunctions/UAV_Reveal.sqf new file mode 100644 index 0000000..c2b1857 --- /dev/null +++ b/Client/PVFunctions/UAV_Reveal.sqf @@ -0,0 +1,27 @@ +/* + Author: Benny + Name: UAV_Reveal.sqf + Parameters: + 0 - UAV + 1 - Target + Description: + This file handle the client's UAV broadcast, a client send info to the others. +*/ + +Private ['_marker','_size','_target','_uav']; +_uav = _this select 0; +_target = _this select 1; + +if (typeName _uav != 'OBJECT' || typeName _target != 'OBJECT') exitWith {diag_log Format ["[WFBE (INFORMATION)][frameno:%3 | ticktime:%4] UAV_Reveal: An object is expected for both parameters given (UAV: %1 Target: %2).",_uav,_target,diag_frameno,diag_tickTime]}; + +_size = round((_uav distance _target) / 16); +_marker = Format["WFBE_UAV_SPOTTED_%1",unitMarker]; +unitMarker = unitMarker + 1; +createMarkerLocal [_marker,[(getPos _target select 0) - random(_size) + random(_size),(getPos _target select 1) - random(_size) + random(_size),0]]; +_marker setMarkerShapeLocal "Ellipse"; +_marker setMarkerColorLocal "ColorOrange"; +_marker setMarkerSizeLocal [_size,_size]; + +sleep (('WFBE_UAVSPOTTINGDELAY' Call GetNamespace)*3); + +deleteMarkerLocal _marker; \ No newline at end of file diff --git a/Client/PVFunctions/VoteForCommander.sqf b/Client/PVFunctions/VoteForCommander.sqf new file mode 100644 index 0000000..7bbb18e --- /dev/null +++ b/Client/PVFunctions/VoteForCommander.sqf @@ -0,0 +1,9 @@ + +private ["_voteTime"]; +if (votePopUp) then { + Private ["_voteTime"]; + _voteTime = 0; + waitUntil {_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];!isNil "_voteTime"}; + if (_voteTime > 0 && !voted) then {CreateDialog "RscMenu_Voting"}; + if (voted) then {voted = false}; +}; \ No newline at end of file -- cgit v1.3.1