Hi,
Some years ago, I used the following to display the item level on an item's tooltip (except armor and weapons and those already had item level info). But it seems it no longer works. I've been away from WoW and LUA coding for a long time, and I will appreciate any pointers to fix my code below.
Thanks!
Lua Code:
local function Add_Item_Level(tooltip)
local itemLink = select(2, tooltip:GetItem())
if itemLink ~= nil then
local itemLevel = select(4, GetItemInfo(itemLink))
local itemType = select(6, GetItemInfo(itemLink))
if itemType ~= "Armor" and itemType ~= "Weapon" and itemLevel ~= nil then
tooltip:AppendText(" |cffffd100("..itemLevel..")")
end
end
end
GameTooltip:HookScript("OnTooltipSetItem", Add_Item_Level)
EDIT 1: I learned that the API was changed. Replacing the last line with the following fixed it.
Lua Code:
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, Add_Item_Level)
EDIT 2: But it now gives the following error for comparison item tooltips:
Lua Code:
main.lua:2: attempt to call method 'GetItem' (a nil value)
I guess GetItem() was also removed but no idea what to use instead.