View Single Post
07-05-17, 04:22 AM   #1
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Custom tooltip text not displaying for Tradeskill window items I don't possess

Hi,

I use the following code to display the "item level" of an item (all items except armor and weapon) next to its name. Ex: "Heavy Kodo Stew (35)".

Lua Code:
  1. local function Add_Item_Level(tooltip)
  2.     local item = tooltip:GetItem()
  3.    
  4.     if item ~= nil then
  5.         local itemLevel = select(4, GetItemInfo(item))
  6.         local itemType = select(6, GetItemInfo(item))
  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)

When I open a profession window (e.g. Blacksmithing) and bring the cursor over a resulting item, the item level is displayed only for items that I posses. For example, I have Dense Grinding Stone, its item level is displayed:

http://imgur.com/kTrxxbP

On the other hand, I don't have Heavy Grinding Stone, its item level is not displayed:

http://imgur.com/8GwaR95

Any ideas why it is not displaying on items I don't have, and how to make it display?

Thanks.
  Reply With Quote