View Single Post
10-09-22, 10:07 AM   #11
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Lua Code:
  1. local function ResetItem2(tooltip)
  2.     print("ResetItem")
  3. end
  4.  
  5. local function SetItem2(tooltip)
  6.     local tooltipData = tooltip:GetTooltipData()
  7.     if(tooltipData and tooltipData.id and tooltipData.type == 0) then -- type -> 0 = item, 1 = spell
  8.         print("SetItem", tooltipData.type, tooltipData.id)
  9.         tooltip:AddLine('Test')
  10.         GameTooltip_CalculatePadding(tooltip)
  11.     end
  12. end
  13.  
  14. hooksecurefunc(GameTooltip, "Show",SetItem2)
  15. hooksecurefunc(GameTooltip, "Hide",ResetItem2)
  16. --GameTooltip:HookScript("OnShow", SetItem2)
  17. --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
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote