Skip to content

Commit

Permalink
Merge pull request #1329 from BrettMayson/rename
Browse files Browse the repository at this point in the history
Item Rename Framework
  • Loading branch information
PabstMirror authored Sep 21, 2024
2 parents db4a097 + 88ba4d4 commit 3df747a
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 159 deletions.
1 change: 1 addition & 0 deletions addons/ui/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CfgFunctions {
PATHTO_FNC(notify);
PATHTO_FNC(openLobbyManager);
PATHTO_FNC(progressBar);
PATHTO_FNC(renameInventoryItem);
};

class ItemContextMenu {
Expand Down
1 change: 1 addition & 0 deletions addons/ui/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if (hasInterface) then {
}];

PREP(openItemContextMenu);
PREP(getInventoryItemData);
};

// legacy function names
Expand Down
2 changes: 2 additions & 0 deletions addons/ui/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ PREP(preload3DEN);
PREP(preloadCurator);

PREP(openItemContextMenu);

PREP(getInventoryItemData);
51 changes: 51 additions & 0 deletions addons/ui/fnc_getInventoryItemData.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Internal Function: cba_ui_fnc_getInventoryItemData
Description:
Returns item data from inventory display control
Parameters:
_control - RscDisplayInventory control <CONTROL>
_index - Item index <NUMBER>
Returns:
_classname, _container, _containerType
Examples:
(begin example)
[_groundContainer, 5] call cba_ui_fnc_getInventoryItemData;
(end)
Author:
commy2, SynixeBrett
---------------------------------------------------------------------------- */

params ["_control", "_index"];

private _unit = call CBA_fnc_currentUnit;

private _container = objNull;
private _containerType = _control getVariable QGVAR(containerType);
switch _containerType do {
case "GROUND": {
_container = GVAR(CurrentGroundItemHolder);
};
case "CARGO": {
_container = GVAR(CurrentContainer);
};
case "UNIFORM_CONTAINER": {
_container = uniformContainer _unit;
};
case "VEST_CONTAINER": {
_container = vestContainer _unit;
};
case "BACKPACK_CONTAINER": {
_container = backpackContainer _unit;
};
};

// Reports classname for every item type except backpacks (https://feedback.bistudio.com/T183096)
private _classname = _control lbData _index;

[_classname, _container, _containerType]
Loading

0 comments on commit 3df747a

Please sign in to comment.