From 6f726fa03d25fc2ec9ceb3af6b1c92169a1a699f Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Fri, 2 Dec 2022 19:48:07 +0100 Subject: [PATCH] Fix new tooltip code for classic clients --- .luacheckrc | 4 +++- KillTrack.lua | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index cfee5cc..265af05 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -67,7 +67,9 @@ stds.wow = { "UnitName", "UnitXP", "UnitXPMax", - "wipe" + "wipe", + "WOW_PROJECT_ID", + "WOW_PROJECT_MAINLINE" } } diff --git a/KillTrack.lua b/KillTrack.lua index 5746014..f3b249a 100644 --- a/KillTrack.lua +++ b/KillTrack.lua @@ -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 @@ -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