From d9e74b3bc5f2f6b4ebaee5c5562d175b436411bb Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sun, 25 Oct 2026 20:24:12 -0500 Subject: [PATCH] Add per-frame reverse toggle for cooldown sweeps --- api/config.lua | 5 +++++ api/unitframes.lua | 3 +++ modules/actionbar.lua | 1 + modules/bags.lua | 2 ++ modules/cooldown.lua | 6 ++++++ modules/gui.lua | 5 +++++ modules/nameplates.lua | 7 ++++++- modules/totems.lua | 1 + 8 files changed, 29 insertions(+), 1 deletion(-) diff --git a/api/config.lua b/api/config.lua index fa70743b..d2e5536a 100644 --- a/api/config.lua +++ b/api/config.lua @@ -174,6 +174,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("appearance", "bags", "abovechat", "0") pfUI:UpdateConfig("appearance", "bags", "hidechat", "0") pfUI:UpdateConfig("appearance", "bags", "icon_size", "-1") + pfUI:UpdateConfig("appearance", "bags", "cooldown_reverse", "0") pfUI:UpdateConfig("appearance", "bags", "bagrowlength", "10") pfUI:UpdateConfig("appearance", "bags", "bankrowlength", "10") pfUI:UpdateConfig("appearance", "bags", "autoSortOnOpen", "0") @@ -516,6 +517,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", unit, "pspace", "-3") pfUI:UpdateConfig("unitframes", unit, "cooldown_text", "1") pfUI:UpdateConfig("unitframes", unit, "cooldown_anim", "0") + pfUI:UpdateConfig("unitframes", unit, "cooldown_reverse", "1") pfUI:UpdateConfig("unitframes", unit, "buffs", "TOPLEFT") pfUI:UpdateConfig("unitframes", unit, "buffsize", "20") pfUI:UpdateConfig("unitframes", unit, "bufflimit", "32") @@ -682,6 +684,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("bars", nil, "bind_size", "8") pfUI:UpdateConfig("bars", nil, "bind_color", "1,1,0,1") pfUI:UpdateConfig("bars", nil, "cd_size", "12") + pfUI:UpdateConfig("bars", nil, "cooldown_reverse", "0") pfUI:UpdateConfig("bars", "gryphons", "texture", "None") pfUI:UpdateConfig("bars", "gryphons", "color", ".6,.6,.6,1") @@ -695,6 +698,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("totems", nil, "iconsize", "26") pfUI:UpdateConfig("totems", nil, "spacing", "3") pfUI:UpdateConfig("totems", nil, "showbg", "0") + pfUI:UpdateConfig("totems", nil, "cooldown_reverse", "1") pfUI:UpdateConfig("panel", nil, "use_unitfonts", "0") pfUI:UpdateConfig("panel", nil, "hide_leftchat", "0") @@ -942,6 +946,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("nameplates", nil, "debufftimers", "1") pfUI:UpdateConfig("nameplates", nil, "debufftext", "1") pfUI:UpdateConfig("nameplates", nil, "debuffanim", "0") + pfUI:UpdateConfig("nameplates", nil, "debreverse", "1") pfUI:UpdateConfig("abuttons", nil, "enable", "1") pfUI:UpdateConfig("abuttons", nil, "position", "bottom") diff --git a/api/unitframes.lua b/api/unitframes.lua index 9d61d0ad..f7850b64 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -470,6 +470,7 @@ function pfUI.uf:UpdateConfig() local cooldown_text = tonumber(f.config.cooldown_text) local cooldown_anim = tonumber(f.config.cooldown_anim) + local cooldown_reverse = tonumber(f.config.cooldown_reverse) or 0 local relative_point = "BOTTOM" if f.config.panchor == "TOPLEFT" then @@ -829,6 +830,7 @@ function pfUI.uf:UpdateConfig() f.buffs[i].cd.pfCooldownType = "ALL" f.buffs[i].cd.pfCooldownStyleText = cooldown_text f.buffs[i].cd.pfCooldownStyleAnimation = cooldown_anim + f.buffs[i].cd.pfCooldownReverse = cooldown_reverse f.buffs[i].cd:SetAlpha(cooldown_anim == 1 and 1 or 0) -- immediately show/hide existing cooldown text @@ -889,6 +891,7 @@ function pfUI.uf:UpdateConfig() f.debuffs[i].cd.pfCooldownType = "ALL" f.debuffs[i].cd.pfCooldownStyleText = cooldown_text f.debuffs[i].cd.pfCooldownStyleAnimation = cooldown_anim + f.debuffs[i].cd.pfCooldownReverse = cooldown_reverse f.debuffs[i].cd:SetAlpha(cooldown_anim == 1 and 1 or 0) -- immediately show/hide existing cooldown text diff --git a/modules/actionbar.lua b/modules/actionbar.lua index c97b625f..84591e5c 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -1045,6 +1045,7 @@ pfUI:RegisterModule("actionbar", function () -- cooldown f.cd = CreateFrame("Cooldown", f:GetName() .. "Cooldown", f, "CooldownFrameTemplate") f.cd.pfCooldownStyleAnimation = 1 + f.cd.pfCooldownReverse = tonumber(C.bars.cooldown_reverse) or 0 f.cd.pfCooldownType = "NOGCD" f.cd.pfCooldownSize = cd_size diff --git a/modules/bags.lua b/modules/bags.lua index a2942b2c..fef9e0f7 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -398,11 +398,13 @@ pfUI:RegisterModule("bags", function () local name = "pfBag" .. bag .. "item" .. slot .. "Cooldown" bankslot.cd = CreateFrame("Cooldown", name, bankslot, "CooldownFrameTemplate") bankslot.cd.pfCooldownStyleAnimation = 1 + bankslot.cd.pfCooldownReverse = tonumber(C.appearance.bags.cooldown_reverse) or 0 bankslot.cd.pfCooldownType = "NOGCD" else local bagslot = pfUI.bags[bag].slots[slot].frame bagslot.cd = _G[bagslot:GetName().."Cooldown"] bagslot.cd.pfCooldownType = "NOGCD" + bagslot.cd.pfCooldownReverse = tonumber(C.appearance.bags.cooldown_reverse) or 0 end if not pfUI.bags[bag].slots[slot].frame.backdrop then diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 0cbfbb0d..0f8ab9d5 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -142,6 +142,12 @@ pfUI:RegisterModule("cooldown", function () this:SetAlpha(0) end + -- reversed sweep direction (ClassicAPI backports SetReverse with the + -- modern Cooldown frame; stock Model swipes don't have it, so guard it) + if this.pfCooldownReverse == 1 and this.SetReverse then + this:SetReverse(true) + end + -- print time as text on cooldown frames if ( not this.pfCooldownStyleText or this.pfCooldownStyleText == 1) and start > 0 and duration > 0 and (not enable or enable > 0) then diff --git a/modules/gui.lua b/modules/gui.lua index b568e441..9b3c82a3 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2341,6 +2341,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(U[c], T["Timer"], nil, nil, "header") CreateConfig(U[c], T["Show Timer Text"], C.unitframes[c], "cooldown_text", "checkbox") CreateConfig(Reload, T["Show Timer Animation"], C.unitframes[c], "cooldown_anim", "checkbox") + CreateConfig(Reload, T["Reverse Timer Animation"], C.unitframes[c], "cooldown_reverse", "checkbox") CreateConfig(U[c], T["Buffs"], nil, nil, "header") CreateConfig(U[c], T["Buff Position"], C.unitframes[c], "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) @@ -2445,6 +2446,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, T["Bankslots Per Row"], C.appearance.bags, "bankrowlength") CreateConfig(nil, T["Enable Full-Text Search"], C.appearance.bags, "fulltext") CreateConfig(nil, T["Item Slot Size"], C.appearance.bags, "icon_size") + CreateConfig(Reload, T["Reverse Cooldown Animation"], C.appearance.bags, "cooldown_reverse", "checkbox") CreateConfig(nil, T["Auto Sell Grey Items"], C.global, "autosell", "checkbox") CreateConfig(nil, T["Auto Repair Items"], C.global, "autorepair", "checkbox") CreateConfig(nil, T["Auto Sort When Opening Bags"], C.appearance.bags, "autoSortOnOpen", "checkbox") @@ -2502,6 +2504,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(U["totems"], T["Icon Size"], C.totems, "iconsize") CreateConfig(U["totems"], T["Spacing"], C.totems, "spacing", "dropdown", pfUI.gui.dropdowns.spacing) CreateConfig(U["totems"], T["Show Background"], C.totems, "showbg", "checkbox") + CreateConfig(Reload, T["Reverse Cooldown Animation"], C.totems, "cooldown_reverse", "checkbox") end) CreateGUIEntry(T["Buffs"], T["Player Buff Bar"], function() @@ -2591,6 +2594,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(U["bars"], T["Keybind Text Size"], C.bars, "bind_size") CreateConfig(U["bars"], T["Keybind Text Color"], C.bars, "bind_color", "color") CreateConfig(nil, T["Cooldown Text Size"], C.bars, "cd_size") + CreateConfig(Reload, T["Reverse Cooldown Animation"], C.bars, "cooldown_reverse", "checkbox") CreateConfig(nil, T["Auto Paging"], nil, nil, "header") CreateConfig(U["bars"], T["Switch Pages On Alt Key Press"], C.bars, "pagemasteralt", "checkbox") @@ -2960,6 +2964,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(U["nameplates"], T["Enable Debuff Timers"], C.nameplates, "debufftimers", "checkbox") CreateConfig(U["nameplates"], T["Show Timer Text"], C.nameplates, "debufftext", "checkbox") CreateConfig(Reload, T["Show Timer Animation"], C.nameplates, "debuffanim", "checkbox") + CreateConfig(Reload, T["Reverse Timer Animation"], C.nameplates, "debreverse", "checkbox") CreateConfig(U["nameplates"], T["Filter Mode"], C.nameplates.debuffs, "filter", "dropdown", pfUI.gui.dropdowns.buffbarfilter) CreateConfig(U["nameplates"], T["Blacklist"], C.nameplates.debuffs, "blacklist", "list") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 110b1cdb..01c41750 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -159,6 +159,7 @@ pfUI:RegisterModule("nameplates", function () cfg.debufftimers = C.nameplates.debufftimers == "1" cfg.debuffanim = tonumber(C.nameplates.debuffanim) or 0 cfg.debufftext = tonumber(C.nameplates.debufftext) or 1 + cfg.debreverse = tonumber(C.nameplates.debreverse) or 0 -- Throttle delays, resolved once instead of per plate per tick. -- libthrottle:Get walks the saved-variable table, a defaults fallback and a @@ -445,6 +446,7 @@ pfUI:RegisterModule("nameplates", function () -- Set initial config flags (will be cached per-cooldown later) plate.debuffs[index].cd.pfCooldownStyleAnimation = cfg.debuffanim + plate.debuffs[index].cd.pfCooldownReverse = cfg.debreverse or 0 plate.debuffs[index].cd.pfCooldownStyleText = cfg.debufftext plate.debuffs[index].cd.pfCooldownType = "ALL" end @@ -486,6 +488,7 @@ pfUI:RegisterModule("nameplates", function () local cooldown_anim = tonumber(C.nameplates.debuffanim) or 0 nameplate.debuffs[i].cd.pfCooldownStyleText = cooldown_text nameplate.debuffs[i].cd.pfCooldownStyleAnimation = cooldown_anim + nameplate.debuffs[i].cd.pfCooldownReverse = tonumber(C.nameplates.debreverse) or 0 end end @@ -1396,12 +1399,14 @@ nameplates:RegisterUnitEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "target", "focu local cd = plate.debuffs[index].cd cd:Show() if not cachedStart or abs(cachedStart - newStart) > 0.5 then - if not cd.configCached or cd.cachedAnim ~= cfg.debuffanim or cd.cachedText ~= cfg.debufftext then + if not cd.configCached or cd.cachedAnim ~= cfg.debuffanim or cd.cachedText ~= cfg.debufftext or cd.cachedReverse ~= cfg.debreverse then cd.pfCooldownStyleAnimation = cfg.debuffanim cd.pfCooldownStyleText = cfg.debufftext + cd.pfCooldownReverse = cfg.debreverse or 0 cd:SetAlpha(cfg.debuffanim == 1 and 1 or 0) cd.cachedAnim = cfg.debuffanim cd.cachedText = cfg.debufftext + cd.cachedReverse = cfg.debreverse cd.configCached = true end CooldownFrame_SetTimer(cd, newStart, effDuration, 1) diff --git a/modules/totems.lua b/modules/totems.lua index 9ad7991c..dd5b4c77 100644 --- a/modules/totems.lua +++ b/modules/totems.lua @@ -115,6 +115,7 @@ pfUI:RegisterModule("totems", function () self.bar[i].cdbg:SetPoint("CENTER", self.bar[i], "CENTER", 0, 0) self.bar[i].cd = self.bar[i].cd or CreateFrame("Cooldown", "pfTotemsBar"..i.."Cooldown", self.bar[i].cdbg, "CooldownFrameTemplate") self.bar[i].cd.pfCooldownStyleAnimation = 1 + self.bar[i].cd.pfCooldownReverse = tonumber(pfUI_config.totems.cooldown_reverse) or 0 self.bar[i].cd.pfCooldownType = "ALL" self.bar[i]:RegisterForClicks("LeftButtonUp", "RightButtonUp")