Timer bars: buffwatch, loot roll, infobox and five-second rule drain from duration objects

Each bar hands its fill to StatusBar:SetTimerDuration instead of a per-frame
SetValue. Buffwatch's time text moves to a duration text binding holding the
cooldown formatter, now exposed as GetTimeFormatter (replacing
GetColoredTimeString, whose only caller this was). The five-second rule's
overlay style becomes a color-filled StatusBar too, so both styles share one
path; energytick's OnUpdate keeps only the tick spark.
This commit is contained in:
Brues
2026-11-03 01:07:02 -06:00
parent 2909679d62
commit d7e732981b
5 changed files with 68 additions and 68 deletions
+4 -9
View File
@@ -834,10 +834,7 @@ function pfUI.api.CreateInfoBox(text, time, parent, height)
end)
infobox:SetScript("OnUpdate", function()
local time = infobox.lastshow + infobox.duration - GetTime()
infobox.timeout:SetValue(time)
if GetTime() > infobox.lastshow + infobox.duration then
if infobox.duration:HasExpired() then
if not infobox.fade:IsPlaying() then infobox.fade:Play() end
elseif MouseIsOverHitRect(this) then
this:SetAlpha(max(0.4, this:GetAlpha() - .1))
@@ -857,6 +854,8 @@ function pfUI.api.CreateInfoBox(text, time, parent, height)
infobox.timeout = CreateFrame("StatusBar", nil, infobox)
infobox.timeout:SetStatusBarTexture(pfUI.media["img:bar"])
infobox.timeout:SetStatusBarColor(.3,1,.8,1)
infobox.duration = C_DurationUtil.CreateDuration()
infobox.timeout:SetTimerDuration(infobox.duration, Enum.StatusBarInterpolation.Immediate, Enum.StatusBarTimerDirection.RemainingTime)
infobox:ClearAllPoints()
infobox.text:SetAllPoints(infobox)
@@ -872,11 +871,7 @@ function pfUI.api.CreateInfoBox(text, time, parent, height)
end
infobox.text:SetText(text)
infobox.timeout:SetMinMaxValues(0, time)
infobox.timeout:SetValue(time)
infobox.duration = time
infobox.lastshow = GetTime()
infobox.duration:SetTimeFromStart(GetTime(), time)
infobox:SetSize(infobox.text:GetStringWidth() + 50, height)
infobox:SetParent(parent)