summaryrefslogtreecommitdiffstats
path: root/Client/PVFunctions/TownCaptured.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
commita3a91d4f45b22fd487ecbc954ad979be5d03efdd (patch)
treea554ab159a347dcd6c00ca1c7c26c1ec3ac0a6bd /Client/PVFunctions/TownCaptured.sqf
downloada2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.tar.gz
a2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.tar.bz2
a2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.zip
Diffstat (limited to '')
-rw-r--r--Client/PVFunctions/TownCaptured.sqf98
1 files changed, 98 insertions, 0 deletions
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