Quantcast
WoWInterface - View Single Post - Hyperlink Tooltip Change
View Single Post
05-17-21, 02:48 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 815
Perhaps you can take a look at OnHyperlinkEnter, OnHyperlinkLeave?


Lua Code:
  1. local function chatHoverIn(cf, link, text)
  2.     local typ = string.match(link, "^(.-):")
  3. --[[    print(typ,link)
  4.     local tbl = { strsplit(":", link) }
  5.     for k,v in pairs(tbl) do
  6.         print(v)
  7.     end
  8. ]]--
  9.     if(typ == "item" or typ == "enchant" or typ == "spell" or typ == "quest" or typ == "currency") then
  10.         GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR")
  11.         GameTooltip:SetHyperlink(link)
  12.         ShowUIPanel(GameTooltip)
  13.     elseif(typ == "player") then
  14.         local typ, name = string.match(link, "^(.-):(.*):(.*):")
  15.         if(name) then
  16.             GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR")
  17.             GameTooltip:SetUnit(name)
  18.             ShowUIPanel(GameTooltip)
  19.         end    
  20.     end
  21. end
  22. local function chatHoverOut(cf, link, text)
  23.     HideUIPanel(GameTooltip)
  24. end
  25.  
  26. for i = 1, NUM_CHAT_WINDOWS do
  27.     local cfn = format('ChatFrame%i',i)
  28.     local cf = _G[cfn]
  29.  
  30.     cf:HookScript("OnHyperlinkEnter",chatHoverIn)
  31.     cf:HookScript("OnHyperlinkLeave",chatHoverOut)
  32. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote