Centralize cooldown setup and settings

Every pfUI cooldown is now made by CreateCooldown(parent, kind) in the
new api/cooldown.lua, which replaces the cooldown module. A kind names
what the cooldown times: actionbar, bags, blizzard (spellbook and
character), unitframe, indicator, nameplate, buff, tooltip, totem or
lossofcontrol. The pfCooldownType, pfCooldownStyleText,
pfCooldownStyleAnimation and pfCooldownSize fields are gone. The new
file owns everything the cooldowns share:
- the numbers' font and size
- the formatter
- each kind's numbers, sweep and sweep direction
- the GCD threshold for spell kinds
- the CooldownFrame_SetTimer hook for other addons' Cooldown frames
UpdateCooldowns applies changed settings to every cooldown at once.
GetAuraTimer moves here from the unit frames.

All settings live in one C.cooldown table, on one page: Settings ->
Cooldown. It has the shared font, size, threshold, tenths and colors,
then "Show Numbers On", "Show Sweep On" and "Reverse Sweep On" lists
with a checkbox per kind. The per-module options are removed:
- each unit frame's timer text, animation and reverse, and the
  indicators' "Show Time Left"
- the nameplate debuff timer options
- the Blizzard and foreign font sizes and toggles
- Action Bars' cooldown text size
- the reverse options of bars, bags, buffs and totems
The old appearance.cd settings are not migrated.

The player buff frame and the tooltip aura icons now show the native
countdown too, which replaces their own text and OnUpdate ticking. The
buff frame keeps its inside or below-the-icon placement. Weapon
enchants report only their time left, so they start through
SetCooldownTimeLeft: numbers, no sweep. A slim poll remains for their
charges and renewals, since no event reports those. Buff indicators
now take the aura's real duration, which gives them a correct sweep.
The spellbook and character slots now hide GCD numbers like the other
spell cooldowns.
This commit is contained in:
Brues
2026-10-31 19:17:14 -05:00
parent 149c8cb3c3
commit 907d282a68
26 changed files with 535 additions and 546 deletions
+2 -17
View File
@@ -155,8 +155,6 @@ pfUI:RegisterModule("nameplates", function ()
cfg.use_unitfonts = C.nameplates.use_unitfonts == "1"
cfg.font_size = cfg.use_unitfonts and C.global.font_unit_size or C.global.font_size
cfg.hptextformat = C.nameplates.hptextformat
-- NEW: Cache debuff config
cfg.debufftimers = C.nameplates.debufftimers == "1"
-- Throttle delays, resolved once instead of per plate per tick.
-- libthrottle:Get walks the saved-variable table, a defaults fallback and a
@@ -438,11 +436,8 @@ pfUI:RegisterModule("nameplates", function ()
plate.debuffs[index].stacks:SetJustifyV("BOTTOM")
plate.debuffs[index].stacks:SetTextColor(1,1,0)
plate.debuffs[index].cd = CreateFrame("Cooldown", plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index], "CooldownFrameTemplate")
plate.debuffs[index].cd = CreateCooldown(plate.debuffs[index], "nameplate", plate.platename.."Debuff"..index.."Cooldown")
plate.debuffs[index].cd:SetFrameLevel(6)
-- the display settings come from UpdateDebuffConfig, which runs for
-- every new icon before its first timer
plate.debuffs[index].cd.pfCooldownType = "ALL"
end
local function UpdateDebuffConfig(nameplate, i)
@@ -475,16 +470,6 @@ pfUI:RegisterModule("nameplates", function ()
end
nameplate.debuffs[i]:SetSize(debuffsize, debuffsize)
-- Update cooldown display settings
local cd = nameplate.debuffs[i].cd
cd.pfCooldownStyleText = tonumber(C.nameplates.debufftext) or 1
cd.pfCooldownStyleAnimation = tonumber(C.nameplates.debuffanim) or 0
-- the draw flags, not alpha: the plate's SetAlpha copies its alpha down
-- to every child (ClassicAPI keeps 1.12's alpha under default plates)
cd:SetDrawSwipe(C.nameplates.debuffanim == "1")
cd:SetDrawBling(C.nameplates.debuffanim == "1")
cd:SetReverse(C.nameplates.debreverse == "1")
end
-- create nameplate core
@@ -1376,7 +1361,7 @@ nameplates:RegisterUnitEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "target", "focu
plate.debuffs[index].stacks:Hide()
end
if duration and timeleft and cfg.debufftimers then
if duration and timeleft then
-- C_UnitAuras returns the Spell.dbc base duration, which talents
-- can extend past — Shadow Affinity bumps SW:P from 18s to 24s,
-- so a fresh cast has timeleft > duration and `now + timeleft -