View Single Post
03-21-13, 02:39 AM   #30
fRodzet
A Flamescale Wyrmkin
Join Date: Mar 2013
Posts: 114
Lua Code:
  1. local function ChatlinkTooltips_SetOrHookHandler(frame, event, func)
  2.     frame:HookScript(event, func) -- Sets & Hooks the script
  3. end

Worked like a charm, ty However:

Lua Code:
  1. local linkType = strmatch(linkData, "|H(.-):")

doesn't seem to work.. and i don't quiet get, why it "should" work either?

string.split(":", linkData) makes also way more sense in my head :P Here is my code so far:

Lua Code:
  1. local supportedType = {
  2. spell = true,
  3. item = true,
  4. quest = true,
  5. achievement = true,
  6. talent = true,
  7. glyph = true,
  8. unit = true,
  9. enchant = true
  10. }
  11.  
  12. local function ChatlinkTooltips_ShowTip(self, linkData)
  13.     local linkType = string.split(":", linkData)
  14.     if supportedType[linkType] then
  15.         GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
  16.         GameTooltip:SetHyperlink(linkData)
  17.         GameTooltip:Show()
  18.     end
  19. end
  20.  
  21. local function ChatlinkTooltips_HideTip()
  22.     GameTooltip:Hide()
  23. end
  24.  
  25. local function ChatlinkTooltips_HookHandler(frame, event, func)
  26.     frame:HookScript(event, func) -- Sets & Hooks the script
  27. end
  28.  
  29.     for i = 1, NUM_CHAT_WINDOWS do
  30.     local frame = _G["ChatFrame" .. i] -- Copy a reference
  31.         ChatlinkTooltips_HookHandler(frame, "OnHyperLinkEnter", ChatlinkTooltips_ShowTip)
  32.         ChatlinkTooltips_HookHandler(frame, "OnHyperLinkLeave", ChatlinkTooltips_HideTip)
  33. end

Last edited by fRodzet : 03-21-13 at 02:56 AM.
  Reply With Quote