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/Fix/Improve/Change numerous aspects #9040

Merged
merged 27 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df30333
Arsenal update
johnb432 Sep 18, 2022
aef50dd
Fixes
johnb432 Nov 4, 2022
d7ea428
Update fnc_onSelChangedLeft.sqf
johnb432 Jan 31, 2023
75d8cc8
Update fnc_updateUniqueItemsList.sqf
johnb432 May 19, 2023
0b89b8f
Merge branch 'master' into master
johnb432 May 19, 2023
652de70
Header fixes
johnb432 May 19, 2023
4597b27
Fix for defines.hpp
johnb432 May 19, 2023
40a1217
Merge branch 'master' into master
johnb432 Jun 14, 2023
4c9eb8b
Moved fnc_baseWeapon, filtered invalid items
johnb432 Jun 24, 2023
ca063f4
Update addons/arsenal/functions/fnc_scanConfig.sqf
johnb432 Jun 24, 2023
f329fe1
Fixes and tweaks
johnb432 Jun 25, 2023
6d8549d
Cleanup, bug fixes and additions
johnb432 Jul 1, 2023
8a4a08f
More fixes and tweaks
johnb432 Jul 9, 2023
3d6647b
Update fnc_replaceUniqueItemsLoadout.sqf
johnb432 Jul 9, 2023
fdf8bca
Update fnc_onSelChangedLeft.sqf
johnb432 Jul 9, 2023
dbdba9a
Update fnc_scanConfig.sqf
johnb432 Jul 9, 2023
4561ccd
Update docs/wiki/framework/arsenal-framework.md
johnb432 Jul 11, 2023
fa48fef
Minor cleanup
johnb432 Jul 11, 2023
98a9c82
Baseweapon filtering
johnb432 Jul 11, 2023
13357de
Improvements + better unique items support
johnb432 Jul 13, 2023
1b189e1
Update fnc_fillRightPanel.sqf
johnb432 Jul 14, 2023
3507da0
Update fnc_onSelChangedLeft.sqf
johnb432 Jul 15, 2023
2903d4b
Merge branch 'master' into master
johnb432 Jul 16, 2023
93cba2b
Update addons/common/functions/fnc_uniqueUnitItems.sqf
johnb432 Jul 16, 2023
539df03
undefined variable
LinkIsGrim Jul 20, 2023
17450ca
fix undefined loadout var
LinkIsGrim Jul 21, 2023
fac03f0
Update fnc_fillLoadoutsList.sqf
johnb432 Jul 21, 2023
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
2 changes: 1 addition & 1 deletion addons/arsenal/ACE_Arsenal_Sorts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class GVAR(sorts) {
displayName = "";
tabs[] = {{}, {}};
statement = "";
condition = "true";
condition = QUOTE(true);
};

class ACE_alphabetically: sortBase {
Expand Down
5 changes: 2 additions & 3 deletions addons/arsenal/ACE_Arsenal_Stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class GVAR(stats) {
showText = 0;
barStatement = "";
textStatement = "";
condition = "true";
condition = QUOTE(true);
tabs[] = {{}, {}};
};
class ACE_bananaPotassium: statBase {
Expand Down Expand Up @@ -63,7 +63,7 @@ class GVAR(stats) {
stats[] = {"hit", "initSpeed"};
displayName = "$STR_a3_rscdisplayarsenal_stat_impact";
showBar = 1;
barStatement = QUOTE([ARR_3(_this select 0, _this select 1, [ARR_3([ARR_2(0, 3.2)], [ARR_2(-1, 1100)], 2006)])] call FUNC(statBarStatement_impact));
barStatement = QUOTE([ARR_3(_this select 0, _this select 1, [ARR_2([ARR_2(0, 3.2)], [ARR_2(-1, 1100)])])] call FUNC(statBarStatement_impact));
tabs[] = {{0,1,2}, {}};
};
class ACE_scopeMagnification: statBase {
Expand Down Expand Up @@ -125,7 +125,6 @@ class GVAR(stats) {
displayName = CSTRING(StatExplosionTime);
showText = 1;
textStatement = QUOTE(call FUNC(statTextStatement_explosionTime));
condition = QUOTE(true);
tabs[] = {{}, {5}};
};
};
3 changes: 2 additions & 1 deletion addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ PREP(fillLeftPanel);
PREP(fillLoadoutsList);
PREP(fillRightPanel);
PREP(fillSort);
PREP(getLoadout);
PREP(handleLoadoutsSearchbar);
PREP(handleMouse);
PREP(handleScrollWheel);
Expand All @@ -61,6 +60,7 @@ PREP(portVALoadouts);
PREP(removeBox);
PREP(removeStat);
PREP(removeVirtualItems);
PREP(replaceUniqueItemsLoadout);
PREP(scanConfig);
PREP(showItem);
PREP(sortPanel);
Expand All @@ -85,5 +85,6 @@ PREP(statTextStatement_scopeVisionMode);
PREP(statTextStatement_smokeChemTTL);
PREP(updateCamPos);
PREP(updateRightPanel);
PREP(updateCurrentItemsList);
PREP(updateUniqueItemsList);
PREP(verifyLoadout);
92 changes: 67 additions & 25 deletions addons/arsenal/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ GVAR(lastSearchTextLoadouts) = "";
GVAR(lastSortLeft) = "";
GVAR(lastSortRight) = "";

[QGVAR(initBox), {_this call FUNC(initBox)}] call CBA_fnc_addEventHandler;
[QGVAR(removeBox), {_this call FUNC(removeBox)}] call CBA_fnc_addEventHandler;
[QGVAR(initBox), {LINKFUNC(initBox)}] call CBA_fnc_addEventHandler;
[QGVAR(removeBox), {LINKFUNC(removeBox)}] call CBA_fnc_addEventHandler;

[QGVAR(broadcastFace), {
params ["_unit", "_face"];
Expand All @@ -28,51 +28,49 @@ GVAR(lastSortRight) = "";
[QGVAR(loadoutUnshared), {
params ["_contentPanelCtrl" , "_playerName", "_loadoutName"];

// If player is in arsenal in the shared tab and a loadout is unshared at the same time
if (!isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {

private _dataToCheck = _playerName + _loadoutName;

for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
if ((_contentPanelCtrl lnbData [_i, 1]) == _dataToCheck) exitwith {_contentPanelCtrl lnbDeleteRow _i};
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
if ((_contentPanelCtrl lnbData [_lbIndex, 1]) == _dataToCheck) exitWith {
_contentPanelCtrl lnbDeleteRow _lbIndex;
};
};
} else {

if (
profileName == _playerName &&
{!(isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts})}
) then {

for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
if ((_contentPanelCtrl lnbText [_i, 1]) == _loadoutName) exitwith {
_contentPanelCtrl lnbSetPicture [[_i, 0], QPATHTOF(data\iconPublicBlank.paa)];
_contentPanelCtrl lnbSetValue [[_i, 0], 0];
if (profileName == _playerName && {!(isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts})}) then {
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _loadoutName) exitWith {
_contentPanelCtrl lnbSetPicture [[_lbIndex, 0], QPATHTOF(data\iconPublicBlank.paa)];
_contentPanelCtrl lnbSetValue [[_lbIndex, 0], 0];
};
};
};
};
}] call CBA_fnc_addEventHandler;

[QGVAR(loadoutShared), {
params ["_contentPanelCtrl" ,"_loadoutArgs"];
params ["_contentPanelCtrl", "_loadoutArgs"];
_loadoutArgs params ["_playerName", "_loadoutName", "_loadoutData"];

// If player is in arsenal in the shared tab and a loadout is shared at the same time
if (!isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {
private _curSelData = _contentPanelCtrl lnbData [lnbCurSelRow _contentPanelCtrl, 1];

private _curSelData =_contentPanelCtrl lnbData [(lnbCurSelRow _contentPanelCtrl), 1];
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
_extendedLoadout params ["_loadout"];

private _newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
private _cfgWeapons = configFile >> "CfgWeapons";

_extendedLoadout params ["_loadout"];
ADD_LOADOUTS_LIST_PICTURES

_contentPanelCtrl lnbSetData [[_newRow, 1], _playerName + _loadoutName];

// Set color of row, depending if items are unavailable/missing
if (_nullItemsAmount > 0) then {

_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]];
} else {

if (_unavailableItemsAmount > 0) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
};
Expand All @@ -81,25 +79,69 @@ GVAR(lastSortRight) = "";
_contentPanelCtrl lnbSort [1, false];

// Select previously selected loadout
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
if ((_contentPanelCtrl lnbText [_i, 1]) == _curSelData) exitwith {_contentPanelCtrl lnbSetCurSelRow _i};
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _curSelData) exitWith {
_contentPanelCtrl lnbSetCurSelRow _lbIndex
};
};
};
}] call CBA_fnc_addEventHandler;

["CBA_loadoutSet", {
params ["_unit", "_loadout", "_extendedInfo"];

// Set face
private _face = _extendedInfo getOrDefault [QGVAR(face), ""];

if (_face != "") then {
_unit setFace _face;
if (isMultiplayer) then {
private _id = [QGVAR(broadcastFace), [_unit, _face], QGVAR(centerFace_) + netId _unit] call CBA_fnc_globalEventJIP;
johnb432 marked this conversation as resolved.
Show resolved Hide resolved
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
} else {
_unit setFace _face;
};
};

// Set voice
private _voice = _extendedInfo getOrDefault [QGVAR(voice), ""];

if (_voice != "") then {
_unit setSpeaker _voice;
if (isMultiplayer) then {
private _id = [QGVAR(broadcastVoice), [_unit, _voice], QGVAR(centerVoice_) + netId _unit] call CBA_fnc_globalEventJIP;
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
} else {
_unit setSpeaker _voice;
};
};

// Set insignia
private _insignia = _extendedInfo getOrDefault [QGVAR(insignia), ""];

if (_insignia != "") then {
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
[_unit, _insignia] call bis_fnc_setUnitInsignia;
[_unit, _insignia] call BIS_fnc_setUnitInsignia;
};
}] call CBA_fnc_addEventHandler;

["CBA_loadoutGet", {
params ["_unit", "_loadout", "_extendedInfo"];

// Set face if enabled
if (GVAR(loadoutsSaveFace)) then {
_extendedInfo set [QGVAR(face), face _unit];
};

// Set voice if enabled
if (GVAR(loadoutsSaveVoice)) then {
_extendedInfo set [QGVAR(voice), speaker _unit];
};

// Set insignia if enabled
if (GVAR(loadoutsSaveInsignia)) then {
private _insignia = _unit call BIS_fnc_getUnitInsignia;

if (_insignia != "") then {
_extendedInfo set [QGVAR(insignia), _insignia];
};
};
}] call CBA_fnc_addEventHandler;
36 changes: 20 additions & 16 deletions addons/arsenal/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ PREP_RECOMPILE_START;
PREP_RECOMPILE_END;

// Arsenal
[QGVAR(camInverted), "CHECKBOX", localize LSTRING(invertCameraSetting), localize LSTRING(settingCategory), false] call CBA_fnc_addSetting;
[QGVAR(enableModIcons), "CHECKBOX", [LSTRING(modIconsSetting), LSTRING(modIconsTooltip)], localize LSTRING(settingCategory), true] call CBA_fnc_addSetting;
[QGVAR(fontHeight), "SLIDER", [LSTRING(fontHeightSetting), LSTRING(fontHeightTooltip)], localize LSTRING(settingCategory), [1, 10, 4.5, 1]] call CBA_fnc_addSetting;
[QGVAR(enableIdentityTabs), "CHECKBOX", localize LSTRING(enableIdentityTabsSettings), localize LSTRING(settingCategory), true, true] call CBA_fnc_addSetting;
[QGVAR(camInverted), "CHECKBOX", LLSTRING(invertCameraSetting), LLSTRING(settingCategory), false] call CBA_fnc_addSetting;
[QGVAR(enableModIcons), "CHECKBOX", [LSTRING(modIconsSetting), LSTRING(modIconsTooltip)], LLSTRING(settingCategory), true] call CBA_fnc_addSetting;
[QGVAR(fontHeight), "SLIDER", [LSTRING(fontHeightSetting), LSTRING(fontHeightTooltip)], LLSTRING(settingCategory), [1, 10, 4.5, 1]] call CBA_fnc_addSetting;
[QGVAR(enableIdentityTabs), "CHECKBOX", LLSTRING(enableIdentityTabsSettings), LLSTRING(settingCategory), true, true] call CBA_fnc_addSetting;

// Arsenal loadouts
[QGVAR(allowDefaultLoadouts), "CHECKBOX", [LSTRING(allowDefaultLoadoutsSetting), LSTRING(defaultLoadoutsTooltip)], [localize LSTRING(settingCategory), localize LSTRING(loadoutSubcategory)], true, true] call CBA_fnc_addSetting;
[QGVAR(allowSharedLoadouts), "CHECKBOX", localize LSTRING(allowSharingSetting), [localize LSTRING(settingCategory), localize LSTRING(loadoutSubcategory)], true, true] call CBA_fnc_addSetting;
[QGVAR(EnableRPTLog), "CHECKBOX", [LSTRING(printToRPTSetting), LSTRING(printToRPTTooltip)], [localize LSTRING(settingCategory), localize LSTRING(loadoutSubcategory)], false, false] call CBA_fnc_addSetting;
[QGVAR(allowDefaultLoadouts), "CHECKBOX", [LSTRING(allowDefaultLoadoutsSetting), LSTRING(defaultLoadoutsTooltip)], [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], true, true] call CBA_fnc_addSetting;
[QGVAR(allowSharedLoadouts), "CHECKBOX", LLSTRING(allowSharingSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], true, true] call CBA_fnc_addSetting;
[QGVAR(EnableRPTLog), "CHECKBOX", [LSTRING(printToRPTSetting), LSTRING(printToRPTTooltip)], [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], false, false] call CBA_fnc_addSetting;

[QGVAR(loadoutsSaveFace), "CHECKBOX", localize LSTRING(loadoutsSaveFaceSetting), [localize LSTRING(settingCategory), localize LSTRING(loadoutSubcategory)], false] call CBA_fnc_addSetting;
[QGVAR(loadoutsSaveVoice), "CHECKBOX", localize LSTRING(loadoutsSaveVoiceSetting), [localize LSTRING(settingCategory), localize LSTRING(loadoutSubcategory)], false] call CBA_fnc_addSetting;
[QGVAR(loadoutsSaveInsignia), "CHECKBOX", localize LSTRING(loadoutsSaveInsigniaSetting), [localize LSTRING(settingCategory), localize LSTRING(loadoutSubcategory)], true] call CBA_fnc_addSetting;
[QGVAR(loadoutsSaveFace), "CHECKBOX", LLSTRING(loadoutsSaveFaceSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], false] call CBA_fnc_addSetting;
[QGVAR(loadoutsSaveVoice), "CHECKBOX", LLSTRING(loadoutsSaveVoiceSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], false] call CBA_fnc_addSetting;
[QGVAR(loadoutsSaveInsignia), "CHECKBOX", LLSTRING(loadoutsSaveInsigniaSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], true] call CBA_fnc_addSetting;

// Arsenal events
[QGVAR(statsToggle), {
params ["_display", "_showStats"];

Expand Down Expand Up @@ -54,25 +55,28 @@ PREP_RECOMPILE_END;
_this call FUNC(buttonStatsPage);
}] call CBA_fnc_addEventHandler;


[QGVAR(displayStats), {
_this call FUNC(handleStats);
}] call CBA_fnc_addEventHandler;

call FUNC(compileStats);
call FUNC(compileSorts);

// Caches for names, pictures, mod icons
GVAR(addListBoxItemCache) = createHashMap;
GVAR(rightPanelCache) = createHashMap;

[QUOTE(ADDON), {!isNil QGVAR(camera)}] call CBA_fnc_registerFeatureCamera;

// Compatibility with CBA scripted optics and dispoable framework
// Compatibility with CBA scripted optics and disposable framework
[QGVAR(displayOpened), {
"cba_optics_arsenalOpened" call CBA_fnc_localEvent;
"cba_disposable_arsenalOpened" call CBA_fnc_localEvent;
"CBA_optics_arsenalOpened" call CBA_fnc_localEvent;
"CBA_disposable_arsenalOpened" call CBA_fnc_localEvent;
}] call CBA_fnc_addEventHandler;

[QGVAR(displayClosed), {
"cba_optics_arsenalClosed" call CBA_fnc_localEvent;
"cba_disposable_arsenalClosed" call CBA_fnc_localEvent;
"CBA_optics_arsenalClosed" call CBA_fnc_localEvent;
"CBA_disposable_arsenalClosed" call CBA_fnc_localEvent;
}] call CBA_fnc_addEventHandler;

ADDON = true;
Loading