Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
 
 
Line 1: Line 1:
  +
== Licensing ==
<center>'''GetItemInfo''' ''-Documentation by [[user:Darjk|Darjk]]-''</center>
 
  +
{{Licensing|Item}}
   
  +
[[ru:Файл:Гербовая накидка Бездны 2.jpg]]
Return information about a specific item.
 
 
args = GetItemInfo(itemID | "itemString");
 
== Parameters ==
 
=== Arguments ===
 
:(itemID or "itemString")
 
 
:;itemID : Integer - The numeric ID of the item. ie. 12345
 
:;"itemString" : String - The full item ID in string format. ie. "item:12345:0:0:0"
 
 
=== Returns ===
 
:itemName, itemLink, itemRarity, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture
 
 
:;itemName : String - The name of the item.
 
:;itemLink : String - The item link ie. "item:12345:0:0:0".
 
:;itemRarity : Integer - The value is 0 to 6, which represents Poor to Artifact.
 
:;itemMinLeveL : Integer - The minimum level required to use the item, 0 being no level requirement.
 
:;itemType : String - The [[API TYPE itemType|type]] of the item. Armor, Weapon, Quest, Key, etc.
 
:;itemSubType : String - The [[API TYPE itemType|sub type]] of the item. Enchanting, Cloth, Sword, etc.
 
:;itemStackCount : Integer - How many of the item per stack. ie. 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc.
 
:;itemEquipLoc : String - Equip [[API TYPE itemEquipLoc|location]] of the item specified. The string contains the name a global string variable, such as "INVTYPE_HEAD", which contains the localized name of the location.
 
:;itemTexture : String - The name and path for the inventory icon texture for the item.
 
 
== Example ==
 
local sName, sLink, iQuality, iLevel, sType, sSubType, iCount = GetItemInfo(16846);
 
message(sName..","..iQuality..","..sType..","..iCount);
 
 
====Result====
 
: Message box will pop-up with - "Giantstalker's Helmet,4,Armor,1".
 
 
==Details==
 
: This function will <b>ONLY</b> 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, itemEquipLoc(until 1.9)) are localized.
 
: itemString is a subset of an item's link, not the actual link returned from functions like GetContainerItemLink()
 
 
== Common usage ==
 
 
function GetItemInfoFromItemLink(link)
 
local itemId = nil;
 
if ( type(link) == "string" ) then
 
_,_, itemId = string.find(link, "item:(%d+):");
 
end
 
if ( itemId ) then
 
return GetItemInfo(itemId);
 
end
 
end
 
 
local link = FunctionThatGetsItemLink(arg1, arg2);
 
local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture
 
= GetItemInfoFromItemLink(link);
 
-- do stuff with the info.
 
 
Most people want to know how to get the item code needed to get item information (among them, me) so I decided to add it here. [[User:Sarf|Sarf]]
 
 
----
 
__NOTOC__
 
{{Template:WoW API}}
 

Revision as of 12:54, 21 July 2011

Licensing

ru:Файл:Гербовая накидка Бездны 2.jpg