Skip to content

Commit

Permalink
Merge pull request #3 from Jul1aK0wal1k/tasks/CON_Outpost
Browse files Browse the repository at this point in the history
Migrated Conquest mission to new mission framework
  • Loading branch information
HakonRydland authored Jul 3, 2022
2 parents 5a25685 + 3976fd9 commit cc99c1a
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 0 deletions.
2 changes: 2 additions & 0 deletions A3A/addons/Tasks/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ class CfgFunctions {
file = QPATHTOFOLDER(Params\LegacyParams);
class AS_Official_p {};
class AS_specOP_p {};
class CON_Outpost_p {};
};
class LegacyTasks {
file = QPATHTOFOLDER(Tasks\LegacyTasks);
class AS_Official {};
class AS_specOP {};
class CON_Outpost {};
};
};
};
1 change: 1 addition & 0 deletions A3A/addons/Tasks/Core/fn_requestTask.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ _taskTypes = _taskTypes select {
private _cfg = TASKS_CFG / _x;

//Common criterias

if !(_cfg call _fnc_requirementMeet) then {
Debug_2("Task %1 is missing one or more required addons: %2", _x, getArray (_cfg/_requiredAddons)); continueWith false;
};
Expand Down
8 changes: 8 additions & 0 deletions A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()

private _roadblocks = controlsX select { isOnRoad getMarkerPos _x };
private _possibleMarkers = [outposts + resourcesX + factories + seaports + _roadblocks] call FUNC(nearHostileMarkers);

if (_possibleMarkers isEqualTo []) exitWith {false};
_possibleMarkers;
7 changes: 7 additions & 0 deletions A3A/addons/Tasks/Tasks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ class Tasks {
Version = 1; //version number of task, update when compatibility is broken between last version and new update
Weight = 1;
};
class L_CON_Outpost {
Category = "CON"; // what Category the task bellongs to
Func = QFUNC(CON_Outpost); // the task information needed to run the task
Params = QFUNC(CON_Outpost_p); // determines the parameters for a task, if no valid ones can be genereated return false
Version = 1; //version number of task, update when compatibility is broken between last version and new update
Weight = 1;
};
};
85 changes: 85 additions & 0 deletions A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()

(_this get "Params") params [["_marker", "", [""]]];
if ((getMarkerPos _marker) isEqualTo [0,0,0]) exitWith {
Error_1("Conquest mission started with bad marker name | %1", _this);
};

private _side = sidesX getVariable _marker;
private _faction = Faction(_side);

_this set ["side", _side];
_this set ["faction", _faction];
_this set ["isDifficult", (random 10 < tierWar)];
_this set ["destination", getMarkerPos _marker];
_this set ["marker", _marker];

private _nameDest = [_marker] call A3A_fnc_localizar;

private _timeLimit = if (_this get "isDifficult") then {30} else {90};
if (A3A_hasIFA) then {_timeLimit = _timeLimit * 2};

private _displayTime = [_timeLimit] call FUNC(minutesFromNow);
private _markerSide = sidesX getVariable [_marker, sideUnknown];

switch (true) do {
case (_marker in resourcesX): { [
localize "STR_antistasi_LTasks_CON_Outpost_resource_title",
format [(localize "STR_antistasi_LTasks_CON_Outpost_resource_description"), _nameDest, _displayTime]
]};
case (_marker in outposts): { [
localize "STR_antistasi_LTasks_CON_Outpost_outpost_title",
format [(localize "STR_antistasi_LTasks_CON_Outpost_outpost_description"), _nameDest, _displayTime]
]};
case (_marker in seaports): { [
localize "STR_antistasi_LTasks_CON_Outpost_seaport_title",
format [(localize "STR_antistasi_LTasks_CON_Outpost_seaport_description"), _nameDest, _displayTime]
]};
case (_marker in factories): { [
localize "STR_antistasi_LTasks_CON_Outpost_factory_title",
format [(localize "STR_antistasi_LTasks_CON_Outpost_factory_description"), _nameDest, _displayTime]
]};
} params ["_taskName", "_taskDescription"];

_this set ["title", _taskName];
_this set ["description", _taskDescription];

_this set ["Constructor", { // Type: code | Required | Constructor to run at start of task
}];

_this set ["Destructor", { // Type: code | Optional | Destructor to run at end of task
}];

_stages = [
createHashMapFromArray [
["Action", { //Type: code | Required | Action to be done in that stage
}],
["Condition", { //Type: code | Required | Return type: bool | Condition to compleate the stage
(sidesX getVariable [_this get "marker", sideUnknown]) isEqualTo teamPlayer;
}],
["Required", true], //Type: bool | Optional | if the task needs the stage to succeed
["Reward", { //Type: code | Optional | the reward given for completing the stage
private _multiplier = if (_this get "isDifficult") then {2} else {1};
private _pos = getMarkerPos (_this get "marker");
private _side = _this get "side";

if ((_this get "state") isEqualTo "SUCCEEDED") then
{
[0,200 * _multiplier] remoteExec ["A3A_fnc_resourcesFIA",2];
[-5 * _multiplier,0,_pos] remoteExec ["A3A_fnc_citySupportChange",2];
[600 * _multiplier, _side] remoteExec ["A3A_fnc_timingCA",2];
{if (isPlayer _x) then {[10 * _multiplier,_x] call A3A_fnc_playerScoreAdd}} forEach ([500,0,_pos,teamPlayer] call A3A_fnc_distanceUnits);
[10 * _multiplier,theBoss] call A3A_fnc_playerScoreAdd;
}
else
{
[5,0,_pos] remoteExec ["A3A_fnc_citySupportChange",2];
[-600, _side] remoteExec ["A3A_fnc_timingCA",2];
[-10,theBoss] call A3A_fnc_playerScoreAdd;
};
}],
["Timeout", _timeLimit * 60] //Type: number | Optional | Time limit for the stage before auto fail
]
];
_this set ["Stages", _stages];
28 changes: 28 additions & 0 deletions A3A/addons/Tasks/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,34 @@
<!-- %1 = Faction name | %2 = Location name | %3 = time in format H:M -->
<Original>We have spotted a %1 SpecOp team patrolling around a %2. Ambush them and we will have one less problem. Do this before %3. Be careful, they are tough boys.</Original>
</Key>
<Key ID="STR_antistasi_LTasks_CON_Outpost_resource_title">
<Original>Resource Acquisition</Original>
</Key>
<!-- %1 = Location name | %2 = time in format H:M -->
<Key ID="STR_antistasi_LTasks_CON_Outpost_resource_description">
<Original>A %1 would be a fine addition to our cause. Go there and capture it before %2.</Original>
</Key>
<Key ID="STR_antistasi_LTasks_CON_Outpost_outpost_title">
<Original>Take the Outpost</Original>
</Key>
<!-- %1 = Location name | %2 = time in format H:M -->
<Key ID="STR_antistasi_LTasks_CON_Outpost_outpost_description">
<Original>A %1 is disturbing our operations in the area. Go there and capture it before %2.</Original>
</Key>
<Key ID="STR_antistasi_LTasks_CON_Outpost_seaport_title">
<Original>Secure the Seaport</Original>
</Key>
<!-- %1 = Location name | %2 = time in format H:M -->
<Key ID="STR_antistasi_LTasks_CON_Outpost_seaport_description">
<Original>%1 is an important fishing supplier for our local Fish&amp;Chips dinners. Go there and capture it before %2.</Original>
</Key>
<Key ID="STR_antistasi_LTasks_CON_Outpost_factory_title">
<Original>Reclaim means of production</Original>
</Key>
<!-- %1 = Location name | %2 = time in format H:M -->
<Key ID="STR_antistasi_LTasks_CON_Outpost_factory_description">
<Original>%1 is being used to aid the enemy. Go there and capture it before %2.</Original>
</Key>
</Container>
</Package>
</Project>

0 comments on commit cc99c1a

Please sign in to comment.