Hello there! We are conducting a survey to better understand the user experience in making a first edit. If you have ever made an edit on Gamepedia, please fill out the survey. Thank you!

API GetItemInfo

From Wowpedia
Jump to: navigation, search

Return information about a specific item.

itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,
itemEquipLoc, itemIcon, itemSellPrice, itemClassID, itemSubClassID, bindType, expacID, itemSetID, 
isCraftingReagent = GetItemInfo(itemID or "itemString" or "itemName" or "itemLink") 

Arguments

One of the following four ways to specify which item to query:

itemId 
Number - Numeric ID of the item. e.g. 30234 for  [Nordrassil Wrath-Kilt]
itemName 
String - Name of an item owned by the player at some point during this play session, e.g. "Nordrassil Wrath-Kilt".
itemString 
String - A fragment of the itemString for the item, e.g. "item:30234:0:0:0:0:0:0:0" or "item:30234".
itemLink 
String - The full itemLink.

Returns

1. itemName
String - The localized name of the item.
2. itemLink
String - The localized item link of the item.
3. itemRarity
Number - The quality of the item. The value is 0 to 7, which represents Poor to Heirloom. This appears to include gains from upgrades/bonuses.
4. itemLevel
Number - The base item level of this item, not including item levels gained from upgrades. Use GetDetailedItemLevelInfo to get the actual current level of the item.
5. itemMinLevel
Number - The minimum level required to use the item, 0 meaning no level requirement.
6. itemType
String - The localized type of the item: Armor, Weapon, Quest, Key, etc.
7. itemSubType
String - The localized sub-type of the item: Enchanting, Cloth, Sword, etc. See itemType.
8. itemStackCount
Number - How many of the item per stack: 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc.
9. itemEquipLoc
String - The type of inventory equipment location in which the item may be equipped, or "" if it can't be equippable. The string returned is also the name of a global string variable e.g. if "INVTYPE_WEAPONMAINHAND" is returned, _G["INVTYPE_WEAPONMAINHAND"] will be the localized, displayable name of the location.
10. itemIcon
Number (fileID) - The icon texture for the item.
11. itemSellPrice
Number - The price, in copper, a vendor is willing to pay for this item, 0 for items that cannot be sold.
12. itemClassID
Number - This is the numerical value that determines the string to display for 'itemType'.
13. itemSubClassID
Number - This is the numerical value that determines the string to display for 'itemSubType'
14. bindType
Number - Item binding type: 0 - none; 1 - on pickup; 2 - on equip; 3 - on use; 4 - quest.
15. expacID
Number - ?
16. itemSetID
Number - ?
17. isCraftingReagent
Boolean - ?

Details

  • If the item hasn't been encountered since the game client was last started, this function will initially return nil, but will asynchronously query the server to obtain the missing data, triggering GET_ITEM_INFO_RECEIVED when the information is available.
  • ItemMixin:ContinueOnItemLoad() provides a convenient callback once item data has been queried:
local item = Item:CreateFromItemID(itemID)
item:ContinueOnItemLoad(function()
	print(item:GetItemLink())
	--local _, itemLink = GetItemInfo(itemID)
	--print(itemLink)
end)

Patch changes

  • Legion Patch 7.1.0 (2016-10-25): Added bindType, expacID, itemSetID, and isCraftingReagent.
  • Legion Patch 7.0.3 (2016-07-19): Item icon is now returned as a fileID rather than a path. Additionally, two new returns were added: itemClassID and itemSubClassID.

See Also