Quantcast
WoWInterface - View Single Post - New Item API
Thread: New Item API
View Single Post
10-22-18, 04:09 AM   #12
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
You can parse the item level out of the tooltip, that is accurate. That's what we're all doing at this point.

Lua Code:
  1. function mnkDurability.GetItemLevel(slotID)
  2.     local tip = CreateFrame("GameTooltip", "scanTip", UIParent, "GameTooltipTemplate")
  3.     tip:ClearLines()
  4.     tip:SetOwner(UIParent,"ANCHOR_NONE")
  5.     tip:SetInventoryItem("player", slotID)
  6.     for i=1, 5 do
  7.         local l = _G["scanTipTextLeft"..i]:GetText()
  8.         if l and l:find('Item Level') then
  9.             local _, i = string.find(l, 'Item Level%s%d')
  10.             -- check for boosted levels ie Chromeie scenarios.
  11.             local _, x = string.find(l, " (", 1, true)
  12.             --print(t, ' ', x)
  13.             if x then
  14.                 return string.sub(l, i, x-2) or '-'
  15.             end
  16.             return string.sub(l, i) or -'-'            
  17.         end
  18.     end
  19.  
  20.     return '-'
  21. end
  Reply With Quote