WoW:API GetItemInfo: Difference between revisions

no edit summary
mNo edit summary
No edit summary
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 ex: "|cFFFFFFFF|Hitem:12345:0:0:0|h[Item Name]|h|r")
:;itemQuality : 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.
:;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 being 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.
Line 40: Line 41:
== Common usage ==
== Common usage ==


<b>Note:</b> It is no longer necessary to take the item ID out of the link to use it with GetItemInfo since patch 2.0
function GetItemInfoFromItemLink(link)
  local itemId = nil;
  if ( type(link) == "string" ) then
    _,_, itemId = string.find(link, "item:(%d+):");
    if(itemId) then
      return GetItemInfo(itemId);
    end
  end
end
  local link = FunctionThatGetsItemLink(arg1, arg2);
  local link = FunctionThatGetsItemLink(arg1, arg2);
  local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture  
  local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture  
   = GetItemInfoFromItemLink(link);
   = GetItemInfo(link);


The above function will work with [[itemString]]s as well as [[itemLink]]s.
This will work both with [[itemString]]s as well as [[itemLink]]s.
Anonymous user