mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-30 23:46:57 +00:00
Let each cooldown frame apply its own sweep settings
The sweep options reached the frames only through the cooldown module's CooldownFrame_SetTimer hook, which set alpha 0 for a hidden animation and SetReverse(true) for a reversed one. With that module disabled, Show Timer Animation and Reverse did nothing, and reverse never turned back off without a reload. The player buff sweeps had no other path at all. Each owner now configures its own frame. Player buffs drive their Cooldown with SetCooldown and Clear, and only while Show Timer Animation is on. Unit frame auras, raid aura indicators and nameplate debuffs hide the sweep with SetDrawSwipe and SetDrawBling. Every frame with a reverse option calls SetReverse. The hook keeps the timer text and Hide Foreign Cooldown Animations. Nameplate debuffs hid the sweep with alpha, which the plate's SetAlpha copied down on every target change (ClassicAPI keeps 1.12's alpha under default plates), so hidden sweeps came back. Their settings now come from UpdateDebuffConfig alone. Bag slots get a native Cooldown like bank slots, in place of the template's indicator Model, so Reverse Cooldown Animation covers bags and Hide Foreign Cooldown Animations no longer hides them. The buff, unit frame, nameplate and totem options apply without a reload. Fixes #72.
This commit is contained in:
@@ -1035,7 +1035,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:SetReverse(C.bars.cooldown_reverse == "1")
|
||||
f.cd.pfCooldownType = "NOGCD"
|
||||
f.cd.pfCooldownSize = cd_size
|
||||
|
||||
|
||||
+9
-14
@@ -415,20 +415,15 @@ pfUI:RegisterModule("bags", function ()
|
||||
pfUI.bags[bag].slots[slot].slot = slot
|
||||
pfUI.bags[bag].slots[slot].frame:SetID(slot)
|
||||
|
||||
-- add cooldown frame to bankslots
|
||||
if tpl == "BankItemButtonGenericTemplate" then
|
||||
local bankslot = pfUI.bags[bag].slots[slot].frame
|
||||
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
|
||||
-- native cooldown frame: the bank template has none and the bag
|
||||
-- template's is 1.12's indicator Model, which can't reverse. Taking the
|
||||
-- "<button>Cooldown" name points ContainerFrame_UpdateCooldown at it;
|
||||
-- the Model starts hidden and nothing reaches it after that
|
||||
local slotframe = pfUI.bags[bag].slots[slot].frame
|
||||
slotframe.cd = CreateFrame("Cooldown", slotframe:GetName() .. "Cooldown", slotframe, "CooldownFrameTemplate")
|
||||
slotframe.cd.pfCooldownStyleAnimation = 1
|
||||
slotframe.cd:SetReverse(C.appearance.bags.cooldown_reverse == "1")
|
||||
slotframe.cd.pfCooldownType = "NOGCD"
|
||||
|
||||
if not pfUI.bags[bag].slots[slot].frame.backdrop then
|
||||
CreateBackdrop(pfUI.bags[bag].slots[slot].frame, default_border)
|
||||
|
||||
+9
-12
@@ -86,23 +86,23 @@ pfUI:RegisterModule("buff", function ()
|
||||
|
||||
-- drive the sweep from the aura duration (weapon enchants and permanent
|
||||
-- auras report no usable total, so those buttons stay text-only)
|
||||
if buff.mode == buff.btype and duration and duration > 0 and expirationTime and expirationTime > 0 then
|
||||
if C.buffs.cooldown_anim == "1" and buff.mode == buff.btype and duration and duration > 0 and expirationTime and expirationTime > 0 then
|
||||
local now = GetTime()
|
||||
local timeleft = expirationTime - now
|
||||
if timeleft > 0 then
|
||||
local effDuration = duration > timeleft and duration or timeleft
|
||||
local newStart = now + timeleft - effDuration
|
||||
if buff.cdStart == nil or abs(buff.cdStart - newStart) > .5 or buff.cdDuration ~= effDuration then
|
||||
CooldownFrame_SetTimer(buff.cd, newStart, effDuration, 1)
|
||||
buff.cd:SetCooldown(newStart, effDuration)
|
||||
buff.cdStart = newStart
|
||||
buff.cdDuration = effDuration
|
||||
end
|
||||
else
|
||||
CooldownFrame_SetTimer(buff.cd, 0, 0, 0)
|
||||
buff.cd:Clear()
|
||||
buff.cdStart = nil
|
||||
end
|
||||
else
|
||||
CooldownFrame_SetTimer(buff.cd, 0, 0, 0)
|
||||
buff.cd:Clear()
|
||||
buff.cdStart = nil
|
||||
end
|
||||
|
||||
@@ -145,15 +145,13 @@ pfUI:RegisterModule("buff", function ()
|
||||
buff.stacks:SetJustifyV("BOTTOM")
|
||||
buff.stacks:SetAllPoints(buff)
|
||||
|
||||
-- radial sweep (the template covers the button and starts hidden;
|
||||
-- the cooldown hook drives it from here, text stays with buff.timer)
|
||||
-- radial sweep (the template covers the button and starts hidden).
|
||||
-- RefreshBuffButton drives it through the frame's own methods, never
|
||||
-- CooldownFrame_SetTimer, so the cooldown module's hook leaves it alone;
|
||||
-- text stays with buff.timer
|
||||
buff.cd = CreateFrame("Cooldown", buttonName .. "Cooldown", buff, "CooldownFrameTemplate")
|
||||
buff.cd:SetFrameLevel(buff:GetFrameLevel() + 1)
|
||||
buff.overlay:SetFrameLevel(buff:GetFrameLevel() + 2)
|
||||
buff.cd.pfCooldownType = "ALL"
|
||||
buff.cd.pfCooldownStyleText = 0
|
||||
buff.cd.pfCooldownStyleAnimation = tonumber(C.buffs.cooldown_anim) or 0
|
||||
buff.cd.pfCooldownReverse = tonumber(C.buffs.cooldown_reverse) or 0
|
||||
|
||||
buff:RegisterForClicks("RightButtonUp")
|
||||
|
||||
@@ -345,8 +343,7 @@ pfUI:RegisterModule("buff", function ()
|
||||
offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+buffSize+2*buffSpacing)
|
||||
end
|
||||
buff:SetSize(buffSize, buffSize)
|
||||
buff.cd.pfCooldownStyleAnimation = tonumber(C.buffs.cooldown_anim) or 0
|
||||
buff.cd.pfCooldownReverse = tonumber(C.buffs.cooldown_reverse) or 0
|
||||
buff.cd:SetReverse(C.buffs.cooldown_reverse == "1")
|
||||
buff:ClearAllPoints()
|
||||
buff:SetPoint("TOPRIGHT", relFrame, "TOPRIGHT",offsetX, offsetY)
|
||||
|
||||
|
||||
+3
-10
@@ -135,17 +135,10 @@ pfUI:RegisterModule("cooldown", function ()
|
||||
start, duration = 0, 0
|
||||
end
|
||||
|
||||
-- hide animation
|
||||
if this.pfCooldownStyleAnimation == 0 then
|
||||
-- hide foreign animations; frames that set pfCooldownStyleAnimation
|
||||
-- configure their own sweep (SetDrawSwipe, SetReverse)
|
||||
if not this.pfCooldownStyleAnimation and C.appearance.cd.hideanim == "1" then
|
||||
this:SetAlpha(0)
|
||||
elseif not this.pfCooldownStyleAnimation and C.appearance.cd.hideanim == "1" then
|
||||
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
|
||||
|
||||
+7
-7
@@ -2337,8 +2337,8 @@ 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["Show Timer Animation"], C.unitframes[c], "cooldown_anim", "checkbox")
|
||||
CreateConfig(U[c], 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)
|
||||
@@ -2508,8 +2508,8 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(U["buff"], T["Number Of Debuffs Per Row"], C.buffs, "debuffrowsize")
|
||||
CreateConfig(U["buff"], T["Show Duration Inside Buff"], C.buffs, "textinside", "checkbox")
|
||||
CreateConfig(U["buff"], T["Buff Font Size"], C.buffs, "fontsize")
|
||||
CreateConfig(Reload, T["Show Timer Animation"], C.buffs, "cooldown_anim", "checkbox")
|
||||
CreateConfig(Reload, T["Reverse Timer Animation"], C.buffs, "cooldown_reverse", "checkbox")
|
||||
CreateConfig(U["buff"], T["Show Timer Animation"], C.buffs, "cooldown_anim", "checkbox")
|
||||
CreateConfig(U["buff"], T["Reverse Timer Animation"], C.buffs, "cooldown_reverse", "checkbox")
|
||||
end)
|
||||
|
||||
CreateGUIEntry(T["Buffs"], T["Totem Icons"], function()
|
||||
@@ -2517,7 +2517,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")
|
||||
CreateConfig(U["totems"], T["Reverse Cooldown Animation"], C.totems, "cooldown_reverse", "checkbox")
|
||||
end)
|
||||
|
||||
CreateGUIEntry(T["Buffs"], T["Player Buff Bar"], function()
|
||||
@@ -2978,8 +2978,8 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(U["nameplates"], T["Show Debuff Stacks"], C.nameplates.debuffs, "showstacks", "checkbox")
|
||||
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["Show Timer Animation"], C.nameplates, "debuffanim", "checkbox")
|
||||
CreateConfig(U["nameplates"], 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")
|
||||
|
||||
+10
-26
@@ -157,9 +157,6 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
cfg.hptextformat = C.nameplates.hptextformat
|
||||
-- NEW: Cache debuff config
|
||||
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
|
||||
@@ -443,11 +440,8 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
|
||||
plate.debuffs[index].cd = CreateFrame("Cooldown", plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index], "CooldownFrameTemplate")
|
||||
plate.debuffs[index].cd:SetFrameLevel(6)
|
||||
|
||||
-- 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
|
||||
-- the display settings come from UpdateDebuffConfig, which runs for
|
||||
-- every new icon before its first timer
|
||||
plate.debuffs[index].cd.pfCooldownType = "ALL"
|
||||
end
|
||||
|
||||
@@ -483,14 +477,14 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
nameplate.debuffs[i]:SetSize(debuffsize, debuffsize)
|
||||
|
||||
-- Update cooldown display settings
|
||||
if nameplate.debuffs[i].cd then
|
||||
local cooldown_text = tonumber(C.nameplates.debufftext) or 1
|
||||
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
|
||||
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
|
||||
@@ -1399,16 +1393,6 @@ 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 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)
|
||||
plate.cdCache[index] = plate.cdCache[index] or {}
|
||||
plate.cdCache[index].effect = effect
|
||||
|
||||
+1
-1
@@ -115,7 +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:SetReverse(pfUI_config.totems.cooldown_reverse == "1")
|
||||
self.bar[i].cd.pfCooldownType = "ALL"
|
||||
|
||||
self.bar[i]:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
|
||||
Reference in New Issue
Block a user