Skip to content

Commit c4f0776

Browse files
committed
display timer prefix&color based on completion timer rather than comparing timer
1 parent d525d10 commit c4f0776

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Display.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,14 @@ function MPT:DisplayTimerElements(chest, completion, preview, diff)
332332
local F = self.Frame
333333
local displayed = 0
334334
F.TimerBar:SetValue(self.timer)
335-
336335
local timertext = self:FormatTime(math.floor(self.timer))
337336
if completion and self.TimerText.Decimals > 0 then
338337
local timeMS = self.timer and select(2, strsplit(".", (self.timer)))
339338
timeMS = timeMS and (".%s"):format(string.sub(timeMS, 1, self.TimerText.Decimals))
340-
timertext = timeMS and ("%s%s"):format(timertext, timeMS) or "00:00"
339+
timertext = timeMS and ("%s%s"):format(timertext, timeMS) or timertext
341340
end
342-
local timercolor = completion and (self.timer < self.timelimit and self.TimerText.SuccessColor) or (self.timer > self.timelimit and self.TimerText.FailColor) or self.TimerText.Color
341+
local upgrades = completion and C_ChallengeMode.GetChallengeCompletionInfo().keystoneUpgradeLevels or 0
342+
local timercolor = completion and (upgrades > 0 and self.TimerText.SuccessColor or self.TimerText.FailColor) or self.TimerText.Color
343343
self:ApplyTextSettings(F.TimerBar.TimerText, self.TimerText, string.format("%s/%s", timertext, self:FormatTime(self.timelimit)))
344344
if diff or preview then
345345
local ComparisonTime = preview and math.random(-200, 200) or diff or 0 -- math.random(-200, 200)
@@ -360,11 +360,12 @@ function MPT:DisplayTimerElements(chest, completion, preview, diff)
360360
if self.TimerBar.ChestTimerDisplay ~= 3 and self["ChestTimer"..i].enabled and (((chest >= i or (i == 1 and remTime < 0)) and (self.TimerBar.ChestTimerDisplay == 2 or displayed == 0)) or (self.TimerBar.ChestTimerDisplay == 1 and completion and chest+1 >= i and displayed < 2 and chest ~= 3 and not preview)) then
361361
displayed = displayed +1
362362
local color = i == 1 and remTime < 0 and self["ChestTimer"..i].BehindColor
363-
if completion then
364-
color = (remTime < 0 and self["ChestTimer"..i].BehindColor) or (remTime > 0 and self["ChestTimer"..i].AheadColor) or self["ChestTimer"..i].EqualColor
365-
end
366363
local prefix = ""
367364
if remTime < 0 then prefix = "+" remTime = remTime*-1 end
365+
if completion then
366+
color = upgrades < i and self["ChestTimer"..i].BehindColor or self["ChestTimer"..i].AheadColor
367+
prefix = upgrades < i and "+" or "-"
368+
end
368369
self:ApplyTextSettings(F.TimerBar["ChestTimer"..i], self["ChestTimer"..i], prefix..self:FormatTime(remTime), color, false, i)
369370
else
370371
F.TimerBar["ChestTimer"..i]:Hide()

0 commit comments

Comments
 (0)