|
583 | 583 | function Simulationcraft:GetBagItemStrings(debugOutput)
|
584 | 584 | local bagItems = {}
|
585 | 585 |
|
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 |
589 | 614 | for slot=1, C_Container.GetContainerNumSlots(bag) do
|
590 | 615 | local itemId = C_Container.GetContainerItemID(bag, slot)
|
591 | 616 |
|
|
0 commit comments