Lua Code:
local function ResetItem2(tooltip)
print("ResetItem")
end
local function SetItem2(tooltip)
local tooltipData = tooltip:GetTooltipData()
if(tooltipData and tooltipData.id and tooltipData.type == 0) then -- type -> 0 = item, 1 = spell
print("SetItem", tooltipData.type, tooltipData.id)
tooltip:AddLine('Test')
GameTooltip_CalculatePadding(tooltip)
end
end
hooksecurefunc(GameTooltip, "Show",SetItem2)
hooksecurefunc(GameTooltip, "Hide",ResetItem2)
--GameTooltip:HookScript("OnShow", SetItem2)
--GameTooltip:HookScript("OnHide", ResetItem2)
I'm looking into this, too because of my items addon. I can change the tooltip and add a line. With hooksecure my function is called multiple times a second and the line is added 1-3 times for a tooltip (3 times when I hover over one of the bags in the bagbar, 2 times mostly for items). With HookScript its called only once but the tooltip is changed back after my line shows up for a split second. Not so promising
I really hope someone has a good guide how this is meant to work in the future