Thread Tools Display Modes
Prev Previous Post   Next Post Next
01/05/24, 06:50 PM   #1
vsrs_au
Join Date: Dec 2022
Posts: 18
Duplication of items between bank and ESO+ bank

I wrote an addon to (among other things) count the items in the account's bank, using the 2 bag type codes defined in the ESOUI API, i.e. BAG_BANK and BAG_SUBSCRIBER_BANK. The problem is that my code is finding various instances of the same items appearing in both shared inventories. My (partial) code is below:
Code:
function InventoryDump.DumpInventory(bagType)
	local iUsed = GetNumBagUsedSlots(bagType)
	local iTotal = GetBagSize(bagType)
	if bagType == BAG_VIRTUAL then
		CHAT_SYSTEM:AddMessage("InventoryDump:     used=" .. iUsed)
	else
		CHAT_SYSTEM:AddMessage("InventoryDump:     used=" .. iUsed .. "/" .. iTotal)
	end

	for _, data in pairs(SHARED_INVENTORY.bagCache[bagType]) do
		if data ~= nil then
			local itemLink = GetItemLink(bagType, data.slotIndex)
			local invCount, bankCount, cbCount = GetItemLinkStacks(itemLink)
			local count = 0
			if bagType == BAG_BANK or bagType == BAG_SUBSCRIBER_BANK then
				count = bankCount
			elseif bagType == BAG_VIRTUAL then
				count = cbCount
			elseif bagType == BAG_BACKPACK then
				count = invCount
			end
			InventoryDump.DumpItem(bagType, count, itemName)
		end
	end

	CHAT_SYSTEM:AddMessage("InventoryDump: inventory dumped.")
end
If I call the function first for BAG_BANK and then for BAG_SUBSCRIBER_BANK, the message output to the chat window correctly shows the used and used+free for the 2 shared inventories, e.g. at the moment it will show
Code:
InventoryDump:    used=165/240
InventoryDump:    used=58/240
When I use the bank UI in the game, it shows I have 223 items out of 480. So the overall counts seem to be correct. But when I examine the item names and counts written to the SavedVariables file, I find that some items are appearing in both these shared inventories (with the same stack count), and others only appear in 1 of these shared inventories. Does anyone know why?

Last edited by vsrs_au : 01/05/24 at 08:55 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Duplication of items between bank and ESO+ bank


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off