Skip to content

Commit

Permalink
Fix new tooltip code for classic clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharparam committed Dec 2, 2022
1 parent 118703c commit 6f726fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ stds.wow = {
"UnitName",
"UnitXP",
"UnitXPMax",
"wipe"
"wipe",
"WOW_PROJECT_ID",
"WOW_PROJECT_MAINLINE"
}
}

Expand Down
10 changes: 8 additions & 2 deletions KillTrack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function KT.Events.ENCOUNTER_END(self, _, _, _, size)
end
end

TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(self)
local function tooltip_enhancer(self)
if not KT.Global.TOOLTIP then return end
local _, unit = self:GetUnit()
if not unit then return end
Expand All @@ -296,7 +296,13 @@ TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(self
self:AddLine(("ID = %d"):format(id))
end
self:Show()
end)
end

if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, tooltip_enhancer)
else
GameTooltip:HookScript("OnTooltipSetUnit", tooltip_enhancer)
end

function KT:ToggleLoadMessage()
self.Global.LOAD_MESSAGE = not self.Global.LOAD_MESSAGE
Expand Down

0 comments on commit 6f726fa

Please sign in to comment.