BagID
Jump to navigation
Jump to search
BagIDs are used for accessing bags and their slots. It's recommended to use the container constants to make future WoW patches less likely to break your code.
Values
ID | Constants | Enum | Description |
---|---|---|---|
0 | BACKPACK_CONTAINER |
Enum.BagIndex.Backpack |
The backpack, which has 16-28 item slots. |
1 to 4 | BACKPACK_CONTAINER :+1 to +NUM_BAG_SLOTS |
Enum.BagIndex.Bag_1 to Bag_4 |
The equipped bags on the character (from right to left). |
5 ![]() |
BACKPACK_CONTAINER+NUM_BAG_SLOTS :+1 to +NUM_REAGENTBAG_SLOTS |
Enum.BagIndex.ReagentBag |
The equipped reagent bag on the character |
6 to 12, 5 to 11 ![]() 5 to 10 ![]() |
BACKPACK_CONTAINER+ITEM_INVENTORY_BANK_BAG_OFFSET :+1 to +NUM_BANKBAGSLOTS |
Enum.BagIndex.BankBag_1 to BankBag_7 ,Enum.BagIndex.BankBag_1 to BankBag_6 ![]() |
The bank bags (from left to right). |
13 to 17 ![]() |
BACKPACK_CONTAINER+ITEM_INVENTORY_BANK_BAG_OFFSET+NUM_BANKBAGSLOTS :+1 to +5 |
Enum.BagIndex.AccountBankTab_1 to AccountBankTab_5 |
The warbank tab "bags", which have 98 (14*7) item slots each. |
-1 | BANK_CONTAINER |
Enum.BagIndex.Bank |
The bank, which has 28 (7*4) item slots, or 24 (6*4) item slots in ![]() |
-2 ![]() |
KEYRING_CONTAINER |
Enum.BagIndex.Keyring |
The keyring, which has 32 key item slots. |
-3 ![]() |
REAGENTBANK_CONTAINER |
Enum.BagIndex.Reagentbank |
The reagent bank, which has 98 (14*7) reagent item slots. |
-4 | N/A | Enum.BagIndex.Bankbag |
A bank bag container with 7 bag item slots, or 6 bag item slots in ![]() |
-5 ![]() |
N/A | Enum.BagIndex.Accountbanktab |
A warbank tab container with 5 "bag" item slots. |
Warning:
Mists of Pandaria Classic and
Classic Era incorrectly use the same enum values for
BankBag_1
to BankBag_7
as Retail, so relying on these enums for those game types 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
- GetBagName()
- GetContainerNumSlots()
- GetContainerItemInfo()
Patch changes
Patch 10.0.2 (2022-11-15): Added
Enum.BagIndex