View Single Post
07-06-17, 01:39 AM   #3
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Originally Posted by Lombra View Post
First return from tooltip:GetItem() is the item name, which only works with GetItemInfo if you have the item in question. Use the second return, item link, instead.
Thank you very much! I modified it like the following and it displays the item level for items I don't have too.

Lua Code:
  1. local function Add_Item_Level(tooltip)
  2.     local itemLink = select(2, tooltip:GetItem())
  3.    
  4.     if itemLink ~= nil then
  5.         local itemLevel = select(4, GetItemInfo(itemLink))
  6.         local itemType = select(6, GetItemInfo(itemLink))
  7.  
  8.         if itemType ~= "Armor" and itemType ~= "Weapon" and itemLevel ~= nil then
  9.             tooltip:AppendText(" |cffffd100("..itemLevel..")")
  10.         end
  11.     end
  12. end
  13.  
  14. GameTooltip:HookScript("OnTooltipSetItem", Add_Item_Level)

Last edited by Eommus : 07-06-17 at 01:42 AM.
  Reply With Quote