From 8f1e2166b1670207397a653df17913261d497936 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Fri, 16 Jan 2026 09:35:29 -0500 Subject: [PATCH] fix false immunities --- Compatibility/pfUI.lua | 9 ++++---- Extensions/Mouseover/GameTooltip.lua | 31 ++++++++++++++++++++++++++++ Utility.lua | 18 +++++++++++++++- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Compatibility/pfUI.lua b/Compatibility/pfUI.lua index 82ea2b7..4d478a9 100644 --- a/Compatibility/pfUI.lua +++ b/Compatibility/pfUI.lua @@ -597,8 +597,9 @@ function Extension.OnLoad() end function Extension.ADDON_LOADED() - -- Check if pfUI just loaded - if arg1 == "pfUI" then + -- Check if pfUI just loaded AND the global actually exists + -- (another addon could be named "pfUI" without being the real UI framework) + if arg1 == "pfUI" and pfUI then Extension.pfUILoaded = true -- pfUI modules load after ADDON_LOADED, so schedule a check if CleveRoids.ScheduleTimer then @@ -613,8 +614,8 @@ function Extension.PLAYER_LOGIN() -- Final check after everything is loaded Extension.SetupCompatibility() - -- Print startup status - if Extension.pfUILoaded then + -- Print startup status only if pfUI global exists and compatibility was set up + if Extension.pfUILoaded and pfUI then DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[SCRM]|r pfUI compatibility loaded. Use /pfuicd for debug.") if not Extension.actionHandlerRegistered then DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[SCRM]|r WARNING: pfUI action handler NOT registered!") diff --git a/Extensions/Mouseover/GameTooltip.lua b/Extensions/Mouseover/GameTooltip.lua index b2e9862..2ea70ae 100644 --- a/Extensions/Mouseover/GameTooltip.lua +++ b/Extensions/Mouseover/GameTooltip.lua @@ -37,11 +37,42 @@ function Extension.UPDATE_MOUSEOVER_UNIT() end end +-- Clear mouseover when tooltip is set to a non-unit (spell, item, action, etc.) +-- This prevents TurtleRP from showing stale RP profile info for spells/items. +-- TurtleRP hooks GameTooltip:OnShow and checks UnitIsPlayer("mouseover") - +-- if that returns true (from a stale unit frame hover), it overwrites the tooltip. +-- By clearing mouseover when non-unit tooltips are shown, we prevent this. +function Extension.OnNonUnitTooltip() + -- Clear the tooltip source (lowest priority fallback) + CleveRoids.ClearMouseoverFrom("tooltip") + + -- Also explicitly clear the game's mouseover to ensure UnitIsPlayer returns false. + -- This is defensive - the main fix is in Utility.lua:apply() using "" instead of nil. + if CleveRoids.hasSuperwow and _G.SetMouseoverUnit then + CleveRoids.__mo.selfTriggered = true + _G.SetMouseoverUnit("") + end +end + function Extension.OnLoad() Extension.HookMethod(_G["GameTooltip"], "SetUnit", "SetUnit") Extension.HookMethod(_G["GameTooltip"], "Hide", "OnClose") Extension.HookMethod(_G["GameTooltip"], "FadeOut", "OnClose") Extension.RegisterEvent("UPDATE_MOUSEOVER_UNIT", "UPDATE_MOUSEOVER_UNIT") + + -- Hook non-unit tooltip methods to clear stale mouseover state. + -- This prevents TurtleRP from showing RP profiles for spells/items. + Extension.HookMethod(_G["GameTooltip"], "SetSpell", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetBagItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetInventoryItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetAction", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetQuestLogItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetLootItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetMerchantItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetCraftItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetTradeSkillItem", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetTrainerService", "OnNonUnitTooltip") + Extension.HookMethod(_G["GameTooltip"], "SetHyperlink", "OnNonUnitTooltip") end _G["CleveRoids"] = CleveRoids diff --git a/Utility.lua b/Utility.lua index 06beb67..c595637 100644 --- a/Utility.lua +++ b/Utility.lua @@ -331,7 +331,10 @@ do if CleveRoids.hasSuperwow and _G.SetMouseoverUnit then -- Set flag so UPDATE_MOUSEOVER_UNIT handler knows we triggered this CleveRoids.__mo.selfTriggered = true - _G.SetMouseoverUnit(unit) + -- Use empty string instead of nil to properly clear mouseover. + -- SetMouseoverUnit(nil) doesn't properly clear the game's internal state, + -- causing UnitIsPlayer("mouseover") to return stale data (TurtleRP bug). + _G.SetMouseoverUnit(unit or "") else CleveRoids.mouseoverUnit = unit end @@ -2502,6 +2505,19 @@ delayedTrackingFrame:SetScript("OnUpdate", function() end end end + elseif not UnitExists(pending.targetGUID) then + -- Target despawned or GUID is invalid - can't verify, skip without recording immunity + -- This is similar to one-shot kills: inconclusive result, don't record immunity + bleedVerified = false + if debug then + local spellNameDebug = _SpellInfo(pending.spellID) or "Bleed" + DEFAULT_CHAT_FRAME:AddMessage( + _string_format("|cffaaaaaa[Bleed Skip]|r %s on %s - target no longer exists (despawned), can't determine immunity", + spellNameDebug, pending.targetName or "Unknown") + ) + end + -- Note: We set bleedVerified = false but DON'T record immunity + -- This is intentional - despawned targets are inconclusive else -- Target is alive - check debuffs by GUID (SuperWoW supports GUID-based queries) bleedVerified = false