View Single Post
03-01-21, 09:37 AM   #7
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
When you find a better way let me know I try to have my own damagemeter and tracking the owner is difficult ... I use this monster ... (stolen from different sources)

Lua Code:
  1. local addonName, addon = ...
  2. local scanTipName = format("%s_ScanTooltip", addonName)
  3. local scanTipText = format("%sTextLeft2", scanTipName)
  4. local scanTip = CreateFrame("GameTooltip", scanTipName, WorldFrame, "GameTooltipTemplate")
  5. local scanTipTitles = {}
  6. for i = 1, 48 do
  7.     scanTipTitles[#scanTipTitles + 1] = _G[format("UNITNAME_SUMMON_TITLE%i",i)]
  8. end
  9. local function scanTooltip(guid)
  10.     local text = _G[scanTipText]
  11.     if(guid and text) then
  12.         scanTip:SetOwner( WorldFrame, "ANCHOR_NONE" )
  13.         scanTip:SetHyperlink(format('unit:%s',guid))
  14.         local text2 = text:GetText()
  15.         if(text2) then
  16.             for i = 1, #scanTipTitles do
  17.                 local check = scanTipTitles[i]:gsub("%%s", "(.+)"):gsub("[%[%]]", "%%%1")
  18.                 local a,b,c = string.find(text2, check)
  19.                 if(c) then
  20.                     local g = UnitGUID(c)
  21.                     if(g) then
  22.                         return g
  23.                     end
  24.                 end
  25.             end
  26.         end
  27.     end
  28. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote