diff --git a/api/config.lua b/api/config.lua index fdd2e130..7002d019 100644 --- a/api/config.lua +++ b/api/config.lua @@ -837,6 +837,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("nameplates", "debuffs", "blacklist", "") pfUI:UpdateConfig("nameplates", "debuffs", "showstacks", "0") pfUI:UpdateConfig("nameplates", "debuffs", "position", "BOTTOM") + pfUI:UpdateConfig("nameplates", nil, "debuffanim", "0") pfUI:UpdateConfig("abuttons", nil, "enable", "1") pfUI:UpdateConfig("abuttons", nil, "position", "bottom") diff --git a/api/unitframes.lua b/api/unitframes.lua index fe29d968..0e88c5a0 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -744,7 +744,17 @@ function pfUI.uf:UpdateConfig() f.buffs[i].stacks:SetShadowOffset(0.8, -0.8) f.buffs[i].stacks:SetTextColor(1,1,.5) - f.buffs[i].cd = f.buffs[i].cd or CreateFrame(COOLDOWN_FRAME_TYPE, f.buffs[i]:GetName() .. "Cooldown", f.buffs[i], "CooldownFrameTemplate") + -- Create CD frame if it doesn't exist + if not f.buffs[i].cd then + f.buffs[i].cd = CreateFrame(COOLDOWN_FRAME_TYPE, f.buffs[i]:GetName() .. "Cooldown", f.buffs[i], "CooldownFrameTemplate") + end + + -- Always update CD properties (in case size changed) + local cdScale = f.config.buffsize / 32 + f.buffs[i].cd:ClearAllPoints() + f.buffs[i].cd:SetScale(cdScale) + f.buffs[i].cd:SetAllPoints(f.buffs[i]) + f.buffs[i].cd:SetFrameLevel(14) f.buffs[i].cd.pfCooldownType = "ALL" f.buffs[i].cd.pfCooldownStyleText = cooldown_text f.buffs[i].cd.pfCooldownStyleAnimation = cooldown_anim @@ -825,7 +835,18 @@ function pfUI.uf:UpdateConfig() f.debuffs[i].stacks:SetShadowColor(0, 0, 0) f.debuffs[i].stacks:SetShadowOffset(0.8, -0.8) f.debuffs[i].stacks:SetTextColor(1,1,.5) - f.debuffs[i].cd = f.debuffs[i].cd or CreateFrame(COOLDOWN_FRAME_TYPE, f.debuffs[i]:GetName() .. "Cooldown", f.debuffs[i], "CooldownFrameTemplate") + + -- Create CD frame if it doesn't exist + if not f.debuffs[i].cd then + f.debuffs[i].cd = CreateFrame(COOLDOWN_FRAME_TYPE, f.debuffs[i]:GetName() .. "Cooldown", f.debuffs[i], "CooldownFrameTemplate") + end + + -- Always update CD properties (in case size changed) + local cdScale = f.config.debuffsize / 32 + f.debuffs[i].cd:ClearAllPoints() + f.debuffs[i].cd:SetScale(cdScale) + f.debuffs[i].cd:SetAllPoints(f.debuffs[i]) + f.debuffs[i].cd:SetFrameLevel(14) f.debuffs[i].cd.pfCooldownType = "ALL" f.debuffs[i].cd.pfCooldownStyleText = cooldown_text f.debuffs[i].cd.pfCooldownStyleAnimation = cooldown_anim diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 0a293940..8d490312 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -112,9 +112,11 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function () start, duration = 0, 0 end - -- hide animation + -- handle animation visibility if this.pfCooldownStyleAnimation == 0 then this:SetAlpha(0) + elseif this.pfCooldownStyleAnimation == 1 then + this:SetAlpha(1) elseif not this.pfCooldownStyleAnimation and C.appearance.cd.hideanim == "1" then this:SetAlpha(0) end diff --git a/modules/gui.lua b/modules/gui.lua index c4f5b218..d7c59177 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2356,6 +2356,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U["nameplates"], T["Debuff Icon Size"], C.nameplates, "debuffsize") CreateConfig(U["nameplates"], T["Estimate Debuffs"], C.nameplates, "guessdebuffs", "checkbox") CreateConfig(U["nameplates"], T["Show Debuff Stacks"], C.nameplates.debuffs, "showstacks", "checkbox") + CreateConfig(U["nameplates"], T["Show Timer Animation"], C.nameplates, "debuffanim", "checkbox") CreateConfig(U["nameplates"], T["Only Show Own Debuffs (|cffffaaaaExperimental|r)"], C.nameplates, "selfdebuff", "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 b9914905..bd7dce8b 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -300,19 +300,19 @@ pfUI:RegisterModule("nameplates", "vanilla", function () plate.debuffs[index].stacks:SetJustifyV("BOTTOM") plate.debuffs[index].stacks:SetTextColor(1,1,0) + -- Read config for cooldown animation + local cooldown_anim = tonumber(C.nameplates.debuffanim) or 0 + if pfUI.client <= 11200 then - -- create a fake animation frame on vanilla to improve performance - plate.debuffs[index].cd = CreateFrame("Frame", plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index]) - plate.debuffs[index].cd:SetScript("OnUpdate", CooldownFrame_OnUpdateModel) - plate.debuffs[index].cd.AdvanceTime = DoNothing - plate.debuffs[index].cd.SetSequence = DoNothing - plate.debuffs[index].cd.SetSequenceTime = DoNothing + -- Use Model frame with CooldownFrameTemplate for proper pie animation in Vanilla + plate.debuffs[index].cd = CreateFrame("Model", plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index], "CooldownFrameTemplate") + plate.debuffs[index].cd:SetAllPoints(plate.debuffs[index]) else -- use regular cooldown animation frames on burning crusade and later plate.debuffs[index].cd = CreateFrame(COOLDOWN_FRAME_TYPE, plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index], "CooldownFrameTemplate") end - plate.debuffs[index].cd.pfCooldownStyleAnimation = 0 + plate.debuffs[index].cd.pfCooldownStyleAnimation = cooldown_anim plate.debuffs[index].cd.pfCooldownType = "ALL" end @@ -1000,7 +1000,8 @@ pfUI:RegisterModule("nameplates", "vanilla", function () end if duration and timeleft and debuffdurations then - plate.debuffs[index].cd:SetAlpha(0) + local cooldown_anim = tonumber(C.nameplates.debuffanim) or 0 + plate.debuffs[index].cd:SetAlpha(cooldown_anim == 1 and 1 or 0) plate.debuffs[index].cd:Show() CooldownFrame_SetTimer(plate.debuffs[index].cd, GetTime() + timeleft - duration, duration, 1) end