Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arsenal - Add yes/no stat text, stat exists condition #10559

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Loading