diff --git a/addons/main/GUI/ESE.hpp b/addons/main/GUI/ESE.hpp index dcbd9c5a..4fc1d529 100644 --- a/addons/main/GUI/ESE.hpp +++ b/addons/main/GUI/ESE.hpp @@ -142,7 +142,11 @@ class ENH_ESE "Backpacks", "Headgear", "Goggles", - "NVGs" + "NVGs", + "Separator", + "ImportToFilter", + "Separator", + "ResetToAllItems" }; }; class FolderHelp @@ -275,6 +279,7 @@ class ENH_ESE { text = "$STR_ENH_MAIN_ESE_IMPORTFROMCLIPBOARD"; action = "[false, [], true] call ENH_fnc_ESE_loadAttributeValue"; + picture = "\a3\ui_f\data\igui\cfg\actions\loadvehicle_ca.paa"; shortcuts[] = {DIK_6}; }; //Filter @@ -399,6 +404,18 @@ class ENH_ESE picture = "\a3\ui_f\data\gui\rsc\rscdisplayarsenal\nvgs_ca.paa"; data = "NVGoggles"; }; + class ImportToFilter + { + text = "$STR_ENH_MAIN_ESE_IMPORTFROMCLIPBOARD"; + picture = "\a3\ui_f\data\igui\cfg\actions\loadvehicle_ca.paa"; + action = "[] call ENH_fnc_ESE_importToFilter"; + }; + class ResetToAllItems + { + text = "$STR_A3_RSCDISPLAYARSENAL_RESET"; + picture = "\A3\ui_f\data\igui\rsctitles\mpprogress\respawn_ca.paa"; + action = "[] call ENH_fnc_ESE_resetToAllItems"; + }; class InventoryItems: ARs { text = "$STR_A3_CFGVEHICLECLASSES_ITEMS0"; diff --git a/addons/main/cfgFunctions.hpp b/addons/main/cfgFunctions.hpp index 9a1f88a3..e97b9d47 100644 --- a/addons/main/cfgFunctions.hpp +++ b/addons/main/cfgFunctions.hpp @@ -99,6 +99,7 @@ class CfgFunctions class ESE_fullArsenal; class ESE_getConfigValues; class ESE_handleTemplates; + class ESE_importToFilter; class ESE_lbAdd; class ESE_lnbAdd; class ESE_loadAttributeValue; @@ -108,6 +109,7 @@ class CfgFunctions class ESE_removeItem; class ESE_resetSearch; class ESE_resetStorage; + class ESE_resetToAllItems; class ESE_search; class ESE_sort; class ESE_toggleVirtual; diff --git a/addons/main/functions/GUI/ESE/fn_ESE_importToFilter.sqf b/addons/main/functions/GUI/ESE/fn_ESE_importToFilter.sqf new file mode 100644 index 00000000..275731bb --- /dev/null +++ b/addons/main/functions/GUI/ESE/fn_ESE_importToFilter.sqf @@ -0,0 +1,27 @@ +/* + Author: Pixelated_Grunt + + Date: 2024-08-29 + + Description: + Used by the ENH_ESE GUI. Import a list from clipboard to the available list (left panel). + The import list is same as ACE arsenal export format i.e. ["item1", "item2"]. + + Parameter(s): + - + + Returns: + - +*/ + + +#include "\x\enh\addons\main\script_component.hpp" +private _allAttributes = [true] call ENH_fnc_ESE_parseClipboardValues; +private _display = uiNamespace getVariable ["ENH_Display_ESE", displayNull]; + +// Backup the existing ENH_ESE_itemsHashMap +uiNamespace setVariable ["ENH_ESE_itemsHashMapClone", uiNamespace getVariable ["ENH_ESE_itemsHashMap", createHashMap]]; +// Replace the hashmap +uiNamespace setVariable ["ENH_ESE_itemsHashMap", _allAttributes]; +// Call change filter to trigger the list update +[CTRL(IDC_ESE_MENU), [2, 0]] call ENH_fnc_ESE_changeFilter diff --git a/addons/main/functions/GUI/ESE/fn_ESE_lbAdd.sqf b/addons/main/functions/GUI/ESE/fn_ESE_lbAdd.sqf index c218eee7..072c7b82 100644 --- a/addons/main/functions/GUI/ESE/fn_ESE_lbAdd.sqf +++ b/addons/main/functions/GUI/ESE/fn_ESE_lbAdd.sqf @@ -31,9 +31,12 @@ params ["_textRight", ""] ]; -private _index = _ctrlLb lbAdd _lbText; -_ctrlLb lbSetData [_index, _lbData]; -_ctrlLb lbSetPicture [_index, _pictureLeft]; -_ctrlLb lbSetPictureRight [_index, _pictureRight]; -_ctrlLb lbSetTooltip [_index, _tooltip]; -_ctrlLb lbSetTextRight [_index, _textRight]; \ No newline at end of file +if (_lbText != "") then +{ + private _index = _ctrlLb lbAdd _lbText; + _ctrlLb lbSetData [_index, _lbData]; + _ctrlLb lbSetPicture [_index, _pictureLeft]; + _ctrlLb lbSetPictureRight [_index, _pictureRight]; + _ctrlLb lbSetTooltip [_index, _tooltip]; + _ctrlLb lbSetTextRight [_index, _textRight] +}; diff --git a/addons/main/functions/GUI/ESE/fn_ESE_lnbAdd.sqf b/addons/main/functions/GUI/ESE/fn_ESE_lnbAdd.sqf index 3fe33585..ac3cc07d 100644 --- a/addons/main/functions/GUI/ESE/fn_ESE_lnbAdd.sqf +++ b/addons/main/functions/GUI/ESE/fn_ESE_lnbAdd.sqf @@ -22,20 +22,23 @@ disableSerialization; params ["_ctrlLnb", "_data", "_text", "_image", "_addonIcon", "_value", "_tooltip", "_specificType"]; -private _row = _ctrlLnb lnbAddRow ["", _text, str _value, ""]; - -//Column #0 -_ctrlLnb lnbSetData [[_row, 0], _data]; -_ctrlLnb lnbSetPicture [[_row, 0], _image]; -_ctrlLnb lnbSetTooltip [[_row, 0], _tooltip]; - -//Column #1 -_ctrlLnb lnbSetValue [[_row, 1], _value]; -_ctrlLnb lnbSetData [[_row, 1], _specificType]; - -//Column #2 - Count -_ctrlLnb lnbSetText [[_row, 2], str _value]; - -//Column #3 - Addon Icon -_ctrlLnb lnbSetPicture [[_row, 3], _addonIcon]; -_ctrlLnb lnbSetData [[_row, 3], _addonIcon]; \ No newline at end of file +if (_text != "") then +{ + private _row = _ctrlLnb lnbAddRow ["", _text, str _value, ""]; + + //Column #0 + _ctrlLnb lnbSetData [[_row, 0], _data]; + _ctrlLnb lnbSetPicture [[_row, 0], _image]; + _ctrlLnb lnbSetTooltip [[_row, 0], _tooltip]; + + //Column #1 + _ctrlLnb lnbSetValue [[_row, 1], _value]; + _ctrlLnb lnbSetData [[_row, 1], _specificType]; + + //Column #2 - Count + _ctrlLnb lnbSetText [[_row, 2], str _value]; + + //Column #3 - Addon Icon + _ctrlLnb lnbSetPicture [[_row, 3], _addonIcon]; + _ctrlLnb lnbSetData [[_row, 3], _addonIcon] +}; diff --git a/addons/main/functions/GUI/ESE/fn_ESE_open.sqf b/addons/main/functions/GUI/ESE/fn_ESE_open.sqf index 4cb13e82..deb40bd2 100644 --- a/addons/main/functions/GUI/ESE/fn_ESE_open.sqf +++ b/addons/main/functions/GUI/ESE/fn_ESE_open.sqf @@ -57,6 +57,10 @@ CTRL(IDC_ESE_AVAILABLEITEMSLIST) ctrlAddEventHandler ["LBSelChanged", private _itemsHashMap = uiNamespace getVariable ["ENH_ESE_itemsHashMap", createHashMap]; private _lbCompItems = ctrlParent _lbAvailableItems displayCtrl IDC_ESE_COMPATIBLEITEMSLIST; + // Use the clone if exist + private _clone = uiNamespace getVariable ["ENH_ESE_itemsHashMapClone", nil]; + if (!isNil("_clone")) then {_itemsHashMap = _clone}; + lbClear _lbCompItems; { @@ -71,4 +75,4 @@ CTRL(IDC_ESE_AVAILABLEITEMSLIST) ctrlAddEventHandler ["LBSelChanged", } forEach (compatibleItems _className + compatibleMagazines _className); }]; -["update"] call ENH_fnc_ESE_handleTemplates; \ No newline at end of file +["update"] call ENH_fnc_ESE_handleTemplates; diff --git a/addons/main/functions/GUI/ESE/fn_ESE_parseClipboardValues.sqf b/addons/main/functions/GUI/ESE/fn_ESE_parseClipboardValues.sqf index 197ece60..8496d512 100644 --- a/addons/main/functions/GUI/ESE/fn_ESE_parseClipboardValues.sqf +++ b/addons/main/functions/GUI/ESE/fn_ESE_parseClipboardValues.sqf @@ -7,14 +7,15 @@ Used by the ENH_ESE GUI. Read and convert array from clipboard to inventory attributes. Parameter(s): - - + BOOL - true to return variable only. Default is false. Returns: - ARRAY - Result attributes that can be loaded into the inventory screen. Return all if failed. + ARRAY - Result attributes that can be loaded into the filter and inventory screens. Return all items if failed. */ #include "\x\enh\addons\main\script_component.hpp" +params [["_return", false, [false]]]; private _importList = call compile copyFromClipboard; // Verify import list is in correct format @@ -41,9 +42,6 @@ private _configs = _importList apply { } }; -//private _configValues = ([_configs] call ENH_fnc_ESE_getConfigValues) select 1; -//private _attributeValue = [true, _configValues] call ENH_fnc_ESE_applyAttribute; -// -//_attributeValue private _attributeValue = ([_configs] call ENH_fnc_ESE_getConfigValues) select 1; +if _return exitWith {_attributeValue}; [true, _attributeValue] call ENH_fnc_ESE_applyAttribute diff --git a/addons/main/functions/GUI/ESE/fn_ESE_resetToAllItems.sqf b/addons/main/functions/GUI/ESE/fn_ESE_resetToAllItems.sqf new file mode 100644 index 00000000..a7d747cd --- /dev/null +++ b/addons/main/functions/GUI/ESE/fn_ESE_resetToAllItems.sqf @@ -0,0 +1,25 @@ +/* + Author: Pixelated_Grunt + + Date: 2024-08-29 + + Description: + Used by the ENH_ESE GUI. Reset the filter list (left panel) back to all available items. + + Parameter(s): + - + + Returns: + - +*/ + + +#include "\x\enh\addons\main\script_component.hpp" +private _display = uiNamespace getVariable ["ENH_Display_ESE", displayNull]; + +// Restore the ENH_ESE_itemsHashMap variable +uiNamespace setVariable ["ENH_ESE_itemsHashMap", uiNamespace getVariable "ENH_ESE_itemsHashMapClone"]; +// Release the memory +uiNamespace setVariable ["ENH_ESE_itemsHashMapClone", nil]; +// Call change filter to trigger the list update +[CTRL(IDC_ESE_MENU), [2, 0]] call ENH_fnc_ESE_changeFilter diff --git a/addons/main/stringtable.xml b/addons/main/stringtable.xml index 11c6723f..8453b223 100644 --- a/addons/main/stringtable.xml +++ b/addons/main/stringtable.xml @@ -6873,6 +6873,17 @@ 可用物品 Oggetti Disponibili + + Reset + Перезагрузить + Zurücksetzen + Nastawić + Réinitialiser + Reiniciar + 重置 + 重置 + Reset + Adds all items of selected addon to the inventory and sets it to be virtual (Arsenal). Добавляет все предметы выбранного аддона в инвентарь и делает его виртуальным (Арсенал). @@ -10341,4 +10352,4 @@ Condizione calcolata ripetutamente, deve restituire un'espressione booleana. Quando è vera, l'indicatore viene visualizzato. - \ No newline at end of file +