BagID
Jump to navigation
Jump to search
BagIDs are used for accessing bags and their slots. It's recommended to use the bag constants to make future WoW patches less likely to break your code.
Values
ID | Constant | Enum | Description |
---|---|---|---|
0 | BACKPACK_CONTAINER |
Enum.BagIndex.Backpack |
The Backpack which has 16 generic slots. |
1 to 4 | BACKPACK_CONTAINER+1 toNUM_BAG_SLOTS |
Enum.BagIndex.Bag_1 to 4 |
The equipped bags on the character (from right to left). |
5 | BACKPACK_CONTAINER+NUM_BAG_SLOTS+1 |
Enum.BagIndex.ReagentBag |
The equipped reagent bag on the character |
6 to 12 | NUM_TOTAL_EQUIPPED_BAG_SLOTS+1 toNUM_TOTAL_EQUIPPED_BAG_SLOTS+NUM_BANKBAGSLOTS |
Enum.BagIndex.BankBag_1 to 7 |
The Bank bags (from left to right). |
-1 | BANK_CONTAINER |
Enum.BagIndex.Bank |
The Bank which has 28 (7*4) generic slots. |
-2 | KEYRING_CONTAINER |
Enum.BagIndex.Keyring |
The Keyring was removed in 4.2.0 but the constant still exists. |
-3 | REAGENTBANK_CONTAINER |
Enum.BagIndex.Reagentbank |
The Reagent Bank which has 98 (14*7) generic slots. |
-4 | n/a | Enum.BagIndex.Bankbag |
A seven slots "bag" that holds the bank bags themselves. |
Warning: Classic Era uses the same values as Retail, yet BankBag_1
to 6 should be 5-10, so relying on these enums for that game type will result in incorrect behaviour.
Example
Prints all items in your character bags.
for bag = BACKPACK_CONTAINER, NUM_TOTAL_EQUIPPED_BAG_SLOTS do
for slot = 1, C_Container.GetContainerNumSlots(bag) do
local itemLink = C_Container.GetContainerItemLink(bag, slot)
if itemLink then
print(bag, slot, itemLink)
end
end
end
0, 1, "[Red Winter Hat]"
0, 2, "[Red Winter Clothes]"
0, 3, "[Winter Boots]"
0, 9, "[Hearthstone]"
0, 19, "[Snowball]"
0, 20, "[Weighted Jack-o'-Lantern]"
1, 1, "[Celebration Wand - Trogg]"
1, 7, "[Dartol's Rod of Transformation]"
See also
- Related APIs: WhatLinksHere
- GetContainerNumSlots()
- GetContainerItemInfo()
Patch changes
- Patch 10.0.2 (2022-11-15): Added
Enum.BagIndex