itemFamily

From Warcraft Wiki
Jump to navigation Jump to search

These are defined in ItemBagFamily.db2

Red exclamation mark iconThe bitfields as returned from APIs like GetItemFamily() should be interpreted as 2^(ID-1)
ID Flag Flavor Family Bag
0 0x0 NONE
1 0x1 (1) WoW Icon update.png Arrows Quiver
2 0x2 (2) WoW Icon update.png Bullets Ammo Pouch
3 0x4 (4) WoW Icon update.png Soul Shards Soul Bag
4 0x8 (8) Leatherworking Supplies Leatherworking Bag
5 0x10 (16) Inscription Supplies Inscription Bag
6 0x20 (32) Herbs Herb Bag
7 0x40 (64) Enchanting Supplies Enchanting Bag
8 0x80 (128) Engineering Supplies Engineering Bag
9 0x100 (256) WoW Icon update.png Keys Keyring
10 0x200 (512) Gems Gem Bag
11 0x400 (1024) Mining Supplies Mining Bag
12 0x800 Soulbound Equipment
13 0x1000 WoW Icon update.png Vanity Pets
14 0x2000 WoW Icon update.png Currency Tokens
15 0x4000 WoW Icon update.png Quest Items
16 0x8000 Fishing Supplies Tackle Box
17 0x10000 Cooking Supplies Cooking Bag
20 0x80000 Toys
21 0x100000 Archaeology
22 0x200000 Alchemy
23 0x400000 Blacksmithing
24 0x800000 First Aid
25 0x1000000 Jewelcrafting
26 0x2000000 Skinning
27 0x4000000 Tailoring

Example

local itemFamilyIDs = {
	[1] = "Arrows",
	[2] = "Bullets",
	[3] = "Soul Shards",
	[4] = "Leatherworking Supplies",
	[5] = "Inscription Supplies",
	[6] = "Herbs",
	[7] = "Enchanting Supplies",
	[8] = "Engineering Supplies",
	[9] = "Keys",
	[10] = "Gems",
	[11] = "Mining Supplies",
	[12] = "Soulbound Equipment",
	[13] = "Vanity Pets",
	[14] = "Currency Tokens",
	[15] = "Quest Items",
	[16] = "Fishing Supplies",
	[17] = "Cooking Supplies",
	[20] = "Toys",
	[21] = "Archaeology",
	[22] = "Alchemy",
	[23] = "Blacksmithing",
	[24] = "First Aid",
	[25] = "Jewelcrafting",
	[26] = "Skinning",
	[27] = "Tailoring",
}

local itemFamilyFlags = {}
for k, v in pairs(itemFamilyIDs) do
	itemFamilyFlags[2^(k-1)] = v
end

local function PrintItemFamily(item)
	local bagType = GetItemFamily(item)
	print(format("0x%X", bagType))
	for k, v in pairs(itemFamilyFlags) do
		if bit.band(bagType, k) > 0 then
			print(format("0x%X, %s", k, v))
		end
	end
end
PrintItemFamily(22786) -- Dreaming Glory
-- 0x200020
-- 0x20, Herbs
-- 0x200000, Alchemy

PrintItemFamily(190395) -- Serevite Ore
-- 0x1400480
-- 0x80, Engineering Supplies
-- 0x400, Mining Supplies
-- 0x400000, Blacksmithing
-- 0x1000000, Jewelcrafting

PrintItemFamily(37700) -- Crystallized Air
-- 0x4004C8
-- 0x8, Leatherworking Supplies
-- 0x40, Enchanting Supplies
-- 0x80, Engineering Supplies
-- 0x400, Mining Supplies
-- 0x400000, Blacksmithing

PrintItemFamily(38347) -- Mammoth Mining Bag
-- 0x400
-- 0x400, Mining Supplies

Details

  • To simply check if an item is a bag, with itemEquipLoc.
select(9, GetItemInfo(item)) == "INVTYPE_BAG"
  • Checking if an item is a specific type of bag, with item subclassID.
select(13, GetItemInfo(item)) == 4 -- Engineering Bag

See also