From 1f3991d004d2d05d7118d96194091eee46f0ed7f Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Thu, 19 Feb 2026 18:04:23 +0100 Subject: [PATCH] fix for swing timer. - Fixed swing timer hiding when you switched the target or had no target. Timer now always runs out showing you when the next swing is available even if you swap targets. --- modules/swingtimer.lua | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/swingtimer.lua b/modules/swingtimer.lua index f3e3bdd7..37b2811a 100644 --- a/modules/swingtimer.lua +++ b/modules/swingtimer.lua @@ -266,7 +266,9 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function () end if not anyActive then - this:Hide() + if not pfUI.swingtimer.mainhand:IsShown() and not pfUI.swingtimer.offhand:IsShown() then + this:Hide() + end end end) @@ -277,7 +279,6 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function () events:RegisterEvent("UNIT_INVENTORY_CHANGED") events:RegisterEvent("PLAYER_REGEN_DISABLED") events:RegisterEvent("PLAYER_REGEN_ENABLED") - events:RegisterEvent("PLAYER_TARGET_CHANGED") events:RegisterEvent("ACTIONBAR_SLOT_CHANGED") events:RegisterEvent("UNIT_DIED") events:RegisterEvent("SPELL_QUEUE_EVENT") @@ -335,7 +336,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function () elseif event == "PLAYER_ENTERING_WORLD" then local _, class = UnitClass("player") isWarrior = (class == "WARRIOR") - playerGUID = UnitGUID and UnitGUID("player") or nil + playerGUID = UnitExists("player") UpdateWeaponSpeeds() RebuildQueueSlotCache() @@ -358,16 +359,11 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function () hsQueued = false cleaveQueued = false - elseif event == "PLAYER_TARGET_CHANGED" then - if not UnitExists("target") or UnitIsDead("target") then - ResetSwingTimers() - end - elseif event == "UNIT_DIED" then + -- Only reset if the player themselves died local guid = arg1 if not guid then return end - local targetGUID = UnitExists("target") and UnitGUID and UnitGUID("target") or nil - if guid == targetGUID or guid == playerGUID then + if guid == playerGUID then ResetSwingTimers() end end