Merge pull request #21 from alganthe/arsenal_loadouts

Arsenal loadouts
This commit is contained in:
Josuan Albin
2017-10-31 17:09:18 +01:00
committed by GitHub
32 changed files with 1016 additions and 179 deletions

View File

@ -5,10 +5,14 @@ PREP(buttonClearAll);
PREP(buttonExport);
PREP(buttonHide);
PREP(buttonImport);
PREP(buttonLoad);
PREP(buttonSave);
PREP(buttonLoadoutsDelete);
PREP(buttonLoadoutsLoad);
PREP(buttonLoadoutsRename);
PREP(buttonLoadoutsSave);
PREP(buttonLoadoutsShare);
PREP(clearSearchbar);
PREP(fillLeftPanel);
PREP(fillLoadoutsList);
PREP(fillRightPanel);
PREP(handleMouse);
PREP(handleScrollWheel);
@ -16,13 +20,17 @@ PREP(handleSearchbar);
PREP(handleStats);
PREP(initBox);
PREP(itemInfo);
PREP(loadoutsChangeTab);
PREP(message);
PREP(onArsenalClose);
PREP(onArsenalOpen);
PREP(onKeyDown);
PREP(onLoadoutsClose);
PREP(onLoadoutsOpen);
PREP(onMouseButtonDown);
PREP(onMouseButtonUp);
PREP(onSelChangedLeft);
PREP(onSelChangedLoadouts);
PREP(onSelChangedRight);
PREP(onSelChangedRightListnBox);
PREP(openBox);
@ -32,3 +40,5 @@ PREP(scanConfig);
PREP(showItem);
PREP(sortPanel);
PREP(updateCamPos);
PREP(updateRightPanel);
PREP(verifyLoadout);

View File

@ -21,13 +21,13 @@ GVAR(lastSearchTextRight) = "";
}] call CBA_fnc_addEventHandler;
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
["ace_arsenalOpened", {
[QGVAR(displayOpened), {
GVAR(virtualItems) set [17, (GVAR(virtualItems) select 17) - ["FirstAidKit", "Medikit"]];
}] call CBA_fnc_addEventHandler;
};
if (["ACE_dogtags"] call EFUNC(common,isModLoaded)) then {
["ace_arsenal_rightPanelFilled", {
[QGVAR(rightPanelFilled), {
if (GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack] && {GVAR(currentRightPanel) == IDC_buttonMisc}) then {

View File

@ -6,9 +6,14 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
// Arsenal
[QGVAR(camInverted), "CHECKBOX", "Invert camera controls", "ACE3 Arsenal", false] call CBA_Settings_fnc_init; // TBL
[QGVAR(canUseCurrentMagTab), "CHECKBOX", "Can use currentMag tab", "ACE3 Arsenal", false] call CBA_Settings_fnc_init; // TBL
[QGVAR(enableModIcons), "CHECKBOX", "Enable mod logos", "ACE3 Arsenal", true] call CBA_Settings_fnc_init; // TBL
[QGVAR(fontHeight), "SLIDER", "Font height for left and right panels", "ACE3 Arsenal", [1, 10, 4.5, 1]] call CBA_Settings_fnc_init; // TBL
// Arsenal loadouts
[QGVAR(allowDefaultLoadouts), "CHECKBOX", "Allow the use of the default loadouts tab", "ACE3 Arsenal", true, true] call CBA_Settings_fnc_init; // TBL
[QGVAR(allowSharedLoadouts), "CHECKBOX", "Allow the use of loadout sharing", "ACE3 Arsenal", true, true] call CBA_Settings_fnc_init; // TBL
ADDON = true;

Binary file not shown.

View File

@ -18,13 +18,6 @@
#define IDC_totalWeightText 801
#define IDC_message 9
#define IDC_menuBar 10
#define IDC_menuBarBackground 1001
#define IDC_buttonClose 1002
#define IDC_buttonSave 1003
#define IDC_buttonLoad 1004
#define IDC_buttonImport 1005
#define IDC_buttonExport 1006
#define IDC_buttonHide 1007
#define IDC_infoBox 11
#define IDC_infoBackground 1101
#define IDC_infoName 1102
@ -101,6 +94,19 @@
#define IDC_buttonRemoveAllSelected 39
#define IDC_buttonRemoveAll 40
#define IDD_loadouts_display 1127002
#define IDC_centerBox 3
#define IDC_centerTitle 301
#define IDC_contentPanel 302
#define IDC_textEditBox 303
#define IDC_buttonSave 304
#define IDC_buttonLoad 305
#define IDC_buttonShare 306
#define IDC_buttonDelete 307
#define IDC_buttonRename 308
#define IDC_buttonMyLoadouts 401
#define IDC_buttonDefaultLoadouts 402
#define IDC_buttonSharedLoadouts 403
#define FADE_DELAY 0.15
#define CAM_DIS_MAX 5
@ -142,13 +148,9 @@
#define TOGGLE_RIGHT_PANEL_WEAPON\
{\
_x = _display displayCtrl _x;\
\
if (ctrlFade _x != 0) then {\
_x ctrlSetFade 0;\
};\
if !(ctrlShown _x) then {\
_x ctrlShow true;\
};\
_x ctrlSetFade 0;\
_x ctrlShow true;\
_x ctrlEnable true;\
_x ctrlCommit FADE_DELAY;\
} foreach [\
IDC_blockRightFrame,\
@ -161,13 +163,9 @@
];\
{\
_x = _display displayCtrl _x;\
\
if (ctrlFade _x != 1) then {\
_x ctrlSetFade 1;\
};\
if (ctrlShown _x) then {\
_x ctrlShow false;\
};\
_x ctrlSetFade 1;\
_x ctrlShow false;\
_x ctrlEnable false;\
_x ctrlCommit FADE_DELAY;\
} foreach [\
IDC_loadIndicator,\
@ -181,13 +179,9 @@
#define TOGGLE_RIGHT_PANEL_CONTAINER\
{\
_x = _display displayCtrl _x;\
\
if (ctrlFade _x != 0) then {\
_x ctrlSetFade 0;\
};\
if !(ctrlShown _x) then {\
_x ctrlShow true;\
};\
_x ctrlSetFade 0;\
_x ctrlShow true;\
_x ctrlEnable true;\
_x ctrlCommit FADE_DELAY;\
} foreach [\
IDC_blockRightFrame, \
@ -201,28 +195,20 @@
IDC_rightSearchbar,\
IDC_rightSearchbarButton\
];\
\
{\
_x = _display displayCtrl _x;\
\
if (ctrlFade _x != 1) then {\
_x ctrlSetFade 1;\
};\
if !(ctrlShown _x) then {\
_x ctrlShow false;\
};\
_x = _display displayCtrl _x;\
_x ctrlSetFade 1;\
_x ctrlShow false;\
_x ctrlEnable false;\
_x ctrlCommit FADE_DELAY;\
} foreach [IDC_iconBackgroundCurrentMag, IDC_buttonCurrentMag];
#define TOGGLE_RIGHT_PANEL_HIDE\
{\
_x = _display displayCtrl _x;\
if (ctrlFade _x != 1) then {\
_x ctrlSetFade 1;\
};\
if (ctrlShown _x) then {\
_x ctrlShow false;\
};\
_x ctrlSetFade 1;\
_x ctrlShow false;\
_x ctrlEnable false;\
_x ctrlCommit FADE_DELAY;\
} foreach [\
IDC_blockRightFrame,\
@ -262,3 +248,54 @@ _x = _display displayCtrl _x;\
[hmd GVAR(center)],\
[binocular GVAR(center)]\
]
#define CHECK_WEAPON_OR_ACC\
_item in (_weaponsArray select 0) ||\
{_item in (_weaponsArray select 1)} ||\
{_item in (_weaponsArray select 2)} ||\
{_item in (GVAR(virtualItems) select 9)} ||\
{_item in (_accsArray select 0)} ||\
{_item in (_accsArray select 1)} ||\
{_item in (_accsArray select 2)} ||\
{_item in (_accsArray select 3)}
#define CHECK_ASSIGNED_ITEMS\
_item in (GVAR(virtualItems) select 10) ||\
{_item in (GVAR(virtualItems) select 11)} ||\
{_item in (GVAR(virtualItems) select 12)} ||\
{_item in (GVAR(virtualItems) select 13)} ||\
{_item in (GVAR(virtualItems) select 14)} ||\
{_item in (GVAR(virtualItems) select 8)} ||\
{_item in (GVAR(virtualItems) select 18)}
#define CHECK_CONTAINER\
_item in (GVAR(virtualItems) select 4) ||\
{_item in (GVAR(virtualItems) select 5)} ||\
{_item in (GVAR(virtualItems) select 6)}
#define CLASS_CHECK_ITEM\
isClass (_weaponCfg >> _item) ||\
{isClass (_vehcCfg >> _item)} ||\
{isClass (_glassesCfg >> _item)} ||\
{isClass (_magCfg >> _item)}
#define CHECK_CONTAINER_ITEMS\
_item in (GVAR(virtualItems) select 3) ||\
{_item in (_accsArray select 0)} ||\
{_item in (_accsArray select 1)} ||\
{_item in (_accsArray select 2)} ||\
{_item in (_accsArray select 3)} ||\
{_item in (GVAR(virtualItems) select 4)} ||\
{_item in (GVAR(virtualItems) select 5)} ||\
{_item in (GVAR(virtualItems) select 6)} ||\
{_item in (GVAR(virtualItems) select 7)} ||\
{_item in (GVAR(virtualItems) select 8)} ||\
{_item in (GVAR(virtualItems) select 10)} ||\
{_item in (GVAR(virtualItems) select 11)} ||\
{_item in (GVAR(virtualItems) select 12)} ||\
{_item in (GVAR(virtualItems) select 13)} ||\
{_item in (GVAR(virtualItems) select 14)} ||\
{_item in (GVAR(virtualItems) select 15)} ||\
{_item in (GVAR(virtualItems) select 16)} ||\
{_item in (GVAR(virtualItems) select 17)} ||\
{_item in (GVAR(virtualItems) select 18)}

View File

@ -148,7 +148,8 @@ if (_items isEqualType true && {_items}) then {
isClass (_configItemInfo) &&
((getNumber (_configItemInfo >> "type")) in [101, 201, 301, 302] &&
{(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
{(getNumber (_configItemInfo >> "type")) in [401, 619, 620]}
{(getNumber (_configItemInfo >> "type")) in [401, 619, 620]} ||
{(getText (_configCfgWeapons >> _x >> "simulation")) == "ItemMineDetector"}
): {
(_cargo select 17) pushBackUnique _x;
};

View File

@ -4,6 +4,7 @@
params ["_display", "_addOrRemove"];
private _load = 0;
private _maxLoad = "";
private _items = [];
private _ctrlList = (_display displayCtrl IDC_rightTabContentListnBox);
private _lnbCurSel = lnbCurSelRow _ctrlList;
@ -11,6 +12,7 @@ private _item = _ctrlList lnbData [_lnbCurSel, 0];
if ((_ctrlList lnbValue [_lnbCurSel, 2]) == 1 && {_addOrRemove == 1}) exitWith {};
// Update item count and currentItems array
switch GVAR(currentLeftPanel) do {
case IDC_buttonUniform : {
@ -25,6 +27,7 @@ switch GVAR(currentLeftPanel) do {
};
_load = loadUniform GVAR(center);
_maxLoad = gettext (configfile >> "CfgWeapons" >> uniform GVAR(center) >> "ItemInfo" >> "containerClass");
_items = uniformItems GVAR(center);
GVAR(currentItems) set [15 ,_items];
};
@ -41,6 +44,7 @@ switch GVAR(currentLeftPanel) do {
};
_load = loadVest GVAR(center);
_maxLoad = gettext (configfile >> "CfgWeapons" >> vest GVAR(center) >> "ItemInfo" >> "containerClass");
_items = vestItems GVAR(center);
GVAR(currentItems) set [16,_items];
};
@ -57,12 +61,18 @@ switch GVAR(currentLeftPanel) do {
};
_load = loadBackpack GVAR(center);
_maxLoad = backpack GVAR(center);
_items = backpackItems GVAR(center);
GVAR(currentItems) set [17,_items];
};
};
(_display displayCtrl IDC_loadIndicatorBar) progressSetPosition _load;
// Update progress bar status, weight info
private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar;
_loadIndicatorBarCtrl progressSetPosition _load;
(_display displayCtrl IDC_totalWeightText) ctrlSetText (GVAR(center) call EFUNC(movement,getWeight));
private _value = {_x == _item} count _items;
_ctrlList lnbSetText [[_lnbCurSel, 2],str _value];
_ctrlList lnbSetText [[_lnbCurSel, 2],str _value];
[_ctrlList, _maxLoad] call FUNC(updateRightPanel);

View File

@ -1,2 +0,0 @@
#include "script_component.hpp"
hint str _this;

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
if !(ctrlEnabled _control) exitWith {};
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
private _contentPanelCursSel = lnbCurSelRow _contentPanelCtrl;
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1];
_data deleteAt (_data find ((_data select {_x select 0 == _loadoutName}) select 0));
_contentPanelCtrl setVariable [_loadoutName, nil];
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
_contentPanelCtrl lnbSetCurSelRow (_contentPanelCursSel);
[(findDisplay IDD_ace_arsenal), format ["Loadout '%1' was deleted", _loadoutName]] call FUNC(message); // TBL

View File

@ -0,0 +1,58 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
if !(ctrlEnabled _control) exitWith {};
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
private _curSel = lnbCurSelRow _contentPanelCtrl;
private _loadoutName = _contentPanelCtrl lnbText [_curSel, 1];
if (ctrlIDC _control == IDC_buttonSharedLoadouts) then {
} else {
GVAR(center) setUnitLoadout [_contentPanelCtrl getVariable _loadoutName, true];
GVAR(currentItems) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", [], [], [], [], [], []];
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))];
};
};
};
[(findDisplay IDD_ace_arsenal), format ["Loadout '%1' was loaded", _loadoutName]] call FUNC(message); // TBL
};

View File

@ -0,0 +1,49 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
if !(ctrlEnabled _control) exitWith {};
private _data = profileNamespace getVariable [QGVAR(saved_loadouts), []];
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
private _curSelRow = lnbCurSelRow _contentPanelCtrl;
private _loadoutName = _contentPanelCtrl lnbText [_curSelRow, 1];
private _loadout = _contentPanelCtrl getVariable _loadoutName;
private _editBoxCtrl = _display displayCtrl IDC_textEditBox;
private _editBoxContent = ctrlText _editBoxCtrl;
private _similarLoadouts = _data select {_x select 0 == _editBoxContent};
if (count _similarLoadouts > 0) exitWith {
[(findDisplay IDD_ace_arsenal), format ["A loadout named %1 already exist", _editBoxContent]] call FUNC(message); // TBL
};
// Update loadout info in profile and list namespaces
_data set [_data find ((_data select {_x select 0 == _loadoutName}) select 0), [_editBoxContent, _loadout]];
_contentPanelCtrl setVariable [_loadoutName, nil];
_contentPanelCtrl setVariable [_editBoxContent, _loadout];
_contentPanelCtrl lnbDeleteRow _curSelRow;
// Add new row
private _newRow = _contentPanelCtrl lnbAddRow ["",_editBoxContent];
_contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadout select 1) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadout select 2) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadout select 3) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadout select 4) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
_contentPanelCtrl setVariable [_editBoxContent, _loadout];
// 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};
};
[(findDisplay IDD_ace_arsenal), format ["Loadout '%1' was renamed to '%2'", _loadoutName, _editBoxContent]] call FUNC(message); // TBL

View File

@ -0,0 +1,64 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
if !(ctrlEnabled _control) exitWith {};
private _data = +(profileNamespace getVariable [QGVAR(saved_loadouts), []]);
private _loadout = getUnitLoadout GVAR(center);
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
private _cursSelRow = lnbCurSelRow _contentPanelCtrl;
private _loadoutName = _contentPanelCtrl lnbText [_cursSelRow, 1];
private _curSelLoadout = _contentPanelCtrl getVariable _loadoutName;
private _editBoxCtrl = _display displayCtrl IDC_textEditBox;
private _editBoxContent = ctrlText _editBoxCtrl;
if (ctrlIDC _control == IDC_buttonSharedLoadouts) then {
} else {
private _sameNameLoadoutsList = _data select {_x select 0 == _editBoxContent};
if (count _sameNameLoadoutsList == 0) then {
_data pushBack [_editBoxContent, [_loadout, _curSelLoadout] select (GVAR(currentLoadoutsTab) != IDC_buttonMyLoadouts)];
} else {
_data set [_data find (_sameNameLoadoutsList select 0), [[_editBoxContent, _loadoutName] select (_loadoutName isEqualTo _editBoxContent), [_loadout, _curSelLoadout] select (GVAR(currentLoadoutsTab) != IDC_buttonMyLoadouts)]];
};
// Add new row if the current tab is "My loadouts"
if (GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts) then {
// Delete "old" loadout row
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];
_contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadout select 1) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadout select 2) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadout select 3) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadout select 4) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
_contentPanelCtrl setVariable [_editBoxContent, _loadout];
_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};
};
[(findDisplay IDD_ace_arsenal), format ["Loadout '%1' was saved", _editBoxContent]] call FUNC(message); // TBL
};
profileNamespace setVariable [QGVAR(saved_loadouts), _data];

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
systemChat str [_display, _control];
if !(ctrlEnabled _control) exitWith {};

View File

@ -1,2 +0,0 @@
#include "script_component.hpp"
hint str _this;

View File

@ -167,7 +167,7 @@ if (GVAR(currentLeftPanel) != _ctrlIDC) then {
};
GVAR(currentLeftPanel) = _ctrlIDC;
["ace_arsenal_leftPanelFilled", [_display, _ctrlIDC]] call CBA_fnc_localEvent;
[QGVAR(leftPanelFilled), [_display, _ctrlIDC]] call CBA_fnc_localEvent;
// Sort
private _sortLeftCtrl = _display displayCtrl IDC_sortLeftTab;

View File

@ -0,0 +1,49 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
private _contentListCtrl = _display displayCtrl IDC_contentPanel;
private _textEditBoxCtrl= _display displayCtrl IDC_textEditBox;
_textEditBoxCtrl ctrlSetText "";
_contentListCtrl lnbSetCurSelRow -1;
lnbClear _contentListCtrl;
private _data = +(profileNamespace getvariable [QGVAR(saved_loadouts),[]]);
if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
{
_x params ["_loadoutName", "_loadoutData"];
([_loadoutData] call FUNC(verifyLoadout)) params ["_loadout", "_nullItemsAmount", "_unavailableItemsAmount"];
private _newRow = _contentListCtrl lnbAddRow ["",_loadoutName];
_contentListCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadout select 1) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadout select 2) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadout select 3) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadout select 4) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
_contentListCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
if (_nullItemsAmount > 0) then {
_contentListCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.5]];
} else {
if (_unavailableItemsAmount > 0) then {
_contentListCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
};
};
_contentListCtrl setVariable [_loadoutName, _loadout];
} foreach ([_data, ([GVAR(defaultLoadoutsList), []] select (isNil QGVAR(defaultLoadoutsList)))] select (ctrlIDC _control == IDC_buttonDefaultLoadouts));
} else {
};
_contentListCtrl lnbSort [1, false];

View File

@ -52,6 +52,7 @@ private _fnc_fill_right_Container = {
_ctrlPanel lnbSetData [[_lbAdd, 0], _x];
_ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture];
_ctrlPanel lnbSetValue [[_lbAdd, 0], _mass];
_ctrlPanel setVariable [_displayName, _mass];
_ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select (_isUnique)];
_ctrlPanel lbSetTooltip [_lbAdd * _columns,format ["%1\n%2", _displayName, _x]];
};
@ -221,7 +222,7 @@ if (GVAR(currentRightPanel) != _ctrlIDC) then {
GVAR(currentRightPanel) = _ctrlIDC;
["ace_arsenal_rightPanelFilled", [_display, _ctrlIDC]] call CBA_fnc_localEvent;
[QGVAR(rightPanelFilled), [_display, _ctrlIDC]] call CBA_fnc_localEvent;
// Sorting
private _sortRightCtrl = _display displayCtrl IDC_sortRightTab;
@ -246,7 +247,7 @@ if (_leftPanelState) then {
[_sortRightCtrl, _sortRightCtrl lbValue (lbCurSel _sortRightCtrl)] call FUNC(sortPanel);
// Add current items in those containers
// Add current items and change progress bar
if (GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]) then {
private _container = switch (GVAR(currentLeftPanel)) do {
case IDC_buttonUniform : {

View File

@ -3,6 +3,8 @@
params [["_object", objNull, [objNull]], ["_mode", 1, [1]], ["_items", true, [[], true]], ["_global", true, [true]]];
if (isNull _object) exitWith {};
if (isNil QGVAR(EHIDArray)) then {
GVAR(EHIDArray) = [];
};

View File

@ -0,0 +1,36 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control"];
if !(ctrlEnabled _control || {GVAR(currentLoadoutsTab) == ctrlIDC _control}) exitWith {};
private _centerBoxTitleCtrl = _display displayCtrl IDC_centerTitle;
private _shareButtonCtrl = _display displayCtrl IDC_buttonShare;
private _saveButtonCtrl = _display displayCtrl IDC_buttonSave;
private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad;
private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete;
private _renameButtonCtrl = _display displayCtrl IDC_buttonRename;
switch (ctrlIDC _control) do {
case IDC_buttonMyLoadouts: {
_centerBoxTitleCtrl ctrlSetText "My loadouts"; // TBL
};
case IDC_buttonDefaultLoadouts: {
_centerBoxTitleCtrl ctrlSetText "Default loadouts"; // TBL
};
case IDC_buttonSharedLoadouts: {
_centerBoxTitleCtrl ctrlSetText "Shared loadouts"; // TBL
};
};
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl, _renameButtonCtrl];
[_display, _control] call FUNC(fillLoadoutsList);
GVAR(currentLoadoutsTab) = ctrlIDC _control;

View File

@ -3,7 +3,7 @@
GVAR(camera) cameraEffect ["terminate", "back"];
private _cameraData = [getposAtl GVAR(camera), (getposAtl GVAR(camera)) vectorFromTo (getposAtl GVAR(cameraHelper))];
["ace_arsenalClosed", []] call CBA_fnc_localEvent;
[QGVAR(displayClosed), []] call CBA_fnc_localEvent;
camDestroy GVAR(camera);
GVAR(center) switchCamera GVAR(cameraView);

View File

@ -27,6 +27,7 @@ GVAR(currentInsignia) = GVAR(center) param [0, objNull, [objNull]] getVariable [
GVAR(currentAction) = "Stand";
GVAR(shiftState) = false;
// Add the items the player has to virtualItems
for "_index" from 0 to 10 do {
switch (_index) do {
case 0: {
@ -44,29 +45,34 @@ for "_index" from 0 to 10 do {
((GVAR(virtualItems) select _index) select 2) pushBackUnique (_array select 2);
};
};
case 1: {
private _array = LIST_DEFAULTS select _index;
if !((_array select 0) isEqualTo []) then {
((GVAR(virtualItems) select _index) select 0) append (_array select 0);
{((GVAR(virtualItems) select _index) select 0) pushBackUnique _x} foreach (_array select 0);
};
if !((_array select 1) isEqualTo []) then {
((GVAR(virtualItems) select _index) select 1) append (_array select 1);
{((GVAR(virtualItems) select _index) select 1) pushBackUnique _x} foreach (_array select 1);
};
if !((_array select 2) isEqualTo []) then {
((GVAR(virtualItems) select _index) select 2) append (_array select 2);
{((GVAR(virtualItems) select _index) select 2) pushBackUnique _x} foreach (_array select 2);
};
if !((_array select 3) isEqualTo []) then {
((GVAR(virtualItems) select _index) select 3) append (_array select 3);
{((GVAR(virtualItems) select _index) select 3) pushBackUnique _x} foreach (_array select 3);
};
};
case 2: {
private _array = LIST_DEFAULTS select _index;
private _itemsCache = uiNamespace getVariable QGVAR(configItems);
private _configCfgWeapons = configFile >> "CfgWeapons";
private _configMagazines = configFile >> "CfgMagazines";
private _grenadeList = [];
{
_grenadeList append getArray (_configCfgWeapons >> "Throw" >> _x >> "magazines");
@ -80,41 +86,35 @@ for "_index" from 0 to 10 do {
} count getArray (_configCfgWeapons >> "Put" >> "muzzles");
{
private _configCfgItemInfo = _configCfgWeapons >> _x >> "itemInfo";
switch true do {
case (isClass (configFile >> "CfgMagazines" >> _x) &&
{(getNumber (configFile >> "CfgMagazines" >> _x >> "type") in [256,512,1536,16]) &&
{!(_x in _grenadeList)} &&
{!(_x in _putList)}}): {
case (isClass (_configMagazines >> _x) && {_x in _grenadeList}): {
(GVAR(virtualItems) select 15) pushBackUnique _x;
};
case (isClass (_configMagazines >> _x) && {_x in _putList}): {
(GVAR(virtualItems) select 16) pushBackUnique _x;
};
case (
isClass (_configMagazines >> _x) &&
{_x in (_itemsCache select 2)} &&
{!(_x in (GVAR(virtualItems) select 2))}
): {
(GVAR(virtualItems) select 2) pushBackUnique _x;
};
case (isClass (configFile >> "CfgMagazines" >> _x) && {_x in _grenadeList}): {
(GVAR(virtualItems) select 15) pushBackUnique _x;
};
case (isClass (configFile >> "CfgMagazines" >> _x) && {_x in _putList}): {
(GVAR(virtualItems) select 16) pushBackUnique _x;
};
case (
isClass (_configCfgWeapons >> _x) &&
{(getNumber (_configCfgWeapons >> _x >> "scope")) == 2} &&
{isClass (_configCfgItemInfo)} && {
((getNumber (_configCfgItemInfo >> "type")) in [101, 201, 301, 302] &&
{(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
{(getNumber (_configCfgItemInfo >> "type")) in [401, 619, 620]}
}
):{
(GVAR(virtualItems) select 17) pushBackUnique _x;
};
default {
if (isClass (configFile >> "CfgWeapons" >> _x)) then {
(GVAR(virtualItems) select 18) pushBackUnique _x;
};
{!(_x in (GVAR(virtualItems) select 17))}
): {
(GVAR(virtualItems) select 18) pushBackUnique _x;
};
};
} foreach _array;
};
default {
private _array = (LIST_DEFAULTS select _index) select {!(_x isEqualTo "")};
if !(_array isEqualTo []) then {
@ -124,6 +124,7 @@ for "_index" from 0 to 10 do {
};
};
// Fill current items
for "_index" from 0 to 15 do {
switch (_index) do {
case 0;
@ -192,7 +193,7 @@ GVAR(currentWeaponType) = switch true do {
default {-1};
};
["ace_arsenalOpened", []] call CBA_fnc_localEvent;
[QGVAR(displayOpened), []] call CBA_fnc_localEvent;
//--------------- Fade out unused elements
private _mouseBlockCtrl = _display displayCtrl IDC_mouseBlock;

View File

@ -5,6 +5,8 @@
params ["", "_args"];
_args params ["_display", "_keyPressed", "_shiftState", "_ctrlState", "_altState"];
if !((findDisplay IDD_loadouts_display) isEqualTo displayNull) exitWith {};
GVAR(shiftState) = _shiftState;
private _return = true;

View File

@ -0,0 +1,17 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["", "_args"];
_args params ["_display"];
GVAR(currentLoadoutsTab) = nil;
private _arsenalDisplay = findDisplay IDD_ace_arsenal;
private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
_mouseBlockCtrl ctrlEnable false;
_mouseBlockCtrl ctrlCommit 0;
[_arsenalDisplay] call FUNC(buttonHide);
[_arsenalDisplay , _arsenalDisplay displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);

View File

@ -0,0 +1,33 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["", "_args"];
_args params ["_display"];
private _arsenalDisplay = findDisplay IDD_ace_arsenal;
private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
_mouseBlockCtrl ctrlEnable true;
_mouseBlockCtrl ctrlCommit 0;
[_arsenalDisplay] call FUNC(buttonHide);
GVAR(currentLoadoutsTab) = -1;
private _panelContentCtrl = _display displayCtrl IDC_contentPanel;
_panelContentCtrl ctrlSetFontHeight (GVAR(fontHeight) * GRID_H);
_panelContentCtrl ctrlCommit 0;
if !(GVAR(allowDefaultLoadouts)) then {
private _buttonDefaultLoadoutsCtrl = _display displayCtrl IDC_buttonDefaultLoadouts;
_buttonDefaultLoadoutsCtrl ctrlEnable false;
_buttonDefaultLoadoutsCtrl ctrlCommit 0;
};
if (!GVAR(allowSharedLoadouts) || {isMultiplayer}) then {
private _buttonShareLoadoutsCtrl = _display displayCtrl IDC_buttonSharedLoadouts;
_buttonShareLoadoutsCtrl ctrlEnable false;
_buttonShareLoadoutsCtrl ctrlCommit 0;
};
[_display, _display displayCtrl IDC_buttonMyLoadouts] call FUNC(loadoutsChangeTab);

View File

@ -225,7 +225,7 @@ switch (GVAR(currentLeftPanel)) do {
removeBackpack GVAR(center);
GVAR(center) addBackpack _item;
while {count backpackItems GVAR(center) > 0} do {
GVAR(center) removeItemFromBackpack (VestItems GVAR(center) select 0);
GVAR(center) removeItemFromBackpack (backpackItems GVAR(center) select 0);
}; //--- Remove default config contents
{GVAR(center) addItemToBackpack _x} foreach (GVAR(currentItems) select 17);

View File

@ -0,0 +1,58 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display", "_control", "_curSel"];
if (_curSel == -1) exitWith {};
private _shareButtonCtrl = _display displayCtrl IDC_buttonShare;
private _saveButtonCtrl = _display displayCtrl IDC_buttonSave;
private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad;
private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete;
private _renameButtonCtrl = _display displayCtrl IDC_buttonRename;
private _textEditBoxCtrl= _display displayCtrl IDC_textEditBox;
switch (GVAR(currentLoadoutsTab)) do {
case IDC_buttonMyLoadouts: {
_shareButtonCtrl ctrlEnable ([false, true] select (GVAR(allowSharedLoadouts)));
_shareButtonCtrl ctrlCommit 0;
_loadButtonCtrl ctrlEnable true;
_loadButtonCtrl ctrlCommit 0;
{
_x ctrlEnable (_curSel >= 0);
_x ctrlCommit 0;
} foreach [_renameButtonCtrl, _deleteButtonCtrl];
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
};
case IDC_buttonDefaultLoadouts: {
_loadButtonCtrl ctrlEnable true;
_loadButtonCtrl ctrlCommit 0;
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _deleteButtonCtrl];
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
};
case IDC_buttonSharedLoadouts: {
_loadButtonCtrl ctrlEnable true;
_loadButtonCtrl ctrlCommit 0;
{
_x ctrlEnable false;
_x ctrlCommit 0;
} foreach [_shareButtonCtrl, _deleteButtonCtrl];
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]);
};
};

View File

@ -11,12 +11,9 @@ private _item = [_control lnbData [_curSel, 0], _control lbData _curSel] select
private _fnc_selectRight = {
params ["_item", "_cfgEntry"];
(lnbSize _control) params ["_rows", "_columns"];
_columns = count lnbGetColumnsPosition _control;
// Load remaining
private _load = switch (GVAR(currentLeftPanel)) do {
private _maxLoad = switch (GVAR(currentLeftPanel)) do {
case IDC_buttonUniform: {
gettext (configfile >> "CfgWeapons" >> uniform GVAR(center) >> "ItemInfo" >> "containerClass")
};
@ -27,38 +24,8 @@ private _fnc_selectRight = {
backpack GVAR(center)
};
};
_load = getnumber (configfile >> "CfgVehicles" >> _load >> "maximumLoad");
_load = _load * (1 - progressPosition (_display displayCtrl IDC_loadIndicatorBar));
// Grey out items too big
for "_r" from 0 to (_rows - 1) do {
private _mass = _control lnbValue [_r, 0];
private _alpha = [1.0,0.25] select (_mass > _load);
private _color = [1,1,1,_alpha];
_control lnbsetcolor [[_r,1],_color];
_control lnbsetcolor [[_r,2],_color];
};
// Remove all from container show / hide
private _removeAllCtrl = _display displayCtrl IDC_buttonRemoveAll;
if (progressPosition (_display displayCtrl IDC_loadIndicatorBar) > 0) then {
_removeAllCtrl ctrlSetFade 0;
_removeAllCtrl ctrlShow true;
_removeAllCtrl ctrlCommit FADE_DELAY;
};
// change button color if unique or too big
private _plusButtonCtrl = _display displayCtrl IDC_arrowPlus;
if ((_control lnbValue [_curSel, 2]) == 1 || {(_control lnbValue [_curSel, 0]) > _load}) then {
_plusButtonCtrl ctrlEnable false;
_plusButtonCtrl ctrlCommit FADE_DELAY;
} else {
_plusButtonCtrl ctrlEnable true;
_plusButtonCtrl ctrlCommit FADE_DELAY;
};
[_control, _maxLoad] call FUNC(updateRightPanel);
[_display, _control, _curSel, (configFile >> _cfgEntry >> _item)] call FUNC(itemInfo);
};
@ -101,4 +68,4 @@ switch (GVAR(currentRightPanel)) do {
};
};
(_display displayCtrl IDC_totalWeightText) ctrlSetText (GVAR(center) call EFUNC(movement,getWeight)); // TBL
(_display displayCtrl IDC_totalWeightText) ctrlSetText (GVAR(center) call EFUNC(movement,getWeight));

View File

@ -118,7 +118,8 @@ private _magazineGroups = [[],[]] call CBA_fnc_hashCreate;
isClass (_configItemInfo) &&
((getNumber (_configItemInfo >> "type")) in [101, 201, 301, 302] &&
{(_className isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
{(getNumber (_configItemInfo >> "type")) in [401, 619, 620]}
{(getNumber (_configItemInfo >> "type")) in [401, 619, 620]} ||
{(getText ( _x >> "simulation")) == "ItemMineDetector"}
): {
(_cargo select 17) pushBackUnique _className;
};

View File

@ -19,6 +19,12 @@ switch (GVAR(currentLeftPanel)) do {
case IDC_buttonVest;
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 : {
_nextAction = "Civil";
};
@ -31,6 +37,7 @@ switch (GVAR(currentLeftPanel)) do {
};
};
case IDC_buttonVoice : {
_nextAction = "Civil";
GVAR(center) directSay "CuratorObjectPlaced";
};
};

View File

@ -0,0 +1,36 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_control", "_maxLoad"];
private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar;
private _curSel = lnbCurSelRow _control;
(lnbSize _control) params ["_rows"];
_maxLoad = getnumber (configfile >> "CfgVehicles" >> _maxLoad >> "maximumLoad");
_maxLoad = _maxLoad * (1 - progressPosition _loadIndicatorBarCtrl);
// Grey out items too big
for "_r" from 0 to (_rows - 1) do {
private _mass = _control getVariable (_control lnbText [_r, 1]);
private _alpha = [1.0,0.25] 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 _removeAllCtrl = _display displayCtrl IDC_buttonRemoveAll;
if (progressPosition _loadIndicatorBarCtrl > 0) then {
_removeAllCtrl ctrlSetFade 0;
_removeAllCtrl ctrlShow true;
_removeAllCtrl ctrlEnable true;
_removeAllCtrl ctrlCommit FADE_DELAY;
};
// change button color if unique or too big
private _plusButtonCtrl = _display displayCtrl IDC_arrowPlus;
_plusButtonCtrl ctrlEnable !((_control lnbValue [_curSel, 2]) == 1 || {(_control getVariable (_control lnbText [_curSel, 1])) > _maxLoad});
_plusButtonCtrl ctrlCommit FADE_DELAY;

View File

@ -0,0 +1,220 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_loadout"];
private _weaponCfg = configFile >> "CfgWeapons";
private _magCfg = configFile >> "CfgMagazines";
private _vehcCfg = configFile >> "CfgVehicles";
private _glassesCfg = configFile >> "CfgGlasses";
private _weaponsArray = GVAR(virtualItems) select 0;
private _accsArray = GVAR(virtualItems) select 1;
private _nullItemsAmount = 0;
private _unavailableItemsAmount = 0;
private _fnc_weaponCheck = {
params ["_dataPath"];
if (count _dataPath != 0) then {
{
if (_x isEqualType "") then {
private _item = _x;
if (_item != "") then {
if (isClass (_weaponCfg >> _item)) then {
if !(CHECK_WEAPON_OR_ACC) then {
TRACE_1("item unavailable", _item);
_dataPath set [_forEachIndex, ""];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
_dataPath set [_forEachIndex, ""];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
} else {
if (count _x != 0) then {
private _mag = _x select 0;
if (isClass (_magCfg >> _mag)) then {
if !(_mag in (GVAR(virtualItems) select 2)) then {
TRACE_1("item unavailable", _item);
_dataPath set [_forEachIndex, []];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
_dataPath set [_forEachIndex, []];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
};
} foreach _dataPath;
};
};
for "_dataIndex" from 0 to 9 do {
switch (_dataIndex) do {
case 0;
case 1;
case 2;
case 8: {
[_loadout select _dataIndex] call _fnc_weaponCheck;
};
case 3;
case 4;
case 5: {
private _containerArray = (_loadout select _dataIndex);
if (count _containerArray != 0) then {
_containerArray params ["_item", "_containerItems"];
if (isClass (_vehcCfg >> _item) || {isClass (_weaponCfg >> _item)}) then {
if !(CHECK_CONTAINER) then {
TRACE_1("item unavailable", _item);
_loadout set [_dataIndex, []];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
} else {
if (count _containerItems != 0) then {
{
private _currentIndex = _forEachIndex;
switch (count _x) do {
case 2: {
if ((_x select 0) isEqualType "") then {
private _item = _x select 0;
if (CLASS_CHECK_ITEM) then {
if !(CHECK_CONTAINER_ITEMS) then {
TRACE_1("item unavailable", _item);
((_loadout select _dataIndex) select 1) set [_currentIndex, []];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
((_loadout select _dataIndex) select 1) set [_currentIndex, []];
_nullItemsAmount = _nullItemsAmount + 1;
};
} else {
[(((_loadout select _dataIndex) select 1) select _currentIndex) select 0] call _fnc_weaponCheck;
};
};
case 3: {
private _item = _x select 0;
if (isClass (_magCfg >> _item)) then {
if (_item in (GVAR(virtualItems) select 3)) then {
TRACE_1("item unavailable", _item);
((_loadout select _dataIndex) select 1) set [_currentIndex, []];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
((_loadout select _dataIndex) select 1) set [_currentIndex, []];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
};
} foreach _containerItems;
};
};
} else {
_loadout set [_dataIndex, []];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
};
case 6: {
private _item = _loadout select _dataIndex;
if (_item != "") then {
if (isClass (_weaponCfg >> _item)) then {
if !(_item in (GVAR(virtualItems) select 3)) then {
TRACE_1("item unavailable", _item);
_loadout set [_dataIndex, ""];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
_loadout set [_dataIndex, ""];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
};
case 7: {
private _item = _loadout select _dataIndex;
if (_item != "") then {
if (isClass (_glassesCfg >> _item)) then {
if !(_item in (GVAR(virtualItems) select 7)) then {
TRACE_1("item unavailable", _item);
_loadout set [_dataIndex, ""];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
_loadout set [_dataIndex, ""];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
};
case 9: {
for "_subIndex" from 0 to 4 do {
private _item = (_loadout select _dataIndex) select _subIndex;
if (_item != "") then {
if (isClass (_weaponCfg >> _item)) then {
if !(CHECK_ASSIGNED_ITEMS) then {
TRACE_1("item unavailable", _item);
(_loadout select _dataIndex) set [_subIndex, ""];
_unavailableItemsAmount = _unavailableItemsAmount + 1;
};
} else {
TRACE_1("item null", _item);
(_loadout select _dataIndex) set [_subIndex, ""];
_nullItemsAmount = _nullItemsAmount + 1;
};
};
};
};
};
};
[_loadout, _nullItemsAmount, _unavailableItemsAmount]

View File

@ -112,14 +112,14 @@ class GVAR(display) {
};
class totalWeight: RscControlsGroupNoScrollbars {
idc = IDC_totalWeight;
x = QUOTE(safezoneX + 14 * GRID_W);
x = QUOTE(safezoneX + 39 * GRID_W);
y = QUOTE(safeZoneH + safezoneY - 9 * GRID_H);
w = QUOTE(20 * GRID_W);
h = QUOTE(7 * GRID_H);
class controls {
class totalWeightBackground: ctrlStaticBackground {
idc = -1;
colorBackground[] = {0,0,0,0.8};
colorBackground[] = {0,0,0,0.5};
x = 0;
y = 0;
w = QUOTE(20 * GRID_W);
@ -151,22 +151,48 @@ class GVAR(display) {
};
class menuBar: RscControlsGroupNoScrollbars {
idc = IDC_menuBar;
x = QUOTE(safezoneX + safezoneW * 0.50 - 75 * GRID_W);
x = QUOTE((safezoneX + safezoneW * 0.50) - (64.5 * GRID_W));
y = QUOTE(safezoneH + safezoneY - 9 * GRID_H);
w = QUOTE(150 * GRID_W);
w = QUOTE(125 * GRID_W);
h = QUOTE(7 * GRID_H);
class controls {
class menuBarBackground: ctrlStaticBackground {
idc = IDC_menuBarBackground;
x = QUOTE(0);
class buttonHide: ctrlButton {
idc = -1;
colorBackground[] = {0,0,0,0.8};
x = QUOTE(0 * GRID_W);
y = QUOTE(0);
w = QUOTE(150 * GRID_W);
w = QUOTE(25 * GRID_W);
h = QUOTE(7 * GRID_H);
colorBackground[] = {0,0,0,1};
text="Hide"; // TBL
shortcuts[]= {"0x0E"};
tooltip="Hide interface"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(buttonHide));
};
class buttonLoadouts: buttonHide {
idc = -1;
x = QUOTE(25 * GRID_W);
text="Loadouts"; // TBL
tooltip="Displays loadouts screen"; // TBL
onButtonClick = QUOTE(createDialog QQGVAR(loadoutsDisplay));
};
class buttonExport: buttonHide {
idc = -1;
x = QUOTE(50 * GRID_W);
text="Export"; // TBL
tooltip="Export loadout"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(buttonExport));
};
class buttonImport: buttonHide {
idc = -1;
x = QUOTE(75 * GRID_W);
text="Import"; // TBL
tooltip="Import loadout"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(buttonImport));
};
class buttonClose: ctrlButtonClose {
idc = IDC_buttonClose;
x = QUOTE(0);
idc = -1;
colorBackground[] = {0,0,0,0.8};
x = QUOTE(100 * GRID_W);
y = QUOTE(0);
w = QUOTE(25 * GRID_W);
h = QUOTE(7 * GRID_H);
@ -175,51 +201,12 @@ class GVAR(display) {
tooltip="Close interface"; // TBL
onButtonClick = QUOTE(ctrlparent (_this select 0) closeDisplay 2);
};
class buttonSave: ctrlButton {
idc = IDC_buttonSave;
x = QUOTE(25 * GRID_W);
y = QUOTE(0);
w = QUOTE(25 * GRID_W);
h = QUOTE(7 * GRID_H);
text="Save"; // TBL
tooltip="Save loadout"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(arsenalButtonSave));
};
class buttonLoad: buttonSave {
idc = IDC_buttonLoad;
x = QUOTE(50 * GRID_W);
text="Load"; // TBL
tooltip="Load loadout"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(arsenalButtonLoad));
};
class buttonImport: buttonSave {
idc = IDC_buttonImport;
x = QUOTE(75 * GRID_W);
text="Import"; // TBL
tooltip="Import loadout"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(buttonImport));
};
class buttonExport: buttonSave {
idc = IDC_buttonExport;
x = QUOTE(100 * GRID_W);
text="Export"; // TBL
tooltip="Export loadout"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(buttonExport));
};
class buttonHide: buttonSave {
idc = IDC_buttonHide;
x = QUOTE(125 * GRID_W);
text="Hide"; // TBL
shortcuts[]= {"0x0E"};
tooltip="Hide interface"; // TBL
onButtonClick = QUOTE([ctrlparent (_this select 0)] call FUNC(buttonHide));
};
};
};
class infoBox: RscControlsGroupNoScrollbars {
idc = IDC_infoBox;
fade = 1;
x = QUOTE(safezoneX + safezoneW - 90 * GRID_W);
x = QUOTE(safezoneX + safezoneW - 99 * GRID_W);
y = QUOTE(safeZoneH + safezoneY - 17 * GRID_H);
w = QUOTE(85 * GRID_W);
h = QUOTE(15 * GRID_H);
@ -708,16 +695,178 @@ class GVAR(display) {
};
class buttonRemoveAll: ctrlButtonPicture {
idc = IDC_buttonRemoveAll;
text="\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoMisc_ca.paa";
text= QPATHTOF(data\iconClearContainer.paa);
tooltip="Remove all items from the container"; //TBL
colorBackground[]={0,0,0,0.5};
onButtonClick = QUOTE(ctrlParent (_this select 0) call FUNC(buttonClearAll));
fade=1;
enable=0;
x = QUOTE(safezoneW + safezoneX - 10 * GRID_W);
x = QUOTE(safezoneW + safezoneX - 11 * GRID_W);
y = QUOTE(safeZoneH + safezoneY - 33 * GRID_H);
w = QUOTE(9 * GRID_W);
h = QUOTE(9 * GRID_H);
};
};
};
class GVAR(loadoutsDisplay) {
idd = IDD_loadouts_display;
onLoad = QUOTE([ARR_3('onLoad', _this, QQGVAR(loadoutsDisplay))] call FUNC(onLoadoutsOpen));
onUnload = QUOTE([ARR_3('onUnload', _this, QQGVAR(loadoutsDisplay))] call FUNC(onLoadoutsClose));
class controls {
class centerBox: ctrlControlsGroupNoScrollbars {
idc = IDC_centerBox;
x = QUOTE((safezoneW * 0.5) + safezoneX - (80 * GRID_W));
y = QUOTE(safezoneY + (5 * GRID_H));
w = QUOTE(160 * GRID_W);
h = QUOTE(safezoneH - (45 * GRID_H));
class controls {
class centerFrame: RscFrame {
idc = -1;
x = QUOTE(0 * GRID_W);
y = QUOTE(0 * GRID_H);
w = QUOTE(160 * GRID_W);
h = QUOTE(safezoneH - (45 * GRID_H));
colorText[] = {0,0,0,1};
};
class centerBackground: ctrlStaticBackground {
idc = -1;
x = QUOTE(0);
y = QUOTE(0);
w = QUOTE(160 * GRID_W);
h = QUOTE(safezoneH - (45 * GRID_H));
colorBackground[] = {0,0,0,0.8};
};
class centerTitle: ctrlStaticTitle {
idc = IDC_centerTitle;
style = ST_CENTER;
text = "Loadouts";
x = QUOTE(0);
y = QUOTE(0);
w = QUOTE(160 * GRID_W);
h = QUOTE(5 * GRID_H);
};
class contentPanel: RscListnBox {
idc = IDC_contentPanel;
colorBackground[]={1,1,1,1};
colorSelectBackground[]={1,1,1,0.5};
colorSelectBackground2[]={1,1,1,0.5};
colorPictureSelected[]={1,1,1,1};
colorSelect[]={1,1,1,1};
colorSelect2[]={1,1,1,1};
colorPictureRightSelected[]={1,1,1,1};
columns[]={0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90};
drawSideArrows=0;
disableOverflow=1;
onLBSelChanged = QUOTE([ARR_3(ctrlParent (_this select 0), _this select 0, _this select 1)] call FUNC(onSelChangedLoadouts));
onLBDblClick = QUOTE([ARR_2(ctrlparent (_this select 0), (ctrlParent (_this select 0)) displayCtrl IDC_buttonLoad)] call FUNC(buttonLoadoutsLoad));
x = QUOTE(0);
y = QUOTE(5 * GRID_H);
w = QUOTE(160 * GRID_W);
h = QUOTE(safezoneH - (57 * GRID_H));
sizeEx = QUOTE(7 * GRID_H);
};
class textTitle: RscText {
idc= -1;
text="$STR_DISP_GAME_NAME";
x = QUOTE(5 * GRID_W);
y = QUOTE(safezoneH - (51 * GRID_H));
w = QUOTE(15 * GRID_W);
h = QUOTE(5 * GRID_H);
colorBackground[]={0,0,0,0.2};
};
class textEditBox: ctrlEdit {
idc= IDC_textEditBox;
x = QUOTE(20 * GRID_W);
y = QUOTE(safezoneH - (51 * GRID_H));
w = QUOTE(100 * GRID_W);
h = QUOTE(5 * GRID_H);
};
};
};
class buttonSave: ctrlButton {
idc = IDC_buttonSave;
x = QUOTE((safezoneW * 0.5) + safezoneX - (75 * GRID_W));
y = QUOTE(safezoneH + safezoneY - 39 * GRID_H);
w = QUOTE(25 * GRID_W);
h = QUOTE(10 * GRID_H);
text="Save"; // TBL
tooltip="Save selected loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsSave));
colorBackground[] = {0,0,0,0.8};
};
class buttonRename: buttonSave {
idc = IDC_buttonRename;
x = QUOTE((safezoneW * 0.5) + safezoneX - (45 * GRID_W));
text="Rename"; // TBL
tooltip="Rename loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsRename));
};
class buttonLoad: buttonSave {
idc = IDC_buttonLoad;
x = QUOTE((safezoneW * 0.5) + safezoneX - (15 * GRID_W));
text="Load"; // TBL
tooltip="Load selected loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsLoad));
};
class buttonShare: buttonSave {
idc = IDC_buttonShare;
x = QUOTE((safezoneW * 0.5) + safezoneX + (15 * GRID_W));
text="Share"; // TBL
tooltip="Share selected loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsShare));
};
class buttonDelete: buttonSave {
idc = IDC_buttonDelete;
x = QUOTE((safezoneW * 0.5) + safezoneX + (45 * GRID_W));
text="Delete"; // TBL
tooltip="Delete loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsDelete));
};
class buttonClose: buttonSave {
idc = -1;
x = QUOTE(safezoneW + safezoneX - 31 * GRID_W);
y = QUOTE(safezoneH + safezoneY - 12 * GRID_H);
w = QUOTE(30 * GRID_W);
h = QUOTE(10 * GRID_H);
sizeEx = QUOTE(4.5 * GRID_H);
text="Close"; // TBL
shortcuts[]= {"0x01"};
tooltip="Close interface"; // TBL
onButtonClick = QUOTE(ctrlparent (_this select 0) closeDisplay 2);
};
class buttonBar: ctrlControlsGroupNoScrollbars {
idc = -1;
x = QUOTE((safezoneW * 0.5) + safezoneX - (61 * GRID_W));
y = QUOTE(safezoneH + safezoneY - 12 * GRID_H);
w = QUOTE(122 * GRID_W);
h = QUOTE(10 * GRID_H);
class controls {
class buttonMyLoadouts: ctrlButton {
idc = IDC_buttonMyLoadouts;
colorBackground[] = {0,0,0,0.8};
x = QUOTE(0 * GRID_W);
y = QUOTE(0 * GRID_H);
w = QUOTE(40 * GRID_W);
h = QUOTE(10 * GRID_H);
sizeEx = QUOTE(4.5 * GRID_H);
text="My loadouts"; // TBL
tooltip="Save selected loadout"; // TBL
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(loadoutsChangeTab));
};
class buttonDefaultLoadouts: buttonMyLoadouts {
idc = IDC_buttonDefaultLoadouts;
x = QUOTE(41 * GRID_W);
text="Default loadouts"; // TBL
tooltip=""; // TBL
};
class buttonSharedLoadouts: buttonMyLoadouts {
idc = IDC_buttonSharedLoadouts;
x = QUOTE(82 * GRID_W);
text="Shared loadouts"; // TBL
tooltip=""; // TBL
};
};
};
};
};