Wowpedia
Advertisement

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 Description
0 BACKPACK_CONTAINER The Backpack which has 16 generic slots.
1 to 4 BACKPACK_CONTAINER+1 to
NUM_BAG_SLOTS
The equipped bags on the character (from right to left).
5 to 11 NUM_BAG_SLOTS+1to
NUM_BAG_SLOTS+NUM_BANKBAGSLOTS
The Bank bags (from left to right).
-1 BANK_CONTAINER The Bank which has 28 (7*4) generic slots.
-2 KEYRING_CONTAINER The Keyring was removed in 4.2.0 but the constant still exists. On retail this "bag" holds the InventorySlotIds instead.
-3 REAGENTBANK_CONTAINER The Reagent Bank which has 98 (14*7) generic slots.
-4 n/a A seven slots "bag" that holds the bank bags themselves.

Example

Slots start at the topleft of each bag.

Prints all items in your character bags.

for bag = BACKPACK_CONTAINER, NUM_BAG_SLOTS do
	for slot = 1, GetContainerNumSlots(bag) do
		local itemLink = 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

Advertisement