@@ -194,10 +194,9 @@ function MPT:UpdateKeyInfo(Full, Deaths, preview)
194194 return
195195 end
196196 if Full then
197- local mapID = self .cmap
198197 local level , affixes = C_ChallengeMode .GetActiveKeystoneInfo ()
199198 local keyLevel = (preview and " +30" ) or " +" .. level
200- local DungeonName = (preview and " Halls of Valor" ) or (mapID and self .maptoID [mapID ] and self .maptoID [mapID ][2 ]) or " "
199+ local DungeonName = (preview and " Halls of Valor" ) or (self . cmap and self .maptoID [self . cmap ] and self .maptoID [self . cmap ][2 ]) or " "
201200 local AffixDisplay = " "
202201 local deathcount = (preview and " 20" ) or C_ChallengeMode .GetDeathCount ()
203202 if preview then
@@ -220,8 +219,7 @@ function MPT:UpdateKeyInfo(Full, Deaths, preview)
220219 end
221220 end
222221 local parent = (self .KeyInfo .AnchoredTo == " MainFrame" and F ) or (self .KeyInfo .AnchoredTo == " Bosses" and F [" Bosses" ..# self .BossNames ]) or F [self .KeyInfo .AnchoredTo ]
223- local yOffset = parent == F and 0 or parent :GetHeight ()
224- self :SetPoint (F .KeyInfo , self .KeyInfo .Anchor , parent , self .KeyInfo .RelativeTo , self .KeyInfo .xOffset , - yOffset + self .KeyInfo .yOffset )
222+ self :SetPoint (F .KeyInfo , self .KeyInfo .Anchor , parent , self .KeyInfo .RelativeTo , self .KeyInfo .xOffset , self .KeyInfo .yOffset )
225223 F .KeyInfo :SetSize (self .KeyInfo .Width , self .KeyInfo .Height )
226224 self :ApplyTextSettings (F .KeyInfo .KeyLevel , self .KeyLevel , keyLevel )
227225 self :ApplyTextSettings (F .KeyInfo .DungeonName , self .DungeonName , DungeonName , false , F .KeyInfo )
@@ -261,7 +259,7 @@ function MPT:UpdateTimerBar(Start, Completion, preview)
261259 local now = GetTime ()
262260 self .timer = preview and math.random (900 , 2000 ) or select (2 , GetWorldElapsedTime (1 ))
263261 self .timelimit = preview and 2280 or self .timelimit or 0
264- local chest = (C_ChallengeMode .GetChallengeCompletionInfo ().onTime and C_ChallengeMode .GetChallengeCompletionInfo .keystoneUpgradeLevels )
262+ local chest = (C_ChallengeMode .GetChallengeCompletionInfo ().onTime and C_ChallengeMode .GetChallengeCompletionInfo () .keystoneUpgradeLevels )
265263 or (self .timer >= self .timelimit and 0 )
266264 or (self .timer >= self .timelimit * 0.8 and 1 )
267265 or (self .timer >= self .timelimit * 0.6 and 2 )
@@ -274,8 +272,7 @@ function MPT:UpdateTimerBar(Start, Completion, preview)
274272 self .timelimit = preview and 2280 or select (3 , C_ChallengeMode .GetMapUIInfo (self .cmap ))
275273 local timeremain = self .timelimit - self .timer
276274 local parent = (self .TimerBar .AnchoredTo == " MainFrame" and F ) or (self .TimerBar .AnchoredTo == " Bosses" and F [" Bosses" ..# self .BossNames ]) or F [self .TimerBar .AnchoredTo ]
277- local yOffset = parent == F and 0 or parent :GetHeight ()
278- self :SetPoint (F .TimerBar , self .TimerBar .Anchor , parent , self .TimerBar .RelativeTo , self .TimerBar .xOffset , - yOffset + self .TimerBar .yOffset - 1 )
275+ self :SetPoint (F .TimerBar , self .TimerBar .Anchor , parent , self .TimerBar .RelativeTo , self .TimerBar .xOffset , self .TimerBar .yOffset - 1 )
279276 F .TimerBar :SetSize (self .TimerBar .Width , self .TimerBar .Height )
280277 F .TimerBar :SetStatusBarTexture (self .LSM :Fetch (" statusbar" , self .TimerBar .Texture ))
281278 F .TimerBar :SetStatusBarColor (unpack (self .TimerBar .Color [chest + 1 ]))
@@ -298,34 +295,16 @@ function MPT:UpdateTimerBar(Start, Completion, preview)
298295 end
299296 if Completion or preview then
300297 self .started = false
301- local time = C_ChallengeMode .GetChallengeCompletionInfo ().time
302-
303298 -- add pb
304- local cmap = self .cmap
305- local level = self .level
306299 local before = false
307300 local date = C_DateAndTime .GetCurrentCalendarTime ()
308- if cmap and level and not preview then
309- if not self .BestTime then self .BestTime = {} end
310- if not self .BestTime [cmap ] then self .BestTime [cmap ] = {} end
311- if not self .BestTime [cmap ][level ] then self .BestTime [cmap ][level ] = {} end
312- before = self .BestTime [cmap ][level ][" finish" ]
313- if not self .BestTime [cmap ][level ][" finish" ] or time < self .BestTime [cmap ][level ][" finish" ] then
314- self .BestTime [cmap ][level ][" finish" ] = time
315- self .BestTime [cmap ][level ][" forces" ] = time
316- self .BestTime [cmap ][level ][" level" ] = level
317- self .BestTime [cmap ][level ][" date" ] = {date .monthDay , date .month , date .year , date .hour , date .minute }
318- for i , v in ipairs (self .BossTimes ) do
319- self .BestTime [cmap ][level ][i ] = v
320- self .BestTime [cmap ][level ][" BossName" .. i ] = self .BossNames [i ]
321- end
322- end
301+ if self .cmap and self .level and not preview then
302+ before = self :UpdatePB (time , self .cmap , level , date )
323303 end
324-
325304 self .timer = preview and self .timer or time / 1000
326305 local timeremain = self .timelimit - self .timer
327306 local diff = before and (self .finish - before )/ 1000
328- if not preview then F .TimerBar :SetStatusBarColor (unpack (self .TimerBar .Color [chest ])) end
307+ if not preview then F .TimerBar :SetStatusBarColor (unpack (self .TimerBar .Color [chest + 1 ])) end
329308 self :DisplayTimerElements (chest , true , preview , diff )
330309 end
331310 if (not Start ) and (not Completion ) and ((not self .Last ) or self .Last < now - self .UpdateRate ) and (time == 0 ) and self .started then
@@ -349,7 +328,7 @@ function MPT:DisplayTimerElements(chest, completion, preview, diff)
349328 local F = self .Frame
350329 local displayed = 0
351330 F .TimerBar :SetValue (self .timer )
352- self :ApplyTextSettings (F .TimerBar .TimerText , self .TimerText , string.format (" %s/%s" , self :FormatTime (self .timer ), self :FormatTime (self .timelimit )))
331+ self :ApplyTextSettings (F .TimerBar .TimerText , self .TimerText , string.format (" %s/%s" , self :FormatTime (self .timer , completion and 1 ), self :FormatTime (self .timelimit )))
353332 if diff or preview then
354333 local ComparisonTime = preview and math.random (- 200 , 200 ) or diff or " " -- math.random(-200, 200)
355334 local ComparisonColor = ComparisonTime < 0 and self .ComparisonTimer .SuccessColor or ComparisonTime > 0 and self .ComparisonTimer .FailColor or self .ComparisonTimer .EqualColor
@@ -368,7 +347,7 @@ function MPT:DisplayTimerElements(chest, completion, preview, diff)
368347 end
369348 for i = 3 , 1 , - 1 do
370349 local remTime = self .timelimit - self .timer - ((i - 1 )* self .timelimit * 0.2 )
371- 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 not preview )) then
350+ 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
372351 displayed = displayed + 1
373352 local color = i == 1 and remTime < 0 and self [" ChestTimer" .. i ].BehindColor
374353 local prefix = " "
@@ -398,14 +377,13 @@ function MPT:UpdateBosses(Start, count, preview)
398377 for i = 1 , 5 do
399378 EJ_SelectInstance (721 )
400379 local name = EJ_GetEncounterInfoByIndex (i , 721 )
401- name = self :Utf8Sub (name , 20 ) or " Boss " .. i
380+ name = self :Utf8Sub (name , 1 , 20 ) or " Boss " .. i
402381 killtime = killtime + math.random (240 , 420 )
403382 local time = self :FormatTime (killtime , true )
404383 local frame = F [" Bosses" .. i ]
405384 self .BossNames [i ] = name
406- local parent = self .Bosses .AnchoredTo == " MainFrame" and F or F [self .Bosses .AnchoredTo ]
407- local yOffset = parent == F and 0 or parent :GetHeight ()
408- self :SetPoint (frame , self .Bosses .Anchor , parent , self .Bosses .RelativeTo , self .Bosses .xOffset , - yOffset - (i * self .Spacing )- (i - 1 )* (self .Bosses .Height )+ self .Bosses .yOffset )
385+ local parent = self .Bosses .AnchoredTo == " MainFrame" and F or F [self .Bosses .AnchoredTo ]
386+ self :SetPoint (frame , self .Bosses .Anchor , parent , self .Bosses .RelativeTo , self .Bosses .xOffset , - (i * self .Spacing )- (i - 1 )* (self .Bosses .Height )+ self .Bosses .yOffset )
409387 frame :SetSize (self .Bosses .Width , self .Bosses .Height )
410388 local BossColor = i <= 3 and self .BossName .CompletionColor or self .BossName .Color
411389 self :ApplyTextSettings (frame [" BossName" .. i ], self .BossName , name , BossColor )
@@ -464,11 +442,9 @@ function MPT:UpdateBosses(Start, count, preview)
464442 end
465443 if max > 0 then
466444 if C_ScenarioInfo .GetCriteriaInfo (max ) and C_ScenarioInfo .GetCriteriaInfo (max ).isWeightedProgress then max = max - 1 end
467- local cmap = self .cmap
468- local level = self .level
469- local pb = self .BossSplit .enabled and self .BestTime and self .BestTime [cmap ] and (self .BestTime [cmap ][level ] or (self .LowerKey and self .BestTime [cmap ][level - 1 ]))
445+ local pb = self .BossSplit .enabled and self :GetPB (self .cmap , self .level )
470446 for i = 1 , max do
471- local num = (cmap == 370 and i + 4 ) or (cmap == 392 and i + 5 ) or (cmap == 227 and i + 2 ) or (cmap == 234 and i + 6 ) or (cmap == 464 and i + 4 ) or i
447+ local num = (self . cmap == 370 and i + 4 ) or (self . cmap == 392 and i + 5 ) or (self . cmap == 227 and i + 2 ) or (self . cmap == 234 and i + 6 ) or (self . cmap == 464 and i + 4 ) or i
472448 local name = self .BossNames [num ]
473449 local criteria = C_ScenarioInfo .GetCriteriaInfo (i )
474450 for j = 1 , # (self .BossNames ) do
@@ -477,8 +453,8 @@ function MPT:UpdateBosses(Start, count, preview)
477453 break
478454 end
479455 end
480- if cmap == 227 and num == 3 then name = " Opera Hall" end
481- name = self :Utf8Sub (name , self .BossName .MaxLength )
456+ if self . cmap == 227 and num == 3 then name = " Opera Hall" end
457+ name = self :Utf8Sub (name , 1 , self .BossName .MaxLength )
482458 if name and name ~= " " then
483459 local completed = criteria .completed
484460 local defeated = criteria .elapsed
@@ -514,30 +490,32 @@ function MPT:UpdateBosses(Start, count, preview)
514490 end
515491 end
516492 elseif not self .IsPreview then
493+ self .BossTimes = self .BossTimes or {}
517494 local max = select (3 , C_Scenario .GetStepInfo ())
518495 if C_ScenarioInfo .GetCriteriaInfo (max ) and C_ScenarioInfo .GetCriteriaInfo (max ).isWeightedProgress then max = max - 1 end
519- local pb = self .BossSplit .enabled and self . BestTime and self . BestTime [ cmap ] and (self .BestTime [ cmap ][ level ] or ( self .LowerKey and self . BestTime [ cmap ][ level - 1 ]) )
496+ local pb = self .BossSplit .enabled and self : GetPB (self .cmap , self .level )
520497 for i = 1 , max do
521498 local criteria = C_ScenarioInfo .GetCriteriaInfo (i )
522499 if criteria .completed then
523- local defeated = criteria . elapsed
524- local frame = F . Bosses [ i ]
525- frame [ " BossName " .. i ]: SetTextColor ( self . BossName . CompletionColor )
526- if defeated and defeated ~= 0 then
500+ local frame = F [ " Bosses " .. i ]
501+ if frame then
502+ local defeated = criteria . elapsed
503+ frame [ " BossName " .. i ]: SetTextColor ( unpack ( self . BossName . CompletionColor ))
527504 local timercolor = self .BossTimer .Color
528- local time = select (2 , GetWorldElapsedTime (1 ))- defeated or 0
505+ local time = self .BossTimes [i ] or select (2 , GetWorldElapsedTime (1 ))- defeated
506+ self .BossTimes [i ] = time
529507 if pb and pb [i ] then
530508 timercolor = (pb [i ] == time and self .BossTimer .EqualColor ) or (pb [i ] > time and self .BossTimer .SuccessColor ) or self .BossTimer .FailColor
531509 end
532510 self :ApplyTextSettings (frame [" BossTimer" .. i ], self .BossTimer , self :FormatTime (time ), timercolor )
533- end
534- if completed and defeated and defeated ~= 0 and pb and pb [ i ] then
535- local time = select ( 2 , GetWorldElapsedTime ( 1 )) - defeated or 0
536- local splitcolor = (pb [i ] == time and self . BossSplit . EqualColor ) or (pb [i ] > time and self . BossSplit . SuccessColor ) or self . BossSplit . FailColor
537- local prefix = ( pb [ i ] == time and " +-0 " ) or ( pb [i ] > time and " - " ) or " + "
538- local diff = time - pb [ i ]
539- if diff < 0 then diff = diff *- 1 end
540- self : ApplyTextSettings ( frame [ " BossSplit " .. i ], self . BossSplit , prefix .. self : FormatTime ( diff ), splitcolor )
511+ if completed and defeated and defeated ~= 0 and pb and pb [ i ] then
512+ local time = select ( 2 , GetWorldElapsedTime ( 1 )) - defeated or 0
513+ local splitcolor = ( pb [ i ] == time and self . BossSplit . EqualColor ) or ( pb [ i ] > time and self . BossSplit . SuccessColor ) or self . BossSplit . FailColor
514+ local prefix = (pb [i ] == time and " +-0 " ) or (pb [i ] > time and " - " ) or " + "
515+ local diff = time - pb [i ]
516+ if diff < 0 then diff = diff *- 1 end
517+ self : ApplyTextSettings ( frame [ " BossSplit " .. i ], self . BossSplit , prefix .. self : FormatTime ( diff ), splitcolor )
518+ end
541519 end
542520 end
543521 end
@@ -567,8 +545,7 @@ function MPT:UpdateEnemyForces(Start, preview)
567545 if Start or preview then
568546 local bosscount = preview and 5 or # self .BossNames
569547 local parent = (self .ForcesBar .AnchoredTo == " MainFrame" and F ) or (self .ForcesBar .AnchoredTo == " Bosses" and F [" Bosses" ..# self .BossNames ]) or F [self .ForcesBar .AnchoredTo ]
570- local yOffset = parent == F and 0 or parent :GetHeight ()
571- self :SetPoint (F .ForcesBar , self .ForcesBar .Anchor , parent , self .ForcesBar .RelativeTo , self .ForcesBar .xOffset , - yOffset - self .Spacing + self .ForcesBar .yOffset )
548+ self :SetPoint (F .ForcesBar , self .ForcesBar .Anchor , parent , self .ForcesBar .RelativeTo , self .ForcesBar .xOffset , - self .Spacing + self .ForcesBar .yOffset )
572549 F .ForcesBar :SetSize (self .ForcesBar .Width , self .ForcesBar .Height )
573550 F .ForcesBar :SetStatusBarTexture (self .LSM :Fetch (" statusbar" , self .ForcesBar .Texture ))
574551 F .ForcesBar :SetBackdropColor (unpack (self .ForcesBar .BackgroundColor ))
@@ -630,6 +607,7 @@ function MPT:UpdateEnemyForces(Start, preview)
630607 F .ForcesBar .Completion :Hide ()
631608 end
632609 else
610+ F .ForcesBar :SetMinMaxValues (0 , total )
633611 F .ForcesBar :SetValue (current )
634612 local forcesColor =
635613 (percent < 20 and self .ForcesBar .Color [1 ]) or
@@ -638,41 +616,45 @@ function MPT:UpdateEnemyForces(Start, preview)
638616 (percent < 80 and self .ForcesBar .Color [4 ]) or
639617 (percent < 100 and self .ForcesBar .Color [5 ]) or self .ForcesBar .CompletionColor
640618 F .ForcesBar :SetStatusBarColor (unpack (forcesColor ))
641- if percent >= 100 and not self .done then
642- local max = select (3 , C_Scenario .GetStepInfo ())
643- local defeat = C_ScenarioInfo .GetCriteriaInfo (max ) and C_ScenarioInfo .GetCriteriaInfo (max ).elapsed or 0
644- local cur = select (2 , GetWorldElapsedTime (1 )) - defeat
645- local cmap = self .cmap
646- local level = self .level
647- local pb = self .BestTime and self .BestTime [cmap ] and (self .BestTime [cmap ][level ] or (self .LowerKey and self .BestTime [cmap ][level - 1 ]))
648- if pb and pb [" forces" ] then
649- local diff = cur - pb [" forces" ]
650- local color = (diff == 0 and self .ForcesSplits .EqualColor ) or (diff < 0 and self .ForcesSplits .SuccessColor ) or self .ForcesSplits .FailColor
651- local prefix = (diff == 0 and " +-0" ) or (diff < 0 and " -" ) or " +"
652- if diff < 0 then diff = diff * - 1 end
653- self :ApplyTextSettings (F .ForcesBar .Splits , self .ForcesSplits , prefix .. self :FormatTime (diff ), color )
654- end
655- self .done = true
656- end
657- local remaining = self .RealCount .remaining and total - current or current
658- local remainingText = self .RealCount .total and string.format (" %s/%s" , remaining , total ) or remaining
659- percent = self .PercentCount .remaining and 100 - percent or percent
660- self :ApplyTextSettings (F .ForcesBar .PercentCount , self .PercentCount , string.format (" %.2f%%" , percent ))
661- self :ApplyTextSettings (F .ForcesBar .RealCount , self .RealCount , remainingText )
662- local completionText = criteria .completed and criteria .elapsed or " "
663- self :ApplyTextSettings (F .ForcesBar .Completion , self .ForcesCompletion , self :FormatTime (completionText ), self .ForcesCompletion .Color )
619+ if percent >= 100 then
620+ if not self .done then
621+ local defeat = C_ScenarioInfo .GetCriteriaInfo (steps ) and C_ScenarioInfo .GetCriteriaInfo (steps ).elapsed or 0
622+ if defeated and defeated ~= 0 then
623+ local cur = select (2 , GetWorldElapsedTime (1 )) - defeat
624+ local pb = self :GetPB (self .cmap , self .level )
625+ if pb and pb [" forces" ] then
626+ local diff = cur - pb [" forces" ]
627+ local color = (diff == 0 and self .ForcesSplits .EqualColor ) or (diff < 0 and self .ForcesSplits .SuccessColor ) or self .ForcesSplits .FailColor
628+ local prefix = (diff == 0 and " +-0" ) or (diff < 0 and " -" ) or " +"
629+ if diff < 0 then diff = diff * - 1 end
630+ self :ApplyTextSettings (F .ForcesBar .Splits , self .ForcesSplits , prefix .. self :FormatTime (diff ), color )
631+ end
632+ self .done = true
633+ local completionText = criteria .completed and self :FormatTime (criteria .elapsed ) or " "
634+ self :ApplyTextSettings (F .ForcesBar .Completion , self .ForcesCompletion , completionText , self .ForcesCompletion .Color )
635+ end
636+ end
637+ F .ForcesBar .PercentCount :Hide ()
638+ F .ForcesBar .RealCount :Hide ()
639+ elseif not self .done then
640+ local remaining = self .RealCount .remaining and total - current or current
641+ local remainingText = self .RealCount .total and string.format (" %s/%s" , remaining , total ) or remaining
642+ percent = self .PercentCount .remaining and 100 - percent or percent
643+ self :ApplyTextSettings (F .ForcesBar .PercentCount , self .PercentCount , string.format (" %.2f%%" , percent ))
644+ self :ApplyTextSettings (F .ForcesBar .RealCount , self .RealCount , remainingText )
645+ end
664646 end
665647end
666648
667649function MPT :UpdatePBInfo (preview )
668- local pb = self . BestTime and self . BestTime [ self . cmap ] and (self .BestTime [ self . cmap ][ self . level ] or ( self .LowerKey and self . BestTime [ self . cmap ][ self . level - 1 ]) )
650+ local pb = self : GetPB (self .cmap , self .level )
669651 local F = self .Frame
670652 F .ForcesBar .PBInfo :Hide ()
671653 if preview or (pb and pb .finish ) then
672654 local level = preview and 29 or self .level
673- local mapname = preview and " Halls of Valor" or (cmap and self .maptoID [cmap ] and self .maptoID [cmap ][2 ]) or " "
655+ local mapname = preview and " Halls of Valor" or (self . cmap and self .maptoID [self . cmap ] and self .maptoID [self . cmap ][2 ]) or " "
674656 local finishtime = preview and math.random (1500000 , 2000000 ) or pb .finish
675- local date = MPT :GetDateFormat (preview and {11 , 10 , 2025 , 17 , 30 } or pb .date )
657+ local date = self :GetDateFormat (preview and {11 , 10 , 2025 , 17 , 30 } or pb .date )
676658 text = string.format (" PB: +%s %s %s" , level , self :FormatTime (finishtime / 1000 ), date )
677659 local parent = (self .PBInfo .AnchoredTo == " MainFrame" and F ) or (self .PBInfo .AnchoredTo == " Bosses" and F [" Bosses" ..# self .BossNames ]) or F [self .PBInfo .AnchoredTo ]
678660 self :ApplyTextSettings (F .ForcesBar .PBInfo , self .PBInfo , text , false , parent )
0 commit comments