View Single Post
02/06/24, 06:50 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,000
At first I'll ask: Describe what your usecase is so we can help better, or tell us what you'd like to achieve.


https://github.com/esoui/esoui/blob/...tory.lua#L2077

The function ZO_InventoryManager:GenerateListOfVirtualStackedItems(inventoryType, predicate, itemIds)
is not stacking your items but generating a list of items of the inventoryType, combining different bagIds for that inventoryType (depending on self.inventories[inventoryType] (where self = object created of ZO_InventoryManager -> PLAYER_INVENTORY [see here: https://github.com/esoui/esoui/blob/...ory.lua#L3174]) -> so PLAYER_INVENTORY.inventories[inventoryType].backingBags table -> bagIds to combine).

The backingBars are defined here, per inventoryType:
https://github.com/esoui/esoui/blob/...ntory.lua#L483
e.g. inventoryBank got 1 bags: the normal bank and the ESO+ subscriber bank:
backingBags = { BAG_BANK, BAG_SUBSCRIBER_BANK },

So you will get a list of all items that are in the different bagIds, e.g. BAG_BACKPACK, BAG_WORN, BAG_VIRTUAL (craftbag)
filtered by the predicate function (if provided).

It will just call this function ZO_InventoryManager:GenerateListOfVirtualStackedItemsFromBag(bagId, predicate, itemIds)
https://github.com/esoui/esoui/blob/...tory.lua#L2090

In the end you got a table itemIds with the items that were found in the bagIds.
It may aslo return an empty table if no backingBags are defined for the inventoryType.

Not sure what your usecase is but this will not stack any items in your inventory!


Edit:
To update the shown inventory list you need to call the inventoryObject's UpdateList() function.
PLAYER_INVENTORY:UpdateList(inventoryType)

LibFilters provides API functions to do so too. If you want to filter items in the inventories/crafting tables etc. then use that library to make it compatible with other addons, and call it's libFilters:RequestUpdate(filterType, delay) function

If you do not need to filter (hide items) anything it's probably easier to do it without that lib

Last edited by Baertram : 02/06/24 at 06:57 AM.
  Reply With Quote