WoW:API GetItemInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(updated itemString argument description to mention that partial itemStrings are supported, as well)
m (Mentioned that an unequippable item returns "" for itemEquipLoc.)
Line 18: Line 18:


:;itemName : String - The name of the item.
:;itemName : String - The name of the item.
:;[[itemLink]] : String - The item Link; you will see the clickable Link instead of the string. (String ex: "|cFFFFFFFF|Hitem:12345:0:0:0|h[Item Name]|h|r")
:;[[itemLink]] : String - The item Link; you will see the clickable Link instead of the string. (String, such as: "|cFFFFFFFF|Hitem:12345:0:0:0|h[Item Name]|h|r")
:;itemRarity : Integer - The [[API TYPE Quality|quality]] of the item.  The value is 0 to 6, which represents Poor to Artifact.
:;itemRarity : Integer - The [[API TYPE Quality|quality]] of the item.  The value is 0 to 6, which represents Poor to Artifact.
:;itemLevel : Integer - The item level of this item.
:;itemLevel : Integer - The item level of this item.
:;itemMinLevel : Integer - The minimum level required to use the item, 0 being no level requirement.
:;itemMinLevel : Integer - The minimum level required to use the item, 0 meaning no level requirement.
:;[[itemType]] : String - The type of the item. Armor, Weapon, Quest, Key, etc.
:;[[itemType]] : String - The type of the item: Armor, Weapon, Quest, Key, etc.
:;itemSubType : String - The sub type of the item. Enchanting, Cloth, Sword, etc. See [[itemType]].
:;itemSubType : String - The sub-type of the item: Enchanting, Cloth, Sword, etc. See [[itemType]].
:;itemStackCount : Integer - How many of the item per stack. ie. 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc.
:;itemStackCount : Integer - How many of the item per stack: 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc.
:;[[itemEquipLoc]] : String - Where the item may be equipped, if it can. The string returned is also the name of a global string variable, i.e. for "INVTYPE_HEAD" there is a INVTYPE_HEAD variable containing a localized, displayable name of the location.
:;[[itemEquipLoc]] : String - Where the item may be equipped, if it can. If not equippable, this is an empty string, "". The string returned is also the name of a global string variable, i.e. for "INVTYPE_HEAD" there is a INVTYPE_HEAD variable containing a localized, displayable name of the location.
:;itemTexture : String - The name and path for the inventory icon texture for the item.
:;itemTexture : String - The name and path for the inventory icon texture for the item.



Revision as of 21:18, 23 June 2007

WoW API < GetItemInfo

Return information about a specific item.

itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,
itemEquipLoc, itemTexture = GetItemInfo(itemID or "itemString" or "itemName" or "itemLink") 

Parameters

Arguments

(itemId or "itemString" or itemName or "itemLink")
itemId
Integer - The numeric ID of the item. ie. 12345
"itemString"
String - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
itemName
String - The Name of the Item, ex: "Hearthstone" (the item must be equiped or in your Inventory for this to work).
"itemLink"
String - The itemLink, when Shift-Clicking items.

Returns

itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, invTexture
itemName
String - The name of the item.
itemLink
String - The item Link; you will see the clickable Link instead of the string. (String, such as: "|cFFFFFFFF|Hitem:12345:0:0:0|h[Item Name]|h|r")
itemRarity
Integer - The quality of the item. The value is 0 to 6, which represents Poor to Artifact.
itemLevel
Integer - The item level of this item.
itemMinLevel
Integer - The minimum level required to use the item, 0 meaning no level requirement.
itemType
String - The type of the item: Armor, Weapon, Quest, Key, etc.
itemSubType
String - The sub-type of the item: Enchanting, Cloth, Sword, etc. See itemType.
itemStackCount
Integer - How many of the item per stack: 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc.
itemEquipLoc
String - Where the item may be equipped, if it can. If not equippable, this is an empty string, "". The string returned is also the name of a global string variable, i.e. for "INVTYPE_HEAD" there is a INVTYPE_HEAD variable containing a localized, displayable name of the location.
itemTexture
String - The name and path for the inventory icon texture for the item.

Example

local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(16846);
message(sName..","..iRarity..","..sType..","..iStackCount);

Result

Message box will pop-up with - "Giantstalker's Helmet,4,Armor,1".

Details

This function will ONLY retrieve data that is in your local cache.
If you have never seen the item that belongs to the Item ID or Item Link it will return nil.
All string returns (itemName, itemType, itemSubType) are localized. Prior to 1.9, itemEquipLoc was localized also.

Common usage

local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture = GetItemInfo(link)