From 92722999b53d80bf9cc5cc683ec61340ac880842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon?= Date: Sun, 3 Jul 2022 15:41:37 +0200 Subject: [PATCH 1/5] fixed bad arguments for requiredAddons check --- A3A/addons/Tasks/Core/fn_requestTask.sqf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/A3A/addons/Tasks/Core/fn_requestTask.sqf b/A3A/addons/Tasks/Core/fn_requestTask.sqf index a066232827..7518f8d9b4 100644 --- a/A3A/addons/Tasks/Core/fn_requestTask.sqf +++ b/A3A/addons/Tasks/Core/fn_requestTask.sqf @@ -45,7 +45,11 @@ _taskTypes = _taskTypes select { private _cfg = TASKS_CFG / _x; //Common criterias +<<<<<<< HEAD if !(_cfg call _fnc_requirementMeet) then { +======= + if (_cfg call _fnc_requirementMeet) then { +>>>>>>> 31aff5b4 (fixed bad arguments for requiredAddons check) Debug_2("Task %1 is missing one or more required addons: %2", _x, getArray (_cfg/_requiredAddons)); continueWith false; }; From df06727996414032839fa4ee448333218f7880a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon?= Date: Sun, 3 Jul 2022 15:53:50 +0200 Subject: [PATCH 2/5] corrected inverted if statement --- A3A/addons/Tasks/Core/fn_requestTask.sqf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/A3A/addons/Tasks/Core/fn_requestTask.sqf b/A3A/addons/Tasks/Core/fn_requestTask.sqf index 7518f8d9b4..3626c540ba 100644 --- a/A3A/addons/Tasks/Core/fn_requestTask.sqf +++ b/A3A/addons/Tasks/Core/fn_requestTask.sqf @@ -45,11 +45,8 @@ _taskTypes = _taskTypes select { private _cfg = TASKS_CFG / _x; //Common criterias -<<<<<<< HEAD + if !(_cfg call _fnc_requirementMeet) then { -======= - if (_cfg call _fnc_requirementMeet) then { ->>>>>>> 31aff5b4 (fixed bad arguments for requiredAddons check) Debug_2("Task %1 is missing one or more required addons: %2", _x, getArray (_cfg/_requiredAddons)); continueWith false; }; From ae1519cafe39dc6df5350cf65030d8ad7ad9cd85 Mon Sep 17 00:00:00 2001 From: Julia Kowalik Date: Sun, 3 Jul 2022 16:00:51 +0200 Subject: [PATCH 3/5] Ported CON_Outpost to new Framework --- A3A/addons/Tasks/CfgFunctions.hpp | 2 + .../Params/LegacyParams/fn_CON_Outpost_p.sqf | 8 ++ A3A/addons/Tasks/Tasks.hpp | 7 ++ .../Tasks/LegacyTasks/fn_CON_Outpost.sqf | 86 +++++++++++++++++++ A3A/addons/Tasks/stringtable.xml | 30 +++++++ 5 files changed, 133 insertions(+) create mode 100644 A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf create mode 100644 A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf diff --git a/A3A/addons/Tasks/CfgFunctions.hpp b/A3A/addons/Tasks/CfgFunctions.hpp index 6dce0ebada..66b5c0df1d 100644 --- a/A3A/addons/Tasks/CfgFunctions.hpp +++ b/A3A/addons/Tasks/CfgFunctions.hpp @@ -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 {}; }; }; }; diff --git a/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf b/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf new file mode 100644 index 0000000000..1d61aac82f --- /dev/null +++ b/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf @@ -0,0 +1,8 @@ +#include "..\..\script_component.hpp" +FIX_LINE_NUMBERS() + +private _roadblocks = controlsX findIf { isOnRoad getMarkerPos _x }; +private _possibleMarkers = [outposts + resourcesX + factories + seaports + _roadblocks] call FUNC(nearHostileMarkers); + +if (_possibleMarkers isEqualTo []) exitWith {false}; +_possibleMarkers; \ No newline at end of file diff --git a/A3A/addons/Tasks/Tasks.hpp b/A3A/addons/Tasks/Tasks.hpp index fcbbc1b32d..d0021b825f 100644 --- a/A3A/addons/Tasks/Tasks.hpp +++ b/A3A/addons/Tasks/Tasks.hpp @@ -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; + }; }; diff --git a/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf b/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf new file mode 100644 index 0000000000..71dfeb9ea3 --- /dev/null +++ b/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf @@ -0,0 +1,86 @@ +#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]; + +private _taskName = ""; +private _taskDescription = ""; + +if (_marker in resourcesX) then { + _taskName = localize "STR_antistasi_LTasks_CON_Outpost_resource_title"; + _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_resource_description"), _nameDest, _displayTime]; +}; +if (_marker in outposts) then { + _taskName = localize "STR_antistasi_LTasks_CON_Outpost_outpost_title"; + _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_outpost_description"), _nameDest, _displayTime]; +}; +if (_marker in seaports) then { + _taskName = localize "STR_antistasi_LTasks_CON_Outpost_seaport_title"; + _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_seaport_description"), _nameDest, _displayTime]; +}; +if (_marker in factories) then { + _taskName = localize "STR_antistasi_LTasks_CON_Outpost_factory_title"; + _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_factory_description"), _nameDest, _displayTime]; +}; + +_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]; \ No newline at end of file diff --git a/A3A/addons/Tasks/stringtable.xml b/A3A/addons/Tasks/stringtable.xml index 0418e9be11..938da55283 100644 --- a/A3A/addons/Tasks/stringtable.xml +++ b/A3A/addons/Tasks/stringtable.xml @@ -16,6 +16,36 @@ 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. + + + + Resource Acquisition + + + + A %1 would be a fine addition to our cause. Go there and capture it before %2. + + + Take the Outpost + + + + A %1 is disturbing our operations in the area. Go there and capture it before %2. + + + Secure the Seaport + + + + %1 is an important fishing supplier for our local Fish&Chips dinners. Go there and capture it before %2. + + + Reclaim means of production + + + + %1 is being used to aid the enemy. Go there and capture it before %2. + From e0d02c75a4451942ec8f83a6b805ccf07a5bab06 Mon Sep 17 00:00:00 2001 From: Julia Kowalik Date: Sun, 3 Jul 2022 17:05:50 +0200 Subject: [PATCH 4/5] Fixed array concatenation of non-array type --- A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf b/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf index 1d61aac82f..a7b62172ad 100644 --- a/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf +++ b/A3A/addons/Tasks/Params/LegacyParams/fn_CON_Outpost_p.sqf @@ -1,7 +1,7 @@ #include "..\..\script_component.hpp" FIX_LINE_NUMBERS() -private _roadblocks = controlsX findIf { isOnRoad getMarkerPos _x }; +private _roadblocks = controlsX select { isOnRoad getMarkerPos _x }; private _possibleMarkers = [outposts + resourcesX + factories + seaports + _roadblocks] call FUNC(nearHostileMarkers); if (_possibleMarkers isEqualTo []) exitWith {false}; From 3976fd92f1a86331e3892a2d88ca848fa4739e74 Mon Sep 17 00:00:00 2001 From: Julia Kowalik Date: Sun, 3 Jul 2022 17:06:59 +0200 Subject: [PATCH 5/5] Code style and formatting improvements --- .../Tasks/LegacyTasks/fn_CON_Outpost.sqf | 65 +++++++++---------- A3A/addons/Tasks/stringtable.xml | 2 - 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf b/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf index 71dfeb9ea3..fa7d3d7913 100644 --- a/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf +++ b/A3A/addons/Tasks/Tasks/LegacyTasks/fn_CON_Outpost.sqf @@ -23,25 +23,24 @@ if (A3A_hasIFA) then {_timeLimit = _timeLimit * 2}; private _displayTime = [_timeLimit] call FUNC(minutesFromNow); private _markerSide = sidesX getVariable [_marker, sideUnknown]; -private _taskName = ""; -private _taskDescription = ""; - -if (_marker in resourcesX) then { - _taskName = localize "STR_antistasi_LTasks_CON_Outpost_resource_title"; - _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_resource_description"), _nameDest, _displayTime]; -}; -if (_marker in outposts) then { - _taskName = localize "STR_antistasi_LTasks_CON_Outpost_outpost_title"; - _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_outpost_description"), _nameDest, _displayTime]; -}; -if (_marker in seaports) then { - _taskName = localize "STR_antistasi_LTasks_CON_Outpost_seaport_title"; - _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_seaport_description"), _nameDest, _displayTime]; -}; -if (_marker in factories) then { - _taskName = localize "STR_antistasi_LTasks_CON_Outpost_factory_title"; - _taskDescription = format [(localize "STR_antistasi_LTasks_CON_Outpost_factory_description"), _nameDest, _displayTime]; -}; +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]; @@ -62,22 +61,22 @@ _stages = [ ["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"; + 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; + 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; + 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 diff --git a/A3A/addons/Tasks/stringtable.xml b/A3A/addons/Tasks/stringtable.xml index 938da55283..8840160286 100644 --- a/A3A/addons/Tasks/stringtable.xml +++ b/A3A/addons/Tasks/stringtable.xml @@ -16,8 +16,6 @@ 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. - - Resource Acquisition