From b06990293397d4b6d0374097f09d1cc5679216e3 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:04 +0300 Subject: init --- Client/Functions/Client_DisplayInventory.sqf | 98 ++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 Client/Functions/Client_DisplayInventory.sqf (limited to 'Client/Functions/Client_DisplayInventory.sqf') diff --git a/Client/Functions/Client_DisplayInventory.sqf b/Client/Functions/Client_DisplayInventory.sqf new file mode 100644 index 0000000..7765609 --- /dev/null +++ b/Client/Functions/Client_DisplayInventory.sqf @@ -0,0 +1,98 @@ +Private ['_cost','_count','_get','_inventoryGUI','_inventorySlots','_items','_loadout','_misca','_miscInvGUI','_miscItemSlots','_primary','_secondary','_sidearm','_sidearmInvGUI','_sidearmInventorySlots','_slot','_sorted']; +_loadout = _this select 0; +_items = _this select 1; + +_inventoryGUI = 3503; +_sidearmInvGUI = 3515; +_miscInvGUI = 3523; + +for [{_count = 0},{_count < 12},{_count = _count + 1}] do {CtrlSetText[_inventoryGUI + _count,"\Ca\UI\Data\ui_gear_mag_gs.paa"]}; +for [{_count = 0},{_count < 8},{_count = _count + 1}] do {CtrlSetText[_sidearmInvGUI + _count,"\Ca\UI\Data\ui_gear_mag_gs.paa"]}; +for [{_count = 0},{_count < 12},{_count = _count + 1}] do {CtrlSetText[_miscInvGUI + _count,"\Ca\UI\Data\ui_gear_eq_gs.paa"]}; + +_cost = 0; +_slot = 0; +_inventorySlots = []; +_sidearmInventorySlots = []; +_miscItemSlots = []; + +_primary = []; +_secondary = []; +_sidearm = []; +_misca = []; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + switch (_get select QUERYGEARTYPE) do { + case 'primary': {_primary = _primary + [_x]}; + case 'secondary': {_secondary = _secondary + [_x]}; + case 'sidearm': {_sidearm = _sidearm + [_x]}; + case 'CfgMagazines': {_misca = _misca + [_x]}; + case 'CfgWeapons': {_misca = _misca + [_x]}; + }; + }; + +} forEach _loadout; + +_sorted = _primary + _secondary + _misca; +_sidearm = _sidearm + _misca; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if (!(_get select QUERYGEARHANDGUNPOOL)) then { + ctrlSetText[_inventoryGUI + _slot,(_get select QUERYGEARPICTURE)]; + _cost = _cost + (_get select QUERYGEARCOST); + _slot = _slot + 1; + _inventorySlots = _inventorySlots + [_x]; + for [{_count = (_get Select QUERYGEARSPACE) - 1},{_count > 0},{_count = _count - 1}] do { + ctrlSetText[_inventoryGUI + _slot,""]; + _slot = _slot + 1; + _inventorySlots = _inventorySlots + [""]; + }; + }; + }; +} forEach _sorted; + +_slot = 0; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if (_get select QUERYGEARHANDGUNPOOL) then { + ctrlSetText[_sidearmInvGUI + _slot,(_get select QUERYGEARPICTURE)]; + _cost = _cost + (_get select QUERYGEARCOST); + _slot = _slot + 1; + _sidearmInventorySlots = _sidearmInventorySlots + [_x]; + for [{_count = (_get Select QUERYGEARSPACE) - 1},{_count > 0},{_count = _count - 1}] do { + ctrlSetText[_sidearmInvGUI + _slot,""]; + _slot = _slot + 1; + _sidearmInventorySlots = _sidearmInventorySlots + [""]; + }; + }; + }; +} forEach _sidearm; + +_slot = 0; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + CtrlSetText[_miscInvGUI + _slot,(_get select QUERYGEARPICTURE)]; + _slot = _slot + 1; + _miscItemSlots = _miscItemSlots + [_x]; + _cost = _cost + (_get select QUERYGEARCOST); + for [{_count = (_get Select QUERYGEARSPACE) - 1},{_count > 0},{_count = _count - 1}] do { + ctrlSetText[_miscInvGUI + _slot,""]; + _slot = _slot + 1; + _miscItemSlots = _miscItemSlots + [""]; + }; + }; +} forEach _items; + +[_inventorySlots,_sidearmInventorySlots,_miscItemSlots,_cost] \ No newline at end of file -- cgit v1.3.1