Skip to content

Commit

Permalink
Arsenal - Add yes/no stat text, stat exists condition (#10559)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim authored Dec 17, 2024
1 parent 2709c2d commit 23a19f4
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ PREP(sortStatement_mod);
PREP(sortStatement_protection);
PREP(sortStatement_rateOfFire);
PREP(sortStatement_scopeMag);
PREP(statCondition_existsAll);
PREP(statCondition_existsAny);
PREP(statBarStatement_accuracy);
PREP(statBarStatement_default);
PREP(statBarStatement_impact);
Expand All @@ -107,6 +109,7 @@ PREP(statTextStatement_rateOfFire);
PREP(statTextStatement_scopeMag);
PREP(statTextStatement_scopeVisionMode);
PREP(statTextStatement_smokeChemTTL);
PREP(statTextStatement_yesno);
PREP(updateCamPos);
PREP(updateRightPanel);
PREP(updateCurrentItemsList);
Expand Down
22 changes: 22 additions & 0 deletions addons/arsenal/functions/fnc_statCondition_existsAll.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Stat condition to only show stats if all exist.
*
* Arguments:
* 0: Stats <ARRAY>
* 1: Item config path <CONFIG>
*
* Return Value:
* Show stat <BOOL>
*
* Example:
* ["ACE_maxZeroing", _config] call ace_arsenal_fnc_statCondition_existsAll
*
* Public: Yes
*/

params ["_stats", "_config"];
TRACE_2("statCondition_existsAll",_stats,_config);

(_stats findIf {isNull (_config >> _x)}) == -1
22 changes: 22 additions & 0 deletions addons/arsenal/functions/fnc_statCondition_existsAny.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Stat condition to only show stats if at least one exists.
*
* Arguments:
* 0: Stats <ARRAY>
* 1: Item config path <CONFIG>
*
* Return Value:
* Show stat <BOOL>
*
* Example:
* ["ACE_maxZeroing", _config] call ace_arsenal_fnc_statCondition_existsAny
*
* Public: Yes
*/

params ["_stats", "_config"];
TRACE_2("statCondition_existsAny",_stats,_config);

(_stats findIf {!isNull (_config >> _x)}) != -1
25 changes: 25 additions & 0 deletions addons/arsenal/functions/fnc_statTextStatement_yesno.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Generic Yes/No/None Text statement for boolean stats.
*
* Arguments:
* 0: Stat <STRING>
* 1: Item config path <CONFIG>
*
* Return Value:
* Stat Text <STRING>
*
* Example:
* ["ACE_hasEHP", _config] call ace_arsenal_fnc_statTextStatement_yesno
*
* Public: Yes
*/

params ["_stat", "_config"];
TRACE_2("statTextStatement_yesno",_stat,_config);

private _statConfig = _config >> _stat;
if (isNull _statConfig) exitWith { LELSTRING(common,none) };

localize ([ELSTRING(common,No), ELSTRING(common,Yes)] select (getNumber _statConfig > 0))

0 comments on commit 23a19f4

Please sign in to comment.