View Single Post
01/06/24, 08:26 AM   #9
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,000
The bag cache is the cached data of the bags, containing the slots (which is the same data as the inventorySlots shown in the scrolllist as you press i basically).

So your loop here
for _, data in pairs(SHARED_INVENTORY.bagCache[bagType]) do
got the data and data.slotIndex etc. but also data.stackCount, data.name and all the other vanilla data should be in there that the GetBag* and GetItemLink* functions would return if you pass in the bagId, slotIndex and/or itemLink.

Only "special data" maybe missing.
I recommand to use an addon like merTorchbug and make your loope data global via e.g.
InventoryDump._debugData = data

That way you can use /tbug or /tb (or /zgoo if you use ZGOO addon) InventoryDump and inspect your global variable InventoryDump and then click on _debugData and inspect what is given already.


oh btw,to get the most actual bag cache you need to run this function once before you start to loop the bagCache:
SHARED_INVENTORY:GetOrCreateBagCache(bagId)
So for your needs you'd have to run

SHARED_INVENTORY:GetOrCreateBagCache(BAG_BACKPACK)
SHARED_INVENTORY:GetOrCreateBagCache(BAG_BANK)
SHARED_INVENTORY:GetOrCreateBagCache(BAG_SUBSCRIBER_BANK)
SHARED_INVENTORY:GetOrCreateBagCache(BAG_VIRTUAL)

Hint: As Dolgubon already said the slotIndex in the BAG_VIRTUAL is the actual data.itemId or GetItemId(bagId, slotIndex)!

Last edited by Baertram : 01/06/24 at 08:31 AM.
  Reply With Quote