diff --git a/addons/arsenal/Cfg3DEN.hpp b/addons/arsenal/Cfg3DEN.hpp new file mode 100644 index 00000000000..9b058f48c06 --- /dev/null +++ b/addons/arsenal/Cfg3DEN.hpp @@ -0,0 +1,188 @@ +class Cfg3DEN { + class Mission { + class GVAR(DummyCategory) { + displayName = "Dummy attribute, should never show up"; + class AttributeCategories { + class ACE3_Arsenal { + class Attributes { + class GVAR(DefaultLoadoutsListAttribute) { + property = QGVAR(DefaultLoadoutsListAttribute); + value = 0; + expression = "if !(is3DEN) then {ace_arsenal_defaultLoadoutsList = _value};"; + defaultValue = "[]"; + validate = "none"; + wikiType = "[[Array]]"; + }; + }; + }; + }; + }; + }; + class Attributes { + class GVAR(attribute): ctrlControlsGroupNoScrollbars { + idc = -1; + // onLoad fixes attributeLoad not happening on multiple selection with different attribute + onLoad = QUOTE(private _objects = get3DENSelected 'object'; if (count _objects > 1) then {[ARR_2(_this select 0,((_objects select 0) get3DENAttribute QQGVAR(attribute)) select 0)] call FUNC(attributeLoad)}); + x = QUOTE(0); + y = QUOTE(0); + w = QUOTE(130 * ATTRIBUTE_W); + h = QUOTE(106.83 * ATTRIBUTE_H); + attributeLoad = QUOTE([ARR_2(_this,+_value)] call FUNC(attributeLoad)); + attributeSave = QUOTE(uiNamespace getVariable [ARR_2(QQGVAR(attributeValue),[ARR_2([], 0)])]); + class controls { + class ModeTitle: ctrlStatic { + idc = -1; + text = CSTRING(Mode); + x = QUOTE(5 * ATTRIBUTE_W); + y = QUOTE(0); + w = QUOTE(125 * ATTRIBUTE_W); + h = QUOTE(5 * ATTRIBUTE_H); + }; + class Mode: ctrlToolbox { + idc = IDC_ATTRIBUTE_MODE; + onToolBoxSelChanged = QUOTE([ARR_2(ctrlParentControlsGroup (_this select 0), _this select 1)] call FUNC(attributeMode)); + x = QUOTE(5 * ATTRIBUTE_W); + y = QUOTE(5 * ATTRIBUTE_H); + w = QUOTE(125 * ATTRIBUTE_W); + h = QUOTE(5 * ATTRIBUTE_H); + rows = 1; + columns = 2; + strings[] = {CSTRING(Whitelist), CSTRING(Blacklist)}; + }; + class ItemsTitle: ModeTitle { + text = CSTRING(Items); + y = QUOTE(10 * ATTRIBUTE_H); + }; + class Category: ctrlToolboxPictureKeepAspect { + idc = IDC_ATTRIBUTE_CATEGORY; + onToolBoxSelChanged = QUOTE([ctrlParentControlsGroup (_this select 0)] call FUNC(attributeAddItems)); + x = QUOTE(5 * ATTRIBUTE_W); + y = QUOTE(15 * ATTRIBUTE_H); + w = QUOTE(125 * ATTRIBUTE_W); + h = QUOTE(20.83 * ATTRIBUTE_H); + rows = 2; + columns = 12; + strings[] = { + "\a3\Ui_F_Curator\Data\RscCommon\RscAttributeInventory\filter_0_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\PrimaryWeapon_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\SecondaryWeapon_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Handgun_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemOptic_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemAcc_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemMuzzle_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemBipod_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoMagAll_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Headgear_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Uniform_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Vest_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Backpack_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Goggles_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\NVGs_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Binoculars_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Map_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Compass_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Radio_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Watch_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\GPS_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoThrow_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoPut_ca.paa", + "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\CargoMisc_ca.paa" + }; + }; + class ListBackground: ctrlStatic { + idc = -1; + x = QUOTE(5 * ATTRIBUTE_W); + y = QUOTE(35.83 * ATTRIBUTE_H); + w = QUOTE(125 * ATTRIBUTE_W); + h = QUOTE(65 * ATTRIBUTE_H); + colorBackground[] = {1, 1, 1, 0.1}; + }; + class List: ctrlListNBox { + idc = IDC_ATTRIBUTE_LIST; + idcLeft = IDC_ATTRIBUTE_LIST_LEFT; + idcRight = IDC_ATTRIBUTE_LIST_RIGHT; + onLBDblClick = QUOTE(_this call FUNC(attributeDblClick)); + x = QUOTE(5 * ATTRIBUTE_W); + y = QUOTE(35.83 * ATTRIBUTE_H); + w = QUOTE(125 * ATTRIBUTE_W); + h = QUOTE(65 * ATTRIBUTE_H); + drawSideArrows = 1; + disableOverflow = 1; + columns[] = {0.05, 0.15, 0.85}; + }; + class ArrowLeft: ctrlButton { + idc = IDC_ATTRIBUTE_LIST_LEFT; + onButtonClick = QUOTE([ARR_2(ctrlParentControlsGroup (_this select 0),false)] call FUNC(attributeSelect)); + text = SYMBOL_ITEM_NONE; + font = "RobotoCondensedBold"; + x = QUOTE(-1); + y = QUOTE(-1); + w = QUOTE(5 * ATTRIBUTE_W); + H = QUOTE(5 * ATTRIBUTE_H); + }; + class ArrowRight: ArrowLeft { + idc = IDC_ATTRIBUTE_LIST_RIGHT; + onButtonClick = QUOTE([ARR_2(ctrlParentControlsGroup (_this select 0),true)] call FUNC(attributeSelect)); + text = SYMBOL_ITEM_VIRTUAL; + }; + class SearchButton: ctrlButtonPicture { + idc = IDC_ATTRIBUTE_SEARCH_BUTTON; + onButtonClick = QUOTE(((ctrlParentControlsGroup (_this select 0)) controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR) ctrlSetText ''; [ctrlParentControlsGroup (_this select 0)] call FUNC(attributeAddItems)); + text = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_start_ca.paa"; + x = QUOTE(5 * ATTRIBUTE_W); + y = QUOTE(101.83 * ATTRIBUTE_H); + w = QUOTE(5 * ATTRIBUTE_W); + h = QUOTE(5 * ATTRIBUTE_H); + colorBackground[] = {0, 0, 0, 0.5}; + }; + class SearchBar: ctrlEdit { + idc = IDC_ATTRIBUTE_SEARCHBAR; + onKeyUp = QUOTE([ctrlParentControlsGroup (_this select 0)] call FUNC(attributeAddItems)); + x = QUOTE(11 * ATTRIBUTE_W); + y = QUOTE(101.83 * ATTRIBUTE_H); + w = QUOTE(55 * ATTRIBUTE_W); + h = QUOTE(5 * ATTRIBUTE_H); + }; + class ClearButton: ctrlButton { + idc = IDC_ATTRIBUTE_CLEAR_BUTTON; + onButtonClick = QUOTE([ctrlParentControlsGroup (_this select 0)] call FUNC(attributeClear)); + text = "$STR_disp_arcmap_clear"; + x = QUOTE(105 * ATTRIBUTE_W); + y = QUOTE(101.83 * ATTRIBUTE_H); + w = QUOTE(25 * ATTRIBUTE_W); + h = QUOTE(5 * ATTRIBUTE_H); + colorBackground[] = {0, 0, 0, 0.6}; + }; + class ExportButton: ClearButton { + idc = IDC_ATTRIBUTE_EXPORT_BUTTON; + onButtonClick = QUOTE(copyToClipboard str ((uiNamespace getVariable [ARR_2(QQGVAR(attributeValue),[ARR_2([],0)])]) select 0)); + text = CSTRING(buttonExportText); + tooltip = CSTRING(AttributeExport_Tooltip); + x = QUOTE(79 * ATTRIBUTE_W); + }; + }; + }; + }; + class Object { + class AttributeCategories { + class ADDON { + displayName = CSTRING(Mission); + collapsed = 1; + class Attributes { + class ADDON { + property = QGVAR(attribute); + control = QGVAR(attribute); + displayName = CSTRING(Mission); + tooltip = ""; + expression = QUOTE(if (!is3DEN) then {[ARR_2(_this,+_value)] call FUNC(attributeInit)}); + defaultValue = "[[], 0]"; + condition = "1 - objectControllable"; + wikiType = "[[Array]]"; + validate = "none"; + value = 0; + }; + }; + }; + }; + }; +}; diff --git a/addons/arsenal/XEH_PREP.hpp b/addons/arsenal/XEH_PREP.hpp index 6b3ace5c1d9..98753b070c6 100644 --- a/addons/arsenal/XEH_PREP.hpp +++ b/addons/arsenal/XEH_PREP.hpp @@ -1,6 +1,13 @@ PREP(addListBoxItem); PREP(addStat); PREP(addVirtualItems); +PREP(attributeAddItems); +PREP(attributeClear); +PREP(attributeDblClick); +PREP(attributeInit); +PREP(attributeLoad); +PREP(attributeMode); +PREP(attributeSelect); PREP(buttonCargo); PREP(buttonClearAll); PREP(buttonExport); diff --git a/addons/arsenal/config.cpp b/addons/arsenal/config.cpp index 9ba31a31f65..32bc41d254d 100644 --- a/addons/arsenal/config.cpp +++ b/addons/arsenal/config.cpp @@ -8,35 +8,14 @@ class CfgPatches { requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; author = ECSTRING(common,ACETeam); - authors[] = {"alganthe"}; + authors[] = {"alganthe", "mharis001"}; url = ECSTRING(main,URL); VERSION_CONFIG; }; }; -class Cfg3DEN { - class Mission { - class GVAR(DummyCategory) { - displayName="Dummy attribute, should never show up"; - class AttributeCategories { - class ACE3_Arsenal { - class Attributes { - class GVAR(DefaultLoadoutsListAttribute) { - property = QGVAR(DefaultLoadoutsListAttribute); - value=0; - expression="if !(is3DEN) then {ace_arsenal_defaultLoadoutsList = _value};"; - defaultValue="[]"; - validate="none"; - wikiType="[[Array]]"; - }; - }; - }; - }; - }; - }; -}; - #include "ui\RscAttributes.hpp" +#include "Cfg3DEN.hpp" #include "CfgEventHandlers.hpp" #include "RscDisplayMain.hpp" #include "ACE_Arsenal_Stats.hpp" diff --git a/addons/arsenal/defines.hpp b/addons/arsenal/defines.hpp index 31d9a278027..6bc200b32fd 100644 --- a/addons/arsenal/defines.hpp +++ b/addons/arsenal/defines.hpp @@ -149,6 +149,24 @@ #define IDC_buttonSharedLoadoutsBackground 405 #define IDC_buttonSharedLoadouts 406 +// 3DEN Attribute +#define ATTRIBUTE_W (pixelW * pixelGrid * 0.5) +#define ATTRIBUTE_H (pixelH * pixelGrid * 0.5) + +#define IDC_ATTRIBUTE_MODE 8100 +#define IDC_ATTRIBUTE_CATEGORY 8101 +#define IDC_ATTRIBUTE_LIST 8102 +#define IDC_ATTRIBUTE_LIST_LEFT 8103 +#define IDC_ATTRIBUTE_LIST_RIGHT 8104 +#define IDC_ATTRIBUTE_SEARCH_BUTTON 8105 +#define IDC_ATTRIBUTE_SEARCHBAR 8106 +#define IDC_ATTRIBUTE_CLEAR_BUTTON 8107 +#define IDC_ATTRIBUTE_EXPORT_BUTTON 8108 + +#define SYMBOL_ITEM_NONE "−" +#define SYMBOL_ITEM_REMOVE "×" +#define SYMBOL_ITEM_VIRTUAL "∞" + #define FADE_DELAY 0.15 #define CAM_DIS_MAX 5 diff --git a/addons/arsenal/functions/fnc_attributeAddItems.sqf b/addons/arsenal/functions/fnc_attributeAddItems.sqf new file mode 100644 index 00000000000..edc62ea6ede --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeAddItems.sqf @@ -0,0 +1,122 @@ +#include "script_component.hpp" +#include "..\defines.hpp" +/* + * Author: mharis001 + * Populates 3DEN attribute listbox with items of given category. + * + * Arguments: + * 0: Attribute controls group + * + * Return Value: + * None + * + * Example: + * [CONTROL, 0] call ace_arsenal_fnc_attributeAddItems + * + * Public: No + */ + +params ["_controlsGroup"]; + +private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY) - 1; +private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR); +private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]); +private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]; +TRACE_3("Populating list",_category,_filter,_attributeValue); + +_attributeValue params ["_attributeItems", "_attributeMode"]; +private _modeSymbol = [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode; + +// Clear listbox +private _listbox = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST; +lnbClear _listbox; + +// Exit with current items (no specific category) +if (_category == -1) exitWith { + { + // Get appropriate config for each item (different since items can be from any category) + private _config = switch (true) do { + case (_x in (_configItems select 2)); + case (_x in (_configItems select 15)); + case (_x in (_configItems select 16)): { + configFile >> "CfgMagazines" >> _x; + }; + case (_x in (_configItems select 6)): { + configFile >> "CfgVehicles" >> _x; + }; + case (_x in (_configItems select 7)): { + configFile >> "CfgGlasses" >> _x; + }; + default { + configFile >> "CfgWeapons" >> _x; + }; + }; + + // Add item if not filtered + private _displayName = getText (_config >> "displayName"); + if (toLower _displayName find _filter > -1) then { + private _picture = getText (_config >> "picture"); + private _index = _listbox lnbAddRow ["", _displayName, _modeSymbol]; + _listbox lnbSetData [[_index, 1], _x]; + _listbox lnbSetPicture [[_index, 0], _picture]; + _listbox lbSetTooltip [_index * (count lnbGetColumnsPosition _listbox), _x]; + }; + } forEach _attributeItems; + + _listbox lnbSort [1]; +}; + +// Get list of category items +private _categoryItems = switch (true) do { + case (_category < 3): { + _configItems select 0 select _category; + }; + case (_category < 7): { + _configItems select 1 select (_category - 3); + }; + default { + _configItems select (_category - 5); + }; +}; + +// Get config for current category +private _config = switch (true) do { + case (_category in [7, 20, 21]): { + configFile >> "CfgMagazines"; + }; + case (_category == 11): { + configFile >> "CfgVehicles"; + }; + case (_category == 12): { + configFile >> "CfgGlasses"; + }; + default { + configFile >> "CfgWeapons"; + }; +}; + +// Populate listbox with category items +{ + // Add item if not filtered + private _displayName = getText (_config >> _x >> "displayName"); + if (toLower _displayName find _filter > -1) then { + private _picture = getText (_config >> _x >> "picture"); + private _symbol = SYMBOL_ITEM_NONE; + private _alpha = 0.5; + + // Change symbol and alpha if item already selected + if (_x in _attributeItems) then { + _symbol = _modeSymbol; + _alpha = 1; + }; + + private _index = _listbox lnbAddRow ["", _displayName, _symbol]; + _listbox lnbSetData [[_index, 1], _x]; + _listbox lnbSetPicture [[_index, 0], _picture]; + _listbox lbSetTooltip [_index * (count lnbGetColumnsPosition _listbox), _x]; + _listbox lnbSetColor [[_index, 1], [1, 1, 1, _alpha]]; + _listbox lnbSetColor [[_index, 2], [1, 1, 1, _alpha]]; + }; +} forEach _categoryItems; + +_listbox lnbSort [1]; diff --git a/addons/arsenal/functions/fnc_attributeClear.sqf b/addons/arsenal/functions/fnc_attributeClear.sqf new file mode 100644 index 00000000000..a0a8cb070d7 --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeClear.sqf @@ -0,0 +1,46 @@ +#include "script_component.hpp" +#include "..\defines.hpp" +/* + * Author: mharis001 + * Clears all items from current category in 3DEN attribute. + * + * Arguments: + * 0: Attribute controls group + * + * Return Value: + * None + * + * Example: + * [CONTROL] call ace_arsenal_fnc_attributeClear + * + * Public: No + */ + +params ["_controlsGroup"]; + +private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY) - 1; +private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]; +TRACE_1("Handling clear button",_category); + +// Remove all if no specific category +if (_category == -1) then { + _attributeValue set [0, []]; +} else { + // Find category items and remove from list + private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]); + private _categoryItems = switch (true) do { + case (_category < 3): { + _configItems select 0 select _category; + }; + case (_category < 7): { + _configItems select 1 select (_category - 3); + }; + default { + _configItems select (_category - 5); + }; + }; + _attributeValue set [0, (_attributeValue select 0) - _categoryItems]; +}; + +// Refresh the list after clear +[_controlsGroup] call FUNC(attributeAddItems); diff --git a/addons/arsenal/functions/fnc_attributeDblClick.sqf b/addons/arsenal/functions/fnc_attributeDblClick.sqf new file mode 100644 index 00000000000..6cb9314bcfc --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeDblClick.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: mharis001 + * Handles double clicking a row in 3DEN attribute listbox. + * + * Arguments: + * 0: Listbox + * 1: Row index + * + * Return Value: + * None + * + * Example: + * [CONTROL, 0] call ace_arsenal_fnc_attributeDblClick + * + * Public: No + */ + +params ["_listbox", "_currentRow"]; +TRACE_1("Double click toggle",_currentRow); + +// Get toggle mode (add or remove item) +private _itemClassname = _listbox lnbData [_currentRow, 1]; +private _addItem = !(_itemClassname in ((uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]) select 0)); + +[ctrlParentControlsGroup _listbox, _addItem] call FUNC(attributeSelect); diff --git a/addons/arsenal/functions/fnc_attributeInit.sqf b/addons/arsenal/functions/fnc_attributeInit.sqf new file mode 100644 index 00000000000..14afa316917 --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeInit.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" +/* + * Author: mharis001 + * Initializes the objects 3DEN attribute at scenario start. + * + * Arguments: + * 0: Attribute target + * 1: Attribute value + * + * Return Value: + * None + * + * Example: + * [box, [[], 1]] call ace_arsenal_fnc_attributeInit + * + * Public: No + */ + +params ["_object", "_value"]; +_value params ["_items", "_mode"]; +TRACE_2("Initializing object with attribute",_object,_value); + +if (_mode > 0) then { + // Blacklist: all full arsenal and take items away + [_object, true, true] call FUNC(initBox); + [_object, _items, true] call FUNC(removeVirtualItems); +} else { + // Exit on whitelist mode with no items + if (_items isEqualTo []) exitWith {}; + + // Whitelist: add only selected items + [_object, _items, true] call FUNC(initBox); +}; diff --git a/addons/arsenal/functions/fnc_attributeLoad.sqf b/addons/arsenal/functions/fnc_attributeLoad.sqf new file mode 100644 index 00000000000..b2b3f13b1e8 --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeLoad.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +#include "..\defines.hpp" +/* + * Author: mharis001 + * Initializes the 3DEN attribute. + * + * Arguments: + * 0: Attribute controls group + * 1: Attribute value + * + * Return Value: + * None + * + * Example: + * [CONTROL, [[], 0]] call ace_arsenal_fnc_attributeLoad + * + * Public: No + */ + +params ["_controlsGroup", "_value"]; +TRACE_1("Initializing 3DEN attribute",_value); + +// Store working attribute value +uiNamespace setVariable [QGVAR(attributeValue), _value]; + +// Handle selected mode +if (_value select 1 > 0) then { + (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_MODE) lbSetCurSel 1; + (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST_RIGHT) ctrlSetText SYMBOL_ITEM_REMOVE; +}; + +[_controlsGroup] call FUNC(attributeAddItems); diff --git a/addons/arsenal/functions/fnc_attributeMode.sqf b/addons/arsenal/functions/fnc_attributeMode.sqf new file mode 100644 index 00000000000..807fea2ec43 --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeMode.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" +#include "..\defines.hpp" +/* + * Author: mharis001 + * Handles changing the mode in 3DEN attribute. + * + * Arguments: + * 0: Attribute controls group + * 1: Mode + * + * Return Value: + * None + * + * Example: + * [CONTROL, 0] call ace_arsenal_fnc_attributeMode + * + * Public: No + */ + +params ["_controlsGroup", "_mode"]; +TRACE_1("Changing attribute mode",_mode); + +// Store mode change +private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]; +_attributeValue set [1, _mode]; + +// Change right list button and refresh list items with new mode +(_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST_RIGHT) ctrlSetText ([SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _mode); +[_controlsGroup] call FUNC(attributeAddItems); diff --git a/addons/arsenal/functions/fnc_attributeSelect.sqf b/addons/arsenal/functions/fnc_attributeSelect.sqf new file mode 100644 index 00000000000..7af0ecc7645 --- /dev/null +++ b/addons/arsenal/functions/fnc_attributeSelect.sqf @@ -0,0 +1,49 @@ +#include "script_component.hpp" +#include "..\defines.hpp" +/* + * Author: mharis001 + * Handles adding/removing an item from 3DEN attribute list. + * + * Arguments: + * 0: Attribute controls group + * 1: Add (true) or remove (false) item + * + * Return Value: + * None + * + * Example: + * [CONTROL, true] call ace_arsenal_fnc_attributeSelect + * + * Public: No + */ + +params ["_controlsGroup", "_addItem"]; + +// Get item class from listbox +private _listbox = _controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_LIST; +private _currentRow = lnbCurSelRow _listbox; +private _itemClassname = _listbox lnbData [_currentRow, 1]; +TRACE_2("Handling item selection",_itemClassname,_addItem); + +private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]; +_attributeValue params ["_attributeItems", "_attributeMode"]; + +private _findItem = _attributeItems find _itemClassname; + +// Add item if not already in list +if (_addItem && {_findItem < 0}) exitWith { + _attributeItems pushBack _itemClassname; + // Change symbol and increase alpha + _listbox lnbSetText [[_currentRow, 2], [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode]; + _listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 1]]; + _listbox lnbSetColor [[_currentRow, 2], [1, 1, 1, 1]]; +}; + +// Remove item if in list +if (!_addItem && {_findItem > -1}) exitWith { + _attributeItems deleteAt _findItem; + // Change symbol and reduce alpha + _listbox lnbSetText [[_currentRow, 2], SYMBOL_ITEM_NONE]; + _listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 0.5]]; + _listbox lnbSetColor [[_currentRow, 2], [1, 1, 1, 0.5]]; +}; diff --git a/addons/arsenal/stringtable.xml b/addons/arsenal/stringtable.xml index 1eea2b74f66..20796a96afb 100644 --- a/addons/arsenal/stringtable.xml +++ b/addons/arsenal/stringtable.xml @@ -751,5 +751,59 @@ 輸出 class name 到剪貼簿上 Copiato il nome della classe negli appunti + + Mode + 模式 + Mode + Modo + Modalità + Tryb + Режим + Modus + Režim + Modo + 모드 + 模式 + モード + Mod + + + Whitelist + Biała lista + Lista blanca + Whitelist + Seznam povolených + Lista branca + Liste blanche + Fehérlista + Вайтлист + Lista Bianca + 許可制 + 화이트리스트 + 白名單 + 白名单 + + + Blacklist + + + Items + 物品 + Objets + Objetos + Oggetti + Przedmioty + Предметы + Gegenstände + Předměty + Itens + 물품 + 物品 + アイテム + Eşyalar + + + Export current items list as an array for use in scripts +