mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into corpse-carry-continued2
This commit is contained in:
commit
4969f48fac
1
.github/workflows/pboproject.yml
vendored
1
.github/workflows/pboproject.yml
vendored
@ -64,7 +64,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
subst P: .
|
subst P: .
|
||||||
pboproject -P
|
pboproject -P
|
||||||
xcopy /e /h /q z\ace\tools\pDummies\A3\ui_f_enoch a3\ui_f_enoch\
|
|
||||||
xcopy /e /h /q z\ace\tools\pDummies\gm gm\
|
xcopy /e /h /q z\ace\tools\pDummies\gm gm\
|
||||||
xcopy /e /h /q z\ace\tools\pDummies\vn vn\
|
xcopy /e /h /q z\ace\tools\pDummies\vn vn\
|
||||||
- name: Build
|
- name: Build
|
||||||
|
@ -4,7 +4,7 @@ class GVAR(sorts) {
|
|||||||
displayName = "";
|
displayName = "";
|
||||||
tabs[] = {{}, {}};
|
tabs[] = {{}, {}};
|
||||||
statement = "";
|
statement = "";
|
||||||
condition = "true";
|
condition = QUOTE(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_alphabetically: sortBase {
|
class ACE_alphabetically: sortBase {
|
||||||
|
@ -8,12 +8,12 @@ class GVAR(stats) {
|
|||||||
showText = 0;
|
showText = 0;
|
||||||
barStatement = "";
|
barStatement = "";
|
||||||
textStatement = "";
|
textStatement = "";
|
||||||
condition = "true";
|
condition = QUOTE(true);
|
||||||
tabs[] = {{}, {}};
|
tabs[] = {{}, {}};
|
||||||
};
|
};
|
||||||
class ACE_bananaPotassium: statBase {
|
class ACE_bananaPotassium: statBase {
|
||||||
scope = 2;
|
scope = 2;
|
||||||
displayName= CSTRING(statPotassium);
|
displayName = CSTRING(statPotassium);
|
||||||
showBar = 1;
|
showBar = 1;
|
||||||
barStatement = "1";
|
barStatement = "1";
|
||||||
condition = QUOTE((configName (_this select 1)) == 'ACE_Banana');
|
condition = QUOTE((configName (_this select 1)) == 'ACE_Banana');
|
||||||
@ -21,7 +21,8 @@ class GVAR(stats) {
|
|||||||
};
|
};
|
||||||
class ACE_mass: statBase {
|
class ACE_mass: statBase {
|
||||||
scope = 2;
|
scope = 2;
|
||||||
displayName= "$STR_a3_rscdisplayarsenal_stat_weight";
|
priority = 1.5;
|
||||||
|
displayName = "$STR_a3_rscdisplayarsenal_stat_weight";
|
||||||
showText = 1;
|
showText = 1;
|
||||||
textStatement = QUOTE([ARR_2(_this select 0, _this select 1)] call FUNC(statTextStatement_mass));
|
textStatement = QUOTE([ARR_2(_this select 0, _this select 1)] call FUNC(statTextStatement_mass));
|
||||||
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}, {0,1,2,3,4,5,6,7}};
|
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}, {0,1,2,3,4,5,6,7}};
|
||||||
@ -30,7 +31,7 @@ class GVAR(stats) {
|
|||||||
scope = 2;
|
scope = 2;
|
||||||
priority = 5;
|
priority = 5;
|
||||||
stats[] = {"reloadTime"};
|
stats[] = {"reloadTime"};
|
||||||
displayName= "$STR_a3_rscdisplayarsenal_stat_rof";
|
displayName = "$STR_a3_rscdisplayarsenal_stat_rof";
|
||||||
showBar = 1;
|
showBar = 1;
|
||||||
showText = 1;
|
showText = 1;
|
||||||
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-1.4, 0.31)], [ARR_2(1, 0.01)])])] call FUNC(statBarStatement_rateOfFIre));
|
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-1.4, 0.31)], [ARR_2(1, 0.01)])])] call FUNC(statBarStatement_rateOfFIre));
|
||||||
@ -50,7 +51,7 @@ class GVAR(stats) {
|
|||||||
};
|
};
|
||||||
class ACE_maxZeroing: statBase {
|
class ACE_maxZeroing: statBase {
|
||||||
scope = 2;
|
scope = 2;
|
||||||
priority = 3;
|
priority = 3.2;
|
||||||
stats[] = {"maxZeroing"};
|
stats[] = {"maxZeroing"};
|
||||||
displayName = "$STR_a3_rscdisplayarsenal_stat_range";
|
displayName = "$STR_a3_rscdisplayarsenal_stat_range";
|
||||||
showBar = 1;
|
showBar = 1;
|
||||||
@ -59,11 +60,11 @@ class GVAR(stats) {
|
|||||||
};
|
};
|
||||||
class ACE_impact: statBase {
|
class ACE_impact: statBase {
|
||||||
scope = 2;
|
scope = 2;
|
||||||
priority = 2;
|
priority = 3.1;
|
||||||
stats[] = {"hit", "initSpeed"};
|
stats[] = {"hit", "initSpeed"};
|
||||||
displayName = "$STR_a3_rscdisplayarsenal_stat_impact";
|
displayName = "$STR_a3_rscdisplayarsenal_stat_impact";
|
||||||
showBar = 1;
|
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}, {}};
|
tabs[] = {{0,1,2}, {}};
|
||||||
};
|
};
|
||||||
class ACE_scopeMagnification: statBase {
|
class ACE_scopeMagnification: statBase {
|
||||||
@ -76,7 +77,7 @@ class GVAR(stats) {
|
|||||||
};
|
};
|
||||||
class ACE_scopeVisionMode: statBase {
|
class ACE_scopeVisionMode: statBase {
|
||||||
scope = 2;
|
scope = 2;
|
||||||
priority = 1;
|
priority = 1.6;
|
||||||
displayName = CSTRING(statVisionMode);
|
displayName = CSTRING(statVisionMode);
|
||||||
showText = 1;
|
showText = 1;
|
||||||
textStatement = QUOTE(call FUNC(statTextStatement_scopeVisionMode));
|
textStatement = QUOTE(call FUNC(statTextStatement_scopeVisionMode));
|
||||||
@ -125,7 +126,6 @@ class GVAR(stats) {
|
|||||||
displayName = CSTRING(StatExplosionTime);
|
displayName = CSTRING(StatExplosionTime);
|
||||||
showText = 1;
|
showText = 1;
|
||||||
textStatement = QUOTE(call FUNC(statTextStatement_explosionTime));
|
textStatement = QUOTE(call FUNC(statTextStatement_explosionTime));
|
||||||
condition = QUOTE(true);
|
|
||||||
tabs[] = {{}, {5}};
|
tabs[] = {{}, {5}};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
10
addons/arsenal/CfgWeapons.hpp
Normal file
10
addons/arsenal/CfgWeapons.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CfgWeapons {
|
||||||
|
class ItemCore;
|
||||||
|
class ToolKit: ItemCore {
|
||||||
|
ACE_isTool = 1; // sort in Tools Tab
|
||||||
|
};
|
||||||
|
class DetectorCore;
|
||||||
|
class MineDetector: DetectorCore {
|
||||||
|
ACE_isTool = 1; // sort in Tools Tab
|
||||||
|
};
|
||||||
|
};
|
@ -15,6 +15,7 @@ PREP(attributeKeyDown);
|
|||||||
PREP(attributeLoad);
|
PREP(attributeLoad);
|
||||||
PREP(attributeMode);
|
PREP(attributeMode);
|
||||||
PREP(attributeSelect);
|
PREP(attributeSelect);
|
||||||
|
PREP(baseWeapon);
|
||||||
PREP(buttonCargo);
|
PREP(buttonCargo);
|
||||||
PREP(buttonClearAll);
|
PREP(buttonClearAll);
|
||||||
PREP(buttonExport);
|
PREP(buttonExport);
|
||||||
@ -34,7 +35,6 @@ PREP(fillLeftPanel);
|
|||||||
PREP(fillLoadoutsList);
|
PREP(fillLoadoutsList);
|
||||||
PREP(fillRightPanel);
|
PREP(fillRightPanel);
|
||||||
PREP(fillSort);
|
PREP(fillSort);
|
||||||
PREP(getLoadout);
|
|
||||||
PREP(handleLoadoutsSearchbar);
|
PREP(handleLoadoutsSearchbar);
|
||||||
PREP(handleMouse);
|
PREP(handleMouse);
|
||||||
PREP(handleScrollWheel);
|
PREP(handleScrollWheel);
|
||||||
@ -59,8 +59,10 @@ PREP(open3DEN);
|
|||||||
PREP(openBox);
|
PREP(openBox);
|
||||||
PREP(portVALoadouts);
|
PREP(portVALoadouts);
|
||||||
PREP(removeBox);
|
PREP(removeBox);
|
||||||
|
PREP(removeSort);
|
||||||
PREP(removeStat);
|
PREP(removeStat);
|
||||||
PREP(removeVirtualItems);
|
PREP(removeVirtualItems);
|
||||||
|
PREP(replaceUniqueItemsLoadout);
|
||||||
PREP(scanConfig);
|
PREP(scanConfig);
|
||||||
PREP(showItem);
|
PREP(showItem);
|
||||||
PREP(sortPanel);
|
PREP(sortPanel);
|
||||||
@ -85,5 +87,6 @@ PREP(statTextStatement_scopeVisionMode);
|
|||||||
PREP(statTextStatement_smokeChemTTL);
|
PREP(statTextStatement_smokeChemTTL);
|
||||||
PREP(updateCamPos);
|
PREP(updateCamPos);
|
||||||
PREP(updateRightPanel);
|
PREP(updateRightPanel);
|
||||||
|
PREP(updateCurrentItemsList);
|
||||||
PREP(updateUniqueItemsList);
|
PREP(updateUniqueItemsList);
|
||||||
PREP(verifyLoadout);
|
PREP(verifyLoadout);
|
||||||
|
@ -9,43 +9,40 @@ GVAR(lastSearchTextRight) = "";
|
|||||||
GVAR(lastSearchTextLoadouts) = "";
|
GVAR(lastSearchTextLoadouts) = "";
|
||||||
GVAR(lastSortLeft) = "";
|
GVAR(lastSortLeft) = "";
|
||||||
GVAR(lastSortRight) = "";
|
GVAR(lastSortRight) = "";
|
||||||
|
GVAR(lastSortDirectionLeft) = DESCENDING;
|
||||||
|
GVAR(lastSortDirectionRight) = DESCENDING;
|
||||||
|
|
||||||
[QGVAR(initBox), {_this call FUNC(initBox)}] call CBA_fnc_addEventHandler;
|
[QGVAR(initBox), LINKFUNC(initBox)] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(removeBox), {_this call FUNC(removeBox)}] call CBA_fnc_addEventHandler;
|
[QGVAR(removeBox), LINKFUNC(removeBox)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QGVAR(broadcastFace), {
|
[QGVAR(broadcastFace), {
|
||||||
params ["_unit", "_face"];
|
params ["_unit", "_face"];
|
||||||
|
|
||||||
_unit setFace _face;
|
_unit setFace _face;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QGVAR(broadcastVoice), {
|
[QGVAR(broadcastVoice), {
|
||||||
params ["_unit", "_voice"];
|
params ["_unit", "_voice"];
|
||||||
|
|
||||||
_unit setSpeaker _voice;
|
_unit setSpeaker _voice;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QGVAR(loadoutUnshared), {
|
[QGVAR(loadoutUnshared), {
|
||||||
params ["_contentPanelCtrl" , "_playerName", "_loadoutName"];
|
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 {
|
if (!isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {
|
||||||
|
|
||||||
private _dataToCheck = _playerName + _loadoutName;
|
private _dataToCheck = _playerName + _loadoutName;
|
||||||
|
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
if ((_contentPanelCtrl lnbData [_i, 1]) == _dataToCheck) exitwith {_contentPanelCtrl lnbDeleteRow _i};
|
if ((_contentPanelCtrl lnbData [_lbIndex, 1]) == _dataToCheck) exitWith {
|
||||||
|
_contentPanelCtrl lnbDeleteRow _lbIndex;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
if (profileName == _playerName && {!(isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts})}) then {
|
||||||
if (
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
profileName == _playerName &&
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _loadoutName) exitWith {
|
||||||
{!(isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts})}
|
_contentPanelCtrl lnbSetPicture [[_lbIndex, 0], QPATHTOF(data\iconPublicBlank.paa)];
|
||||||
) then {
|
_contentPanelCtrl lnbSetValue [[_lbIndex, 0], 0];
|
||||||
|
|
||||||
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];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -53,53 +50,99 @@ GVAR(lastSortRight) = "";
|
|||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QGVAR(loadoutShared), {
|
[QGVAR(loadoutShared), {
|
||||||
params ["_contentPanelCtrl" ,"_loadoutArgs"];
|
params ["_contentPanelCtrl", "_loadoutArgs"];
|
||||||
_loadoutArgs params ["_playerName", "_loadoutName", "_loadoutData"];
|
_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 {
|
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"];
|
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
|
||||||
|
_extendedLoadout params ["_loadout"];
|
||||||
|
|
||||||
private _newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
|
private _newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
|
||||||
_extendedLoadout params ["_loadout"];
|
|
||||||
ADD_LOADOUTS_LIST_PICTURES
|
ADD_LOADOUTS_LIST_PICTURES
|
||||||
|
|
||||||
_contentPanelCtrl lnbSetData [[_newRow, 1], _playerName + _loadoutName];
|
_contentPanelCtrl lnbSetData [[_newRow, 1], _playerName + _loadoutName];
|
||||||
|
|
||||||
|
// Set color of row, depending if items are unavailable/missing
|
||||||
if (_nullItemsAmount > 0) then {
|
if (_nullItemsAmount > 0) then {
|
||||||
|
|
||||||
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]];
|
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (_unavailableItemsAmount > 0) then {
|
if (_unavailableItemsAmount > 0) then {
|
||||||
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
|
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Sort loadouts alphabetically
|
||||||
_contentPanelCtrl lnbSort [1, false];
|
_contentPanelCtrl lnbSort [1, false];
|
||||||
|
|
||||||
// Select previously selected loadout
|
// Select previously selected loadout
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _curSelData) exitwith {_contentPanelCtrl lnbSetCurSelRow _i};
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _curSelData) exitWith {
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow _lbIndex
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
["CBA_loadoutSet", {
|
["CBA_loadoutSet", {
|
||||||
params ["_unit", "_loadout", "_extendedInfo"];
|
params ["_unit", "_loadout", "_extendedInfo"];
|
||||||
|
|
||||||
|
// Set face
|
||||||
private _face = _extendedInfo getOrDefault [QGVAR(face), ""];
|
private _face = _extendedInfo getOrDefault [QGVAR(face), ""];
|
||||||
|
|
||||||
if (_face != "") then {
|
if (_face != "") then {
|
||||||
_unit setFace _face;
|
if (isMultiplayer) then {
|
||||||
|
private _id = [QGVAR(broadcastFace), [_unit, _face], QGVAR(centerFace_) + netId _unit] call CBA_fnc_globalEventJIP;
|
||||||
|
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
|
||||||
|
} else {
|
||||||
|
_unit setFace _face;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set voice
|
||||||
private _voice = _extendedInfo getOrDefault [QGVAR(voice), ""];
|
private _voice = _extendedInfo getOrDefault [QGVAR(voice), ""];
|
||||||
|
|
||||||
if (_voice != "") then {
|
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), ""];
|
private _insignia = _extendedInfo getOrDefault [QGVAR(insignia), ""];
|
||||||
|
|
||||||
if (_insignia != "") then {
|
if (_insignia != "") then {
|
||||||
_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil];
|
_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;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,27 +1,17 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "defines.hpp"
|
#include "defines.hpp"
|
||||||
|
|
||||||
|
#define TOOLS_TAB_ICON "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa"
|
||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
PREP_RECOMPILE_START;
|
PREP_RECOMPILE_START;
|
||||||
#include "XEH_PREP.hpp"
|
#include "XEH_PREP.hpp"
|
||||||
PREP_RECOMPILE_END;
|
PREP_RECOMPILE_END;
|
||||||
|
|
||||||
// Arsenal
|
#include "initSettings.sqf"
|
||||||
[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;
|
|
||||||
|
|
||||||
// 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(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;
|
|
||||||
|
|
||||||
|
// Arsenal events
|
||||||
[QGVAR(statsToggle), {
|
[QGVAR(statsToggle), {
|
||||||
params ["_display", "_showStats"];
|
params ["_display", "_showStats"];
|
||||||
|
|
||||||
@ -54,25 +44,31 @@ PREP_RECOMPILE_END;
|
|||||||
_this call FUNC(buttonStatsPage);
|
_this call FUNC(buttonStatsPage);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
|
||||||
[QGVAR(displayStats), {
|
[QGVAR(displayStats), {
|
||||||
_this call FUNC(handleStats);
|
_this call FUNC(handleStats);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Compile sorts and stats
|
||||||
call FUNC(compileStats);
|
call FUNC(compileStats);
|
||||||
call FUNC(compileSorts);
|
call FUNC(compileSorts);
|
||||||
|
|
||||||
[QUOTE(ADDON), {!isNil QGVAR(camera)}] call CBA_fnc_registerFeatureCamera;
|
[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), {
|
[QGVAR(displayOpened), {
|
||||||
"cba_optics_arsenalOpened" call CBA_fnc_localEvent;
|
"CBA_optics_arsenalOpened" call CBA_fnc_localEvent;
|
||||||
"cba_disposable_arsenalOpened" call CBA_fnc_localEvent;
|
"CBA_disposable_arsenalOpened" call CBA_fnc_localEvent;
|
||||||
|
EGVAR(common,blockItemReplacement) = true;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[QGVAR(displayClosed), {
|
[QGVAR(displayClosed), {
|
||||||
"cba_optics_arsenalClosed" call CBA_fnc_localEvent;
|
"CBA_optics_arsenalClosed" call CBA_fnc_localEvent;
|
||||||
"cba_disposable_arsenalClosed" call CBA_fnc_localEvent;
|
"CBA_disposable_arsenalClosed" call CBA_fnc_localEvent;
|
||||||
|
EGVAR(common,blockItemReplacement) = false;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Setup Tools tab
|
||||||
|
[keys (uiNamespace getVariable [QGVAR(configItemsTools), createHashMap]), LLSTRING(toolsTab), TOOLS_TAB_ICON, -1, true] call FUNC(addRightPanelButton);
|
||||||
|
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -2,4 +2,12 @@
|
|||||||
|
|
||||||
#include "XEH_PREP.hpp"
|
#include "XEH_PREP.hpp"
|
||||||
|
|
||||||
|
// Cache for FUNC(baseWeapon)
|
||||||
|
uiNamespace setVariable [QGVAR(baseWeaponNameCache), createHashMap];
|
||||||
|
|
||||||
|
// Caches for names, pictures, mod icons
|
||||||
|
uiNamespace setVariable [QGVAR(addListBoxItemCache), createHashMap];
|
||||||
|
uiNamespace setVariable [QGVAR(rightPanelCache), createHashMap];
|
||||||
|
uiNamespace setVariable [QGVAR(sortCache), createHashMap];
|
||||||
|
|
||||||
call FUNC(scanConfig);
|
call FUNC(scanConfig);
|
||||||
|
@ -8,7 +8,7 @@ class CfgPatches {
|
|||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_common"};
|
requiredAddons[] = {"ace_common"};
|
||||||
author = ECSTRING(common,ACETeam);
|
author = ECSTRING(common,ACETeam);
|
||||||
authors[] = {"alganthe", "mharis001", "Brett Mayson"};
|
authors[] = {"alganthe", "mharis001", "Brett Mayson", "johnb43"};
|
||||||
url = ECSTRING(main,URL);
|
url = ECSTRING(main,URL);
|
||||||
VERSION_CONFIG;
|
VERSION_CONFIG;
|
||||||
};
|
};
|
||||||
@ -19,6 +19,7 @@ class CfgPatches {
|
|||||||
#include "Display3DEN.hpp"
|
#include "Display3DEN.hpp"
|
||||||
#include "Cfg3DEN.hpp"
|
#include "Cfg3DEN.hpp"
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
|
#include "CfgWeapons.hpp"
|
||||||
#include "RscDisplayMain.hpp"
|
#include "RscDisplayMain.hpp"
|
||||||
#include "ACE_Arsenal_Sorts.hpp"
|
#include "ACE_Arsenal_Sorts.hpp"
|
||||||
#include "ACE_Arsenal_Stats.hpp"
|
#include "ACE_Arsenal_Stats.hpp"
|
||||||
|
@ -7,6 +7,18 @@
|
|||||||
#define WIDTH_GAP (WIDTH_TOTAL / 100)
|
#define WIDTH_GAP (WIDTH_TOTAL / 100)
|
||||||
#define WIDTH_SINGLE ((WIDTH_TOTAL - 6 * WIDTH_GAP) / 5)
|
#define WIDTH_SINGLE ((WIDTH_TOTAL - 6 * WIDTH_GAP) / 5)
|
||||||
|
|
||||||
|
// IDDs
|
||||||
|
#define IDD_MISSION 46
|
||||||
|
#define IDD_RSCDISPLAYCURATOR 312
|
||||||
|
#define IDD_DISPLAY3DEN 313
|
||||||
|
|
||||||
|
#define IDC_OK 1 // emulate "OK" button
|
||||||
|
#define IDC_CANCEL 2 // emulate "Cancel" button
|
||||||
|
|
||||||
|
// Sorting
|
||||||
|
#define ASCENDING 0
|
||||||
|
#define DESCENDING 1
|
||||||
|
|
||||||
// IDCs
|
// IDCs
|
||||||
#define IDD_ace_arsenal 1127001
|
#define IDD_ace_arsenal 1127001
|
||||||
#define IDC_mouseArea 0
|
#define IDC_mouseArea 0
|
||||||
@ -38,7 +50,9 @@
|
|||||||
#define IDC_rightTabContent 14
|
#define IDC_rightTabContent 14
|
||||||
#define IDC_rightTabContentListnBox 15
|
#define IDC_rightTabContentListnBox 15
|
||||||
#define IDC_sortLeftTab 16
|
#define IDC_sortLeftTab 16
|
||||||
|
#define IDC_sortLeftTabDirection 161
|
||||||
#define IDC_sortRightTab 17
|
#define IDC_sortRightTab 17
|
||||||
|
#define IDC_sortRightTabDirection 171
|
||||||
#define IDC_leftSearchbar 18
|
#define IDC_leftSearchbar 18
|
||||||
#define IDC_leftSearchbarButton 41
|
#define IDC_leftSearchbarButton 41
|
||||||
#define IDC_rightSearchbar 19
|
#define IDC_rightSearchbar 19
|
||||||
@ -165,12 +179,45 @@
|
|||||||
#define IDC_ATTRIBUTE_IMPORT_BUTTON 8109
|
#define IDC_ATTRIBUTE_IMPORT_BUTTON 8109
|
||||||
#define IDC_ATTRIBUTE_ADD_COMPATIBLE 8110
|
#define IDC_ATTRIBUTE_ADD_COMPATIBLE 8110
|
||||||
|
|
||||||
|
// Indexes of categories
|
||||||
|
#define IDX_CAT_ALL 0
|
||||||
|
#define IDX_CAT_PRIMARY_WEAPON 1
|
||||||
|
#define IDX_CAT_SECONDARY_WEAPON 2
|
||||||
|
#define IDX_CAT_HANDGUN_WEAPON 3
|
||||||
|
#define IDX_CAT_OPTICS_ATTACHMENTS 4
|
||||||
|
#define IDX_CAT_FLASHLIGHT_ATTACHMENTS 5
|
||||||
|
#define IDX_CAT_MUZZLE_ATTACHMENTS 6
|
||||||
|
#define IDX_CAT_BIPOD_ATTACHMENTS 7
|
||||||
|
#define IDX_CAT_ITEMS_ALL 8
|
||||||
|
#define IDX_CAT_HEADGEAR 9
|
||||||
|
#define IDX_CAT_UNIFORM 10
|
||||||
|
#define IDX_CAT_VEST 11
|
||||||
|
#define IDX_CAT_BACKPACK 12
|
||||||
|
#define IDX_CAT_GOGGLES 13
|
||||||
|
#define IDX_CAT_NVG 14
|
||||||
|
#define IDX_CAT_BINO 15
|
||||||
|
#define IDX_CAT_MAP 16
|
||||||
|
#define IDX_CAT_COMPASS 17
|
||||||
|
#define IDX_CAT_RADIO 18
|
||||||
|
#define IDX_CAT_WATCH 19
|
||||||
|
#define IDX_CAT_COMMS 20
|
||||||
|
#define IDX_CAT_GRENADES 21
|
||||||
|
#define IDX_CAT_EXPLOSIVES 22
|
||||||
|
#define IDX_CAT_MISC_ITEMS 23
|
||||||
|
|
||||||
// Indexes of virtual items array
|
// Indexes of virtual items array
|
||||||
#define IDX_VIRT_WEAPONS 0
|
#define IDX_VIRT_WEAPONS 0
|
||||||
#define IDX_VIRT_ATTACHEMENTS 1
|
#define IDX_VIRT_PRIMARY_WEAPONS 0
|
||||||
|
#define IDX_VIRT_SECONDARY_WEAPONS 1
|
||||||
|
#define IDX_VIRT_HANDGUN_WEAPONS 2
|
||||||
|
|
||||||
|
#define IDX_VIRT_ATTACHMENTS 1
|
||||||
|
#define IDX_VIRT_OPTICS_ATTACHMENTS 0
|
||||||
|
#define IDX_VIRT_FLASHLIGHT_ATTACHMENTS 1
|
||||||
|
#define IDX_VIRT_MUZZLE_ATTACHMENTS 2
|
||||||
|
#define IDX_VIRT_BIPOD_ATTACHMENTS 3
|
||||||
|
|
||||||
#define IDX_VIRT_ITEMS_ALL 2
|
#define IDX_VIRT_ITEMS_ALL 2
|
||||||
|
|
||||||
#define IDX_VIRT_HEADGEAR 3
|
#define IDX_VIRT_HEADGEAR 3
|
||||||
#define IDX_VIRT_UNIFORM 4
|
#define IDX_VIRT_UNIFORM 4
|
||||||
#define IDX_VIRT_VEST 5
|
#define IDX_VIRT_VEST 5
|
||||||
@ -183,6 +230,54 @@
|
|||||||
#define IDX_VIRT_RADIO 12
|
#define IDX_VIRT_RADIO 12
|
||||||
#define IDX_VIRT_WATCH 13
|
#define IDX_VIRT_WATCH 13
|
||||||
#define IDX_VIRT_COMMS 14
|
#define IDX_VIRT_COMMS 14
|
||||||
|
#define IDX_VIRT_GRENADES 15
|
||||||
|
#define IDX_VIRT_EXPLOSIVES 16
|
||||||
|
#define IDX_VIRT_MISC_ITEMS 17
|
||||||
|
|
||||||
|
#define IDX_VIRT_UNIQUE_MISC_ITEMS 18
|
||||||
|
#define IDX_VIRT_UNIQUE_VIRT_ITEMS_ALL 19
|
||||||
|
#define IDX_VIRT_UNIQUE_GRENADES 20
|
||||||
|
#define IDX_VIRT_UNIQUE_EXPLOSIVES 21
|
||||||
|
#define IDX_VIRT_UNIQUE_ATTACHMENTS 22
|
||||||
|
#define IDX_VIRT_UNIQUE_BACKPACKS 23
|
||||||
|
#define IDX_VIRT_UNIQUE_GOGGLES 24
|
||||||
|
#define IDX_VIRT_UNIQUE_UNKNOWN_ITEMS 25
|
||||||
|
|
||||||
|
// Indexes of current items array
|
||||||
|
#define IDX_CURR_PRIMARY_WEAPON 0
|
||||||
|
#define IDX_CURR_SECONDARY_WEAPON 1
|
||||||
|
#define IDX_CURR_HANDGUN_WEAPON 2
|
||||||
|
#define IDX_CURR_HEADGEAR 3
|
||||||
|
#define IDX_CURR_UNIFORM 4
|
||||||
|
#define IDX_CURR_VEST 5
|
||||||
|
#define IDX_CURR_BACKPACK 6
|
||||||
|
#define IDX_CURR_GOGGLES 7
|
||||||
|
#define IDX_CURR_NVG 8
|
||||||
|
#define IDX_CURR_BINO 9
|
||||||
|
#define IDX_CURR_MAP 10
|
||||||
|
#define IDX_CURR_COMPASS 11
|
||||||
|
#define IDX_CURR_RADIO 12
|
||||||
|
#define IDX_CURR_WATCH 13
|
||||||
|
#define IDX_CURR_COMMS 14
|
||||||
|
#define IDX_CURR_UNIFORM_ITEMS 15
|
||||||
|
#define IDX_CURR_VEST_ITEMS 16
|
||||||
|
#define IDX_CURR_BACKPACK_ITEMS 17
|
||||||
|
#define IDX_CURR_PRIMARY_WEAPON_ITEMS 18
|
||||||
|
#define IDX_CURR_SECONDARY_WEAPON_ITEMS 19
|
||||||
|
#define IDX_CURR_HANDGUN_WEAPON_ITEMS 20
|
||||||
|
#define IDX_CURR_BINO_ITEMS 21
|
||||||
|
|
||||||
|
// Indexes of loadout items array
|
||||||
|
#define IDX_LOADOUT_PRIMARY_WEAPON 0
|
||||||
|
#define IDX_LOADOUT_SECONDARY_WEAPON 1
|
||||||
|
#define IDX_LOADOUT_HANDGUN_WEAPON 2
|
||||||
|
#define IDX_LOADOUT_UNIFORM 3
|
||||||
|
#define IDX_LOADOUT_VEST 4
|
||||||
|
#define IDX_LOADOUT_BACKPACK 5
|
||||||
|
#define IDX_LOADOUT_HEADGEAR 6
|
||||||
|
#define IDX_LOADOUT_GOGGLES 7
|
||||||
|
#define IDX_LOADOUT_BINO 8
|
||||||
|
#define IDX_LOADOUT_ASSIGNEDITEMS 9
|
||||||
|
|
||||||
#define SYMBOL_ITEM_NONE "−"
|
#define SYMBOL_ITEM_NONE "−"
|
||||||
#define SYMBOL_ITEM_REMOVE "×"
|
#define SYMBOL_ITEM_REMOVE "×"
|
||||||
@ -199,31 +294,6 @@
|
|||||||
#define RIGHT_PANEL_ITEMS_BACKGROUND_IDCS IDC_iconBackgroundMag, IDC_iconBackgroundMagALL, IDC_iconBackgroundThrow, IDC_iconBackgroundPut, IDC_iconBackgroundMisc, RIGHT_PANEL_CUSTOM_BACKGROUND
|
#define RIGHT_PANEL_ITEMS_BACKGROUND_IDCS IDC_iconBackgroundMag, IDC_iconBackgroundMagALL, IDC_iconBackgroundThrow, IDC_iconBackgroundPut, IDC_iconBackgroundMisc, RIGHT_PANEL_CUSTOM_BACKGROUND
|
||||||
#define ARROWS_IDCS IDC_arrowMinus, IDC_arrowPlus
|
#define ARROWS_IDCS IDC_arrowMinus, IDC_arrowPlus
|
||||||
|
|
||||||
#define GETDLC\
|
|
||||||
{\
|
|
||||||
private _dlc = "";\
|
|
||||||
private _addons = configsourceaddonlist _this;\
|
|
||||||
if (count _addons > 0) then {\
|
|
||||||
private _mods = configsourcemodlist (configfile >> "CfgPatches" >> _addons select 0);\
|
|
||||||
if (count _mods > 0) then {\
|
|
||||||
_dlc = _mods select 0;\
|
|
||||||
};\
|
|
||||||
};\
|
|
||||||
_dlc\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ADDMODICON\
|
|
||||||
{\
|
|
||||||
private _dlcName = _this call GETDLC;\
|
|
||||||
if (_dlcName != "") then {\
|
|
||||||
_ctrlPanel lbsetpictureright [_lbAdd,(modParams [_dlcName,["logo"]]) param [0,""]];\
|
|
||||||
};\
|
|
||||||
};
|
|
||||||
|
|
||||||
#define ADDBINOCULARSMAG\
|
|
||||||
private _magazines = getarray (configfile >> "cfgweapons" >> _item >> "magazines");\
|
|
||||||
if (count _magazines > 0) then {GVAR(center) addmagazine (_magazines select 0)};
|
|
||||||
|
|
||||||
#define TOGGLE_RIGHT_PANEL_WEAPON\
|
#define TOGGLE_RIGHT_PANEL_WEAPON\
|
||||||
{\
|
{\
|
||||||
_x = _display displayCtrl _x;\
|
_x = _display displayCtrl _x;\
|
||||||
@ -231,26 +301,21 @@
|
|||||||
_x ctrlShow true;\
|
_x ctrlShow true;\
|
||||||
_x ctrlEnable true;\
|
_x ctrlEnable true;\
|
||||||
_x ctrlCommit FADE_DELAY;\
|
_x ctrlCommit FADE_DELAY;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_blockRightFrame,\
|
IDC_blockRightFrame,\
|
||||||
IDC_blockRighttBackground,\
|
IDC_blockRighttBackground,\
|
||||||
IDC_rightTabContent,\
|
IDC_rightTabContent,\
|
||||||
IDC_sortRightTab,\
|
IDC_sortRightTab,\
|
||||||
|
IDC_sortRightTabDirection,\
|
||||||
RIGHT_PANEL_ACC_IDCS,\
|
RIGHT_PANEL_ACC_IDCS,\
|
||||||
IDC_rightSearchbar,\
|
IDC_rightSearchbar,\
|
||||||
IDC_rightSearchbarButton,\
|
IDC_rightSearchbarButton,\
|
||||||
IDC_buttonCurrentMag\
|
IDC_buttonCurrentMag\
|
||||||
];\
|
];\
|
||||||
private _buttonCurrentMag2Ctrl = _display displayCtrl IDC_buttonCurrentMag2;\
|
private _buttonCurrentMag2Ctrl = _display displayCtrl IDC_buttonCurrentMag2;\
|
||||||
if (GVAR(currentLeftPanel) == IDC_buttonPrimaryWeapon) then {\
|
_buttonCurrentMag2Ctrl ctrlSetFade 0;\
|
||||||
_buttonCurrentMag2Ctrl ctrlSetFade 0;\
|
_buttonCurrentMag2Ctrl ctrlShow true;\
|
||||||
_buttonCurrentMag2Ctrl ctrlShow true;\
|
_buttonCurrentMag2Ctrl ctrlEnable true;\
|
||||||
_buttonCurrentMag2Ctrl ctrlEnable true;\
|
|
||||||
} else {\
|
|
||||||
_buttonCurrentMag2Ctrl ctrlSetFade 1;\
|
|
||||||
_buttonCurrentMag2Ctrl ctrlShow false;\
|
|
||||||
_buttonCurrentMag2Ctrl ctrlEnable false;\
|
|
||||||
};\
|
|
||||||
_buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
_buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
||||||
{\
|
{\
|
||||||
_x = _display displayCtrl _x;\
|
_x = _display displayCtrl _x;\
|
||||||
@ -258,7 +323,7 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
|||||||
_x ctrlShow false;\
|
_x ctrlShow false;\
|
||||||
_x ctrlEnable false;\
|
_x ctrlEnable false;\
|
||||||
_x ctrlCommit FADE_DELAY;\
|
_x ctrlCommit FADE_DELAY;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_loadIndicator,\
|
IDC_loadIndicator,\
|
||||||
RIGHT_PANEL_ITEMS_IDCS,\
|
RIGHT_PANEL_ITEMS_IDCS,\
|
||||||
IDC_rightTabContentListnBox,\
|
IDC_rightTabContentListnBox,\
|
||||||
@ -274,7 +339,7 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
|||||||
safezoneH - 28 * GRID_H\
|
safezoneH - 28 * GRID_H\
|
||||||
];\
|
];\
|
||||||
_x ctrlCommit 0;\
|
_x ctrlCommit 0;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_blockRightFrame,\
|
IDC_blockRightFrame,\
|
||||||
IDC_blockRighttBackground\
|
IDC_blockRighttBackground\
|
||||||
];
|
];
|
||||||
@ -286,12 +351,13 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
|||||||
_x ctrlShow true;\
|
_x ctrlShow true;\
|
||||||
_x ctrlEnable true;\
|
_x ctrlEnable true;\
|
||||||
_x ctrlCommit FADE_DELAY;\
|
_x ctrlCommit FADE_DELAY;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_blockRightFrame, \
|
IDC_blockRightFrame, \
|
||||||
IDC_blockRighttBackground,\
|
IDC_blockRighttBackground,\
|
||||||
IDC_loadIndicator,\
|
IDC_loadIndicator,\
|
||||||
IDC_rightTabContentListnBox,\
|
IDC_rightTabContentListnBox,\
|
||||||
IDC_sortRightTab,\
|
IDC_sortRightTab,\
|
||||||
|
IDC_sortRightTabDirection,\
|
||||||
IDC_tabRight,\
|
IDC_tabRight,\
|
||||||
RIGHT_PANEL_ACC_IDCS,\
|
RIGHT_PANEL_ACC_IDCS,\
|
||||||
RIGHT_PANEL_ITEMS_IDCS,\
|
RIGHT_PANEL_ITEMS_IDCS,\
|
||||||
@ -304,7 +370,7 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
|||||||
_x ctrlShow false;\
|
_x ctrlShow false;\
|
||||||
_x ctrlEnable false;\
|
_x ctrlEnable false;\
|
||||||
_x ctrlCommit FADE_DELAY;\
|
_x ctrlCommit FADE_DELAY;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_buttonCurrentMag,\
|
IDC_buttonCurrentMag,\
|
||||||
IDC_buttonCurrentMag2,\
|
IDC_buttonCurrentMag2,\
|
||||||
IDC_iconBackgroundCurrentMag,\
|
IDC_iconBackgroundCurrentMag,\
|
||||||
@ -319,7 +385,7 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
|
|||||||
safezoneH - 34 * GRID_H\
|
safezoneH - 34 * GRID_H\
|
||||||
];\
|
];\
|
||||||
_x ctrlCommit 0;\
|
_x ctrlCommit 0;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_blockRightFrame,\
|
IDC_blockRightFrame,\
|
||||||
IDC_blockRighttBackground\
|
IDC_blockRighttBackground\
|
||||||
];\
|
];\
|
||||||
@ -367,13 +433,14 @@ if (!isNil QGVAR(customRightPanelButtons)) then {\
|
|||||||
_x ctrlShow false;\
|
_x ctrlShow false;\
|
||||||
_x ctrlEnable false;\
|
_x ctrlEnable false;\
|
||||||
_x ctrlCommit FADE_DELAY;\
|
_x ctrlCommit FADE_DELAY;\
|
||||||
} foreach [\
|
} forEach [\
|
||||||
IDC_blockRightFrame,\
|
IDC_blockRightFrame,\
|
||||||
IDC_blockRighttBackground,\
|
IDC_blockRighttBackground,\
|
||||||
IDC_loadIndicator,\
|
IDC_loadIndicator,\
|
||||||
IDC_rightTabContent,\
|
IDC_rightTabContent,\
|
||||||
IDC_rightTabContentListnBox,\
|
IDC_rightTabContentListnBox,\
|
||||||
IDC_sortRightTab,\
|
IDC_sortRightTab,\
|
||||||
|
IDC_sortRightTabDirection,\
|
||||||
RIGHT_PANEL_ACC_BACKGROUND_IDCS,\
|
RIGHT_PANEL_ACC_BACKGROUND_IDCS,\
|
||||||
RIGHT_PANEL_ACC_IDCS,\
|
RIGHT_PANEL_ACC_IDCS,\
|
||||||
RIGHT_PANEL_ITEMS_BACKGROUND_IDCS,\
|
RIGHT_PANEL_ITEMS_BACKGROUND_IDCS,\
|
||||||
@ -387,83 +454,12 @@ if (!isNil QGVAR(customRightPanelButtons)) then {\
|
|||||||
IDC_iconBackgroundCurrentMag2\
|
IDC_iconBackgroundCurrentMag2\
|
||||||
];
|
];
|
||||||
|
|
||||||
#define LIST_DEFAULTS\
|
|
||||||
[\
|
|
||||||
[\
|
|
||||||
(primaryweapon GVAR(center) call bis_fnc_baseWeapon),\
|
|
||||||
(secondaryweapon GVAR(center) call bis_fnc_baseWeapon),\
|
|
||||||
(handgunweapon GVAR(center) call bis_fnc_baseWeapon)\
|
|
||||||
],\
|
|
||||||
[\
|
|
||||||
[primaryWeaponItems GVAR(center), secondaryWeaponItems GVAR(center), handgunItems GVAR(center)],\
|
|
||||||
[primaryWeaponMagazine GVAR(center), secondaryWeaponMagazine GVAR(center), handgunMagazine GVAR(center)]\
|
|
||||||
],\
|
|
||||||
uniformItems GVAR(center) + vestItems GVAR(center) + backpackItems GVAR(center),\
|
|
||||||
[headgear GVAR(center)],\
|
|
||||||
[uniform GVAR(center)],\
|
|
||||||
[vest GVAR(center)],\
|
|
||||||
[backpack GVAR(center)],\
|
|
||||||
[goggles GVAR(center)],\
|
|
||||||
[hmd GVAR(center)],\
|
|
||||||
[binocular GVAR(center)]\
|
|
||||||
]
|
|
||||||
|
|
||||||
#define CHECK_WEAPON_OR_ACC\
|
|
||||||
(_weaponsArray select 0) findIf {_x == _item} > -1 ||\
|
|
||||||
{(_weaponsArray select 1) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_weaponsArray select 2) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 9) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_accsArray select 0) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_accsArray select 1 findIf {_x == _item} > -1)} ||\
|
|
||||||
{(_accsArray select 2) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_accsArray select 3) findIf {_x == _item} > -1}
|
|
||||||
|
|
||||||
// PboProject 2.45 has problems with these macros for some reason, adding a single space before the \ fixes
|
|
||||||
#define CHECK_ASSIGNED_ITEMS \
|
|
||||||
(GVAR(virtualItems) select 10) findIf {_x == _item} > -1 ||\
|
|
||||||
{(GVAR(virtualItems) select 11) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 12) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 13) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 14) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 8) findIf {_x == _item} > -1}
|
|
||||||
|
|
||||||
#define CHECK_CONTAINER \
|
|
||||||
(GVAR(virtualItems) select 4) findIf {_x == _item} > -1 ||\
|
|
||||||
{(GVAR(virtualItems) select 5) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 6) findIf {_x == _item} > -1}
|
|
||||||
|
|
||||||
#define CLASS_CHECK_ITEM\
|
|
||||||
isClass (_weaponCfg >> _item) ||\
|
|
||||||
{isClass (_vehcCfg >> _item)} ||\
|
|
||||||
{isClass (_glassesCfg >> _item)} ||\
|
|
||||||
{isClass (_magCfg >> _item)}
|
|
||||||
|
|
||||||
#define CHECK_CONTAINER_ITEMS \
|
|
||||||
(GVAR(virtualItems) select 3) findIf {_x == _item} > -1 ||\
|
|
||||||
{(_accsArray select 0) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_accsArray select 1) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_accsArray select 2) findIf {_x == _item} > -1} ||\
|
|
||||||
{(_accsArray select 3) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 4) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 5) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 6) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 7) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 8) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 10) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 11) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 12) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 13) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 14) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 15) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 16) findIf {_x == _item} > -1} ||\
|
|
||||||
{(GVAR(virtualItems) select 17) findIf {_x == _item} > -1}
|
|
||||||
|
|
||||||
#define ADD_LOADOUTS_LIST_PICTURES\
|
#define ADD_LOADOUTS_LIST_PICTURES\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (_cfgWeapons >> (_loadout select IDX_LOADOUT_PRIMARY_WEAPON) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadout select 1) select 0) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 3], getText (_cfgWeapons >> (_loadout select IDX_LOADOUT_SECONDARY_WEAPON) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadout select 2) select 0) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 4], getText (_cfgWeapons >> (_loadout select IDX_LOADOUT_HANDGUN_WEAPON) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadout select 3) select 0) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 5], getText (_cfgWeapons >> (_loadout select IDX_LOADOUT_UNIFORM) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadout select 4) select 0) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (_cfgWeapons >> (_loadout select IDX_LOADOUT_VEST) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "CfgVehicles" >> (_loadout select IDX_LOADOUT_BACKPACK) select 0 >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];\
|
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (_cfgWeapons >> _loadout select IDX_LOADOUT_HEADGEAR >> "picture")];\
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
|
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "CfgGlasses" >> _loadout select IDX_LOADOUT_GOGGLES >> "picture")];
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: 654wak654
|
* Author: 654wak654, johnb43
|
||||||
* Adds a loadout to the "Default Loadouts" list.
|
* Adds a loadout to the "Default Loadouts" list.
|
||||||
* If a loadout with the same name exists, it is overwritten.
|
* If a loadout with a similar name exists (case insensitve), it is overwritten.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Name of loadout <STRING>
|
* 0: Name of loadout <STRING>
|
||||||
@ -20,6 +20,8 @@
|
|||||||
params [["_name", "", [""]], ["_loadout", [], [[]]]];
|
params [["_name", "", [""]], ["_loadout", [], [[]]]];
|
||||||
|
|
||||||
private _extendedInfo = createHashMap;
|
private _extendedInfo = createHashMap;
|
||||||
|
|
||||||
|
// Check if CBA extended loadout array
|
||||||
if (count _loadout == 2) then {
|
if (count _loadout == 2) then {
|
||||||
_extendedInfo = _loadout select 1;
|
_extendedInfo = _loadout select 1;
|
||||||
_loadout = _loadout select 0;
|
_loadout = _loadout select 0;
|
||||||
@ -31,84 +33,15 @@ if (isNil QGVAR(defaultLoadoutsList)) then {
|
|||||||
GVAR(defaultLoadoutsList) = [];
|
GVAR(defaultLoadoutsList) = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
for "_dataIndex" from 0 to 10 do {
|
// Replace unique items with their bases and replace weapons with their base weapons
|
||||||
switch (_dataIndex) do {
|
_loadout = [_loadout] call FUNC(replaceUniqueItemsLoadout);
|
||||||
|
|
||||||
case 0;
|
private _index = GVAR(defaultLoadoutsList) findIf {(_x select 0) == _name};
|
||||||
case 1;
|
|
||||||
case 2;
|
|
||||||
case 8: {
|
|
||||||
if (count (_loadout select _dataIndex) > 0) then {
|
|
||||||
|
|
||||||
private _weapon = (_loadout select _dataIndex) select 0;
|
// If there is an already existing loadout with similar name, overwrite it
|
||||||
if (_weapon != "") then {
|
if (_index != -1) then {
|
||||||
|
GVAR(defaultLoadoutsList) set [_index, [_name, [_loadout, _extendedInfo]]];
|
||||||
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
|
|
||||||
if (_weapon != _baseWeapon) then {
|
|
||||||
(_loadout select _dataIndex) set [0, _baseWeapon];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case 3;
|
|
||||||
case 4;
|
|
||||||
case 5: {
|
|
||||||
if (count (_loadout select _dataIndex) > 0) then {
|
|
||||||
private _containerContents = (_loadout select _dataIndex) select 1;
|
|
||||||
|
|
||||||
if (count _containerContents > 0) then {
|
|
||||||
|
|
||||||
{
|
|
||||||
if (count _x == 2) then {
|
|
||||||
|
|
||||||
if ((_x select 0) isEqualType "") then {
|
|
||||||
|
|
||||||
private _item = (_x select 0);
|
|
||||||
if (_item != "") then {
|
|
||||||
|
|
||||||
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
|
|
||||||
if (_uniqueBaseCfgText != "") then {
|
|
||||||
|
|
||||||
_x set [0, _uniqueBaseCfgText];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
private _weapon = (_x select 0) select 0;
|
|
||||||
if (_weapon != "") then {
|
|
||||||
|
|
||||||
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
|
|
||||||
if (_weapon != _baseWeapon) then {
|
|
||||||
(_x select 0) set [0, _baseWeapon];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} foreach _containerContents;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case 9: {
|
|
||||||
for "_subIndex" from 0 to 4 do {
|
|
||||||
private _item = (_loadout select _dataIndex) select _subIndex;
|
|
||||||
|
|
||||||
if (_item != "") then {
|
|
||||||
|
|
||||||
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
|
|
||||||
if (_uniqueBaseCfgText != "") then {
|
|
||||||
|
|
||||||
(_loadout select _dataIndex) set [_subIndex, _uniqueBaseCfgText];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _loadoutIndex = (+(GVAR(defaultLoadoutsList))) findIf {(_x select 0) == _name};
|
|
||||||
if (_loadoutIndex == -1) then {
|
|
||||||
GVAR(defaultLoadoutsList) pushBack [_name, [_loadout, _extendedInfo]];
|
|
||||||
} else {
|
} else {
|
||||||
GVAR(defaultLoadoutsList) set [_loadoutIndex, [_name, [_loadout, _extendedInfo]]];
|
// Otherwise just add
|
||||||
|
GVAR(defaultLoadoutsList) pushBack [_name, [_loadout, _extendedInfo]];
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Dedmen
|
* Author: Dedmen, johnb43
|
||||||
* Add a listbox row.
|
* Add a listbox row.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Config category, must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice" <STRING>
|
* 0: Config category, must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice" or "CfgUnitInsignia" <STRING>
|
||||||
* 1: Classname <STRING>
|
* 1: Classname <STRING>
|
||||||
* 2: Panel control <CONTROL>
|
* 2: Panel control <CONTROL>
|
||||||
* 3: Name of the picture entry in that Cfg class <STRING>
|
* 3: Name of the picture entry in that Cfg class <STRING> (default: "picture")
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -20,43 +20,18 @@
|
|||||||
|
|
||||||
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
|
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
|
||||||
|
|
||||||
private _cacheNamespace = _ctrlPanel; //For better readability.
|
// Sanitise key, as it's public; If not in cache, find info and cache it for later use
|
||||||
|
((uiNamespace getVariable QGVAR(addListBoxItemCache)) getOrDefaultCall [_configCategory + _className, {
|
||||||
private _cachedItemInfo = _cacheNamespace getVariable [_configCategory+_className, []];
|
// Get classname (config case), display name, picture and DLC
|
||||||
|
|
||||||
//_cachedItemInfo == [_displayName, _itemPicture, _modPicture]
|
|
||||||
if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into cache.
|
|
||||||
|
|
||||||
private _configPath = configFile >> _configCategory >> _className;
|
private _configPath = configFile >> _configCategory >> _className;
|
||||||
|
private _dlcName = _configPath call EFUNC(common,getAddon);
|
||||||
|
|
||||||
_cachedItemInfo set [0, getText (_configPath >> "displayName")];
|
// If _pictureEntryName is empty, then this item has no picture (e.g. faces)
|
||||||
//if _pictureEntryName is empty then this item has no Icons. (Faces)
|
[configName _configPath, getText (_configPath >> "displayName"), if (_pictureEntryName == "") then {""} else {getText (_configPath >> _pictureEntryName)}, if (_dlcName != "") then {(modParams [_dlcName, ["logo"]]) param [0, ""]} else {""}]
|
||||||
_cachedItemInfo set [1, if (_pictureEntryName isEqualTo "") then {""} else {getText (_configPath >> _pictureEntryName)}];
|
}, true]) params ["_className", "_displayName", "_itemPicture", "_modPicture"];
|
||||||
|
|
||||||
//get name of DLC
|
|
||||||
private _dlcName = "";
|
|
||||||
private _addons = configsourceaddonlist _configPath;
|
|
||||||
if (_addons isNotEqualTo []) then {
|
|
||||||
private _mods = configsourcemodlist (configfile >> "CfgPatches" >> _addons select 0);
|
|
||||||
if (_mods isNotEqualTo []) then {
|
|
||||||
_dlcName = _mods select 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_dlcName != "") then {
|
|
||||||
_cachedItemInfo set [2, (modParams [_dlcName,["logo"]]) param [0,""]];//mod picture
|
|
||||||
} else {
|
|
||||||
_cachedItemInfo set [2, ""];//mod picture
|
|
||||||
_cachedItemInfo set [3, 0];//mod ID
|
|
||||||
};
|
|
||||||
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
|
|
||||||
};
|
|
||||||
|
|
||||||
_cachedItemInfo params ["_displayName", "_itemPicture", "_modPicture"];
|
|
||||||
|
|
||||||
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
|
||||||
|
|
||||||
|
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
||||||
_ctrlPanel lbSetData [_lbAdd, _className];
|
_ctrlPanel lbSetData [_lbAdd, _className];
|
||||||
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
||||||
_ctrlPanel lbSetPictureRight [_lbAdd,["",_modPicture] select (GVAR(enableModIcons))];
|
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
|
||||||
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
||||||
|
@ -1,55 +1,74 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: shukari, Schwaggot
|
* Author: shukari, Schwaggot, johnb43
|
||||||
* Adds a right panel button for uniforms, vests and backpacks with
|
* Adds a right panel button for uniforms, vests and backpacks with defined misc. items.
|
||||||
* defined misc items.
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: items only misc items <ARRAY of STRING>
|
* 0: Items, must be misc items <ARRAY of STRINGS>
|
||||||
* 1: tooltip <STRING> (default: "")
|
* 1: Tooltip <STRING> (default: "")
|
||||||
* 2: picture path <STRING> (default: QPATHTOF(data\iconCustom.paa))
|
* 2: Picture path <STRING> (default: QPATHTOF(data\iconCustom.paa))
|
||||||
* 3: override a specific button (0-9) <NUMBER> (default: -1)
|
* 3: Override a specific button (0-9) <NUMBER> (default: -1)
|
||||||
|
* 4: Move button if its position is overridden <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* successful: number of the slot (0-9); error: -1 <NUMBER>
|
* Successful: Number of the slot (0-9) <NUMBER>
|
||||||
|
* Error: -1 <NUMBER>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [["ACE_bloodIV_500", "ACE_Banana"], "MedicalStuff", "\z\ace\addons\arsenal\data\iconCustom.paa", 5] call ace_arsenal_fnc_addRightPanelButton
|
* [["ACE_bloodIV_500", "ACE_Banana"], "MedicalStuff", "\z\ace\addons\arsenal\data\iconCustom.paa", 5, false] call ace_arsenal_fnc_addRightPanelButton
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_items", [], [[]]], ["_tooltip", "", [""]], ["_picture", QPATHTOF(data\iconCustom.paa), [""]], ["_override", -1, [0]]];
|
params [["_items", [], [[]]], ["_tooltip", "", [""]], ["_picture", QPATHTOF(data\iconCustom.paa), [""]], ["_override", -1, [0]], ["_moveOnOverwrite", false, [false]]];
|
||||||
|
|
||||||
if (isNil QGVAR(customRightPanelButtons)) then {
|
if (isNil QGVAR(customRightPanelButtons)) then {
|
||||||
GVAR(customRightPanelButtons) = [];
|
GVAR(customRightPanelButtons) = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil];
|
||||||
};
|
};
|
||||||
|
|
||||||
private _position = count GVAR(customRightPanelButtons);
|
private _position = -1;
|
||||||
|
|
||||||
if (_override != -1 && {_override >= 0} && {_override <= 9}) then {
|
// See if override is valid
|
||||||
|
if (_override >= 0 && {_override <= 9}) then {
|
||||||
_position = _override;
|
_position = _override;
|
||||||
} else {
|
} else {
|
||||||
|
// Try to find an empty spot
|
||||||
private _emptyPos = GVAR(customRightPanelButtons) findIf {isNil "_x"};
|
private _emptyPos = GVAR(customRightPanelButtons) findIf {isNil "_x"};
|
||||||
|
|
||||||
if (_emptyPos != -1) then {
|
if (_emptyPos != -1) then {
|
||||||
_position = _emptyPos;
|
_position = _emptyPos;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
private _return = -1;
|
// If spot not found, return error
|
||||||
if (_position >= 0 && _position <= 9) then {
|
if (_position < 0 || {_position > 9}) exitWith {
|
||||||
private _cfgWeapons = configFile >> "CfgWeapons";
|
-1
|
||||||
_items = _items select {
|
|
||||||
private _configItemInfo = _cfgWeapons >> _x >> "ItemInfo";
|
|
||||||
|
|
||||||
_x isKindOf ["CBA_MiscItem", _cfgWeapons] && {getNumber (_configItemInfo >> "type") in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} ||
|
|
||||||
{getNumber (_configItemInfo >> "type") in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
|
||||||
{getText (_cfgWeapons >> _x >> "simulation") == "ItemMineDetector"}
|
|
||||||
};
|
|
||||||
|
|
||||||
_return = _position;
|
|
||||||
GVAR(customRightPanelButtons) set [_position, [_items apply {toLower _x}, _picture, _tooltip]];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_return
|
// Check if we're overwriting a button that's being force-kept
|
||||||
|
private _currentButtonInPosition = GVAR(customRightPanelButtons) select _position;
|
||||||
|
if (!isNil "_currentButtonInPosition") then {
|
||||||
|
_currentButtonInPosition params ["_cbItems", "_cbPicture", "_cbTooltip", "_cbMove"];
|
||||||
|
if (_cbMove) then {
|
||||||
|
[{_this call FUNC(addRightPanelButton)}, [_cbItems, _cbTooltip, _cbPicture, -1, _cbMove]] call CBA_fnc_execNextFrame;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// If spot found, add items and return position
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
private _configItemInfo = "";
|
||||||
|
|
||||||
|
_items = _items select {
|
||||||
|
_configItemInfo = _cfgWeapons >> _x >> "ItemInfo";
|
||||||
|
|
||||||
|
_x isKindOf ["CBA_MiscItem", _cfgWeapons] && {getNumber (_configItemInfo >> "type") in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} ||
|
||||||
|
{getNumber (_configItemInfo >> "type") in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
||||||
|
{getText (_cfgWeapons >> _x >> "simulation") == "ItemMineDetector"} ||
|
||||||
|
{getNumber (_cfgMagazines >> _x >> "ACE_isUnique") == 1}
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip, _moveOnOverwrite]];
|
||||||
|
|
||||||
|
_position
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Brett Mayson
|
* Author: Brett Mayson, johnb43
|
||||||
* Add a custom sorting method.
|
* Adds a custom sorting method.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Tabs to add stat to <ARRAY>
|
* 0: Tabs to add sort to <ARRAY>
|
||||||
* 0.0: Left Tab Indexes <ARRAY>
|
* 0.0: Left Tab Indexes <ARRAY of NUMBERS>
|
||||||
* 0.1: Right Tab Indexes <ARRAY>
|
* 0.1: Right Tab Indexes <ARRAY of NUMBERS>
|
||||||
* 1: Sort Class (a unique string for each algorithm) <STRING>
|
* 1: Sort Class (a unique string for each algorithm) <STRING>
|
||||||
* 2: Display Name <STRING>
|
* 2: Title <STRING>
|
||||||
* 3: Algorithm <CODE>
|
* 3: Algorithm <CODE>
|
||||||
* 4: Condition <CODE> (default: true)
|
* 4: Condition <CODE> (default: true)
|
||||||
*
|
*
|
||||||
@ -23,11 +23,11 @@
|
|||||||
*
|
*
|
||||||
* {
|
* {
|
||||||
* _fireRate pushBackUnique (getNumber (_itemCfg >> _x >> "reloadTime"));
|
* _fireRate pushBackUnique (getNumber (_itemCfg >> _x >> "reloadTime"));
|
||||||
* } foreach _fireModes;
|
* } forEach _fireModes;
|
||||||
*
|
*
|
||||||
* _fireRate sort true;
|
* _fireRate sort true;
|
||||||
* _fireRate param [0, 0]
|
* _fireRate param [0, 0]
|
||||||
* }] call ACE_arsenal_fnc_addSort;
|
* }] call ace_arsenal_fnc_addSort;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
@ -35,9 +35,10 @@
|
|||||||
params [
|
params [
|
||||||
["_tabs", [[], []], [[]], 2],
|
["_tabs", [[], []], [[]], 2],
|
||||||
["_class", "", [""]],
|
["_class", "", [""]],
|
||||||
["_displayName", "", [""]],
|
["_title", "", [""]],
|
||||||
["_statement", {}, [{}]],
|
["_statement", {}, [{}]],
|
||||||
["_condition", {true}, [{}]]
|
["_condition", {true}, [{}]],
|
||||||
|
["_overwrite", false, [false]]
|
||||||
];
|
];
|
||||||
|
|
||||||
_tabs params [
|
_tabs params [
|
||||||
@ -45,28 +46,46 @@ _tabs params [
|
|||||||
["_rightTabs", [], [[]]]
|
["_rightTabs", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Compile sorts from config (in case this is called before preInit)
|
||||||
call FUNC(compileSorts);
|
call FUNC(compileSorts);
|
||||||
|
|
||||||
private _returnArray = [];
|
private _return = [];
|
||||||
|
|
||||||
private _fnc_addToTabs = {
|
private _fnc_addToTabs = {
|
||||||
params ["_tabsList", "_tabsToAddTo", "_sideString"];
|
params ["_tabsList", "_tabsToAddTo", "_tabSide"];
|
||||||
|
|
||||||
|
private _sort = [];
|
||||||
|
private _sortName = "";
|
||||||
|
private _currentTab = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _arrayToSave = +_finalArray;
|
// Copy title, statement and condition
|
||||||
_arrayToSave set [0, [_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString ""];
|
_sort = +_finalArray;
|
||||||
_returnArray pushBack (_arrayToSave select 0);
|
|
||||||
(_tabsList select _x) pushBack _arrayToSave;
|
// Make sort name
|
||||||
|
_sortName = [_class, _tabSide, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "";
|
||||||
|
_sort set [0, _sortName];
|
||||||
|
|
||||||
|
_currentTab = _tabsList select _x;
|
||||||
|
|
||||||
|
// Find if there is an entry with same ID
|
||||||
|
if ((_currentTab findIf {(_x select 0) == _sortName}) == -1) then {
|
||||||
|
_currentTab pushBack _sort;
|
||||||
|
_return pushBack _sortName;
|
||||||
|
} else {
|
||||||
|
TRACE_1("A sort with this ID already exists", _sortName);
|
||||||
|
};
|
||||||
} forEach _tabsToAddTo;
|
} forEach _tabsToAddTo;
|
||||||
};
|
};
|
||||||
|
|
||||||
_finalArray = ["", _displayName, _statement, _condition];
|
private _finalArray = ["", _title, _statement, _condition];
|
||||||
|
|
||||||
if (_leftTabs isNotEqualTo []) then {
|
if (_leftTabs isNotEqualTo []) then {
|
||||||
[GVAR(sortListLeftPanel), _leftTabs, "L", 0] call _fnc_addToTabs;
|
[GVAR(sortListLeftPanel), _leftTabs, "L"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_rightTabs isNotEqualTo []) then {
|
if (_rightTabs isNotEqualTo []) then {
|
||||||
[GVAR(sortListRightPanel), _rightTabs, "R", 1] call _fnc_addToTabs;
|
[GVAR(sortListRightPanel), _rightTabs, "R"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
_returnArray
|
_return
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Add a stat to ACE Arsenal.
|
* Adds a stat to ACE Arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Tabs to add the stat to <ARRAY of ARRAYS>
|
* 0: Tabs to add the stat to <ARRAY of ARRAYS>
|
||||||
@ -11,22 +11,22 @@
|
|||||||
* 2: Config entries to pass <ARRAY of STRINGS>
|
* 2: Config entries to pass <ARRAY of STRINGS>
|
||||||
* 3: Title <STRING>
|
* 3: Title <STRING>
|
||||||
* 4: Show bar / show text bools <ARRAY of BOOLS>
|
* 4: Show bar / show text bools <ARRAY of BOOLS>
|
||||||
* 4.0: Show bar <BOOL>
|
* 4.0: Show bar <BOOL> (default: false)
|
||||||
* 4.1: Show text <BOOL>
|
* 4.1: Show text <BOOL> (default: false)
|
||||||
* 5: Array of statements <ARRAY of ARRAYS>
|
* 5: Array of statements <ARRAY of CODE>
|
||||||
* 5.0: Bar code <CODE>
|
* 5.0: Bar code <CODE> (default: {})
|
||||||
* 5.1: Text code <CODE>
|
* 5.1: Text code <CODE> (default: {})
|
||||||
* 5.2: Condition code <CODE>
|
* 5.2: Condition code <CODE> (default: {true})
|
||||||
* 6: Priority <NUMBER> (default: 0)
|
* 6: Priority <NUMBER> (default: 0)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0: Array of IDs <ARRAY of STRINGS>
|
* 0: Array of IDs <ARRAY of STRINGS>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[[0,1,2], [7]], "scopeStat", ["scope"], "Scope", [false, true], [{}, {
|
* [[[0, 1, 2], [7]], "scopeStat", ["scope"], "Scope", [false, true], [{}, {
|
||||||
* params ["_statsArray", "_itemCfg"];
|
* params ["_statsArray", "_itemCfg"];
|
||||||
* getNumber (_itemCfg >> _statsArray select 0)
|
* getNumber (_itemCfg >> _statsArray select 0)
|
||||||
* }, {true}]] call ACE_arsenal_fnc_addStat
|
* }, {true}]] call ace_arsenal_fnc_addStat
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,10 @@ _tabs params [
|
|||||||
["_rightTabs", [], [[]]]
|
["_rightTabs", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
_bools params [["_showBar", false, [false]], ["_showText", false, [false]]];
|
_bools params [
|
||||||
|
["_showBar", false, [false]],
|
||||||
|
["_showText", false, [false]]
|
||||||
|
];
|
||||||
|
|
||||||
_statements params [
|
_statements params [
|
||||||
["_barStatement", {}, [{}]],
|
["_barStatement", {}, [{}]],
|
||||||
@ -54,47 +57,100 @@ _statements params [
|
|||||||
["_condition", {true}, [{}]]
|
["_condition", {true}, [{}]]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Compile stats from config (in case this is called before preInit)
|
||||||
call FUNC(compileStats);
|
call FUNC(compileStats);
|
||||||
|
|
||||||
private _returnArray = [];
|
private _return = [];
|
||||||
|
private _changes = [];
|
||||||
|
|
||||||
private _fnc_addToTabs = {
|
private _fnc_addToTabs = {
|
||||||
params ["_tabsList", "_tabsToAddTo", "_sideString", "_returnIndex"];
|
params ["_tabsList", "_tabsToAddTo", "_tabSide"];
|
||||||
|
|
||||||
|
private _statName = "";
|
||||||
|
private _currentTab = [];
|
||||||
|
private _stat = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _currentTab = _tabsList select _x;
|
// Make stat name
|
||||||
|
_statName = [_class, _tabSide, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "";
|
||||||
|
_currentTab = _tabsList select _x;
|
||||||
|
|
||||||
private _finalID = [_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "";
|
// Find if there is an entry with same ID
|
||||||
|
if (_currentTab findIf {_x findIf {_x select 0 == _statName} != -1} != -1) then {
|
||||||
if ({{_x select 0 == _finalID} count _x > 0} count _currentTab > 0) then {
|
TRACE_1("A stat with this ID already exists", _statName);
|
||||||
TRACE_1("A stat with this ID already exists", _finalID);
|
|
||||||
} else {
|
} else {
|
||||||
|
_stat = +_finalArray;
|
||||||
|
_stat set [0, _statName];
|
||||||
|
|
||||||
private _arrayToSave = +_finalArray;
|
_index = _currentTab findIf {count _x < 5};
|
||||||
_arrayToSave set [0, _finalID];
|
|
||||||
_returnArray pushBack _finalID;
|
|
||||||
|
|
||||||
// Add to existing page if there's enough space, otherwise create a new page
|
// Add to existing page if there's enough space, otherwise create a new page
|
||||||
if ({count _x < 5} count _currentTab > 0) then {
|
if (_index != -1) then {
|
||||||
{
|
(_currentTab select _index) pushBack _stat;
|
||||||
if (count _x < 5) exitWith {
|
|
||||||
(_currentTab select _forEachIndex) append [_arrayToSave];
|
|
||||||
};
|
|
||||||
} foreach _currentTab;
|
|
||||||
} else {
|
} else {
|
||||||
_currentTab pushBack [_arrayToSave];
|
_currentTab pushBack [_stat];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_return pushBack _statName;
|
||||||
|
|
||||||
|
// Store information, so that only tabs that were changed can be sorted again
|
||||||
|
_changes pushBackUnique [_x, _tabSide];
|
||||||
};
|
};
|
||||||
} foreach _tabsToAddTo;
|
} forEach _tabsToAddTo;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _finalArray = ["", _stats, _title, [_showBar, _showText], [_barStatement, _textStatement, _condition], _priority];
|
private _finalArray = ["", _stats, _title, [_showBar, _showText], [_barStatement, _textStatement, _condition], _priority];
|
||||||
|
|
||||||
if (count _leftTabs > 0) then {
|
if (_leftTabs isNotEqualTo []) then {
|
||||||
[GVAR(statsListLeftPanel), _leftTabs, "L", 0] call _fnc_addToTabs;
|
[GVAR(statsListLeftPanel), _leftTabs, "L"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (count _rightTabs > 0) then {
|
if (_rightTabs isNotEqualTo []) then {
|
||||||
[GVAR(statsListRightPanel), _rightTabs, "R", 1] call _fnc_addToTabs;
|
[GVAR(statsListRightPanel), _rightTabs, "R"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
_returnArray
|
private _statsFlat = [];
|
||||||
|
private _stats = [];
|
||||||
|
private _tabToChange = [];
|
||||||
|
|
||||||
|
// Ensure priority is kept
|
||||||
|
{
|
||||||
|
_x params ["_tab", "_tabSide"];
|
||||||
|
|
||||||
|
_tabToChange = if (_tabSide == "R") then {
|
||||||
|
GVAR(statsListRightPanel)
|
||||||
|
} else {
|
||||||
|
GVAR(statsListLeftPanel)
|
||||||
|
};
|
||||||
|
|
||||||
|
_statsFlat = [];
|
||||||
|
|
||||||
|
// Get all stats of a tab into a single array
|
||||||
|
{
|
||||||
|
_statsFlat append _x;
|
||||||
|
} forEach (_tabToChange select _tab);
|
||||||
|
|
||||||
|
// Put priority up front
|
||||||
|
{
|
||||||
|
reverse _x;
|
||||||
|
} forEach _statsFlat;
|
||||||
|
|
||||||
|
// Sort numerically
|
||||||
|
_statsFlat sort false;
|
||||||
|
|
||||||
|
// Put it back at the rear
|
||||||
|
{
|
||||||
|
reverse _x;
|
||||||
|
} forEach _statsFlat;
|
||||||
|
|
||||||
|
_stats = [];
|
||||||
|
|
||||||
|
// Group stats into groups of 5
|
||||||
|
for "_index" from 0 to count _statsFlat - 1 step 5 do {
|
||||||
|
_stats pushBack (_statsFlat select [_index, _index + 5]);
|
||||||
|
};
|
||||||
|
|
||||||
|
_tabToChange set [_tab, _stats];
|
||||||
|
} forEach _changes;
|
||||||
|
|
||||||
|
_return
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe, Dedmen
|
* Author: Alganthe, Dedmen, johnb43
|
||||||
* Add virtual items to the provided target.
|
* Add virtual items to the provided target.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Target <OBJECT>
|
* 0: Target <OBJECT>
|
||||||
* 1: Items <ARRAY of strings> <BOOL>
|
* 1: Items <ARRAY of STRINGS> <BOOL>
|
||||||
* 2: Add globally <BOOL>
|
* 2: Add globally <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -21,206 +21,105 @@
|
|||||||
|
|
||||||
params [["_object", objNull, [objNull]], ["_items", [], [true, []]], ["_global", false, [false]]];
|
params [["_object", objNull, [objNull]], ["_items", [], [true, []]], ["_global", false, [false]]];
|
||||||
|
|
||||||
if (isNull _object) exitWith {};
|
if (isNull _object || {_items isEqualTo []}) exitWith {};
|
||||||
if (_items isEqualType [] && {count _items == 0}) exitWith {};
|
|
||||||
|
|
||||||
private _cargo = _object getVariable [QGVAR(virtualItems), [
|
private _cargo = _object getVariable QGVAR(virtualItems);
|
||||||
[[], [], []], // Weapons 0, primary, secondary, handgun
|
|
||||||
[[], [], [], []], // WeaponAccessories 1, optic,side,muzzle,bipod
|
|
||||||
[ ], // Magazines 2
|
|
||||||
[ ], // Headgear 3
|
|
||||||
[ ], // Uniform 4
|
|
||||||
[ ], // Vest 5
|
|
||||||
[ ], // Backpacks 6
|
|
||||||
[ ], // Goggles 7
|
|
||||||
[ ], // NVGs 8
|
|
||||||
[ ], // Binoculars 9
|
|
||||||
[ ], // Map 10
|
|
||||||
[ ], // Compass 11
|
|
||||||
[ ], // Radio slot 12
|
|
||||||
[ ], // Watch slot 13
|
|
||||||
[ ], // Comms slot 14
|
|
||||||
[ ], // WeaponThrow 15
|
|
||||||
[ ], // WeaponPut 16
|
|
||||||
[ ] // InventoryItems 17
|
|
||||||
]];
|
|
||||||
|
|
||||||
private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in variable for perf improvement
|
if (isNil "_cargo") then {
|
||||||
|
_cargo = [
|
||||||
|
[IDX_VIRT_WEAPONS, createHashMapFromArray [[IDX_VIRT_PRIMARY_WEAPONS, createHashMap], [IDX_VIRT_SECONDARY_WEAPONS, createHashMap], [IDX_VIRT_HANDGUN_WEAPONS, createHashMap]]],
|
||||||
|
[IDX_VIRT_ATTACHMENTS, createHashMapFromArray [[IDX_VIRT_OPTICS_ATTACHMENTS, createHashMap], [IDX_VIRT_FLASHLIGHT_ATTACHMENTS, createHashMap], [IDX_VIRT_MUZZLE_ATTACHMENTS, createHashMap], [IDX_VIRT_BIPOD_ATTACHMENTS, createHashMap]]]
|
||||||
|
];
|
||||||
|
|
||||||
|
_cargo = createHashMapFromArray _cargo;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_cargo set [_index, createHashMap];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// If passed arguement is "true", add all items
|
||||||
if (_items isEqualType true) then {
|
if (_items isEqualType true) then {
|
||||||
if (_items) then {
|
if (_items) then {
|
||||||
|
private _weapons = _cargo get IDX_VIRT_WEAPONS;
|
||||||
|
private _weaponAttachments = _cargo get IDX_VIRT_ATTACHMENTS;
|
||||||
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
|
|
||||||
|
// Add onto existing items, in case some items that were already added aren't available by default in the arsenal
|
||||||
{
|
{
|
||||||
(_x select 0) append (_x select 1);
|
(_x select 0) merge [_x select 1, true];
|
||||||
(_x select 2) set [(_x select 3), (_x select 0) arrayIntersect (_x select 0)];
|
(_x select 2) set [_x select 3, _x select 0];
|
||||||
} forEach [
|
} forEach [
|
||||||
[(_cargo select 0 select 0),(_configItems select 0 select 0), _cargo select 0, 0],
|
[_weapons get IDX_VIRT_PRIMARY_WEAPONS, _configItems get IDX_VIRT_WEAPONS get IDX_VIRT_PRIMARY_WEAPONS, _weapons, IDX_VIRT_PRIMARY_WEAPONS],
|
||||||
[(_cargo select 0 select 1),(_configItems select 0 select 1), _cargo select 0, 1],
|
[_weapons get IDX_VIRT_SECONDARY_WEAPONS, _configItems get IDX_VIRT_WEAPONS get IDX_VIRT_SECONDARY_WEAPONS, _weapons, IDX_VIRT_SECONDARY_WEAPONS],
|
||||||
[(_cargo select 0 select 2),(_configItems select 0 select 2), _cargo select 0, 2],
|
[_weapons get IDX_VIRT_HANDGUN_WEAPONS, _configItems get IDX_VIRT_WEAPONS get IDX_VIRT_HANDGUN_WEAPONS, _weapons, IDX_VIRT_HANDGUN_WEAPONS],
|
||||||
[(_cargo select 1 select 0),(_configItems select 1 select 0), _cargo select 1, 0],
|
[_weaponAttachments get IDX_VIRT_OPTICS_ATTACHMENTS, _configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_OPTICS_ATTACHMENTS, _weaponAttachments, IDX_VIRT_OPTICS_ATTACHMENTS],
|
||||||
[(_cargo select 1 select 1),(_configItems select 1 select 1), _cargo select 1, 1],
|
[_weaponAttachments get IDX_VIRT_FLASHLIGHT_ATTACHMENTS, _configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_FLASHLIGHT_ATTACHMENTS, _weaponAttachments, IDX_VIRT_FLASHLIGHT_ATTACHMENTS],
|
||||||
[(_cargo select 1 select 2),(_configItems select 1 select 2), _cargo select 1, 2],
|
[_weaponAttachments get IDX_VIRT_MUZZLE_ATTACHMENTS, _configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_MUZZLE_ATTACHMENTS, _weaponAttachments, IDX_VIRT_MUZZLE_ATTACHMENTS],
|
||||||
[(_cargo select 1 select 3),(_configItems select 1 select 3), _cargo select 1, 3]
|
[_weaponAttachments get IDX_VIRT_BIPOD_ATTACHMENTS, _configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_BIPOD_ATTACHMENTS, _weaponAttachments, IDX_VIRT_BIPOD_ATTACHMENTS]
|
||||||
];
|
];
|
||||||
|
|
||||||
for "_index" from 2 to 17 do {
|
// Add onto existing items, in case some items that were already added aren't available by default in the arsenal
|
||||||
(_cargo select _index) append (_configItems select _index);
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
_cargo set [_index, (_cargo select _index) arrayIntersect (_cargo select _index)];
|
(_cargo get _index) merge [_configItems get _index, true];
|
||||||
|
_cargo set [_index, _cargo get _index];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Make sure all items are in string form, then convert to config case (non-existent items return "")
|
||||||
|
_items = (_items select {_x isEqualType ""}) apply {_x call EFUNC(common,getConfigName)};
|
||||||
|
|
||||||
|
// Remove any invalid/non-existing items
|
||||||
|
_items = _items - [""];
|
||||||
|
|
||||||
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
|
private _configItemsFlat = uiNamespace getVariable QGVAR(configItemsFlat);
|
||||||
|
|
||||||
|
// Convert all items to their baseWeapon
|
||||||
|
_items = _items apply {if (_x in _configItemsFlat) then {_x} else {_x call FUNC(baseWeapon)}};
|
||||||
|
|
||||||
|
// Remove any items not found by the arsenal
|
||||||
|
_items = _items select {_x in _configItemsFlat};
|
||||||
|
|
||||||
|
// https://community.bistudio.com/wiki/Arma_3:_Characters_And_Gear_Encoding_Guide#Character_configuration
|
||||||
|
// https://github.com/acemod/ACE3/pull/9040#issuecomment-1597748331
|
||||||
{
|
{
|
||||||
if (_x isEqualType "") then {
|
switch (true) do {
|
||||||
private _configItemInfo = _configCfgWeapons >> _x >> "ItemInfo";
|
// Weapons
|
||||||
private _simulationType = getText (_configCfgWeapons >> _x >> "simulation");
|
case (_x in ((_configItems get IDX_VIRT_WEAPONS) get IDX_VIRT_PRIMARY_WEAPONS)): {
|
||||||
switch true do {
|
((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_PRIMARY_WEAPONS) set [_x, nil];
|
||||||
case (isClass (_configCfgWeapons >> _x)): {
|
};
|
||||||
switch true do {
|
case (_x in ((_configItems get IDX_VIRT_WEAPONS) get IDX_VIRT_HANDGUN_WEAPONS)): {
|
||||||
/* Weapon acc */
|
((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_HANDGUN_WEAPONS) set [_x, nil];
|
||||||
case (
|
};
|
||||||
isClass (_configItemInfo) &&
|
case (_x in ((_configItems get IDX_VIRT_WEAPONS) get IDX_VIRT_SECONDARY_WEAPONS)): {
|
||||||
{(getNumber (_configItemInfo >> "type")) in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} &&
|
((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_SECONDARY_WEAPONS) set [_x, nil];
|
||||||
{!(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}
|
};
|
||||||
): {
|
|
||||||
switch (getNumber (_configItemInfo >> "type")) do {
|
|
||||||
case TYPE_OPTICS: {
|
|
||||||
(_cargo select 1) select 0 pushBackUnique _x;
|
|
||||||
};
|
|
||||||
case TYPE_FLASHLIGHT: {
|
|
||||||
(_cargo select 1) select 1 pushBackUnique _x;
|
|
||||||
};
|
|
||||||
case TYPE_MUZZLE: {
|
|
||||||
(_cargo select 1) select 2 pushBackUnique _x;
|
|
||||||
};
|
|
||||||
case TYPE_BIPOD: {
|
|
||||||
(_cargo select 1) select 3 pushBackUnique _x;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
/* Headgear */
|
|
||||||
case (isClass (_configItemInfo) &&
|
|
||||||
{getNumber (_configItemInfo >> "type") == TYPE_HEADGEAR}): {
|
|
||||||
(_cargo select 3) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Uniform */
|
|
||||||
case (isClass (_configItemInfo) &&
|
|
||||||
{getNumber (_configItemInfo >> "type") == TYPE_UNIFORM}): {
|
|
||||||
(_cargo select 4) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Vest */
|
|
||||||
case (isClass (_configItemInfo) &&
|
|
||||||
{getNumber (_configItemInfo >> "type") == TYPE_VEST}): {
|
|
||||||
(_cargo select 5) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* NVgs */
|
|
||||||
case (_simulationType == "NVGoggles"): {
|
|
||||||
(_cargo select 8) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Binos */
|
|
||||||
case (_simulationType == "Binocular" ||
|
|
||||||
{(_simulationType == 'Weapon') && {(getNumber (_configCfgWeapons >> _x >> 'type') == TYPE_BINOCULAR_AND_NVG)}}): {
|
|
||||||
(_cargo select 9) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Map */
|
|
||||||
case (_simulationType == "ItemMap"): {
|
|
||||||
(_cargo select 10) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Compass */
|
|
||||||
case (_simulationType == "ItemCompass"): {
|
|
||||||
(_cargo select 11) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Radio */
|
|
||||||
case (_simulationType == "ItemRadio"): {
|
|
||||||
(_cargo select 12) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Watch */
|
|
||||||
case (_simulationType == "ItemWatch"): {
|
|
||||||
(_cargo select 13) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* GPS */
|
|
||||||
case (_simulationType == "ItemGPS"): {
|
|
||||||
(_cargo select 14) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* UAV terminals */
|
|
||||||
case (isClass (_configItemInfo) &&
|
|
||||||
{getNumber (_configItemInfo >> "type") == TYPE_UAV_TERMINAL}): {
|
|
||||||
(_cargo select 14) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
/* Weapon, at the bottom to avoid adding binos */
|
|
||||||
case (isClass (_configCfgWeapons >> _x >> "WeaponSlotsInfo") &&
|
|
||||||
{getNumber (_configCfgWeapons >> _x >> 'type') != TYPE_BINOCULAR_AND_NVG}): {
|
|
||||||
switch (getNumber (_configCfgWeapons >> _x >> "type")) do {
|
|
||||||
case TYPE_WEAPON_PRIMARY: {
|
|
||||||
(_cargo select 0) select 0 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
|
||||||
};
|
|
||||||
case TYPE_WEAPON_HANDGUN: {
|
|
||||||
(_cargo select 0) select 2 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
|
||||||
};
|
|
||||||
case TYPE_WEAPON_SECONDARY: {
|
|
||||||
(_cargo select 0) select 1 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
/* Misc items */
|
|
||||||
case (
|
|
||||||
isClass (_configItemInfo) &&
|
|
||||||
((getNumber (_configItemInfo >> "type")) in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD] &&
|
|
||||||
{(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
|
|
||||||
{(getNumber (_configItemInfo >> "type")) in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
|
||||||
{(getText (_configCfgWeapons >> _x >> "simulation")) == "ItemMineDetector"}
|
|
||||||
): {
|
|
||||||
(_cargo select 17) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
case (isClass (configFile >> "CfgMagazines" >> _x)): {
|
|
||||||
// Lists to check against
|
|
||||||
private _grenadeList = [];
|
|
||||||
{
|
|
||||||
_grenadeList append getArray (_configCfgWeapons >> "Throw" >> _x >> "magazines");
|
|
||||||
false
|
|
||||||
} count getArray (_configCfgWeapons >> "Throw" >> "muzzles");
|
|
||||||
|
|
||||||
private _putList = [];
|
// Weapon attachments
|
||||||
{
|
case (_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS)): {
|
||||||
_putList append getArray (_configCfgWeapons >> "Put" >> _x >> "magazines");
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS) set [_x, nil];
|
||||||
false
|
};
|
||||||
} count getArray (_configCfgWeapons >> "Put" >> "muzzles");
|
case (_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
case (_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
case (_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
|
||||||
// Check what the magazine actually is
|
// Other
|
||||||
switch true do {
|
default {
|
||||||
// Rifle, handgun, secondary weapons mags
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
case (
|
if (_x in (_configItems get _index)) exitWith {
|
||||||
((getNumber (configFile >> "CfgMagazines" >> _x >> "type") in [TYPE_MAGAZINE_PRIMARY_AND_THROW,TYPE_MAGAZINE_SECONDARY_AND_PUT,1536,TYPE_MAGAZINE_HANDGUN_AND_GL]) ||
|
(_cargo get _index) set [_x, nil];
|
||||||
{(getNumber (configFile >> "CfgMagazines" >> _x >> QGVAR(hide))) == -1}) &&
|
|
||||||
{!(_x in _grenadeList)} &&
|
|
||||||
{!(_x in _putList)}
|
|
||||||
): {
|
|
||||||
(_cargo select 2) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
// Grenades
|
|
||||||
case (_x in _grenadeList): {
|
|
||||||
(_cargo select 15) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
// Put
|
|
||||||
case (_x in _putList): {
|
|
||||||
(_cargo select 16) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case (isClass (configFile >> "CfgVehicles" >> _x)): {
|
|
||||||
if (getNumber (configFile >> "CfgVehicles" >> _x >> "isBackpack") == 1) then {
|
|
||||||
(_cargo select 6) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
case (isClass (configFile >> "CfgGlasses" >> _x)): {
|
|
||||||
(_cargo select 7) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach _items;
|
} forEach _items;
|
||||||
};
|
};
|
||||||
|
|
||||||
_object setVariable [QGVAR(virtualItems), _cargo, _global];
|
_object setVariable [QGVAR(virtualItems), _cargo, _global];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001, johnb43
|
||||||
* Adds compatible attachments or magazines for all weapons in 3DEN attribute.
|
* Adds compatible attachments or magazines for all weapons in 3DEN attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -21,55 +21,63 @@ params ["_controlsGroup"];
|
|||||||
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
|
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
|
||||||
|
|
||||||
// Exit if selected category is not attachments or magazines
|
// Exit if selected category is not attachments or magazines
|
||||||
if !(_category in [4, 5, 6, 7, 8]) exitWith {};
|
if !(_category in [IDX_CAT_OPTICS_ATTACHMENTS, IDX_CAT_FLASHLIGHT_ATTACHMENTS, IDX_CAT_MUZZLE_ATTACHMENTS, IDX_CAT_BIPOD_ATTACHMENTS, IDX_CAT_ITEMS_ALL]) exitWith {};
|
||||||
|
|
||||||
private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||||
_attributeValue params ["_attributeItems"];
|
_attributeValue params ["_attributeItems"];
|
||||||
|
|
||||||
// Get list of all weapons in attribute items
|
// Get list of all weapons in attribute items
|
||||||
(_configItems select 0) params ["_primaryWeapons", "_secondaryWeapons", "_handgunWeapons"];
|
private _attributeWeapons = [];
|
||||||
private _attributeWeapons = _attributeItems select {_x in _primaryWeapons || {_x in _secondaryWeapons} || {_x in _handgunWeapons}};
|
|
||||||
|
{
|
||||||
|
_attributeWeapons append (_attributeItems arrayIntersect (keys _y));
|
||||||
|
} forEach (_configItems get IDX_VIRT_WEAPONS);
|
||||||
|
|
||||||
|
private _itemsToAdd = createHashMap;
|
||||||
|
|
||||||
// Add compatible attachments or magazines to attribute
|
// Add compatible attachments or magazines to attribute
|
||||||
private _cfgWeapons = configFile >> "CfgWeapons";
|
if (_category == IDX_CAT_ITEMS_ALL) then {
|
||||||
private _itemsToAdd = [];
|
// Add compatible attachments or magazines to attribute
|
||||||
|
private _compatibleMagazines = createHashMap;
|
||||||
if (_category == 8) then {
|
|
||||||
private _magazineGroups = uiNamespace getVariable QGVAR(magazineGroups);
|
|
||||||
private _cfgMagazines = configFile >> "CfgMagazines";
|
|
||||||
|
|
||||||
|
// Get all compatible magazines for weapons
|
||||||
{
|
{
|
||||||
private _weaponConfig = _cfgWeapons >> _x;
|
_compatibleMagazines insert [true, compatibleMagazines _x, []];
|
||||||
|
|
||||||
{
|
|
||||||
private _muzzleConfig = if (_x == "this") then {_weaponConfig} else {_weaponConfig >> _x};
|
|
||||||
|
|
||||||
// Only add existent magazines and ensure correct classname case
|
|
||||||
private _magazines = getArray (_muzzleConfig >> "magazines") select {isClass (_cfgMagazines >> _x)};
|
|
||||||
_magazines = _magazines apply {configName (_cfgMagazines >> _x)};
|
|
||||||
_itemsToAdd append _magazines;
|
|
||||||
|
|
||||||
{
|
|
||||||
_itemsToAdd append (_magazineGroups get (toLower _x));
|
|
||||||
} forEach getArray (_muzzleConfig >> "magazineWell");
|
|
||||||
} forEach getArray (_weaponConfig >> "muzzles");
|
|
||||||
} forEach _attributeWeapons;
|
} forEach _attributeWeapons;
|
||||||
|
|
||||||
|
// Check if magazines are in configItems
|
||||||
|
{
|
||||||
|
if (_x in (_configItems get IDX_VIRT_ITEMS_ALL)) then {
|
||||||
|
_itemsToAdd set [_x, nil];
|
||||||
|
};
|
||||||
|
} forEach (keys _compatibleMagazines);
|
||||||
} else {
|
} else {
|
||||||
private _attachmentCategory = _category - 4;
|
private _attachmentCategory = _category - 4;
|
||||||
private _filter = ["optic", "pointer", "muzzle", "bipod"] select _attachmentCategory;
|
private _filter = ["optic", "pointer", "muzzle", "bipod"] select _attachmentCategory;
|
||||||
|
private _compatibleItems = createHashMap;
|
||||||
|
|
||||||
|
// CBA_fnc_compatibleItems returns config case sensitive names
|
||||||
{
|
{
|
||||||
_itemsToAdd append ([_x, _filter] call CBA_fnc_compatibleItems);
|
_compatibleItems insert [true, [_x, _filter] call CBA_fnc_compatibleItems, []];
|
||||||
} forEach _attributeWeapons;
|
} forEach _attributeWeapons;
|
||||||
|
|
||||||
// Only add items with scope of 2 and ensure correct classname case
|
// Check if attachments are in configItems
|
||||||
_itemsToAdd = _itemsToAdd select {getNumber (_cfgWeapons >> _x >> "scope") == 2};
|
{
|
||||||
_itemsToAdd = _itemsToAdd apply {configName (_cfgWeapons >> _x)};
|
if (
|
||||||
|
_x in (_configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_OPTICS_ATTACHMENTS) ||
|
||||||
|
{_x in (_configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_FLASHLIGHT_ATTACHMENTS)} ||
|
||||||
|
{_x in (_configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_MUZZLE_ATTACHMENTS)} ||
|
||||||
|
{_x in (_configItems get IDX_VIRT_ATTACHMENTS get IDX_VIRT_BIPOD_ATTACHMENTS)}
|
||||||
|
) then {
|
||||||
|
_itemsToAdd set [_x, nil];
|
||||||
|
};
|
||||||
|
} forEach (keys _compatibleItems);
|
||||||
};
|
};
|
||||||
|
|
||||||
_attributeItems append _itemsToAdd;
|
// Only take items that can be found by default in the arsenal
|
||||||
_attributeValue set [0, _attributeItems arrayIntersect _attributeItems];
|
_attributeItems insert [-1, keys _itemsToAdd, true];
|
||||||
|
_attributeValue set [0, _attributeItems];
|
||||||
|
|
||||||
// Refresh the list for new items
|
// Refresh the list for new items
|
||||||
[_controlsGroup] call FUNC(attributeAddItems);
|
[_controlsGroup] call FUNC(attributeAddItems);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001, johnb43
|
||||||
* Populates 3DEN attribute listbox with items of given category.
|
* Populates 3DEN's ace arsenal attribute listbox with items of given category.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
@ -18,105 +18,117 @@
|
|||||||
|
|
||||||
params ["_controlsGroup"];
|
params ["_controlsGroup"];
|
||||||
|
|
||||||
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY) - 1;
|
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
|
||||||
private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
|
private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
|
||||||
private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
|
private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems);
|
||||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||||
|
_attributeValue params ["_attributeItems", "_attributeMode"];
|
||||||
|
|
||||||
TRACE_3("Populating list",_category,_filter,_attributeValue);
|
TRACE_3("Populating list",_category,_filter,_attributeValue);
|
||||||
|
|
||||||
_attributeValue params ["_attributeItems", "_attributeMode"];
|
|
||||||
private _modeSymbol = [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode;
|
private _modeSymbol = [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode;
|
||||||
|
|
||||||
// Clear listbox
|
// Clear listbox
|
||||||
private _listbox = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST;
|
private _listbox = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST;
|
||||||
lnbClear _listbox;
|
lnbClear _listbox;
|
||||||
|
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
private _cfgVehicles = configFile >> "CfgVehicles";
|
||||||
|
private _cfgGlasses = configFile >> "CfgGlasses";
|
||||||
|
|
||||||
// Exit with current items (no specific category)
|
// Exit with current items (no specific category)
|
||||||
if (_category == -1) exitWith {
|
if (_category == IDX_CAT_ALL) exitWith {
|
||||||
|
private _config = configNull;
|
||||||
|
private _displayName = "";
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Get appropriate config for each item (different since items can be from any category)
|
// Get appropriate config for each item (different since items can be from any category)
|
||||||
private _config = switch (true) do {
|
_config = switch (true) do {
|
||||||
case (_x in (_configItems select 2));
|
case (_x in _magazineMiscItems);
|
||||||
case (_x in (_configItems select 15));
|
case (_x in (_configItems get IDX_VIRT_ITEMS_ALL));
|
||||||
case (_x in (_configItems select 16)): {
|
case (_x in (_configItems get IDX_VIRT_GRENADES));
|
||||||
configFile >> "CfgMagazines" >> _x;
|
case (_x in (_configItems get IDX_VIRT_EXPLOSIVES)): {_cfgMagazines >> _x};
|
||||||
};
|
case (_x in (_configItems get IDX_VIRT_BACKPACK)): {_cfgVehicles >> _x};
|
||||||
case (_x in (_configItems select 6)): {
|
case (_x in (_configItems get IDX_VIRT_GOGGLES)): {_cfgGlasses >> _x};
|
||||||
configFile >> "CfgVehicles" >> _x;
|
default {_cfgWeapons >> _x};
|
||||||
};
|
|
||||||
case (_x in (_configItems select 7)): {
|
|
||||||
configFile >> "CfgGlasses" >> _x;
|
|
||||||
};
|
|
||||||
default {
|
|
||||||
configFile >> "CfgWeapons" >> _x;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_displayName = getText (_config >> "displayName");
|
||||||
|
|
||||||
// Add item if not filtered
|
// Add item if not filtered
|
||||||
private _displayName = getText (_config >> "displayName");
|
if (_filter in (toLower _displayName) || {_filter in (toLower _x)}) then {
|
||||||
if (toLower _displayName find _filter > -1) then {
|
_index = _listbox lnbAddRow ["", _displayName, _modeSymbol];
|
||||||
private _picture = getText (_config >> "picture");
|
|
||||||
private _index = _listbox lnbAddRow ["", _displayName, _modeSymbol];
|
|
||||||
_listbox lnbSetData [[_index, 1], _x];
|
_listbox lnbSetData [[_index, 1], _x];
|
||||||
_listbox lnbSetPicture [[_index, 0], _picture];
|
_listbox lnbSetPicture [[_index, 0], getText (_config >> "picture")];
|
||||||
_listbox lbSetTooltip [_index * (count lnbGetColumnsPosition _listbox), _x];
|
_listbox lnbSetTooltip [[_index, 0], _x];
|
||||||
};
|
};
|
||||||
} forEach _attributeItems;
|
} forEach _attributeItems;
|
||||||
|
|
||||||
_listbox lnbSort [1];
|
// Sort alphabetically
|
||||||
|
_listbox lnbSort [1, false];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get list of category items
|
// Get list of category items
|
||||||
private _categoryItems = switch (true) do {
|
private _categoryItems = switch (true) do {
|
||||||
case (_category < 3): {
|
// Weapons
|
||||||
_configItems select 0 select _category;
|
case (_category < IDX_CAT_OPTICS_ATTACHMENTS): {
|
||||||
|
(_configItems get IDX_VIRT_WEAPONS) get (_category - 1)
|
||||||
};
|
};
|
||||||
case (_category < 7): {
|
// Weapon attachments
|
||||||
_configItems select 1 select (_category - 3);
|
case (_category < IDX_CAT_ITEMS_ALL): {
|
||||||
|
(_configItems get IDX_VIRT_ATTACHMENTS) get (_category - 4)
|
||||||
};
|
};
|
||||||
|
// Other
|
||||||
default {
|
default {
|
||||||
_configItems select (_category - 5);
|
_configItems get (_category - 6)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get config for current category
|
// Get config for current category
|
||||||
private _config = switch (true) do {
|
private _cfgClass = switch (true) do {
|
||||||
case (_category in [7, 20, 21]): {
|
case (_category in [IDX_CAT_ITEMS_ALL, IDX_CAT_GRENADES, IDX_CAT_EXPLOSIVES]): {_cfgMagazines};
|
||||||
configFile >> "CfgMagazines";
|
case (_category == IDX_CAT_BACKPACK): {_cfgVehicles};
|
||||||
};
|
case (_category == IDX_CAT_GOGGLES): {_cfgGlasses};
|
||||||
case (_category == 11): {
|
default {_cfgWeapons};
|
||||||
configFile >> "CfgVehicles";
|
|
||||||
};
|
|
||||||
case (_category == 12): {
|
|
||||||
configFile >> "CfgGlasses";
|
|
||||||
};
|
|
||||||
default {
|
|
||||||
configFile >> "CfgWeapons";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _displayName = "";
|
||||||
|
private _symbol = SYMBOL_ITEM_NONE;
|
||||||
|
private _alpha = 0;
|
||||||
|
private _index = -1;
|
||||||
|
private _config = _cfgClass;
|
||||||
|
|
||||||
// Populate listbox with category items
|
// Populate listbox with category items
|
||||||
{
|
{
|
||||||
// Add item if not filtered
|
// "Misc. items" magazines (e.g. spare barrels, intel, photos)
|
||||||
private _displayName = getText (_config >> _x >> "displayName");
|
if (_category == IDX_CAT_MISC_ITEMS) then {
|
||||||
if (toLower _displayName find _filter > -1) then {
|
_config = [_cfgClass, _cfgMagazines] select (_x in _magazineMiscItems);
|
||||||
private _picture = getText (_config >> _x >> "picture");
|
};
|
||||||
private _symbol = SYMBOL_ITEM_NONE;
|
|
||||||
private _alpha = 0.5;
|
|
||||||
|
|
||||||
|
_displayName = getText (_config >> _x >> "displayName");
|
||||||
|
|
||||||
|
// Add item if not filtered
|
||||||
|
if (_filter in (toLower _displayName) || {_filter in (toLower _x)}) then {
|
||||||
// Change symbol and alpha if item already selected
|
// Change symbol and alpha if item already selected
|
||||||
if (_x in _attributeItems) then {
|
if (_x in _attributeItems) then {
|
||||||
_symbol = _modeSymbol;
|
_symbol = _modeSymbol;
|
||||||
_alpha = 1;
|
_alpha = 1;
|
||||||
|
} else {
|
||||||
|
_symbol = SYMBOL_ITEM_NONE;
|
||||||
|
_alpha = 0.5;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _index = _listbox lnbAddRow ["", _displayName, _symbol];
|
_index = _listbox lnbAddRow ["", _displayName, _symbol];
|
||||||
_listbox lnbSetData [[_index, 1], _x];
|
_listbox lnbSetData [[_index, 1], _x];
|
||||||
_listbox lnbSetPicture [[_index, 0], _picture];
|
_listbox lnbSetPicture [[_index, 0], getText (_config >> _x >> "picture")];
|
||||||
_listbox lbSetTooltip [_index * (count lnbGetColumnsPosition _listbox), _x];
|
_listbox lnbSetTooltip [[_index, 0], _x];
|
||||||
_listbox lnbSetColor [[_index, 1], [1, 1, 1, _alpha]];
|
_listbox lnbSetColor [[_index, 1], [1, 1, 1, _alpha]];
|
||||||
_listbox lnbSetColor [[_index, 2], [1, 1, 1, _alpha]];
|
_listbox lnbSetColor [[_index, 2], [1, 1, 1, _alpha]];
|
||||||
};
|
};
|
||||||
} forEach _categoryItems;
|
} forEach (keys _categoryItems);
|
||||||
|
|
||||||
_listbox lnbSort [1];
|
// Sort alphabetically
|
||||||
|
_listbox lnbSort [1, false];
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Handles changing the category in 3DEN attribute.
|
* Handles changing the category in 3DEN's ace arsenal attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
@ -24,7 +24,7 @@ uiNamespace setVariable [QGVAR(attributeCategory), _category];
|
|||||||
|
|
||||||
// Show add compatible items button when category is attachments or magazines
|
// Show add compatible items button when category is attachments or magazines
|
||||||
private _compatibleButton = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_ADD_COMPATIBLE;
|
private _compatibleButton = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_ADD_COMPATIBLE;
|
||||||
private _enable = _category in [4, 5, 6, 7, 8];
|
private _enable = _category in [IDX_CAT_OPTICS_ATTACHMENTS, IDX_CAT_FLASHLIGHT_ATTACHMENTS, IDX_CAT_MUZZLE_ATTACHMENTS, IDX_CAT_BIPOD_ATTACHMENTS, IDX_CAT_ITEMS_ALL];
|
||||||
_compatibleButton ctrlEnable _enable;
|
_compatibleButton ctrlEnable _enable;
|
||||||
_compatibleButton ctrlShow _enable;
|
_compatibleButton ctrlShow _enable;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Clears all items from current category in 3DEN attribute.
|
* Clears all items from current category in 3DEN's ace arsenal attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
@ -18,28 +18,32 @@
|
|||||||
|
|
||||||
params ["_controlsGroup"];
|
params ["_controlsGroup"];
|
||||||
|
|
||||||
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY) - 1;
|
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
|
||||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||||
TRACE_1("Handling clear button",_category);
|
TRACE_1("Handling clear button",_category);
|
||||||
|
|
||||||
// Remove all if no specific category
|
// Remove all if no specific category
|
||||||
if (_category == -1) then {
|
if (_category == IDX_CAT_ALL) then {
|
||||||
_attributeValue set [0, []];
|
_attributeValue set [0, []];
|
||||||
} else {
|
} else {
|
||||||
// Find category items and remove from list
|
// Find category items and remove from list
|
||||||
private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
private _categoryItems = switch (true) do {
|
private _categoryItems = switch (true) do {
|
||||||
case (_category < 3): {
|
// Weapons
|
||||||
_configItems select 0 select _category;
|
case (_category < IDX_CAT_OPTICS_ATTACHMENTS): {
|
||||||
|
(_configItems get IDX_VIRT_WEAPONS) get (_category - 1)
|
||||||
};
|
};
|
||||||
case (_category < 7): {
|
// Weapon attachments
|
||||||
_configItems select 1 select (_category - 3);
|
case (_category < IDX_CAT_ITEMS_ALL): {
|
||||||
|
(_configItems get IDX_VIRT_ATTACHMENTS) get (_category - 4)
|
||||||
};
|
};
|
||||||
|
// Other
|
||||||
default {
|
default {
|
||||||
_configItems select (_category - 5);
|
_configItems get (_category - 6)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_attributeValue set [0, (_attributeValue select 0) - _categoryItems];
|
|
||||||
|
_attributeValue set [0, (_attributeValue select 0) select {!(_x in _categoryItems)}];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Refresh the list after clear
|
// Refresh the list after clear
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Handles double clicking a row in 3DEN attribute listbox.
|
* Handles double clicking a row in 3DEN's ace arsenal attribute listbox.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Listbox <CONTROL>
|
* 0: Listbox <CONTROL>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Handles importing items list from clipboard into 3DEN attribute.
|
* Handles importing items list from clipboard into 3DEN's ace arsenal attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
@ -15,8 +16,6 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_controlsGroup"];
|
|
||||||
|
|
||||||
private _importList = call compile copyFromClipboard;
|
private _importList = call compile copyFromClipboard;
|
||||||
|
|
||||||
// Verify import list is in correct format
|
// Verify import list is in correct format
|
||||||
@ -24,23 +23,17 @@ if (isNil "_importList" || {!(_importList isEqualType [])} || {!(_importList isE
|
|||||||
playSound ["3DEN_notificationWarning", true];
|
playSound ["3DEN_notificationWarning", true];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ensure imported items are in scanned config array and classname case is correct
|
params ["_controlsGroup"];
|
||||||
private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]);
|
|
||||||
private _configItemsFlat = _configItems select [2, 16];
|
|
||||||
_configItemsFlat append (_configItems select 0);
|
|
||||||
_configItemsFlat append (_configItems select 1);
|
|
||||||
|
|
||||||
private _filteredList = [];
|
// Convert all items to config case
|
||||||
|
_importList = _importList apply {_x call EFUNC(common,getConfigName)};
|
||||||
|
|
||||||
{
|
// Remove any invalid/non-existing items
|
||||||
private _item = _x;
|
_importList = _importList - [""];
|
||||||
{
|
|
||||||
private _index = _x findIf {_x == _item};
|
// Ensure imported items are in scanned config array
|
||||||
if (_index > -1) then {
|
private _configItemsFlat = uiNamespace getVariable QGVAR(configItemsFlat);
|
||||||
_filteredList pushBackUnique (_x select _index);
|
private _filteredList = _importList select {_x in _configItemsFlat};
|
||||||
};
|
|
||||||
} forEach _configItemsFlat;
|
|
||||||
} forEach _importList;
|
|
||||||
|
|
||||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||||
_attributeValue set [0, _filteredList];
|
_attributeValue set [0, _filteredList];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Initializes the objects 3DEN attribute at scenario start.
|
* Initializes the objects 3DEN's ace arsenal attribute at scenario start.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute target <OBJECT>
|
* 0: Attribute target <OBJECT>
|
||||||
@ -28,6 +28,7 @@ if (_mode > 0) then {
|
|||||||
[{
|
[{
|
||||||
[{
|
[{
|
||||||
params ["_object", "_items"];
|
params ["_object", "_items"];
|
||||||
|
|
||||||
[_object, _items, true] call FUNC(removeVirtualItems);
|
[_object, _items, true] call FUNC(removeVirtualItems);
|
||||||
}, _this] call CBA_fnc_execNextFrame;
|
}, _this] call CBA_fnc_execNextFrame;
|
||||||
}, [_object, _items]] call CBA_fnc_execNextFrame;
|
}, [_object, _items]] call CBA_fnc_execNextFrame;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Handles keyboard input for the 3DEN attribute.
|
* Handles keyboard input for the 3DEN's ace arsenal attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Display <DISPLAY>
|
* 0: Display <DISPLAY>
|
||||||
@ -21,18 +21,23 @@ params ["_display", "_keyCode"];
|
|||||||
TRACE_2("Attribute key down",_display,_keyCode);
|
TRACE_2("Attribute key down",_display,_keyCode);
|
||||||
|
|
||||||
// Exit if attribute is not in focus
|
// Exit if attribute is not in focus
|
||||||
private _controlsGroup = uiNamespace getVariable QGVAR(attributeFocus);
|
private _controlsGroup = uiNamespace getVariable [QGVAR(attributeFocus), controlNull];
|
||||||
if (isNil "_controlsGroup") exitWith {false};
|
|
||||||
|
if (isNull _controlsGroup) exitWith {false};
|
||||||
|
|
||||||
switch (_keyCode) do {
|
switch (_keyCode) do {
|
||||||
|
// Unselect item
|
||||||
case DIK_LEFT;
|
case DIK_LEFT;
|
||||||
case DIK_NUMPADMINUS: {
|
case DIK_NUMPADMINUS: {
|
||||||
[_controlsGroup, false] call FUNC(attributeSelect);
|
[_controlsGroup, false] call FUNC(attributeSelect);
|
||||||
|
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
// Select item
|
||||||
case DIK_RIGHT;
|
case DIK_RIGHT;
|
||||||
case DIK_NUMPADPLUS: {
|
case DIK_NUMPADPLUS: {
|
||||||
[_controlsGroup, true] call FUNC(attributeSelect);
|
[_controlsGroup, true] call FUNC(attributeSelect);
|
||||||
|
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
default {false};
|
default {false};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Initializes the 3DEN attribute.
|
* Initializes the 3DEN's ace arsenal attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
@ -23,10 +23,8 @@ TRACE_1("Initializing 3DEN attribute",_value);
|
|||||||
// Store working attribute value
|
// Store working attribute value
|
||||||
uiNamespace setVariable [QGVAR(attributeValue), _value];
|
uiNamespace setVariable [QGVAR(attributeValue), _value];
|
||||||
|
|
||||||
// Add keyDown EH to display
|
// Add keyDown EH to display; Does not work properly when added to controls group
|
||||||
// Does not work properly when added to controls group
|
(ctrlParent _controlsGroup) displayAddEventHandler ["KeyDown", {call FUNC(attributeKeyDown)}];
|
||||||
private _display = ctrlParent _controlsGroup;
|
|
||||||
_display displayAddEventHandler ["KeyDown", {call FUNC(attributeKeyDown)}];
|
|
||||||
|
|
||||||
// Handle selected mode
|
// Handle selected mode
|
||||||
if (_value select 1 > 0) then {
|
if (_value select 1 > 0) then {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Handles changing the mode in 3DEN attribute.
|
* Handles changing the mode in 3DEN's ace arsenal attribute.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: mharis001
|
* Author: mharis001
|
||||||
* Handles adding/removing an item from 3DEN attribute list.
|
* Handles adding/removing an item from 3DEN's ace arsenal attribute list.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Attribute controls group <CONTROL>
|
* 0: Attribute controls group <CONTROL>
|
||||||
@ -28,11 +28,12 @@ TRACE_2("Handling item selection",_itemClassname,_addItem);
|
|||||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||||
_attributeValue params ["_attributeItems", "_attributeMode"];
|
_attributeValue params ["_attributeItems", "_attributeMode"];
|
||||||
|
|
||||||
private _findItem = _attributeItems find _itemClassname;
|
private _itemIndex = _attributeItems find _itemClassname;
|
||||||
|
|
||||||
// Add item if not already in list
|
// Add item if not already in list
|
||||||
if (_addItem && {_findItem < 0}) exitWith {
|
if (_addItem && {_itemIndex == -1}) exitWith {
|
||||||
_attributeItems pushBack _itemClassname;
|
_attributeItems pushBack _itemClassname;
|
||||||
|
|
||||||
// Change symbol and increase alpha
|
// Change symbol and increase alpha
|
||||||
_listbox lnbSetText [[_currentRow, 2], [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode];
|
_listbox lnbSetText [[_currentRow, 2], [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode];
|
||||||
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 1]];
|
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 1]];
|
||||||
@ -40,8 +41,9 @@ if (_addItem && {_findItem < 0}) exitWith {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Remove item if in list
|
// Remove item if in list
|
||||||
if (!_addItem && {_findItem > -1}) exitWith {
|
if (!_addItem && {_itemIndex != -1}) exitWith {
|
||||||
_attributeItems deleteAt _findItem;
|
_attributeItems deleteAt _itemIndex;
|
||||||
|
|
||||||
// Change symbol and reduce alpha
|
// Change symbol and reduce alpha
|
||||||
_listbox lnbSetText [[_currentRow, 2], SYMBOL_ITEM_NONE];
|
_listbox lnbSetText [[_currentRow, 2], SYMBOL_ITEM_NONE];
|
||||||
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 0.5]];
|
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 0.5]];
|
||||||
|
52
addons/arsenal/functions/fnc_baseWeapon.sqf
Normal file
52
addons/arsenal/functions/fnc_baseWeapon.sqf
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Karel Moricky, johnb43
|
||||||
|
* Returns base weapon (weapon without any attachments), but it returns it in config sensitive case.
|
||||||
|
* Same as BIS_fnc_baseWeapon, except config case and uses cache.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Weapon <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Base weapon <STRING>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* ["arifle_AK12_GL_lush_arco_pointer_F"] call ace_arsenal_fnc_baseWeapon
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params [["_weapon", "", [""]]];
|
||||||
|
|
||||||
|
// Check if item is cached
|
||||||
|
(uiNamespace getVariable QGVAR(baseWeaponNameCache)) getOrDefaultCall [toLower _weapon, {
|
||||||
|
private _cfgWeapons = configfile >> "CfgWeapons";
|
||||||
|
private _config = _cfgWeapons >> _weapon;
|
||||||
|
|
||||||
|
// If class doesn't exist, exit
|
||||||
|
if (!isClass _config) then {
|
||||||
|
_weapon
|
||||||
|
} else {
|
||||||
|
// Get manual base weapon
|
||||||
|
private _configBase = _cfgWeapons >> getText (_config >> "baseWeapon");
|
||||||
|
|
||||||
|
if (isClass _configBase) then {
|
||||||
|
configName _configBase
|
||||||
|
} else {
|
||||||
|
private _className = _weapon;
|
||||||
|
|
||||||
|
// Get first parent without any attachments; Only take weapons available to the arsenal
|
||||||
|
// https://community.bistudio.com/wiki/Arma_3:_Characters_And_Gear_Encoding_Guide#Character_configuration
|
||||||
|
// https://github.com/acemod/ACE3/pull/9040#issuecomment-1597748331
|
||||||
|
while {isClass _config && {getNumber (_config >> "scope") > 0 && {if (isNumber (_config >> "scopeArsenal")) then {getNumber (_config >> "scopeArsenal") == 2} else {true}}} && {getNumber (_config >> QGVAR(hide)) != 1}} do {
|
||||||
|
if (count (_config >> "LinkedItems") == 0) exitWith {
|
||||||
|
_className = configName _config;
|
||||||
|
};
|
||||||
|
|
||||||
|
_config = inheritsFrom _config;
|
||||||
|
};
|
||||||
|
|
||||||
|
_className
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}, true]
|
@ -1,12 +1,12 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Add or remove item(s) when the + or - button is pressed in the right panel.
|
* Add or remove item(s) when the + or - button is pressed in the right panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Add or remove <SCALAR> (-1: remove, 1: Add)
|
* 1: Add (1) or remove (-1) item <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -16,77 +16,110 @@
|
|||||||
|
|
||||||
params ["_display", "_addOrRemove"];
|
params ["_display", "_addOrRemove"];
|
||||||
|
|
||||||
private _load = 0;
|
private _add = _addOrRemove > 0;
|
||||||
private _maxLoad = "";
|
|
||||||
private _items = [];
|
private _ctrlList = _display displayCtrl IDC_rightTabContentListnBox;
|
||||||
private _ctrlList = (_display displayCtrl IDC_rightTabContentListnBox);
|
|
||||||
private _lnbCurSel = lnbCurSelRow _ctrlList;
|
private _lnbCurSel = lnbCurSelRow _ctrlList;
|
||||||
|
private _isUnique = (_ctrlList lnbValue [_lnbCurSel, 2]) == 1;
|
||||||
|
|
||||||
|
// If item is unique, don't allow adding more
|
||||||
|
if (_add && {_isUnique}) exitWith {};
|
||||||
|
|
||||||
|
private _containerItems = [];
|
||||||
private _item = _ctrlList lnbData [_lnbCurSel, 0];
|
private _item = _ctrlList lnbData [_lnbCurSel, 0];
|
||||||
|
|
||||||
if ((_ctrlList lnbValue [_lnbCurSel, 2]) == 1 && {_addOrRemove == 1}) exitWith {};
|
// Update item count and currentItems array & get relevant container
|
||||||
|
private _container = switch (GVAR(currentLeftPanel)) do {
|
||||||
// Update item count and currentItems array
|
// Uniform
|
||||||
switch GVAR(currentLeftPanel) do {
|
case IDC_buttonUniform: {
|
||||||
|
if (_add) then {
|
||||||
case IDC_buttonUniform : {
|
for "_i" from 1 to ([1, 5] select GVAR(shiftState)) do {
|
||||||
if (_addOrRemove > 0) then {
|
GVAR(center) addItemToUniform _item;
|
||||||
for "_count" from 1 to ([1, 5] select (GVAR(shiftState))) do {
|
};
|
||||||
GVAR(center) addItemToUniform _item;
|
} else {
|
||||||
};
|
// Backpacks need special command to be removed
|
||||||
|
if (_isUnique && {_item in ((uiNamespace getVariable QGVAR(configItems)) get IDX_VIRT_BACKPACK)}) then {
|
||||||
|
[uniformContainer GVAR(center), _item, [1, 5] select GVAR(shiftState)] call CBA_fnc_removeBackpackCargo;
|
||||||
} else {
|
} else {
|
||||||
for "_count" from 1 to ([1, 5] select (GVAR(shiftState))) do {
|
for "_i" from 1 to ([1, 5] select GVAR(shiftState)) do {
|
||||||
GVAR(center) removeItemFromUniform _item;
|
GVAR(center) removeItemFromUniform _item;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_load = loadUniform GVAR(center);
|
/// Get all items from container (excluding container itself)
|
||||||
_maxLoad = gettext (configfile >> "CfgWeapons" >> uniform GVAR(center) >> "ItemInfo" >> "containerClass");
|
_containerItems = [GVAR(center), 0, 3, 0, 0, false] call EFUNC(common,uniqueUnitItems);
|
||||||
_items = uniformItems GVAR(center);
|
|
||||||
GVAR(currentItems) set [15 ,_items];
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM_ITEMS, ((getUnitLoadout GVAR(center)) select IDX_LOADOUT_UNIFORM) param [1, []]];
|
||||||
|
|
||||||
|
// Update load bar
|
||||||
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadUniform GVAR(center));
|
||||||
|
|
||||||
|
uniformContainer GVAR(center)
|
||||||
};
|
};
|
||||||
|
// Vest
|
||||||
case IDC_buttonVest : {
|
case IDC_buttonVest: {
|
||||||
if (_addOrRemove > 0) then {
|
if (_add) then {
|
||||||
for "_count" from 1 to ([1, 5] select (GVAR(shiftState))) do {
|
for "_i" from 1 to ([1, 5] select GVAR(shiftState)) do {
|
||||||
GVAR(center) addItemToVest _item;
|
GVAR(center) addItemToVest _item;
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
// Backpacks need special command to be removed
|
||||||
|
if (_isUnique && {_item in ((uiNamespace getVariable QGVAR(configItems)) get IDX_VIRT_BACKPACK)}) then {
|
||||||
|
[vestContainer GVAR(center), _item, [1, 5] select GVAR(shiftState)] call CBA_fnc_removeBackpackCargo;
|
||||||
} else {
|
} else {
|
||||||
for "_count" from 1 to ([1, 5] select (GVAR(shiftState))) do {
|
for "_i" from 1 to ([1, 5] select GVAR(shiftState)) do {
|
||||||
GVAR(center) removeItemFromVest _item;
|
GVAR(center) removeItemFromVest _item;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_load = loadVest GVAR(center);
|
// Get all items from container (excluding container itself)
|
||||||
_maxLoad = gettext (configfile >> "CfgWeapons" >> vest GVAR(center) >> "ItemInfo" >> "containerClass");
|
_containerItems = [GVAR(center), 0, 0, 3, 0, false] call EFUNC(common,uniqueUnitItems);
|
||||||
_items = vestItems GVAR(center);
|
|
||||||
GVAR(currentItems) set [16,_items];
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_VEST_ITEMS, ((getUnitLoadout GVAR(center)) select IDX_LOADOUT_VEST) param [1, []]];
|
||||||
|
|
||||||
|
// Update load bar
|
||||||
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadVest GVAR(center));
|
||||||
|
|
||||||
|
vestContainer GVAR(center)
|
||||||
};
|
};
|
||||||
|
// Backpack
|
||||||
case IDC_buttonBackpack : {
|
case IDC_buttonBackpack: {
|
||||||
if (_addOrRemove > 0) then {
|
if (_add) then {
|
||||||
for "_count" from 1 to ([1, 5] select (GVAR(shiftState))) do {
|
for "_i" from 1 to ([1, 5] select GVAR(shiftState)) do {
|
||||||
GVAR(center) addItemToBackpack _item;
|
GVAR(center) addItemToBackpack _item;
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
// Backpacks need special command to be removed
|
||||||
|
if (_isUnique && {_item in ((uiNamespace getVariable QGVAR(configItems)) get IDX_VIRT_BACKPACK)}) then {
|
||||||
|
[backpackContainer GVAR(center), _item, [1, 5] select GVAR(shiftState)] call CBA_fnc_removeBackpackCargo;
|
||||||
} else {
|
} else {
|
||||||
for "_count" from 1 to ([1, 5] select (GVAR(shiftState))) do {
|
for "_i" from 1 to ([1, 5] select GVAR(shiftState)) do {
|
||||||
GVAR(center) removeItemFromBackpack _item;
|
GVAR(center) removeItemFromBackpack _item;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_load = loadBackpack GVAR(center);
|
// Get all items from container (excluding container itself)
|
||||||
_maxLoad = backpack GVAR(center);
|
_containerItems = [GVAR(center), 0, 0, 0, 3, false] call EFUNC(common,uniqueUnitItems);
|
||||||
_items = backpackItems GVAR(center);
|
|
||||||
GVAR(currentItems) set [17,_items];
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, ((getUnitLoadout GVAR(center)) select IDX_LOADOUT_BACKPACK) param [1, []]];
|
||||||
|
|
||||||
|
// Update load bar
|
||||||
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadBackpack GVAR(center));
|
||||||
|
|
||||||
|
backpackContainer GVAR(center)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update progress bar status, weight info
|
// Find out how many items of that type there are and update the number displayed
|
||||||
private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar;
|
_ctrlList lnbSetText [[_lnbCurSel, 2], str (_containerItems getOrDefault [_item, 0])];
|
||||||
_loadIndicatorBarCtrl progressSetPosition _load;
|
|
||||||
|
|
||||||
private _value = {_x == _item} count _items;
|
|
||||||
_ctrlList lnbSetText [[_lnbCurSel, 2],str _value];
|
|
||||||
|
|
||||||
[QGVAR(cargoChanged), [_display, _item, _addOrRemove, GVAR(shiftState)]] call CBA_fnc_localEvent;
|
[QGVAR(cargoChanged), [_display, _item, _addOrRemove, GVAR(shiftState)]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
[_ctrlList, _maxLoad] call FUNC(updateRightPanel);
|
// Refresh availibility of items based on space remaining in container
|
||||||
|
[_ctrlList, _container, _containerItems isNotEqualTo []] call FUNC(updateRightPanel);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Clear the current container.
|
* Clear the current container.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -15,48 +15,56 @@
|
|||||||
|
|
||||||
params ["_display"];
|
params ["_display"];
|
||||||
|
|
||||||
// Clear container
|
// Clear chosen container, reset currentItems for that container and get relevant container
|
||||||
switch (GVAR(currentLeftPanel)) do {
|
private _container = switch (GVAR(currentLeftPanel)) do {
|
||||||
|
// Uniform
|
||||||
case IDC_buttonUniform: {
|
case IDC_buttonUniform: {
|
||||||
{GVAR(center) removeItemFromUniform _x} foreach (uniformItems GVAR(center));
|
private _container = uniformContainer GVAR(center);
|
||||||
GVAR(currentItems) set [15, []];
|
|
||||||
|
// Remove everything (backpacks need special command for this)
|
||||||
|
clearWeaponCargoGlobal _container;
|
||||||
|
clearMagazineCargoGlobal _container;
|
||||||
|
clearItemCargoGlobal _container;
|
||||||
|
clearBackpackCargoGlobal _container;
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM_ITEMS, []];
|
||||||
|
|
||||||
|
_container
|
||||||
};
|
};
|
||||||
|
// Vest
|
||||||
case IDC_buttonVest: {
|
case IDC_buttonVest: {
|
||||||
{GVAR(center) removeItemFromVest _x} foreach (vestItems GVAR(center));
|
private _container = vestContainer GVAR(center);
|
||||||
GVAR(currentItems) set [16, []];
|
|
||||||
|
// Remove everything (backpacks need special command for this)
|
||||||
|
clearWeaponCargoGlobal _container;
|
||||||
|
clearMagazineCargoGlobal _container;
|
||||||
|
clearItemCargoGlobal _container;
|
||||||
|
clearBackpackCargoGlobal _container;
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_VEST_ITEMS, []];
|
||||||
|
|
||||||
|
_container
|
||||||
};
|
};
|
||||||
|
// Backpack
|
||||||
case IDC_buttonBackpack: {
|
case IDC_buttonBackpack: {
|
||||||
{GVAR(center) removeItemFromBackpack _x} foreach (backpackItems GVAR(center));
|
// Remove everything
|
||||||
GVAR(currentItems) set [17, []];
|
clearAllItemsFromBackpack GVAR(center);
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, []];
|
||||||
|
|
||||||
|
backpackContainer GVAR(center)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clear number of owned items
|
// Clear number of owned items
|
||||||
private _ctrlList = _display displayCtrl IDC_rightTabContentListnBox;
|
private _ctrlList = _display displayCtrl IDC_rightTabContentListnBox;
|
||||||
|
|
||||||
for "_l" from 0 to (lbSize _ctrlList - 1) do {
|
for "_lbIndex" from 0 to (lbSize _ctrlList) - 1 do {
|
||||||
_ctrlList lnbSetText [[_l, 2], str 0];
|
_ctrlList lnbSetText [[_lbIndex, 2], "0"];
|
||||||
};
|
};
|
||||||
|
|
||||||
private _removeAllCtrl = _display displayCtrl IDC_buttonRemoveAll;
|
|
||||||
_removeAllCtrl ctrlSetFade 1;
|
|
||||||
_removeAllCtrl ctrlCommit FADE_DELAY;
|
|
||||||
|
|
||||||
// Update load bar
|
// Update load bar
|
||||||
private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar;
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition 0;
|
||||||
_loadIndicatorBarCtrl progressSetPosition 0;
|
|
||||||
|
|
||||||
private _maxLoad = switch (GVAR(currentLeftPanel)) do {
|
// Refresh availibility of items based on space remaining in container
|
||||||
case IDC_buttonUniform: {
|
[_ctrlList, _container, false] call FUNC(updateRightPanel);
|
||||||
gettext (configfile >> "CfgWeapons" >> uniform GVAR(center) >> "ItemInfo" >> "containerClass")
|
|
||||||
};
|
|
||||||
case IDC_buttonVest: {
|
|
||||||
gettext (configfile >> "CfgWeapons" >> vest GVAR(center) >> "ItemInfo" >> "containerClass")
|
|
||||||
};
|
|
||||||
case IDC_buttonBackpack: {
|
|
||||||
backpack GVAR(center)
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _control = _display displayCtrl IDC_rightTabContentListnBox;
|
|
||||||
[_control, _maxLoad] call FUNC(updateRightPanel);
|
|
||||||
|
@ -15,39 +15,41 @@
|
|||||||
params ["_display"];
|
params ["_display"];
|
||||||
|
|
||||||
if (GVAR(shiftState)) then {
|
if (GVAR(shiftState)) then {
|
||||||
|
|
||||||
if (isNil QGVAR(defaultLoadoutsList) || {GVAR(defaultLoadoutsList) isEqualTo []}) exitWith {
|
if (isNil QGVAR(defaultLoadoutsList) || {GVAR(defaultLoadoutsList) isEqualTo []}) exitWith {
|
||||||
[_display, localize LSTRING(exportDefaultError)] call FUNC(message);
|
[_display, LLSTRING(exportDefaultError)] call FUNC(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Export default loadout list
|
||||||
private _listLength = count GVAR(defaultLoadoutsList);
|
private _listLength = count GVAR(defaultLoadoutsList);
|
||||||
for "_index" from -1 to _listLength do {
|
|
||||||
|
|
||||||
switch true do {
|
for "_index" from -1 to _listLength do {
|
||||||
|
switch (true) do {
|
||||||
|
// Beginning
|
||||||
case (_index == -1): {
|
case (_index == -1): {
|
||||||
"ace_clipboard" callExtension (format ["[%1", endl]);
|
"ace_clipboard" callExtension (format ["[%1", endl]);
|
||||||
};
|
};
|
||||||
|
// End
|
||||||
case (_index == _listLength): {
|
case (_index == _listLength): {
|
||||||
"ace_clipboard" callExtension "];";
|
"ace_clipboard" callExtension "];";
|
||||||
};
|
};
|
||||||
|
// Rest
|
||||||
default {
|
default {
|
||||||
"ace_clipboard" callExtension ([" ",str (GVAR(defaultLoadoutsList) select _index), [",", ""] select (_index == _listLength - 1), endl] joinString "");
|
"ace_clipboard" callExtension ([" ", str (GVAR(defaultLoadoutsList) select _index), [",", ""] select (_index == _listLength - 1), endl] joinString "");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
"ace_clipboard" callExtension "--COMPLETE--";
|
"ace_clipboard" callExtension "--COMPLETE--";
|
||||||
|
|
||||||
[_display, localize LSTRING(exportDefault)] call FUNC(message);
|
[_display, LLSTRING(exportDefault)] call FUNC(message);
|
||||||
} else {
|
} else {
|
||||||
|
// Export singular loadout
|
||||||
|
private _export = str (GVAR(center) call CBA_fnc_getLoadout);
|
||||||
|
|
||||||
private _export = str ([GVAR(center)] call FUNC(getLoadout));
|
|
||||||
"ace_clipboard" callExtension (_export + ";");
|
"ace_clipboard" callExtension (_export + ";");
|
||||||
"ace_clipboard" callExtension "--COMPLETE--";
|
"ace_clipboard" callExtension "--COMPLETE--";
|
||||||
|
|
||||||
[_display, localize LSTRING(exportCurrent)] call FUNC(message);
|
[_display, LLSTRING(exportCurrent)] call FUNC(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
[QGVAR(loadoutExported), [_display, GVAR(shiftState)]] call CBA_fnc_localEvent;
|
[QGVAR(loadoutExported), [_display, GVAR(shiftState)]] call CBA_fnc_localEvent;
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
params ["_display"];
|
params ["_display"];
|
||||||
|
|
||||||
private _showToggle = !ctrlShown (_display displayCtrl IDC_menuBar);
|
private _showToggle = !ctrlShown (_display displayCtrl IDC_menuBar);
|
||||||
|
private _ctrl = controlNull;
|
||||||
|
|
||||||
{
|
{
|
||||||
private _ctrl = _display displayctrl _x;
|
_ctrl = _display displayCtrl _x;
|
||||||
_ctrl ctrlshow _showToggle;
|
_ctrl ctrlShow _showToggle;
|
||||||
_ctrl ctrlcommit 0.15;
|
_ctrl ctrlCommit FADE_DELAY;
|
||||||
} foreach [
|
} forEach [
|
||||||
IDC_blockLeftFrame,
|
IDC_blockLeftFrame,
|
||||||
IDC_blockLeftBackground,
|
IDC_blockLeftBackground,
|
||||||
IDC_blockRightFrame,
|
IDC_blockRightFrame,
|
||||||
@ -35,6 +36,8 @@ private _showToggle = !ctrlShown (_display displayCtrl IDC_menuBar);
|
|||||||
IDC_rightTabContentListnBox,
|
IDC_rightTabContentListnBox,
|
||||||
IDC_sortLeftTab,
|
IDC_sortLeftTab,
|
||||||
IDC_sortRightTab,
|
IDC_sortRightTab,
|
||||||
|
IDC_sortLeftTabDirection,
|
||||||
|
IDC_sortRightTabDirection,
|
||||||
IDC_leftSearchbarButton,
|
IDC_leftSearchbarButton,
|
||||||
IDC_rightSearchbarButton,
|
IDC_rightSearchbarButton,
|
||||||
IDC_leftSearchbar,
|
IDC_leftSearchbar,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Import loadout / default loadouts list from clipboard.
|
* Import loadout / default loadouts list from clipboard.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -15,102 +15,72 @@
|
|||||||
|
|
||||||
params ["_display"];
|
params ["_display"];
|
||||||
|
|
||||||
private _data = call (compile copyFromClipboard);
|
// Can be either a singular loadout or an array of loadouts
|
||||||
|
private _extendedLoadout = call compile copyFromClipboard;
|
||||||
|
|
||||||
if (isNil "_data" || {!(_data isEqualType [])}) exitWith {
|
// If error, exit
|
||||||
[_display, localize LSTRING(importFormatError)] call FUNC(message);
|
if (isNil "_extendedLoadout" || {!(_extendedLoadout isEqualType [])}) exitWith {
|
||||||
|
[_display, LLSTRING(importFormatError)] call FUNC(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(shiftState) && {is3DEN}) then {
|
if (GVAR(shiftState) && {is3DEN}) then {
|
||||||
|
// Supports CBA extended loadout or getUnitLoadout arrays
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
count _x == 2 &&
|
count _x == 2 &&
|
||||||
{_x select 0 isEqualType ""} &&
|
{(_x select 0) isEqualType ""} &&
|
||||||
{_x select 0 != ""} &&
|
{(_x select 0) != ""} &&
|
||||||
{_x select 1 isEqualType []} &&
|
{(_x select 1) isEqualType []} &&
|
||||||
{count (_x select 1) == 10}
|
{count (_x select 1) in [2, 10]}
|
||||||
) then {
|
) then {
|
||||||
_x call FUNC(addDefaultLoadout);
|
_x call FUNC(addDefaultLoadout);
|
||||||
};
|
};
|
||||||
} foreach _data;
|
} forEach _extendedLoadout;
|
||||||
|
|
||||||
|
[_display, LLSTRING(importedDefault)] call FUNC(message);
|
||||||
|
|
||||||
[_display, localize LSTRING(importedDefault)] call FUNC(message);
|
|
||||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
private _count = count _data;
|
// If _extendedLoadout is in getUnitLoadout array, change into CBA extended loadout array
|
||||||
if (_count == 10 || { _count == 2 }) then {
|
if (count _extendedLoadout == 10) then {
|
||||||
[GVAR(center), _data] call CBA_fnc_setLoadout;
|
_extendedLoadout = [_extendedLoadout, createHashMap];
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(currentItems) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", [], [], [], [], [], []];
|
// Check if CBA extended loadout array
|
||||||
for "_index" from 0 to 15 do {
|
if ((count _extendedLoadout) == 2) then {
|
||||||
switch (_index) do {
|
[GVAR(center), _extendedLoadout] call CBA_fnc_setLoadout;
|
||||||
case 0;
|
|
||||||
case 1;
|
|
||||||
case 2:{
|
|
||||||
GVAR(currentItems) set [_index, ((LIST_DEFAULTS select 0) select _index)];
|
|
||||||
};
|
|
||||||
case 3;
|
|
||||||
case 4;
|
|
||||||
case 5;
|
|
||||||
case 6;
|
|
||||||
case 7;
|
|
||||||
case 8;
|
|
||||||
case 9: {
|
|
||||||
GVAR(currentItems) set [_index, (LIST_DEFAULTS select _index) select 0];
|
|
||||||
|
|
||||||
};
|
// Update current item list
|
||||||
case 10: {
|
call FUNC(updateCurrentItemsList);
|
||||||
{(GVAR(currentItems) select 15) pushBack _x} forEach (uniformItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 11: {
|
|
||||||
{(GVAR(currentItems) select 16) pushBack _x} forEach (vestItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 12: {
|
|
||||||
{(GVAR(currentItems) select 17) pushBack _x} forEach (backpackItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 13: {
|
|
||||||
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + (primaryWeaponMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
case 14: {
|
|
||||||
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + (secondaryWeaponMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
case 15: {
|
|
||||||
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + (handgunMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
private _simulationType = getText (configFile >> "CfgWeapons" >> _x >> "simulation");
|
|
||||||
private _index = 10 + (["itemmap", "itemcompass", "itemradio", "itemwatch", "itemgps"] find (tolower _simulationType));
|
|
||||||
|
|
||||||
GVAR(currentItems) set [_index, _x];
|
|
||||||
} foreach (assignedItems GVAR(center));
|
|
||||||
|
|
||||||
|
// This takes care of items that aren't available in the arsenal (either wrong tab or arsenal doesn't have it whitelisted)
|
||||||
call FUNC(updateUniqueItemsList);
|
call FUNC(updateUniqueItemsList);
|
||||||
|
|
||||||
|
_extendedLoadout params ["_loadout", "_extendedInfo"];
|
||||||
|
|
||||||
// Reapply insignia
|
// Reapply insignia
|
||||||
if (QGVAR(insignia) in _loadout#1) then {
|
if (QGVAR(insignia) in _extendedInfo) then {
|
||||||
GVAR(currentInsignia) = _loadout#1 getOrDefault [QGVAR(insignia), ""];
|
GVAR(currentInsignia) = _extendedInfo getOrDefault [QGVAR(insignia), ""];
|
||||||
} else {
|
} else {
|
||||||
[GVAR(center), ""] call bis_fnc_setUnitInsignia;
|
[GVAR(center), ""] call BIS_fnc_setUnitInsignia;
|
||||||
[GVAR(center), GVAR(currentInsignia)] call bis_fnc_setUnitInsignia;
|
[GVAR(center), GVAR(currentInsignia)] call BIS_fnc_setUnitInsignia;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (QGVAR(face) in _loadout#1) then {
|
// Save face
|
||||||
GVAR(currentFace) = _loadout#1 getOrDefault [QGVAR(face), GVAR(currentFace)];
|
if (QGVAR(face) in _extendedInfo) then {
|
||||||
};
|
GVAR(currentFace) = _extendedInfo getOrDefault [QGVAR(face), GVAR(currentFace)];
|
||||||
if (QGVAR(voice) in _loadout#1) then {
|
|
||||||
GVAR(currentVoice) = _loadout#1 getOrDefault [QGVAR(voice), GVAR(currentVoice)];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Save voice
|
||||||
|
if (QGVAR(voice) in _extendedInfo) then {
|
||||||
|
GVAR(currentVoice) = _extendedInfo getOrDefault [QGVAR(voice), GVAR(currentVoice)];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fill left panel
|
||||||
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
||||||
|
|
||||||
[_display, localize LSTRING(importedCurrent)] call FUNC(message);
|
[_display, LLSTRING(importedCurrent)] call FUNC(message);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
[QGVAR(loadoutImported), [_display, (GVAR(shiftState) && {is3DEN})]] call CBA_fnc_localEvent;
|
[QGVAR(loadoutImported), [_display, GVAR(shiftState) && {is3DEN}]] call CBA_fnc_localEvent;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Delete / unshare loadout currently selected.
|
* Delete / unshare loadout currently selected.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -22,35 +22,39 @@ private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
|||||||
private _contentPanelCursSel = lnbCurSelRow _contentPanelCtrl;
|
private _contentPanelCursSel = lnbCurSelRow _contentPanelCtrl;
|
||||||
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1];
|
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1];
|
||||||
|
|
||||||
|
// If loadout is local or default
|
||||||
if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||||
|
// Find loadout and delete from list
|
||||||
if (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts}) then {
|
if (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts}) then {
|
||||||
GVAR(defaultLoadoutsList) deleteAt (GVAR(defaultLoadoutsList) find ((GVAR(defaultLoadoutsList) select {_x select 0 == _loadoutName}) select 0));
|
GVAR(defaultLoadoutsList) deleteAt (GVAR(defaultLoadoutsList) findIf {(_x select 0) == _loadoutName});
|
||||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
|
||||||
|
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||||
} else {
|
} else {
|
||||||
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
|
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
|
||||||
_data deleteAt (_data find ((_data select {_x select 0 == _loadoutName}) select 0));
|
|
||||||
|
_data deleteAt (_data findIf {(_x select 0) == _loadoutName});
|
||||||
};
|
};
|
||||||
|
|
||||||
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), nil];
|
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), nil];
|
||||||
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
|
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
|
||||||
_contentPanelCtrl lnbSetCurSelRow (_contentPanelCursSel);
|
_contentPanelCtrl lnbSetCurSelRow _contentPanelCursSel;
|
||||||
|
|
||||||
|
[findDisplay IDD_ace_arsenal, [LLSTRING(loadoutDeleted), _loadoutName] joinString " "] call FUNC(message);
|
||||||
|
|
||||||
[(findDisplay IDD_ace_arsenal), [localize LSTRING(loadoutDeleted), _loadoutName] joinString " "] call FUNC(message);
|
|
||||||
[QGVAR(onLoadoutDelete), [_loadoutName]] call CBA_fnc_localEvent;
|
[QGVAR(onLoadoutDelete), [_loadoutName]] call CBA_fnc_localEvent;
|
||||||
} else {
|
} else {
|
||||||
|
// If loadout is shared
|
||||||
private _profileName = profileName; // GVAR(center) could be a remote unit
|
private _profileName = profileName; // GVAR(center) could be a remote unit
|
||||||
private _loadoutVar = _profileName + _loadoutName;
|
private _loadoutVar = _profileName + _loadoutName;
|
||||||
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable [QGVAR(sharedLoadoutsVars), []];
|
||||||
|
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars - [_loadoutVar], true];
|
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars - [_loadoutVar], true];
|
||||||
|
|
||||||
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
|
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
|
||||||
_contentPanelCtrl lnbSetCurSelRow (_contentPanelCursSel);
|
_contentPanelCtrl lnbSetCurSelRow _contentPanelCursSel;
|
||||||
|
|
||||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
[findDisplay IDD_ace_arsenal, [LLSTRING(loadoutUnshared), _loadoutName] joinString " "] call FUNC(message);
|
||||||
|
|
||||||
[(findDisplay IDD_ace_arsenal), [localize LSTRING(loadoutUnshared), _loadoutName] joinString " "] call FUNC(message);
|
[QGVAR(loadoutUnshared), [_contentPanelCtrl, _profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Load selected loadout.
|
* Load selected loadout.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -22,90 +22,48 @@ private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
|||||||
private _curSel = lnbCurSelRow _contentPanelCtrl;
|
private _curSel = lnbCurSelRow _contentPanelCtrl;
|
||||||
private _loadoutName = _contentPanelCtrl lnbText [_curSel, 1];
|
private _loadoutName = _contentPanelCtrl lnbText [_curSel, 1];
|
||||||
|
|
||||||
private _loadout = switch GVAR(currentLoadoutsTab) do {
|
private _extendedLoadout = switch (GVAR(currentLoadoutsTab)) do {
|
||||||
|
// Local and default loadouts
|
||||||
case IDC_buttonMyLoadouts;
|
case IDC_buttonMyLoadouts;
|
||||||
case IDC_buttonDefaultLoadouts:{
|
case IDC_buttonDefaultLoadouts: {
|
||||||
(_contentPanelCtrl getVariable _loadoutName + str GVAR(currentLoadoutsTab)) select 0
|
(_contentPanelCtrl getVariable _loadoutName + str GVAR(currentLoadoutsTab)) select 0
|
||||||
};
|
};
|
||||||
|
// Shared loadouts
|
||||||
case IDC_buttonSharedLoadouts:{
|
case IDC_buttonSharedLoadouts: {
|
||||||
(GVAR(sharedLoadoutsNamespace) getVariable ((_contentPanelCtrl lnbText [_curSel, 0]) + (_contentPanelCtrl lnbText [_curSel, 1]))) select 2
|
(GVAR(sharedLoadoutsNamespace) getVariable ((_contentPanelCtrl lnbText [_curSel, 0]) + (_contentPanelCtrl lnbText [_curSel, 1]))) select 2
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
[GVAR(center), _loadout, true] call CBA_fnc_setLoadout;
|
// Apply loadout to unit
|
||||||
|
[GVAR(center), _extendedLoadout, true] call CBA_fnc_setLoadout;
|
||||||
|
|
||||||
GVAR(currentItems) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", [], [], [], [], [], []];
|
// Update current item list
|
||||||
for "_index" from 0 to 15 do {
|
call FUNC(updateCurrentItemsList);
|
||||||
switch (_index) do {
|
|
||||||
case 0;
|
|
||||||
case 1;
|
|
||||||
case 2:{
|
|
||||||
GVAR(currentItems) set [_index, ((LIST_DEFAULTS select 0) select _index)];
|
|
||||||
};
|
|
||||||
case 3;
|
|
||||||
case 4;
|
|
||||||
case 5;
|
|
||||||
case 6;
|
|
||||||
case 7;
|
|
||||||
case 8;
|
|
||||||
case 9: {
|
|
||||||
GVAR(currentItems) set [_index, (LIST_DEFAULTS select _index) select 0];
|
|
||||||
|
|
||||||
};
|
|
||||||
case 10: {
|
|
||||||
{(GVAR(currentItems) select 15) pushBack _x} forEach (uniformItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 11: {
|
|
||||||
{(GVAR(currentItems) select 16) pushBack _x} forEach (vestItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 12: {
|
|
||||||
{(GVAR(currentItems) select 17) pushBack _x} forEach (backpackItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 13: {
|
|
||||||
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + (primaryWeaponMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
case 14: {
|
|
||||||
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + (secondaryWeaponMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
case 15: {
|
|
||||||
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + (handgunMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
{
|
|
||||||
private _simulationType = getText (configFile >> "CfgWeapons" >> _x >> "simulation");
|
|
||||||
|
|
||||||
if (_simulationType != "NVGoggles") then {
|
|
||||||
if (_simulationType == "ItemGps" || _simulationType == "Weapon") then {
|
|
||||||
GVAR(currentItems) set [14, _x];
|
|
||||||
} else {
|
|
||||||
|
|
||||||
private _index = 10 + (["itemmap", "itemcompass", "itemradio", "itemwatch"] find (tolower _simulationType));
|
|
||||||
GVAR(currentItems) set [_index, _x];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach (assignedItems GVAR(center));
|
|
||||||
|
|
||||||
|
// This takes care of items that aren't available in the arsenal (either wrong tab or arsenal doesn't have it whitelisted)
|
||||||
call FUNC(updateUniqueItemsList);
|
call FUNC(updateUniqueItemsList);
|
||||||
|
|
||||||
|
_extendedLoadout params ["_loadout", "_extendedInfo"];
|
||||||
|
|
||||||
// Reapply insignia
|
// Reapply insignia
|
||||||
if (QGVAR(insignia) in _loadout#1) then {
|
if (QGVAR(insignia) in _extendedInfo) then {
|
||||||
GVAR(currentInsignia) = _loadout#1 getOrDefault [QGVAR(insignia), ""];
|
GVAR(currentInsignia) = _extendedInfo getOrDefault [QGVAR(insignia), ""];
|
||||||
} else {
|
} else {
|
||||||
[GVAR(center), ""] call bis_fnc_setUnitInsignia;
|
[GVAR(center), ""] call BIS_fnc_setUnitInsignia;
|
||||||
[GVAR(center), GVAR(currentInsignia)] call bis_fnc_setUnitInsignia;
|
[GVAR(center), GVAR(currentInsignia)] call BIS_fnc_setUnitInsignia;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (QGVAR(face) in _loadout#1) then {
|
// Update current face if necessary
|
||||||
GVAR(currentFace) = _loadout#1 getOrDefault [QGVAR(face), GVAR(currentFace)];
|
if (QGVAR(face) in _extendedInfo) then {
|
||||||
};
|
GVAR(currentFace) = _extendedInfo getOrDefault [QGVAR(face), GVAR(currentFace)];
|
||||||
if (QGVAR(voice) in _loadout#1) then {
|
|
||||||
GVAR(currentVoice) = _loadout#1 getOrDefault [QGVAR(voice), GVAR(currentVoice)];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[(findDisplay IDD_ace_arsenal), [localize LSTRING(loadoutLoaded), _loadoutName] joinString " "] call FUNC(message);
|
// Update voice face if necessary
|
||||||
|
if (QGVAR(voice) in _extendedInfo) then {
|
||||||
|
GVAR(currentVoice) = _extendedInfo getOrDefault [QGVAR(voice), GVAR(currentVoice)];
|
||||||
|
};
|
||||||
|
|
||||||
[QGVAR(onLoadoutLoad), [_loadout#0, _loadoutName]] call CBA_fnc_localEvent;
|
[findDisplay IDD_ace_arsenal, [LLSTRING(loadoutLoaded), _loadoutName] joinString " "] call FUNC(message);
|
||||||
[QGVAR(onLoadoutLoadExtended), [_loadout, _loadoutName]] call CBA_fnc_localEvent;
|
|
||||||
|
[QGVAR(onLoadoutLoad), [_loadout, _loadoutName]] call CBA_fnc_localEvent;
|
||||||
|
[QGVAR(onLoadoutLoadExtended), [_extendedLoadout, _loadoutName]] call CBA_fnc_localEvent;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Rename selected loadout.
|
* Rename selected loadout.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -23,49 +23,45 @@ private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
|||||||
private _curSelRow = lnbCurSelRow _contentPanelCtrl;
|
private _curSelRow = lnbCurSelRow _contentPanelCtrl;
|
||||||
private _loadoutName = _contentPanelCtrl lnbText [_curSelRow, 1];
|
private _loadoutName = _contentPanelCtrl lnbText [_curSelRow, 1];
|
||||||
|
|
||||||
private _editBoxCtrl = _display displayCtrl IDC_textEditBox;
|
// Get text from text edit box
|
||||||
private _editBoxContent = ctrlText _editBoxCtrl;
|
private _editBoxContent = ctrlText (_display displayCtrl IDC_textEditBox);
|
||||||
|
|
||||||
private _data = [profileNamespace getVariable [QGVAR(saved_loadouts), []], GVAR(defaultLoadoutsList)] select (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts && {is3DEN});
|
// If it's the exact same name, don't do anything
|
||||||
private _similarLoadouts = _data select {_x select 0 == _editBoxContent};
|
if (_editBoxContent isEqualTo _loadoutName) exitWith {};
|
||||||
|
|
||||||
if (count _similarLoadouts > 0) exitWith {
|
private _data = [profileNamespace getVariable [QGVAR(saved_loadouts), []], GVAR(defaultLoadoutsList)] select (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts});
|
||||||
[(findDisplay IDD_ace_arsenal), localize LSTRING(renameExistError)] call FUNC(message);
|
|
||||||
|
// If there is a loadout with a similar name and it's not chosen to be renamed, don't rename and exit
|
||||||
|
if (_editBoxContent != _loadoutName && {_data findIf {(_x select 0) == _editBoxContent} != -1}) exitWith {
|
||||||
|
[findDisplay IDD_ace_arsenal, LLSTRING(renameExistError)] call FUNC(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update loadout info in profile / 3DEN and list namespaces
|
// Update loadout info in profile / 3DEN and list namespaces
|
||||||
private _loadoutToRename = (_data select {_x select 0 == _loadoutName}) select 0;
|
private _loadoutIndex = _data findIf {(_x select 0) == _loadoutName};
|
||||||
(_contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab))) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount", "_nullItemsList", "_unavailableItemsList"];
|
|
||||||
|
|
||||||
_data set [_data find _loadoutToRename, [_editBoxContent, (_loadoutToRename select 1)]];
|
// Set new name
|
||||||
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), nil];
|
(_data select _loadoutIndex) set [0, _editBoxContent];
|
||||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), [_extendedLoadout, _nullItemsAmount, _unavailableItemsAmount, _nullItemsList, _unavailableItemsList]];
|
|
||||||
|
|
||||||
// Add new row
|
|
||||||
_contentPanelCtrl lnbDeleteRow _curSelRow;
|
|
||||||
private _newRow = _contentPanelCtrl lnbAddRow ["",_editBoxContent];
|
|
||||||
|
|
||||||
_extendedLoadout params ["_loadout"];
|
|
||||||
ADD_LOADOUTS_LIST_PICTURES
|
|
||||||
|
|
||||||
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]];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sort and select the current row
|
|
||||||
_contentPanelCtrl lnbSort [1, false];
|
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
|
||||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _editBoxContent) exitwith {_contentPanelCtrl lnbSetCurSelRow _i};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts}) then {
|
if (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts}) then {
|
||||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||||
};
|
};
|
||||||
|
|
||||||
[(findDisplay IDD_ace_arsenal), [_loadoutName, localize LSTRING(loadoutRenamed) ,_editBoxContent] joinString " "] call FUNC(message);
|
private _currentLoadoutsTab = str GVAR(currentLoadoutsTab);
|
||||||
|
|
||||||
|
_contentPanelCtrl setVariable [_editBoxContent + _currentLoadoutsTab, _contentPanelCtrl getVariable [_loadoutName + _currentLoadoutsTab, []]];
|
||||||
|
_contentPanelCtrl setVariable [_loadoutName + _currentLoadoutsTab, nil];
|
||||||
|
|
||||||
|
// Update the current row's loadout name
|
||||||
|
_contentPanelCtrl lnbSetText [[_curSelRow, 1], _editBoxContent];
|
||||||
|
|
||||||
|
// Sort loadouts alphabetically
|
||||||
|
_contentPanelCtrl lnbSort [1, false];
|
||||||
|
|
||||||
|
// Select the newly renamed loadout
|
||||||
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _editBoxContent) exitWith {
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
[findDisplay IDD_ace_arsenal, [_loadoutName, LLSTRING(loadoutRenamed), _editBoxContent] joinString " "] call FUNC(message);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Save selected loadout.
|
* Save selected loadout.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -21,280 +21,167 @@ if !(ctrlEnabled _control) exitWith {};
|
|||||||
private _editBoxCtrl = _display displayCtrl IDC_textEditBox;
|
private _editBoxCtrl = _display displayCtrl IDC_textEditBox;
|
||||||
private _editBoxContent = ctrlText _editBoxCtrl;
|
private _editBoxContent = ctrlText _editBoxCtrl;
|
||||||
|
|
||||||
|
// If no name given, throw error
|
||||||
if (_editBoxContent == "") exitWith {
|
if (_editBoxContent == "") exitWith {
|
||||||
[(findDisplay IDD_ace_arsenal), localize LSTRING(saveEmptyNameBox)] call FUNC(message);
|
[findDisplay IDD_ace_arsenal, LLSTRING(saveEmptyNameBox)] call FUNC(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _data = [+(profileNamespace getVariable [QGVAR(saved_loadouts),[]]), +(GVAR(defaultLoadoutsList))] select (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts && {is3DEN});
|
// Get shared loadouts
|
||||||
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable [QGVAR(sharedLoadoutsVars), []];
|
||||||
private _cursSelRow = lnbCurSelRow _contentPanelCtrl;
|
|
||||||
|
|
||||||
private _loadoutName = _contentPanelCtrl lnbText [_cursSelRow, 1];
|
|
||||||
private _curSelLoadout = (_contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab))) select 0;
|
|
||||||
private _extendedLoadout = GVAR(center) call FUNC(getLoadout);
|
|
||||||
private _loadout = _extendedLoadout select 0;
|
|
||||||
|
|
||||||
private _loadoutIndex = _data findIf {(_x select 0) == _editBoxContent};
|
|
||||||
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
|
||||||
|
|
||||||
// Make sure the loadout isn't yours (public tab) or being shared (my loadouts tab)
|
// Make sure the loadout isn't yours (public tab) or being shared (my loadouts tab)
|
||||||
private _similarSharedLoadout = (profileName + _editBoxContent) in _sharedLoadoutsVars;
|
if ((profileName + _editBoxContent) in _sharedLoadoutsVars) exitWith {
|
||||||
if ((_contentPanelCtrl lnbText [_cursSelRow, 0]) == profileName) exitWith {
|
[findDisplay IDD_ace_arsenal, LLSTRING(saveSharedError)] call FUNC(message);
|
||||||
[(findDisplay IDD_ace_arsenal), localize LSTRING(saveAuthorError)] call FUNC(message);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_similarSharedLoadout) exitWith {
|
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||||
[(findDisplay IDD_ace_arsenal), localize LSTRING(saveSharedError)] call FUNC(message);
|
private _curSelRow = lnbCurSelRow _contentPanelCtrl;
|
||||||
|
|
||||||
|
if ((_contentPanelCtrl lnbText [_curSelRow, 0]) == profileName) exitWith {
|
||||||
|
[findDisplay IDD_ace_arsenal, LLSTRING(saveAuthorError)] call FUNC(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (GVAR(currentLoadoutsTab)) do {
|
// Get currently selected loadout name & loadout
|
||||||
case IDC_buttonMyLoadouts:{
|
private _loadoutName = _contentPanelCtrl lnbText [_curSelRow, 1];
|
||||||
|
private _curSelLoadout = (_contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab))) select 0;
|
||||||
|
|
||||||
for "_dataIndex" from 0 to 10 do {
|
// Get unit's current loadout
|
||||||
switch (_dataIndex) do {
|
private _extendedLoadout = GVAR(center) call CBA_fnc_getLoadout;
|
||||||
|
_extendedLoadout params ["_loadout"];
|
||||||
|
|
||||||
case 0;
|
private _loadouts = [profileNamespace getVariable [QGVAR(saved_loadouts), []], GVAR(defaultLoadoutsList)] select (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts});
|
||||||
case 1;
|
private _loadoutIndex = _loadouts findIf {(_x select 0) == _editBoxContent};
|
||||||
case 2;
|
|
||||||
case 8: {
|
|
||||||
if (count (_loadout select _dataIndex) > 0) then {
|
|
||||||
|
|
||||||
private _weapon = (_loadout select _dataIndex) select 0;
|
// Return what loadout was saved
|
||||||
if (_weapon != "") then {
|
private _savedLoadout = switch (GVAR(currentLoadoutsTab)) do {
|
||||||
|
// Local loadouts tab
|
||||||
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
|
case IDC_buttonMyLoadouts: {
|
||||||
if (_weapon != _baseWeapon) then {
|
// If saved to default loadout
|
||||||
(_loadout select _dataIndex) set [0, _baseWeapon];
|
if (GVAR(shiftState) && {is3DEN} && {_loadoutName != ""} && {_curSelRow != -1} && {_loadoutIndex != -1}) then {
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case 3;
|
|
||||||
case 4;
|
|
||||||
case 5: {
|
|
||||||
if (count (_loadout select _dataIndex) > 0) then {
|
|
||||||
private _containerContents = (_loadout select _dataIndex) select 1;
|
|
||||||
|
|
||||||
if (count _containerContents > 0) then {
|
|
||||||
|
|
||||||
{
|
|
||||||
if (count _x == 2) then {
|
|
||||||
|
|
||||||
if ((_x select 0) isEqualType "") then {
|
|
||||||
|
|
||||||
private _item = (_x select 0);
|
|
||||||
if (_item != "") then {
|
|
||||||
|
|
||||||
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
|
|
||||||
if (_uniqueBaseCfgText != "") then {
|
|
||||||
|
|
||||||
_x set [0, _uniqueBaseCfgText];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
private _weapon = (_x select 0) select 0;
|
|
||||||
if (_weapon != "") then {
|
|
||||||
|
|
||||||
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
|
|
||||||
if (_weapon != _baseWeapon) then {
|
|
||||||
(_x select 0)set [0, _baseWeapon];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} foreach _containerContents;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case 9: {
|
|
||||||
for "_subIndex" from 0 to 4 do {
|
|
||||||
private _item = (_loadout select _dataIndex) select _subIndex;
|
|
||||||
|
|
||||||
if (_item != "") then {
|
|
||||||
|
|
||||||
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
|
|
||||||
if (_uniqueBaseCfgText != "") then {
|
|
||||||
|
|
||||||
(_loadout select _dataIndex) set [_subIndex, _uniqueBaseCfgText];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (GVAR(shiftState) && {is3DEN} && {_loadoutName isNotEqualTo ""} && {_cursSelRow != -1} && {_loadoutIndex isNotEqualTo -1}) exitwith {
|
|
||||||
private _defaultLoadoutsSearch = GVAR(defaultLoadoutsList) findIf {(_x select 0) == _loadoutName};
|
private _defaultLoadoutsSearch = GVAR(defaultLoadoutsList) findIf {(_x select 0) == _loadoutName};
|
||||||
if (_defaultLoadoutsSearch isEqualto -1) then {
|
|
||||||
GVAR(defaultLoadoutsList) pushBack [_loadoutName, _curSelLoadout];
|
if (_defaultLoadoutsSearch == -1) then {
|
||||||
|
_loadoutIndex = GVAR(defaultLoadoutsList) pushBack [_loadoutName, _curSelLoadout];
|
||||||
} else {
|
} else {
|
||||||
GVAR(defaultLoadoutsList) set [_defaultLoadoutsSearch , [ _loadoutName, _curSelLoadout]];
|
GVAR(defaultLoadoutsList) set [_defaultLoadoutsSearch, [_loadoutName, _curSelLoadout]];
|
||||||
};
|
};
|
||||||
|
|
||||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||||
};
|
|
||||||
|
|
||||||
if (_loadoutIndex isEqualto -1) then {
|
_curSelLoadout
|
||||||
_data pushBack [_editBoxContent, _extendedLoadout];
|
|
||||||
} else {
|
} else {
|
||||||
_data set [_loadoutIndex, [[_editBoxContent, _loadoutName] select (_loadoutName isEqualTo _editBoxContent), _extendedLoadout]];
|
// Replace unique items with their bases and replace weapons with their base weapons
|
||||||
};
|
_loadout = [_loadout] call FUNC(replaceUniqueItemsLoadout);
|
||||||
|
|
||||||
// Delete "old" loadout row
|
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
|
||||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _editBoxContent) exitwith {_contentPanelCtrl lnbDeleteRow _i};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _newRow = _contentPanelCtrl lnbAddRow ["",_editBoxContent];
|
// Add or overwrite loadout in loadout storage
|
||||||
|
if (_loadoutIndex == -1) then {
|
||||||
|
_loadoutIndex = _data pushBack [_editBoxContent, _extendedLoadout];
|
||||||
|
} else {
|
||||||
|
_data set [_loadoutIndex, [_editBoxContent, _extendedLoadout]];
|
||||||
|
};
|
||||||
|
|
||||||
ADD_LOADOUTS_LIST_PICTURES
|
// Refresh loadout list; Delete previous loadout row
|
||||||
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), [_extendedLoadout] call FUNC(verifyLoadout)];
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _editBoxContent) exitWith {
|
||||||
|
_contentPanelCtrl lnbDeleteRow _lbIndex;
|
||||||
_contentPanelCtrl lnbSort [1, false];
|
|
||||||
|
|
||||||
// Select newly saved loadout
|
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
|
||||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _editBoxContent) exitwith {_contentPanelCtrl lnbSetCurSelRow _i};
|
|
||||||
};
|
|
||||||
|
|
||||||
profileNamespace setVariable [QGVAR(saved_loadouts), _data];
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonDefaultLoadouts:{
|
|
||||||
|
|
||||||
if (is3DEN) then {
|
|
||||||
|
|
||||||
private _loadoutIndex = _data findIf {(_x select 0) == _editBoxContent};
|
|
||||||
|
|
||||||
for "_dataIndex" from 0 to 10 do {
|
|
||||||
switch (_dataIndex) do {
|
|
||||||
|
|
||||||
case 0;
|
|
||||||
case 1;
|
|
||||||
case 2;
|
|
||||||
case 8: {
|
|
||||||
if (count (_loadout select _dataIndex) > 0) then {
|
|
||||||
|
|
||||||
private _weapon = (_loadout select _dataIndex) select 0;
|
|
||||||
if (_weapon != "") then {
|
|
||||||
|
|
||||||
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
|
|
||||||
if (_weapon != _baseWeapon) then {
|
|
||||||
(_loadout select _dataIndex) set [0, _baseWeapon];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case 3;
|
|
||||||
case 4;
|
|
||||||
case 5: {
|
|
||||||
if (count (_loadout select _dataIndex) > 0) then {
|
|
||||||
private _containerContents = (_loadout select _dataIndex) select 1;
|
|
||||||
|
|
||||||
if (count _containerContents > 0) then {
|
|
||||||
|
|
||||||
{
|
|
||||||
if (count _x == 2) then {
|
|
||||||
|
|
||||||
if ((_x select 0) isEqualType "") then {
|
|
||||||
|
|
||||||
private _item = (_x select 0);
|
|
||||||
if (_item != "") then {
|
|
||||||
|
|
||||||
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
|
|
||||||
if (_uniqueBaseCfgText != "") then {
|
|
||||||
|
|
||||||
_x set [0, _uniqueBaseCfgText];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
private _weapon = (_x select 0) select 0;
|
|
||||||
if (_weapon != "") then {
|
|
||||||
|
|
||||||
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
|
|
||||||
if (_weapon != _baseWeapon) then {
|
|
||||||
(_x select 0)set [0, _baseWeapon];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} foreach _containerContents;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case 9: {
|
|
||||||
for "_subIndex" from 0 to 4 do {
|
|
||||||
private _item = (_loadout select _dataIndex) select _subIndex;
|
|
||||||
|
|
||||||
if (_item != "") then {
|
|
||||||
|
|
||||||
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
|
|
||||||
if (_uniqueBaseCfgText != "") then {
|
|
||||||
|
|
||||||
(_loadout select _dataIndex) set [_subIndex, _uniqueBaseCfgText];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_loadoutIndex == -1) then {
|
private _newRow = _contentPanelCtrl lnbAddRow ["", _editBoxContent];
|
||||||
GVAR(defaultLoadoutsList) pushBack [_editBoxContent, _extendedLoadout];
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
} else {
|
|
||||||
GVAR(defaultLoadoutsList) set [_loadoutIndex, [[_editBoxContent, _loadoutName] select (_loadoutName isEqualTo _editBoxContent), _extendedLoadout]];
|
|
||||||
};
|
|
||||||
|
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
|
||||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _editBoxContent) exitwith {_contentPanelCtrl lnbDeleteRow _i};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _newRow = _contentPanelCtrl lnbAddRow ["",_editBoxContent];
|
|
||||||
|
|
||||||
ADD_LOADOUTS_LIST_PICTURES
|
ADD_LOADOUTS_LIST_PICTURES
|
||||||
|
|
||||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), [_extendedLoadout] call FUNC(verifyLoadout)];
|
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), [_extendedLoadout] call FUNC(verifyLoadout)];
|
||||||
|
|
||||||
|
// Sort loadouts alphabetically
|
||||||
_contentPanelCtrl lnbSort [1, false];
|
_contentPanelCtrl lnbSort [1, false];
|
||||||
|
|
||||||
// Select newly saved loadout
|
// Select newly saved loadout
|
||||||
for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _editBoxContent) exitwith {_contentPanelCtrl lnbSetCurSelRow _i};
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _editBoxContent) exitWith {
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_extendedLoadout
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Default loadouts tab
|
||||||
|
case IDC_buttonDefaultLoadouts: {
|
||||||
|
if (is3DEN) then {
|
||||||
|
// Replace unique items with their bases and replace weapons with their base weapons
|
||||||
|
_loadout = [_loadout] call FUNC(replaceUniqueItemsLoadout);
|
||||||
|
|
||||||
|
// Add or overwrite loadout in loadout storage
|
||||||
|
if (_loadoutIndex == -1) then {
|
||||||
|
_loadoutIndex = GVAR(defaultLoadoutsList) pushBack [_editBoxContent, _extendedLoadout];
|
||||||
|
} else {
|
||||||
|
GVAR(defaultLoadoutsList) set [_loadoutIndex, [_editBoxContent, _extendedLoadout]];
|
||||||
};
|
};
|
||||||
|
|
||||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||||
} else {
|
|
||||||
|
|
||||||
|
// Refresh loadout list; Delete previous loadout row
|
||||||
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _editBoxContent) exitWith {
|
||||||
|
_contentPanelCtrl lnbDeleteRow _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private _newRow = _contentPanelCtrl lnbAddRow ["", _editBoxContent];
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
|
||||||
|
ADD_LOADOUTS_LIST_PICTURES
|
||||||
|
|
||||||
|
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), [_extendedLoadout] call FUNC(verifyLoadout)];
|
||||||
|
|
||||||
|
// Sort loadouts alphabetically
|
||||||
|
_contentPanelCtrl lnbSort [1, false];
|
||||||
|
|
||||||
|
// Select newly saved loadout
|
||||||
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _editBoxContent) exitWith {
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_extendedLoadout
|
||||||
|
} else {
|
||||||
|
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
|
||||||
|
|
||||||
|
// Add or overwrite loadout in loadout storage
|
||||||
if (_loadoutIndex == -1) then {
|
if (_loadoutIndex == -1) then {
|
||||||
_data pushBack [_editBoxContent, _curSelLoadout];
|
_loadoutIndex = _data pushBack [_editBoxContent, _curSelLoadout];
|
||||||
} else {
|
} else {
|
||||||
_data set [_loadoutIndex, [[_editBoxContent, _loadoutName] select (_loadoutName isEqualTo _editBoxContent), _curSelLoadout]];
|
_data set [_loadoutIndex, [_editBoxContent, _curSelLoadout]];
|
||||||
_contentPanelCtrl setVariable [_editBoxContent + str IDC_buttonMyLoadouts, [_curSelLoadout] call FUNC(verifyLoadout)];
|
_contentPanelCtrl setVariable [_editBoxContent + str IDC_buttonMyLoadouts, [_curSelLoadout] call FUNC(verifyLoadout)];
|
||||||
};
|
};
|
||||||
|
|
||||||
profileNamespace setVariable [QGVAR(saved_loadouts), _data];
|
_curSelLoadout
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
// Shared loadouts tab
|
||||||
|
case IDC_buttonSharedLoadouts: {
|
||||||
|
_loadout = (GVAR(sharedLoadoutsNamespace) getVariable ((_contentPanelCtrl lnbText [_curSelRow, 0]) + (_contentPanelCtrl lnbText [_curSelRow, 1]))) select 2;
|
||||||
|
|
||||||
case IDC_buttonSharedLoadouts :{
|
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
|
||||||
|
|
||||||
_loadout = (GVAR(sharedLoadoutsNamespace) getVariable ((_contentPanelCtrl lnbText [_cursSelRow, 0]) + (_contentPanelCtrl lnbText [_cursSelRow, 1]))) select 2;
|
|
||||||
|
|
||||||
|
// Add or overwrite loadout in loadout storage
|
||||||
if (_loadoutIndex == -1) then {
|
if (_loadoutIndex == -1) then {
|
||||||
_data pushBack [_editBoxContent, _loadout];
|
_loadoutIndex = _data pushBack [_editBoxContent, _loadout];
|
||||||
} else {
|
} else {
|
||||||
_data set [_loadoutIndex, [[_editBoxContent, _loadoutName] select (_loadoutName isEqualTo _editBoxContent), _loadout]];
|
_data set [_loadoutIndex, [_editBoxContent, _loadout]];
|
||||||
_contentPanelCtrl setVariable [_editBoxContent + str IDC_buttonMyLoadouts, [_loadout] call FUNC(verifyLoadout)];
|
_contentPanelCtrl setVariable [_editBoxContent + str IDC_buttonMyLoadouts, [_loadout] call FUNC(verifyLoadout)];
|
||||||
};
|
};
|
||||||
|
|
||||||
profileNamespace setVariable [QGVAR(saved_loadouts), _data];
|
_loadout
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
[(findDisplay IDD_ace_arsenal), [localize LSTRING(loadoutSaved), _editBoxContent] joinString " "] call FUNC(message);
|
|
||||||
private _savedLoadout = (_data select {_x select 0 == _editBoxContent}) select 0;
|
[findDisplay IDD_ace_arsenal, [LLSTRING(loadoutSaved), _editBoxContent] joinString " "] call FUNC(message);
|
||||||
[QGVAR(onLoadoutSave), [_data find _savedLoadout, _savedLoadout#0]] call CBA_fnc_localEvent;
|
|
||||||
[QGVAR(onLoadoutSaveExtended), [_data find _savedLoadout, _savedLoadout]] call CBA_fnc_localEvent;
|
[QGVAR(onLoadoutSave), [_loadoutIndex, _savedLoadout select 0]] call CBA_fnc_localEvent;
|
||||||
|
[QGVAR(onLoadoutSaveExtended), [_loadoutIndex, _savedLoadout]] call CBA_fnc_localEvent;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Share selected loadout.
|
* Share selected loadout.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -23,33 +23,33 @@ private _contentPanelCursSel = lnbCurSelRow _contentPanelCtrl;
|
|||||||
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1];
|
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1];
|
||||||
private _profileName = profileName; // GVAR(center) could be a remote unit
|
private _profileName = profileName; // GVAR(center) could be a remote unit
|
||||||
private _loadoutVar = _profileName + _loadoutName;
|
private _loadoutVar = _profileName + _loadoutName;
|
||||||
private _sharedLoadoutsVars = +(GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars));
|
private _sharedLoadoutsVars = +(GVAR(sharedLoadoutsNamespace) getVariable [QGVAR(sharedLoadoutsVars), []]);
|
||||||
|
|
||||||
private _loadoutIndex = _sharedLoadoutsVars find _loadoutVar;
|
|
||||||
private _loadoutData = (_contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab))) select 0;
|
private _loadoutData = (_contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab))) select 0;
|
||||||
|
|
||||||
// Loadout set to private
|
if (_loadoutVar in _sharedLoadoutsVars) then {
|
||||||
if (_loadoutIndex > -1) then {
|
// Loadout is shared, set to private
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars - [_loadoutVar], true];
|
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars - [_loadoutVar], true];
|
||||||
|
|
||||||
_contentPanelCtrl lnbSetPicture [[_contentPanelCursSel, 0], QPATHTOF(data\iconPublicBlank.paa)];
|
_contentPanelCtrl lnbSetPicture [[_contentPanelCursSel, 0], QPATHTOF(data\iconPublicBlank.paa)];
|
||||||
_contentPanelCtrl lnbSetValue [[_contentPanelCursSel, 0], 0];
|
_contentPanelCtrl lnbSetValue [[_contentPanelCursSel, 0], 0];
|
||||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
|
||||||
|
|
||||||
// Loadout set to public
|
[QGVAR(loadoutUnshared), [_contentPanelCtrl, _profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||||
} else {
|
} else {
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, [_profileName ,_loadoutName , _loadoutData], true];
|
// Loadout is private, set to shared
|
||||||
|
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, [_profileName, _loadoutName, _loadoutData], true];
|
||||||
_sharedLoadoutsVars pushBackUnique _loadoutVar;
|
_sharedLoadoutsVars pushBackUnique _loadoutVar;
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars, true];
|
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars, true];
|
||||||
|
|
||||||
_contentPanelCtrl lnbSetPicture [[_contentPanelCursSel, 0], QPATHTOF(data\iconPublic.paa)];
|
_contentPanelCtrl lnbSetPicture [[_contentPanelCursSel, 0], QPATHTOF(data\iconPublic.paa)];
|
||||||
_contentPanelCtrl lnbSetValue [[_contentPanelCursSel, 0], 1];
|
_contentPanelCtrl lnbSetValue [[_contentPanelCursSel, 0], 1];
|
||||||
[QGVAR(loadoutShared), [_contentPanelCtrl, [_profileName ,_loadoutName , _loadoutData]]] call CBA_fnc_remoteEvent;
|
|
||||||
|
[QGVAR(loadoutShared), [_contentPanelCtrl, [_profileName, _loadoutName, _loadoutData]]] call CBA_fnc_remoteEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update share button text
|
// Update share button text
|
||||||
_control ctrlSetText ( [
|
_control ctrlSetText ([
|
||||||
localize LSTRING(buttonSharePrivateText),
|
LLSTRING(buttonSharePrivateText),
|
||||||
localize LSTRING(buttonSharePublicText)
|
LLSTRING(buttonSharePublicText)
|
||||||
] select ((_contentPanelCtrl lnbValue [_contentPanelCursSel, 0]) == 1));
|
] select ((_contentPanelCtrl lnbValue [_contentPanelCursSel, 0]) == 1));
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe
|
||||||
* Toggle the stats control group
|
* Toggle the stats control group.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Button control <CONTROL>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -17,15 +16,15 @@
|
|||||||
params ["_display"];
|
params ["_display"];
|
||||||
|
|
||||||
(_display displayCtrl IDC_statsButton) ctrlShow GVAR(showStats);
|
(_display displayCtrl IDC_statsButton) ctrlShow GVAR(showStats);
|
||||||
|
|
||||||
GVAR(showStats) = !GVAR(showStats);
|
GVAR(showStats) = !GVAR(showStats);
|
||||||
|
|
||||||
{
|
{
|
||||||
(_display displayCtrl _x) ctrlShow GVAR(showStats);
|
(_display displayCtrl _x) ctrlShow GVAR(showStats);
|
||||||
} foreach [
|
} forEach [
|
||||||
IDC_statsBox,
|
IDC_statsBox,
|
||||||
IDC_statsPreviousPage,
|
IDC_statsPreviousPage,
|
||||||
IDC_statsNextPage,
|
IDC_statsNextPage,
|
||||||
IDC_statsCurrentPage,
|
IDC_statsCurrentPage,
|
||||||
IDC_statsButtonClose
|
IDC_statsButtonClose
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe
|
||||||
* Handles the previous / next page buttons for stats
|
* Handles the previous / next page buttons for stats.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Previous or next <BOOL> (false = previous, true = next)
|
* 1: Stats page <CONTROL>
|
||||||
|
* 2: Previous (false) or next (true) page <BOOL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -21,7 +22,7 @@ if !(ctrlEnabled _control) exitWith {};
|
|||||||
|
|
||||||
GVAR(statsInfo) params ["_isLeftPanel", "_statsIndex", "_panelControl", "_curSel", "_itemCfg"];
|
GVAR(statsInfo) params ["_isLeftPanel", "_statsIndex", "_panelControl", "_curSel", "_itemCfg"];
|
||||||
|
|
||||||
private _pageList = [GVAR(statsPagesRight), GVAR(statsPagesLeft)] select (_isLeftPanel);
|
private _pageList = [GVAR(statsPagesRight), GVAR(statsPagesLeft)] select _isLeftPanel;
|
||||||
private _newPageNumber = [(_pageList select _statsIndex) - 1, (_pageList select _statsIndex) + 1] select _nextPage;
|
private _newPageNumber = [(_pageList select _statsIndex) - 1, (_pageList select _statsIndex) + 1] select _nextPage;
|
||||||
|
|
||||||
_pageList set [_statsIndex, _newPageNumber];
|
_pageList set [_statsIndex, _newPageNumber];
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Searchbar control <CONTROL>
|
* 1: Searchbar control <CONTROL>
|
||||||
* 2: Right button state <BOOL>
|
* 2: Mouse button <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -15,11 +15,11 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_display", "_control", "_rightButton"];
|
params ["_display", "_control", "_buttonPressed"];
|
||||||
|
|
||||||
if (_rightButton != 1) exitWith {};
|
if (_buttonPressed != 1) exitWith {};
|
||||||
|
|
||||||
_control ctrlSetText '';
|
_control ctrlSetText "";
|
||||||
|
|
||||||
if (ctrlIDC _control == IDC_leftSearchbar) then {
|
if (ctrlIDC _control == IDC_leftSearchbar) then {
|
||||||
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Brett Mayson
|
* Author: Brett Mayson, johnb43
|
||||||
* Create the internal stats arrays when needed for the first time
|
* Create the internal sort arrays when needed for the first time.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -15,11 +15,19 @@
|
|||||||
if (!isNil QGVAR(sortListLeftPanel)) exitWith {};
|
if (!isNil QGVAR(sortListLeftPanel)) exitWith {};
|
||||||
|
|
||||||
private _fnc_addToTabs = {
|
private _fnc_addToTabs = {
|
||||||
params ["_tabsList", "_tabsToAddTo", "_sideString"];
|
params ["_tabsList", "_tabsToAddTo", "_tabSide"];
|
||||||
|
|
||||||
|
private _sort = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _arrayToSave = +_finalArray;
|
// Copy title, statement and condition
|
||||||
_arrayToSave set [0, [_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString ""];
|
_sort = +_finalArray;
|
||||||
(_tabsList select _x) pushBack _arrayToSave;
|
|
||||||
|
// Make sort name
|
||||||
|
_sort set [0, [_class, _tabSide, [str _x, format ["0%1", _x]] select (_x < 10)] joinString ""];
|
||||||
|
|
||||||
|
// No duplicates are possible here
|
||||||
|
(_tabsList select _x) pushBack _sort;
|
||||||
} forEach _tabsToAddTo;
|
} forEach _tabsToAddTo;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,15 +64,17 @@ private _sortListRightPanel = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
//------------------------- Config handling
|
//------------------------- Config handling
|
||||||
private _configEntries = "(getNumber (_x >> 'scope')) == 2" configClasses (configFile >> QGVAR(sorts));
|
private _class = "";
|
||||||
|
private _displayName = "";
|
||||||
|
private _statement = "";
|
||||||
|
private _condition = "";
|
||||||
|
private _finalArray = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _finalArray = [];
|
_class = configName _x;
|
||||||
|
_displayName = getText (_x >> "displayName");
|
||||||
private _class = configName _x;
|
_statement = getText (_x >> "statement");
|
||||||
private _displayName = getText (_x >> "displayName");
|
_condition = getText (_x >> "condition");
|
||||||
private _statement = getText (_x >> "statement");
|
|
||||||
private _condition = getText (_x >> "condition");
|
|
||||||
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
|
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
|
||||||
|
|
||||||
if (_statement != "") then {
|
if (_statement != "") then {
|
||||||
@ -84,7 +94,7 @@ private _configEntries = "(getNumber (_x >> 'scope')) == 2" configClasses (confi
|
|||||||
if (_rightTabsList isNotEqualTo []) then {
|
if (_rightTabsList isNotEqualTo []) then {
|
||||||
[_sortListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
|
[_sortListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
} foreach _configEntries;
|
} forEach ("(getNumber (_x >> 'scope')) == 2" configClasses (configFile >> QGVAR(sorts)));
|
||||||
|
|
||||||
missionNamespace setVariable [QGVAR(sortListLeftPanel), _sortListLeftPanel];
|
GVAR(sortListLeftPanel) = _sortListLeftPanel;
|
||||||
missionNamespace setVariable [QGVAR(sortListRightPanel), _sortListRightPanel];
|
GVAR(sortListRightPanel) = _sortListRightPanel;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Create the internal stats arrays when needed for the first time
|
* Create the internal stat arrays when needed for the first time.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -15,88 +15,104 @@
|
|||||||
if (!isNil QGVAR(statsListLeftPanel)) exitWith {};
|
if (!isNil QGVAR(statsListLeftPanel)) exitWith {};
|
||||||
|
|
||||||
private _fnc_addToTabs = {
|
private _fnc_addToTabs = {
|
||||||
params ["_tabsList", "_tabsToAddTo", "_sideString"];
|
params ["_tabsList", "_tabsToAddTo", "_tabSide"];
|
||||||
|
|
||||||
|
private _stat = [];
|
||||||
|
|
||||||
|
// First gather all stats for a tab
|
||||||
{
|
{
|
||||||
private _currentTab = _tabsList select _x;
|
// Make stat name
|
||||||
private _availablePagesCount = {count _x < 5} count _currentTab;
|
_stat = +_finalArray;
|
||||||
|
_stat set [0, [_class, _tabSide, [str _x, format ["0%1", _x]] select (_x < 10)] joinString ""];
|
||||||
|
|
||||||
private _arrayToSave = +_finalArray;
|
(_tabsList select _x) pushBack _stat;
|
||||||
_arrayToSave set [0, ([_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "")];
|
} forEach _tabsToAddTo;
|
||||||
|
|
||||||
if (_availablePagesCount > 0) then {
|
|
||||||
|
|
||||||
{
|
|
||||||
if (count _x < 5) exitWith {
|
|
||||||
(_currentTab select _forEachIndex) append [_arrayToSave];
|
|
||||||
};
|
|
||||||
} foreach _currentTab;
|
|
||||||
} else {
|
|
||||||
_currentTab pushBack [_arrayToSave];
|
|
||||||
};
|
|
||||||
} foreach _tabsToAddTo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Sort by priority
|
||||||
private _fnc_sortLists = {
|
private _fnc_sortLists = {
|
||||||
params ["_tabsList"];
|
params ["_tabsList"];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _page = _x;
|
// Put priority up front
|
||||||
{
|
{
|
||||||
{
|
reverse _x;
|
||||||
reverse _x;
|
} forEach _x;
|
||||||
} foreach _x;
|
|
||||||
|
|
||||||
_x sort false;
|
// Sort numerically
|
||||||
|
_x sort false;
|
||||||
|
|
||||||
{
|
// Put it back at the rear
|
||||||
reverse _x;
|
{
|
||||||
} foreach _x;
|
reverse _x;
|
||||||
} foreach _page;
|
} forEach _x;
|
||||||
} foreach _tabsList;
|
} forEach _tabsList;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Group stats into groups of 5
|
||||||
|
private _fnc_toStatsArray = {
|
||||||
|
params ["_tabsList", "_tabsListAll"];
|
||||||
|
|
||||||
|
private _stats = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_stats = [];
|
||||||
|
|
||||||
|
for "_index" from 0 to count _x - 1 step 5 do {
|
||||||
|
_stats pushBack (_x select [_index, _index + 5]);
|
||||||
|
};
|
||||||
|
|
||||||
|
_tabsList set [_forEachIndex, _stats];
|
||||||
|
} forEach _tabsList;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _statsListLeftPanel = [
|
private _statsListLeftPanel = [
|
||||||
[[]], // Primary 0
|
[], // Primary 0
|
||||||
[[]], // Handgun 1
|
[], // Handgun 1
|
||||||
[[]], // Launcher 2
|
[], // Launcher 2
|
||||||
[[]], // Uniform 3
|
[], // Uniform 3
|
||||||
[[]], // Vests 4
|
[], // Vests 4
|
||||||
[[]], // Backpacks 5
|
[], // Backpacks 5
|
||||||
[[]], // Headgear 6
|
[], // Headgear 6
|
||||||
[[]], // Goggles 7
|
[], // Goggles 7
|
||||||
[[]], // NVGs 8
|
[], // NVGs 8
|
||||||
[[]], // Binoculars 9
|
[], // Binoculars 9
|
||||||
[[]], // Map 10
|
[], // Map 10
|
||||||
[[]], // GPS 11
|
[], // GPS 11
|
||||||
[[]], // Radio 12
|
[], // Radio 12
|
||||||
[[]], // Compass 13
|
[], // Compass 13
|
||||||
[[]] // Watch 14
|
[] // Watch 14
|
||||||
];
|
];
|
||||||
|
|
||||||
private _statsListRightPanel = [
|
private _statsListRightPanel = [
|
||||||
[[]], // Optics 0
|
[], // Optics 0
|
||||||
[[]], // Side accs 1
|
[], // Side accs 1
|
||||||
[[]], // Muzzle 2
|
[], // Muzzle 2
|
||||||
[[]], // Bipod 3
|
[], // Bipod 3
|
||||||
[[]], // Mag 4
|
[], // Mag 4
|
||||||
[[]], // Throw 5
|
[], // Throw 5
|
||||||
[[]], // Put 6
|
[], // Put 6
|
||||||
[[]] // Misc 7
|
[] // Misc 7
|
||||||
];
|
];
|
||||||
|
|
||||||
//------------------------- Config handling
|
//------------------------- Config handling
|
||||||
private _configEntries = "(getNumber (_x >> 'scope')) == 2" configClasses (configFile >> QGVAR(stats));
|
private _finalArray = [];
|
||||||
|
private _class = "";
|
||||||
|
private _stats = [];
|
||||||
|
private _displayName = "";
|
||||||
|
private _showBar = false;
|
||||||
|
private _showText = false;
|
||||||
|
private _condition = "";
|
||||||
|
private _priority = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
private _finalArray = [];
|
_class = configName _x;
|
||||||
|
_stats = getArray (_x >> "stats");
|
||||||
private _class = configName _x;
|
_displayName = getText (_x >> "displayName");
|
||||||
private _stats = getArray (_x >> "stats");
|
_showBar = getNumber (_x >> "showBar") == 1;
|
||||||
private _displayName = getText (_x >> "displayName");
|
_showText = getNumber (_x >> "showText") == 1;
|
||||||
private _showBar = getNumber (_x >> "showBar") == 1;
|
_condition = getText (_x >> "condition");
|
||||||
private _showText = getNumber (_x >> "showText") == 1;
|
_priority = getNumber (_x >> "priority");
|
||||||
private _condition = getText (_x >> "condition");
|
|
||||||
private _priority = getNumber (_x >> "priority");
|
|
||||||
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
|
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
|
||||||
|
|
||||||
if (_condition != "") then {
|
if (_condition != "") then {
|
||||||
@ -106,30 +122,32 @@ private _configEntries = "(getNumber (_x >> 'scope')) == 2" configClasses (confi
|
|||||||
_finalArray = ["", _stats, _displayName, [_showBar, _showText], [{}, {}, _condition], _priority];
|
_finalArray = ["", _stats, _displayName, [_showBar, _showText], [{}, {}, _condition], _priority];
|
||||||
|
|
||||||
if (_showBar) then {
|
if (_showBar) then {
|
||||||
private _barStatement = compile (getText (_x >> "barStatement"));
|
(_finalArray select 4) set [0, compile (getText (_x >> "barStatement"))];
|
||||||
(_finalArray select 4) set [0, _barStatement];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_showText) then {
|
if (_showText) then {
|
||||||
private _textStatement = compile (getText (_x >> "textStatement"));
|
(_finalArray select 4) set [1, compile (getText (_x >> "textStatement"))];
|
||||||
(_finalArray select 4) set [1, _textStatement];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACE_3("stats array", _finalArray, _leftTabsList, _rightTabsList);
|
TRACE_3("stats array", _finalArray, _leftTabsList, _rightTabsList);
|
||||||
|
|
||||||
if (count _leftTabsList > 0) then {
|
if (_leftTabsList isNotEqualTo []) then {
|
||||||
[_statsListLeftPanel, _leftTabsList, "L"] call _fnc_addToTabs;
|
[_statsListLeftPanel, _leftTabsList, "L"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (count _rightTabsList > 0) then {
|
if (_rightTabsList isNotEqualTo []) then {
|
||||||
[_statsListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
|
[_statsListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
|
||||||
};
|
};
|
||||||
} foreach _configEntries;
|
} forEach ("(getNumber (_x >> 'scope')) == 2" configClasses (configFile >> "ace_arsenal_stats"));
|
||||||
|
|
||||||
|
// Sort
|
||||||
[_statsListLeftPanel] call _fnc_sortLists;
|
[_statsListLeftPanel] call _fnc_sortLists;
|
||||||
[_statsListRightPanel] call _fnc_sortLists;
|
[_statsListRightPanel] call _fnc_sortLists;
|
||||||
|
|
||||||
//------------------------- Config Handling
|
// Group into 5 stats
|
||||||
|
[_statsListLeftPanel] call _fnc_toStatsArray;
|
||||||
|
[_statsListRightPanel] call _fnc_toStatsArray;
|
||||||
|
|
||||||
missionNamespace setVariable [QGVAR(statsListLeftPanel), _statsListLeftPanel];
|
//------------------------- Config Handling
|
||||||
missionNamespace setVariable [QGVAR(statsListRightPanel), _statsListRightPanel];
|
GVAR(statsListLeftPanel) = _statsListLeftPanel;
|
||||||
|
GVAR(statsListRightPanel) = _statsListRightPanel;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Fill left panel.
|
* Fills left panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
@ -16,19 +16,21 @@
|
|||||||
|
|
||||||
params ["_display", "_control"];
|
params ["_display", "_control"];
|
||||||
|
|
||||||
private _ctrlIDC = ctrlIDC _control;
|
// Fade old control background
|
||||||
|
|
||||||
if (!isNil QGVAR(currentLeftPanel)) then {
|
if (!isNil QGVAR(currentLeftPanel)) then {
|
||||||
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLeftPanel) - 1);
|
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLeftPanel) - 1);
|
||||||
_previousCtrlBackground ctrlSetFade 1;
|
_previousCtrlBackground ctrlSetFade 1;
|
||||||
_previousCtrlBackground ctrlCommit FADE_DELAY;
|
_previousCtrlBackground ctrlCommit FADE_DELAY;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Show new control background
|
||||||
|
private _ctrlIDC = ctrlIDC _control;
|
||||||
private _ctrlBackground = _display displayCtrl (_ctrlIDC - 1);
|
private _ctrlBackground = _display displayCtrl (_ctrlIDC - 1);
|
||||||
private _ctrlPanel = _display displayCtrl IDC_leftTabContent;
|
|
||||||
_ctrlBackground ctrlSetFade 0;
|
_ctrlBackground ctrlSetFade 0;
|
||||||
_ctrlBackground ctrlCommit FADE_DELAY;
|
_ctrlBackground ctrlCommit FADE_DELAY;
|
||||||
|
|
||||||
|
private _ctrlPanel = _display displayCtrl IDC_leftTabContent;
|
||||||
|
|
||||||
// Force a "refresh" animation of the panel
|
// Force a "refresh" animation of the panel
|
||||||
_ctrlPanel ctrlSetFade 1;
|
_ctrlPanel ctrlSetFade 1;
|
||||||
_ctrlPanel ctrlCommit 0;
|
_ctrlPanel ctrlCommit 0;
|
||||||
@ -38,168 +40,226 @@ _ctrlPanel ctrlCommit FADE_DELAY;
|
|||||||
_ctrlPanel lbSetCurSel -1;
|
_ctrlPanel lbSetCurSel -1;
|
||||||
|
|
||||||
// Handle icons and filling
|
// Handle icons and filling
|
||||||
switch true do {
|
private _selectedItem = switch (true) do {
|
||||||
case (_ctrlIDC in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon]) : {
|
// Primary weapons, secondary weapons, handgun weapons
|
||||||
|
case (_ctrlIDC in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon]): {
|
||||||
// Purge old data
|
// Purge old data
|
||||||
lbClear _ctrlPanel;
|
lbClear _ctrlPanel;
|
||||||
private _addEmpty = _ctrlPanel lbadd format [" <%1>",localize "str_empty"];
|
|
||||||
_ctrlPanel lbsetvalue [_addEmpty, -1];
|
// Add "Empty" entry
|
||||||
|
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
|
||||||
|
_ctrlPanel lbSetValue [_addEmpty, -1];
|
||||||
|
|
||||||
|
// Add selected tab's weapons
|
||||||
|
private _index = [IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC_buttonHandgun] find _ctrlIDC;
|
||||||
|
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach ((GVAR(virtualItems) select IDX_VIRT_WEAPONS) select ([IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC_buttonHandgun] find _ctrlIDC));
|
} forEach (keys ((GVAR(virtualItems) get IDX_VIRT_WEAPONS) get _index));
|
||||||
|
|
||||||
|
GVAR(currentItems) select _index
|
||||||
};
|
};
|
||||||
|
// Uniforms, vests, backpacks
|
||||||
case (_ctrlIDC in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]) : {
|
case (_ctrlIDC in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]): {
|
||||||
|
// Purge old data
|
||||||
lbClear _ctrlPanel;
|
lbClear _ctrlPanel;
|
||||||
private _addEmpty = _ctrlPanel lbadd format [" <%1>",localize "str_empty"];
|
|
||||||
_ctrlPanel lbsetvalue [_addEmpty, -1];
|
|
||||||
|
|
||||||
// Filling
|
// Add "Empty" entry
|
||||||
|
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
|
||||||
|
_ctrlPanel lbSetValue [_addEmpty, -1];
|
||||||
|
|
||||||
switch (_ctrlIDC) do {
|
switch (_ctrlIDC) do {
|
||||||
case IDC_buttonUniform : {
|
// Add uniforms
|
||||||
|
case IDC_buttonUniform: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select IDX_VIRT_UNIFORM);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIFORM));
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonVest : {
|
GVAR(currentItems) select IDX_CURR_UNIFORM
|
||||||
|
};
|
||||||
|
// Add vests
|
||||||
|
case IDC_buttonVest: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select IDX_VIRT_VEST);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_VEST));
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonBackpack : {
|
GVAR(currentItems) select IDX_CURR_VEST
|
||||||
|
};
|
||||||
|
// Add backpacks
|
||||||
|
case IDC_buttonBackpack: {
|
||||||
{
|
{
|
||||||
["CfgVehicles", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgVehicles", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select IDX_VIRT_BACKPACK);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_BACKPACK));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_BACKPACK
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
// Other
|
||||||
default {
|
default {
|
||||||
GVAR(currentRightPanel) = nil;
|
// Don't reset right panel selection if left tab is binos
|
||||||
|
if (_ctrlIDC != IDC_buttonBinoculars) then {
|
||||||
|
GVAR(currentRightPanel) = nil;
|
||||||
|
};
|
||||||
|
|
||||||
lbClear _ctrlPanel;
|
lbClear _ctrlPanel;
|
||||||
|
|
||||||
|
// For every left tab except faces and voices, add "Empty" entry
|
||||||
if !(_ctrlIDC in [IDC_buttonFace, IDC_buttonVoice]) then {
|
if !(_ctrlIDC in [IDC_buttonFace, IDC_buttonVoice]) then {
|
||||||
private _addEmpty = _ctrlPanel lbadd format [" <%1>",localize "str_empty"];
|
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
|
||||||
_ctrlPanel lbsetvalue [_addEmpty, -1];
|
_ctrlPanel lbSetValue [_addEmpty, -1];
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (_ctrlIDC) do {
|
switch (_ctrlIDC) do {
|
||||||
|
// Headgear
|
||||||
case IDC_buttonHeadgear: {
|
case IDC_buttonHeadgear: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select IDX_VIRT_HEADGEAR);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_HEADGEAR));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_HEADGEAR
|
||||||
};
|
};
|
||||||
case IDC_buttonGoggles : {
|
// Facewear
|
||||||
|
case IDC_buttonGoggles: {
|
||||||
{
|
{
|
||||||
["CfgGlasses", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgGlasses", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select IDX_VIRT_GOGGLES);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_GOGGLES));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_GOGGLES
|
||||||
};
|
};
|
||||||
case IDC_buttonNVG : {
|
// NVGs
|
||||||
|
case IDC_buttonNVG: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 8);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_NVG));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_NVG
|
||||||
};
|
};
|
||||||
case IDC_buttonBinoculars : {
|
// Binoculars
|
||||||
|
case IDC_buttonBinoculars: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 9);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_BINO));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_BINO
|
||||||
};
|
};
|
||||||
case IDC_buttonMap : {
|
// Maps
|
||||||
|
case IDC_buttonMap: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 10);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_MAP));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_MAP
|
||||||
};
|
};
|
||||||
case IDC_buttonCompass : {
|
// Compasses
|
||||||
|
case IDC_buttonCompass: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 11);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_COMPASS));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_COMPASS
|
||||||
};
|
};
|
||||||
case IDC_buttonRadio : {
|
// Radios
|
||||||
|
case IDC_buttonRadio: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 12);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_RADIO));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_RADIO
|
||||||
};
|
};
|
||||||
case IDC_buttonWatch : {
|
// Watches
|
||||||
|
case IDC_buttonWatch: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 13);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_WATCH));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_WATCH
|
||||||
};
|
};
|
||||||
case IDC_buttonGPS : {
|
// GPS and UAV Terminals
|
||||||
|
case IDC_buttonGPS: {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} foreach (GVAR(virtualItems) select 14);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_COMMS));
|
||||||
|
|
||||||
|
GVAR(currentItems) select IDX_CURR_COMMS
|
||||||
};
|
};
|
||||||
case IDC_buttonFace : {
|
// Faces
|
||||||
{
|
case IDC_buttonFace: {
|
||||||
{
|
private _lbAdd = -1;
|
||||||
if (
|
|
||||||
getnumber (_x >> "disabled") == 0 &&
|
|
||||||
{getText (_x >> "head") != ""} &&
|
|
||||||
{configName _x != "Default"}
|
|
||||||
) then {
|
|
||||||
private _configName = configName _x;
|
|
||||||
private _displayName = getText (_x >> "displayName");
|
|
||||||
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
|
||||||
_ctrlPanel lbSetData [_lbAdd, _configName];
|
|
||||||
_ctrlPanel lbSetTooltip [_lbAdd,format ["%1\n%2",_displayName, _configName]];
|
|
||||||
_x call ADDMODICON;
|
|
||||||
};
|
|
||||||
} foreach ("true" configClasses _x);
|
|
||||||
} foreach ("true" configClasses (configfile >> "cfgfaces"));
|
|
||||||
};
|
|
||||||
case IDC_buttonVoice : {
|
|
||||||
private _voices = (configProperties [(configFile >> "CfgVoice"), "isClass _x && {getNumber (_x >> 'scope') == 2}", true]) - [(configfile >> "CfgVoice" >> "NoVoice")];
|
|
||||||
{
|
|
||||||
["CfgVoice", configName _x, _ctrlPanel, "icon"] call FUNC(addListBoxItem);
|
|
||||||
} foreach _voices;
|
|
||||||
};
|
|
||||||
case IDC_buttonInsignia : {
|
|
||||||
{
|
|
||||||
["CfgUnitInsignia", configName _x, _ctrlPanel, "texture"] call FUNC(addListBoxItem);
|
|
||||||
} foreach ("true" configClasses (configFile >> "CfgUnitInsignia"));
|
|
||||||
|
|
||||||
{
|
{
|
||||||
private _displayName = getText (_x >> "displayName");
|
_y params ["_displayName", "_modPicture"];
|
||||||
private _className = configName _x;
|
|
||||||
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
_lbAdd = _ctrlPanel lbAdd _displayName;
|
||||||
|
_ctrlPanel lbSetData [_lbAdd, _x];
|
||||||
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]];
|
||||||
|
_ctrlPanel lbSetPictureRight [_lbAdd, _modPicture];
|
||||||
|
} forEach (uiNamespace getVariable QGVAR(faceCache));
|
||||||
|
|
||||||
|
GVAR(currentFace)
|
||||||
|
};
|
||||||
|
// Voices
|
||||||
|
case IDC_buttonVoice: {
|
||||||
|
{
|
||||||
|
["CfgVoice", _x, _ctrlPanel, "icon"] call FUNC(addListBoxItem);
|
||||||
|
} forEach (uiNamespace getVariable QGVAR(voiceCache));
|
||||||
|
|
||||||
|
GVAR(currentVoice)
|
||||||
|
};
|
||||||
|
// Insignia
|
||||||
|
case IDC_buttonInsignia: {
|
||||||
|
// Insignia from config
|
||||||
|
{
|
||||||
|
["CfgUnitInsignia", _x, _ctrlPanel, "texture"] call FUNC(addListBoxItem);
|
||||||
|
} forEach (uiNamespace getVariable QGVAR(insigniaCache));
|
||||||
|
|
||||||
|
private _displayName = "";
|
||||||
|
private _className = "";
|
||||||
|
private _lbAdd = -1;
|
||||||
|
|
||||||
|
// Insignia from mission file
|
||||||
|
{
|
||||||
|
_className = configName _x;
|
||||||
|
_displayName = getText (_x >> "displayName");
|
||||||
|
_lbAdd = _ctrlPanel lbAdd _displayName;
|
||||||
|
|
||||||
_ctrlPanel lbSetData [_lbAdd, _className];
|
_ctrlPanel lbSetData [_lbAdd, _className];
|
||||||
_ctrlPanel lbSetPicture [_lbAdd, getText (_x >> "texture")];
|
_ctrlPanel lbSetPicture [_lbAdd, getText (_x >> "texture")];
|
||||||
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
||||||
} foreach ("true" configClasses (missionConfigFile >> "CfgUnitInsignia"));
|
} forEach ("(if (isNumber (_x >> 'scope')) then {getNumber (_x >> 'scope')} else {2}) == 2" configClasses (missionConfigFile >> "CfgUnitInsignia"));
|
||||||
|
|
||||||
|
GVAR(currentInsignia)
|
||||||
};
|
};
|
||||||
|
// Unknown
|
||||||
|
default {""};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Done
|
// When switching tabs, clear searchbox
|
||||||
if (GVAR(currentLeftPanel) != _ctrlIDC) then {
|
if (GVAR(currentLeftPanel) != _ctrlIDC) then {
|
||||||
(_display displayCtrl IDC_leftSearchbar) ctrlSetText "";
|
(_display displayCtrl IDC_leftSearchbar) ctrlSetText "";
|
||||||
(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
|
(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Trigger event
|
||||||
GVAR(currentLeftPanel) = _ctrlIDC;
|
GVAR(currentLeftPanel) = _ctrlIDC;
|
||||||
[QGVAR(leftPanelFilled), [_display, _ctrlIDC, GVAR(currentRightPanel)]] call CBA_fnc_localEvent;
|
[QGVAR(leftPanelFilled), [_display, _ctrlIDC, GVAR(currentRightPanel)]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
private _sortLeftCtrl = _display displayCtrl IDC_sortLeftTab;
|
[_display, _control, _display displayCtrl IDC_sortLeftTab, _display displayCtrl IDC_sortLeftTabDirection] call FUNC(fillSort);
|
||||||
[_display, _control, _sortLeftCtrl] call FUNC(fillSort);
|
|
||||||
|
|
||||||
//Select current item
|
// Try to select previously selected item again, otherwise select first item ("Empty")
|
||||||
private _itemsToCheck = ((GVAR(currentItems) select [0,15]) + [GVAR(currentFace), GVAR(currentVoice), GVAR(currentInsignia)]) apply {tolower _x};
|
if (_selectedItem != "") then {
|
||||||
|
private _index = 0;
|
||||||
|
|
||||||
for "_lbIndex" from 0 to (lbSize _ctrlPanel - 1) do {
|
for "_lbIndex" from 0 to (lbSize _ctrlPanel) - 1 do {
|
||||||
private _currentData = _ctrlPanel lbData _lbIndex;
|
if ((_ctrlPanel lbData _lbIndex) == _selectedItem) exitWith {
|
||||||
|
_index = _lbIndex;
|
||||||
if ((_currentData isNotEqualTo "") && {tolower _currentData in _itemsToCheck}) exitWith {
|
};
|
||||||
_ctrlPanel lbSetCurSel _lbIndex;
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
if (lbCurSel _ctrlPanel < 0) then {
|
_ctrlPanel lbSetCurSel _index;
|
||||||
|
} else {
|
||||||
_ctrlPanel lbSetCurSel 0;
|
_ctrlPanel lbSetCurSel 0;
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Fill loadouts list.
|
* Fill loadouts list.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -16,11 +16,9 @@
|
|||||||
|
|
||||||
params ["_display", "_control"];
|
params ["_display", "_control"];
|
||||||
|
|
||||||
|
(_display displayCtrl IDC_textEditBox) ctrlSetText "";
|
||||||
|
|
||||||
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||||
private _textEditBoxCtrl= _display displayCtrl IDC_textEditBox;
|
|
||||||
_textEditBoxCtrl ctrlSetText "";
|
|
||||||
private _sharingEnabled = (GVAR(allowSharedLoadouts) && {isMultiplayer});
|
|
||||||
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
|
||||||
|
|
||||||
// Force a "refresh" animation of the panel
|
// Force a "refresh" animation of the panel
|
||||||
_contentPanelCtrl ctrlSetFade 1;
|
_contentPanelCtrl ctrlSetFade 1;
|
||||||
@ -31,98 +29,107 @@ _contentPanelCtrl ctrlCommit FADE_DELAY;
|
|||||||
_contentPanelCtrl lnbSetCurSelRow -1;
|
_contentPanelCtrl lnbSetCurSelRow -1;
|
||||||
lnbClear _contentPanelCtrl;
|
lnbClear _contentPanelCtrl;
|
||||||
|
|
||||||
private _data = +(profileNamespace getvariable [QGVAR(saved_loadouts),[]]);
|
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _newRow = -1;
|
||||||
|
|
||||||
if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||||
|
private _loadoutNameAndTab = "";
|
||||||
|
private _loadoutCachedInfo = "";
|
||||||
|
private _sharingEnabled = GVAR(allowSharedLoadouts) && {isMultiplayer};
|
||||||
|
|
||||||
|
// Add all loadouts to loadout list
|
||||||
{
|
{
|
||||||
_x params ["_loadoutName", "_loadoutData"];
|
_x params ["_loadoutName", "_loadoutData"];
|
||||||
|
|
||||||
private _loadoutCachedInfo = _contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab));
|
_loadoutNameAndTab = _loadoutName + str GVAR(currentLoadoutsTab);
|
||||||
|
_loadoutCachedInfo = _contentPanelCtrl getVariable _loadoutNameAndTab;
|
||||||
|
|
||||||
|
// If not in cache, get info and cache it
|
||||||
if (isNil "_loadoutCachedInfo") then {
|
if (isNil "_loadoutCachedInfo") then {
|
||||||
[_loadoutData] call FUNC(verifyLoadout)
|
_loadoutCachedInfo = [_loadoutData] call FUNC(verifyLoadout);
|
||||||
} else {
|
_contentPanelCtrl setVariable [_loadoutNameAndTab, _loadoutCachedInfo];
|
||||||
_loadoutCachedInfo
|
|
||||||
} params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount", "_nullItemsList", "_unavailableItemsList"];
|
|
||||||
|
|
||||||
// Log missing / nil items to RPT
|
_loadoutCachedInfo params ["", "_nullItemsAmount", "_unavailableItemsAmount", "_nullItemsList", "_unavailableItemsList"];
|
||||||
if (GVAR(EnableRPTLog) && {isNil "_loadoutCachedInfo"} && {(_nullItemsAmount > 0) || {_unavailableItemsAmount > 0}}) then {
|
|
||||||
|
|
||||||
private _printComponent = "ACE_Arsenal - Loadout:";
|
// Log missing / nil items to RPT (only once per arsenal session)
|
||||||
private _printNullItemsList = ["Missing items:", str _nullItemsList] joinString " ";
|
if (GVAR(EnableRPTLog) && {(_nullItemsAmount > 0) || {_unavailableItemsAmount > 0}}) then {
|
||||||
private _printUnavailableItemsList = ["Unavailable items:", str _unavailableItemsList] joinString " ";
|
private _printComponent = "ACE_Arsenal - Loadout:";
|
||||||
|
private _printNullItemsList = ["Missing items:", str _nullItemsList] joinString " ";
|
||||||
|
private _printUnavailableItemsList = ["Unavailable items:", str _unavailableItemsList] joinString " ";
|
||||||
|
|
||||||
diag_log text (format ["%1%5 %2%5 %3%5 %4", _printComponent, "Name: " + _loadoutName, _printNullItemsList, _printUnavailableItemsList, endl]);
|
diag_log text (format ["%1%5 %2%5 %3%5 %4", _printComponent, "Name: " + _loadoutName, _printNullItemsList, _printUnavailableItemsList, endl]);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set position of loadouts different if in default loadout tab or if sharing is disabled
|
||||||
if (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts || {!_sharingEnabled}) then {
|
if (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts || {!_sharingEnabled}) then {
|
||||||
_contentPanelCtrl lnbSetColumnsPos [0, 0, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
|
_contentPanelCtrl lnbSetColumnsPos [0, 0, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
|
||||||
} else {
|
} else {
|
||||||
_contentPanelCtrl lnbSetColumnsPos [0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
|
_contentPanelCtrl lnbSetColumnsPos [0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
|
||||||
};
|
};
|
||||||
|
|
||||||
private _newRow = _contentPanelCtrl lnbAddRow ["",_loadoutName];
|
_loadoutCachedInfo params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
|
||||||
|
|
||||||
_extendedLoadout params ["_loadout"];
|
_extendedLoadout params ["_loadout"];
|
||||||
|
|
||||||
|
_newRow = _contentPanelCtrl lnbAddRow ["", _loadoutName];
|
||||||
|
|
||||||
ADD_LOADOUTS_LIST_PICTURES
|
ADD_LOADOUTS_LIST_PICTURES
|
||||||
|
|
||||||
|
// Change color on loadout lines that have items that aren't available or don't exist
|
||||||
if (_nullItemsAmount > 0) then {
|
if (_nullItemsAmount > 0) then {
|
||||||
|
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]]; // Red
|
||||||
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]];
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (_unavailableItemsAmount > 0) then {
|
if (_unavailableItemsAmount > 0) then {
|
||||||
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
|
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]]; // Gray
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), [_extendedLoadout, _nullItemsAmount, _unavailableItemsAmount, _nullItemsList, _unavailableItemsList]];
|
// If it's a shared loadout and player is in the private loadouts tab, add icon
|
||||||
|
if (((profileName + _loadoutName) in _sharedLoadoutsVars) && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts}) then {
|
||||||
if ((profileName + _loadoutName) in _sharedLoadoutsVars && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts}) then {
|
|
||||||
_contentPanelCtrl lnbSetPicture [[_newRow, 0], QPATHTOF(data\iconPublic.paa)];
|
_contentPanelCtrl lnbSetPicture [[_newRow, 0], QPATHTOF(data\iconPublic.paa)];
|
||||||
_contentPanelCtrl lnbSetValue [[_newRow, 0], 1];
|
_contentPanelCtrl lnbSetValue [[_newRow, 0], 1];
|
||||||
};
|
};
|
||||||
} foreach ([_data, +GVAR(defaultLoadoutsList)] select (ctrlIDC _control == IDC_buttonDefaultLoadouts));
|
} forEach ([profileNamespace getVariable [QGVAR(saved_loadouts), []], GVAR(defaultLoadoutsList)] select (ctrlIDC _control == IDC_buttonDefaultLoadouts));
|
||||||
} else {
|
} else {
|
||||||
|
private _allPlayerNames = allPlayers apply {name _x};
|
||||||
|
private _loadoutVar = "";
|
||||||
|
|
||||||
{
|
{
|
||||||
_x params ["_playerName", "_loadoutName", "_loadoutData"];
|
_x params ["_playerName", "_loadoutName", "_loadoutData"];
|
||||||
|
|
||||||
if ((allPlayers apply {name _x}) find _playerName == -1) then {
|
_loadoutVar = _playerName + _loadoutName;
|
||||||
|
|
||||||
private _loadoutVar = _playerName + _loadoutName;
|
|
||||||
|
|
||||||
|
// If player who shared loadout doesn't exist anymore, unshare loadout
|
||||||
|
if !(_playerName in _allPlayerNames) then {
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||||
_sharedLoadoutsVars = _sharedLoadoutsVars - [_loadoutVar];
|
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsNamespace), _sharedLoadoutsVars - [_loadoutVar], true];
|
||||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsNamespace), _sharedLoadoutsVars, true];
|
|
||||||
|
|
||||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
|
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
|
||||||
|
_extendedLoadout params ["_loadout"];
|
||||||
|
|
||||||
_contentPanelCtrl lnbSetColumnsPos [0, 0.15, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
|
_contentPanelCtrl lnbSetColumnsPos [0, 0.15, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
|
||||||
private _newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
|
_newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
|
||||||
|
|
||||||
_extendedLoadout params ["_loadout"];
|
|
||||||
ADD_LOADOUTS_LIST_PICTURES
|
ADD_LOADOUTS_LIST_PICTURES
|
||||||
|
|
||||||
_contentPanelCtrl lnbSetData [[_newRow, 1], _playerName + _loadoutName];
|
_contentPanelCtrl lnbSetData [[_newRow, 1], _loadoutVar];
|
||||||
|
|
||||||
|
// Change color on loadout lines that have items that aren't available or don't exist
|
||||||
if (_nullItemsAmount > 0) then {
|
if (_nullItemsAmount > 0) then {
|
||||||
|
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]]; // Red
|
||||||
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]];
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (_unavailableItemsAmount > 0) then {
|
if (_unavailableItemsAmount > 0) then {
|
||||||
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
|
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]]; // Gray
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach (_sharedLoadoutsVars apply {GVAR(sharedLoadoutsNamespace) getVariable _x});
|
} forEach (_sharedLoadoutsVars apply {GVAR(sharedLoadoutsNamespace) getVariable _x});
|
||||||
};
|
};
|
||||||
|
|
||||||
[QGVAR(loadoutsListFilled), [_display, _control]] call CBA_fnc_localEvent;
|
[QGVAR(loadoutsListFilled), [_display, _control]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
|
// Sort loadouts alphabetically
|
||||||
_contentPanelCtrl lnbSort [1, false];
|
_contentPanelCtrl lnbSort [1, false];
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Fill right panel.
|
* Fills right panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
params ["_display", "_control"];
|
params ["_display", "_control"];
|
||||||
|
|
||||||
private _ctrlIDC = ctrlIDC _control;
|
|
||||||
|
|
||||||
// Fade old control background
|
// Fade old control background
|
||||||
if (!isNil QGVAR(currentRightPanel)) then {
|
if (!isNil QGVAR(currentRightPanel)) then {
|
||||||
private _previousCtrlBackground = _display displayCtrl (GVAR(currentRightPanel) - 1);
|
private _previousCtrlBackground = _display displayCtrl (GVAR(currentRightPanel) - 1);
|
||||||
@ -26,6 +24,7 @@ if (!isNil QGVAR(currentRightPanel)) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Show new control background
|
// Show new control background
|
||||||
|
private _ctrlIDC = ctrlIDC _control;
|
||||||
private _ctrlBackground = _display displayCtrl (_ctrlIDC - 1);
|
private _ctrlBackground = _display displayCtrl (_ctrlIDC - 1);
|
||||||
_ctrlBackground ctrlShow true;
|
_ctrlBackground ctrlShow true;
|
||||||
_ctrlBackground ctrlSetFade 0;
|
_ctrlBackground ctrlSetFade 0;
|
||||||
@ -33,110 +32,144 @@ _ctrlBackground ctrlCommit FADE_DELAY;
|
|||||||
|
|
||||||
private _searchbarCtrl = _display displayCtrl IDC_rightSearchbar;
|
private _searchbarCtrl = _display displayCtrl IDC_rightSearchbar;
|
||||||
|
|
||||||
|
// Show right search bar
|
||||||
if (!(ctrlShown _searchbarCtrl) || {ctrlFade _searchbarCtrl > 0}) then {
|
if (!(ctrlShown _searchbarCtrl) || {ctrlFade _searchbarCtrl > 0}) then {
|
||||||
_searchbarCtrl ctrlShow true;
|
_searchbarCtrl ctrlShow true;
|
||||||
_searchbarCtrl ctrlSetFade 0;
|
_searchbarCtrl ctrlSetFade 0;
|
||||||
_searchbarCtrl ctrlCommit 0;
|
_searchbarCtrl ctrlCommit 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _fnc_fill_right_Container = {
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
params ["_configCategory", "_className", "_isMagazine", ["_isUnique", false, [false]]];
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _rightPanelCache = uiNamespace getVariable QGVAR(rightPanelCache);
|
||||||
|
|
||||||
private _cacheNamespace = _ctrlPanel;
|
private _fnc_fillRightContainer = {
|
||||||
private _cachedItemInfo = _cacheNamespace getVariable [_configCategory+_className, []];
|
params ["_configCategory", "_className", "_hasItemInfo", ["_isUnique", false, [false]], ["_unknownOrigin", false, [false]]];
|
||||||
|
|
||||||
if (!(_className in GVAR(virtualItemsFlat))) then {
|
// If item is not in the arsenal, it must be unique
|
||||||
|
if (!_isUnique && {!(_className in GVAR(virtualItemsFlat))}) then {
|
||||||
_isUnique = true;
|
_isUnique = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Not in cache. So get info and put into cache
|
// If not in cache, find info and cache it for later use
|
||||||
if (_cachedItemInfo isEqualTo []) then {
|
(_rightPanelCache getOrDefaultCall [_configCategory + _className, {
|
||||||
|
// Get display name, picture and mass
|
||||||
private _configPath = configFile >> _configCategory >> _className;
|
private _configPath = configFile >> _configCategory >> _className;
|
||||||
|
|
||||||
_cachedItemInfo set [0, getText (_configPath >> "displayName")];
|
// "Misc. items" magazines (e.g. spare barrels, intel, photos)
|
||||||
_cachedItemInfo set [1, getText (_configPath >> "picture")];
|
if (_className in (uiNamespace getVariable QGVAR(magazineMiscItems))) then {
|
||||||
_cachedItemInfo set [2, [getNumber (_configPath >> "itemInfo" >> "mass"), getNumber (_configPath >> "mass")] select _isMagazine];
|
_configPath = _cfgMagazines >> _className;
|
||||||
|
_hasItemInfo = false;
|
||||||
|
};
|
||||||
|
|
||||||
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
|
// If an item with unknown origin is in the arsenal list, try to find it
|
||||||
};
|
if (_unknownOrigin && {isNull _configPath}) then {
|
||||||
|
_configPath = _className call CBA_fnc_getItemConfig;
|
||||||
|
|
||||||
_cachedItemInfo params ["_displayName","_picture", "_mass"];
|
// Check if item is object (this should never happen)
|
||||||
|
if (isNull _configPath) then {
|
||||||
|
_configPath = _className call CBA_fnc_getObjectConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check if item is has item info
|
||||||
|
_itemInfo = isClass (_cfgWeapons >> configName _configPath);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get mass
|
||||||
|
private _mass = if (!_hasItemInfo) then {
|
||||||
|
getNumber (_configPath >> "mass")
|
||||||
|
} else {
|
||||||
|
private _mass = getNumber (_configPath >> "itemInfo" >> "mass");
|
||||||
|
|
||||||
|
if (_mass == 0) then {
|
||||||
|
_mass = getNumber (_configPath >> "WeaponSlotsInfo" >> "mass");
|
||||||
|
};
|
||||||
|
|
||||||
|
_mass
|
||||||
|
};
|
||||||
|
|
||||||
|
_rightPanelCache set [_className, _mass]; // Needed because this provides more accurate weight for FUNC(updateRightPanel)
|
||||||
|
|
||||||
|
[getText (_configPath >> "displayName"), getText (_configPath >> "picture"), _mass]
|
||||||
|
}, true]) params ["_displayName", "_picture", "_mass"];
|
||||||
|
|
||||||
private _lbAdd = _ctrlPanel lnbAddRow ["", _displayName, "0"];
|
private _lbAdd = _ctrlPanel lnbAddRow ["", _displayName, "0"];
|
||||||
private _columns = count lnbGetColumnsPosition _ctrlPanel;
|
|
||||||
|
|
||||||
_ctrlPanel lnbSetData [[_lbAdd, 0], _className];
|
_ctrlPanel lnbSetData [[_lbAdd, 0], _className];
|
||||||
_ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture];
|
_ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture];
|
||||||
_ctrlPanel lnbSetValue [[_lbAdd, 0], _mass];
|
_ctrlPanel lnbSetValue [[_lbAdd, 0], _mass];
|
||||||
_ctrlPanel setVariable [_className, _mass];
|
_ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select _isUnique];
|
||||||
_ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select (_isUnique)];
|
_ctrlPanel lnbSetTooltip [[_lbAdd, 0], format ["%1\n%2", _displayName, _className]];
|
||||||
_ctrlPanel lbSetTooltip [_lbAdd * _columns, format ["%1\n%2", _displayName, _className]];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retrieve compatible mags
|
|
||||||
private _compatibleItems = [];
|
|
||||||
private _compatibleMagazines = [[[], []], [[], []], [[], []]];
|
|
||||||
{
|
|
||||||
if (_x != "") then {
|
|
||||||
private _weaponConfig = (configFile >> "CfgWeapons" >> _x);
|
|
||||||
private _index = _forEachIndex;
|
|
||||||
|
|
||||||
{
|
|
||||||
private _subIndex = _forEachIndex min 1;
|
|
||||||
{
|
|
||||||
((_compatibleMagazines select _index) select _subIndex) pushBackUnique (configName (configFile >> "CfgMagazines" >> _x))
|
|
||||||
} foreach ([getArray (_weaponConfig >> _x >> "magazines"), getArray (_weaponConfig >> "magazines")] select (_x == "this"));
|
|
||||||
|
|
||||||
// Magazine groups
|
|
||||||
{
|
|
||||||
private _magazineGroups = uiNamespace getVariable [QGVAR(magazineGroups), createHashMap];
|
|
||||||
private _magArray = _magazineGroups get (toLower _x);
|
|
||||||
{((_compatibleMagazines select _index) select _subIndex) pushBackUnique _x} forEach _magArray;
|
|
||||||
} foreach ([getArray (_weaponConfig >> _x >> "magazineWell"), getArray (_weaponConfig >> "magazineWell")] select (_x == "this"));
|
|
||||||
|
|
||||||
|
|
||||||
} foreach getArray (_weaponConfig >> "muzzles");
|
|
||||||
};
|
|
||||||
} foreach [primaryWeapon GVAR(center), handgunWeapon GVAR(center), secondaryWeapon GVAR(center)];
|
|
||||||
|
|
||||||
private _itemsToCheck = [];
|
|
||||||
private _compatibleMagsPrimaryMuzzle = [];
|
|
||||||
private _compatibleMagsSecondaryMuzzle = [];
|
|
||||||
|
|
||||||
private _allCompatibleMags = [];
|
|
||||||
{
|
|
||||||
_allCompatibleMags append (_x select 0);
|
|
||||||
_allCompatibleMags append (_x select 1);
|
|
||||||
} foreach _compatibleMagazines;
|
|
||||||
|
|
||||||
private _ctrlPanel = _display displayCtrl IDC_rightTabContent;
|
private _ctrlPanel = _display displayCtrl IDC_rightTabContent;
|
||||||
|
private _listnBox = _display displayCtrl IDC_rightTabContentListnBox;
|
||||||
|
|
||||||
|
// Reset right panel content
|
||||||
|
lbClear _ctrlPanel;
|
||||||
|
lbClear _listnBox;
|
||||||
|
|
||||||
|
_ctrlPanel lbSetCurSel -1;
|
||||||
|
_listnBox lbSetCurSel -1;
|
||||||
|
|
||||||
|
// Retrieve compatible items
|
||||||
|
private _itemToCheck = "";
|
||||||
|
private _compatibleItems = [];
|
||||||
|
private _compatibleMagsMuzzle = [];
|
||||||
|
private _compatibleMagsAll = createHashMap;
|
||||||
|
|
||||||
switch (GVAR(currentLeftPanel)) do {
|
switch (GVAR(currentLeftPanel)) do {
|
||||||
case IDC_buttonPrimaryWeapon : {
|
// If weapons or binoculars are chosen, get their compatible magazines & items
|
||||||
_compatibleMagsPrimaryMuzzle = _compatibleMagazines select 0 select 0;
|
// Weapons and binoculars
|
||||||
_compatibleMagsSecondaryMuzzle = _compatibleMagazines select 0 select 1;
|
case IDC_buttonPrimaryWeapon;
|
||||||
_compatibleItems = (primaryWeapon GVAR(center)) call bis_fnc_compatibleItems;
|
case IDC_buttonHandgun;
|
||||||
_itemsToCheck = GVAR(currentItems) select 18;
|
case IDC_buttonSecondaryWeapon;
|
||||||
};
|
case IDC_buttonBinoculars: {
|
||||||
|
(switch (GVAR(currentLeftPanel)) do {
|
||||||
|
case IDC_buttonPrimaryWeapon: {
|
||||||
|
[IDX_CURR_PRIMARY_WEAPON, IDX_CURR_PRIMARY_WEAPON_ITEMS]
|
||||||
|
};
|
||||||
|
case IDC_buttonHandgun: {
|
||||||
|
[IDX_CURR_HANDGUN_WEAPON, IDX_CURR_HANDGUN_WEAPON_ITEMS]
|
||||||
|
};
|
||||||
|
case IDC_buttonSecondaryWeapon: {
|
||||||
|
[IDX_CURR_SECONDARY_WEAPON, IDX_CURR_SECONDARY_WEAPON_ITEMS]
|
||||||
|
};
|
||||||
|
case IDC_buttonBinoculars: {
|
||||||
|
[IDX_CURR_BINO, IDX_CURR_BINO_ITEMS]
|
||||||
|
};
|
||||||
|
}) params ["_currentWeaponIndex", "_currentWeaponItemsIndex"];
|
||||||
|
|
||||||
case IDC_buttonHandgun : {
|
private _index = [IDC_buttonMuzzle, IDC_buttonItemAcc, IDC_buttonOptic, IDC_buttonBipod, IDC_buttonCurrentMag, IDC_buttonCurrentMag2] find _ctrlIDC;
|
||||||
_compatibleMagsPrimaryMuzzle = _compatibleMagazines select 1 select 0;
|
private _weapon = GVAR(currentItems) select _currentWeaponIndex;
|
||||||
_compatibleMagsSecondaryMuzzle = _compatibleMagazines select 1 select 1;
|
|
||||||
_compatibleItems = (handgunWeapon GVAR(center)) call bis_fnc_compatibleItems;
|
|
||||||
_itemsToCheck = GVAR(currentItems) select 20;
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonSecondaryWeapon : {
|
// Check if weapon attachement or magazine
|
||||||
_compatibleMagsPrimaryMuzzle = _compatibleMagazines select 2 select 0;
|
if (_index != -1) then {
|
||||||
_compatibleMagsSecondaryMuzzle = _compatibleMagazines select 2 select 1;
|
_itemToCheck = (GVAR(currentItems) select _currentWeaponItemsIndex) select _index;
|
||||||
_compatibleItems = (secondaryWeapon GVAR(center)) call bis_fnc_compatibleItems;
|
|
||||||
_itemsToCheck = GVAR(currentItems) select 19;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// If weapon attachment, get base weapon; Get compatible items
|
||||||
|
if (_index <= 3) then {
|
||||||
|
_compatibleItems = compatibleItems _weapon;
|
||||||
|
_itemToCheck = _itemToCheck call FUNC(baseWeapon);
|
||||||
|
} else {
|
||||||
|
// Get compatible magazines for primary & secondary muzzle (secondary muzzle is not guaranteed to exist)
|
||||||
|
// Assumption: One weapon can have two muzzles maximum
|
||||||
|
_compatibleMagsMuzzle = compatibleMagazines [_weapon, (_weapon call CBA_fnc_getMuzzles) param [_index - 4, ""]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Uniform, vest or backpack
|
||||||
case IDC_buttonUniform;
|
case IDC_buttonUniform;
|
||||||
case IDC_buttonVest;
|
case IDC_buttonVest;
|
||||||
case IDC_buttonBackpack : {
|
case IDC_buttonBackpack: {
|
||||||
_ctrlPanel = _display displayCtrl IDC_rightTabContentListnBox;
|
_ctrlPanel = _listnBox;
|
||||||
|
|
||||||
|
// This is for the "compatible magazines" tab when a container is open
|
||||||
|
if (_ctrlIDC == IDC_buttonMag) then {
|
||||||
|
// Get all compatibles magazines with unit's weapons (including compatible magazines that aren't in configItems)
|
||||||
|
{
|
||||||
|
_compatibleMagsAll insert [true, compatibleMagazines _x, []];
|
||||||
|
} forEach [GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON, GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON, GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON, GVAR(currentItems) select IDX_CURR_BINO];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -146,238 +179,241 @@ _ctrlPanel ctrlCommit 0;
|
|||||||
_ctrlPanel ctrlSetFade 0;
|
_ctrlPanel ctrlSetFade 0;
|
||||||
_ctrlPanel ctrlCommit FADE_DELAY;
|
_ctrlPanel ctrlCommit FADE_DELAY;
|
||||||
|
|
||||||
_itemsToCheck = _itemsToCheck apply {toLower _x};
|
// Check if the left panel is a weapon. If so, right panel will be compatible items with weapon only
|
||||||
_compatibleItems = _compatibleItems apply {toLower _x};
|
private _leftPanelState = GVAR(currentLeftPanel) in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon, IDC_buttonBinoculars];
|
||||||
|
|
||||||
lbClear (_display displayCtrl IDC_rightTabContentListnBox);
|
// Add an empty entry if left panel is a weapon or bino
|
||||||
lbClear (_display displayCtrl IDC_rightTabContent);
|
if (_leftPanelState && {_ctrlIDC in [RIGHT_PANEL_ACC_IDCS, IDC_buttonCurrentMag, IDC_buttonCurrentMag2]}) then {
|
||||||
|
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
|
||||||
(_display displayCtrl IDC_rightTabContentListnBox) lbSetCurSel -1;
|
_ctrlPanel lbSetValue [_addEmpty, -1];
|
||||||
(_display displayCtrl IDC_rightTabContent) lbSetCurSel -1;
|
|
||||||
|
|
||||||
private _leftPanelState = GVAR(currentLeftPanel) in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon];
|
|
||||||
|
|
||||||
if (_ctrlIDC in [RIGHT_PANEL_ACC_IDCS, IDC_buttonCurrentMag, IDC_buttonCurrentMag2] && {_leftPanelState}) then {
|
|
||||||
private _addEmpty = _ctrlPanel lbadd format [" <%1>",localize "str_empty"];
|
|
||||||
_ctrlPanel lbsetvalue [_addEmpty, -1];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fill right panel according to category choice
|
||||||
switch (_ctrlIDC) do {
|
switch (_ctrlIDC) do {
|
||||||
|
// Optics, flashlights, muzzle attachments, bipods
|
||||||
|
case IDC_buttonOptic;
|
||||||
|
case IDC_buttonItemAcc;
|
||||||
|
case IDC_buttonMuzzle;
|
||||||
|
case IDC_buttonBipod: {
|
||||||
|
private _index = [IDX_VIRT_OPTICS_ATTACHMENTS, IDX_VIRT_FLASHLIGHT_ATTACHMENTS, IDX_VIRT_MUZZLE_ATTACHMENTS, IDX_VIRT_BIPOD_ATTACHMENTS] select ([RIGHT_PANEL_ACC_IDCS] find _ctrlIDC);
|
||||||
|
|
||||||
case IDC_buttonOptic : {
|
|
||||||
if (_leftPanelState) then {
|
if (_leftPanelState) then {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
if (_x in ((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get _index)) then {
|
||||||
} foreach (_compatibleItems arrayIntersect (((GVAR(virtualItems) select 1) select 0) apply {toLower _x}));
|
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
|
};
|
||||||
|
} forEach _compatibleItems;
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
|
["CfgWeapons", _x, true] call _fnc_fillRightContainer;
|
||||||
} foreach ((GVAR(virtualItems) select 1) select 0);
|
} forEach (keys ((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get _index));
|
||||||
|
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
|
["CfgWeapons", _x, true, true] call _fnc_fillRightContainer;
|
||||||
} foreach ((GVAR(virtualItems) select 22) select 0);
|
} forEach (keys ((GVAR(virtualItems) get IDX_VIRT_UNIQUE_ATTACHMENTS) get _index));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
// Current primary & secondary muzzle compatible magazines
|
||||||
case IDC_buttonItemAcc : {
|
case IDC_buttonCurrentMag;
|
||||||
|
case IDC_buttonCurrentMag2: {
|
||||||
if (_leftPanelState) then {
|
if (_leftPanelState) then {
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
if (_x in (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL)) then {
|
||||||
} foreach (_compatibleItems arrayIntersect (((GVAR(virtualItems) select 1) select 1) apply {toLower _x}));
|
["CfgMagazines", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
||||||
} else {
|
};
|
||||||
{
|
} forEach _compatibleMagsMuzzle;
|
||||||
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 1) select 1);
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 22) select 1);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
// All compatible magazines
|
||||||
case IDC_buttonMuzzle : {
|
case IDC_buttonMag: {
|
||||||
if (_leftPanelState) then {
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
|
||||||
} foreach (_compatibleItems arrayIntersect (((GVAR(virtualItems) select 1) select 2) apply {toLower _x}));
|
|
||||||
} else {
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 1) select 2);
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 22) select 2);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonBipod : {
|
|
||||||
if (_leftPanelState) then {
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
|
||||||
} foreach (_compatibleItems arrayIntersect (((GVAR(virtualItems) select 1) select 3) apply {toLower _x}));
|
|
||||||
} else {
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 1) select 3);
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 22) select 3);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonCurrentMag : {
|
|
||||||
if (_leftPanelState) then {
|
|
||||||
{
|
|
||||||
["CfgMagazines", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
|
||||||
} foreach ((GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL) arrayIntersect _compatibleMagsPrimaryMuzzle);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonCurrentMag2 : {
|
|
||||||
if (_leftPanelState) then {
|
|
||||||
{
|
|
||||||
["CfgMagazines", _x, _ctrlPanel] call FUNC(addListBoxItem);
|
|
||||||
} foreach ((GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL) arrayIntersect _compatibleMagsSecondaryMuzzle);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonMag : {
|
|
||||||
{
|
{
|
||||||
["CfgMagazines", _x, true] call _fnc_fill_right_Container;
|
if (_x in (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL)) then {
|
||||||
} foreach ((GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL) arrayIntersect _allCompatibleMags);
|
["CfgMagazines", _x, false] call _fnc_fillRightContainer;
|
||||||
{
|
|
||||||
["CfgMagazines", _x, true, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 19) arrayIntersect _allCompatibleMags);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonMagALL : {
|
continue;
|
||||||
{
|
};
|
||||||
["CfgMagazines", _x, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach (GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL);
|
|
||||||
{
|
|
||||||
["CfgMagazines", _x, true, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach (GVAR(virtualItems) select 19);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonThrow : {
|
if (_x in (GVAR(virtualItems) get IDX_VIRT_UNIQUE_VIRT_ITEMS_ALL)) then {
|
||||||
{
|
["CfgMagazines", _x, false, true] call _fnc_fillRightContainer;
|
||||||
["CfgMagazines", _x, true] call _fnc_fill_right_Container;
|
};
|
||||||
} foreach (GVAR(virtualItems) select 15);
|
} forEach (keys _compatibleMagsAll);
|
||||||
{
|
|
||||||
["CfgMagazines", _x, true, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach (GVAR(virtualItems) select 20);
|
|
||||||
};
|
};
|
||||||
|
// All magazines
|
||||||
|
case IDC_buttonMagALL: {
|
||||||
|
{
|
||||||
|
["CfgMagazines", _x, false] call _fnc_fillRightContainer;
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL));
|
||||||
|
|
||||||
case IDC_buttonPut : {
|
|
||||||
{
|
{
|
||||||
["CfgMagazines", _x, true] call _fnc_fill_right_Container;
|
["CfgMagazines", _x, false, true] call _fnc_fillRightContainer;
|
||||||
} foreach (GVAR(virtualItems) select 16);
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_VIRT_ITEMS_ALL));
|
||||||
{
|
|
||||||
["CfgMagazines", _x, true, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach (GVAR(virtualItems) select 21);
|
|
||||||
};
|
};
|
||||||
|
// Grenades
|
||||||
|
case IDC_buttonThrow: {
|
||||||
|
{
|
||||||
|
["CfgMagazines", _x, false] call _fnc_fillRightContainer;
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_GRENADES));
|
||||||
|
|
||||||
|
{
|
||||||
|
["CfgMagazines", _x, false, true] call _fnc_fillRightContainer;
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_GRENADES));
|
||||||
|
};
|
||||||
|
// Explosives
|
||||||
|
case IDC_buttonPut: {
|
||||||
|
{
|
||||||
|
["CfgMagazines", _x, false] call _fnc_fillRightContainer;
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_EXPLOSIVES));
|
||||||
|
|
||||||
|
{
|
||||||
|
["CfgMagazines", _x, false, true] call _fnc_fillRightContainer;
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_EXPLOSIVES));
|
||||||
|
};
|
||||||
|
// Misc. items
|
||||||
|
case IDC_buttonMisc: {
|
||||||
|
// Don't add items that will be in a custom right panel button
|
||||||
|
private _items = createHashMap;
|
||||||
|
|
||||||
case IDC_buttonMisc : {
|
|
||||||
// hide custom button items
|
|
||||||
private _blockItems = [];
|
|
||||||
if (!isNil QGVAR(customRightPanelButtons)) then {
|
if (!isNil QGVAR(customRightPanelButtons)) then {
|
||||||
{
|
{
|
||||||
if (!isNil "_x") then {
|
if (!isNil "_x") then {
|
||||||
_blockItems append (_x select 0);
|
_items insert [true, _x select 0, []];
|
||||||
};
|
};
|
||||||
} forEach GVAR(customRightPanelButtons);
|
} forEach GVAR(customRightPanelButtons);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// "Regular" misc. items
|
||||||
{
|
{
|
||||||
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
|
if !(_x in _items) then {
|
||||||
} forEach ((GVAR(virtualItems) select 17) select {!((toLower _x) in _blockItems)});
|
["CfgWeapons", _x, true] call _fnc_fillRightContainer;
|
||||||
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 18) select {!((toLower _x) in _blockItems)});
|
|
||||||
{
|
|
||||||
["CfgVehicles", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 23) select {!((toLower _x) in _blockItems)});
|
|
||||||
{
|
|
||||||
["CfgGlasses", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 24) select {!((toLower _x) in _blockItems)});
|
|
||||||
};
|
|
||||||
|
|
||||||
default {
|
|
||||||
private _index = [RIGHT_PANEL_CUSTOM_BUTTONS] find _ctrlIDC;
|
|
||||||
if (_index != -1) then {
|
|
||||||
private _data = GVAR(customRightPanelButtons) param [_index];
|
|
||||||
|
|
||||||
if (!isNil "_data") then {
|
|
||||||
private _items = _data select 0;
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 17) select {(toLower _x) in _items});
|
|
||||||
|
|
||||||
{
|
|
||||||
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 18) select {(toLower _x) in _items});
|
|
||||||
{
|
|
||||||
["CfgVehicles", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 23) select {(toLower _x) in _items});
|
|
||||||
{
|
|
||||||
["CfgGlasses", _x, false, true] call _fnc_fill_right_Container;
|
|
||||||
} foreach ((GVAR(virtualItems) select 24) select {(toLower _x) in _items});
|
|
||||||
};
|
};
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS));
|
||||||
|
// Unique items
|
||||||
|
{
|
||||||
|
if !(_x in _items) then {
|
||||||
|
["CfgWeapons", _x, true, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_MISC_ITEMS));
|
||||||
|
// Unique backpacks
|
||||||
|
{
|
||||||
|
if !(_x in _items) then {
|
||||||
|
["CfgVehicles", _x, false, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_BACKPACKS));
|
||||||
|
// Unique goggles
|
||||||
|
{
|
||||||
|
if !(_x in _items) then {
|
||||||
|
["CfgGlasses", _x, false, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_GOGGLES));
|
||||||
|
// Unknown items
|
||||||
|
{
|
||||||
|
if !(_x in _items) then {
|
||||||
|
["CfgWeapons", _x, true, true, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIQUE_UNKNOWN_ITEMS));
|
||||||
|
};
|
||||||
|
// Custom buttons
|
||||||
|
default {
|
||||||
|
private _items = (GVAR(customRightPanelButtons) param [[RIGHT_PANEL_CUSTOM_BUTTONS] find _ctrlIDC, []]) param [0, []];
|
||||||
|
|
||||||
|
if (_items isNotEqualTo []) then {
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (true) do {
|
||||||
|
// "Regular" misc. items
|
||||||
|
case (_x in (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS)): {
|
||||||
|
["CfgWeapons", _x, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
// Unique items
|
||||||
|
case (_x in (GVAR(virtualItems) get IDX_VIRT_UNIQUE_MISC_ITEMS)): {
|
||||||
|
["CfgWeapons", _x, true, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
// Unique backpacks
|
||||||
|
case (_x in (GVAR(virtualItems) get IDX_VIRT_UNIQUE_BACKPACKS)): {
|
||||||
|
["CfgVehicles", _x, false, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
// Unique goggles
|
||||||
|
case (_x in (GVAR(virtualItems) get IDX_VIRT_UNIQUE_GOGGLES)): {
|
||||||
|
["CfgGlasses", _x, false, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
// Unknown items
|
||||||
|
case (_x in (GVAR(virtualItems) get IDX_VIRT_UNIQUE_UNKNOWN_ITEMS)): {
|
||||||
|
["CfgWeapons", _x, true, true, true] call _fnc_fillRightContainer;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _items;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
|
// When switching tabs, clear searchbox
|
||||||
|
if (GVAR(currentRightPanel) != _ctrlIDC) then {
|
||||||
|
(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
|
||||||
|
};
|
||||||
|
|
||||||
|
// Trigger event
|
||||||
GVAR(currentRightPanel) = _ctrlIDC;
|
GVAR(currentRightPanel) = _ctrlIDC;
|
||||||
|
|
||||||
[QGVAR(rightPanelFilled), [_display, GVAR(currentLeftPanel), _ctrlIDC]] call CBA_fnc_localEvent;
|
[QGVAR(rightPanelFilled), [_display, GVAR(currentLeftPanel), _ctrlIDC]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Add current items and change progress bar
|
// Add current items, change progress bar of container load and get relevant container
|
||||||
if (GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]) then {
|
if (GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]) then {
|
||||||
|
private _containerItems = [];
|
||||||
private _maxLoad = 0;
|
|
||||||
private _container = switch (GVAR(currentLeftPanel)) do {
|
private _container = switch (GVAR(currentLeftPanel)) do {
|
||||||
case IDC_buttonUniform : {
|
// Uniform
|
||||||
|
case IDC_buttonUniform: {
|
||||||
|
// Update load bar
|
||||||
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadUniform GVAR(center));
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadUniform GVAR(center));
|
||||||
_maxLoad = gettext (configfile >> "CfgWeapons" >> uniform GVAR(center) >> "ItemInfo" >> "containerClass");
|
|
||||||
uniformItems GVAR(center)
|
// Get all items from container (excluding container itself)
|
||||||
|
_containerItems = [GVAR(center), 0, 3, 0, 0, false] call EFUNC(common,uniqueUnitItems);
|
||||||
|
|
||||||
|
uniformContainer GVAR(center)
|
||||||
};
|
};
|
||||||
case IDC_buttonVest : {
|
// Vest
|
||||||
|
case IDC_buttonVest: {
|
||||||
|
// Update load bar
|
||||||
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadVest GVAR(center));
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadVest GVAR(center));
|
||||||
_maxLoad = gettext (configfile >> "CfgWeapons" >> vest GVAR(center) >> "ItemInfo" >> "containerClass");
|
|
||||||
vestItems GVAR(center)
|
// Get all items from container (excluding container itself)
|
||||||
|
_containerItems = [GVAR(center), 0, 0, 3, 0, false] call EFUNC(common,uniqueUnitItems);
|
||||||
|
|
||||||
|
vestContainer GVAR(center)
|
||||||
};
|
};
|
||||||
case IDC_buttonBackpack : {
|
// Backpack
|
||||||
|
case IDC_buttonBackpack: {
|
||||||
|
// Update load bar
|
||||||
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadBackpack GVAR(center));
|
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition (loadBackpack GVAR(center));
|
||||||
_maxLoad = backpack GVAR(center);
|
|
||||||
backpackItems GVAR(center)
|
// Get all items from container (excluding container itself)
|
||||||
|
_containerItems = [GVAR(center), 0, 0, 0, 3, false] call EFUNC(common,uniqueUnitItems);
|
||||||
|
|
||||||
|
backpackContainer GVAR(center)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
for "_l" from 0 to ((lnbsize _ctrlPanel select 0) - 1) do {
|
// Find out how many items of a type there are and update the number displayed
|
||||||
private _class = _ctrlPanel lnbData [_l, 0];
|
for "_lbIndex" from 0 to (lnbSize _ctrlPanel select 0) - 1 do {
|
||||||
_ctrlPanel lnbSetText [[_l, 2], ["0", str ({_x == _class} count _container)] select (_class in _container)];
|
_ctrlPanel lnbSetText [[_lbIndex, 2], str (_containerItems getOrDefault [_ctrlPanel lnbData [_lbIndex, 0], 0])];
|
||||||
};
|
};
|
||||||
|
|
||||||
[_ctrlPanel, _maxLoad] call FUNC(updateRightPanel);
|
// Refresh availibility of items based on space remaining in container
|
||||||
|
[_ctrlPanel, _container, _containerItems isNotEqualTo []] call FUNC(updateRightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sorting
|
// Sorting
|
||||||
private _sortRightCtrl = _display displayCtrl IDC_sortRightTab;
|
[_display, _control, _display displayCtrl IDC_sortRightTab, _display displayCtrl IDC_sortRightTabDirection] call FUNC(fillSort);
|
||||||
[_display, _control, _sortRightCtrl] call FUNC(fillSort);
|
|
||||||
|
|
||||||
// Select current data if not in a container
|
// Try to select previously selected item again, otherwise select first item ("Empty")
|
||||||
if (_itemsToCheck isNotEqualTo []) then {
|
if (_itemToCheck != "") then {
|
||||||
for "_lbIndex" from 0 to (lbSize _ctrlPanel - 1) do {
|
private _index = 0;
|
||||||
private _currentData = _ctrlPanel lbData _lbIndex;
|
|
||||||
|
|
||||||
if ((_currentData != "") && {tolower _currentData in _itemsToCheck}) exitWith {
|
for "_lbIndex" from 0 to (lbSize _ctrlPanel) - 1 do {
|
||||||
_ctrlPanel lbSetCurSel _lbIndex;
|
if ((_ctrlPanel lbData _lbIndex) == _itemToCheck) exitWith {
|
||||||
|
_index = _lbIndex;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (lbCurSel _ctrlPanel < 0) then {
|
_ctrlPanel lbSetCurSel _index;
|
||||||
_ctrlPanel lbSetCurSel 0;
|
} else {
|
||||||
};
|
_ctrlPanel lbSetCurSel 0;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe, Brett Mayson
|
* Author: Alganthe, Brett Mayson, johnb43
|
||||||
* Fill right panel.
|
* Fills the sort menu.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
@ -15,51 +15,78 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_display", "_control", "_sortCtrl"];
|
params ["_display", "_control", "_sortCtrl", "_sortDirectionCtrl"];
|
||||||
|
|
||||||
lbClear _sortCtrl;
|
lbClear _sortCtrl;
|
||||||
|
lbClear _sortDirectionCtrl;
|
||||||
|
|
||||||
private _right = false;
|
private _right = false;
|
||||||
private _rightSort = ctrlIDC _sortCtrl == 17;
|
private _rightSort = ctrlIDC _sortCtrl == IDC_sortRightTab;
|
||||||
|
|
||||||
private _sorts = if (_rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform ,IDC_buttonVest, IDC_buttonBackpack]}) then {
|
// Handle sorting direction
|
||||||
|
private _lastSortDirection = [GVAR(lastSortDirectionLeft), GVAR(lastSortDirectionRight)] select _rightSort;
|
||||||
|
private _sortIndex = 0;
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
|
{
|
||||||
|
_x params ["_sortName", "_displayName", "_direction"];
|
||||||
|
|
||||||
|
_index = _sortDirectionCtrl lbAdd _displayName;
|
||||||
|
_sortDirectionCtrl lbSetData [_index, _sortName];
|
||||||
|
_sortDirectionCtrl lbSetValue [_index, _direction];
|
||||||
|
|
||||||
|
if (_direction == _lastSortDirection) then {
|
||||||
|
_sortIndex = _index;
|
||||||
|
};
|
||||||
|
} forEach [[QGVAR(descending), LLSTRING(sortDescending), DESCENDING], [QGVAR(ascending), LLSTRING(sortAscending), ASCENDING]];
|
||||||
|
|
||||||
|
// Prevent FUNC(sortPanel) being called twice in succession
|
||||||
|
GVAR(ignoreFirstSortPanelCall) = true;
|
||||||
|
_sortDirectionCtrl lbSetCurSel _sortIndex;
|
||||||
|
|
||||||
|
// Handle sorting
|
||||||
|
private _sorts = if (_rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]}) then {
|
||||||
_right = true;
|
_right = true;
|
||||||
|
|
||||||
|
// Right panel for uniforms, vest and backpacks
|
||||||
GVAR(sortListRightPanel) select (
|
GVAR(sortListRightPanel) select (
|
||||||
switch (GVAR(currentRightPanel)) do {
|
switch (GVAR(currentRightPanel)) do {
|
||||||
case IDC_buttonOptic: { 0 };
|
case IDC_buttonOptic: {0};
|
||||||
case IDC_buttonItemAcc: { 1 };
|
case IDC_buttonItemAcc: {1};
|
||||||
case IDC_buttonMuzzle: { 2 };
|
case IDC_buttonMuzzle: {2};
|
||||||
case IDC_buttonBipod: { 3 };
|
case IDC_buttonBipod: {3};
|
||||||
case IDC_buttonCurrentMag;
|
case IDC_buttonCurrentMag;
|
||||||
case IDC_buttonCurrentMag2;
|
case IDC_buttonCurrentMag2;
|
||||||
case IDC_buttonMag;
|
case IDC_buttonMag;
|
||||||
case IDC_buttonMagALL: { 4 };
|
case IDC_buttonMagALL: {4};
|
||||||
case IDC_buttonThrow: { 5 };
|
case IDC_buttonThrow: {5};
|
||||||
case IDC_buttonPut: { 6 };
|
case IDC_buttonPut: {6};
|
||||||
case IDC_buttonMisc: { 7 };
|
case IDC_buttonMisc: {7};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
private _sidc = ctrlIDC _sortCtrl;
|
|
||||||
private _idc = ctrlIDC _control;
|
private _idc = ctrlIDC _control;
|
||||||
switch true do {
|
|
||||||
case (_sidc == 17): { // Right panel weapon attachment
|
switch (true) do {
|
||||||
|
// Right panel for weapons
|
||||||
|
case (_rightSort): {
|
||||||
GVAR(sortListRightPanel) select (
|
GVAR(sortListRightPanel) select (
|
||||||
switch (_idc) do {
|
switch (_idc) do {
|
||||||
case IDC_buttonOptic: { 0 };
|
case IDC_buttonOptic: {0};
|
||||||
case IDC_buttonItemAcc: { 1 };
|
case IDC_buttonItemAcc: {1};
|
||||||
case IDC_buttonMuzzle: { 2 };
|
case IDC_buttonMuzzle: {2};
|
||||||
case IDC_buttonBipod: { 3 };
|
case IDC_buttonBipod: {3};
|
||||||
case IDC_buttonCurrentMag;
|
case IDC_buttonCurrentMag;
|
||||||
case IDC_buttonCurrentMag2;
|
case IDC_buttonCurrentMag2;
|
||||||
case IDC_buttonMag;
|
case IDC_buttonMag;
|
||||||
case IDC_buttonMagALL: { 4 };
|
case IDC_buttonMagALL: {4};
|
||||||
case IDC_buttonThrow: { 5 };
|
case IDC_buttonThrow: {5};
|
||||||
case IDC_buttonPut: { 6 };
|
case IDC_buttonPut: {6};
|
||||||
case IDC_buttonMisc: { 7 };
|
case IDC_buttonMisc: {7};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// Left panel
|
||||||
default {
|
default {
|
||||||
GVAR(sortListLeftPanel) select ([
|
GVAR(sortListLeftPanel) select ([
|
||||||
IDC_buttonPrimaryWeapon,
|
IDC_buttonPrimaryWeapon,
|
||||||
@ -86,15 +113,21 @@ private _sorts = if (_rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform
|
|||||||
};
|
};
|
||||||
|
|
||||||
private _lastSort = [GVAR(lastSortLeft), GVAR(lastSortRight)] select _rightSort;
|
private _lastSort = [GVAR(lastSortLeft), GVAR(lastSortRight)] select _rightSort;
|
||||||
private _sortIndex = 0;
|
_sortIndex = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_x isEqualTo []) exitWith {};
|
if (_x isEqualTo []) then {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
_x params ["_sortName", "_displayName", "", "_condition"];
|
_x params ["_sortName", "_displayName", "", "_condition"];
|
||||||
|
|
||||||
|
// Check if sort if available for this panel
|
||||||
if ([_right] call _condition) then {
|
if ([_right] call _condition) then {
|
||||||
private _index = _sortCtrl lbAdd _displayName;
|
_index = _sortCtrl lbAdd _displayName;
|
||||||
_sortCtrl lbSetData [_index, _sortName];
|
_sortCtrl lbSetData [_index, _sortName];
|
||||||
if (_displayName isEqualTo _lastSort) then {
|
|
||||||
|
if (_displayName == _lastSort) then {
|
||||||
_sortIndex = _index;
|
_sortIndex = _index;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
#include "script_component.hpp"
|
|
||||||
/*
|
|
||||||
* Author: Brett Mayson
|
|
||||||
* Get the extended loadout of a unit, including identity options if enabled
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Unit <OBJECT>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* CBA Extended Loadout <ARRAY>
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [_unit] call ace_arsenal_fnc_getLoadout
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
|
||||||
|
|
||||||
params [["_unit", objNull, [objNull]]];
|
|
||||||
|
|
||||||
if (isNull _unit) exitWith {};
|
|
||||||
|
|
||||||
([_unit] call CBA_fnc_getLoadout) params ["_loadout", "_extendedInfo"];
|
|
||||||
|
|
||||||
if (GVAR(loadoutsSaveFace)) then {
|
|
||||||
_extendedInfo set [QGVAR(face), face _unit];
|
|
||||||
};
|
|
||||||
if (GVAR(loadoutsSaveVoice)) then {
|
|
||||||
_extendedInfo set [QGVAR(voice), speaker _unit];
|
|
||||||
};
|
|
||||||
if (GVAR(loadoutsSaveInsignia)) then {
|
|
||||||
private _insignia = _unit getVariable ["BIS_fnc_setUnitInsignia_class", ""];
|
|
||||||
if (_insignia != "") then {
|
|
||||||
_extendedInfo set [QGVAR(insignia), _insignia];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
[_loadout, _extendedInfo]
|
|
@ -16,30 +16,56 @@
|
|||||||
|
|
||||||
params ["_display", "_control"];
|
params ["_display", "_control"];
|
||||||
|
|
||||||
private _textString = ctrlText _control;
|
|
||||||
|
|
||||||
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||||
|
|
||||||
if !(GVAR(lastSearchTextLoadouts) isEqualTo "" || {(_textString find GVAR(lastSearchTextLoadouts)) == 0}) then {//don't refill if there is no need
|
// Get the currently selected item in panel
|
||||||
|
private _selectedLoadoutIndex = lnbCurSelRow _contentPanelCtrl;
|
||||||
|
private _selectedLoadout = "";
|
||||||
|
|
||||||
|
// If something is selected, save it
|
||||||
|
if (_selectedLoadoutIndex != -1) then {
|
||||||
|
_selectedLoadout = _contentPanelCtrl lnbText [_selectedLoadoutIndex, 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
private _searchString = ctrlText _control;
|
||||||
|
|
||||||
|
// Don't refill if there is no need
|
||||||
|
if (GVAR(lastSearchTextLoadouts) != "" && {(_searchString find GVAR(lastSearchTextLoadouts)) != 0}) then {
|
||||||
[_display, _display displayCtrl GVAR(currentLoadoutsTab)] call FUNC(fillLoadoutsList);
|
[_display, _display displayCtrl GVAR(currentLoadoutsTab)] call FUNC(fillLoadoutsList);
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(lastSearchTextLoadouts) = _textString;
|
GVAR(lastSearchTextLoadouts) = _searchString;
|
||||||
if (count _textString == 0) exitWith {};
|
|
||||||
|
|
||||||
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
// If nothing searched, quit here
|
||||||
|
if (_searchString != "") then {
|
||||||
|
_searchString = toLower _searchString;
|
||||||
|
|
||||||
private _itemsToGo = (lnbSize _contentPanelCtrl) select 0;
|
private _loadoutName = "";
|
||||||
private _lbIndex = 0;
|
private _loadout = [];
|
||||||
while {_itemsToGo > 0} do {
|
private _currentTab = str GVAR(currentLoadoutsTab);
|
||||||
private _currentData = _contentPanelCtrl lnbText [_lbIndex, 1];
|
|
||||||
private _currentClassname = _contentPanelCtrl lnbData [_lbIndex, 0];
|
|
||||||
|
|
||||||
if ((_currentData isEqualTo "") || {(((toUpper _currentData) find (toUpper _textString)) == -1) && {((toUpper _currentClassname) find (toUpper _textString)) == -1}}) then {
|
// Go through all items in panel and see if they need to be deleted or not
|
||||||
_contentPanelCtrl lnbDeleteRow _lbIndex;
|
for "_lbIndex" from (lnbSize _contentPanelCtrl select 0) - 1 to 0 step -1 do {
|
||||||
} else {
|
_loadoutName = toLower (_contentPanelCtrl lnbText [_lbIndex, 1]);
|
||||||
_lbIndex = _lbIndex + 1;
|
|
||||||
|
// Remove item in panel if it doesn't match search, skip otherwise
|
||||||
|
if ((_loadoutName == "") || {!(_searchString in _loadoutName)}) then {
|
||||||
|
_contentPanelCtrl lnbDeleteRow _lbIndex;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
_itemsToGo = _itemsToGo - 1;
|
|
||||||
};
|
};
|
||||||
_contentPanelCtrl lnbSetCurSelRow -1;
|
|
||||||
|
// Try to select previously selected item again, otherwise select nothing
|
||||||
|
if (_selectedLoadoutIndex != -1) then {
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
|
for "_lbIndex" from 0 to (lnbSize _contentPanelCtrl select 0) - 1 do {
|
||||||
|
if ((_contentPanelCtrl lnbText [_lbIndex, 1]) == _selectedLoadout) exitWith {
|
||||||
|
_index = _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow _index;
|
||||||
|
} else {
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow -1;
|
||||||
|
};
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Karel Moricky, modified by Alganthe
|
* Author: Karel Moricky, modified by Alganthe, johnb43
|
||||||
* Update the camera position and pitch/bank.
|
* Update the camera position and pitch/bank.
|
||||||
* Modernized a bit, modified to fit the rewrite.
|
* Modernized a bit, modified to fit the rewrite.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Not used
|
* 0: Not used
|
||||||
* 1: Arguments <ARRAY>
|
* 1: Arguments <ARRAY>
|
||||||
* 1.1: Mouse area control <CONTROL>
|
* 1.0: Mouse area control <CONTROL>
|
||||||
* 1.2: Mouse X position <SCALAR>
|
* 1.1: Mouse X position <NUMBER>
|
||||||
* 1.3: Mouse Y position <SCALAR>
|
* 1.2: Mouse Y position <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -19,50 +19,53 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
params ["", "_args"];
|
params ["", "_args"];
|
||||||
|
|
||||||
_args params ["_control", "_mouseX", "_mouseY"];
|
_args params ["_control", "_mouseX", "_mouseY"];
|
||||||
GVAR(cameraPosition) params ["_distance", "_dirH", "_dirV", "_helperPos"];
|
|
||||||
|
GVAR(cameraPosition) params ["", "_dirH", "_dirV", "_helperPos"];
|
||||||
GVAR(mouseButtonState) params ["_LMB", "_RMB"];
|
GVAR(mouseButtonState) params ["_LMB", "_RMB"];
|
||||||
|
|
||||||
if (count _LMB > 0) then {
|
if (count _LMB > 0) then {
|
||||||
_LMB params ["_LMBcursorX", "_LMBcursorY"];
|
_LMB params ["_LMBcursorX", "_LMBcursorY"];
|
||||||
private _dX = [(_mouseX - _LMBcursorX), (_LMBcursorX - _mouseX)] select GVAR(camInverted);
|
private _dX = [_mouseX - _LMBcursorX, _LMBcursorX - _mouseX] select GVAR(camInverted);
|
||||||
private _dY = [(_mouseY -_LMBcursorY), (_LMBcursorY - _mouseY)] select GVAR(camInverted);
|
private _dY = [_mouseY -_LMBcursorY, _LMBcursorY - _mouseY] select GVAR(camInverted);
|
||||||
GVAR(mouseButtonState) set [0,[_mouseX,_mouseY]];
|
|
||||||
|
|
||||||
private _centerBox = boundingboxreal GVAR(center);
|
private _centerBox = boundingBoxReal GVAR(center);
|
||||||
private _centerSizeBottom = _centerBox select 0 select 2;
|
private _centerSizeBottom = _centerBox select 0 select 2;
|
||||||
private _centerSizeUp = _centerBox select 1 select 2;
|
private _centerSizeUp = _centerBox select 1 select 2;
|
||||||
private _centerSize = sqrt ([_centerBox select 0 select 0,_centerBox select 0 select 1] distance [_centerBox select 1 select 0,_centerBox select 1 select 1]);
|
private _centerSize = sqrt ([_centerBox select 0 select 0, _centerBox select 0 select 1] distance [_centerBox select 1 select 0, _centerBox select 1 select 1]);
|
||||||
|
|
||||||
|
_helperPos = [_helperPos, _dX * _centerSize, _dirH - 90] call BIS_fnc_relPos;
|
||||||
|
|
||||||
_helperPos = [_helperPos, _dX * _centerSize, _dirH - 90] call bis_fnc_relpos;
|
|
||||||
_helperPos = [
|
_helperPos = [
|
||||||
[0,0,((_helperPos select 2) - _dY * _centerSize) max _centerSizeBottom min _centerSizeUp],
|
[0, 0, ((_helperPos select 2) - _dY * _centerSize) max _centerSizeBottom min _centerSizeUp],
|
||||||
([0,0,0] distance2D _helperPos) min _centerSize,
|
([0, 0, 0] distance2D _helperPos) min _centerSize,
|
||||||
[0,0,0] getDir _helperPos
|
[0, 0, 0] getDir _helperPos
|
||||||
] call bis_fnc_relpos;
|
] call BIS_fnc_relPos;
|
||||||
|
|
||||||
_helperPos set [2,(_helperPos select 2) max ((boundingboxreal GVAR(center) select 0 select 2) + 0.2)];
|
_helperPos set [2, (_helperPos select 2) max ((_centerBox select 0 select 2) + 0.2)];
|
||||||
|
|
||||||
GVAR(cameraPosition) set [3,_helperPos];
|
GVAR(cameraPosition) set [3, _helperPos];
|
||||||
|
GVAR(mouseButtonState) set [0, [_mouseX, _mouseY]];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (count _RMB > 0) then {
|
if (count _RMB > 0) then {
|
||||||
_RMB params ["_RMBcursorX", "_RMBcursorY"];
|
_RMB params ["_RMBcursorX", "_RMBcursorY"];
|
||||||
|
|
||||||
private _dX = (_RMBcursorX - _mouseX) * 0.75;
|
private _dX = (_RMBcursorX - _mouseX) * 0.75;
|
||||||
private _dY = (_RMBcursorY - _mouseY) * 0.75;
|
private _dY = (_RMBcursorY - _mouseY) * 0.75;
|
||||||
|
|
||||||
_helperPos = [
|
_helperPos = [
|
||||||
[0,0,_helperPos select 2],
|
[0, 0, _helperPos select 2],
|
||||||
[0,0,0] distance2D _helperPos,
|
[0, 0, 0] distance2D _helperPos,
|
||||||
([0,0,0] getDir _helperPos) - _dX * 360
|
([0, 0, 0] getDir _helperPos) - _dX * 360
|
||||||
] call bis_fnc_relpos;
|
] call BIS_fnc_relPos;
|
||||||
|
|
||||||
GVAR(cameraPosition) set [1,(_dirH - _dX * 360)];
|
GVAR(cameraPosition) set [1, _dirH - _dX * 360];
|
||||||
GVAR(cameraPosition) set [2,(_dirV - _dY * 100) max -89 min 89];
|
GVAR(cameraPosition) set [2, (_dirV - _dY * 100) max -89 min 89];
|
||||||
GVAR(cameraPosition) set [3,_helperPos];
|
GVAR(cameraPosition) set [3, _helperPos];
|
||||||
GVAR(mouseButtonState) set [1,[_mouseX,_mouseY]];
|
GVAR(mouseButtonState) set [1, [_mouseX, _mouseY]];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!alive (GVAR(center)) || isnull GVAR(center)) then {
|
if (!alive GVAR(center)) then {
|
||||||
(ctrlParent _control) closeDisplay 2;
|
(ctrlParent _control) closeDisplay IDC_CANCEL;
|
||||||
};
|
};
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe
|
||||||
* Handle the mouse wheel.
|
* Handle the mouse wheel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Not used
|
* 0: Not used
|
||||||
* 1: Mousewheel Z position <SCALAR>
|
* 1: onMouseZChanged EH return <ARRAY>
|
||||||
|
* 1.0: Not used
|
||||||
|
* 1.1: Mousewheel Z position <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -17,7 +18,8 @@
|
|||||||
params ["", "_args"];
|
params ["", "_args"];
|
||||||
_args params ["", "_zPos"];
|
_args params ["", "_zPos"];
|
||||||
|
|
||||||
private _distanceMax = ((boundingboxreal GVAR(center) select 0) vectordistance (boundingboxreal GVAR(center) select 1)) * 1.5;
|
private _boundingBoxReal = boundingBoxReal GVAR(center);
|
||||||
|
private _distanceMax = ((_boundingBoxReal select 0) vectorDistance (_boundingBoxReal select 1)) * 1.5;
|
||||||
private _distanceMin = _distanceMax * 0.15;
|
private _distanceMin = _distanceMax * 0.15;
|
||||||
private _distance = GVAR(cameraPosition) select 0;
|
private _distance = GVAR(cameraPosition) select 0;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Handles keyboard inputs inside the searchbars text boxes.
|
* Handles keyboard inputs inside the searchbars text boxes.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -16,77 +16,162 @@
|
|||||||
|
|
||||||
params ["_display", "_control"];
|
params ["_display", "_control"];
|
||||||
|
|
||||||
private _textString = ctrlText _control;
|
private _searchString = ctrlText _control;
|
||||||
|
|
||||||
|
// Right panel search bar
|
||||||
if ((ctrlIDC _control) == IDC_rightSearchbar) then {
|
if ((ctrlIDC _control) == IDC_rightSearchbar) then {
|
||||||
if !(GVAR(lastSearchTextRight) isEqualTo "" || {(_textString find GVAR(lastSearchTextRight)) == 0}) then {//don't refill if there is no need
|
// Don't refill if there is no need
|
||||||
|
if (GVAR(lastSearchTextRight) != "" && {(_searchString find GVAR(lastSearchTextRight)) != 0}) then {
|
||||||
[_display, _display displayCtrl GVAR(currentRightPanel)] call FUNC(fillRightPanel);
|
[_display, _display displayCtrl GVAR(currentRightPanel)] call FUNC(fillRightPanel);
|
||||||
};
|
};
|
||||||
GVAR(lastSearchTextRight) = _textString;
|
|
||||||
if (count _textString == 0) exitWith {};
|
|
||||||
|
|
||||||
private _rightPanelState = GVAR(currentLeftPanel) in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon];
|
GVAR(lastSearchTextRight) = _searchString;
|
||||||
private _rightPanelCtrl = [_display displayCtrl IDC_rightTabContentListnBox, _display displayCtrl IDC_rightTabContent] select (_rightPanelState);
|
|
||||||
|
|
||||||
|
// If nothing searched, quit here
|
||||||
|
if (_searchString == "") exitWith {};
|
||||||
|
|
||||||
|
private _rightPanelState = GVAR(currentLeftPanel) in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon, IDC_buttonBinoculars];
|
||||||
|
private _rightPanelCtrl = [_display displayCtrl IDC_rightTabContentListnBox, _display displayCtrl IDC_rightTabContent] select _rightPanelState;
|
||||||
|
|
||||||
|
_searchString = toLower _searchString;
|
||||||
|
|
||||||
|
// If right panel selection is weapons or binoculars
|
||||||
if (_rightPanelState) then {
|
if (_rightPanelState) then {
|
||||||
|
// Get the currently selected item in panel
|
||||||
|
private _selectedItemIndex = lbCurSel _rightPanelCtrl;
|
||||||
|
private _selectedItem = "";
|
||||||
|
|
||||||
private _itemsToGo = lbSize _rightPanelCtrl;
|
// If something is selected, save it
|
||||||
private _lbIndex = 0;
|
if (_selectedItemIndex != -1) then {
|
||||||
while {_itemsToGo > 0} do {
|
_selectedItem = _rightPanelCtrl lbText _selectedItemIndex;
|
||||||
private _currentData = _rightPanelCtrl lbText _lbIndex;
|
};
|
||||||
private _currentClassname = _rightPanelCtrl lbData _lbIndex;
|
|
||||||
|
|
||||||
if ((_currentData isEqualTo "") || {(((toUpper _currentData) find (toUpper _textString)) == -1) && {((toUpper _currentClassname) find (toUpper _textString)) == -1}}) then {
|
private _currentDisplayName = "";
|
||||||
|
private _currentClassname = "";
|
||||||
|
|
||||||
|
// Go through all items in panel and see if they need to be deleted or not
|
||||||
|
for "_lbIndex" from (lbSize _rightPanelCtrl) - 1 to 0 step -1 do {
|
||||||
|
_currentDisplayName = toLower (_rightPanelCtrl lbText _lbIndex);
|
||||||
|
_currentClassname = toLower (_rightPanelCtrl lbData _lbIndex);
|
||||||
|
|
||||||
|
// Remove item in panel if it doesn't match search, skip otherwise
|
||||||
|
if ((_currentDisplayName == "") || {!(_searchString in _currentDisplayName) && {!(_searchString in _currentClassname)}}) then {
|
||||||
_rightPanelCtrl lbDelete _lbIndex;
|
_rightPanelCtrl lbDelete _lbIndex;
|
||||||
} else {
|
|
||||||
_lbIndex = _lbIndex + 1;
|
|
||||||
};
|
};
|
||||||
_itemsToGo = _itemsToGo - 1;
|
|
||||||
};
|
};
|
||||||
_rightPanelCtrl lbSetCurSel -1;
|
|
||||||
|
// Try to select previously selected item again, otherwise select nothing
|
||||||
|
if (_selectedItemIndex != -1) then {
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
|
// Try to find previously selected item in panel
|
||||||
|
for "_lbIndex" from 0 to (lbSize _rightPanelCtrl) - 1 do {
|
||||||
|
if ((_rightPanelCtrl lbText _lbIndex) == _selectedItem) exitWith {
|
||||||
|
_index = _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Select old item if found, otherwise don't select anything
|
||||||
|
_rightPanelCtrl lbSetCurSel _index;
|
||||||
|
} else {
|
||||||
|
_rightPanelCtrl lbSetCurSel -1;
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
|
// Get the currently selected item in panel
|
||||||
|
private _selectedItemIndex = lnbCurSelRow _rightPanelCtrl;
|
||||||
|
private _selectedItem = "";
|
||||||
|
|
||||||
private _itemsToGo = (lnbSize _rightPanelCtrl) select 0;
|
// If something is selected, save it
|
||||||
private _lbIndex = 0;
|
if (_selectedItemIndex != -1) then {
|
||||||
while {_itemsToGo > 0} do {
|
_selectedItem = _rightPanelCtrl lnbText [_selectedItemIndex, 1];
|
||||||
private _currentData = _rightPanelCtrl lnbText [_lbIndex, 1];
|
};
|
||||||
private _currentClassname = _rightPanelCtrl lnbData [_lbIndex, 0];
|
|
||||||
|
private _currentDisplayName = "";
|
||||||
if ((_currentData isEqualTo "") || {(((toUpper _currentData) find (toUpper _textString)) == -1) && {((toUpper _currentClassname) find (toUpper _textString)) == -1}}) then {
|
private _currentClassname = "";
|
||||||
_rightPanelCtrl lnbDeleteRow _lbIndex;
|
|
||||||
} else {
|
// Go through all items in panel and see if they need to be deleted or not
|
||||||
_lbIndex = _lbIndex + 1;
|
for "_lbIndex" from (lnbSize _rightPanelCtrl select 0) - 1 to 0 step -1 do {
|
||||||
};
|
_currentDisplayName = toLower (_rightPanelCtrl lnbText [_lbIndex, 1]);
|
||||||
_itemsToGo = _itemsToGo - 1;
|
_currentClassname = toLower (_rightPanelCtrl lnbData [_lbIndex, 0]);
|
||||||
|
|
||||||
|
// Remove item in panel if it doesn't match search, skip otherwise
|
||||||
|
if ((_currentDisplayName == "") || {!(_searchString in _currentDisplayName) && {!(_searchString in _currentClassname)}}) then {
|
||||||
|
_rightPanelCtrl lnbDeleteRow _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Try to select previously selected item again, otherwise select nothing
|
||||||
|
if (_selectedItemIndex != -1) then {
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
|
// Try to find previously selected item in panel
|
||||||
|
for "_lbIndex" from 0 to (lnbSize _rightPanelCtrl select 0) - 1 do {
|
||||||
|
if ((_rightPanelCtrl lnbText [_lbIndex, 1]) == _selectedItem) exitWith {
|
||||||
|
_index = _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Select old item if found, otherwise don't select anything
|
||||||
|
_rightPanelCtrl lnbSetCurSelRow _index;
|
||||||
|
} else {
|
||||||
|
_rightPanelCtrl lnbSetCurSelRow -1;
|
||||||
};
|
};
|
||||||
_rightPanelCtrl lnbSetCurSelRow -1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[_display, nil, nil, configNull] call FUNC(itemInfo);
|
[_display, nil, nil, configNull] call FUNC(itemInfo);
|
||||||
} else {
|
} else {
|
||||||
|
// Left panel search bar
|
||||||
if !(GVAR(lastSearchTextLeft) isEqualTo "" || {(_textString find GVAR(lastSearchTextLeft)) == 0}) then {//don't refill if there is no need
|
// Don't refill if there is no need
|
||||||
|
if (GVAR(lastSearchTextLeft) != "" && {(_searchString find GVAR(lastSearchTextLeft)) != 0}) then {
|
||||||
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
||||||
};
|
};
|
||||||
GVAR(lastSearchTextLeft) = _textString;
|
|
||||||
if (count _textString == 0) exitWith {};
|
GVAR(lastSearchTextLeft) = _searchString;
|
||||||
|
|
||||||
|
// If nothing searched, quit here
|
||||||
|
if (_searchString == "") exitWith {};
|
||||||
|
|
||||||
private _leftPanelCtrl = _display displayCtrl IDC_leftTabContent;
|
private _leftPanelCtrl = _display displayCtrl IDC_leftTabContent;
|
||||||
|
|
||||||
|
_searchString = toLower _searchString;
|
||||||
|
|
||||||
private _itemsToGo = (lbSize _leftPanelCtrl);
|
// Get the currently selected item in panel
|
||||||
private _lbIndex = 0;
|
private _selectedItemIndex = lbCurSel _leftPanelCtrl;
|
||||||
while {_itemsToGo > 0} do {
|
private _selectedItem = "";
|
||||||
private _currentData = _leftPanelCtrl lbText _lbIndex;
|
|
||||||
private _currentClassname = _leftPanelCtrl lbData _lbIndex;
|
|
||||||
|
|
||||||
if ((_currentData isEqualTo "") || {(((toUpper _currentData) find (toUpper _textString)) == -1) && {((toUpper _currentClassname) find (toUpper _textString)) == -1}}) then {
|
// If something is selected, save it
|
||||||
_leftPanelCtrl lbDelete _lbIndex;
|
if (_selectedItemIndex != -1) then {
|
||||||
} else {
|
_selectedItem = _leftPanelCtrl lbText _selectedItemIndex;
|
||||||
_lbIndex = _lbIndex + 1;
|
|
||||||
};
|
|
||||||
_itemsToGo = _itemsToGo - 1;
|
|
||||||
};
|
};
|
||||||
_leftPanelCtrl lbSetCurSel -1;
|
|
||||||
|
private _currentDisplayName = "";
|
||||||
|
private _currentClassname = "";
|
||||||
|
|
||||||
|
// Go through all items in panel and see if they need to be deleted or not
|
||||||
|
for "_lbIndex" from (lbSize _leftPanelCtrl) - 1 to 0 step -1 do {
|
||||||
|
_currentDisplayName = toLower (_leftPanelCtrl lbText _lbIndex);
|
||||||
|
_currentClassname = toLower (_leftPanelCtrl lbData _lbIndex);
|
||||||
|
|
||||||
|
// Remove item in panel if it doesn't match search, skip otherwise
|
||||||
|
if ((_currentDisplayName == "") || {!(_searchString in _currentDisplayName) && {!(_searchString in _currentClassname)}}) then {
|
||||||
|
_leftPanelCtrl lbDelete _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Try to select previously selected item again, otherwise select nothing
|
||||||
|
if (_selectedItemIndex != -1) then {
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
|
for "_lbIndex" from 0 to (lbSize _leftPanelCtrl) - 1 do {
|
||||||
|
if ((_leftPanelCtrl lbText _lbIndex) == _selectedItem) exitWith {
|
||||||
|
_index = _lbIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_leftPanelCtrl lbSetCurSel _index;
|
||||||
|
} else {
|
||||||
|
_leftPanelCtrl lbSetCurSel -1;
|
||||||
|
};
|
||||||
|
|
||||||
[_display, nil, nil, configNull] call FUNC(itemInfo);
|
[_display, nil, nil, configNull] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe
|
||||||
* Handles the stats control group
|
* Handles the stats control group.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Current panel control <CONTROL>
|
* 1: Current panel control <CONTROL>
|
||||||
* 2: Current panel selection <SCALAR>
|
* 2: Current panel selection <NUMBER>
|
||||||
* 3: Item config entry <CONFIG>
|
* 3: Item config entry <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
@ -27,7 +27,7 @@ private _hideUnusedFnc = {
|
|||||||
params ["_numbers"];
|
params ["_numbers"];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _statsTitleCtrl = _display displayCtrl (5101 + ((_x - 1) * 4));
|
private _statsTitleCtrl = _display displayCtrl (IDC_statsTitle1 + ((_x - 1) * 4));
|
||||||
private _statsTitleIDC = ctrlIDC _statsTitleCtrl;
|
private _statsTitleIDC = ctrlIDC _statsTitleCtrl;
|
||||||
|
|
||||||
private _statsBackgroundCtrl = _display displayCtrl (_statsTitleIDC + 1);
|
private _statsBackgroundCtrl = _display displayCtrl (_statsTitleIDC + 1);
|
||||||
@ -47,34 +47,40 @@ private _hideUnusedFnc = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!isNil "_itemCfg") then {
|
if (!isNil "_itemCfg") then {
|
||||||
|
|
||||||
private _handleStatsFnc = {
|
private _handleStatsFnc = {
|
||||||
params ["_statsIndex", "_leftPanel"];
|
params ["_statsIndex", "_leftPanel"];
|
||||||
|
|
||||||
// Get the proper list and page
|
// Get the proper list and page
|
||||||
if (_leftPanel) then {
|
if (_leftPanel) then {
|
||||||
[true, (GVAR(statsListLeftPanel)) select _statsIndex, GVAR(statsPagesLeft) select _statsIndex]
|
[(GVAR(statsListLeftPanel)) select _statsIndex, GVAR(statsPagesLeft) select _statsIndex]
|
||||||
} else {
|
} else {
|
||||||
[false, (GVAR(statsListRightPanel)) select _statsIndex, GVAR(statsPagesRight) select _statsIndex]
|
[(GVAR(statsListRightPanel)) select _statsIndex, GVAR(statsPagesRight) select _statsIndex]
|
||||||
} params ["_isLeftPanel", "_statsArray", "_currentPage"];
|
} params ["_statsArray", "_currentPage"];
|
||||||
|
|
||||||
private _statsList = _statsArray select _currentPage;
|
private _statsList = _statsArray select _currentPage;
|
||||||
|
|
||||||
private _statsCount = 0;
|
private _statsCount = 0;
|
||||||
|
|
||||||
// Handle titles, bars and text
|
// Handle titles, bars and text
|
||||||
_statsList = _statsList select [0, 5];
|
_statsList = _statsList select [0, 5];
|
||||||
|
|
||||||
if (_statsList isNotEqualTo []) then {
|
if (_statsList isNotEqualTo []) then {
|
||||||
|
private _statsTitleCtrl = controlNull;
|
||||||
|
private _statsTitleIDC = -1;
|
||||||
|
private _statsBackgroundCtrl = controlNull;
|
||||||
|
private _statsBarCtrl = controlNull;
|
||||||
|
private _statsTextCtrl = controlNull;
|
||||||
|
private _textStatementResult = "";
|
||||||
|
|
||||||
{
|
{
|
||||||
_x params ["_ID", "_configEntry", "_title", "_bools", "_statements"];
|
_x params ["_ID", "_configEntry", "_title", "_bools", "_statements"];
|
||||||
_bools params ["_showBar", "_showText"];
|
_bools params ["_showBar", "_showText"];
|
||||||
_statements params [["_barStatement", {}, [{}]], ["_textStatement", {}, [{}]], ["_condition", {true}, [{}]]];
|
_statements params [["_barStatement", {}, [{}]], ["_textStatement", {}, [{}]], ["_condition", {true}, [{}]]];
|
||||||
|
|
||||||
private _statsTitleCtrl = _display displayCtrl (5101 + _forEachIndex * 4);
|
_statsTitleCtrl = _display displayCtrl (IDC_statsTitle1 + _forEachIndex * 4);
|
||||||
private _statsTitleIDC = ctrlIDC _statsTitleCtrl;
|
_statsTitleIDC = ctrlIDC _statsTitleCtrl;
|
||||||
private _statsBackgroundCtrl = _display displayCtrl (_statsTitleIDC + 1);
|
_statsBackgroundCtrl = _display displayCtrl (_statsTitleIDC + 1);
|
||||||
private _statsBarCtrl = _display displayCtrl (_statsTitleIDC + 2);
|
_statsBarCtrl = _display displayCtrl (_statsTitleIDC + 2);
|
||||||
private _statsTextCtrl = _display displayCtrl (_statsTitleIDC + 3);
|
_statsTextCtrl = _display displayCtrl (_statsTitleIDC + 3);
|
||||||
|
|
||||||
_statsCount = _statsCount + 1;
|
_statsCount = _statsCount + 1;
|
||||||
_statsTitleCtrl ctrlSetText _title;
|
_statsTitleCtrl ctrlSetText _title;
|
||||||
@ -83,7 +89,6 @@ if (!isNil "_itemCfg") then {
|
|||||||
// Handle bars
|
// Handle bars
|
||||||
if (_showBar) then {
|
if (_showBar) then {
|
||||||
_statsBarCtrl progressSetPosition ([_configEntry, _itemCfg] call _barStatement);
|
_statsBarCtrl progressSetPosition ([_configEntry, _itemCfg] call _barStatement);
|
||||||
|
|
||||||
_statsBackgroundCtrl ctrlSetFade 0;
|
_statsBackgroundCtrl ctrlSetFade 0;
|
||||||
_statsBarCtrl ctrlSetFade 0;
|
_statsBarCtrl ctrlSetFade 0;
|
||||||
} else {
|
} else {
|
||||||
@ -93,15 +98,14 @@ if (!isNil "_itemCfg") then {
|
|||||||
|
|
||||||
// Handle text entries
|
// Handle text entries
|
||||||
if (_showText) then {
|
if (_showText) then {
|
||||||
private _textStatementResult = [_configEntry, _itemCfg] call _textStatement;
|
_textStatementResult = [_configEntry, _itemCfg] call _textStatement;
|
||||||
|
|
||||||
if (_textStatementResult isEqualtype "") then {
|
if !(_textStatementResult isEqualtype "") then {
|
||||||
_statsTextCtrl ctrlSetText _textStatementResult;
|
_textStatementResult = str _textStatementResult;
|
||||||
} else {
|
|
||||||
_statsTextCtrl ctrlSetText (str _textStatementResult);
|
|
||||||
};
|
};
|
||||||
_statsTextCtrl ctrlSetTextColor ([[1,1,1,1], [0,0,0,1]] select (_showBar));
|
|
||||||
|
|
||||||
|
_statsTextCtrl ctrlSetText _textStatementResult;
|
||||||
|
_statsTextCtrl ctrlSetTextColor ([[1, 1, 1, 1], [0, 0, 0, 1]] select (_showBar));
|
||||||
_statsTextCtrl ctrlSetFade 0;
|
_statsTextCtrl ctrlSetFade 0;
|
||||||
} else {
|
} else {
|
||||||
_statsTextCtrl ctrlSetFade 1;
|
_statsTextCtrl ctrlSetFade 1;
|
||||||
@ -116,8 +120,8 @@ if (!isNil "_itemCfg") then {
|
|||||||
_statsTextCtrl
|
_statsTextCtrl
|
||||||
];
|
];
|
||||||
} forEach (_statsList select {
|
} forEach (_statsList select {
|
||||||
_x params ["_ID","_configEntry", "_title", "_bools", "_statements"];
|
_x params ["", "_configEntry", "", "", "_statements"];
|
||||||
_statements params [["_barStatement", {}, [{}]], ["_textStatement", {}, [{}]], ["_condition", {true}, [{}]]];
|
_statements params ["", "", ["_condition", {true}, [{}]]];
|
||||||
|
|
||||||
([_configEntry, _itemCfg] call _condition)
|
([_configEntry, _itemCfg] call _condition)
|
||||||
});
|
});
|
||||||
@ -133,12 +137,12 @@ if (!isNil "_itemCfg") then {
|
|||||||
];
|
];
|
||||||
_statsBoxCtrl ctrlCommit 0;
|
_statsBoxCtrl ctrlCommit 0;
|
||||||
|
|
||||||
GVAR(statsInfo) = [_isLeftPanel, _statsIndex, _control, _curSel, _itemCfg];
|
GVAR(statsInfo) = [_leftPanel, _statsIndex, _control, _curSel, _itemCfg];
|
||||||
|
|
||||||
// Toggle page buttons
|
// Toggle page buttons
|
||||||
_statsPreviousPageCtrl ctrlEnable !(_currentPage == 0);
|
_statsPreviousPageCtrl ctrlEnable (_currentPage > 0);
|
||||||
_statsNextPageCtrl ctrlEnable !(_currentPage + 1 >= count _statsArray);
|
_statsNextPageCtrl ctrlEnable (_currentPage + 1 < count _statsArray);
|
||||||
_statsCurrentPageCtrl ctrlSetText ([localize LSTRING(page), str (_currentPage + 1)] joinString " ");
|
_statsCurrentPageCtrl ctrlSetText ([LLSTRING(page), str (_currentPage + 1)] joinString " ");
|
||||||
|
|
||||||
{
|
{
|
||||||
_x ctrlSetFade 0;
|
_x ctrlSetFade 0;
|
||||||
@ -150,10 +154,10 @@ if (!isNil "_itemCfg") then {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check if in left or right panel
|
||||||
if (ctrlIDC _control == IDC_leftTabContent) then {
|
if (ctrlIDC _control == IDC_leftTabContent) then {
|
||||||
|
// Faces, voices and insigna do not have stats
|
||||||
if ([IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsignia] find GVAR(currentLeftPanel) > -1) then {
|
if ([IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsignia] find GVAR(currentLeftPanel) > -1) then {
|
||||||
|
|
||||||
[[1, 2, 3, 4, 5]] call _hideUnusedFnc;
|
[[1, 2, 3, 4, 5]] call _hideUnusedFnc;
|
||||||
_statsBoxCtrl ctrlSetPosition [
|
_statsBoxCtrl ctrlSetPosition [
|
||||||
(0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP,
|
(0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP,
|
||||||
@ -227,7 +231,7 @@ if (!isNil "_itemCfg") then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
// If nothing is chosen, hide stats
|
||||||
[[1, 2, 3, 4, 5]] call _hideUnusedFnc;
|
[[1, 2, 3, 4, 5]] call _hideUnusedFnc;
|
||||||
_statsBoxCtrl ctrlSetPosition [
|
_statsBoxCtrl ctrlSetPosition [
|
||||||
(0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP,
|
(0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP,
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Initialize a box / object for arsenal.
|
* Initialize a box / object for arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Target <OBJECT>
|
* 0: Target <OBJECT>
|
||||||
* 1: Items <BOOL> or <ARRAY>
|
* 1: Items <BOOL> <ARRAY>
|
||||||
* 2: Initialize globally <BOOL>
|
* 2: Initialize globally <BOOL> (default: true)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -22,42 +22,36 @@ params [["_object", objNull, [objNull]], ["_items", true, [[], true]], ["_global
|
|||||||
|
|
||||||
if (isNull _object) exitWith {};
|
if (isNull _object) exitWith {};
|
||||||
|
|
||||||
if (isNil QGVAR(EHIDArray)) then {
|
if (_global && {isMultiplayer} && {isNil {_object getVariable QGVAR(initBoxJIP)}}) then {
|
||||||
GVAR(EHIDArray) = [];
|
private _id = [QGVAR(initBox), [_object, _items, false]] call CBA_fnc_globalEventJIP;
|
||||||
};
|
|
||||||
|
|
||||||
if (_global && {isMultiplayer} && {{_object in _x} count GVAR(EHIDArray) == 0}) then {
|
// Remove JIP EH if object is deleted
|
||||||
|
[_id, _object] call CBA_fnc_removeGlobalEventJIP;
|
||||||
|
|
||||||
private _ID = [QGVAR(initBox), [_object, _items, false]] call CBA_fnc_globalEventJIP;
|
// Save JIP ID
|
||||||
[_ID, _object] call CBA_fnc_removeGlobalEventJIP;
|
_object setVariable [QGVAR(initBoxJIP), _id, true];
|
||||||
|
|
||||||
GVAR(EHIDArray) pushBack [_ID, _object];
|
|
||||||
publicVariable QGVAR(EHIDArray);
|
|
||||||
} else {
|
} else {
|
||||||
|
// Only add interaction if there isn't one already present
|
||||||
|
if (((_object getVariable [QEGVAR(interact_menu,actions), []]) findIf {((_x select 0) select 0) == QGVAR(interaction)}) != -1) exitWith {};
|
||||||
|
|
||||||
if ({(_x select 0) select 0 isEqualTo QGVAR(interaction)} count (_object getVariable [QEGVAR(interact_menu,actions), []]) == 0) then {
|
private _action = [
|
||||||
|
QGVAR(interaction),
|
||||||
|
localize "STR_A3_Arsenal",
|
||||||
|
"",
|
||||||
|
{
|
||||||
|
params ["_target", "_player"];
|
||||||
|
|
||||||
private _action = [
|
[_target, _player] call FUNC(openBox);
|
||||||
QGVAR(interaction),
|
},
|
||||||
localize "STR_A3_Arsenal",
|
{
|
||||||
"",
|
params ["_target", "_player"];
|
||||||
{
|
|
||||||
params ["_target", "_player"];
|
|
||||||
|
|
||||||
[_target, _player] call FUNC(openBox);
|
[_player, _target] call EFUNC(common,canInteractWith)
|
||||||
},
|
}
|
||||||
{
|
] call EFUNC(interact_menu,createAction);
|
||||||
params ["_target", "_player"];
|
[_object, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToObject);
|
||||||
|
|
||||||
[_player, _target] call EFUNC(common,canInteractWith)
|
[_object, _items, false] call FUNC(addVirtualItems);
|
||||||
},
|
|
||||||
{},
|
|
||||||
[]
|
|
||||||
] call EFUNC(interact_menu,createAction);
|
|
||||||
[_object, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToObject);
|
|
||||||
|
|
||||||
[_object, _items, false] call FUNC(addVirtualItems);
|
[QGVAR(boxInitialized), [_object, _items]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
[QGVAR(boxInitialized), [_object, _items]] call CBA_fnc_localEvent;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
|
#include "\a3\ui_f\hpp\defineResincl.inc"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Update arsenal's info box.
|
* Update arsenal's info box.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Current panel control <CONTROL>
|
* 1: Current panel control <CONTROL>
|
||||||
* 2: Current panel selection <SCALAR>
|
* 2: Current panel selection <NUMBER>
|
||||||
* 3: Item config entry <CONFIG>
|
* 3: Item config entry <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
@ -16,60 +17,55 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_display", "_control", "_curSel" ,"_itemCfg"];
|
params ["_display", "_control", "_curSel", "_itemCfg"];
|
||||||
|
|
||||||
private _ctrlInfo = _display displayCtrl IDC_infoBox;
|
private _ctrlInfo = _display displayCtrl IDC_infoBox;
|
||||||
|
|
||||||
if (isClass _itemCfg) then {
|
if (isClass _itemCfg) then {
|
||||||
|
|
||||||
_ctrlInfo ctrlSetFade 0;
|
_ctrlInfo ctrlSetFade 0;
|
||||||
_ctrlInfo ctrlCommit FADE_DELAY;
|
_ctrlInfo ctrlCommit FADE_DELAY;
|
||||||
|
|
||||||
[QGVAR(displayStats), [_display, _control, _curSel, _itemCfg]] call CBA_fnc_localEvent;
|
[QGVAR(displayStats), [_display, _control, _curSel, _itemCfg]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Name + author
|
// Name + author
|
||||||
private _ctrlInfoName = _display displayCtrl IDC_infoName;
|
(_display displayCtrl IDC_infoName) ctrlSetText ([_control lbText _curSel, _control lnbText [_curSel, 1]] select (ctrlType _control == CT_LISTNBOX));
|
||||||
_ctrlInfoName ctrlSetText ([_control lbText _curSel, _control lnbText [_curSel, 1]] select (ctrlType _control == 102));
|
|
||||||
|
|
||||||
private _ctrlInfoAuthor = _display displayctrl IDC_infoAuthor;
|
|
||||||
_ctrlInfoAuthor ctrlSetText "";
|
|
||||||
|
|
||||||
private _itemAuthor = getText (_itemCfg >> "author");
|
private _itemAuthor = getText (_itemCfg >> "author");
|
||||||
_ctrlInfoAuthor ctrlSetText ([localize "STR_AUTHOR_UNKNOWN", format [localize "STR_FORMAT_AUTHOR_SCRIPTED",_itemAuthor]] select (_itemAuthor != ""));
|
(_display displayctrl IDC_infoAuthor) ctrlSetText ([localize "STR_AUTHOR_UNKNOWN", format [localize "STR_FORMAT_AUTHOR_SCRIPTED", _itemAuthor]] select (_itemAuthor != ""));
|
||||||
|
|
||||||
// DLC / mod icon
|
// DLC / mod icon
|
||||||
private _ctrlDLC = _display displayctrl IDC_DLCIcon;
|
private _ctrlDLC = _display displayctrl IDC_DLCIcon;
|
||||||
private _ctrlDLCBackground = _display displayctrl IDC_DLCBackground;
|
private _ctrlDLCBackground = _display displayctrl IDC_DLCBackground;
|
||||||
private _dlc = _itemCfg call GETDLC;
|
private _dlc = _itemCfg call EFUNC(common,getAddon);
|
||||||
|
|
||||||
if (_dlc != "") then {
|
if (_dlc != "") then {
|
||||||
|
(modParams [_dlc, ["name", "logo", "logoOver"]]) params ["_name", "_logo", "_logoOver"];
|
||||||
|
|
||||||
private _dlcParams = modParams [_dlc, ["name", "logo", "logoOver"]];
|
_ctrlDLC ctrlSetTooltip _name;
|
||||||
_dlcParams params ["_name", "_logo", "_logoOver"];
|
_ctrlDLC ctrlSetText _logo;
|
||||||
private _appId = getnumber (configfile >> "CfgMods" >> _dlc >> "appId");
|
_ctrlDLCBackground ctrlSetFade 0;
|
||||||
|
_ctrlDLC ctrlSetFade 0;
|
||||||
|
|
||||||
_ctrlDLC ctrlsettooltip _name;
|
// If an item is from a DLC, set it so when you press the icon on the bottom right it opens the DLC page
|
||||||
_ctrlDLC ctrlsettext _logo;
|
if ((getNumber (configfile >> "CfgMods" >> _dlc >> "appId")) > 0) then {
|
||||||
_ctrlDLCBackground ctrlsetfade 0;
|
_ctrlDLC ctrlSetEventHandler ["mouseExit", format ["(_this select 0) ctrlSetText '%1';", _logo]];
|
||||||
_ctrlDLC ctrlsetfade 0;
|
_ctrlDLC ctrlSetEventHandler ["mouseEnter", format ["(_this select 0) ctrlSetText '%1';", _logoOver]];
|
||||||
if (_appId > 0) then {
|
_ctrlDLC ctrlSetEventHandler [
|
||||||
_ctrlDLC ctrlseteventhandler ["mouseexit",format ["(_this select 0) ctrlsettext '%1';",_logo]];
|
"buttonClick",
|
||||||
_ctrlDLC ctrlseteventhandler ["mouseenter",format ["(_this select 0) ctrlsettext '%1';",_logoOver]];
|
format ["uiNamespace setVariable ['RscDisplayDLCPreview_dlc','%1']; ctrlParent (_this select 0) createDisplay 'RscDisplayDLCPreview';", _dlc]
|
||||||
_ctrlDLC ctrlseteventhandler [
|
|
||||||
"buttonclick",
|
|
||||||
format ["uiNamespace setvariable ['RscDisplayDLCPreview_dlc','%1']; ctrlparent (_this select 0) createDisplay 'RscDisplayDLCPreview';", _dlc]
|
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
_ctrlDLC ctrlRemoveAllEventHandlers "buttonclick";
|
_ctrlDLC ctrlRemoveAllEventHandlers "mouseExit";
|
||||||
_ctrlDLC ctrlRemoveAllEventHandlers "mouseexit";
|
_ctrlDLC ctrlRemoveAllEventHandlers "mouseEnter";
|
||||||
_ctrlDLC ctrlRemoveAllEventHandlers "mouseenter";
|
_ctrlDLC ctrlRemoveAllEventHandlers "buttonClick";
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_ctrlDLC ctrlsetfade 1;
|
_ctrlDLC ctrlSetFade 1;
|
||||||
_ctrlDLCBackground ctrlsetfade 1;
|
_ctrlDLCBackground ctrlSetFade 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
_ctrlDLC ctrlcommit 0;
|
_ctrlDLC ctrlCommit 0;
|
||||||
_ctrlDLCBackground ctrlcommit 0;
|
_ctrlDLCBackground ctrlCommit 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
[QGVAR(displayStats), [_display, _control, -1, nil]] call CBA_fnc_localEvent;
|
[QGVAR(displayStats), [_display, _control, -1, nil]] call CBA_fnc_localEvent;
|
||||||
|
@ -27,7 +27,6 @@ private _renameButtonCtrl = _display displayCtrl IDC_buttonRename;
|
|||||||
|
|
||||||
// Update UI visual elements
|
// Update UI visual elements
|
||||||
if (GVAR(currentLoadoutsTab) != -1) then {
|
if (GVAR(currentLoadoutsTab) != -1) then {
|
||||||
|
|
||||||
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLoadoutsTab) - 1);
|
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLoadoutsTab) - 1);
|
||||||
_previousCtrlBackground ctrlSetBackgroundColor [0, 0, 0, 0.8];
|
_previousCtrlBackground ctrlSetBackgroundColor [0, 0, 0, 0.8];
|
||||||
_previousCtrlBackground ctrlCommit 0;
|
_previousCtrlBackground ctrlCommit 0;
|
||||||
@ -45,26 +44,36 @@ _control ctrlSetTextColor [0, 0, 0, 1];
|
|||||||
_control ctrlCommit 0;
|
_control ctrlCommit 0;
|
||||||
|
|
||||||
switch (ctrlIDC _control) do {
|
switch (ctrlIDC _control) do {
|
||||||
|
// Local loadouts
|
||||||
case IDC_buttonMyLoadouts: {
|
case IDC_buttonMyLoadouts: {
|
||||||
_centerBoxTitleCtrl ctrlSetText (localize LSTRING(tabMyLoadoutsText));
|
_centerBoxTitleCtrl ctrlSetText LLSTRING(tabMyLoadoutsText);
|
||||||
|
|
||||||
|
if (is3DEN) then {
|
||||||
|
_saveButtonCtrl ctrlSetTooltip format ["%1\n%2", LLSTRING(buttonSaveTooltip), LLSTRING(buttonSaveTooltip_shiftClick)];
|
||||||
|
};
|
||||||
|
|
||||||
if (is3den) then { _saveButtonCtrl ctrlSetTooltip format ["%1\n%2", localize LSTRING(buttonSaveTooltip), localize LSTRING(buttonSaveTooltip_shiftClick)]; };
|
|
||||||
_saveButtonCtrl ctrlEnable true;
|
_saveButtonCtrl ctrlEnable true;
|
||||||
_saveButtonCtrl ctrlCommit 0;
|
_saveButtonCtrl ctrlCommit 0;
|
||||||
};
|
};
|
||||||
|
// Default loadouts
|
||||||
case IDC_buttonDefaultLoadouts: {
|
case IDC_buttonDefaultLoadouts: {
|
||||||
_centerBoxTitleCtrl ctrlSetText (localize LSTRING(tabDefaultLoadoutsText));
|
_centerBoxTitleCtrl ctrlSetText LLSTRING(tabDefaultLoadoutsText);
|
||||||
|
|
||||||
if (is3den) then { _saveButtonCtrl ctrlSetTooltip localize LSTRING(buttonSaveTooltip); };
|
if (is3DEN) then {
|
||||||
_saveButtonCtrl ctrlEnable (is3DEN);
|
_saveButtonCtrl ctrlSetTooltip LLSTRING(buttonSaveTooltip);
|
||||||
|
};
|
||||||
|
|
||||||
|
_saveButtonCtrl ctrlEnable is3DEN;
|
||||||
_saveButtonCtrl ctrlCommit 0;
|
_saveButtonCtrl ctrlCommit 0;
|
||||||
};
|
};
|
||||||
|
// Shared loadouts
|
||||||
case IDC_buttonSharedLoadouts: {
|
case IDC_buttonSharedLoadouts: {
|
||||||
_centerBoxTitleCtrl ctrlSetText (localize LSTRING(tabSharedLoadoutsText));
|
_centerBoxTitleCtrl ctrlSetText LLSTRING(tabSharedLoadoutsText);
|
||||||
|
|
||||||
|
if (is3DEN) then {
|
||||||
|
_saveButtonCtrl ctrlSetTooltip LLSTRING(buttonSaveTooltip);
|
||||||
|
};
|
||||||
|
|
||||||
if (is3den) then { _saveButtonCtrl ctrlSetTooltip localize LSTRING(buttonSaveTooltip); };
|
|
||||||
_saveButtonCtrl ctrlEnable false;
|
_saveButtonCtrl ctrlEnable false;
|
||||||
_saveButtonCtrl ctrlCommit 0;
|
_saveButtonCtrl ctrlCommit 0;
|
||||||
};
|
};
|
||||||
@ -73,8 +82,9 @@ switch (ctrlIDC _control) do {
|
|||||||
{
|
{
|
||||||
_x ctrlEnable false;
|
_x ctrlEnable false;
|
||||||
_x ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} foreach [_shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl, _renameButtonCtrl];
|
} forEach [_shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl, _renameButtonCtrl];
|
||||||
|
|
||||||
|
// Save new tab as current tab
|
||||||
GVAR(currentLoadoutsTab) = ctrlIDC _control;
|
GVAR(currentLoadoutsTab) = ctrlIDC _control;
|
||||||
|
|
||||||
[QGVAR(loadoutsTabChanged), [_display, _control]] call CBA_fnc_localEvent;
|
[QGVAR(loadoutsTabChanged), [_display, _control]] call CBA_fnc_localEvent;
|
||||||
|
@ -19,6 +19,7 @@ params ["_display", "_message"];
|
|||||||
private _messageBoxCtrl = _display displayCtrl IDC_message;
|
private _messageBoxCtrl = _display displayCtrl IDC_message;
|
||||||
private _handle = _messageBoxCtrl getVariable QGVAR(messageBoxHandle);
|
private _handle = _messageBoxCtrl getVariable QGVAR(messageBoxHandle);
|
||||||
|
|
||||||
|
// Stop previous message being displayed
|
||||||
if (!isNil "_handle") then {
|
if (!isNil "_handle") then {
|
||||||
terminate _handle;
|
terminate _handle;
|
||||||
};
|
};
|
||||||
@ -26,29 +27,30 @@ if (!isNil "_handle") then {
|
|||||||
_handle = [_display, _messageBoxCtrl, time + 5, _message, FADE_DELAY] spawn {
|
_handle = [_display, _messageBoxCtrl, time + 5, _message, FADE_DELAY] spawn {
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
|
|
||||||
_this params ["_display", "_control", "_timer", "_message", "_delay"];
|
params ["_display", "_control", "_timer", "_message", "_delay"];
|
||||||
|
|
||||||
|
// Refresh message box, in case previous message box is still shown
|
||||||
|
_control ctrlSetText _message;
|
||||||
|
_control ctrlSetFade 1;
|
||||||
|
_control ctrlCommit 0;
|
||||||
|
|
||||||
|
_control ctrlSetFade 0;
|
||||||
|
_control ctrlCommit _delay;
|
||||||
|
|
||||||
while {_timer >= time} do {
|
while {_timer >= time} do {
|
||||||
switch true do {
|
// If the display has been closed, quit
|
||||||
case (_display isEqualTo displayNull): {
|
if (isNull _display) then {
|
||||||
terminate _thisScript;
|
terminate _thisScript;
|
||||||
};
|
|
||||||
|
|
||||||
case (round (_timer - time) == 5): {
|
|
||||||
_control ctrlSetText _message;
|
|
||||||
_control ctrlSetFade 1;
|
|
||||||
_control ctrlCommit 0;
|
|
||||||
|
|
||||||
_control ctrlSetFade 0;
|
|
||||||
_control ctrlCommit _delay;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uiSleep 1;
|
uiSleep 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hide message box and finish
|
||||||
_control ctrlSetFade 1;
|
_control ctrlSetFade 1;
|
||||||
_control ctrlCommit _delay;
|
_control ctrlCommit _delay;
|
||||||
|
|
||||||
terminate _thisScript;
|
terminate _thisScript;
|
||||||
};
|
};
|
||||||
|
|
||||||
_messageBoxCtrl setVariable [QGVAR(messageBoxHandle), _handle];
|
_messageBoxCtrl setVariable [QGVAR(messageBoxHandle), _handle];
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
* onUnLoad EH for arsenal.
|
* onUnLoad EH for arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* 0: Not used
|
||||||
|
* 1: Args <ARRAY>
|
||||||
|
* 1.0: Not used
|
||||||
|
* 1.1: Exit code <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -14,13 +17,10 @@
|
|||||||
|
|
||||||
(_this select 1) params ["", "_exitCode"];
|
(_this select 1) params ["", "_exitCode"];
|
||||||
|
|
||||||
private _cameraData = [getposAtl GVAR(camera), (getposAtl GVAR(camera)) vectorFromTo (getposAtl GVAR(cameraHelper))];
|
|
||||||
|
|
||||||
[QGVAR(displayClosed), []] call CBA_fnc_localEvent;
|
[QGVAR(displayClosed), []] call CBA_fnc_localEvent;
|
||||||
removeMissionEventHandler ["draw3D", GVAR(camPosUpdateHandle)];
|
removeMissionEventHandler ["draw3D", GVAR(camPosUpdateHandle)];
|
||||||
|
|
||||||
if (is3DEN) then {
|
if (is3DEN) then {
|
||||||
|
|
||||||
private _centerOriginParent = objectParent GVAR(centerOrigin);
|
private _centerOriginParent = objectParent GVAR(centerOrigin);
|
||||||
|
|
||||||
if !(isNull _centerOriginParent) then {
|
if !(isNull _centerOriginParent) then {
|
||||||
@ -31,11 +31,14 @@ if (is3DEN) then {
|
|||||||
|
|
||||||
// Apply the loadout from the dummy to all selected units
|
// Apply the loadout from the dummy to all selected units
|
||||||
if (_exitCode == 1) then {
|
if (_exitCode == 1) then {
|
||||||
{
|
private _extendedLoadout = GVAR(center) call CBA_fnc_getLoadout;
|
||||||
[_x, GVAR(center) call FUNC(getLoadout)] call CBA_fnc_setLoadout;
|
private _objects = get3DENSelected "object";
|
||||||
} foreach (get3DENSelected "object");
|
|
||||||
|
|
||||||
save3DENInventory (get3DENSelected "object");
|
{
|
||||||
|
[_x, _extendedLoadout] call CBA_fnc_setLoadout;
|
||||||
|
} forEach _objects;
|
||||||
|
|
||||||
|
save3DENInventory _objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteVehicle GVAR(light);
|
deleteVehicle GVAR(light);
|
||||||
@ -44,21 +47,21 @@ if (is3DEN) then {
|
|||||||
GVAR(centerOrigin) = nil;
|
GVAR(centerOrigin) = nil;
|
||||||
GVAR(light) = nil;
|
GVAR(light) = nil;
|
||||||
|
|
||||||
get3DENCamera cameraEffect ["internal","back"];
|
get3DENCamera cameraEffect ["Internal", "BACK"];
|
||||||
["ShowInterface",true] call bis_fnc_3DENInterface;
|
["ShowInterface", true] call BIS_fnc_3DENInterface;
|
||||||
GVAR(visionMode) call bis_fnc_3DENVisionMode;
|
GVAR(visionMode) call BIS_fnc_3DENVisionMode;
|
||||||
} else {
|
} else {
|
||||||
// Select correct weapon
|
// Select correct weapon
|
||||||
switch GVAR(selectedWeaponType) do {
|
switch (GVAR(selectedWeaponType)) do {
|
||||||
case 0: {GVAR(center) selectWeapon primaryWeapon GVAR(center);};
|
case 0: {GVAR(center) selectWeapon (primaryWeapon GVAR(center))};
|
||||||
case 1: {GVAR(center) selectWeapon secondaryWeapon GVAR(center);};
|
case 1: {GVAR(center) selectWeapon (secondaryWeapon GVAR(center))};
|
||||||
case 2: {GVAR(center) selectWeapon handgunWeapon GVAR(center);};
|
case 2: {GVAR(center) selectWeapon (handgunWeapon GVAR(center))};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(isnull curatorCamera) && {ACE_player == player}) then {
|
if (!isNull curatorCamera && {ACE_player == player}) then {
|
||||||
curatorcamera cameraEffect ["internal","back"];
|
curatorCamera cameraEffect ["Internal", "BACK"];
|
||||||
} else {
|
} else {
|
||||||
GVAR(camera) cameraEffect ["terminate","back"];
|
GVAR(camera) cameraEffect ["Terminate", "BACK"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,12 +83,13 @@ if (!isNull curatorCamera) then {
|
|||||||
curatorCamera setVectorDirAndUp _dirAndUp;
|
curatorCamera setVectorDirAndUp _dirAndUp;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isMultiplayer) then {
|
// Make face and voice selection JIP compatible; 3DEN doesn't need this though
|
||||||
[QGVAR(broadcastFace), [GVAR(center), GVAR(currentFace)], QGVAR(center) + "_face"] call CBA_fnc_globalEventJIP;
|
if (isMultiplayer && {!is3DEN}) then {
|
||||||
[QGVAR(center) + "_face", GVAR(center)] call CBA_fnc_removeGlobalEventJIP;
|
private _id = [QGVAR(broadcastFace), [GVAR(center), GVAR(currentFace)], QGVAR(centerFace_) + netId GVAR(center)] call CBA_fnc_globalEventJIP;
|
||||||
|
[_id, GVAR(center)] call CBA_fnc_removeGlobalEventJIP;
|
||||||
|
|
||||||
[QGVAR(broadcastVoice), [GVAR(center), GVAR(currentVoice)], QGVAR(center) + "_voice"] call CBA_fnc_globalEventJIP;
|
_id = [QGVAR(broadcastVoice), [GVAR(center), GVAR(currentVoice)], QGVAR(centerVoice_) + netId GVAR(center)] call CBA_fnc_globalEventJIP;
|
||||||
[QGVAR(center) + "_voice", GVAR(center)] call CBA_fnc_removeGlobalEventJIP;
|
[_id, GVAR(center)] call CBA_fnc_removeGlobalEventJIP;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(currentBox) = objNull;
|
GVAR(currentBox) = objNull;
|
||||||
@ -104,10 +108,12 @@ GVAR(shiftState) = nil;
|
|||||||
GVAR(leftTabFocus) = nil;
|
GVAR(leftTabFocus) = nil;
|
||||||
GVAR(rightTabFocus) = nil;
|
GVAR(rightTabFocus) = nil;
|
||||||
GVAR(rightTabLnBFocus) = nil;
|
GVAR(rightTabLnBFocus) = nil;
|
||||||
|
GVAR(ignoreFirstSortPanelCall) = nil;
|
||||||
|
|
||||||
GVAR(selectedWeaponType) = nil;
|
GVAR(selectedWeaponType) = nil;
|
||||||
GVAR(virtualItems) = nil;
|
GVAR(virtualItems) = nil;
|
||||||
GVAR(virtualItemsFlat) = nil;
|
GVAR(virtualItemsFlat) = nil;
|
||||||
|
GVAR(virtualItemsFlatAll) = nil;
|
||||||
GVAR(currentItems) = nil;
|
GVAR(currentItems) = nil;
|
||||||
GVAR(currentFace) = nil;
|
GVAR(currentFace) = nil;
|
||||||
GVAR(currentVoice) = nil;
|
GVAR(currentVoice) = nil;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* onLoad EH for arsenal.
|
* onLoad EH for arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Ignored
|
* 0: Not used
|
||||||
* 1: Arguments <ARRAY>
|
* 1: Arguments <ARRAY>
|
||||||
* 1.1: Arsenal display <DISPLAY>
|
* 1.0: Arsenal display <DISPLAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -23,7 +23,7 @@ if (isNil QGVAR(center)) then {
|
|||||||
GVAR(center) = player;
|
GVAR(center) = player;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(mouseButtonState) = [[],[]];
|
GVAR(mouseButtonState) = [[], []];
|
||||||
|
|
||||||
if (isNil QGVAR(sharedLoadoutsNamespace)) then {
|
if (isNil QGVAR(sharedLoadoutsNamespace)) then {
|
||||||
GVAR(sharedLoadoutsNamespace) = true call CBA_fnc_createNamespace;
|
GVAR(sharedLoadoutsNamespace) = true call CBA_fnc_createNamespace;
|
||||||
@ -36,171 +36,155 @@ if (isNil {GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars)})
|
|||||||
|
|
||||||
if (isNil QGVAR(defaultLoadoutsList)) then {
|
if (isNil QGVAR(defaultLoadoutsList)) then {
|
||||||
if (is3DEN) then {
|
if (is3DEN) then {
|
||||||
GVAR(defaultLoadoutsList) = (QGVAR(DummyCategory) get3DENMissionAttribute QGVAR(DefaultLoadoutsListAttribute));
|
GVAR(defaultLoadoutsList) = QGVAR(DummyCategory) get3DENMissionAttribute QGVAR(DefaultLoadoutsListAttribute);
|
||||||
} else {
|
} else {
|
||||||
GVAR(defaultLoadoutsList) = [];
|
GVAR(defaultLoadoutsList) = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isNil QGVAR(virtualItems)) then {
|
if (isNil QGVAR(virtualItems)) then {
|
||||||
GVAR(virtualItems) = [[[], [], []], [[], [], [], []], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
|
private _virtualItems = [
|
||||||
};
|
[IDX_VIRT_WEAPONS, createHashMapFromArray [[IDX_VIRT_PRIMARY_WEAPONS, createHashMap], [IDX_VIRT_SECONDARY_WEAPONS, createHashMap], [IDX_VIRT_HANDGUN_WEAPONS, createHashMap]]],
|
||||||
|
[IDX_VIRT_ATTACHMENTS, createHashMapFromArray [[IDX_VIRT_OPTICS_ATTACHMENTS, createHashMap], [IDX_VIRT_FLASHLIGHT_ATTACHMENTS, createHashMap], [IDX_VIRT_MUZZLE_ATTACHMENTS, createHashMap], [IDX_VIRT_BIPOD_ATTACHMENTS, createHashMap]]]
|
||||||
|
];
|
||||||
|
|
||||||
GVAR(currentItems) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", [], [], [], [], [], []];
|
_virtualItems = createHashMapFromArray _virtualItems;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_virtualItems set [_index, createHashMap];
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(virtualItems) = _virtualItems;
|
||||||
|
|
||||||
|
// Flatten out hashmaps for easy checking later
|
||||||
|
private _virtualItemsFlat = +_virtualItems;
|
||||||
|
private _weapons = _virtualItemsFlat deleteAt IDX_VIRT_WEAPONS;
|
||||||
|
private _attachments = _virtualItemsFlat deleteAt IDX_VIRT_ATTACHMENTS;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_virtualItemsFlat merge [_virtualItemsFlat deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_PRIMARY_WEAPONS to IDX_VIRT_HANDGUN_WEAPONS do {
|
||||||
|
_virtualItemsFlat merge [_weapons deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_OPTICS_ATTACHMENTS to IDX_VIRT_BIPOD_ATTACHMENTS do {
|
||||||
|
_virtualItemsFlat merge [_attachments deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(virtualItemsFlat) = _virtualItemsFlat;
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(currentFace) = face GVAR(center);
|
GVAR(currentFace) = face GVAR(center);
|
||||||
GVAR(currentVoice) = speaker GVAR(center);
|
GVAR(currentVoice) = speaker GVAR(center);
|
||||||
GVAR(currentInsignia) = GVAR(center) param [0, objNull, [objNull]] getVariable ["BIS_fnc_setUnitInsignia_class", ""];
|
GVAR(currentInsignia) = GVAR(center) call BIS_fnc_getUnitInsignia;
|
||||||
|
|
||||||
GVAR(currentAction) = "Stand";
|
GVAR(currentAction) = "Stand";
|
||||||
GVAR(shiftState) = false;
|
GVAR(shiftState) = false;
|
||||||
|
|
||||||
GVAR(showStats) = true;
|
GVAR(showStats) = true;
|
||||||
GVAR(statsPagesLeft) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
GVAR(statsPagesLeft) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
GVAR(statsPagesRight) = [0, 0, 0, 0, 0, 0, 0, 0];
|
GVAR(statsPagesRight) = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
GVAR(statsInfo) = [true, 0, controlNull, nil, nil];
|
GVAR(statsInfo) = [true, 0, controlNull, nil, nil];
|
||||||
|
|
||||||
// Cache assignedItems
|
|
||||||
private _assignedItems = (getUnitLoadout GVAR(center)) select 9;
|
|
||||||
|
|
||||||
// Add the items the player has to virtualItems
|
// Add the items the player has to virtualItems
|
||||||
for "_index" from 0 to 14 do {
|
|
||||||
switch (_index) do {
|
|
||||||
// primary, secondary, handgun weapons
|
|
||||||
case IDX_VIRT_WEAPONS: {
|
|
||||||
private _array = LIST_DEFAULTS select _index;
|
|
||||||
|
|
||||||
if ((_array select 0) isNotEqualTo "") then {
|
|
||||||
((GVAR(virtualItems) select _index) select 0) pushBackUnique (_array select 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((_array select 1) isNotEqualTo "") then {
|
|
||||||
((GVAR(virtualItems) select _index) select 1) pushBackUnique (_array select 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((_array select 2) isNotEqualTo "") then {
|
|
||||||
((GVAR(virtualItems) select _index) select 2) pushBackUnique (_array select 2);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Accs for the weapons above
|
|
||||||
case IDX_VIRT_ATTACHEMENTS: {
|
|
||||||
private _array = LIST_DEFAULTS select _index;
|
|
||||||
_array params ["_accsArray", "_magsArray"];
|
|
||||||
|
|
||||||
{
|
|
||||||
private _subIndex = _forEachIndex;
|
|
||||||
|
|
||||||
{
|
|
||||||
if (_x != "") then {
|
|
||||||
(GVAR(virtualItems) select _index) select ([2, 1, 0, 3] select _forEachIndex) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
} forEach _x;
|
|
||||||
} forEach _accsArray;
|
|
||||||
|
|
||||||
{
|
|
||||||
if (_x isNotEqualTo []) then {
|
|
||||||
|
|
||||||
if (_x select 0 != "") then {
|
|
||||||
(GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL) pushBackUnique (_x select 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (count _x > 1 && {_x select 1 != ""}) then {
|
|
||||||
(GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL) pushBackUnique (_x select 1);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _magsArray;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Assigned items
|
|
||||||
case IDX_VIRT_MAP: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 0) };
|
|
||||||
case IDX_VIRT_COMMS: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 1) };
|
|
||||||
case IDX_VIRT_RADIO: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 2) };
|
|
||||||
case IDX_VIRT_COMPASS: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 3) };
|
|
||||||
case IDX_VIRT_WATCH: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 4) };
|
|
||||||
|
|
||||||
|
|
||||||
// Inventory items
|
|
||||||
case IDX_VIRT_ITEMS_ALL: {
|
|
||||||
call FUNC(updateUniqueItemsList);
|
|
||||||
};
|
|
||||||
|
|
||||||
// The rest
|
|
||||||
default {
|
|
||||||
private _array = (LIST_DEFAULTS select _index) select {_x isNotEqualTo ""};
|
|
||||||
if (_array isNotEqualTo []) then {
|
|
||||||
{(GVAR(virtualItems) select _index) pushBackUnique _x} forEach _array;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Fill current items
|
|
||||||
for "_index" from 0 to 15 do {
|
|
||||||
switch (_index) do {
|
|
||||||
case 0;
|
|
||||||
case 1;
|
|
||||||
case 2:{
|
|
||||||
GVAR(currentItems) set [_index, ((LIST_DEFAULTS select 0) select _index)];
|
|
||||||
};
|
|
||||||
case 3;
|
|
||||||
case 4;
|
|
||||||
case 5;
|
|
||||||
case 6;
|
|
||||||
case 7;
|
|
||||||
case 8;
|
|
||||||
case 9: {
|
|
||||||
GVAR(currentItems) set [_index, (LIST_DEFAULTS select _index) select 0];
|
|
||||||
|
|
||||||
};
|
|
||||||
case 10: {
|
|
||||||
{(GVAR(currentItems) select 15) pushBack _x} forEach (uniformItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 11: {
|
|
||||||
{(GVAR(currentItems) select 16) pushBack _x} forEach (vestItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 12: {
|
|
||||||
{(GVAR(currentItems) select 17) pushBack _x} forEach (backpackItems GVAR(center));
|
|
||||||
};
|
|
||||||
case 13: {
|
|
||||||
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + (primaryWeaponMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
case 14: {
|
|
||||||
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + (secondaryWeaponMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
case 15: {
|
|
||||||
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + (handgunMagazine GVAR(center))];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
{
|
||||||
switch (_forEachIndex) do {
|
switch (_forEachIndex) do {
|
||||||
case 0: { // Map
|
// Primary weapon, Secondary weapon, Handgun weapon, Binoculars
|
||||||
GVAR(currentItems) set [10, _x];
|
case IDX_LOADOUT_PRIMARY_WEAPON;
|
||||||
|
case IDX_LOADOUT_SECONDARY_WEAPON;
|
||||||
|
case IDX_LOADOUT_HANDGUN_WEAPON;
|
||||||
|
case IDX_LOADOUT_BINO: {
|
||||||
|
_x params [["_weapon", ""], ["_muzzle", ""], ["_flashlight", ""], ["_optics", ""], ["_primaryMagazine", []], ["_secondaryMagazine", []], ["_bipod", ""]];
|
||||||
|
|
||||||
|
// Add weapon
|
||||||
|
if (_weapon != "") then {
|
||||||
|
_weapon = _weapon call FUNC(baseWeapon);
|
||||||
|
|
||||||
|
// If bino, add it in a different place than regular weapons
|
||||||
|
if (_forEachIndex != IDX_LOADOUT_BINO) then {
|
||||||
|
((GVAR(virtualItems) get IDX_VIRT_WEAPONS) get _forEachIndex) set [_weapon, nil];
|
||||||
|
} else {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_BINO) set [_weapon, nil];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add weapon attachments
|
||||||
|
{
|
||||||
|
if (_x != "") then {
|
||||||
|
((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get _forEachIndex) set [_x call FUNC(baseWeapon), nil];
|
||||||
|
};
|
||||||
|
} forEach [_optics, _flashlight, _muzzle, _bipod];
|
||||||
|
|
||||||
|
// Add magazines
|
||||||
|
{
|
||||||
|
// Check if there is a magazine (ammo count is unnecssary to check)
|
||||||
|
if ((_x param [0, ""]) != "") then {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL) set [_x select 0, nil];
|
||||||
|
};
|
||||||
|
} forEach [_primaryMagazine, _secondaryMagazine];
|
||||||
};
|
};
|
||||||
case 1: { // GPS
|
|
||||||
GVAR(currentItems) set [14, _x];
|
// Uniform, vest, backpack
|
||||||
|
case IDX_LOADOUT_UNIFORM;
|
||||||
|
case IDX_LOADOUT_VEST;
|
||||||
|
case IDX_LOADOUT_BACKPACK: {
|
||||||
|
_x params [["_containerClass", ""]];
|
||||||
|
|
||||||
|
if (_containerClass != "") then {
|
||||||
|
(GVAR(virtualItems) get (_forEachIndex + 1)) set [_containerClass, nil];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
case 2: { // Radio
|
// Helmet
|
||||||
GVAR(currentItems) set [12, _x];
|
case IDX_LOADOUT_HEADGEAR: {
|
||||||
|
if (_x != "") then {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_HEADGEAR) set [_x, nil];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
case 3: { // Compass
|
// Facewear
|
||||||
GVAR(currentItems) set [11, _x];
|
case IDX_LOADOUT_GOGGLES: {
|
||||||
|
if (_x != "") then {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_GOGGLES) set [_x, nil];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
case 4: { // Watch
|
// Assigned items: Map, Compass, Watch, GPS / UAV Terminal, Radio, NVGs
|
||||||
GVAR(currentItems) set [13, _x];
|
case IDX_LOADOUT_ASSIGNEDITEMS: {
|
||||||
|
{
|
||||||
|
// Order of storing virtualItems is different than what getUnitLoadout returns, so do some math
|
||||||
|
if (_x != "") then {
|
||||||
|
(GVAR(virtualItems) get (IDX_VIRT_NVG + ([2, 6, 4, 3, 5, 0] select _forEachIndex))) set [_x, nil];
|
||||||
|
};
|
||||||
|
} forEach _x;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach _assignedItems;
|
} forEach (getUnitLoadout GVAR(center)); // Only need items, not extended loadout
|
||||||
|
|
||||||
GVAR(currentWeaponType) = switch true do {
|
// Get a list of all virtual items, including single panel items that are unique
|
||||||
case (currentWeapon GVAR(center) == GVAR(currentItems) select 0): {0};
|
private _virtualItemsFlat = +GVAR(virtualItems);
|
||||||
case (currentWeapon GVAR(center) == GVAR(currentItems) select 1): {1};
|
private _weapons = _virtualItemsFlat deleteAt IDX_VIRT_WEAPONS;
|
||||||
case (currentWeapon GVAR(center) == GVAR(currentItems) select 2): {2};
|
private _attachments = _virtualItemsFlat deleteAt IDX_VIRT_ATTACHMENTS;
|
||||||
default {-1};
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_virtualItemsFlat merge [_virtualItemsFlat deleteAt _index, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_PRIMARY_WEAPONS to IDX_VIRT_HANDGUN_WEAPONS do {
|
||||||
|
_virtualItemsFlat merge [_weapons deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_OPTICS_ATTACHMENTS to IDX_VIRT_BIPOD_ATTACHMENTS do {
|
||||||
|
_virtualItemsFlat merge [_attachments deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(virtualItemsFlatAll) = _virtualItemsFlat;
|
||||||
|
|
||||||
|
// Update current item list
|
||||||
|
call FUNC(updateCurrentItemsList);
|
||||||
|
|
||||||
|
// This takes care of items that aren't available in the arsenal (either wrong tab or arsenal doesn't have it whitelisted)
|
||||||
|
call FUNC(updateUniqueItemsList);
|
||||||
|
|
||||||
[QGVAR(displayOpened), [_display]] call CBA_fnc_localEvent;
|
[QGVAR(displayOpened), [_display]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
//--------------- Fade out unused elements
|
//--------------- Fade out unused elements
|
||||||
@ -250,7 +234,7 @@ if (isMultiplayer) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//--------------- Camera prep
|
//--------------- Camera prep
|
||||||
cutText ["","plain"];
|
cutText ["", "PLAIN"];
|
||||||
showCommandingMenu "";
|
showCommandingMenu "";
|
||||||
|
|
||||||
GVAR(cameraView) = cameraView;
|
GVAR(cameraView) = cameraView;
|
||||||
@ -260,73 +244,71 @@ GVAR(center) switchCamera "internal";
|
|||||||
private _mouseAreaCtrl = _display displayCtrl IDC_mouseArea;
|
private _mouseAreaCtrl = _display displayCtrl IDC_mouseArea;
|
||||||
ctrlSetFocus _mouseAreaCtrl;
|
ctrlSetFocus _mouseAreaCtrl;
|
||||||
|
|
||||||
|
private _centerPos = position GVAR(center);
|
||||||
|
|
||||||
// 3DEN support, lifted from BIS_fnc_arsenal
|
// 3DEN support, lifted from BIS_fnc_arsenal
|
||||||
if (is3DEN) then {
|
if (is3DEN) then {
|
||||||
|
|
||||||
GVAR(centerOrigin) = GVAR(center);
|
GVAR(centerOrigin) = GVAR(center);
|
||||||
GVAR(centerOrigin) hideObject true;
|
GVAR(centerOrigin) hideObject true;
|
||||||
|
|
||||||
private _centerOriginParent = objectParent GVAR(centerOrigin);
|
private _centerOriginParent = objectParent GVAR(centerOrigin);
|
||||||
|
|
||||||
if !(isNull _centerOriginParent) then {
|
if !(isNull _centerOriginParent) then {
|
||||||
_centerOriginParent hideObject true;
|
_centerOriginParent hideObject true;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _centerPos = position GVAR(centerOrigin);
|
GVAR(center) = createAgent [typeOf GVAR(centerOrigin), _centerPos, [], 0, "none"];
|
||||||
|
GVAR(center) setPosATL getPosATL GVAR(centerOrigin);
|
||||||
GVAR(center) = createAgent [typeOf GVAR(centerOrigin), position GVAR(centerOrigin), [], 0, "none"];
|
|
||||||
GVAR(center) setPosAtl getPosAtl GVAR(centerOrigin);
|
|
||||||
GVAR(center) setDir (getDir GVAR(centerOrigin));
|
GVAR(center) setDir (getDir GVAR(centerOrigin));
|
||||||
GVAR(center) switchMove animationState GVAR(centerOrigin);
|
GVAR(center) switchMove animationState GVAR(centerOrigin);
|
||||||
GVAR(center) switchAction "playerstand";
|
GVAR(center) switchAction "playerStand";
|
||||||
GVAR(center) enableSimulation false;
|
GVAR(center) enableSimulation false;
|
||||||
|
|
||||||
GVAR(center) setUnitLoadout (getUnitLoadout GVAR(centerOrigin));
|
[GVAR(center), GVAR(centerOrigin) call CBA_fnc_getLoadout] call CBA_fnc_setLoadout;
|
||||||
GVAR(center) setFace GVAR(currentFace);
|
|
||||||
GVAR(center) setSpeaker GVAR(currentVoice);
|
|
||||||
|
|
||||||
//--- Create light for night editing (code based on BIS_fnc_3DENFlashlight)
|
//--- Create light for night editing (code based on BIS_fnc_3DENFlashlight)
|
||||||
private _intensity = 1;
|
|
||||||
GVAR(light) = "#lightpoint" createVehicle _centerPos;
|
GVAR(light) = "#lightpoint" createVehicle _centerPos;
|
||||||
GVAR(light) setLightBrightness _intensity;
|
GVAR(light) setLightBrightness 1;
|
||||||
GVAR(light) setLightAmbient [1,1,1];
|
GVAR(light) setLightAmbient [1, 1, 1];
|
||||||
GVAR(light) setLightColor [0,0,0];
|
GVAR(light) setLightColor [0, 0, 0];
|
||||||
GVAR(light) lightAttachObject [GVAR(centerOrigin), [0, 0, -_intensity * 7]];
|
GVAR(light) lightAttachObject [GVAR(centerOrigin), [0, 0, -7]];
|
||||||
|
|
||||||
//--- Use the same vision mode as in Eden
|
//--- Use the same vision mode as in Eden
|
||||||
GVAR(visionMode)= -2 call bis_fnc_3DENVisionMode;
|
GVAR(visionMode) = -2 call BIS_fnc_3DENVisionMode;
|
||||||
["ShowInterface",false] spawn bis_fnc_3DENInterface;
|
["ShowInterface", false] spawn BIS_fnc_3DENInterface;
|
||||||
if (get3denactionstate "togglemap" > 0) then {do3DENAction "togglemap";};
|
|
||||||
|
if (get3DENActionState "toggleMap" > 0) then {
|
||||||
|
do3DENAction "toggleMap";
|
||||||
|
};
|
||||||
|
|
||||||
|
private _ctrl = controlNull;
|
||||||
|
|
||||||
{
|
{
|
||||||
private _ctrl = _display displayctrl _x;
|
_ctrl = _display displayCtrl _x;
|
||||||
|
|
||||||
_ctrl ctrlEnable false;
|
_ctrl ctrlEnable false;
|
||||||
_ctrl ctrlSetFade 0.6;
|
_ctrl ctrlSetFade 0.6;
|
||||||
_ctrl ctrlCommit 0;
|
_ctrl ctrlCommit 0;
|
||||||
} forEach [
|
} forEach [IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsignia];
|
||||||
IDC_buttonFace,
|
|
||||||
IDC_buttonVoice,
|
|
||||||
IDC_buttonInsignia
|
|
||||||
];
|
|
||||||
|
|
||||||
_buttonCloseCtrl = _display displayCtrl IDC_menuBarClose;
|
_buttonCloseCtrl = _display displayCtrl IDC_menuBarClose;
|
||||||
_buttonCloseCtrl ctrlSetText (localize "str_ui_debug_but_apply");
|
_buttonCloseCtrl ctrlSetText (localize "str_ui_debug_but_apply");
|
||||||
} else {
|
} else {
|
||||||
GVAR(centerNotPlayer) = (GVAR(center) != player);
|
GVAR(centerNotPlayer) = GVAR(center) != player;
|
||||||
|
|
||||||
if (currentVisionMode ACE_Player == 1) then {
|
if (currentVisionMode ACE_Player == 1) then {
|
||||||
GVAR(center) action ["NVGogglesOff", GVAR(center)];
|
GVAR(center) action ["NVGogglesOff", GVAR(center)];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _ctrl = controlNull;
|
||||||
|
|
||||||
{
|
{
|
||||||
private _ctrl = _display displayCtrl _x;
|
_ctrl = _display displayCtrl _x;
|
||||||
|
|
||||||
_ctrl ctrlEnable GVAR(enableIdentityTabs);
|
_ctrl ctrlEnable GVAR(enableIdentityTabs);
|
||||||
_ctrl ctrlSetFade ([0.6, 0] select GVAR(enableIdentityTabs));
|
_ctrl ctrlSetFade ([0.6, 0] select GVAR(enableIdentityTabs));
|
||||||
_ctrl ctrlCommit 0;
|
_ctrl ctrlCommit 0;
|
||||||
} forEach [
|
} forEach [IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsignia];
|
||||||
IDC_buttonFace,
|
|
||||||
IDC_buttonVoice,
|
|
||||||
IDC_buttonInsignia
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------- Prepare the left panel
|
//--------------- Prepare the left panel
|
||||||
@ -337,6 +319,7 @@ GVAR(rightSearchbarFocus) = false;
|
|||||||
GVAR(leftTabFocus) = false;
|
GVAR(leftTabFocus) = false;
|
||||||
GVAR(rightTabFocus) = false;
|
GVAR(rightTabFocus) = false;
|
||||||
GVAR(rightTabLnBFocus) = false;
|
GVAR(rightTabLnBFocus) = false;
|
||||||
|
GVAR(ignoreFirstSortPanelCall) = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
private _panel = _display displayCtrl _x;
|
private _panel = _display displayCtrl _x;
|
||||||
@ -348,26 +331,28 @@ GVAR(rightTabLnBFocus) = false;
|
|||||||
|
|
||||||
//--------------- Init camera
|
//--------------- Init camera
|
||||||
if (isNil QGVAR(cameraPosition)) then {
|
if (isNil QGVAR(cameraPosition)) then {
|
||||||
GVAR(cameraPosition) = [5,0,0,[0,0,0.85]];
|
GVAR(cameraPosition) = [5, 0, 0, [0, 0, 0.85]];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save curator camera state so camera position and direction are not modified while using arsenal
|
// Save curator camera state so camera position and direction are not modified while using arsenal
|
||||||
if (!isNull curatorCamera) then {
|
private _curatorCamera = curatorCamera;
|
||||||
GVAR(curatorCameraData) = [getPosASL curatorCamera, [vectorDir curatorCamera, vectorUp curatorCamera]];
|
|
||||||
|
if (!isNull _curatorCamera) then {
|
||||||
|
GVAR(curatorCameraData) = [getPosASL _curatorCamera, [vectorDir _curatorCamera, vectorUp _curatorCamera]];
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(cameraHelper) = createAgent ["Logic", position GVAR(center) ,[] ,0 ,"none"];
|
GVAR(cameraHelper) = createAgent ["Logic", _centerPos, [], 0, "none"];
|
||||||
GVAR(cameraHelper) attachTo [GVAR(center), GVAR(cameraPosition) select 3, ""];
|
GVAR(cameraHelper) attachTo [GVAR(center), GVAR(cameraPosition) select 3, ""];
|
||||||
|
|
||||||
GVAR(camera) = "camera" camCreate position GVAR(center);
|
GVAR(camera) = "camera" camCreate _centerPos;
|
||||||
GVAR(camera) cameraEffect ["internal","back"];
|
GVAR(camera) cameraEffect ["internal", "back"];
|
||||||
GVAR(camera) camPrepareFocus [-1,-1];
|
GVAR(camera) camPrepareFocus [-1, -1];
|
||||||
GVAR(camera) camPrepareFov 0.35;
|
GVAR(camera) camPrepareFov 0.35;
|
||||||
GVAR(camera) camCommitPrepared 0;
|
GVAR(camera) camCommitPrepared 0;
|
||||||
|
|
||||||
showCinemaBorder false;
|
showCinemaBorder false;
|
||||||
["#(argb,8,8,3)color(0,0,0,1)",false,nil,0,[0,0.5]] call bis_fnc_textTiles;
|
["#(argb,8,8,3)color(0,0,0,1)", false, nil, 0, [0, 0.5]] call BIS_fnc_textTiles;
|
||||||
|
|
||||||
//--------------- Reset camera pos
|
//--------------- Reset camera pos
|
||||||
[nil, [controlNull,0,0]] call FUNC(handleMouse);
|
[nil, [controlNull, 0, 0]] call FUNC(handleMouse);
|
||||||
GVAR(camPosUpdateHandle) = addMissionEventHandler ["draw3D",{ [] call FUNC(updateCamPos) }];
|
GVAR(camPosUpdateHandle) = addMissionEventHandler ["draw3D", {call FUNC(updateCamPos)}];
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Handles keyboard inputs in arsenal.
|
* Handles keyboard inputs in arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Arsenal display <DISPLAY>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Key being pressed <SCALAR>
|
* 1: Key being pressed <NUMBER>
|
||||||
* 2: Shift state <BOOL>
|
* 2: Shift state <BOOL>
|
||||||
* 3: Ctrl state <BOOL>
|
* 3: Ctrl state <BOOL>
|
||||||
* 4: Alt state <BOOL>
|
* 4: Alt state <BOOL>
|
||||||
@ -25,12 +25,14 @@ GVAR(shiftState) = _shiftState;
|
|||||||
private _return = true;
|
private _return = true;
|
||||||
private _loadoutsDisplay = findDisplay IDD_loadouts_display;
|
private _loadoutsDisplay = findDisplay IDD_loadouts_display;
|
||||||
|
|
||||||
if (_loadoutsDisplay isNotEqualTo displayNull) then {
|
// If in loadout screen
|
||||||
if !(GVAR(loadoutsSearchbarFocus)) then {
|
if (!isNull _loadoutsDisplay) then {
|
||||||
switch true do {
|
// If loadout search bar isn't focussed
|
||||||
|
if (!GVAR(loadoutsSearchbarFocus)) then {
|
||||||
|
switch (true) do {
|
||||||
// Close button
|
// Close button
|
||||||
case (_keyPressed == DIK_ESCAPE): {
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
_display closeDisplay 2;
|
_display closeDisplay IDC_CANCEL;
|
||||||
};
|
};
|
||||||
// Search field
|
// Search field
|
||||||
case (_keyPressed == DIK_F && {_ctrlState}): {
|
case (_keyPressed == DIK_F && {_ctrlState}): {
|
||||||
@ -38,48 +40,37 @@ if (_loadoutsDisplay isNotEqualTo displayNull) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
switch true do {
|
// If loadout search bar is focussed
|
||||||
|
switch (true) do {
|
||||||
|
// Close button
|
||||||
case (_keyPressed == DIK_ESCAPE): {
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
_display closeDisplay 2;
|
_display closeDisplay IDC_CANCEL;
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_BACKSPACE): {
|
|
||||||
_return = false;
|
|
||||||
};
|
};
|
||||||
|
// Search
|
||||||
case (_keyPressed == DIK_NUMPADENTER);
|
case (_keyPressed == DIK_NUMPADENTER);
|
||||||
case (_keyPressed == DIK_RETURN): {
|
case (_keyPressed == DIK_RETURN): {
|
||||||
[_loadoutsDisplay, _loadoutsDisplay displayCtrl IDC_loadoutsSearchbar] call FUNC(handleLoadoutsSearchBar);
|
[_loadoutsDisplay, _loadoutsDisplay displayCtrl IDC_loadoutsSearchbar] call FUNC(handleLoadoutsSearchBar);
|
||||||
};
|
};
|
||||||
|
case (_keyPressed == DIK_BACKSPACE);
|
||||||
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
|
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
switch true do {
|
switch (true) do {
|
||||||
case (_keyPressed == DIK_C && {_ctrlState}): {
|
case (_keyPressed in [DIK_C, DIK_V, DIK_A, DIK_X] && {_ctrlState});
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_V && {_ctrlState}): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_A && {_ctrlState}): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_X && {_ctrlState}): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (GVAR(loadoutsPanelFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}): {
|
case (GVAR(loadoutsPanelFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}): {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
// If in arsenal and no search bar is selected
|
||||||
if (!GVAR(leftSearchbarFocus) && {!GVAR(rightSearchbarFocus)}) then {
|
if (!GVAR(leftSearchbarFocus) && {!GVAR(rightSearchbarFocus)}) then {
|
||||||
|
switch (true) do {
|
||||||
switch true do {
|
|
||||||
// Close button
|
// Close button
|
||||||
case (_keyPressed == DIK_ESCAPE): {
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
_display closeDisplay 2;
|
_display closeDisplay IDC_CANCEL;
|
||||||
};
|
};
|
||||||
// Hide button
|
// Hide button
|
||||||
case (_keyPressed == DIK_BACKSPACE): {
|
case (_keyPressed == DIK_BACKSPACE): {
|
||||||
@ -88,7 +79,7 @@ if (_loadoutsDisplay isNotEqualTo displayNull) then {
|
|||||||
// Export button / export classname
|
// Export button / export classname
|
||||||
case (_keyPressed == DIK_C && {_ctrlState}): {
|
case (_keyPressed == DIK_C && {_ctrlState}): {
|
||||||
if (GVAR(leftTabFocus) || {GVAR(rightTabFocus)} || {GVAR(rightTabLnBFocus)}) then {
|
if (GVAR(leftTabFocus) || {GVAR(rightTabFocus)} || {GVAR(rightTabLnBFocus)}) then {
|
||||||
switch true do {
|
switch (true) do {
|
||||||
case (GVAR(leftTabFocus)): {
|
case (GVAR(leftTabFocus)): {
|
||||||
private _control = (_display displayCtrl IDC_leftTabContent);
|
private _control = (_display displayCtrl IDC_leftTabContent);
|
||||||
_control lbData (lbCurSel _control)
|
_control lbData (lbCurSel _control)
|
||||||
@ -99,14 +90,14 @@ if (_loadoutsDisplay isNotEqualTo displayNull) then {
|
|||||||
};
|
};
|
||||||
case (GVAR(rightTabLnBFocus)): {
|
case (GVAR(rightTabLnBFocus)): {
|
||||||
private _control = (_display displayCtrl IDC_rightTabContentListnBox);
|
private _control = (_display displayCtrl IDC_rightTabContentListnBox);
|
||||||
_control lnbData [(lnbCurSelRow _control), 0]
|
_control lnbData [lnbCurSelRow _control, 0]
|
||||||
};
|
};
|
||||||
} params ["_className"];
|
} params ["_className"];
|
||||||
|
|
||||||
"ace_clipboard" callExtension (_className + ";");
|
"ace_clipboard" callExtension (_className + ";");
|
||||||
"ace_clipboard" callExtension "--COMPLETE--";
|
"ace_clipboard" callExtension "--COMPLETE--";
|
||||||
|
|
||||||
[_display, localize LSTRING(exportedClassnameText)] call FUNC(message);
|
[_display, LLSTRING(exportedClassnameText)] call FUNC(message);
|
||||||
} else {
|
} else {
|
||||||
[_display] call FUNC(buttonExport);
|
[_display] call FUNC(buttonExport);
|
||||||
};
|
};
|
||||||
@ -115,36 +106,37 @@ if (_loadoutsDisplay isNotEqualTo displayNull) then {
|
|||||||
case (_keyPressed == DIK_V && {_ctrlState}): {
|
case (_keyPressed == DIK_V && {_ctrlState}): {
|
||||||
[_display] call FUNC(buttonImport);
|
[_display] call FUNC(buttonImport);
|
||||||
};
|
};
|
||||||
// Search fields
|
// Focus search
|
||||||
case (_keyPressed == DIK_F && {_ctrlState}): {
|
case (_keyPressed == DIK_F && {_ctrlState}): {
|
||||||
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
||||||
};
|
};
|
||||||
// Switch vision mode
|
// Switch vision mode
|
||||||
case (_keyPressed in (actionkeys "nightvision")): {
|
case (_keyPressed in (actionKeys "nightvision")): {
|
||||||
if (isNil QGVAR(visionMode)) then {
|
if (isNil QGVAR(visionMode)) then {
|
||||||
GVAR(visionMode) = 0;
|
GVAR(visionMode) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(visionMode) = (GVAR(visionMode) + 1) % 3;
|
GVAR(visionMode) = (GVAR(visionMode) + 1) % 3;
|
||||||
|
|
||||||
switch GVAR(visionMode) do {
|
switch (GVAR(visionMode)) do {
|
||||||
//--- Normal
|
// Normal
|
||||||
case 0: {
|
case 0: {
|
||||||
camusenvg false;
|
camUseNVG false;
|
||||||
false setCamUseTi 0;
|
false setCamUseTI 0;
|
||||||
};
|
};
|
||||||
//--- NVG
|
// NVG
|
||||||
case 1: {
|
case 1: {
|
||||||
camusenvg true;
|
camUseNVG true;
|
||||||
false setCamUseTi 0;
|
false setCamUseTI 0;
|
||||||
};
|
};
|
||||||
//--- TI
|
// TI
|
||||||
default {
|
default {
|
||||||
camusenvg false;
|
camUseNVG false;
|
||||||
true setCamUseTi 0;
|
true setCamUseTI 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
playsound ["RscDisplayCurator_visionMode",true];
|
playSound ["RscDisplayCurator_visionMode", true];
|
||||||
};
|
};
|
||||||
// Panel up down
|
// Panel up down
|
||||||
case (_keyPressed in [DIK_UP, DIK_DOWN]): {
|
case (_keyPressed in [DIK_UP, DIK_DOWN]): {
|
||||||
@ -160,38 +152,29 @@ if (_loadoutsDisplay isNotEqualTo displayNull) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
switch true do {
|
// If in arsenal and a search bar is selected
|
||||||
|
switch (true) do {
|
||||||
|
// Close button
|
||||||
case (_keyPressed == DIK_ESCAPE): {
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
_display closeDisplay 2;
|
_display closeDisplay IDC_CANCEL;
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_BACKSPACE): {
|
|
||||||
_return = false;
|
|
||||||
};
|
};
|
||||||
|
// Search
|
||||||
case (_keyPressed == DIK_NUMPADENTER);
|
case (_keyPressed == DIK_NUMPADENTER);
|
||||||
case (_keyPressed == DIK_RETURN): {
|
case (_keyPressed == DIK_RETURN): {
|
||||||
if (GVAR(leftSearchbarFocus)) then {
|
if (GVAR(leftSearchbarFocus)) then {
|
||||||
[_display, _display displayCtrl IDC_leftSearchbar] call FUNC(handleSearchBar);
|
[_display, _display displayCtrl IDC_leftSearchbar] call FUNC(handleSearchBar);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(rightSearchbarFocus)) then {
|
if (GVAR(rightSearchbarFocus)) then {
|
||||||
[_display, _display displayCtrl IDC_rightSearchbar] call FUNC(handleSearchBar);
|
[_display, _display displayCtrl IDC_rightSearchbar] call FUNC(handleSearchBar);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
|
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]);
|
||||||
|
case (_keyPressed == DIK_BACKSPACE);
|
||||||
|
case (_keyPressed in [DIK_C, DIK_V, DIK_A, DIK_X] && {_ctrlState}): {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
case (_keyPressed == DIK_C && {_ctrlState}): {
|
// Focus search fields
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_V && {_ctrlState}): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_A && {_ctrlState}): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_X && {_ctrlState}): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
// Search fields
|
|
||||||
case (_keyPressed == DIK_F && {_ctrlState}): {
|
case (_keyPressed == DIK_F && {_ctrlState}): {
|
||||||
if (GVAR(rightSearchbarFocus)) then {
|
if (GVAR(rightSearchbarFocus)) then {
|
||||||
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
||||||
|
@ -14,13 +14,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GVAR(currentLoadoutsTab) = nil;
|
GVAR(currentLoadoutsTab) = nil;
|
||||||
|
|
||||||
private _arsenalDisplay = findDisplay IDD_ace_arsenal;
|
|
||||||
private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
|
|
||||||
|
|
||||||
GVAR(loadoutsSearchbarFocus) = nil;
|
GVAR(loadoutsSearchbarFocus) = nil;
|
||||||
GVAR(loadoutsPanelFocus) = nil;
|
GVAR(loadoutsPanelFocus) = nil;
|
||||||
|
|
||||||
|
private _arsenalDisplay = findDisplay IDD_ace_arsenal;
|
||||||
|
private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
|
||||||
_mouseBlockCtrl ctrlEnable false;
|
_mouseBlockCtrl ctrlEnable false;
|
||||||
_mouseBlockCtrl ctrlCommit 0;
|
_mouseBlockCtrl ctrlCommit 0;
|
||||||
|
|
||||||
@ -28,4 +26,4 @@ _mouseBlockCtrl ctrlCommit 0;
|
|||||||
|
|
||||||
[QGVAR(loadoutsDisplayClosed), []] call CBA_fnc_localEvent;
|
[QGVAR(loadoutsDisplayClosed), []] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
[_arsenalDisplay , _arsenalDisplay displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
[_arsenalDisplay, _arsenalDisplay displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
* onLoad EH for arsenal loadouts display.
|
* onLoad EH for arsenal loadouts display.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Ignored
|
* 0: Not used
|
||||||
* 1: Arguments <ARRAY>
|
* 1: Arguments <ARRAY>
|
||||||
* 1.1: Loadouts display <DISPLAY>
|
* 1.0: Loadouts display <DISPLAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -34,6 +34,7 @@ private _panelContentCtrl = _display displayCtrl IDC_contentPanel;
|
|||||||
_panelContentCtrl ctrlSetFontHeight (4.5 * GRID_H);
|
_panelContentCtrl ctrlSetFontHeight (4.5 * GRID_H);
|
||||||
_panelContentCtrl ctrlCommit 0;
|
_panelContentCtrl ctrlCommit 0;
|
||||||
|
|
||||||
|
// If default loadouts are disabled, disable button
|
||||||
if !(GVAR(allowDefaultLoadouts)) then {
|
if !(GVAR(allowDefaultLoadouts)) then {
|
||||||
private _buttonDefaultLoadoutsCtrl = _display displayCtrl IDC_buttonDefaultLoadouts;
|
private _buttonDefaultLoadoutsCtrl = _display displayCtrl IDC_buttonDefaultLoadouts;
|
||||||
_buttonDefaultLoadoutsCtrl ctrlEnable false;
|
_buttonDefaultLoadoutsCtrl ctrlEnable false;
|
||||||
@ -44,6 +45,7 @@ if !(GVAR(allowDefaultLoadouts)) then {
|
|||||||
_buttonDefaultLoadoutsBackgroundCtrl ctrlCommit 0;
|
_buttonDefaultLoadoutsBackgroundCtrl ctrlCommit 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If shared loadouts are disabled or it's singleplayer, disable button
|
||||||
if !(GVAR(allowSharedLoadouts) && {isMultiplayer}) then {
|
if !(GVAR(allowSharedLoadouts) && {isMultiplayer}) then {
|
||||||
private _buttonShareLoadoutsCtrl = _display displayCtrl IDC_buttonSharedLoadouts;
|
private _buttonShareLoadoutsCtrl = _display displayCtrl IDC_buttonSharedLoadouts;
|
||||||
_buttonShareLoadoutsCtrl ctrlEnable false;
|
_buttonShareLoadoutsCtrl ctrlEnable false;
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Handles mouse button press.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Not used
|
||||||
|
* 1: Args <ARRAY>
|
||||||
|
* 1.0: Not used
|
||||||
|
* 1.1: Mouse button <NUMBER>
|
||||||
|
* 1.2: Mouse X position <NUMBER>
|
||||||
|
* 1.3: Mouse Y position <NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Handles mouse button release.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Not used
|
||||||
|
* 1: Args <ARRAY>
|
||||||
|
* 1.0: Not used
|
||||||
|
* 1.1: Mouse button <NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
|
#include "\a3\ui_f\hpp\defineResincl.inc"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Handles selection changes on the left panel.
|
* Handles selection changes on the left panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Left panel control <CONTROL>
|
* 0: Left panel control <CONTROL>
|
||||||
* 1: Left panel selection <SCALAR>
|
* 1: Left panel selection <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -18,429 +19,678 @@ params ["_control", "_curSel"];
|
|||||||
|
|
||||||
if (_curSel < 0) exitwith {};
|
if (_curSel < 0) exitwith {};
|
||||||
|
|
||||||
private _ctrlIDC = ctrlIDC _control;
|
|
||||||
private _display = ctrlParent _control;
|
private _display = ctrlParent _control;
|
||||||
private _item = [_control lnbData [_curSel, 0], _control lbData _curSel] select !(ctrlType _control == 102);
|
private _item = [_control lbData _curSel, _control lnbData [_curSel, 0]] select (ctrlType _control == CT_LISTNBOX);
|
||||||
|
|
||||||
private _weaponDefaultRightPanel = _display displayCtrl IDC_buttonOptic;
|
// When having chosen a new category, see if the current right panel can be kept open, otherwise take default
|
||||||
private _selectCorrectPanelWeapon = [_weaponDefaultRightPanel, _display displayCtrl GVAR(currentRightPanel)] select (!isNil QGVAR(currentRightPanel) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ACC_IDCS, IDC_buttonCurrentMag, IDC_buttonCurrentMag2]});
|
private _selectCorrectPanelWeapon = [_display displayCtrl IDC_buttonOptic, _display displayCtrl GVAR(currentRightPanel)] select (!isNil QGVAR(currentRightPanel) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ACC_IDCS, IDC_buttonCurrentMag, IDC_buttonCurrentMag2]});
|
||||||
|
private _selectCorrectPanelContainer = [_display displayCtrl IDC_buttonMisc, _display displayCtrl GVAR(currentRightPanel)] select (!isNil QGVAR(currentRightPanel) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ITEMS_IDCS]});
|
||||||
|
|
||||||
private _containerDefaultRightPanel = _display displayCtrl IDC_buttonMisc;
|
// Remove all magazines from the current weapon that aren't compatible with the new weapon
|
||||||
private _selectCorrectPanelContainer = [_containerDefaultRightPanel, _display displayCtrl GVAR(currentRightPanel)] select (!isNil QGVAR(currentRightPanel) && {GVAR(currentRightPanel) in [RIGHT_PANEL_ITEMS_IDCS]});
|
private _fnc_clearCurrentWeaponMags = {
|
||||||
|
private _compatibleMagsCurrentWeapon = compatibleMagazines _currentWeapon;
|
||||||
private _fnc_clearPreviousWepMags = {
|
|
||||||
private _compatibleMagsBaseWeapon = [_baseWeapon, true] call CBA_fnc_compatibleMagazines;
|
|
||||||
|
|
||||||
|
// If nothing was selected, remove all magazines from the current weapon
|
||||||
if (_item != "") then {
|
if (_item != "") then {
|
||||||
_compatibleMagsBaseWeapon = _compatibleMagsBaseWeapon select {!(_x in _compatibleMags)};
|
_compatibleMagsCurrentWeapon = _compatibleMagsCurrentWeapon - _compatibleMags;
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
GVAR(center) removeMagazines _x;
|
GVAR(center) removeMagazines _x;
|
||||||
} foreach _compatibleMagsBaseWeapon;
|
} forEach _compatibleMagsCurrentWeapon;
|
||||||
|
|
||||||
GVAR(currentItems) set [15, uniformItems GVAR(center)];
|
// Update currentItems
|
||||||
GVAR(currentItems) set [16, vestItems GVAR(center)];
|
private _loadout = getUnitLoadout GVAR(center);
|
||||||
GVAR(currentItems) set [17, backpackItems GVAR(center)];
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM_ITEMS, (_loadout select IDX_LOADOUT_UNIFORM) param [1, []]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_VEST_ITEMS, (_loadout select IDX_LOADOUT_VEST) param [1, []]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, (_loadout select IDX_LOADOUT_BACKPACK) param [1, []]];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check which right panel has changed
|
||||||
switch (GVAR(currentLeftPanel)) do {
|
switch (GVAR(currentLeftPanel)) do {
|
||||||
|
// Primary weapon
|
||||||
|
case IDC_buttonPrimaryWeapon: {
|
||||||
|
private _currentWeapon = GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON;
|
||||||
|
|
||||||
case IDC_buttonPrimaryWeapon : {
|
// If nothing selected, remove primary weapon and its magazines
|
||||||
private _baseWeapon = ((GVAR(currentItems) select 0) call bis_fnc_baseWeapon);
|
|
||||||
|
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
call _fnc_clearPreviousWepMags;
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
GVAR(center) removeWeapon (primaryWeapon GVAR(center));
|
GVAR(center) removeWeapon (primaryWeapon GVAR(center));
|
||||||
GVAR(currentItems) set [18, ["", "", "", "", "", ""]];
|
GVAR(currentItems) set [IDX_CURR_PRIMARY_WEAPON_ITEMS, ["", "", "", "", "", ""]];
|
||||||
GVAR(currentItems) set [0, _item];
|
GVAR(currentItems) set [IDX_CURR_PRIMARY_WEAPON, ""];
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 0) != _item && {_baseWeapon != _item}) then {
|
// Check if a new primary weapon was selected
|
||||||
private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x};
|
if (_item != _currentWeapon) then {
|
||||||
private _cfgMags = configFile >> "CfgMagazines";
|
// Get magazines that are compatible with the new weapon
|
||||||
private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 };
|
private _compatibleMags = compatibleMagazines _item;
|
||||||
|
|
||||||
call _fnc_clearPreviousWepMags;
|
// Remove all magazines from the current weapon that aren't compatible with the new one
|
||||||
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
[GVAR(center), _item] call CBA_fnc_addWeaponWithoutItems;
|
// Add new weapon without taking a magazine from the inventory
|
||||||
if (_compatibleMags isNotEqualTo []) then {
|
[GVAR(center), _item] call EFUNC(common,addWeapon);
|
||||||
GVAR(center) addWeaponItem [_item, [_compatibleMags select 0], true];
|
|
||||||
|
private _linkedItems = primaryWeaponItems GVAR(center) - [""];
|
||||||
|
|
||||||
|
// Remove linked items if unavailable
|
||||||
|
if (_linkedItems isNotEqualTo []) then {
|
||||||
|
{
|
||||||
|
if !(_x in GVAR(virtualItemsFlat)) then {
|
||||||
|
GVAR(center) removePrimaryWeaponItem _x;
|
||||||
|
};
|
||||||
|
} forEach _linkedItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add old attachments and magazines back if they are compatible
|
||||||
{
|
{
|
||||||
if (tolower _x in _compatibleItems || {_x in _compatibleMags}) then {
|
if (_item canAdd _x) then {
|
||||||
GVAR(center) addPrimaryWeaponItem _x;
|
GVAR(center) addWeaponItem [_item, _x, true];
|
||||||
};
|
};
|
||||||
} foreach (GVAR(currentItems) select 18);
|
} forEach (GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS);
|
||||||
|
|
||||||
private _primaryMags = primaryWeaponMagazine GVAR(center);
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_PRIMARY_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
|
|
||||||
GVAR(currentItems) set [0, _item];
|
_primaryMagazine = _primaryMagazine param [0, ""];
|
||||||
|
|
||||||
|
// Add a magazine to the primary muzzle if empty
|
||||||
|
if (_primaryMagazine == "") then {
|
||||||
|
// Get magazines that are compatible with the new weapon's primary muzzle only
|
||||||
|
private _compatibleMagsPrimaryMuzzle = compatibleMagazines [_item, "this"];
|
||||||
|
private _compatibleMagIndex = _compatibleMagsPrimaryMuzzle findAny (keys (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL));
|
||||||
|
|
||||||
|
if (_compatibleMagIndex != -1) then {
|
||||||
|
_primaryMagazine = _compatibleMagsPrimaryMuzzle select _compatibleMagIndex;
|
||||||
|
GVAR(center) addWeaponItem [_item, _primaryMagazine, true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_PRIMARY_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine, _secondaryMagazine param [0, ""]]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_PRIMARY_WEAPON, _item];
|
||||||
};
|
};
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_WEAPON
|
TOGGLE_RIGHT_PANEL_WEAPON
|
||||||
|
|
||||||
[_display, _selectCorrectPanelWeapon] call FUNC(fillRightPanel);
|
[_display, _selectCorrectPanelWeapon] call FUNC(fillRightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
|
// Handgun weapon
|
||||||
|
case IDC_buttonHandgun: {
|
||||||
|
private _currentWeapon = GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON;
|
||||||
|
|
||||||
case IDC_buttonHandgun : {
|
// If nothing selected, remove handgun weapon and its magazines
|
||||||
private _baseWeapon = ((GVAR(currentItems) select 2) call bis_fnc_baseWeapon);
|
|
||||||
|
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
call _fnc_clearPreviousWepMags;
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
GVAR(center) removeWeapon (handgunWeapon GVAR(center));
|
GVAR(center) removeWeapon (handgunWeapon GVAR(center));
|
||||||
GVAR(currentItems) set [18, ["", "", "", "", "", ""]];
|
GVAR(currentItems) set [IDX_CURR_HANDGUN_WEAPON_ITEMS, ["", "", "", "", "", ""]];
|
||||||
GVAR(currentItems) set [2, _item];
|
GVAR(currentItems) set [IDX_CURR_HANDGUN_WEAPON, ""];
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 2) != _item && {_baseWeapon != _item}) then {
|
// Check if a new handgun weapon was selected
|
||||||
private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x};
|
if (_item != _currentWeapon) then {
|
||||||
private _cfgMags = configFile >> "CfgMagazines";
|
// Get magazines that are compatible with the new weapon
|
||||||
private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 };
|
private _compatibleMags = compatibleMagazines _item;
|
||||||
|
|
||||||
call _fnc_clearPreviousWepMags;
|
// Remove all magazines from the current weapon that aren't compatible with the new one
|
||||||
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
[GVAR(center), _item] call CBA_fnc_addWeaponWithoutItems;
|
// Add new weapon without taking a magazine from the inventory
|
||||||
if (_compatibleMags isNotEqualTo []) then {
|
[GVAR(center), _item] call EFUNC(common,addWeapon);
|
||||||
GVAR(center) addWeaponItem [_item, [_compatibleMags select 0], true];
|
|
||||||
|
private _linkedItems = handgunItems GVAR(center) - [""];
|
||||||
|
|
||||||
|
// Remove linked items if unavailable
|
||||||
|
if (_linkedItems isNotEqualTo []) then {
|
||||||
|
{
|
||||||
|
if !(_x in GVAR(virtualItemsFlat)) then {
|
||||||
|
GVAR(center) removeHandgunItem _x;
|
||||||
|
};
|
||||||
|
} forEach _linkedItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add old attachments and magazines back if they are compatible
|
||||||
{
|
{
|
||||||
if (tolower _x in _compatibleItems || {_x in _compatibleMags}) then {
|
|
||||||
GVAR(center) addHandgunItem _x;
|
|
||||||
};
|
|
||||||
} foreach (GVAR(currentItems) select 20);
|
|
||||||
|
|
||||||
private _handgunMags = handgunMagazine GVAR(center);
|
if (_item canAdd _x) then {
|
||||||
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
|
GVAR(center) addWeaponItem [_item, _x, true];
|
||||||
GVAR(currentItems) set [2, _item];
|
};
|
||||||
|
} forEach (GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON_ITEMS);
|
||||||
|
|
||||||
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_HANDGUN_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
|
|
||||||
|
_primaryMagazine = _primaryMagazine param [0, ""];
|
||||||
|
|
||||||
|
// Add a magazine to the primary muzzle if empty
|
||||||
|
if (_primaryMagazine == "") then {
|
||||||
|
// Get magazines that are compatible with the new weapon's primary muzzle only
|
||||||
|
private _compatibleMagsPrimaryMuzzle = compatibleMagazines [_item, "this"];
|
||||||
|
private _compatibleMagIndex = _compatibleMagsPrimaryMuzzle findAny (keys (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL));
|
||||||
|
|
||||||
|
if (_compatibleMagIndex != -1) then {
|
||||||
|
_primaryMagazine = _compatibleMagsPrimaryMuzzle select _compatibleMagIndex;
|
||||||
|
GVAR(center) addWeaponItem [_item, _primaryMagazine, true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_HANDGUN_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine, _secondaryMagazine param [0, ""]]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_HANDGUN_WEAPON, _item];
|
||||||
};
|
};
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_WEAPON
|
TOGGLE_RIGHT_PANEL_WEAPON
|
||||||
[_display, [_selectCorrectPanelWeapon, _weaponDefaultRightPanel] select (GVAR(currentRightPanel) == IDC_buttonCurrentMag2)] call FUNC(fillRightPanel);
|
|
||||||
|
[_display, _selectCorrectPanelWeapon] call FUNC(fillRightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
|
// Secondary weapon
|
||||||
|
case IDC_buttonSecondaryWeapon: {
|
||||||
|
private _currentWeapon = GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON;
|
||||||
|
private _isDisposable = _item in (uiNamespace getVariable QGVAR(CBAdisposableLaunchers));
|
||||||
|
|
||||||
case IDC_buttonSecondaryWeapon : {
|
// If nothing selected, remove secondary weapon and its magazines
|
||||||
private _baseWeapon = ((GVAR(currentItems) select 1) call bis_fnc_baseWeapon);
|
|
||||||
|
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
call _fnc_clearPreviousWepMags;
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
GVAR(center) removeWeapon (secondaryWeapon GVAR(center));
|
GVAR(center) removeWeapon (secondaryWeapon GVAR(center));
|
||||||
GVAR(currentItems) set [18, ["", "", "", "", "", ""]];
|
GVAR(currentItems) set [IDX_CURR_SECONDARY_WEAPON_ITEMS, ["", "", "", "", "", ""]];
|
||||||
GVAR(currentItems) set [1, _item];
|
GVAR(currentItems) set [IDX_CURR_SECONDARY_WEAPON, ""];
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 1) != _item && {_baseWeapon != _item}) then {
|
// Check if a new secondary weapon was selected
|
||||||
private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x};
|
if (_item != _currentWeapon) then {
|
||||||
private _cfgMags = configFile >> "CfgMagazines";
|
// Get magazines that are compatible with the new weapon
|
||||||
private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 };
|
private _compatibleMags = compatibleMagazines _item;
|
||||||
|
|
||||||
call _fnc_clearPreviousWepMags;
|
// Remove all magazines from the current weapon that aren't compatible with the new one
|
||||||
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
[GVAR(center), _item] call CBA_fnc_addWeaponWithoutItems;
|
// Add new weapon without taking a magazine from the inventory
|
||||||
if (_compatibleMags isNotEqualTo []) then {
|
[GVAR(center), _item] call EFUNC(common,addWeapon);
|
||||||
GVAR(center) addWeaponItem [_item, [_compatibleMags select 0], true];
|
|
||||||
|
private _linkedItems = secondaryWeaponItems GVAR(center) - [""];
|
||||||
|
|
||||||
|
// Remove linked items if unavailable
|
||||||
|
if (_linkedItems isNotEqualTo []) then {
|
||||||
|
{
|
||||||
|
if !(_x in GVAR(virtualItemsFlat)) then {
|
||||||
|
GVAR(center) removeSecondaryWeaponItem _x;
|
||||||
|
};
|
||||||
|
} forEach _linkedItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add old attachments and magazines back if they are compatible
|
||||||
{
|
{
|
||||||
if (tolower _x in _compatibleItems || {_x in _compatibleMags}) then {
|
if (_item canAdd _x) then {
|
||||||
GVAR(center) addSecondaryWeaponItem _x;
|
GVAR(center) addWeaponItem [_item, _x, true];
|
||||||
};
|
};
|
||||||
} foreach (GVAR(currentItems) select 19);
|
} forEach (GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON_ITEMS);
|
||||||
|
|
||||||
private _secondaryMags = secondaryWeaponMagazine GVAR(center);
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_SECONDARY_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
|
|
||||||
GVAR(currentItems) set [1, _item];
|
_primaryMagazine = _primaryMagazine param [0, ""];
|
||||||
|
|
||||||
|
// Add a magazine to the primary muzzle if empty
|
||||||
|
if (_primaryMagazine == "") then {
|
||||||
|
// Get magazines that are compatible with the new weapon's primary muzzle only
|
||||||
|
private _compatibleMagsPrimaryMuzzle = compatibleMagazines [_item, "this"];
|
||||||
|
private _compatibleMagIndex = _compatibleMagsPrimaryMuzzle findAny (keys (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL));
|
||||||
|
|
||||||
|
if (_compatibleMagIndex != -1) then {
|
||||||
|
_primaryMagazine = _compatibleMagsPrimaryMuzzle select _compatibleMagIndex;
|
||||||
|
GVAR(center) addWeaponItem [_item, _primaryMagazine, true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_SECONDARY_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine, _secondaryMagazine param [0, ""]]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_SECONDARY_WEAPON, _item];
|
||||||
};
|
};
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_WEAPON
|
TOGGLE_RIGHT_PANEL_WEAPON
|
||||||
[_display, [_selectCorrectPanelWeapon, _weaponDefaultRightPanel] select (GVAR(currentRightPanel) == IDC_buttonCurrentMag2)] call FUNC(fillRightPanel);
|
|
||||||
|
// If item is a disposable launcher, delay a bit to show new compatible items
|
||||||
|
if (_isDisposable) then {
|
||||||
|
[{
|
||||||
|
_this call FUNC(fillRightPanel);
|
||||||
|
}, [_display, _selectCorrectPanelWeapon]] call CBA_fnc_execNextFrame;
|
||||||
|
} else {
|
||||||
|
[_display, _selectCorrectPanelWeapon] call FUNC(fillRightPanel);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
call FUNC(showItem);
|
// If item is a disposable launcher, delay a bit to show new compatible items
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
if (_isDisposable) then {
|
||||||
|
[{
|
||||||
|
// Make unit switch to new item
|
||||||
|
call FUNC(showItem);
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
_this call FUNC(itemInfo);
|
||||||
|
}, [_display, _control, _curSel, configFile >> "CfgWeapons" >> _item]] call CBA_fnc_execNextFrame;
|
||||||
|
} else {
|
||||||
|
// Make unit switch to new item
|
||||||
|
call FUNC(showItem);
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
// Headgear
|
||||||
case IDC_buttonHeadgear : {
|
case IDC_buttonHeadgear: {
|
||||||
|
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
removeHeadgear GVAR(center);
|
removeHeadgear GVAR(center);
|
||||||
GVAR(currentItems) set [3, _item];
|
GVAR(currentItems) set [IDX_CURR_HEADGEAR, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 3) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_HEADGEAR) != _item) then {
|
||||||
GVAR(center) addHeadgear _item;
|
GVAR(center) addHeadgear _item;
|
||||||
GVAR(currentItems) set [3, _item];
|
GVAR(currentItems) set [IDX_CURR_HEADGEAR, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
|
// Uniform
|
||||||
case IDC_buttonUniform : {
|
case IDC_buttonUniform: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
|
removeUniform GVAR(center);
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM_ITEMS, []];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM, ""];
|
||||||
|
|
||||||
removeuniform GVAR(center);
|
|
||||||
GVAR(currentItems) set [15, []];
|
|
||||||
GVAR(currentItems) set [4, _item];
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
} else {
|
} else {
|
||||||
|
if ((GVAR(currentItems) select IDX_CURR_UNIFORM) != _item) then {
|
||||||
|
// Get the unit's current loadout and just change the container
|
||||||
|
private _loadout = getUnitLoadout GVAR(center);
|
||||||
|
_loadout set [IDX_LOADOUT_UNIFORM, [_item, GVAR(currentItems) select IDX_CURR_UNIFORM_ITEMS]];
|
||||||
|
GVAR(center) setUnitLoadout _loadout;
|
||||||
|
|
||||||
if ((GVAR(currentItems) select 4) != _item) then {
|
private _uniformItems = uniformItems GVAR(center);
|
||||||
GVAR(center) forceAddUniform _item;
|
private _index = count _uniformItems - 1;
|
||||||
|
|
||||||
while {count uniformItems GVAR(center) > 0} do {
|
// Remove any items that can't fit in the container (this prevents overloading)
|
||||||
GVAR(center) removeItemFromUniform (uniformItems GVAR(center) select 0);
|
while {loadUniform GVAR(center) > 1 && {_index >= 0}} do {
|
||||||
}; //--- Remove default config contents
|
GVAR(center) removeItemFromUniform (_uniformItems select _index);
|
||||||
|
DEC(_index);
|
||||||
|
};
|
||||||
|
|
||||||
{GVAR(center) addItemtoUniform _x} foreach (GVAR(currentItems) select 15);
|
GVAR(currentItems) set [IDX_CURR_UNIFORM, _item];
|
||||||
GVAR(currentItems) set [4, _item];
|
|
||||||
|
|
||||||
[GVAR(center), ""] call bis_fnc_setUnitInsignia;
|
[GVAR(center), ""] call BIS_fnc_setUnitInsignia;
|
||||||
[GVAR(center), GVAR(currentInsignia)] call bis_fnc_setUnitInsignia;
|
[GVAR(center), GVAR(currentInsignia)] call BIS_fnc_setUnitInsignia;
|
||||||
};
|
};
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_CONTAINER
|
TOGGLE_RIGHT_PANEL_CONTAINER
|
||||||
|
|
||||||
[_display, _selectCorrectPanelContainer] call FUNC(fillRightPanel);
|
[_display, _selectCorrectPanelContainer] call FUNC(fillRightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Vest
|
||||||
case IDC_buttonVest: {
|
case IDC_buttonVest: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
|
|
||||||
removeVest GVAR(center);
|
removeVest GVAR(center);
|
||||||
GVAR(currentItems) set [16, []];
|
GVAR(currentItems) set [IDX_CURR_VEST_ITEMS, []];
|
||||||
GVAR(currentItems) set [5, _item];
|
GVAR(currentItems) set [IDX_CURR_VEST, ""];
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
} else {
|
} else {
|
||||||
|
if ((GVAR(currentItems) select IDX_CURR_VEST) != _item) then {
|
||||||
|
// Get the unit's current loadout and just change the container
|
||||||
|
private _loadout = getUnitLoadout GVAR(center);
|
||||||
|
_loadout set [IDX_LOADOUT_VEST, [_item, GVAR(currentItems) select IDX_CURR_VEST_ITEMS]];
|
||||||
|
GVAR(center) setUnitLoadout _loadout;
|
||||||
|
|
||||||
if ((GVAR(currentItems) select 5) != _item) then {
|
private _vestItems = vestItems GVAR(center);
|
||||||
GVAR(center) addVest _item;
|
private _index = count _vestItems - 1;
|
||||||
while {count vestItems GVAR(center) > 0} do {
|
|
||||||
GVAR(center) removeItemFromVest (VestItems GVAR(center) select 0);
|
|
||||||
}; //--- Remove default config contents
|
|
||||||
{GVAR(center) addItemToVest _x} foreach (GVAR(currentItems) select 16);
|
|
||||||
|
|
||||||
GVAR(currentItems) set [5, _item];
|
// Remove any items that can't fit in the container (this prevents overloading)
|
||||||
|
while {loadVest GVAR(center) > 1 && {_index >= 0}} do {
|
||||||
|
GVAR(center) removeItemFromVest (_vestItems select _index);
|
||||||
|
DEC(_index);
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_VEST, _item];
|
||||||
};
|
};
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_CONTAINER
|
TOGGLE_RIGHT_PANEL_CONTAINER
|
||||||
|
|
||||||
[_display, _selectCorrectPanelContainer] call FUNC(fillRightPanel);
|
[_display, _selectCorrectPanelContainer] call FUNC(fillRightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonBackpack : {
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Backpack
|
||||||
|
case IDC_buttonBackpack: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
|
|
||||||
removeBackpack GVAR(center);
|
removeBackpack GVAR(center);
|
||||||
GVAR(currentItems) set [17, []];
|
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, []];
|
||||||
GVAR(currentItems) set [6, _item];
|
GVAR(currentItems) set [IDX_CURR_BACKPACK, ""];
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
} else {
|
} else {
|
||||||
|
if ((GVAR(currentItems) select IDX_CURR_BACKPACK) != _item) then {
|
||||||
|
// Get the unit's current loadout and just change the container
|
||||||
|
private _loadout = getUnitLoadout GVAR(center);
|
||||||
|
_loadout set [IDX_LOADOUT_BACKPACK, [_item, GVAR(currentItems) select IDX_CURR_BACKPACK_ITEMS]];
|
||||||
|
GVAR(center) setUnitLoadout _loadout;
|
||||||
|
|
||||||
if ((GVAR(currentItems) select 6) != _item) then {
|
private _backpackItems = backpackItems GVAR(center);
|
||||||
removeBackpack GVAR(center);
|
private _index = count _backpackItems - 1;
|
||||||
GVAR(center) addBackpackGlobal _item;
|
|
||||||
while {count backpackItems GVAR(center) > 0} do {
|
|
||||||
GVAR(center) removeItemFromBackpack (backpackItems GVAR(center) select 0);
|
|
||||||
}; //--- Remove default config contents
|
|
||||||
{GVAR(center) addItemToBackpack _x} foreach (GVAR(currentItems) select 17);
|
|
||||||
|
|
||||||
GVAR(currentItems) set [6, _item];
|
// Remove any items that can't fit in the container (this prevents overloading)
|
||||||
|
while {loadBackpack GVAR(center) > 1 && {_index >= 0}} do {
|
||||||
|
GVAR(center) removeItemFromBackpack (_backpackItems select _index);
|
||||||
|
DEC(_index);
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BACKPACK, _item];
|
||||||
};
|
};
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_CONTAINER
|
TOGGLE_RIGHT_PANEL_CONTAINER
|
||||||
|
|
||||||
[_display, _selectCorrectPanelContainer] call FUNC(fillRightPanel);
|
[_display, _selectCorrectPanelContainer] call FUNC(fillRightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
[_display, _control, _curSel, (configFile >> "CfgVehicles" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonGoggles : {
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgVehicles" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Facewear
|
||||||
|
case IDC_buttonGoggles: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
removeGoggles GVAR(center);
|
removeGoggles GVAR(center);
|
||||||
GVAR(currentItems) set [7, _item];
|
GVAR(currentItems) set [IDX_CURR_GOGGLES, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 7) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_GOGGLES) != _item) then {
|
||||||
GVAR(center) addGoggles _item;
|
GVAR(center) addGoggles _item;
|
||||||
GVAR(currentItems) set [7, _item];
|
GVAR(currentItems) set [IDX_CURR_GOGGLES, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgGlasses" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonNVG : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgGlasses" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// NVG
|
||||||
|
case IDC_buttonNVG: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
GVAR(center) unlinkItem (GVAR(currentItems) select 8);
|
GVAR(center) unlinkItem (GVAR(currentItems) select IDX_CURR_NVG);
|
||||||
GVAR(currentItems) set [8, _item];
|
GVAR(currentItems) set [IDX_CURR_NVG, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 8) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_NVG) != _item) then {
|
||||||
GVAR(center) linkItem _item;
|
GVAR(center) linkItem _item;
|
||||||
GVAR(currentItems) set [8, _item];
|
GVAR(currentItems) set [IDX_CURR_NVG, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonBinoculars : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Binoculars
|
||||||
|
case IDC_buttonBinoculars: {
|
||||||
|
private _currentWeapon = GVAR(currentItems) select IDX_CURR_BINO;
|
||||||
|
|
||||||
|
// If nothing selected, remove secondary weapon and its magazines
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
GVAR(center) removeWeapon (binocular GVAR(center));
|
GVAR(center) removeWeapon (binocular GVAR(center));
|
||||||
GVAR(currentItems) set [9, _item];
|
GVAR(currentItems) set [IDX_CURR_BINO_ITEMS, ["", "", "", "", "", ""]];
|
||||||
} else {
|
GVAR(currentItems) set [IDX_CURR_BINO, ""];
|
||||||
if ((GVAR(currentItems) select 9) != _item) then {
|
|
||||||
GVAR(center) addWeapon _item;
|
|
||||||
GVAR(currentItems) set [9, _item];
|
|
||||||
call FUNC(showItem);
|
|
||||||
ADDBINOCULARSMAG
|
|
||||||
};
|
|
||||||
};
|
|
||||||
call FUNC(showItem);
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonMap : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
} else {
|
||||||
|
// Check if a new binocular was selected
|
||||||
|
if (_item != _currentWeapon) then {
|
||||||
|
// Get magazines that are compatible with the new binocular
|
||||||
|
private _compatibleMags = compatibleMagazines _item;
|
||||||
|
|
||||||
|
// Remove all magazines from the current binocular that aren't compatible with the new one
|
||||||
|
call _fnc_clearCurrentWeaponMags;
|
||||||
|
|
||||||
|
// Add new weapon without taking a magazine from the inventory
|
||||||
|
[GVAR(center), _item] call EFUNC(common,addWeapon);
|
||||||
|
|
||||||
|
private _linkedItems = binocularItems GVAR(center) - [""];
|
||||||
|
|
||||||
|
// Remove linked items if unavailable
|
||||||
|
if (_linkedItems isNotEqualTo []) then {
|
||||||
|
{
|
||||||
|
if !(_x in GVAR(virtualItemsFlat)) then {
|
||||||
|
GVAR(center) removeBinocularItem _x;
|
||||||
|
};
|
||||||
|
} forEach _linkedItems;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add old attachments and magazines back if they are compatible
|
||||||
|
{
|
||||||
|
if (_item canAdd _x) then {
|
||||||
|
GVAR(center) addWeaponItem [_item, _x, true];
|
||||||
|
};
|
||||||
|
} forEach (GVAR(currentItems) select IDX_CURR_BINO_ITEMS);
|
||||||
|
|
||||||
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_BINO) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
|
|
||||||
|
_primaryMagazine = _primaryMagazine param [0, ""];
|
||||||
|
|
||||||
|
// Add a magazine to the primary muzzle if empty
|
||||||
|
if (_primaryMagazine == "") then {
|
||||||
|
// Get magazines that are compatible with the new weapon's primary muzzle only
|
||||||
|
private _compatibleMagsPrimaryMuzzle = compatibleMagazines [_item, "this"];
|
||||||
|
private _compatibleMagIndex = _compatibleMagsPrimaryMuzzle findAny (keys (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL));
|
||||||
|
|
||||||
|
if (_compatibleMagIndex != -1) then {
|
||||||
|
_primaryMagazine = _compatibleMagsPrimaryMuzzle select _compatibleMagIndex;
|
||||||
|
GVAR(center) addWeaponItem [_item, _primaryMagazine, true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update currentItems
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BINO_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine, _secondaryMagazine param [0, ""]]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BINO, _item];
|
||||||
|
};
|
||||||
|
|
||||||
|
TOGGLE_RIGHT_PANEL_WEAPON
|
||||||
|
|
||||||
|
[_display, _selectCorrectPanelWeapon] call FUNC(fillRightPanel);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
|
call FUNC(showItem);
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Map
|
||||||
|
case IDC_buttonMap: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
GVAR(center) unlinkItem (GVAR(currentItems) select 10) select 0;
|
GVAR(center) unlinkItem (GVAR(currentItems) select IDX_CURR_MAP);
|
||||||
GVAR(currentItems) set [10, _item];
|
GVAR(currentItems) set [IDX_CURR_MAP, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 10) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_MAP) != _item) then {
|
||||||
GVAR(center) linkItem _item;
|
GVAR(center) linkItem _item;
|
||||||
GVAR(currentItems) set [10, _item];
|
GVAR(currentItems) set [IDX_CURR_MAP, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonCompass : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Compass
|
||||||
|
case IDC_buttonCompass: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
GVAR(center) unlinkItem (GVAR(currentItems) select 11) select 0;
|
GVAR(center) unlinkItem (GVAR(currentItems) select IDX_CURR_COMPASS);
|
||||||
GVAR(currentItems) set [11, _item];
|
GVAR(currentItems) set [IDX_CURR_COMPASS, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 11) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_COMPASS) != _item) then {
|
||||||
GVAR(center) linkItem _item;
|
GVAR(center) linkItem _item;
|
||||||
GVAR(currentItems) set [11, _item];
|
GVAR(currentItems) set [IDX_CURR_COMPASS, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonRadio : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Radio
|
||||||
|
case IDC_buttonRadio: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
GVAR(center) unlinkItem (GVAR(currentItems) select 12) select 0;
|
GVAR(center) unlinkItem (GVAR(currentItems) select IDX_CURR_RADIO);
|
||||||
GVAR(currentItems) set [12, _item];
|
GVAR(currentItems) set [IDX_CURR_RADIO, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 12) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_RADIO) != _item) then {
|
||||||
GVAR(center) linkItem _item;
|
GVAR(center) linkItem _item;
|
||||||
GVAR(currentItems) set [12, _item];
|
GVAR(currentItems) set [IDX_CURR_RADIO, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonWatch : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Watch
|
||||||
|
case IDC_buttonWatch: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
GVAR(center) unlinkItem (GVAR(currentItems) select 13);
|
GVAR(center) unlinkItem (GVAR(currentItems) select IDX_CURR_WATCH);
|
||||||
GVAR(currentItems) set [13, _item];
|
GVAR(currentItems) set [IDX_CURR_WATCH, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 13) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_WATCH) != _item) then {
|
||||||
GVAR(center) linkItem _item;
|
GVAR(center) linkItem _item;
|
||||||
GVAR(currentItems) set [13, _item];
|
GVAR(currentItems) set [IDX_CURR_WATCH, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonGPS : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// GPS or UAV Terminal
|
||||||
|
case IDC_buttonGPS: {
|
||||||
if (_item == "") then {
|
if (_item == "") then {
|
||||||
GVAR(center) unlinkItem (GVAR(currentItems) select 14) select 0;
|
GVAR(center) unlinkItem (GVAR(currentItems) select IDX_CURR_COMMS);
|
||||||
GVAR(currentItems) set [14, _item];
|
GVAR(currentItems) set [IDX_CURR_COMMS, ""];
|
||||||
} else {
|
} else {
|
||||||
if ((GVAR(currentItems) select 14) != _item) then {
|
if ((GVAR(currentItems) select IDX_CURR_COMMS) != _item) then {
|
||||||
GVAR(center) linkItem _item;
|
GVAR(center) linkItem _item;
|
||||||
GVAR(currentItems) set [14, _item];
|
GVAR(currentItems) set [IDX_CURR_COMMS, _item];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgWeapons" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonFace : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgWeapons" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Face
|
||||||
|
case IDC_buttonFace: {
|
||||||
private _face = [_item, "Default"] select (_item == "");
|
private _face = [_item, "Default"] select (_item == "");
|
||||||
|
|
||||||
GVAR(center) setFace _face;
|
GVAR(center) setFace _face;
|
||||||
GVAR(currentFace) = _face;
|
GVAR(currentFace) = _face;
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgFaces" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonVoice : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgFaces" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Voice
|
||||||
|
case IDC_buttonVoice: {
|
||||||
GVAR(center) setSpeaker _item;
|
GVAR(center) setSpeaker _item;
|
||||||
GVAR(currentVoice) = _item;
|
GVAR(currentVoice) = _item;
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
|
||||||
[_display, _control, _curSel, (configFile >> "CfgVoice" >> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
case IDC_buttonInsignia : {
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
[GVAR(center), _item] call bis_fnc_setUnitInsignia;
|
|
||||||
|
// Display new items's info on the bottom right
|
||||||
|
[_display, _control, _curSel, configFile >> "CfgVoice" >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Insignia
|
||||||
|
case IDC_buttonInsignia: {
|
||||||
|
[GVAR(center), _item] call BIS_fnc_setUnitInsignia;
|
||||||
GVAR(currentInsignia) = _item;
|
GVAR(currentInsignia) = _item;
|
||||||
|
|
||||||
|
// Make unit switch to new item
|
||||||
call FUNC(showItem);
|
call FUNC(showItem);
|
||||||
|
|
||||||
TOGGLE_RIGHT_PANEL_HIDE
|
TOGGLE_RIGHT_PANEL_HIDE
|
||||||
|
|
||||||
private _unitInsigniaConfig = (configFile >> "CfgUnitInsignia" >> _item);
|
private _unitInsigniaConfig = configFile >> "CfgUnitInsignia" >> _item;
|
||||||
|
|
||||||
if (configName _unitInsigniaConfig isEqualTo "") then {
|
// Display new items's info on the bottom right
|
||||||
[_display, _control, _curSel, (missionConfigFile >> "CfgUnitInsignia" >> _item)] call FUNC(itemInfo);
|
if (isNull _unitInsigniaConfig) then {
|
||||||
|
[_display, _control, _curSel, missionConfigFile >> "CfgUnitInsignia" >> _item] call FUNC(itemInfo);
|
||||||
} else {
|
} else {
|
||||||
[_display, _control, _curSel, _unitInsigniaConfig] call FUNC(itemInfo);
|
[_display, _control, _curSel, _unitInsigniaConfig] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", [GVAR(center), 2] call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", GVAR(center) call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
* Handles selection changes on loadouts panel.
|
* Handles selection changes on loadouts panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Loadouts panel control <CONTROL>
|
* 0: Arsenal display <DISPLAY>
|
||||||
* 1: Loadouts panel selection <SCALAR>
|
* 1: Loadouts panel control <CONTROL>
|
||||||
|
* 2: Currently selected loadout's index <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -23,74 +24,76 @@ private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete;
|
|||||||
private _renameButtonCtrl = _display displayCtrl IDC_buttonRename;
|
private _renameButtonCtrl = _display displayCtrl IDC_buttonRename;
|
||||||
private _textEditBoxCtrl= _display displayCtrl IDC_textEditBox;
|
private _textEditBoxCtrl= _display displayCtrl IDC_textEditBox;
|
||||||
|
|
||||||
|
// If nothing selected, disable all buttons
|
||||||
if (_curSel == -1) exitWith {
|
if (_curSel == -1) exitWith {
|
||||||
|
|
||||||
if (GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts) then {
|
if (GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts) then {
|
||||||
_saveButtonCtrl ctrlEnable false;
|
_saveButtonCtrl ctrlEnable false;
|
||||||
_saveButtonCtrl ctrlCommit 0;
|
_saveButtonCtrl ctrlCommit 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
_shareButtonCtrl ctrlSetText (localize LSTRING(buttonSharePrivateText));
|
_shareButtonCtrl ctrlSetText LLSTRING(buttonSharePrivateText);
|
||||||
|
|
||||||
{
|
{
|
||||||
_x ctrlEnable false;
|
_x ctrlEnable false;
|
||||||
_x ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} foreach [_shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl, _renameButtonCtrl];
|
} forEach [_shareButtonCtrl, _loadButtonCtrl, _renameButtonCtrl, _deleteButtonCtrl];
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (GVAR(currentLoadoutsTab)) do {
|
switch (GVAR(currentLoadoutsTab)) do {
|
||||||
|
// Local loadouts
|
||||||
case IDC_buttonMyLoadouts: {
|
case IDC_buttonMyLoadouts: {
|
||||||
|
// Enable shared loadouts if option is enabled and MP
|
||||||
_shareButtonCtrl ctrlEnable (GVAR(allowSharedLoadouts) && {isMultiplayer});
|
_shareButtonCtrl ctrlEnable (GVAR(allowSharedLoadouts) && {isMultiplayer});
|
||||||
_shareButtonCtrl ctrlCommit 0;
|
_shareButtonCtrl ctrlCommit 0;
|
||||||
|
|
||||||
_loadButtonCtrl ctrlEnable true;
|
// Rename share button, depending if it's already shared or not
|
||||||
_loadButtonCtrl ctrlCommit 0;
|
_shareButtonCtrl ctrlSetText ([
|
||||||
|
LLSTRING(buttonSharePrivateText),
|
||||||
_shareButtonCtrl ctrlSetText ( [
|
LLSTRING(buttonSharePublicText)
|
||||||
localize LSTRING(buttonSharePrivateText),
|
|
||||||
localize LSTRING(buttonSharePublicText)
|
|
||||||
] select ((_control lnbValue [_curSel, 0]) == 1));
|
] select ((_control lnbValue [_curSel, 0]) == 1));
|
||||||
|
|
||||||
|
// Enable all other buttons
|
||||||
{
|
{
|
||||||
_x ctrlEnable true;
|
_x ctrlEnable true;
|
||||||
_x ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} foreach [_renameButtonCtrl, _deleteButtonCtrl];
|
} forEach [_loadButtonCtrl, _renameButtonCtrl, _deleteButtonCtrl];
|
||||||
|
|
||||||
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
|
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
|
||||||
};
|
};
|
||||||
|
// Default loadouts
|
||||||
case IDC_buttonDefaultLoadouts: {
|
case IDC_buttonDefaultLoadouts: {
|
||||||
|
// Enable saving and loading for everyone
|
||||||
{
|
{
|
||||||
_x ctrlEnable true;
|
_x ctrlEnable true;
|
||||||
_x ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} foreach [_saveButtonCtrl, _loadButtonCtrl];
|
} forEach [_saveButtonCtrl, _loadButtonCtrl];
|
||||||
|
|
||||||
|
// Disable sharing button
|
||||||
_shareButtonCtrl ctrlEnable false;
|
_shareButtonCtrl ctrlEnable false;
|
||||||
_shareButtonCtrl ctrlCommit 0;
|
_shareButtonCtrl ctrlCommit 0;
|
||||||
|
|
||||||
|
// Enable delete and renaming button if in 3DEN
|
||||||
{
|
{
|
||||||
_x ctrlEnable (is3DEN);
|
_x ctrlEnable (is3DEN);
|
||||||
_x ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} foreach [_deleteButtonCtrl, _renameButtonCtrl];
|
} forEach [_renameButtonCtrl, _deleteButtonCtrl];
|
||||||
|
|
||||||
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
|
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
|
||||||
};
|
};
|
||||||
|
// Shared loadouts
|
||||||
case IDC_buttonSharedLoadouts: {
|
case IDC_buttonSharedLoadouts: {
|
||||||
|
// Enable saving and loading for everyone
|
||||||
{
|
{
|
||||||
_x ctrlEnable true;
|
_x ctrlEnable true;
|
||||||
_x ctrlCommit 0;
|
_x ctrlCommit 0;
|
||||||
} foreach [_saveButtonCtrl, _loadButtonCtrl];
|
} forEach [_saveButtonCtrl, _loadButtonCtrl];
|
||||||
|
|
||||||
|
// Disable sharing button
|
||||||
_shareButtonCtrl ctrlEnable false;
|
_shareButtonCtrl ctrlEnable false;
|
||||||
_shareButtonCtrl ctrlCommit 0;
|
_shareButtonCtrl ctrlCommit 0;
|
||||||
|
|
||||||
|
// If admin or loadout author, enable button for shared loadout
|
||||||
if ((serverCommandAvailable "#logout") || {(_control lnbText [_curSel, 0]) == profileName}) then {
|
if ((serverCommandAvailable "#logout") || {(_control lnbText [_curSel, 0]) == profileName}) then {
|
||||||
|
|
||||||
_deleteButtonCtrl ctrlEnable true;
|
_deleteButtonCtrl ctrlEnable true;
|
||||||
_deleteButtonCtrl ctrlCommit 0;
|
_deleteButtonCtrl ctrlCommit 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Handles selection changes on the right panel.
|
* Handles selection changes on the right panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Right panel control <CONTROL>
|
* 0: Right panel control <CONTROL>
|
||||||
* 1: Right panel selection <SCALAR>
|
* 1: Right panel selection <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -18,61 +18,185 @@ params ["_control", "_curSel"];
|
|||||||
|
|
||||||
if (_curSel < 0) exitwith {};
|
if (_curSel < 0) exitwith {};
|
||||||
|
|
||||||
private _ctrlIDC = ctrlIDC _control;
|
|
||||||
private _display = ctrlParent _control;
|
private _display = ctrlParent _control;
|
||||||
private _item = _control lbData _curSel;
|
private _item = _control lbData _curSel;
|
||||||
|
private _currentItemsIndex = IDX_CURR_PRIMARY_WEAPON_ITEMS + ([IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC_buttonHandgun, IDC_buttonBinoculars] find GVAR(currentLeftPanel));
|
||||||
|
private _itemIndex = [IDC_buttonMuzzle, IDC_buttonItemAcc, IDC_buttonOptic, IDC_buttonBipod, IDC_buttonCurrentMag, IDC_buttonCurrentMag2] find GVAR(currentRightPanel);
|
||||||
|
|
||||||
|
// Check which right panel has changed
|
||||||
|
switch (_currentItemsIndex) do {
|
||||||
|
// Primary weapon
|
||||||
|
case IDX_CURR_PRIMARY_WEAPON_ITEMS: {
|
||||||
|
// If removal
|
||||||
|
if (_item == "") then {
|
||||||
|
private _secondaryMagazine = (GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS) select 5;
|
||||||
|
|
||||||
private _fnc_selectItem = {
|
// If secondary magazine, make sure to remove from correct muzzle
|
||||||
params ["_item", "_currentItemsIndex", "_itemIndex"];
|
if (_itemIndex == 5 && {_secondaryMagazine != ""} && {((GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS) select 4) == _secondaryMagazine}) then {
|
||||||
|
// Remove both magazines
|
||||||
|
GVAR(center) removePrimaryWeaponItem _secondaryMagazine;
|
||||||
|
GVAR(center) removePrimaryWeaponItem _secondaryMagazine;
|
||||||
|
|
||||||
switch (_currentItemsIndex) do {
|
// Add magazine back into primary muzzle
|
||||||
case 18: {
|
GVAR(center) addWeaponItem [primaryWeapon GVAR(center), _secondaryMagazine, true];
|
||||||
if (_item == "") then {
|
|
||||||
GVAR(center) removePrimaryWeaponItem ((GVAR(currentItems) select 18) select _itemIndex);
|
|
||||||
private _primaryMags = primaryWeaponMagazine GVAR(center);
|
|
||||||
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
|
|
||||||
} else {
|
} else {
|
||||||
GVAR(center) addWeaponItem [primaryWeapon GVAR(center), _item, true];
|
GVAR(center) removePrimaryWeaponItem ((GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS) select _itemIndex);
|
||||||
private _primaryMags = primaryWeaponMagazine GVAR(center);
|
};
|
||||||
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
|
} else {
|
||||||
|
// Don't add item if it isn't a different item than what the unit already has
|
||||||
|
if (_item != ((GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS) select _itemIndex)) then {
|
||||||
|
// If magazine, make sure to add to correct muzzle
|
||||||
|
if (_itemIndex >= 4) then {
|
||||||
|
private _weapon = primaryWeapon GVAR(center);
|
||||||
|
|
||||||
|
GVAR(center) addWeaponItem [_weapon, [_item, nil, (_weapon call CBA_fnc_getMuzzles) param [_itemIndex - 4, ""]], true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) addWeaponItem [primaryWeapon GVAR(center), _item, true];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
[_display, _control, _curSel, (configFile >> (["CfgWeapons", "CfgMagazines"] select (_itemIndex in [4, 5]))>> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case 19: {
|
// Update currentItems
|
||||||
if (_item == "") then {
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_PRIMARY_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
if (cba_disposable_replaceDisposableLauncher && !isNil {cba_disposable_LoadedLaunchers getVariable secondaryWeapon GVAR(center)}) exitWith { TRACE_1("ignoring unload of disposable",secondaryWeapon GVAR(center)); };
|
GVAR(currentItems) set [IDX_CURR_PRIMARY_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine param [0, ""], _secondaryMagazine param [0, ""]]];
|
||||||
GVAR(center) removeSecondaryWeaponItem ((GVAR(currentItems) select 19) select _itemIndex);
|
|
||||||
private _secondaryMags = secondaryWeaponMagazine GVAR(center);
|
[_display, _control, _curSel, configFile >> ["CfgWeapons", "CfgMagazines"] select (_itemIndex >= 4) >> _item] call FUNC(itemInfo);
|
||||||
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
|
};
|
||||||
} else {
|
// Secondary weapon
|
||||||
GVAR(center) addWeaponItem [secondaryWeapon GVAR(center), _item, true];
|
case IDX_CURR_SECONDARY_WEAPON_ITEMS: {
|
||||||
private _secondaryMags = secondaryWeaponMagazine GVAR(center);
|
private _isDisposable = CBA_disposable_replaceDisposableLauncher && {!isNil {CBA_disposable_loadedLaunchers getVariable (secondaryWeapon GVAR(center))}};
|
||||||
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
|
|
||||||
|
// If removal
|
||||||
|
if (_item == "") then {
|
||||||
|
// Don't unload magazines from diposable weapons
|
||||||
|
if (_isDisposable && {_itemIndex >= 4}) exitWith {
|
||||||
|
TRACE_1("Ignoring unload of magazine from disposable",secondaryWeapon GVAR(center));
|
||||||
|
};
|
||||||
|
|
||||||
|
private _secondaryMagazine = (GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON_ITEMS) select 5;
|
||||||
|
|
||||||
|
// If secondary magazine, make sure to remove from correct muzzle
|
||||||
|
if (_itemIndex == 5 && {_secondaryMagazine != ""} && {((GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON_ITEMS) select 4) == _secondaryMagazine}) then {
|
||||||
|
// Remove both magazines
|
||||||
|
GVAR(center) removeSecondaryWeaponItem _secondaryMagazine;
|
||||||
|
GVAR(center) removeSecondaryWeaponItem _secondaryMagazine;
|
||||||
|
|
||||||
|
// Add magazine back into primary muzzle
|
||||||
|
GVAR(center) addWeaponItem [secondaryWeapon GVAR(center), _secondaryMagazine, true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) removeSecondaryWeaponItem ((GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON_ITEMS) select _itemIndex);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Don't add item if it isn't a different item than what the unit already has
|
||||||
|
if (_item != ((GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON_ITEMS) select _itemIndex)) then {
|
||||||
|
// If magazine, make sure to add to correct muzzle
|
||||||
|
if (_itemIndex >= 4) then {
|
||||||
|
private _weapon = secondaryWeapon GVAR(center);
|
||||||
|
|
||||||
|
GVAR(center) addWeaponItem [_weapon, [_item, nil, (_weapon call CBA_fnc_getMuzzles) param [_itemIndex - 4, ""]], true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) addWeaponItem [secondaryWeapon GVAR(center), _item, true];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
[_display, _control, _curSel, (configFile >> (["CfgWeapons", "CfgMagazines"] select (_itemIndex in [4, 5]))>> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case 20: {
|
// Update currentItems
|
||||||
if (_item == "") then {
|
if !(_isDisposable && {_itemIndex >= 4}) then {
|
||||||
GVAR(center) removeHandgunItem ((GVAR(currentItems) select 20) select _itemIndex);
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_SECONDARY_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
private _handgunMags = handgunMagazine GVAR(center);
|
GVAR(currentItems) set [IDX_CURR_SECONDARY_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine param [0, ""], _secondaryMagazine param [0, ""]]];
|
||||||
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
|
|
||||||
} else {
|
|
||||||
GVAR(center) addWeaponItem [handgunWeapon GVAR(center), _item, true];
|
|
||||||
private _handgunMags = handgunMagazine GVAR(center);
|
|
||||||
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
|
|
||||||
};
|
|
||||||
[_display, _control, _curSel, (configFile >> (["CfgWeapons", "CfgMagazines"] select (_itemIndex in [4, 5]))>> _item)] call FUNC(itemInfo);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[_display, _control, _curSel, configFile >> ["CfgWeapons", "CfgMagazines"] select (_itemIndex >= 4) >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Handgun weapon
|
||||||
|
case IDX_CURR_HANDGUN_WEAPON_ITEMS: {
|
||||||
|
if (_item == "") then {
|
||||||
|
private _secondaryMagazine = (GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON_ITEMS) select 5;
|
||||||
|
|
||||||
|
// If secondary magazine, make sure to remove from correct muzzle
|
||||||
|
if (_itemIndex == 5 && {_secondaryMagazine != ""} && {((GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON_ITEMS) select 4) == _secondaryMagazine}) then {
|
||||||
|
// Remove both magazines
|
||||||
|
GVAR(center) removeHandgunItem _secondaryMagazine;
|
||||||
|
GVAR(center) removeHandgunItem _secondaryMagazine;
|
||||||
|
|
||||||
|
// Add magazine back into primary muzzle
|
||||||
|
GVAR(center) addWeaponItem [handgunWeapon GVAR(center), _secondaryMagazine, true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) removeHandgunItem ((GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON_ITEMS) select _itemIndex);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Don't add item if it isn't a different item than what the unit already has
|
||||||
|
if (_item != ((GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON_ITEMS) select _itemIndex)) then {
|
||||||
|
// If magazine, make sure to add to correct muzzle
|
||||||
|
if (_itemIndex >= 4) then {
|
||||||
|
private _weapon = handgunWeapon GVAR(center);
|
||||||
|
|
||||||
|
GVAR(center) addWeaponItem [_weapon, [_item, nil, (_weapon call CBA_fnc_getMuzzles) param [_itemIndex - 4, ""]], true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) addWeaponItem [handgunWeapon GVAR(center), _item, true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update currentItems
|
||||||
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_HANDGUN_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
|
|
||||||
|
// https://feedback.bistudio.com/T173880
|
||||||
|
_primaryMagazine = _primaryMagazine param [0, ""];
|
||||||
|
private _handgunMagazines = handgunMagazine GVAR(center);
|
||||||
|
|
||||||
|
// Delete the first magazine (but keep one if both magazines are the same)
|
||||||
|
_handgunMagazines deleteAt (_handgunMagazines findIf {_x == _primaryMagazine});
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_HANDGUN_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine, _handgunMagazines param [0, ""]]];
|
||||||
|
|
||||||
|
[_display, _control, _curSel, configFile >> ["CfgWeapons", "CfgMagazines"] select (_itemIndex >= 4) >> _item] call FUNC(itemInfo);
|
||||||
|
};
|
||||||
|
// Binoculars
|
||||||
|
case IDX_CURR_BINO_ITEMS: {
|
||||||
|
if (_item == "") then {
|
||||||
|
private _secondaryMagazine = (GVAR(currentItems) select IDX_CURR_BINO_ITEMS) select 5;
|
||||||
|
|
||||||
|
// If secondary magazine, make sure to remove from correct muzzle
|
||||||
|
if (_itemIndex == 5 && {_secondaryMagazine != ""} && {((GVAR(currentItems) select IDX_CURR_BINO_ITEMS) select 4) == _secondaryMagazine}) then {
|
||||||
|
// Remove both magazines
|
||||||
|
GVAR(center) removeBinocularItem _secondaryMagazine;
|
||||||
|
GVAR(center) removeBinocularItem _secondaryMagazine;
|
||||||
|
|
||||||
|
// Add magazine back into primary muzzle
|
||||||
|
GVAR(center) addWeaponItem [binocular GVAR(center), _secondaryMagazine, true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) removeBinocularItem ((GVAR(currentItems) select IDX_CURR_BINO_ITEMS) select _itemIndex);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Don't add item if it isn't a different item than what the unit already has
|
||||||
|
if (_item != ((GVAR(currentItems) select IDX_CURR_BINO_ITEMS) select _itemIndex)) then {
|
||||||
|
// If magazine, make sure to add to correct muzzle
|
||||||
|
if (_itemIndex >= 4) then {
|
||||||
|
private _weapon = binocular GVAR(center);
|
||||||
|
|
||||||
|
GVAR(center) addWeaponItem [_weapon, [_item, nil, (_weapon call CBA_fnc_getMuzzles) param [_itemIndex - 4, ""]], true];
|
||||||
|
} else {
|
||||||
|
GVAR(center) addWeaponItem [binocular GVAR(center), _item, true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update currentItems
|
||||||
|
(getUnitLoadout GVAR(center) select IDX_LOADOUT_BINO) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
|
||||||
|
|
||||||
|
// https://feedback.bistudio.com/T173880 (unsure if binocular weapons are affected by this)
|
||||||
|
_primaryMagazine = _primaryMagazine param [0, ""];
|
||||||
|
private _binocularMagazines = binocularMagazine GVAR(center);
|
||||||
|
|
||||||
|
// Delete the first magazine (but keep one if both magazines are the same)
|
||||||
|
_binocularMagazines deleteAt (_binocularMagazines findIf {_x == _primaryMagazine});
|
||||||
|
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BINO_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine, _binocularMagazines param [0, ""]]];
|
||||||
|
|
||||||
|
[_display, _control, _curSel, configFile >> ["CfgWeapons", "CfgMagazines"] select (_itemIndex >= 4) >> _item] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
[
|
// Update weight display
|
||||||
_item,
|
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", GVAR(center) call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
||||||
18 + ([IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC_buttonHandgun] find GVAR(currentLeftPanel)),
|
|
||||||
[IDC_buttonMuzzle, IDC_buttonItemAcc, IDC_buttonOptic, IDC_buttonBipod, IDC_buttonCurrentMag, IDC_buttonCurrentMag2] find GVAR(currentRightPanel)
|
|
||||||
] call _fnc_selectItem;
|
|
||||||
|
|
||||||
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", [GVAR(center), 2] call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Handles selection changes on the right panel (listnbox).
|
* Handles selection changes on the right panel (listnbox).
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Right panel control <CONTROL>
|
* 0: Right panel control <CONTROL>
|
||||||
* 1: Right panel selection <SCALAR>
|
* 1: Right panel selection <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -16,36 +16,41 @@
|
|||||||
|
|
||||||
params ["_control", "_curSel"];
|
params ["_control", "_curSel"];
|
||||||
|
|
||||||
if (_curSel < 0) exitwith {};
|
if (_curSel < 0 || {!(GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack])}) exitWith {};
|
||||||
|
|
||||||
private _ctrlIDC = ctrlIDC _control;
|
private _hasItems = false;
|
||||||
private _display = ctrlParent _control;
|
|
||||||
private _item = [_control lnbData [_curSel, 0], _control lbData _curSel] select !(ctrlType _control == 102);
|
|
||||||
|
|
||||||
private _fnc_selectRight = {
|
// Get relevant container
|
||||||
params ["_item", "_cfgEntry"];
|
private _container = switch (GVAR(currentLeftPanel)) do {
|
||||||
|
case IDC_buttonUniform: {
|
||||||
|
_hasItems = (GVAR(currentItems) select IDX_CURR_UNIFORM_ITEMS) isNotEqualTo [];
|
||||||
|
|
||||||
// Load remaining
|
uniformContainer GVAR(center)
|
||||||
private _maxLoad = switch (GVAR(currentLeftPanel)) do {
|
|
||||||
case IDC_buttonUniform: {
|
|
||||||
gettext (configfile >> "CfgWeapons" >> uniform GVAR(center) >> "ItemInfo" >> "containerClass")
|
|
||||||
};
|
|
||||||
case IDC_buttonVest: {
|
|
||||||
gettext (configfile >> "CfgWeapons" >> vest GVAR(center) >> "ItemInfo" >> "containerClass")
|
|
||||||
};
|
|
||||||
case IDC_buttonBackpack: {
|
|
||||||
backpack GVAR(center)
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
case IDC_buttonVest: {
|
||||||
|
_hasItems = (GVAR(currentItems) select IDX_CURR_VEST_ITEMS) isNotEqualTo [];
|
||||||
|
|
||||||
[_control, _maxLoad] call FUNC(updateRightPanel);
|
vestContainer GVAR(center)
|
||||||
[_display, _control, _curSel, (configFile >> _cfgEntry >> _item)] call FUNC(itemInfo);
|
};
|
||||||
|
case IDC_buttonBackpack: {
|
||||||
|
_hasItems = (GVAR(currentItems) select IDX_CURR_BACKPACK_ITEMS) isNotEqualTo [];
|
||||||
|
|
||||||
|
backpackContainer GVAR(center)
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]) then {
|
// Refresh availibility of items based on space remaining in container
|
||||||
|
[_control, _container, _hasItems] call FUNC(updateRightPanel);
|
||||||
|
|
||||||
[
|
private _item = _control lnbData [_curSel, 0];
|
||||||
_item,
|
private _cfgEntry = ["CfgWeapons", "CfgMagazines"] select (GVAR(currentRightPanel) in [IDC_buttonMag, IDC_buttonMagALL, IDC_buttonThrow, IDC_buttonPut] || {_item in (uiNamespace getVariable [QGVAR(magazineMiscItems), []])});
|
||||||
["CfgWeapons", "CfgMagazines"] select (GVAR(currentRightPanel) in [IDC_buttonMag, IDC_buttonMagALL, IDC_buttonThrow, IDC_buttonPut])
|
|
||||||
] call _fnc_selectRight;
|
_cfgEntry = configFile >> _cfgEntry >> _item;
|
||||||
|
|
||||||
|
// If e.g. in misc. items, item could be e.g. a backpack
|
||||||
|
if (isNull _cfgEntry) then {
|
||||||
|
_cfgEntry = _item call CBA_fnc_getItemConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Display item info on the bottom right
|
||||||
|
[ctrlParent _control, _control, _curSel, _cfgEntry] call FUNC(itemInfo);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe
|
||||||
* Replace the 3DEN "edit loadout" menu action
|
* Replace the 3DEN "edit loadout" menu action.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -9,9 +9,8 @@
|
|||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private _entity = (uinamespace getvariable ["bis_fnc_3DENEntityMenu_data",[]]) param [1, objnull];
|
private _entity = (uiNamespace getVariable ["BIS_fnc_3DENEntityMenu_data", []]) param [1, objNull];
|
||||||
[_entity, _entity, true] call FUNC(openBox);
|
[_entity, _entity, true] call FUNC(openBox);
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Open arsenal.
|
* Open arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Box <OBJECT>
|
* 0: Box <OBJECT>
|
||||||
* 1: Unit to open the arsenal on <OBJECT>
|
* 1: Unit to open the arsenal on <OBJECT>
|
||||||
* 2: Ignore virtual items and fill arsenal <BOOL>
|
* 2: Ignore virtual items and fill arsenal <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -26,31 +27,68 @@ if (
|
|||||||
{!(isNull objectParent _center) && {!is3DEN}}
|
{!(isNull objectParent _center) && {!is3DEN}}
|
||||||
) exitWith {};
|
) exitWith {};
|
||||||
|
|
||||||
if (isNil {_object getVariable [QGVAR(virtualItems), nil]} && {!_mode}) exitWith {
|
// If object has no arsenal and chosen option is to not ignore virtual items of object, exit
|
||||||
[localize LSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText);
|
if (isNil {_object getVariable QGVAR(virtualItems)} && {!_mode}) exitWith {
|
||||||
|
[LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Don't execute in scheduled environment
|
||||||
if (canSuspend) exitWith {
|
if (canSuspend) exitWith {
|
||||||
[{_this call FUNC(openBox)}, _this] call CBA_fnc_directCall;
|
[{_this call FUNC(openBox)}, _this] call CBA_fnc_directCall;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _displayToUse = [findDisplay 46, findDIsplay 312] select (!isNull findDisplay 312);
|
private _displayToUse = findDisplay IDD_RSCDISPLAYCURATOR;
|
||||||
_displayToUse = [_displayToUse, findDisplay 313] select (is3DEN);
|
_displayToUse = [_displayToUse, findDisplay IDD_MISSION] select (isNull _displayToUse);
|
||||||
|
_displayToUse = [_displayToUse, findDisplay IDD_DISPLAY3DEN] select is3DEN;
|
||||||
|
|
||||||
if (isNil "_displayToUse" || {!isnil QGVAR(camera)}) exitWith {
|
// Check if the display is available and that there isn't already a camera for the arsenal
|
||||||
[localize LSTRING(CantOpenDisplay), false, 5, 1] call EFUNC(common,displayText);
|
if (isNull _displayToUse || {!isNil QGVAR(camera)}) exitWith {
|
||||||
|
[LLSTRING(CantOpenDisplay), false, 5, 1] call EFUNC(common,displayText);
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(currentBox) = _object;
|
GVAR(currentBox) = _object;
|
||||||
|
|
||||||
if (_mode) then {
|
if (_mode) then {
|
||||||
|
// Add all the items from the game that the arsenal has detected
|
||||||
GVAR(virtualItems) = +(uiNamespace getVariable QGVAR(configItems));
|
GVAR(virtualItems) = +(uiNamespace getVariable QGVAR(configItems));
|
||||||
GVAR(virtualItemsFlat) = +(uiNamespace getVariable QGVAR(configItemsFlat));
|
GVAR(virtualItemsFlat) = +(uiNamespace getVariable QGVAR(configItemsFlat));
|
||||||
} else {
|
} else {
|
||||||
GVAR(virtualItems) = +(_object getVariable [QGVAR(virtualItems), [
|
// Add only specified items to the arsenal
|
||||||
[[], [], []], [[], [], [], []], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []
|
private _virtualItems = _object getVariable QGVAR(virtualItems);
|
||||||
]]);
|
|
||||||
GVAR(virtualItemsFlat) = flatten GVAR(virtualItems);
|
GVAR(virtualItems) = if (isNil "_virtualItems") then {
|
||||||
|
_virtualItems = [
|
||||||
|
[IDX_VIRT_WEAPONS, createHashMapFromArray [[IDX_VIRT_PRIMARY_WEAPONS, createHashMap], [IDX_VIRT_SECONDARY_WEAPONS, createHashMap], [IDX_VIRT_HANDGUN_WEAPONS, createHashMap]]],
|
||||||
|
[IDX_VIRT_ATTACHMENTS, createHashMapFromArray [[IDX_VIRT_OPTICS_ATTACHMENTS, createHashMap], [IDX_VIRT_FLASHLIGHT_ATTACHMENTS, createHashMap], [IDX_VIRT_MUZZLE_ATTACHMENTS, createHashMap], [IDX_VIRT_BIPOD_ATTACHMENTS, createHashMap]]]
|
||||||
|
];
|
||||||
|
|
||||||
|
_virtualItems = createHashMapFromArray _virtualItems;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_virtualItems set [_index, createHashMap];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
+_virtualItems
|
||||||
|
};
|
||||||
|
|
||||||
|
// Flatten out hashmaps for easy checking later
|
||||||
|
private _virtualItemsFlat = +_virtualItems;
|
||||||
|
private _weapons = _virtualItemsFlat deleteAt IDX_VIRT_WEAPONS;
|
||||||
|
private _attachments = _virtualItemsFlat deleteAt IDX_VIRT_ATTACHMENTS;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_virtualItemsFlat merge [_virtualItemsFlat deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_PRIMARY_WEAPONS to IDX_VIRT_HANDGUN_WEAPONS do {
|
||||||
|
_virtualItemsFlat merge [_weapons deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_OPTICS_ATTACHMENTS to IDX_VIRT_BIPOD_ATTACHMENTS do {
|
||||||
|
_virtualItemsFlat merge [_attachments deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(virtualItemsFlat) = _virtualItemsFlat;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(center) = _center;
|
GVAR(center) = _center;
|
||||||
@ -58,5 +96,7 @@ GVAR(center) = _center;
|
|||||||
if (is3DEN) then {
|
if (is3DEN) then {
|
||||||
_displayToUse createDisplay QGVAR(display);
|
_displayToUse createDisplay QGVAR(display);
|
||||||
} else {
|
} else {
|
||||||
[{(_this select 0) createDisplay (_this select 1)}, [_displayToUse, QGVAR(display)]] call CBA_fnc_execNextFrame;
|
[{
|
||||||
|
_this createDisplay QGVAR(display);
|
||||||
|
}, _displayToUse] call CBA_fnc_execNextFrame;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Port VA loadouts to ACE Arsenal.
|
* Port VA loadouts to ACE Arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -15,31 +15,40 @@
|
|||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private _VALoadouts = +(profilenamespace getvariable ["bis_fnc_saveInventory_data",[]]);
|
private _unit = player;
|
||||||
private _aceLoadouts = +(profileNamespace getVariable [QGVAR(saved_loadouts),[]]);
|
|
||||||
|
|
||||||
if (isNull player) exitWith {
|
// Need a player object to transfer loadouts
|
||||||
[localize LSTRING(portLoadoutsPlayerError)] call BIS_fnc_error;
|
if (isNull _unit) exitWith {
|
||||||
|
[LLSTRING(portLoadoutsPlayerError)] call BIS_fnc_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check if there are any VA loadouts
|
||||||
|
private _VALoadouts = profileNamespace getVariable ["BIS_fnc_saveInventory_data", []];
|
||||||
|
|
||||||
if (_VALoadouts isEqualTo []) exitWith {
|
if (_VALoadouts isEqualTo []) exitWith {
|
||||||
[localize LSTRING(portLoadoutsLoadoutError)] call BIS_fnc_error;
|
[LLSTRING(portLoadoutsLoadoutError)] call BIS_fnc_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
for "_i" from 0 to (count _VALoadouts - 1) step 2 do {
|
private _aceLoadouts = +(profileNamespace getVariable [QGVAR(saved_loadouts),[]]);
|
||||||
|
private _name = "";
|
||||||
|
private _index = -1;
|
||||||
|
|
||||||
|
// Go through all VA loadouts and save them as ACE Arsenal loadouts
|
||||||
|
for "_i" from 0 to (count _VALoadouts) - 1 step 2 do {
|
||||||
_name = _VALoadouts select _i;
|
_name = _VALoadouts select _i;
|
||||||
_inventory = _VALoadouts select (_i + 1);
|
|
||||||
|
|
||||||
private _sameNameLoadoutsList = _aceLoadouts select {_x select 0 == _name};
|
// Load VA loadout onto player
|
||||||
[player, [profilenamespace, _name]] call bis_fnc_loadinventory;
|
[_unit, [profileNamespace, _name]] call BIS_fnc_loadInventory;
|
||||||
|
|
||||||
private _loadout = getUnitLoadout player;
|
// See if there is an already existing loadout with the same name
|
||||||
|
_index = _aceLoadouts findIf {(_x select 0) == _name};
|
||||||
if (count _sameNameLoadoutsList > 0) then {
|
|
||||||
_aceLoadouts set [_aceLoadouts find (_sameNameLoadoutsList select 0), [_name, _loadout]];
|
|
||||||
|
|
||||||
|
// If there is an already existing loadout with same name, overwrite it (in CBA extended loadout array)
|
||||||
|
if (_index != -1) then {
|
||||||
|
_aceLoadouts set [_index, [_name, [getUnitLoadout _unit, createHashMap]]];
|
||||||
} else {
|
} else {
|
||||||
_aceLoadouts pushBack [_name, _loadout];
|
// Otherwise just add
|
||||||
|
_aceLoadouts pushBack [_name, [getUnitLoadout _unit, createHashMap]];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Remove arsenal from target.
|
* Remove arsenal from target.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Target <OBJECT>
|
* 0: Target <OBJECT>
|
||||||
* 1: Remove globally <BOOL>
|
* 1: Remove globally <BOOL> (default: true)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -18,19 +18,24 @@
|
|||||||
|
|
||||||
params [["_object", objNull, [objNull]], ["_global", true, [true]]];
|
params [["_object", objNull, [objNull]], ["_global", true, [true]]];
|
||||||
|
|
||||||
if (isNull _object || {isNil QGVAR(EHIDArray)}) exitWith {};
|
if (isNull _object) exitWith {};
|
||||||
|
|
||||||
if (_global && {isMultiplayer}) then {
|
private _id = _object getVariable QGVAR(initBoxJIP);
|
||||||
private _ID = (GVAR(EHIDArray) select {_x select 1 == _object}) select 0;
|
|
||||||
|
|
||||||
if (!isNil "_ID") then {
|
if (_global && {isMultiplayer} && {!isNil "_id"}) then {
|
||||||
[_ID select 0] call CBA_fnc_removeGlobalEventJIP;
|
// Remove event from JIP queue
|
||||||
GVAR(EHIDArray) deleteAt (GVAR(EHIDArray) find _ID);
|
[_id] call CBA_fnc_removeGlobalEventJIP;
|
||||||
publicVariable QGVAR(EHIDArray);
|
|
||||||
[QGVAR(removeBox), [_object, false]] call CBA_fnc_globalEvent;
|
// Reset JIP ID
|
||||||
};
|
_object setVariable [QGVAR(initBoxJIP), nil, true];
|
||||||
|
|
||||||
|
// Remove box for everyone
|
||||||
|
[QGVAR(removeBox), [_object, false]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
|
// Remove from JIP
|
||||||
|
_object setVariable [QGVAR(virtualItems), nil, true];
|
||||||
} else {
|
} else {
|
||||||
_object setVariable [QGVAR(virtualItems), nil, false];
|
_object setVariable [QGVAR(virtualItems), nil];
|
||||||
[_object, 0, ["ACE_MainActions", QGVAR(interaction)]] call EFUNC(interact_menu,removeActionFromObject);
|
[_object, 0, ["ACE_MainActions", QGVAR(interaction)]] call EFUNC(interact_menu,removeActionFromObject);
|
||||||
[QGVAR(boxRemoved), _object] call CBA_fnc_localEvent;
|
[QGVAR(boxRemoved), _object] call CBA_fnc_localEvent;
|
||||||
};
|
};
|
||||||
|
54
addons/arsenal/functions/fnc_removeSort.sqf
Normal file
54
addons/arsenal/functions/fnc_removeSort.sqf
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: johnb43
|
||||||
|
* Remove a sort from ACE Arsenal.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Array of IDs <ARRAY of STRINGS>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
[["scopeSortL00", "scopeSortL01", "scopeSortL02", "scopeSortR07"]] call ace_arsenal_fnc_removeSort;
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_IDList"];
|
||||||
|
|
||||||
|
// Compile sorts from config (in case this is called before preInit)
|
||||||
|
call FUNC(compileSorts);
|
||||||
|
|
||||||
|
private _currentID = "";
|
||||||
|
private _stringCount = 0;
|
||||||
|
private _tabSide = "";
|
||||||
|
private _tab = "";
|
||||||
|
private _tabToChange = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_currentID = _x;
|
||||||
|
_stringCount = count _currentID;
|
||||||
|
|
||||||
|
// Make sure to keep at least 1 sort per category, so make default sort not deletable
|
||||||
|
if ("ace_alphabetically" in toLower (_currentID select [0, _stringCount - 3])) then {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get tab info
|
||||||
|
_tabSide = _currentID select [_stringCount - 3, 1];
|
||||||
|
_tab = _currentID select [_stringCount - 2, 2];
|
||||||
|
|
||||||
|
_tab = parseNumber _tab;
|
||||||
|
|
||||||
|
// Check which side to delete it from
|
||||||
|
_tabToChange = if (_tabSide == "R") then {
|
||||||
|
GVAR(sortListRightPanel) select _tab
|
||||||
|
} else {
|
||||||
|
GVAR(sortListLeftPanel) select _tab
|
||||||
|
};
|
||||||
|
|
||||||
|
// Remove entry (all names are unique, there are no duplicates)
|
||||||
|
_tabToChange deleteAt (_tabToChange findIf {_x select 0 == _currentID});
|
||||||
|
} forEach _IDList;
|
@ -4,57 +4,81 @@
|
|||||||
* Remove a stat from ACE Arsenal.
|
* Remove a stat from ACE Arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Array of IDs <ARRAY>
|
* 0: Array of IDs <ARRAY of STRINGS>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [["scopeStatL00","scopeStatL01","scopeStatL02","scopeStatR07"]] call ace_arsenal_fnc_removeStat;
|
* [["scopeStatL00", "scopeStatL01", "scopeStatL02", "scopeStatR07"]] call ace_arsenal_fnc_removeStat;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_IDList"];
|
params ["_IDList"];
|
||||||
|
|
||||||
|
// Compile stats from config (in case this is called before preInit)
|
||||||
call FUNC(compileStats);
|
call FUNC(compileStats);
|
||||||
|
|
||||||
|
private _currentID = "";
|
||||||
|
private _stringCount = 0;
|
||||||
|
private _tabSide = "";
|
||||||
|
private _tab = "";
|
||||||
|
private _tabToChange = [];
|
||||||
|
private _changes = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _currentID = _x;
|
// Get tab info
|
||||||
private _stringCount = count _currentID;
|
_currentID = _x;
|
||||||
private _side = _currentID select [_stringCount - 3, 1];
|
_stringCount = count _currentID;
|
||||||
private _tab = _currentID select [_stringCount - 2, 2];
|
_tabSide = _currentID select [_stringCount - 3, 1];
|
||||||
|
_tab = _currentID select [_stringCount - 2, 2];
|
||||||
|
|
||||||
_tab = parseNumber _tab;
|
_tab = parseNumber _tab;
|
||||||
|
|
||||||
private _tabToChange = if (_side == "R") then {
|
// Check which side to delete it from
|
||||||
|
_tabToChange = if (_tabSide == "R") then {
|
||||||
GVAR(statsListRightPanel) select _tab
|
GVAR(statsListRightPanel) select _tab
|
||||||
} else {
|
} else {
|
||||||
GVAR(statsListLeftPanel) select _tab
|
GVAR(statsListLeftPanel) select _tab
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Delete stat
|
||||||
{
|
{
|
||||||
_x deleteAt (_x findIf {_x select 0 == _currentID});
|
_x deleteAt (_x findIf {_x select 0 == _currentID});
|
||||||
} foreach _tabToChange;
|
} forEach _tabToChange;
|
||||||
} foreach _IDList;
|
|
||||||
|
|
||||||
// Clear empty pages
|
// Store information, so that only tabs that were changed can be sorted again
|
||||||
private _fnc_deleteEmptyPage = {
|
_changes pushBackUnique [_tab, _tabSide];
|
||||||
params ["_list"];
|
} forEach _IDList;
|
||||||
|
|
||||||
|
private _statsFlat = [];
|
||||||
|
private _stats = [];
|
||||||
|
|
||||||
|
// Fill empty spots
|
||||||
|
{
|
||||||
|
_x params ["_tab", "_tabSide"];
|
||||||
|
|
||||||
|
_tabToChange = if (_tabSide == "R") then {
|
||||||
|
GVAR(statsListRightPanel)
|
||||||
|
} else {
|
||||||
|
GVAR(statsListLeftPanel)
|
||||||
|
};
|
||||||
|
|
||||||
|
_statsFlat = [];
|
||||||
|
|
||||||
|
// Get all stats of a tab into a single array
|
||||||
{
|
{
|
||||||
private _evaluatedTab = _forEachIndex;
|
_statsFlat append _x;
|
||||||
{
|
} forEach (_tabToChange select _tab);
|
||||||
if (count _x == 0) then {
|
|
||||||
_markedForDeletion pushBack [_evaluatedTab, _forEachIndex];
|
|
||||||
};
|
|
||||||
} foreach _x;
|
|
||||||
|
|
||||||
{
|
// Priority has stayed intact, so no need to sort
|
||||||
(_list select (_x select 0)) deleteAt (_x select 1);
|
_stats = [];
|
||||||
} foreach _markedForDeletion;
|
|
||||||
} foreach (_this select 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
private _markedForDeletion = [];
|
// Group stats into groups of 5
|
||||||
|
for "_index" from 0 to count _statsFlat - 1 step 5 do {
|
||||||
|
_stats pushBack (_statsFlat select [_index, _index + 5]);
|
||||||
|
};
|
||||||
|
|
||||||
[GVAR(statsListLeftPanel)] call _fnc_deleteEmptyPage;
|
_tabToChange set [_tab, _stats];
|
||||||
[GVAR(statsListRightPanel)] call _fnc_deleteEmptyPage;
|
} forEach _changes;
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Remove virtual items to the provided target.
|
* Remove virtual items to the provided target.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Target <OBJECT>
|
* 0: Target <OBJECT>
|
||||||
* 1: Items <ARRAY of strings> <BOOL>
|
* 1: Items <ARRAY of STRINGS> <BOOL>
|
||||||
* 2: Add globally <BOOL>
|
* 2: Remove globally <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -18,63 +19,84 @@
|
|||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [ ["_object", objNull, [objNull]], ["_items", [], [true, [""]]], ["_global", false, [false]] ];
|
params [["_object", objNull, [objNull]], ["_items", [], [true, [""]]], ["_global", false, [false]]];
|
||||||
|
|
||||||
if (isNull _object) exitWith {};
|
if (isNull _object || {_items isEqualTo []}) exitWith {};
|
||||||
if (_items isEqualType [] && {count _items == 0}) exitWith {};
|
|
||||||
|
|
||||||
private _cargo = _object getVariable [QGVAR(virtualItems), [
|
|
||||||
[[], [], []], // Weapons 0, primary, handgun, secondary
|
|
||||||
[[], [], [], []], // WeaponAccessories 1, optic,side,muzzle,bipod
|
|
||||||
[ ], // Magazines 2
|
|
||||||
[ ], // Headgear 3
|
|
||||||
[ ], // Uniform 4
|
|
||||||
[ ], // Vest 5
|
|
||||||
[ ], // Backpacks 6
|
|
||||||
[ ], // Goggles 7
|
|
||||||
[ ], // NVGs 8
|
|
||||||
[ ], // Binoculars 9
|
|
||||||
[ ], // Map 10
|
|
||||||
[ ], // Compass 11
|
|
||||||
[ ], // Radio slot 12
|
|
||||||
[ ], // Watch slot 13
|
|
||||||
[ ], // Comms slot 14
|
|
||||||
[ ], // WeaponThrow 15
|
|
||||||
[ ], // WeaponPut 16
|
|
||||||
[ ] // InventoryItems 17
|
|
||||||
]];
|
|
||||||
|
|
||||||
if (_items isEqualType true) then {
|
if (_items isEqualType true) then {
|
||||||
if (_items) then {
|
if (_items) then {
|
||||||
[_object, _global] call FUNC(removeBox);
|
[_object, _global] call FUNC(removeBox);
|
||||||
_object setVariable [QGVAR(virtualItems), nil, _global];
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
private _cargo = _object getVariable QGVAR(virtualItems);
|
||||||
|
|
||||||
// Make sure all items are in string form
|
if (isNil "_cargo") exitWith {
|
||||||
_items = _items select {_x isEqualType "" && {_x != ""}};
|
[_object, _global] call FUNC(removeBox);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Make sure all items are in string form, then convert to config case (non-existent items return "")
|
||||||
|
_items = (_items select {_x isEqualType ""}) apply {_x call EFUNC(common,getConfigName)};
|
||||||
|
|
||||||
|
// Remove any invalid/non-existing items
|
||||||
|
_items = _items - [""];
|
||||||
|
|
||||||
|
private _configItemsFlat = uiNamespace getVariable QGVAR(configItemsFlat);
|
||||||
|
|
||||||
|
// Convert all items to their baseWeapon
|
||||||
|
_items = _items apply {if (_x in _configItemsFlat) then {_x} else {_x call FUNC(baseWeapon)}};
|
||||||
|
|
||||||
|
// Remove items from lists
|
||||||
{
|
{
|
||||||
if (_forEachIndex isEqualTo 0) then {
|
switch (true) do {
|
||||||
_cargo set [_forEachIndex, [(_x select 0) - _items, (_x select 1) - _items, (_x select 2) - _items]];
|
// Weapons
|
||||||
} else {
|
case (_x in ((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_PRIMARY_WEAPONS)): {
|
||||||
if (_forEachIndex isEqualTo 1) then {
|
((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_PRIMARY_WEAPONS) deleteAt _x;
|
||||||
_cargo set [_forEachIndex, [(_x select 0) - _items, (_x select 1) - _items, (_x select 2) - _items, (_x select 3) - _items]];
|
};
|
||||||
} else {
|
case (_x in ((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_HANDGUN_WEAPONS)): {
|
||||||
_cargo set [_cargo find _x, _x - _items];
|
((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_HANDGUN_WEAPONS) deleteAt _x;
|
||||||
|
};
|
||||||
|
case (_x in ((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_SECONDARY_WEAPONS)): {
|
||||||
|
((_cargo get IDX_VIRT_WEAPONS) get IDX_VIRT_SECONDARY_WEAPONS) deleteAt _x;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Weapon attachments
|
||||||
|
case (_x in ((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS) deleteAt _x;
|
||||||
|
};
|
||||||
|
case (_x in ((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS) deleteAt _x;
|
||||||
|
};
|
||||||
|
case (_x in ((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS) deleteAt _x;
|
||||||
|
};
|
||||||
|
case (_x in ((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS)): {
|
||||||
|
((_cargo get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS) deleteAt _x;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Other
|
||||||
|
default {
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
if (_x in (_cargo get _index)) exitWith {
|
||||||
|
(_cargo get _index) deleteAt _x;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach _cargo;
|
} forEach _items;
|
||||||
|
|
||||||
private _itemCount = {
|
private _empty = [
|
||||||
if (_x isEqualTo (_cargo select 0) || {_x isEqualTo (_cargo select 1)}) then {
|
[IDX_VIRT_WEAPONS, createHashMapFromArray [[IDX_VIRT_PRIMARY_WEAPONS, createHashMap], [IDX_VIRT_SECONDARY_WEAPONS, createHashMap], [IDX_VIRT_HANDGUN_WEAPONS, createHashMap]]],
|
||||||
(_x isNotEqualTo [[],[],[]] || {_x isEqualTo [[],[],[],[]]})
|
[IDX_VIRT_ATTACHMENTS, createHashMapFromArray [[IDX_VIRT_OPTICS_ATTACHMENTS, createHashMap], [IDX_VIRT_FLASHLIGHT_ATTACHMENTS, createHashMap], [IDX_VIRT_MUZZLE_ATTACHMENTS, createHashMap], [IDX_VIRT_BIPOD_ATTACHMENTS, createHashMap]]]
|
||||||
} else {
|
];
|
||||||
(_x isNotEqualTo [])
|
|
||||||
};
|
|
||||||
} count _cargo;
|
|
||||||
|
|
||||||
if (_itemCount == 0) then {
|
_empty = createHashMapFromArray _empty;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_empty set [_index, createHashMap];
|
||||||
|
};
|
||||||
|
|
||||||
|
// If nothing is left, remove arsenal from object
|
||||||
|
if (_cargo isEqualTo _empty) then {
|
||||||
[_object, _global] call FUNC(removeBox);
|
[_object, _global] call FUNC(removeBox);
|
||||||
} else {
|
} else {
|
||||||
_object setVariable [QGVAR(virtualItems), _cargo, _global];
|
_object setVariable [QGVAR(virtualItems), _cargo, _global];
|
||||||
|
150
addons/arsenal/functions/fnc_replaceUniqueItemsLoadout.sqf
Normal file
150
addons/arsenal/functions/fnc_replaceUniqueItemsLoadout.sqf
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
|
/*
|
||||||
|
* Author: johnb43
|
||||||
|
* Replaces unique items in a loadout with their base items. Weapons are replaced with their base weapon.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: CBA extended loadout or getUnitLoadout array <ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Sanitised loadout <ARRAY> (getUnitLoadout array)
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [getUnitLoadout player] call ace_arsenal_fnc_replaceUniqueItemsLoadout
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params [["_loadout", [], [[]]]];
|
||||||
|
|
||||||
|
// IF CBA extended loadout, just take getUnitLoadout array
|
||||||
|
if (count _loadout == 2) then {
|
||||||
|
_loadout = _loadout select 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (count _loadout != 10) exitWith {[]};
|
||||||
|
|
||||||
|
private _weapon = "";
|
||||||
|
private _weaponsInfo = [];
|
||||||
|
private _uniqueBaseCfgText = "";
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
private _cfgVehicles = configFile >> "CfgVehicles";
|
||||||
|
|
||||||
|
{
|
||||||
|
switch (_forEachIndex) do {
|
||||||
|
// Primary weapon, Secondary weapon, Handgun weapon, Binoculars
|
||||||
|
case IDX_LOADOUT_PRIMARY_WEAPON;
|
||||||
|
case IDX_LOADOUT_SECONDARY_WEAPON;
|
||||||
|
case IDX_LOADOUT_HANDGUN_WEAPON;
|
||||||
|
case IDX_LOADOUT_BINO: {
|
||||||
|
_weaponsInfo = _x;
|
||||||
|
|
||||||
|
// Check weapon & weapon attachments
|
||||||
|
{
|
||||||
|
// Magazines
|
||||||
|
if (_forEachIndex in [4, 5]) then {
|
||||||
|
_x params [["_magazine", ""], "_count"];
|
||||||
|
|
||||||
|
if (_magazine != "") then {
|
||||||
|
_uniqueBaseCfgText = (getText (_cfgMagazines >> _magazine >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_uniqueBaseCfgText != "") then {
|
||||||
|
_weaponsInfo set [_forEachIndex, [_uniqueBaseCfgText, _count]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Other
|
||||||
|
if (_x != "") then {
|
||||||
|
_weaponsInfo set [_forEachIndex, _x call FUNC(baseWeapon)];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _weaponsInfo;
|
||||||
|
};
|
||||||
|
// Uniform, vest, backpack
|
||||||
|
case IDX_LOADOUT_UNIFORM;
|
||||||
|
case IDX_LOADOUT_VEST;
|
||||||
|
case IDX_LOADOUT_BACKPACK: {
|
||||||
|
_x params [["_containerClass", ""], ["_items", []]];
|
||||||
|
|
||||||
|
if (_containerClass != "") then {
|
||||||
|
_uniqueBaseCfgText = (getText ([_cfgWeapons, _cfgVehicles] select (_forEachIndex == IDX_LOADOUT_BACKPACK) >> _containerClass >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_uniqueBaseCfgText != "") then {
|
||||||
|
(_x select 0) set [0, _uniqueBaseCfgText];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check if container has items that need replacing with a defined base
|
||||||
|
{
|
||||||
|
switch (true) do {
|
||||||
|
// Containers have 2 entries: Name and isBackpack
|
||||||
|
case (_x isEqualTypeArray ["", false]);
|
||||||
|
// Misc. items have 2 entries: Name and amount
|
||||||
|
case (_x isEqualTypeArray ["", 0]): {
|
||||||
|
_x params ["_item", "_arg"];
|
||||||
|
|
||||||
|
if (_item != "") then {
|
||||||
|
_uniqueBaseCfgText = (getText ([_cfgWeapons, _cfgVehicles] select ((_arg isEqualType false) && {_arg}) >> _item >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_uniqueBaseCfgText != "") then {
|
||||||
|
_x set [0, _uniqueBaseCfgText];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Weapons have 2 entries: Weapon info array and amount
|
||||||
|
case (_x isEqualTypeArray [[], 0]): {
|
||||||
|
_weaponsInfo = _x select 0;
|
||||||
|
|
||||||
|
// Check weapon & weapon attachments
|
||||||
|
{
|
||||||
|
// Magazines
|
||||||
|
if (_forEachIndex in [4, 5]) then {
|
||||||
|
_uniqueBaseCfgText = (getText (_cfgMagazines >> _x >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_uniqueBaseCfgText != "") then {
|
||||||
|
_weaponsInfo set [_forEachIndex, _uniqueBaseCfgText];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Other
|
||||||
|
if (_x != "") then {
|
||||||
|
_weaponsInfo set [_forEachIndex, _x call FUNC(baseWeapon)];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _weaponsInfo;
|
||||||
|
};
|
||||||
|
// Magazines have 3 entries: Name, amount and ammo count
|
||||||
|
case (_x isEqualTypeArray ["", 0, 0]): {
|
||||||
|
_x params ["_item"];
|
||||||
|
|
||||||
|
if (_item != "") then {
|
||||||
|
_uniqueBaseCfgText = (getText (_cfgMagazines >> _item >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_uniqueBaseCfgText != "") then {
|
||||||
|
_x set [0, _uniqueBaseCfgText];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _items;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Assigned items: Map, Compass, Watch, GPS / UAV Terminal, Radio, NVGs
|
||||||
|
case IDX_LOADOUT_ASSIGNEDITEMS: {
|
||||||
|
// Check if assignedItems have items that need replacing with a defined base
|
||||||
|
_items = _x;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (_x != "") then {
|
||||||
|
_uniqueBaseCfgText = (getText (_cfgWeapons >> _x >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_uniqueBaseCfgText != "") then {
|
||||||
|
_items set [_forEachIndex, _uniqueBaseCfgText];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _items;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _loadout;
|
||||||
|
|
||||||
|
_loadout
|
@ -1,7 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Dedmen
|
* Author: Dedmen, johnb43
|
||||||
* Cache an array of all the compatible items for arsenal.
|
* Cache an array of all the compatible items for arsenals.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -12,178 +13,264 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private _cargo = [
|
private _configItems = [
|
||||||
[[], [], []], // Weapons 0, primary, secondary, handgun
|
[IDX_VIRT_WEAPONS, createHashMapFromArray [[IDX_VIRT_PRIMARY_WEAPONS, createHashMap], [IDX_VIRT_SECONDARY_WEAPONS, createHashMap], [IDX_VIRT_HANDGUN_WEAPONS, createHashMap]]],
|
||||||
[[], [], [], []], // WeaponAccessories 1, optic,side,muzzle,bipod
|
[IDX_VIRT_ATTACHMENTS, createHashMapFromArray [[IDX_VIRT_OPTICS_ATTACHMENTS, createHashMap], [IDX_VIRT_FLASHLIGHT_ATTACHMENTS, createHashMap], [IDX_VIRT_MUZZLE_ATTACHMENTS, createHashMap], [IDX_VIRT_BIPOD_ATTACHMENTS, createHashMap]]]
|
||||||
[ ], // Magazines 2
|
|
||||||
[ ], // Headgear 3
|
|
||||||
[ ], // Uniform 4
|
|
||||||
[ ], // Vest 5
|
|
||||||
[ ], // Backpacks 6
|
|
||||||
[ ], // Goggles 7
|
|
||||||
[ ], // NVGs 8
|
|
||||||
[ ], // Binoculars 9
|
|
||||||
[ ], // Map 10
|
|
||||||
[ ], // Compass 11
|
|
||||||
[ ], // Radio slot 12
|
|
||||||
[ ], // Watch slot 13
|
|
||||||
[ ], // Comms slot 14
|
|
||||||
[ ], // WeaponThrow 15
|
|
||||||
[ ], // WeaponPut 16
|
|
||||||
[ ] // InventoryItems 17
|
|
||||||
];
|
];
|
||||||
|
|
||||||
private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in variable for perf improvement
|
_configItems = createHashMapFromArray _configItems;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_configItems set [_index, createHashMap];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Cache tools for separate tab
|
||||||
|
private _toolList = createHashMap;
|
||||||
|
|
||||||
|
// https://community.bistudio.com/wiki/Arma_3:_Characters_And_Gear_Encoding_Guide#Character_configuration
|
||||||
|
// https://github.com/acemod/ACE3/pull/9040#issuecomment-1597748331
|
||||||
|
private _filterFunction = toString {
|
||||||
|
isClass _x && {if (isNumber (_x >> "scopeArsenal")) then {getNumber (_x >> "scopeArsenal") == 2 && {getNumber (_x >> "scope") > 0}} else {getNumber (_x >> "scope") == 2}} && {getNumber (_x >> QGVAR(hide)) != 1}
|
||||||
|
};
|
||||||
|
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
private _className = "";
|
||||||
|
private _simulationType = "";
|
||||||
|
private _configItemInfo = "";
|
||||||
|
private _hasItemInfo = false;
|
||||||
|
private _itemInfoType = 0;
|
||||||
|
private _isMiscItem = false;
|
||||||
|
private _isTool = false;
|
||||||
|
|
||||||
|
// Get weapons and other various items
|
||||||
{
|
{
|
||||||
private _configItemInfo = _x >> "ItemInfo";
|
_className = configName _x;
|
||||||
private _simulationType = getText (_x >> "simulation");
|
_simulationType = getText (_x >> "simulation");
|
||||||
private _className = configName _x;
|
_configItemInfo = _x >> "ItemInfo";
|
||||||
private _hasItemInfo = isClass (_configItemInfo);
|
_hasItemInfo = isClass (_configItemInfo);
|
||||||
private _itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
|
_itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
|
||||||
private _isMiscItem = _className isKindOf ["CBA_MiscItem", (_configCfgWeapons)];
|
_isMiscItem = _className isKindOf ["CBA_MiscItem", _cfgWeapons];
|
||||||
|
_isTool = getNumber (_x >> "ACE_isTool") isEqualTo 1;
|
||||||
|
|
||||||
switch true do {
|
switch (true) do {
|
||||||
/* Weapon acc */
|
// Weapon attachments
|
||||||
case (
|
case (
|
||||||
_hasItemInfo &&
|
_hasItemInfo &&
|
||||||
{_itemInfoType in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} &&
|
{!_isMiscItem} &&
|
||||||
{!_isMiscItem}
|
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}
|
||||||
): {
|
): {
|
||||||
|
// Convert type to array index
|
||||||
//Convert type to array index
|
((_configItems get IDX_VIRT_ATTACHMENTS) get ([TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD] find _itemInfoType)) set [_className call FUNC(baseWeapon), nil];
|
||||||
(_cargo select 1) select ([TYPE_OPTICS,TYPE_FLASHLIGHT,TYPE_MUZZLE,TYPE_BIPOD] find _itemInfoType) pushBackUnique _className;
|
|
||||||
};
|
};
|
||||||
/* Headgear */
|
// Headgear
|
||||||
case (_itemInfoType == TYPE_HEADGEAR): {
|
case (_itemInfoType == TYPE_HEADGEAR): {
|
||||||
(_cargo select 3) pushBackUnique _className;
|
(_configItems get IDX_VIRT_HEADGEAR) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* Uniform */
|
// Uniform
|
||||||
case (_itemInfoType == TYPE_UNIFORM): {
|
case (_itemInfoType == TYPE_UNIFORM): {
|
||||||
(_cargo select 4) pushBackUnique _className;
|
(_configItems get IDX_VIRT_UNIFORM) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* Vest */
|
// Vest
|
||||||
case (_itemInfoType == TYPE_VEST): {
|
case (_itemInfoType == TYPE_VEST): {
|
||||||
(_cargo select 5) pushBackUnique _className;
|
(_configItems get IDX_VIRT_VEST) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* NVgs */
|
// NVGs
|
||||||
case (_simulationType == "NVGoggles"): {
|
case (_simulationType == "NVGoggles"): {
|
||||||
(_cargo select 8) pushBackUnique _className;
|
(_configItems get IDX_VIRT_NVG) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* Binos */
|
// Binos
|
||||||
case (_simulationType == "Binocular" ||
|
case (
|
||||||
((_simulationType == 'Weapon') && {(getNumber (_x >> 'type') == TYPE_BINOCULAR_AND_NVG)})): {
|
_simulationType == "Binocular" ||
|
||||||
(_cargo select 9) pushBackUnique _className;
|
{_simulationType == "Weapon" && {getNumber (_x >> "type") == TYPE_BINOCULAR_AND_NVG}}
|
||||||
|
): {
|
||||||
|
(_configItems get IDX_VIRT_BINO) set [_className call FUNC(baseWeapon), nil];
|
||||||
};
|
};
|
||||||
/* Map */
|
// Map
|
||||||
case (_simulationType == "ItemMap"): {
|
case (_simulationType == "ItemMap"): {
|
||||||
(_cargo select 10) pushBackUnique _className;
|
(_configItems get IDX_VIRT_MAP) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* Compass */
|
// Compass
|
||||||
case (_simulationType == "ItemCompass"): {
|
case (_simulationType == "ItemCompass"): {
|
||||||
(_cargo select 11) pushBackUnique _className;
|
(_configItems get IDX_VIRT_COMPASS) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* Radio */
|
// Radio
|
||||||
case (_simulationType == "ItemRadio"): {
|
case (_simulationType == "ItemRadio"): {
|
||||||
(_cargo select 12) pushBackUnique _className;
|
(_configItems get IDX_VIRT_RADIO) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* Watch */
|
// Watch
|
||||||
case (_simulationType == "ItemWatch"): {
|
case (_simulationType == "ItemWatch"): {
|
||||||
(_cargo select 13) pushBackUnique _className;
|
(_configItems get IDX_VIRT_WATCH) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* GPS */
|
// GPS and UAV terminals
|
||||||
case (_simulationType == "ItemGPS"): {
|
case (
|
||||||
(_cargo select 14) pushBackUnique _className;
|
_simulationType == "ItemGPS" ||
|
||||||
|
{_itemInfoType == TYPE_UAV_TERMINAL}
|
||||||
|
): {
|
||||||
|
(_configItems get IDX_VIRT_COMMS) set [_className, nil];
|
||||||
};
|
};
|
||||||
/* UAV terminals */
|
// Weapon, at the bottom to avoid adding binos
|
||||||
case (_itemInfoType == TYPE_UAV_TERMINAL): {
|
case (
|
||||||
(_cargo select 14) pushBackUnique _className;
|
isClass (_x >> "WeaponSlotsInfo") &&
|
||||||
};
|
{getNumber (_x >> "type") != TYPE_BINOCULAR_AND_NVG}
|
||||||
/* Weapon, at the bottom to avoid adding binos */
|
): {
|
||||||
case (isClass (_x >> "WeaponSlotsInfo") &&
|
|
||||||
{getNumber (_x >> 'type') != TYPE_BINOCULAR_AND_NVG}): {
|
|
||||||
switch (getNumber (_x >> "type")) do {
|
switch (getNumber (_x >> "type")) do {
|
||||||
case TYPE_WEAPON_PRIMARY: {
|
case TYPE_WEAPON_PRIMARY: {
|
||||||
(_cargo select 0) select 0 pushBackUnique (_className call bis_fnc_baseWeapon);
|
((_configItems get IDX_VIRT_WEAPONS) get IDX_VIRT_PRIMARY_WEAPONS) set [_className call FUNC(baseWeapon), nil];
|
||||||
};
|
};
|
||||||
case TYPE_WEAPON_HANDGUN: {
|
case TYPE_WEAPON_HANDGUN: {
|
||||||
(_cargo select 0) select 2 pushBackUnique (_className call bis_fnc_baseWeapon);
|
((_configItems get IDX_VIRT_WEAPONS) get IDX_VIRT_HANDGUN_WEAPONS) set [_className call FUNC(baseWeapon), nil];
|
||||||
};
|
};
|
||||||
case TYPE_WEAPON_SECONDARY: {
|
case TYPE_WEAPON_SECONDARY: {
|
||||||
(_cargo select 0) select 1 pushBackUnique (_className call bis_fnc_baseWeapon);
|
((_configItems get IDX_VIRT_WEAPONS) get IDX_VIRT_SECONDARY_WEAPONS) set [_className call FUNC(baseWeapon), nil];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/* Misc items */
|
// Misc. items
|
||||||
case (
|
case (
|
||||||
_hasItemInfo &&
|
_hasItemInfo &&
|
||||||
(_itemInfoType in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD] &&
|
{_isMiscItem &&
|
||||||
{_isMiscItem}) ||
|
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}} ||
|
||||||
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
||||||
{(getText ( _x >> "simulation")) == "ItemMineDetector"}
|
{_simulationType == "ItemMineDetector"}
|
||||||
): {
|
): {
|
||||||
(_cargo select 17) pushBackUnique _className;
|
(_configItems get IDX_VIRT_MISC_ITEMS) set [_className, nil];
|
||||||
|
if (_isTool) then {_toolList set [_className, nil]};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach configProperties [_configCfgWeapons, "isClass _x && {(if (isNumber (_x >> 'scopeArsenal')) then {getNumber (_x >> 'scopeArsenal')} else {getNumber (_x >> 'scope')}) == 2} && {getNumber (_x >> 'ace_arsenal_hide') != 1}", true];
|
} forEach configProperties [_cfgWeapons, _filterFunction, true];
|
||||||
|
|
||||||
private _grenadeList = [];
|
// Get all grenades
|
||||||
{
|
private _grenadeList = createHashMap;
|
||||||
_grenadeList append getArray (_configCfgWeapons >> "Throw" >> _x >> "magazines");
|
|
||||||
} foreach getArray (_configCfgWeapons >> "Throw" >> "muzzles");
|
|
||||||
|
|
||||||
private _putList = [];
|
|
||||||
{
|
|
||||||
_putList append getArray (_configCfgWeapons >> "Put" >> _x >> "magazines");
|
|
||||||
} foreach getArray (_configCfgWeapons >> "Put" >> "muzzles");
|
|
||||||
|
|
||||||
{
|
{
|
||||||
private _className = configName _x;
|
_grenadeList insert [true, (getArray (_cfgWeapons >> "Throw" >> _x >> "magazines")) apply {_x call EFUNC(common,getConfigName)}, []];
|
||||||
|
} forEach getArray (_cfgWeapons >> "Throw" >> "muzzles");
|
||||||
|
|
||||||
switch true do {
|
// Get all explosives, mines, IEDS and similar
|
||||||
|
private _putList = createHashMap;
|
||||||
|
|
||||||
|
{
|
||||||
|
_putList insert [true, (getArray (_cfgWeapons >> "Put" >> _x >> "magazines")) apply {_x call EFUNC(common,getConfigName)}, []];
|
||||||
|
} forEach getArray (_cfgWeapons >> "Put" >> "muzzles");
|
||||||
|
|
||||||
|
// Remove invalid/non-existent entries
|
||||||
|
_grenadeList deleteAt "";
|
||||||
|
_putList deleteAt "";
|
||||||
|
|
||||||
|
private _magazineMiscItems = createHashMap;
|
||||||
|
|
||||||
|
// Get all other grenades, explosives (and similar) and magazines
|
||||||
|
{
|
||||||
|
_className = configName _x;
|
||||||
|
|
||||||
|
switch (true) do {
|
||||||
|
// "Misc. items" magazines (e.g. spare barrels, intel, photos)
|
||||||
|
case (getNumber (_x >> "ACE_isUnique") isEqualTo 1): {
|
||||||
|
(_configItems get IDX_VIRT_MISC_ITEMS) set [_className, nil];
|
||||||
|
_magazineMiscItems set [_className, nil];
|
||||||
|
if (getNumber (_x >> "ACE_isTool") isEqualTo 1) then {_toolList set [_className, nil]};
|
||||||
|
};
|
||||||
// Grenades
|
// Grenades
|
||||||
case (_className in _grenadeList): {
|
case (_className in _grenadeList): {
|
||||||
(_cargo select 15) pushBackUnique _className;
|
(_configItems get IDX_VIRT_GRENADES) set [_className, nil];
|
||||||
};
|
};
|
||||||
// Put
|
// Explosives
|
||||||
case (_className in _putList): {
|
case (_className in _putList): {
|
||||||
(_cargo select 16) pushBackUnique _className;
|
(_configItems get IDX_VIRT_EXPLOSIVES) set [_className, nil];
|
||||||
};
|
};
|
||||||
// Rifle, handgun, secondary weapons mags
|
// Primary, handgun & secondary weapon magazines, and magazines that are forced with "ace_arsenal_hide = -1"
|
||||||
case (
|
case (
|
||||||
((getNumber (_x >> "type") in [TYPE_MAGAZINE_PRIMARY_AND_THROW,TYPE_MAGAZINE_SECONDARY_AND_PUT,1536,TYPE_MAGAZINE_HANDGUN_AND_GL,TYPE_MAGAZINE_MISSILE]) ||
|
getNumber (_x >> QGVAR(hide)) == -1 ||
|
||||||
{(getNumber (_x >> QGVAR(hide))) == -1})
|
{getNumber (_x >> "type") in [TYPE_MAGAZINE_PRIMARY_AND_THROW, TYPE_MAGAZINE_SECONDARY_AND_PUT, 1536, TYPE_MAGAZINE_HANDGUN_AND_GL, TYPE_MAGAZINE_MISSILE]}
|
||||||
): {
|
): {
|
||||||
(_cargo select 2) pushBackUnique _className;
|
(_configItems get IDX_VIRT_ITEMS_ALL) set [_className, nil];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach configProperties [(configFile >> "CfgMagazines"), "isClass _x && {(if (isNumber (_x >> 'scopeArsenal')) then {getNumber (_x >> 'scopeArsenal')} else {getNumber (_x >> 'scope')}) == 2} && {getNumber (_x >> 'ace_arsenal_hide') != 1}", true];
|
} forEach configProperties [_cfgMagazines, _filterFunction, true];
|
||||||
|
|
||||||
|
// Get all backpacks
|
||||||
{
|
{
|
||||||
if (getNumber (_x >> "isBackpack") == 1) then {
|
if (getNumber (_x >> "isBackpack") == 1) then {
|
||||||
(_cargo select 6) pushBackUnique (configName _x);
|
(_configItems get IDX_VIRT_BACKPACK) set [configName _x, nil];
|
||||||
};
|
};
|
||||||
} foreach configProperties [(configFile >> "CfgVehicles"), "isClass _x && {(if (isNumber (_x >> 'scopeArsenal')) then {getNumber (_x >> 'scopeArsenal')} else {getNumber (_x >> 'scope')}) == 2} && {getNumber (_x >> 'ace_arsenal_hide') != 1}", true];
|
} forEach configProperties [configFile >> "CfgVehicles", _filterFunction, true];
|
||||||
|
|
||||||
|
// Get all facewear
|
||||||
|
{
|
||||||
|
(_configItems get IDX_VIRT_GOGGLES) set [configName _x, nil];
|
||||||
|
} forEach configProperties [configFile >> "CfgGlasses", _filterFunction, true];
|
||||||
|
|
||||||
|
// Get all faces
|
||||||
|
private _faceCache = createHashMap;
|
||||||
|
private _dlcName = "";
|
||||||
|
private _modPicture = "";
|
||||||
|
private _faceCategory = "";
|
||||||
|
|
||||||
{
|
{
|
||||||
(_cargo select 7) pushBackUnique (configName _x);
|
_faceCategory = configName _x;
|
||||||
} foreach configProperties [(configFile >> "CfgGlasses"), "isClass _x && {(if (isNumber (_x >> 'scopeArsenal')) then {getNumber (_x >> 'scopeArsenal')} else {getNumber (_x >> 'scope')}) == 2} && {getNumber (_x >> 'ace_arsenal_hide') != 1}", true];
|
|
||||||
|
|
||||||
private _magazineGroups = createHashMap;
|
|
||||||
|
|
||||||
private _cfgMagazines = configFile >> "CfgMagazines";
|
|
||||||
|
|
||||||
{
|
|
||||||
private _magList = [];
|
|
||||||
{
|
{
|
||||||
private _magazines = (getArray _x) select {isClass (_cfgMagazines >> _x)}; //filter out non-existent magazines
|
if (getNumber (_x >> "disabled") == 0 && {getText (_x >> "head") != ""} && {configName _x != "Default"}) then {
|
||||||
_magazines = _magazines apply {configName (_cfgMagazines >> _x)}; //Make sure classname case is correct
|
_dlcName = _x call EFUNC(common,getAddon);
|
||||||
_magList append _magazines;
|
_modPicture = "";
|
||||||
} foreach configProperties [_x, "isArray _x", true];
|
|
||||||
|
|
||||||
_magazineGroups set [toLower configName _x, _magList arrayIntersect _magList];
|
if (_dlcName != "") then {
|
||||||
} foreach configProperties [(configFile >> "CfgMagazineWells"), "isClass _x", true];
|
_modPicture = (modParams [_dlcName, ["logo"]]) param [0, ""];
|
||||||
|
};
|
||||||
|
|
||||||
uiNamespace setVariable [QGVAR(configItems), _cargo];
|
_faceCache set [configName _x, [getText (_x >> "displayName"), _modPicture, _faceCategory]];
|
||||||
uiNamespace setVariable [QGVAR(configItemsFlat), flatten _cargo];
|
};
|
||||||
uiNamespace setVariable [QGVAR(magazineGroups), _magazineGroups];
|
} forEach ("true" configClasses _x);
|
||||||
|
} forEach ("true" configClasses (configfile >> "CfgFaces"));
|
||||||
|
|
||||||
|
// Get all voices
|
||||||
|
private _voiceCache = (configProperties [configFile >> "CfgVoice", "isClass _x && {getNumber (_x >> 'scope') == 2}", true]) - [configfile >> "CfgVoice" >> "NoVoice"];
|
||||||
|
_voiceCache = _voiceCache apply {configName _x};
|
||||||
|
|
||||||
|
// Get all insignia
|
||||||
|
private _insigniaCache = "(if (isNumber (_x >> 'scope')) then {getNumber (_x >> 'scope')} else {2}) == 2" configClasses (configFile >> "CfgUnitInsignia");
|
||||||
|
_insigniaCache = _insigniaCache apply {configName _x};
|
||||||
|
|
||||||
|
// Get all disposable launchers
|
||||||
|
private _launchersConfig = configProperties [configFile >> "CBA_DisposableLaunchers"];
|
||||||
|
private _launchers = createHashMap;
|
||||||
|
private _launcher = "";
|
||||||
|
|
||||||
|
// Get the loaded launchers (used launchers aren't necessary)
|
||||||
|
{
|
||||||
|
// Convert to config case
|
||||||
|
_launcher = ((getArray _x) param [0, ""]) call EFUNC(common,getConfigName);
|
||||||
|
|
||||||
|
if (_launcher != "") then {
|
||||||
|
_launchers set [_launcher, nil];
|
||||||
|
};
|
||||||
|
} forEach _launchersConfig;
|
||||||
|
|
||||||
|
private _configItemsFlat = +_configItems;
|
||||||
|
private _weapons = _configItemsFlat deleteAt IDX_VIRT_WEAPONS;
|
||||||
|
private _attachments = _configItemsFlat deleteAt IDX_VIRT_ATTACHMENTS;
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
|
||||||
|
_configItemsFlat merge [_configItemsFlat deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_PRIMARY_WEAPONS to IDX_VIRT_HANDGUN_WEAPONS do {
|
||||||
|
_configItemsFlat merge [_weapons deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_index" from IDX_VIRT_OPTICS_ATTACHMENTS to IDX_VIRT_BIPOD_ATTACHMENTS do {
|
||||||
|
_configItemsFlat merge [_attachments deleteAt _index, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
// This contains config case entries only
|
||||||
|
uiNamespace setVariable [QGVAR(configItems), _configItems];
|
||||||
|
uiNamespace setVariable [QGVAR(configItemsFlat), _configItemsFlat];
|
||||||
|
uiNamespace setVariable [QGVAR(faceCache), _faceCache];
|
||||||
|
uiNamespace setVariable [QGVAR(voiceCache), _voiceCache];
|
||||||
|
uiNamespace setVariable [QGVAR(insigniaCache), _insigniaCache];
|
||||||
|
uiNamespace setVariable [QGVAR(grenadeCache), _grenadeList];
|
||||||
|
uiNamespace setVariable [QGVAR(putCache), _putList];
|
||||||
|
uiNamespace setVariable [QGVAR(magazineMiscItems), _magazineMiscItems];
|
||||||
|
uiNamespace setVariable [QGVAR(CBAdisposableLaunchers), _launchers];
|
||||||
|
uiNamespace setVariable [QGVAR(configItemsTools), _toolList];
|
||||||
|
@ -15,54 +15,46 @@
|
|||||||
|
|
||||||
if (GVAR(centerNotPlayer)) exitWith {};
|
if (GVAR(centerNotPlayer)) exitWith {};
|
||||||
|
|
||||||
|
// Determine action to play based on current category selection
|
||||||
private _nextAction = switch (GVAR(currentLeftPanel)) do {
|
private _nextAction = switch (GVAR(currentLeftPanel)) do {
|
||||||
|
// Primary weapon
|
||||||
case IDC_buttonPrimaryWeapon : {
|
case IDC_buttonPrimaryWeapon: {
|
||||||
["Civil", "PrimaryWeapon"] select ((GVAR(currentItems) select 0) != "")
|
["Civil", "PrimaryWeapon"] select ((GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON) != "")
|
||||||
};
|
};
|
||||||
case IDC_buttonSecondaryWeapon : {
|
// Secondary weapon
|
||||||
["Civil", "SecondaryWeapon"] select (GVAR(currentItems) select 1 != "")
|
case IDC_buttonSecondaryWeapon: {
|
||||||
|
["Civil", "SecondaryWeapon"] select ((GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON) != "")
|
||||||
};
|
};
|
||||||
case IDC_buttonHandgun : {
|
// Handgun weapon
|
||||||
["Civil", "HandGunOn"] select (GVAR(currentItems) select 2 != "")
|
case IDC_buttonHandgun: {
|
||||||
|
["Civil", "HandGunOn"] select ((GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON) != "")
|
||||||
};
|
};
|
||||||
case IDC_buttonHeadgear;
|
// Binoculars
|
||||||
case IDC_buttonUniform;
|
case IDC_buttonBinoculars: {
|
||||||
case IDC_buttonVest;
|
["Civil", "Binoculars"] select ((GVAR(currentItems) select IDX_CURR_BINO) != "")
|
||||||
case IDC_buttonBackpack;
|
|
||||||
case IDC_buttonGoggles;
|
|
||||||
case IDC_buttonMap;
|
|
||||||
case IDC_buttonGPS;
|
|
||||||
case IDC_buttonRadio;
|
|
||||||
case IDC_buttonCompass;
|
|
||||||
case IDC_buttonWatch;
|
|
||||||
case IDC_buttonFace;
|
|
||||||
case IDC_buttonNVG : {
|
|
||||||
"Civil"
|
|
||||||
};
|
};
|
||||||
case IDC_buttonBinoculars : {
|
// Insignia
|
||||||
["Civil", "Binoculars"] select (GVAR(currentItems) select 9 != "")
|
case IDC_buttonInsignia: {
|
||||||
};
|
|
||||||
case IDC_buttonInsignia : {
|
|
||||||
"Salute"
|
"Salute"
|
||||||
};
|
};
|
||||||
case IDC_buttonVoice : {
|
// Voice
|
||||||
|
case IDC_buttonVoice: {
|
||||||
GVAR(center) directSay "CuratorObjectPlaced";
|
GVAR(center) directSay "CuratorObjectPlaced";
|
||||||
"Civil"
|
"Civil"
|
||||||
};
|
};
|
||||||
|
// Other
|
||||||
|
default {
|
||||||
|
"Civil"
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Play the action if a new category of item was selected
|
||||||
if (_nextAction != GVAR(currentAction)) then {
|
if (_nextAction != GVAR(currentAction)) then {
|
||||||
switch (_nextAction) do {
|
GVAR(selectedWeaponType) = switch (_nextAction) do {
|
||||||
case "PrimaryWeapon": {
|
case "PrimaryWeapon": {0};
|
||||||
GVAR(selectedWeaponType) = 0;
|
case "SecondaryWeapon": {1};
|
||||||
};
|
case "HandGunOn": {2};
|
||||||
case "SecondaryWeapon": {
|
default {GVAR(selectedWeaponType)};
|
||||||
GVAR(selectedWeaponType) = 1;
|
|
||||||
};
|
|
||||||
case "HandGunOn": {
|
|
||||||
GVAR(selectedWeaponType) = 2;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (simulationEnabled GVAR(center)) then {
|
if (simulationEnabled GVAR(center)) then {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe, Dedmen, Brett Mayson
|
* Author: Alganthe, Dedmen, Brett Mayson, johnb43
|
||||||
* Sort arsenal panel.
|
* Sort an arsenal panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Sort control <CONTROL>
|
* 0: Control <CONTROL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -13,12 +13,23 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_sortControl"];
|
params ["_control"];
|
||||||
|
|
||||||
private _display = ctrlParent _sortControl;
|
// When filling the sorting panel, FUNC(sortPanel) is called twice, so ignore first call
|
||||||
|
if (GVAR(ignoreFirstSortPanelCall)) exitWith {
|
||||||
|
GVAR(ignoreFirstSortPanelCall) = false;
|
||||||
|
};
|
||||||
|
|
||||||
private _rightSort = ctrlIDC _sortControl == 17;
|
private _display = ctrlParent _control;
|
||||||
|
private _rightSort = (ctrlIDC _control) in [IDC_sortRightTab, IDC_sortRightTabDirection];
|
||||||
private _right = _rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]};
|
private _right = _rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]};
|
||||||
|
private _sortCtrl = _display displayCtrl ([IDC_sortLeftTab, IDC_sortRightTab] select _rightSort);
|
||||||
|
private _sortDirectionCtrl = _display displayCtrl ([IDC_sortLeftTabDirection, IDC_sortRightTabDirection] select _rightSort);
|
||||||
|
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
private _cfgFaces = configFile >> "CfgFaces";
|
||||||
|
private _cfgUnitInsignia = configFile >> "CfgUnitInsignia";
|
||||||
|
private _cfgUnitInsigniaMission = missionConfigFile >> "CfgUnitInsignia";
|
||||||
|
|
||||||
if (_rightSort) then {
|
if (_rightSort) then {
|
||||||
[
|
[
|
||||||
@ -33,8 +44,8 @@ if (_rightSort) then {
|
|||||||
case IDC_buttonThrow;
|
case IDC_buttonThrow;
|
||||||
case IDC_buttonPut;
|
case IDC_buttonPut;
|
||||||
case IDC_buttonMag;
|
case IDC_buttonMag;
|
||||||
case IDC_buttonMagALL: { configFile >> "CfgMagazines" };
|
case IDC_buttonMagALL: {_cfgMagazines};
|
||||||
default { configFile >> "CfgWeapons" };
|
default {configFile >> "CfgWeapons"};
|
||||||
},
|
},
|
||||||
GVAR(sortListRightPanel) select (
|
GVAR(sortListRightPanel) select (
|
||||||
switch (GVAR(currentRightPanel)) do {
|
switch (GVAR(currentRightPanel)) do {
|
||||||
@ -56,12 +67,12 @@ if (_rightSort) then {
|
|||||||
[
|
[
|
||||||
_display displayCtrl IDC_leftTabContent,
|
_display displayCtrl IDC_leftTabContent,
|
||||||
switch (GVAR(currentLeftPanel)) do {
|
switch (GVAR(currentLeftPanel)) do {
|
||||||
case IDC_buttonBackpack: { configFile >> "CfgVehicles" };
|
case IDC_buttonBackpack: {configFile >> "CfgVehicles"};
|
||||||
case IDC_buttonGoggles: { configFile >> "CfgGlasses" };
|
case IDC_buttonGoggles: {configFile >> "CfgGlasses"};
|
||||||
case IDC_buttonFace: { configFile >> "CfgFaces" >> "Man_A3" };
|
case IDC_buttonFace: {_cfgFaces};
|
||||||
case IDC_buttonVoice: { configFile >> "CfgVoice" };
|
case IDC_buttonVoice: {configFile >> "CfgVoice"};
|
||||||
case IDC_buttonInsignia: { configFile >> "CfgUnitInsignia" };
|
case IDC_buttonInsignia: {_cfgUnitInsignia};
|
||||||
default { configFile >> "CfgWeapons" };
|
default {configFile >> "CfgWeapons"};
|
||||||
},
|
},
|
||||||
(GVAR(sortListLeftPanel) select ([
|
(GVAR(sortListLeftPanel) select ([
|
||||||
IDC_buttonPrimaryWeapon,
|
IDC_buttonPrimaryWeapon,
|
||||||
@ -86,101 +97,174 @@ if (_rightSort) then {
|
|||||||
]
|
]
|
||||||
} params ["_panel", "_cfgClass", "_sorts"];
|
} params ["_panel", "_cfgClass", "_sorts"];
|
||||||
|
|
||||||
|
// Get sort & sort direction
|
||||||
|
private _sortName = _sortCtrl lbData (0 max lbCurSel _sortCtrl);
|
||||||
|
private _sortDirection = _sortDirectionCtrl lbValue (0 max lbCurSel _sortDirectionCtrl);
|
||||||
|
(_sorts select (0 max (_sorts findIf {(_x select 0) == _sortName}))) params ["", "_displayName", "_statement"];
|
||||||
|
|
||||||
|
// Update last sort & sort direction
|
||||||
|
missionNamespace setVariable [
|
||||||
|
[QGVAR(lastSortLeft), QGVAR(lastSortRight)] select _rightSort,
|
||||||
|
_displayName
|
||||||
|
];
|
||||||
|
|
||||||
|
missionNamespace setVariable [
|
||||||
|
[QGVAR(lastSortDirectionLeft), QGVAR(lastSortDirectionRight)] select _rightSort,
|
||||||
|
_sortDirection
|
||||||
|
];
|
||||||
|
|
||||||
|
// Get currently selected item
|
||||||
private _curSel = if (_right) then {
|
private _curSel = if (_right) then {
|
||||||
lnbCurSelRow _panel
|
lnbCurSelRow _panel
|
||||||
} else {
|
} else {
|
||||||
lbCurSel _panel
|
lbCurSel _panel
|
||||||
};
|
};
|
||||||
|
|
||||||
private _selected = if (_right) then {
|
private _selected = if (_right) then {
|
||||||
_panel lnbData [_curSel, 0];
|
_panel lnbData [_curSel, 0]
|
||||||
} else {
|
} else {
|
||||||
_panel lbData _curSel
|
_panel lbData _curSel
|
||||||
};
|
};
|
||||||
|
|
||||||
private _sortName = _sortControl lbData (0 max lbCurSel _sortControl);
|
|
||||||
private _sortConfig = _sorts select (0 max (_sorts findIf {(_x select 0) isEqualTo _sortName}));
|
|
||||||
private _statement = _sortConfig select 2;
|
|
||||||
|
|
||||||
missionNamespace setVariable [
|
|
||||||
[QGVAR(lastSortLeft), QGVAR(lastSortRight)] select _rightSort,
|
|
||||||
_sortConfig select 1
|
|
||||||
];
|
|
||||||
|
|
||||||
private _originalNames = createHashMap;
|
private _originalNames = createHashMap;
|
||||||
|
private _item = "";
|
||||||
|
private _quantity = "";
|
||||||
|
private _itemCfg = configNull;
|
||||||
|
private _value = "";
|
||||||
|
private _name = "";
|
||||||
|
|
||||||
|
private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems);
|
||||||
|
private _sortCache = uiNamespace getVariable QGVAR(sortCache);
|
||||||
|
|
||||||
|
private _faceCache = if (_cfgClass == _cfgFaces) then {
|
||||||
|
uiNamespace getVariable [QGVAR(faceCache), createHashMap]
|
||||||
|
} else {
|
||||||
|
createHashMap
|
||||||
|
};
|
||||||
|
|
||||||
|
private _countColumns = if (_right) then {
|
||||||
|
count lnbGetColumnsPosition _panel
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
private _for = if (_right) then {
|
private _for = if (_right) then {
|
||||||
for '_i' from 0 to ((lnbSize _panel select 0) - 1)
|
for '_i' from 0 to (lnbSize _panel select 0) - 1
|
||||||
} else {
|
} else {
|
||||||
for '_i' from 0 to (lbSize _panel - 1)
|
for '_i' from 0 to (lbSize _panel) - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
_for do {
|
_for do {
|
||||||
private _item = if (_right) then {
|
// Get item
|
||||||
|
_item = if (_right) then {
|
||||||
_panel lnbData [_i, 0]
|
_panel lnbData [_i, 0]
|
||||||
} else {
|
} else {
|
||||||
_panel lbData _i
|
_panel lbData _i
|
||||||
};
|
};
|
||||||
private _quantity = if (_right) then {
|
|
||||||
|
// Get item's count
|
||||||
|
_quantity = if (_right) then {
|
||||||
parseNumber (_panel lnbText [_i, 2])
|
parseNumber (_panel lnbText [_i, 2])
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
private _itemCfg = _cfgClass >> _item;
|
// "Misc. items" magazines (e.g. spare barrels, intel, photos)
|
||||||
|
if (_item in _magazineMiscItems) then {
|
||||||
|
_cfgClass = _cfgMagazines;
|
||||||
|
};
|
||||||
|
|
||||||
// In rare cases, item may not belong to the config class for the panel
|
// Check item's config
|
||||||
// For example, misc items panel can contain CfgVehicles and CfgGlasses items in addition to the usual CfgWeapons items
|
_itemCfg = if !(_cfgClass in [_cfgFaces, _cfgUnitInsignia]) then {
|
||||||
|
_cfgClass >> _item
|
||||||
|
} else {
|
||||||
|
// If insignia, check both config and mission file
|
||||||
|
if (_cfgClass == _cfgUnitInsignia) then {
|
||||||
|
_itemCfg = _cfgClass >> _item;
|
||||||
|
|
||||||
|
if (isNull _itemCfg) then {
|
||||||
|
_itemCfg = _cfgUnitInsigniaMission >> _item;
|
||||||
|
};
|
||||||
|
|
||||||
|
_itemCfg
|
||||||
|
} else {
|
||||||
|
// If face, check correct category
|
||||||
|
_cfgClass >> (_faceCache get _item) param [2, "Man_A3"] >> _item
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Some items may not belong to the config class for the panel (e.g. misc. items panel can have unique items)
|
||||||
if (isNull _itemCfg) then {
|
if (isNull _itemCfg) then {
|
||||||
_itemCfg = _item call CBA_fnc_getItemConfig;
|
_itemCfg = _item call CBA_fnc_getItemConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _value = [_itemCfg, _item, _quantity] call _statement;
|
// Value can be any type
|
||||||
if (_value isEqualType 0) then {
|
_value = _sortCache getOrDefaultCall [format ["%1_%2_%3", _sortName, _item, _quantity], {
|
||||||
_value = [_value, 8] call CBA_fnc_formatNumber;
|
private _value = [_itemCfg, _item, _quantity] call _statement;
|
||||||
};
|
|
||||||
if (_value isEqualTo "") then {
|
|
||||||
_value = "_";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// If number, convert to string (keep 2 decimal after comma; Needed for correct weight sorting)
|
||||||
|
if (_value isEqualType 0) then {
|
||||||
|
_value = [_value, 8, 2] call CBA_fnc_formatNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
// If empty string, add alphabetically small char at beginning to make it sort correctly
|
||||||
|
if (_value isEqualTo "") then {
|
||||||
|
_value = "_";
|
||||||
|
};
|
||||||
|
|
||||||
|
_value
|
||||||
|
}, true];
|
||||||
|
|
||||||
|
// Save the current row's item's name in a cache and set text to it's sorting value
|
||||||
if (_right) then {
|
if (_right) then {
|
||||||
private _name = _panel lnbText [_i, 1];
|
_originalNames set [_item, _panel lnbText [_i, 1]];
|
||||||
_originalNames set [_item, _name];
|
|
||||||
|
|
||||||
_panel lnbSetText [[_i, 1], format ["%1%2", _value, _name]];
|
// Use tooltip to sort, as it also contains the classname, which means a fixed alphabetical order is guaranteed
|
||||||
|
_panel lnbSetText [[_i, 1], format ["%1%2", _value, _panel lbTooltip (_i * _countColumns)]];
|
||||||
} else {
|
} else {
|
||||||
if (_item isNotEqualTo "") then {
|
if (_item != "") then {
|
||||||
private _name = _panel lbText _i;
|
_originalNames set [_item, _panel lbText _i];
|
||||||
_originalNames set [_item, _name];
|
|
||||||
|
|
||||||
_panel lbSetText [_i, format ["%1%2", _value, _name]];
|
// Use tooltip to sort, as it also contains the classname, which means a fixed alphabetical order is guaranteed
|
||||||
|
_panel lbSetText [_i, format ["%1%2", _value, _panel lbTooltip _i]];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Sort alphabetically, find the previously selected item, select it again and reset text to original text
|
||||||
if (_right) then {
|
if (_right) then {
|
||||||
_panel lnbSort [1, false];
|
_panel lnbSort [1, _sortDirection == ASCENDING];
|
||||||
|
|
||||||
_for do {
|
_for do {
|
||||||
private _data = _panel lnbData [_i, 0];
|
_item = _panel lnbData [_i, 0];
|
||||||
|
|
||||||
if (_curSel >= 0 && {_data == _selected}) then {
|
_panel lnbSetText [[_i, 1], _originalNames get _item];
|
||||||
|
|
||||||
|
// Set selection after text, otherwise item info box on the right side shows invalid name
|
||||||
|
if (_curSel != -1 && {_item == _selected}) then {
|
||||||
_panel lnbSetCurSelRow _i;
|
_panel lnbSetCurSelRow _i;
|
||||||
};
|
|
||||||
|
|
||||||
_panel lnbSetText [[_i, 1], _originalNames get _data];
|
// To avoid unnecessary checks after previsouly selected item was found
|
||||||
|
_curSel = -1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
lbSort [_panel, "ASC"];
|
lbSort [_panel, ["DESC", "ASC"] select _sortDirection];
|
||||||
|
|
||||||
_for do {
|
_for do {
|
||||||
private _data = _panel lbData _i;
|
_item = _panel lbData _i;
|
||||||
|
|
||||||
if (_curSel >= 0 && {_data == _selected}) then {
|
// Check if valid item (problems can be caused when searching)
|
||||||
_panel lbSetCurSel _i;
|
if (_item != "") then {
|
||||||
|
_panel lbSetText [_i, _originalNames get _item];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_data isNotEqualTo "") then {
|
// Set selection after text, otherwise item info box on the right side shows invalid name
|
||||||
_panel lbSetText [_i, _originalNames get _data];
|
if (_curSel != -1 && {_item == _selected}) then {
|
||||||
|
_panel lbSetCurSel _i;
|
||||||
|
|
||||||
|
// To avoid unnecessary checks after previsouly selected item was found
|
||||||
|
_curSel = -1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
params ["_config"];
|
params ["_config"];
|
||||||
|
|
||||||
private _fireModes = getArray (_config >> "modes");
|
|
||||||
private _dispersion = [];
|
private _dispersion = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -27,7 +26,7 @@ private _dispersion = [];
|
|||||||
|
|
||||||
_dispersion pushBackUnique _n;
|
_dispersion pushBackUnique _n;
|
||||||
};
|
};
|
||||||
} foreach _fireModes;
|
} forEach (getArray (_config >> "modes"));
|
||||||
|
|
||||||
_dispersion sort true;
|
_dispersion sort true;
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* Statement to sort items by the amount in inventory.
|
* Statement to sort items by the amount in inventory.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Item Config <CONFIG>
|
* 0: Not used
|
||||||
* 1: Item Name <STRING>
|
* 1: Not used
|
||||||
* 2: Quantity <NUMBER>
|
* 2: Quantity <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Brett Mayson
|
* Author: Brett Mayson, johnb43
|
||||||
* Statement to sort items by the mod they belong to.
|
* Statement to sort items by the mod they belong to.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -14,13 +14,4 @@
|
|||||||
|
|
||||||
params ["_config"];
|
params ["_config"];
|
||||||
|
|
||||||
private _dlc = "";
|
(modParams [_config call EFUNC(common,getAddon), ["name"]]) param [0, ""]
|
||||||
private _addons = configSourceAddonList _config;
|
|
||||||
if (_addons isNotEqualTo []) then {
|
|
||||||
private _mods = configSourceModList (configfile >> "CfgPatches" >> _addons select 0);
|
|
||||||
if (_mods isNotEqualTo []) then {
|
|
||||||
_dlc = _mods select 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
modParams [_dlc, ["name"]] param [0, ""]
|
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_itemInfo", "_ballisticCo", "_explosiveCo"];
|
params ["_itemInfo", "_ballisticCo", "_explosiveCo"];
|
||||||
_itemInfo params ["_itemCfg"];
|
_itemInfo params ["_config"];
|
||||||
|
|
||||||
(([[_itemCfg], ["passthrough", "armor"]] call BIS_fnc_configExtremes) select 1) params [["_passthroughMax", 0], ["_armorMax", 0]];
|
(([[_config], ["passthrough", "armor"]] call BIS_fnc_configExtremes) select 1) params [["_passthroughMax", 0], ["_armorMax", 0]];
|
||||||
|
|
||||||
private _protectionCombined = _passthroughMax * _ballisticCo + _armorMax * _explosiveCo;
|
_passthroughMax * _ballisticCo + _armorMax * _explosiveCo;
|
||||||
|
|
||||||
_protectionCombined
|
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
|
|
||||||
params ["_config"];
|
params ["_config"];
|
||||||
|
|
||||||
private _fireModes = getArray (_config >> "modes");
|
|
||||||
private _fireRate = [];
|
private _fireRate = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_fireRate pushBackUnique getNumber (_config >> _x >> "reloadTime");
|
_fireRate pushBackUnique getNumber (_config >> _x >> "reloadTime");
|
||||||
} foreach _fireModes;
|
} forEach (getArray (_config >> "modes"));
|
||||||
|
|
||||||
_fireRate sort true;
|
_fireRate sort true;
|
||||||
_fireRate = _fireRate param [0, 0];
|
_fireRate = _fireRate param [0, 0];
|
||||||
|
|
||||||
if (_fireRate == 0) exitWith {0};
|
if (_fireRate == 0) exitWith {0};
|
||||||
|
|
||||||
round (60 / _fireRate)
|
round (60 / _fireRate)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 0: Item Config <CONFIG>
|
* 0: Item Config <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Sorting Value <NUMBER|STRING>
|
* Sorting Value <NUMBER> <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -15,6 +15,7 @@
|
|||||||
params ["_config"];
|
params ["_config"];
|
||||||
|
|
||||||
private _minZoom = 999; // FOV, so smaller is more zoomed in
|
private _minZoom = 999; // FOV, so smaller is more zoomed in
|
||||||
|
|
||||||
{
|
{
|
||||||
_minZoom = _minZoom min getNumber (_x >> "opticsZoomMin");
|
_minZoom = _minZoom min getNumber (_x >> "opticsZoomMin");
|
||||||
} forEach configProperties [_config >> "ItemInfo" >> "OpticsModes", "isClass _x"];
|
} forEach configProperties [_config >> "ItemInfo" >> "OpticsModes", "isClass _x"];
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
* Accuracy bar statement.
|
* Accuracy bar statement.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: stats array (ARRAY)
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
* 2: Args
|
* 2: Args <ARRAY>
|
||||||
* 2.1: Stat limits (ARRAY of BOOL)
|
* 2.0: Stat limits <ARRAY of BOOLS>
|
||||||
* 2.2: Bar limits (ARRAY of SCALAR)
|
* 2.1: Bar limits <ARRAY of NUMBERS>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* <NUMBER>
|
* <NUMBER>
|
||||||
@ -16,20 +16,22 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_stat", "_config", "_args"];
|
params ["", "_config", "_args"];
|
||||||
_args params ["_statMinMax", "_barLimits"];
|
_args params ["_statMinMax", "_barLimits"];
|
||||||
|
|
||||||
private _fireModes = getArray (_config >> "modes");
|
|
||||||
private _dispersion = [];
|
private _dispersion = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
if (getNumber (_config >> _x >> "showToPlayer") != 0) then {
|
if (getNumber (_config >> _x >> "showToPlayer") != 0) then {
|
||||||
private _n = log (getNumber (_config >> _x >> "dispersion"));
|
private _n = log (getNumber (_config >> _x >> "dispersion"));
|
||||||
|
|
||||||
if (!finite _n) then {_n = 0;};
|
if (!finite _n) then {
|
||||||
|
_n = 0;
|
||||||
|
};
|
||||||
|
|
||||||
_dispersion pushBackUnique _n;
|
_dispersion pushBackUnique _n;
|
||||||
};
|
};
|
||||||
} foreach _fireModes;
|
} forEach (getArray (_config >> "modes"));
|
||||||
|
|
||||||
_dispersion sort true;
|
_dispersion sort true;
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
* 0: Stat <STRING>
|
* 0: Stat <STRING>
|
||||||
* 1: Item config path <CONFIG>
|
* 1: Item config path <CONFIG>
|
||||||
* 2: Args for configExtreme <ARRAY>
|
* 2: Args for configExtreme <ARRAY>
|
||||||
* 2.1: Stat limits <ARRAY of BOOLS>
|
* 2.0: Stat limits <ARRAY of BOOLS>
|
||||||
* 2.2: Bar limits <ARRAY of NUMBERS>
|
* 2.1: Bar limits <ARRAY of NUMBERS>
|
||||||
* 2.3: Evaluate as a logarithmic number <BOOL>
|
* 2.2: Evaluate as a logarithmic number <BOOL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Bar statement <NUMBER>
|
* Bar statement <NUMBER>
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Impact bar statement.
|
* Impact bar statement.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: stats array (ARRAY)
|
* 0: Stats array <ARRAY>
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
* 2: Args for configExtreme
|
* 2: Args for configExtreme <ARRAY>
|
||||||
* 2.1: Stat limits (ARRAY of BOOL)
|
* 2.0: Stats limits <ARRAY of BOOLS>
|
||||||
* 2.2: Bar limits (ARRAY of SCALAR)
|
* 2.1: Bar limits <ARRAY of NUMBERS>
|
||||||
* 2.3: Evaluate as a logarithmic number (BOOL)
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Number
|
* Number
|
||||||
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_stats", "_config", "_args"];
|
params ["_stats", "_config", "_args"];
|
||||||
_args params ["_hitMinMax", "_initSpeedMinMax", "_launcherTabIDC"];
|
_args params ["_hitMinMax", "_initSpeedMinMax"];
|
||||||
|
|
||||||
private _statValues = [
|
private _statValues = [
|
||||||
[_config],
|
[_config],
|
||||||
@ -31,4 +31,5 @@ private _statValues = [
|
|||||||
_hit = linearConversion [_hitMinMax select 0, _hitMinMax select 1, _hit, 0.01, 1];
|
_hit = linearConversion [_hitMinMax select 0, _hitMinMax select 1, _hit, 0.01, 1];
|
||||||
_initSpeed = linearConversion [_initSpeedMinMax select 0, _initSpeedMinMax select 1, _initSpeed, 0.01, 1];
|
_initSpeed = linearConversion [_initSpeedMinMax select 0, _initSpeedMinMax select 1, _initSpeed, 0.01, 1];
|
||||||
|
|
||||||
[sqrt(_hit^2 * _initSpeed), _hit] select (GVAR(currentLeftPanel) == _launcherTabIDC)
|
// If launcher tab
|
||||||
|
[sqrt (_hit ^ 2 * _initSpeed), _hit] select (GVAR(currentLeftPanel) == IDC_buttonSecondaryWeapon)
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
* Rate of fire bar statement.
|
* Rate of fire bar statement.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: stats array (ARRAY)
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
* 2: Args
|
* 2: Args <ARRAY>
|
||||||
* 2.1: Stat limits (ARRAY of BOOL)
|
* 2.0: Stat limits <ARRAY of BOOLS>
|
||||||
* 2.2: Bar limits (ARRAY of SCALAR)
|
* 2.1: Bar limits <ARRAY of NUMBERS>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Number
|
* Number
|
||||||
@ -16,17 +16,20 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_stat", "_config", "_args"];
|
params ["", "_config", "_args"];
|
||||||
_args params ["_statMinMax", "_barLimits"];
|
_args params ["_statMinMax", "_barLimits"];
|
||||||
|
|
||||||
private _fireModes = getArray (_config >> "modes");
|
|
||||||
private _fireRate = [];
|
private _fireRate = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private _n = log (getNumber (_config >> _x >> "reloadTime"));
|
private _n = log (getNumber (_config >> _x >> "reloadTime"));
|
||||||
if (!finite _n) then {_n = 0;};
|
|
||||||
|
if (!finite _n) then {
|
||||||
|
_n = 0;
|
||||||
|
};
|
||||||
|
|
||||||
_fireRate pushBackUnique _n;
|
_fireRate pushBackUnique _n;
|
||||||
} foreach _fireModes;
|
} forEach (getArray (_config >> "modes"));
|
||||||
|
|
||||||
_fireRate sort true;
|
_fireRate sort true;
|
||||||
|
|
||||||
|
@ -1,34 +1,30 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Accuracy text statement.
|
* Accuracy text statement.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: stat (STRING)
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
* 2: Args for configExtreme
|
|
||||||
* 2.1: Stat limits (ARRAY of BOOL)
|
|
||||||
* 2.2: Evaluate as a logarithmic number (BOOL)
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Number
|
* Stat Text <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_stat", "_config", "_args"];
|
params ["", "_config"];
|
||||||
_args params ["_statMinMax", "_configExtremeBool"];
|
TRACE_1("statTextStatement_accuracy",_config);
|
||||||
|
|
||||||
private _fireModes = getArray (_config >> "modes");
|
|
||||||
private _dispersion = [];
|
private _dispersion = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
if (getNumber (_config >> _x >> "showToPlayer") != 0) then {
|
if (getNumber (_config >> _x >> "showToPlayer") != 0) then {
|
||||||
_dispersion pushBackUnique (getNumber (_config >> _x >> "dispersion"));
|
_dispersion pushBackUnique (getNumber (_config >> _x >> "dispersion"));
|
||||||
};
|
};
|
||||||
} foreach _fireModes;
|
} forEach (getArray (_config >> "modes"));
|
||||||
|
|
||||||
_dispersion sort true;
|
_dispersion sort true;
|
||||||
_dispersion = _dispersion param [0, 0];
|
_dispersion = _dispersion param [0, 0];
|
||||||
|
|
||||||
format ["%1 MIL (%2 MOA)", (_dispersion * 1000) toFixed 2, (_dispersion / pi * 10800) ToFixed 1];
|
format ["%1 MIL (%2 MOA)", (_dispersion * 1000) toFixed 2, (_dispersion / pi * 10800) toFixed 1];
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* Text statement for the explosion time stat.
|
* Text statement for the explosion time stat.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Stats Array (not used) <ARRAY>
|
* 0: Not used
|
||||||
* 1: Item Config <CONFIG>
|
* 1: Item config path <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Stat Text <STRING>
|
* Stat Text <STRING>
|
||||||
@ -17,17 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
params ["", "_config"];
|
params ["", "_config"];
|
||||||
|
TRACE_1("statTextStatement_explosionTime",_config);
|
||||||
|
|
||||||
private _ammoConfig = configFile >> "CfgAmmo" >> getText (_config >> "ammo");
|
private _ammoConfig = configFile >> "CfgAmmo" >> getText (_config >> "ammo");
|
||||||
private _timeToLive = getNumber (_ammoConfig >> "timeToLive");
|
private _timeToLive = getNumber (_ammoConfig >> "timeToLive");
|
||||||
private _explosionTime = getNumber (_ammoConfig >> "explosionTime");
|
private _explosionTime = getNumber (_ammoConfig >> "explosionTime");
|
||||||
|
|
||||||
|
// Handle IR grenades
|
||||||
if (_explosionTime > _timeToLive) exitWith {
|
if (_explosionTime > _timeToLive) exitWith {
|
||||||
"-" // Handle IR grenades
|
"-"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_explosionTime == -1) exitWith {
|
if (_explosionTime == -1) exitWith {
|
||||||
localize LSTRING(DetonatesOnImpact)
|
LLSTRING(DetonatesOnImpact)
|
||||||
};
|
};
|
||||||
|
|
||||||
format ["%1s", _explosionTime]
|
format ["%1s", _explosionTime]
|
||||||
|
@ -4,16 +4,17 @@
|
|||||||
* Text statement for the mass stat.
|
* Text statement for the mass stat.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: not used
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* String to display
|
* Stat Text <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["", "_config"];
|
params ["", "_config"];
|
||||||
|
TRACE_1("statTextStatement_mass",_config);
|
||||||
|
|
||||||
private _mass = getNumber (_config >> "mass");
|
private _mass = getNumber (_config >> "mass");
|
||||||
|
|
||||||
@ -25,4 +26,4 @@ if (_mass == 0 && {isClass (_config >> "WeaponSlotsInfo")}) then {
|
|||||||
_mass = getNumber (_config >> "WeaponSlotsInfo" >> "mass");
|
_mass = getNumber (_config >> "WeaponSlotsInfo" >> "mass");
|
||||||
};
|
};
|
||||||
|
|
||||||
format ["%1kg (%2lb)",((_mass * 0.1 * (1/2.2046) * 100) / 100) ToFixed 2, ((_mass * 0.1 * 100) / 100) ToFixed 2]
|
format ["%1kg (%2lb)", ((_mass * 0.1 * (1 / 2.2046) * 100) / 100) toFixed 2, ((_mass * 0.1 * 100) / 100) toFixed 2]
|
||||||
|
@ -4,30 +4,27 @@
|
|||||||
* Rate of fire text statement.
|
* Rate of fire text statement.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: stat (STRING)
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
* 2: Args for configExtreme
|
|
||||||
* 2.1: Stat limits (ARRAY of BOOL)
|
|
||||||
* 2.2: Evaluate as a logarithmic number (BOOL)
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* String
|
* Stat Text <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_stat", "_config", "_args"];
|
params ["", "_config"];
|
||||||
_args params ["_statMinMax", "_configExtremeBool"];
|
TRACE_1("statTextStatement_rateOfFire",_config);
|
||||||
|
|
||||||
private _fireModes = getArray (_config >> "modes");
|
|
||||||
private _fireRate = [];
|
private _fireRate = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_fireRate pushBackUnique (getNumber (_config >> _x >> "reloadTime"));
|
_fireRate pushBackUnique (getNumber (_config >> _x >> "reloadTime"));
|
||||||
} foreach _fireModes;
|
} forEach (getArray (_config >> "modes"));
|
||||||
|
|
||||||
_fireRate sort true;
|
_fireRate sort true;
|
||||||
_fireRate = _fireRate param [0, 0];
|
_fireRate = _fireRate param [0, 0];
|
||||||
|
|
||||||
if (_fireRate == 0) exitWith {"PEWPEWPEW"};
|
if (_fireRate == 0) exitWith {"PEWPEWPEW"};
|
||||||
|
|
||||||
format ["%1 rpm", round (60 / _fireRate)]
|
format ["%1 rpm", round (60 / _fireRate)]
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
* Text statement for the scope magnification stat.
|
* Text statement for the scope magnification stat.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: not used
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* String to display
|
* Stat Text <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -17,10 +17,11 @@ params ["", "_config"];
|
|||||||
TRACE_1("statTextStatement_scopeMag",_config);
|
TRACE_1("statTextStatement_scopeMag",_config);
|
||||||
|
|
||||||
private _minZoom = 999; // FOV, so smaller is more zoomed in
|
private _minZoom = 999; // FOV, so smaller is more zoomed in
|
||||||
|
|
||||||
{
|
{
|
||||||
_minZoom = _minZoom min (getNumber (_x >> "opticsZoomMin"));
|
_minZoom = _minZoom min (getNumber (_x >> "opticsZoomMin"));
|
||||||
} forEach configProperties [_config >> "ItemInfo" >> "OpticsModes"];
|
} forEach configProperties [_config >> "ItemInfo" >> "OpticsModes"];
|
||||||
|
|
||||||
if (_minZoom in [0, 999]) exitWith {"?"};
|
if (_minZoom in [0, 999]) exitWith {"?"};
|
||||||
|
|
||||||
format ["%1x", (0.25/_minZoom) toFixed 1]
|
format ["%1x", (0.25 / _minZoom) toFixed 1]
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Dedmen
|
* Author: Dedmen, johnb43
|
||||||
* Text statement for the scope Night vision support stat.
|
* Text statement for the scope Night vision support stat.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: not used
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* String to display
|
* Stat Text <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -17,12 +17,12 @@ params ["", "_config"];
|
|||||||
TRACE_1("statTextStatement_scopeVisionMode",_config);
|
TRACE_1("statTextStatement_scopeVisionMode",_config);
|
||||||
|
|
||||||
private _opticsModes = ("true" configClasses (_config >> "ItemInfo" >> "OpticsModes")) apply {
|
private _opticsModes = ("true" configClasses (_config >> "ItemInfo" >> "OpticsModes")) apply {
|
||||||
private _visionMode = getArray (_x >> "visionMode");
|
private _visionMode = getArray (_x >> "visionMode") apply {toLower _x};
|
||||||
[
|
[
|
||||||
getNumber (_x >> "useModelOptics") == 1, //is in optics
|
getNumber (_x >> "useModelOptics") == 1, // Is in optics
|
||||||
_visionMode isEqualTo [], //optional NVG
|
_visionMode isEqualTo [], // Optional NVG
|
||||||
"NVG" in _visionMode, //Integrated NVG
|
"nvg" in _visionMode, // Integrated NVG
|
||||||
"Ti" in _visionMode //Integrated Thermal
|
"ti" in _visionMode // Integrated Thermal
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,26 +33,29 @@ private _secondaryNVGSupported = false;
|
|||||||
|
|
||||||
{
|
{
|
||||||
_x params ["_isPrimary", "_optionalNvg", "_integratedNVG", "_integratedTi"];
|
_x params ["_isPrimary", "_optionalNvg", "_integratedNVG", "_integratedTi"];
|
||||||
|
|
||||||
if (_isPrimary) then {
|
if (_isPrimary) then {
|
||||||
if (_integratedNVG) then {
|
if (_integratedNVG) then {
|
||||||
_primaryNVGIntegrated = true;
|
_primaryNVGIntegrated = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_optionalNvg) then {
|
if (_optionalNvg) then {
|
||||||
_primaryNVGSupported = true;
|
_primaryNVGSupported = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_integratedTi) then {
|
if (_integratedTi) then {
|
||||||
_primaryTiIntegrated = true;
|
_primaryTiIntegrated = true;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (_optionalNvg) then {
|
if (_optionalNvg) then {
|
||||||
_secondaryNVGSupported = true;
|
_secondaryNVGSupported = true;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
} forEach _opticsModes;
|
} forEach _opticsModes;
|
||||||
|
|
||||||
//Detecting Primary by useModelOptics works in 99.9% of cases.
|
// Detecting Primary by useModelOptics works in 99.9% of cases.
|
||||||
//But on some scopes (from one specific mod) even the primary mode has useModelOptics=false
|
// But on some scopes (from one specific mod) even the primary mode has useModelOptics=false
|
||||||
//So we have this workaround
|
// So we have this workaround
|
||||||
|
|
||||||
// If we only have a single mode and it's a secondary, then consider it primary.
|
// If we only have a single mode and it's a secondary, then consider it primary.
|
||||||
if (count _opticsModes == 1 && {!(_opticsModes select 0 select 0)}) then {
|
if (count _opticsModes == 1 && {!(_opticsModes select 0 select 0)}) then {
|
||||||
|
@ -4,22 +4,22 @@
|
|||||||
* Text statement for the smoke / chemlight time to live stat.
|
* Text statement for the smoke / chemlight time to live stat.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: not used
|
* 0: Not used
|
||||||
* 1: item config path (CONFIG)
|
* 1: Item config path <CONFIG>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* String to display
|
* Stat Text <STRING>
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["", "_config"];
|
params ["", "_config"];
|
||||||
|
TRACE_1("statTextStatement_smokeChemTTL",_config);
|
||||||
|
|
||||||
private _TTL = getNumber (configFile >> "CfgAmmo" >> getText (_config >> "ammo") >> "timeToLive");
|
private _TTL = getNumber (configFile >> "CfgAmmo" >> getText (_config >> "ammo") >> "timeToLive");
|
||||||
|
|
||||||
if (_TTL > 3600) then {
|
if (_TTL > 3600) then {
|
||||||
|
_TTL = _TTL / 3600;
|
||||||
_TTL = _TTL / 60^2;
|
|
||||||
_TTL = str _TTL splitString ".";
|
_TTL = str _TTL splitString ".";
|
||||||
|
|
||||||
if (count _TTL > 1) then {
|
if (count _TTL > 1) then {
|
||||||
@ -35,6 +35,5 @@ if (_TTL > 3600) then {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
format ["%1m", round (_TTL / 60)]
|
||||||
format ["%1m", round (_TTL / 60)];
|
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Karel Moricky, modified by Alganthe
|
* Author: Karel Moricky, modified by Alganthe
|
||||||
* Update camera position
|
* Update camera position.
|
||||||
* Modernized a bit, modified vars to fit arsenal rewrite.
|
* Modernized a bit, modified vars to fit arsenal rewrite.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -16,9 +16,10 @@
|
|||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GVAR(cameraPosition) params ["_distance", "_dirH", "_dirV"];
|
GVAR(cameraPosition) params ["_distance", "_dirH", "_dirV"];
|
||||||
[GVAR(cameraHelper), [_dirH + 180, - _dirV, 0]] call bis_fnc_setobjectrotation;
|
|
||||||
GVAR(cameraHelper) attachTo [GVAR(center), GVAR(cameraPosition) select 3, ""]; //--- Reattach for smooth movement
|
[GVAR(cameraHelper), [_dirH + 180, - _dirV, 0]] call BIS_fnc_setObjectRotation;
|
||||||
|
GVAR(cameraHelper) attachTo [GVAR(center), GVAR(cameraPosition) select 3, ""]; // Reattach for smooth movement
|
||||||
|
|
||||||
GVAR(camera) setPos (GVAR(cameraHelper) modelToWorld [0, -_distance, 0]);
|
GVAR(camera) setPos (GVAR(cameraHelper) modelToWorld [0, -_distance, 0]);
|
||||||
GVAR(camera) setVectorDirAndUp [vectorDir GVAR(cameraHelper), vectorUp GVAR(cameraHelper)];
|
GVAR(camera) setVectorDirAndUp [vectorDir GVAR(cameraHelper), vectorUp GVAR(cameraHelper)];
|
||||||
|
85
addons/arsenal/functions/fnc_updateCurrentItemsList.sqf
Normal file
85
addons/arsenal/functions/fnc_updateCurrentItemsList.sqf
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
|
/*
|
||||||
|
* Author: johnb43
|
||||||
|
* Updates the list of current items.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
GVAR(currentItems) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", [], [], [], [], [], [], []];
|
||||||
|
|
||||||
|
private _isWeapon = false;
|
||||||
|
private _indexCurrentItems = -1;
|
||||||
|
|
||||||
|
// Add the items the player has to currentItems
|
||||||
|
{
|
||||||
|
switch (_forEachIndex) do {
|
||||||
|
// Primary weapon, Secondary weapon, Handgun weapon, Binoculars
|
||||||
|
case IDX_LOADOUT_PRIMARY_WEAPON;
|
||||||
|
case IDX_LOADOUT_SECONDARY_WEAPON;
|
||||||
|
case IDX_LOADOUT_HANDGUN_WEAPON;
|
||||||
|
case IDX_LOADOUT_BINO: {
|
||||||
|
_x params [["_weapon", ""], ["_muzzle", ""], ["_flashlight", ""], ["_optics", ""], ["_primaryMagazine", []], ["_secondaryMagazine", []], ["_bipod", ""]];
|
||||||
|
|
||||||
|
// Find baseweapon of weapon
|
||||||
|
if (_weapon != "") then {
|
||||||
|
_weapon = _weapon call FUNC(baseWeapon);
|
||||||
|
};
|
||||||
|
|
||||||
|
_isWeapon = _forEachIndex != IDX_LOADOUT_BINO;
|
||||||
|
|
||||||
|
// If bino, add it in a different place than regular weapons
|
||||||
|
GVAR(currentItems) set [[IDX_CURR_BINO, _forEachIndex] select _isWeapon, _weapon];
|
||||||
|
|
||||||
|
_indexCurrentItems = [IDX_CURR_BINO_ITEMS, IDX_CURR_PRIMARY_WEAPON_ITEMS + _forEachIndex] select _isWeapon;
|
||||||
|
|
||||||
|
// Add weapon attachments
|
||||||
|
{
|
||||||
|
(GVAR(currentItems) select _indexCurrentItems) set [[2, 1, 0, 3] select _forEachIndex, if (_x != "") then {_x call FUNC(baseWeapon)} else {_x}];
|
||||||
|
} forEach [_optics, _flashlight, _muzzle, _bipod];
|
||||||
|
|
||||||
|
// Add magazines
|
||||||
|
{
|
||||||
|
// Magazines are at index 4 & 5 in array -> That's why +4
|
||||||
|
(GVAR(currentItems) select _indexCurrentItems) set [_forEachIndex + 4, _x param [0, ""]];
|
||||||
|
} forEach [_primaryMagazine, _secondaryMagazine];
|
||||||
|
};
|
||||||
|
// Uniform
|
||||||
|
case IDX_LOADOUT_UNIFORM: {
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM, _x param [0, ""]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_UNIFORM_ITEMS, _x param [1, []]];
|
||||||
|
};
|
||||||
|
// Vest
|
||||||
|
case IDX_LOADOUT_VEST: {
|
||||||
|
GVAR(currentItems) set [IDX_CURR_VEST, _x param [0, ""]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_VEST_ITEMS, _x param [1, []]];
|
||||||
|
};
|
||||||
|
// Backpack
|
||||||
|
case IDX_LOADOUT_BACKPACK: {
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BACKPACK, _x param [0, ""]];
|
||||||
|
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, _x param [1, []]];
|
||||||
|
};
|
||||||
|
// Helmet
|
||||||
|
case IDX_LOADOUT_HEADGEAR: {
|
||||||
|
GVAR(currentItems) set [IDX_CURR_HEADGEAR, _x];
|
||||||
|
};
|
||||||
|
// Facewear
|
||||||
|
case IDX_LOADOUT_GOGGLES: {
|
||||||
|
GVAR(currentItems) set [IDX_CURR_GOGGLES, _x];
|
||||||
|
};
|
||||||
|
// Assigned items: Map, Compass, Watch, GPS / UAV Terminal, Radio, NVGs
|
||||||
|
case IDX_LOADOUT_ASSIGNEDITEMS: {
|
||||||
|
{
|
||||||
|
// Order of storing currentItems is different than what getUnitLoadout returns, so do some math
|
||||||
|
GVAR(currentItems) set [IDX_CURR_NVG + ([2, 6, 4, 3, 5, 0] select _forEachIndex), _x];
|
||||||
|
} forEach _x;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach (getUnitLoadout GVAR(center)); // Only need items, not extended loadout
|
@ -1,12 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Update the right panel (listnbox).
|
* Update the right panel (listnbox).
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Right panel control <CONTROL>
|
* 0: Right panel control <CONTROL>
|
||||||
* 1: Max load of the current container <STRING>
|
* 1: Container <OBJECT>
|
||||||
|
* 2: If container has items <BOOL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -14,44 +15,43 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_control", "_maxLoad"];
|
params ["_control", "_container", "_hasItems"];
|
||||||
|
|
||||||
private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar;
|
private _loadRemaining = maxLoad _container - loadAbs _container;
|
||||||
private _curSel = lnbCurSelRow _control;
|
private _rightPanelCache = uiNamespace getVariable [QGVAR(rightPanelCache), createHashMap];
|
||||||
|
|
||||||
(lnbSize _control) params ["_rows"];
|
private _mass = -1;
|
||||||
|
private _color = [];
|
||||||
|
|
||||||
_maxLoad = getnumber (configfile >> "CfgVehicles" >> _maxLoad >> "maximumLoad");
|
// Grey out items that are too big to fit in remaining space of the container
|
||||||
_maxLoad = _maxLoad * (1 - (progressPosition _loadIndicatorBarCtrl));
|
for "_row" from 0 to (lnbSize _control select 0) - 1 do {
|
||||||
_maxLoad = parseNumber (_maxLoad toFixed 2); // Required to avoid an issue where even though the typename returns "SCALAR" it doesn't act as one.
|
_mass = _rightPanelCache getOrDefault [_control lnbData [_row, 0], 0];
|
||||||
|
|
||||||
// Grey out items too big
|
// Lower alpha on color for items that can't fit
|
||||||
for "_r" from 0 to (_rows - 1) do {
|
_color = [1, 1, 1, [0.25, 1] select (_mass <= _loadRemaining)];
|
||||||
private _mass = _control getVariable (_control lnbData [_r, 0]);
|
_control lnbSetColor [[_row, 1], _color];
|
||||||
private _class = _control lnbText [_r, 1];
|
_control lnbSetColor [[_row, 2], _color];
|
||||||
|
|
||||||
private _alpha = [0.25, 1.0] select (_mass <= _maxLoad);
|
|
||||||
private _color = [1, 1, 1, _alpha];
|
|
||||||
_control lnbSetColor [[_r, 1],_color];
|
|
||||||
_control lnbSetColor [[_r, 2],_color];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove all from container show / hide
|
private _display = ctrlParent _control;
|
||||||
|
|
||||||
|
// If there are items inside container, show "remove all" button
|
||||||
private _removeAllCtrl = _display displayCtrl IDC_buttonRemoveAll;
|
private _removeAllCtrl = _display displayCtrl IDC_buttonRemoveAll;
|
||||||
|
|
||||||
if (progressPosition _loadIndicatorBarCtrl > 0) then {
|
// A separate "_hasItems" argument is needed, because items can have no mass
|
||||||
|
_removeAllCtrl ctrlSetFade 0;
|
||||||
|
_removeAllCtrl ctrlShow _hasItems;
|
||||||
|
_removeAllCtrl ctrlEnable _hasItems;
|
||||||
|
_removeAllCtrl ctrlCommit FADE_DELAY;
|
||||||
|
|
||||||
_removeAllCtrl ctrlSetFade 0;
|
// Update weight display
|
||||||
_removeAllCtrl ctrlShow true;
|
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", GVAR(center) call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
||||||
_removeAllCtrl ctrlEnable true;
|
|
||||||
_removeAllCtrl ctrlCommit FADE_DELAY;
|
|
||||||
};
|
|
||||||
|
|
||||||
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", [GVAR(center), 2] call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|
private _curSel = lnbCurSelRow _control;
|
||||||
|
|
||||||
// change button color if unique or too big
|
// Disable '+' button if item is unique or too big to fit in remaining space
|
||||||
if (_curSel != -1) then {
|
if (_curSel != -1) then {
|
||||||
private _plusButtonCtrl = _display displayCtrl IDC_arrowPlus;
|
private _plusButtonCtrl = _display displayCtrl IDC_arrowPlus;
|
||||||
_plusButtonCtrl ctrlEnable !((_control lnbValue [_curSel, 2]) == 1 || {(_control getVariable (_control lnbData [_curSel, 0])) > _maxLoad});
|
_plusButtonCtrl ctrlEnable !((_control lnbValue [_curSel, 2]) == 1 || {(_rightPanelCache getOrDefault [_control lnbData [_curSel, 0], 0]) > _loadRemaining});
|
||||||
_plusButtonCtrl ctrlCommit FADE_DELAY;
|
_plusButtonCtrl ctrlCommit FADE_DELAY;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe
|
* Author: Alganthe, johnb43
|
||||||
* Update the list of unique items.
|
* Updates the list of unique items.
|
||||||
|
* Unique items are items that can't be multiplied using the arsenal.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -13,106 +14,166 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GVAR(virtualItems) set [18, []];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_MISC_ITEMS, createHashMap];
|
||||||
GVAR(virtualItems) set [19, []];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_VIRT_ITEMS_ALL, createHashMap];
|
||||||
GVAR(virtualItems) set [20, []];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_GRENADES, createHashMap];
|
||||||
GVAR(virtualItems) set [21, []];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_EXPLOSIVES, createHashMap];
|
||||||
GVAR(virtualItems) set [22, [[], [], [], []]];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_ATTACHMENTS, createHashMapFromArray [[IDX_VIRT_OPTICS_ATTACHMENTS, createHashMap], [IDX_VIRT_FLASHLIGHT_ATTACHMENTS, createHashMap], [IDX_VIRT_MUZZLE_ATTACHMENTS, createHashMap], [IDX_VIRT_BIPOD_ATTACHMENTS, createHashMap]]];
|
||||||
GVAR(virtualItems) set [23, []];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_BACKPACKS, createHashMap];
|
||||||
GVAR(virtualItems) set [24, []];
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_GOGGLES, createHashMap];
|
||||||
|
GVAR(virtualItems) set [IDX_VIRT_UNIQUE_UNKNOWN_ITEMS, createHashMap];
|
||||||
|
|
||||||
private _array = LIST_DEFAULTS select IDX_VIRT_ITEMS_ALL;
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
private _itemsCache = uiNamespace getVariable QGVAR(configItems);
|
|
||||||
|
|
||||||
private _configCfgWeapons = configFile >> "CfgWeapons";
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
private _configMagazines = configFile >> "CfgMagazines";
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
private _configVehicles = configFile >> "CfgVehicles";
|
private _cfgVehicles = configFile >> "CfgVehicles";
|
||||||
private _configGlasses = configFile >> "CfgGlasses";
|
private _cfgGlasses = configFile >> "CfgGlasses";
|
||||||
|
|
||||||
|
private _isMagazine = false;
|
||||||
|
private _isWeapon = false;
|
||||||
|
private _config = configNull;
|
||||||
|
private _simulationType = "";
|
||||||
|
private _configItemInfo = "";
|
||||||
|
private _hasItemInfo = false;
|
||||||
|
private _itemInfoType = 0;
|
||||||
|
private _isMiscItem = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
switch true do {
|
_isMagazine = isClass (_cfgMagazines >> _x);
|
||||||
// Weapon mag
|
_isWeapon = isClass (_cfgWeapons >> _x);
|
||||||
case (
|
|
||||||
isClass (_configMagazines >> _x) &&
|
|
||||||
{_x in (_itemsCache select 2)} &&
|
|
||||||
{!(_x in (GVAR(virtualItems) select IDX_VIRT_ITEMS_ALL))}
|
|
||||||
): {
|
|
||||||
(GVAR(virtualItems) select 19) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Mag throw
|
switch (true) do {
|
||||||
case (
|
// Magazines
|
||||||
isClass (_configMagazines >> _x) &&
|
case (_isMagazine): {
|
||||||
{_x in (_itemsCache select 15)} &&
|
_config = _cfgMagazines >> _x;
|
||||||
{!(_x in (GVAR(virtualItems) select 15))}
|
|
||||||
): {
|
|
||||||
(GVAR(virtualItems) select 20) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Mag put
|
switch (true) do {
|
||||||
case (
|
// "Misc. items" magazines (e.g. spare barrels, intel, photos)
|
||||||
isClass (_configMagazines >> _x) &&
|
case (
|
||||||
{_x in (_itemsCache select 16)} &&
|
!(_x in (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS)) &&
|
||||||
{!(_x in (GVAR(virtualItems) select 16))}
|
{_x in (uiNamespace getVariable QGVAR(magazineMiscItems)) ||
|
||||||
): {
|
{getNumber (_config >> "ACE_isUnique") == 1}}
|
||||||
(GVAR(virtualItems) select 21) pushBackUnique _x;
|
): {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_MISC_ITEMS) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Primary, Handgun, Secondary weapon magazines
|
||||||
|
case (
|
||||||
|
!(_x in (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL)) &&
|
||||||
|
{_x in (_configItems get IDX_VIRT_ITEMS_ALL) ||
|
||||||
|
{getNumber (_config >> QGVAR(hide)) == -1} ||
|
||||||
|
{getNumber (_config >> "type") in [TYPE_MAGAZINE_PRIMARY_AND_THROW, TYPE_MAGAZINE_SECONDARY_AND_PUT, 1536, TYPE_MAGAZINE_HANDGUN_AND_GL, TYPE_MAGAZINE_MISSILE]}}
|
||||||
|
): {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_VIRT_ITEMS_ALL) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Grenades
|
||||||
|
case (
|
||||||
|
!(_x in (GVAR(virtualItems) get IDX_VIRT_GRENADES)) &&
|
||||||
|
{_x in (uiNamespace getVariable QGVAR(grenadeCache))}
|
||||||
|
): {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_GRENADES) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Explosives
|
||||||
|
case (
|
||||||
|
!(_x in (GVAR(virtualItems) get IDX_VIRT_EXPLOSIVES)) &&
|
||||||
|
{_x in (uiNamespace getVariable QGVAR(putCache))}
|
||||||
|
): {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_EXPLOSIVES) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Unknown
|
||||||
|
default {
|
||||||
|
// Don't add items that are part of the arsenal
|
||||||
|
if !(_x in GVAR(virtualItemsFlatAll)) then {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_UNKNOWN_ITEMS) set [_x, nil];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
// Weapons
|
||||||
|
case (_isWeapon): {
|
||||||
|
_config = _cfgWeapons >> _x;
|
||||||
|
_simulationType = getText (_config >> "simulation");
|
||||||
|
_configItemInfo = _config >> "ItemInfo";
|
||||||
|
_hasItemInfo = isClass (_configItemInfo);
|
||||||
|
_itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
|
||||||
|
_isMiscItem = _x isKindOf ["CBA_MiscItem", _cfgWeapons];
|
||||||
|
|
||||||
// acc
|
switch (true) do {
|
||||||
case (
|
// Optics
|
||||||
isClass (_configCfgWeapons >> _x) &&
|
case (
|
||||||
{!(_x in ((GVAR(virtualItems) select IDX_VIRT_ATTACHEMENTS) select 0))} &&
|
!(_x in ((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS)) &&
|
||||||
{_x in ((_itemsCache select 1) select 0)}
|
{_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS) ||
|
||||||
): {
|
{_hasItemInfo &&
|
||||||
((GVAR(virtualItems) select 22) select 0) pushBackUnique _x;
|
{!_isMiscItem} &&
|
||||||
|
{_itemInfoType == TYPE_OPTICS}}}
|
||||||
|
): {
|
||||||
|
((GVAR(virtualItems) get IDX_VIRT_UNIQUE_ATTACHMENTS) get IDX_VIRT_OPTICS_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Flashlights
|
||||||
|
case (
|
||||||
|
!(_x in ((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS)) &&
|
||||||
|
{_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS) ||
|
||||||
|
{_hasItemInfo &&
|
||||||
|
{!_isMiscItem} &&
|
||||||
|
{_itemInfoType == TYPE_FLASHLIGHT}}}
|
||||||
|
): {
|
||||||
|
((GVAR(virtualItems) get IDX_VIRT_UNIQUE_ATTACHMENTS) get IDX_VIRT_FLASHLIGHT_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Muzzle attachments
|
||||||
|
case (
|
||||||
|
!(_x in ((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS)) &&
|
||||||
|
{_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS) ||
|
||||||
|
{_hasItemInfo &&
|
||||||
|
{!_isMiscItem} &&
|
||||||
|
{_itemInfoType == TYPE_MUZZLE}}}
|
||||||
|
): {
|
||||||
|
((GVAR(virtualItems) get IDX_VIRT_UNIQUE_ATTACHMENTS) get IDX_VIRT_MUZZLE_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Bipods
|
||||||
|
case (
|
||||||
|
!(_x in ((GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS)) &&
|
||||||
|
{_x in ((_configItems get IDX_VIRT_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS) ||
|
||||||
|
{_hasItemInfo &&
|
||||||
|
{!_isMiscItem} &&
|
||||||
|
{_itemInfoType == TYPE_BIPOD}}}
|
||||||
|
): {
|
||||||
|
((GVAR(virtualItems) get IDX_VIRT_UNIQUE_ATTACHMENTS) get IDX_VIRT_BIPOD_ATTACHMENTS) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Misc. items
|
||||||
|
case (
|
||||||
|
!(_x in (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS)) &&
|
||||||
|
{_x in (_configItems get IDX_VIRT_MISC_ITEMS) ||
|
||||||
|
{_hasItemInfo &&
|
||||||
|
{_isMiscItem &&
|
||||||
|
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}} ||
|
||||||
|
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
|
||||||
|
{_simulationType == "ItemMineDetector"}}}
|
||||||
|
): {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_MISC_ITEMS) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Unknown
|
||||||
|
default {
|
||||||
|
// Don't add items that are part of the arsenal
|
||||||
|
if !(_x in GVAR(virtualItemsFlatAll)) then {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_UNKNOWN_ITEMS) set [_x, nil];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// acc
|
|
||||||
case (
|
|
||||||
isClass (_configCfgWeapons >> _x) &&
|
|
||||||
{!(_x in ((GVAR(virtualItems) select IDX_VIRT_ATTACHEMENTS) select 1))} &&
|
|
||||||
{_x in ((_itemsCache select 1) select 1)}
|
|
||||||
): {
|
|
||||||
((GVAR(virtualItems) select 22) select 1) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
|
|
||||||
// acc
|
|
||||||
case (
|
|
||||||
isClass (_configCfgWeapons >> _x) &&
|
|
||||||
{!(_x in ((GVAR(virtualItems) select IDX_VIRT_ATTACHEMENTS) select 2))} &&
|
|
||||||
{_x in ((_itemsCache select 1) select 2)}
|
|
||||||
): {
|
|
||||||
((GVAR(virtualItems) select 22) select 2) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
// acc
|
|
||||||
case (
|
|
||||||
isClass (_configCfgWeapons >> _x) &&
|
|
||||||
{!(_x in ((GVAR(virtualItems) select IDX_VIRT_ATTACHEMENTS) select 3))} &&
|
|
||||||
{_x in ((_itemsCache select 1) select 3)}
|
|
||||||
): {
|
|
||||||
((GVAR(virtualItems) select 22) select 3) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
case (
|
|
||||||
isClass (_configCfgWeapons >> _x) &&
|
|
||||||
{!(_x in (GVAR(virtualItems) select 17))} &&
|
|
||||||
{!(_x in ((_itemsCache select 1) select 0))} &&
|
|
||||||
{!(_x in ((_itemsCache select 1) select 1))} &&
|
|
||||||
{!(_x in ((_itemsCache select 1) select 2))} &&
|
|
||||||
{!(_x in ((_itemsCache select 1) select 3))}
|
|
||||||
): {
|
|
||||||
(GVAR(virtualItems) select 18) pushBackUnique _x;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Backpacks
|
// Backpacks
|
||||||
case (getNumber (_configVehicles >> _x >> "isBackpack") == 1): {
|
case (getNumber (_cfgVehicles >> _x >> "isBackpack") == 1): {
|
||||||
(GVAR(virtualItems) select 23) pushBackUnique _x;
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_BACKPACKS) set [_x, nil];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Facewear
|
// Facewear
|
||||||
case (isClass (_configGlasses >> _x)): {
|
case (isClass (_cfgGlasses >> _x)): {
|
||||||
(GVAR(virtualItems) select 24) pushBackUnique _x;
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_GOGGLES) set [_x, nil];
|
||||||
|
};
|
||||||
|
// Unknown
|
||||||
|
default {
|
||||||
|
// Don't add items that are part of the arsenal
|
||||||
|
if !(_x in GVAR(virtualItemsFlatAll)) then {
|
||||||
|
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_UNKNOWN_ITEMS) set [_x, nil];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach _array;
|
} forEach (keys ([GVAR(center), 0, 3, 3, 3, false] call EFUNC(common,uniqueUnitItems))); // Get all items from unit
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user