Skip to content

Commit 08c3230

Browse files
committed
Handle 11.2 bank changes, add support for warband bank
1 parent 254db9d commit 08c3230

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

Simulationcraft.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## IconTexture: Interface\Addons\SimulationCraft\logo
44
## Notes: Constructs SimC export strings
55
## Author: Theck, navv_, seriallos
6-
## Version: 11.2.0-alpha05
6+
## Version: 11.2.0-alpha06
77
## OptionalDependencies: Ace3, LibRealmInfo, LibDBIcon, LibDataBroker-1.1
88
## SavedVariables: SimulationCraftDB
99

core.lua

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,34 @@ end
583583
function Simulationcraft:GetBagItemStrings(debugOutput)
584584
local bagItems = {}
585585

586-
-- https://wowpedia.fandom.com/wiki/BagID
587-
-- Bag indexes are a pain, need to start in the negatives to check everything (like the default bank container)
588-
for bag=BACKPACK_CONTAINER - ITEM_INVENTORY_BANK_BAG_OFFSET, NUM_TOTAL_EQUIPPED_BAG_SLOTS + 6 do
586+
-- https://warcraft.wiki.gg/wiki/InventorySlotID#Bags
587+
-- https://warcraft.wiki.gg/wiki/BagID
588+
-- 11.2 unifies character, reagent, and void banks and reorganizes the container IDs
589+
-- Before 11.2, the addon basically needed to iteration from index -5 to 11 or so
590+
-- After 11.2, it's a much more sane 0 to 17
591+
-- The bound of the iteration can mostly be gleaned from various constants (that have shifted around between patches)
592+
-- with the addition of the built-in backpack slot
593+
-- This should work for a while if they add any more containers and if the container sizes change as it's all pretty
594+
-- dynamic now
595+
596+
local invConstants = Constants.InventoryConstants
597+
local startSlot = nil
598+
local totalSlots = nil
599+
if invConstants.NumCharacterBankSlots then
600+
-- 11.2 and after
601+
startSlot = 0
602+
-- add 1 for the backpack
603+
local numBagSlots = 1 + invConstants.NumBagSlots + invConstants.NumReagentBagSlots
604+
local numBankSlots = invConstants.NumCharacterBankSlots
605+
local numWarbandBankSlots = invConstants.NumAccountBankSlots
606+
endSlot = numBagSlots + numBankSlots + numWarbandBankSlots
607+
else
608+
-- 11.1.7 and before
609+
startSlot = BACKPACK_CONTAINER - ITEM_INVENTORY_BANK_BAG_OFFSET
610+
endSlot = NUM_TOTAL_EQUIPPED_BAG_SLOTS + NUM_BANKBAGSLOTS
611+
end
612+
613+
for bag=startSlot, endSlot do
589614
for slot=1, C_Container.GetContainerNumSlots(bag) do
590615
local itemId = C_Container.GetContainerItemID(bag, slot)
591616

0 commit comments

Comments
 (0)