-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDisplay.lua
More file actions
792 lines (769 loc) · 44.8 KB
/
Display.lua
File metadata and controls
792 lines (769 loc) · 44.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
local _, MPT = ...
local L = LibStub("AceLocale-3.0"):GetLocale("MPlusTimer") --
local LSM = LibStub("LibSharedMedia-3.0")
function MPT:HideBossFrames()
local F = self.Frame
for i=1, 20 do
local frame = F["Bosses"..i]
if frame then
frame:Hide()
frame["BossName"..i]:SetText("")
frame["BossTimer"..i]:SetText("")
frame["BossSplit"..i]:SetText("")
end
end
end
function MPT:Init(preview)
self:SetKeyInfo(true)
self.opened = false
self.QuarryTime = false
self.IsPreview = preview
self.PreviousMaxBossFrame = 0
local time = C_ChallengeMode.GetChallengeCompletionInfo().time
if time == 0 then -- prevent setting this to false on completion
self.done = false
self:CreateStates(preview)
end
end
function MPT:SetKeyInfo(init)
if init or (not self.cmap) or (not self.level) or (not self.affixes) or self.level == 0 or self.affixes == {} then
self.cmap = C_ChallengeMode.GetActiveChallengeMapID()
self.level, self.affixes = C_ChallengeMode.GetActiveKeystoneInfo()
end
end
function MPT:UpdateAllStates(preview)
self:UpdateMainFrame()
self:UpdateBosses(true, (not preview) and 1, preview)
self:UpdateKeyInfo(true, false, preview)
self:UpdateTimerBar(true, false, preview)
self:UpdateEnemyForces(true, preview)
self:UpdatePBInfo(preview)
self:UpdateMainFrame(true)
self:MoveFrame(preview)
self:ShowFrame(true)
end
function MPT:CreateStates(preview)
if self.Frame then self.Frame:Hide() end
if not self.Frame then
self.Frame = CreateFrame("Frame", nil, UIParent) -- Main Frame
local F = self.Frame
-- Background Main Frame
F.BG = F:CreateTexture(nil, "BACKGROUND")
-- Background Border Main Frame
F.BGBorder = CreateFrame("Frame", nil, F, "BackdropTemplate")
-- Keystone Info
self:CreateStatusBar(F, "KeyInfo", false, false)
self:CreateText(F.KeyInfo, "KeyLevel", self.KeyLevel)
self:CreateText(F.KeyInfo, "DungeonName", self.DungeonName)
self:CreateText(F.KeyInfo, "AffixIcons", self.AffixIcons)
F.KeyInfo.Icon = CreateFrame("Button", nil, F.KeyInfo)
F.KeyInfo.Icon.Texture = F.KeyInfo.Icon:CreateTexture(nil, "ARTWORK")
self:CreateText(F.KeyInfo, "DeathCounter", self.DeathCounter)
-- Timer Bar
self:CreateStatusBar(F, "TimerBar", true, true)
self:CreateText(F.TimerBarBorder, "TimerText", self.TimerText) -- Current Timer
for i=1, 3 do
self:CreateText(F.TimerBarBorder, "ChestTimer"..i, self["ChestTimer"..i], false, false, i) -- Chest Timer
end
self:CreateText(F.TimerBarBorder, "ComparisonTimer", self.ComparisonTimer) -- Comparison Timer
-- Timer Bar Ticks
F.TimerBar.Ticks = {}
for i=1, 2 do
F.TimerBar.Ticks[i] = F.TimerBar:CreateTexture(nil, "OVERLAY")
F.TimerBar.Ticks[i]:ClearAllPoints()
F.TimerBar.Ticks[i]:SetPoint("TOP")
F.TimerBar.Ticks[i]:SetPoint("BOTTOM")
F.TimerBar.Ticks[i]:Hide()
end
-- Bosses
F.Bosses = {}
-- Enemy Forces
self:CreateStatusBar(F, "ForcesBar", true, true)
self:CreateText(F.ForcesBarBorder, "PercentCount", self.PercentCount)
self:CreateText(F.ForcesBarBorder, "Splits", self.ForcesSplits)
self:CreateText(F.ForcesBarBorder, "RealCount", self.RealCount)
self:CreateText(F.ForcesBarBorder, "Completion", self.ForcesCompletion)
self:CreateStatusBar(F.ForcesBar, "CurrentPullBar", false, false)
-- PB Info
self:CreateText(F.ForcesBar, "PBInfo", self.PBInfo)
-- Move Scripts
F:SetScript("OnDragStart", function(self)
self:StartMoving()
end)
F:SetScript("OnDragStop", function(Frame)
Frame:StopMovingOrSizing()
local Anchor, _, relativeTo, xOffset, yOffset = Frame:GetPoint()
xOffset = math.floor(xOffset * 10 + 0.5) / 10
yOffset = math.floor(yOffset * 10 + 0.5) / 10
self:SetSV({"Position", "xOffset"}, xOffset)
self:SetSV({"Position", "yOffset"}, yOffset)
self:SetSV({"Position", "Anchor"}, Anchor)
self:SetSV({"Position", "relativeTo"}, relativeTo)
self:SetPoint(self.Frame, Anchor, UIParent, relativeTo, xOffset, yOffset)
end)
end
self:UpdateAllStates(preview)
end
function MPT:UpdateMainFrame(BackgroundOnly)
local F = self.Frame
-- Main Frame
if BackgroundOnly then
local spacing = self.Spacing*(self.MaxBossFrame-1)
if self.KeyInfo.AnchoredTo ~= "MainFrame" then spacing = spacing+self.Spacing end
if self.TimerBar.AnchoredTo ~= "MainFrame" then spacing = spacing+self.Spacing end
if self.ForcesBar.AnchoredTo ~= "MainFrame" then spacing = spacing+self.Spacing end
if self.Bosses.AnchoredTo ~= "MainFrame" then spacing = spacing+self.Spacing end
local size = self.TimerBar.Height+self.ForcesBar.Height+self.KeyInfo.Height+(self.Bosses.Height*self.MaxBossFrame)+spacing
F:SetSize(self.TimerBar.Width, size)
F:SetFrameStrata(self.FrameStrata)
if self.Background.enabled then
local w, h = F:GetWidth(), F:GetHeight()
F.BG:SetSize(w+(self.Background.WidthOffset), h+(self.Background.HeightOffset))
self:SetPoint(F.BG, "TOPLEFT", F, "TOPLEFT", self.Background.xOffset, self.Background.yOffset)
F.BG:SetColorTexture(unpack(self.Background.Color))
F.BGBorder:SetFrameLevel(F.KeyInfo:GetFrameLevel()+1)
F.BGBorder:SetAllPoints(F.BG)
F.BGBorder:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = self.Background.BorderSize,
})
F.BGBorder:SetBackdropBorderColor(unpack(self.Background.BorderColor))
F.BG:Show()
F.BGBorder:Show()
else
F.BG:Hide()
F.BGBorder:Hide()
end
else
local maxSize = self.TimerBar.Height+self.ForcesBar.Height+self.KeyInfo.Height+(self.Bosses.Height*5)+(self.Spacing*7)
F:SetSize(self.TimerBar.Width, maxSize)
F:SetScale(self.Scale)
F:SetFrameStrata(self.FrameStrata)
self:SetPoint(F, self.Position.Anchor, UIParent, self.Position.relativeTo, self.Position.xOffset, self.Position.yOffset)
if self.Background.enabled then
F.BG:SetAllPoints(F)
F.BG:SetColorTexture(unpack(self.Background.Color))
F.BGBorder:SetFrameLevel(F.KeyInfo:GetFrameLevel()+1)
F.BGBorder:SetAllPoints(F)
F.BGBorder:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = self.Background.BorderSize,
})
F.BGBorder:SetBackdropBorderColor(unpack(self.Background.BorderColor))
else
F.BG:Hide()
F.BGBorder:Hide()
end
end
end
function MPT:UpdateKeyInfo(Full, Deaths, preview)
local F = self.Frame
if Full then
local AffixDisplay = ""
local deathtext = (preview and "20") or C_ChallengeMode.GetDeathCount()
if preview then
for i=1, 4 do
AffixDisplay = AffixDisplay.."\124T"..select(i, strsplit(" ", "236401 1035055 451169 1385910"))..":"..self.AffixIcons.FontSize..":"..self.AffixIcons.FontSize..":"..1-i..":0:64:64:6:60:6:60\124t"
end
else
local icon = ""
for _, v in pairs(self.affixes) do
if icon == "" then
icon = select(3, C_ChallengeMode.GetAffixInfo(v))
else
icon = icon.." "..select(3, C_ChallengeMode.GetAffixInfo(v))
end
end
for i=1, 4 do
if select(i, strsplit(" ", icon)) then
AffixDisplay = AffixDisplay.."\124T"..select(i, strsplit(" ", icon))..":"..self.AffixIcons.FontSize..":"..self.AffixIcons.FontSize..":"..1-i..":0:64:64:6:60:6:60\124t"
end
end
end
local parent = (self.KeyInfo.AnchoredTo == "MainFrame" and F) or (self.KeyInfo.AnchoredTo == "Bosses" and F["Bosses"..self.MaxBossFrame]) or F[self.KeyInfo.AnchoredTo]
local spacing = parent == F and 0 or self.Spacing
self:SetPoint(F.KeyInfo, self.KeyInfo.Anchor, parent, self.KeyInfo.RelativeTo, self.KeyInfo.xOffset, -spacing+self.KeyInfo.yOffset)
F.KeyInfo:SetSize(self.KeyInfo.Width, self.KeyInfo.Height)
self:ApplyTextSettings(F.KeyInfo.KeyLevel, self.KeyLevel, preview and "+30" or "+"..self.level)
self:ApplyTextSettings(F.KeyInfo.DungeonName, self.DungeonName, preview and L["Halls of Valor"] or self:GetDungeonName(self.cmap), false, F.KeyInfo)
self:ApplyTextSettings(F.KeyInfo.AffixIcons, self.AffixIcons, AffixDisplay, false, F.KeyInfo)
if self.DeathCounter.enabled then
if self.DeathCounter.ShowTimer then
local timelost = preview and 100 or select(2,C_ChallengeMode.GetDeathCount())
if timelost > 0 then
local lostmin = math.floor(timelost/60)
local lostsec = timelost - (lostmin*60)
local mintext = lostmin > 0 and lostmin.."m" or ""
local sectext = lostsec > 0 and lostsec.."s" or ""
local bracket1 = self.DeathCounter.SquareBrackets and "[" or "("
local bracket2 = self.DeathCounter.SquareBrackets and "]" or ")"
sectext = mintext ~= "" and " "..sectext or sectext
deathtext = deathtext.." "..bracket1.."+"..mintext..sectext..bracket2
end
end
self:ApplyTextSettings(F.KeyInfo.DeathCounter , self.DeathCounter, deathtext, false, F.KeyInfo)
else
F.KeyInfo.DeathCounter:Hide()
end
if self.DeathCounter.Iconenabled then
local icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcon_8"
self:SetPoint(F.KeyInfo.Icon, self.DeathCounter.IconAnchor, F.KeyInfo, self.DeathCounter.IconRelativeTo, self.DeathCounter.IconxOffset, self.DeathCounter.IconyOffset)
F.KeyInfo.Icon:SetSize(self.KeyInfo.Height, self.KeyInfo.Height)
F.KeyInfo.Icon.Texture:SetAllPoints(F.KeyInfo.Icon)
F.KeyInfo.Icon.Texture:SetTexture(icon)
F.KeyInfo.Icon:EnableMouse(true)
F.KeyInfo.Icon:SetScript("OnEnter", function(Frame)
local timelost = self:FormatTime(select(2,C_ChallengeMode.GetDeathCount())) or "0:00"
local text = string.format(L["Time lost: %s"], timelost)
local list = {}
self.PlayerDeaths = self.PlayerDeaths or {}
for unit, deaths in pairs(self.PlayerDeaths) do
local color = GetClassColorObj(select(2, UnitClass(unit)))
local name = NSAPI and NSAPI:Shorten(unit, 8) or color:WrapTextInColorCode(UnitName(unit))
table.insert(list, {name, deaths})
end
table.sort(list,
function(a, b)
if a[2] == b[2] then -- sort by name if deathcount is equal
return a[1] > b[1]
else -- otherwise sort by death count
return a[2] > b[2]
end
end)
for _, v in ipairs(list) do
text = text.."\n"..v[1].." "..v[2]
end
GameTooltip:SetOwner(Frame, "ANCHOR_CURSOR")
GameTooltip:SetText(text)
GameTooltip:Show()
end)
F.KeyInfo.Icon:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
F.KeyInfo.Icon:Show()
else
F.KeyInfo.Icon:Hide()
end
end
if Deaths then
if self.DeathCounter.enabled then
local deathtext, timelost = C_ChallengeMode.GetDeathCount()
if self.DeathCounter.ShowTimer then
if timelost > 0 then
local lostmin = math.floor(timelost/60)
local lostsec = timelost - (lostmin*60)
local mintext = lostmin > 0 and lostmin.."m" or ""
local sectext = lostsec > 0 and lostsec.."s" or ""
local bracket1 = self.DeathCounter.SquareBrackets and "[" or "("
local bracket2 = self.DeathCounter.SquareBrackets and "]" or ")"
sectext = mintext ~= "" and " "..sectext or sectext
deathtext = deathtext.." "..bracket1.."+"..mintext..sectext..bracket2
end
end
self:ApplyTextSettings(F.KeyInfo.DeathCounter , self.DeathCounter, deathtext, false, F.KeyInfo)
else
F.KeyInfo.DeathCounter:Hide()
end
end
end
function MPT:UpdateTimerBar(Start, Completion, preview)
local F = self.Frame
local time = C_ChallengeMode.GetChallengeCompletionInfo().time
local now = GetTime()
self.timer = preview and math.random(900, 2000) or select(2, GetWorldElapsedTime(1))
self.timelimit = preview and 2280 or self.timelimit or 0
local chest = (C_ChallengeMode.GetChallengeCompletionInfo().onTime and C_ChallengeMode.GetChallengeCompletionInfo().keystoneUpgradeLevels)
or ((time ~= 0 and not C_ChallengeMode.GetChallengeCompletionInfo().onTime) and 0)
or (self.timer >= self.timelimit and 0)
or (self.timer >= self.timelimit*0.8 and 1)
or (self.timer >= self.timelimit*0.6 and 2)
or 3
if Start or preview then
if time == 0 then
self.started = true
if (self.cmap and self.cmap ~= 0) or preview then
self.timelimit = preview and 2280 or select(3, C_ChallengeMode.GetMapUIInfo(self.cmap))
local timeremain = self.timelimit-self.timer
local parent = (self.TimerBar.AnchoredTo == "MainFrame" and F) or (self.TimerBar.AnchoredTo == "Bosses" and F["Bosses"..self.MaxBossFrame]) or F[self.TimerBar.AnchoredTo]
local spacing = parent == F and 0 or self.Spacing
self:SetPoint(F.TimerBar, self.TimerBar.Anchor, parent, self.TimerBar.RelativeTo, self.TimerBar.xOffset, -spacing+self.TimerBar.yOffset)
F.TimerBar:SetSize(self.TimerBar.Width, self.TimerBar.Height)
F.TimerBar:SetStatusBarTexture(self.LSM:Fetch("statusbar", self.TimerBar.Texture))
F.TimerBar:SetStatusBarColor(unpack(self.TimerBar.Color[chest+1]))
F.TimerBar:SetBackdropColor(unpack(self.TimerBar.BackgroundColor))
F.TimerBarBorder:ClearAllPoints()
F.TimerBarBorder:SetPoint("TOPLEFT", 0, 0)
F.TimerBarBorder:SetPoint("BOTTOMRIGHT", 0, 0)
F.TimerBarBorder:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = self.TimerBar.BorderSize
})
F.TimerBarBorder:SetBackdropBorderColor(unpack(self.TimerBar.BorderColor))
-- Text on Timer Bar
local percTime = self.timer/self.timelimit
F.TimerBar:SetMinMaxValues(0, self.timelimit)
self:DisplayTimerElements(chest)
end
end
end
if Completion or preview then
self.started = false
-- add pb
local before = false
local date = C_DateAndTime.GetCurrentCalendarTime()
if (self.cmap and self.level) and not preview then
before = self:UpdatePB(time, self.forcesTime, self.cmap, self.level, date, self.BossTimes, self.BossNames)
end
self.timer = preview and self.timer or time/1000
local diff = before and (time-before)/1000
if not preview then F.TimerBar:SetStatusBarColor(unpack(self.TimerBar.Color[chest+1])) end
self:DisplayTimerElements(chest, true, preview, diff)
end
if (not Start) and (not Completion) and ((not self.Last) or self.Last < now-self.UpdateRate) and (time == 0) and self.started then
self.last = now
if (not self.lasttimer) or self.lasttimer ~= self.timer then
self:SetKeyInfo()
self.lasttimer = self.timer
local timeremain = self.timelimit-self.timer
F.TimerBar:SetStatusBarColor(unpack(self.TimerBar.Color[chest+1]))
self:DisplayTimerElements(chest, false, preview)
return true
end
end
end
function MPT:DisplayTimerElements(chest, completion, preview, diff)
local F = self.Frame
local displayed = 0
F.TimerBar:SetValue(self.timer)
local timertext = self:FormatTime(math.floor(self.timer))
if completion and self.TimerText.Decimals > 0 then
local timeMS = self.timer and select(2, strsplit(".", (self.timer)))
timeMS = timeMS and (".%s"):format(string.sub(timeMS, 1, self.TimerText.Decimals))
timertext = timeMS and ("%s%s"):format(timertext, timeMS) or timertext
end
local upgrades = completion and C_ChallengeMode.GetChallengeCompletionInfo().keystoneUpgradeLevels or 0
local timercolor = ((not preview) and completion and (C_ChallengeMode.GetChallengeCompletionInfo().onTime and self.TimerText.SuccessColor or self.TimerText.FailColor)) or self.TimerText.Color
timertext = self.TimerText.Space and string.format("%s / %s", timertext, self:FormatTime(self.timelimit)) or string.format("%s/%s", timertext, self:FormatTime(self.timelimit))
self:ApplyTextSettings(F.TimerBarBorder.TimerText, self.TimerText, timertext, timercolor)
if diff or preview then
local ComparisonTime = preview and math.random(-200, 200) or diff or 0 -- math.random(-200, 200)
local ComparisonColor = (ComparisonTime < 0 and self.ComparisonTimer.SuccessColor) or (ComparisonTime > 0 and self.ComparisonTimer.FailColor) or self.ComparisonTimer.EqualColor
local prefix = ""
if ComparisonTime < 0 then
ComparisonTime = ComparisonTime*-1
prefix = "-"
elseif ComparisonTime > 0 then
prefix = "+"
end
self:ApplyTextSettings(F.TimerBarBorder.ComparisonTimer, self.ComparisonTimer, string.format("%s%s", prefix, ComparisonTime == 0 and "+-0" or self:FormatTime(ComparisonTime, true)), ComparisonColor)
else
F.TimerBarBorder.ComparisonTimer:Hide()
end
for i=3, 1, -1 do
local remTime = self.timelimit-self.timer-((i-1)*self.timelimit*0.2)
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
displayed = displayed +1
local color = i == 1 and remTime < 0 and self["ChestTimer"..i].BehindColor
local prefix = ""
if remTime < 0 then prefix = "+" remTime = remTime*-1 end
if completion then
color = (preview and self["ChestTimer"..i].Color) or (upgrades < i and self["ChestTimer"..i].BehindColor or self["ChestTimer"..i].AheadColor)
prefix = (preview and "") or (upgrades < i and "+" or "-")
end
self:ApplyTextSettings(F.TimerBarBorder["ChestTimer"..i], self["ChestTimer"..i], prefix..self:FormatTime(remTime), color, false, i)
else
F.TimerBarBorder["ChestTimer"..i]:Hide()
end
if i > 1 and self["Tick"..i-1].enabled and chest >= i then
F.TimerBar.Ticks[i-1]:SetColorTexture(unpack(self["Tick"..i-1].Color))
F.TimerBar.Ticks[i-1]:SetWidth(self["Tick"..i-1].Width)
F.TimerBar.Ticks[i-1]:SetHeight(self.TimerBar.Height)
self:SetPoint(F.TimerBar.Ticks[i-1], "LEFT", F.TimerBar, "LEFT", (i == 2 and self.TimerBar.Width*0.8) or (i == 3 and self.TimerBar.Width*0.6) , 0)
F.TimerBar.Ticks[i-1]:Show()
elseif i >= 2 then
F.TimerBar.Ticks[i-1]:Hide()
end
end
end
function MPT:UpdateBosses(Start, count, preview)
local F = self.Frame
if preview then
local killtime = 0
self.BossNames = {}
self.MaxBossFrame = 5
self:HideBossFrames()
for i=1, 5 do
EJ_SelectInstance(721)
local name = EJ_GetEncounterInfoByIndex(i, 721)
name = self:Utf8Sub(name, 1, 20) or string.format(L["Boss %s"], i)
killtime = killtime+math.random(240, 420)
local time = self:FormatTime(killtime, true)
local frame = self:CreateBossFrame(i)
self.BossNames[i] = name
local parent = self.Bosses.AnchoredTo == "MainFrame" and F or F[self.Bosses.AnchoredTo]
local spacing = parent == F and i == 1 and 0 or self.Spacing -- only use spacing if not anchored to main frame or not first boss
self:SetPoint(frame, self.Bosses.Anchor, parent, self.Bosses.RelativeTo, self.Bosses.xOffset, -(i*spacing)-(i-1)*(self.Bosses.Height)+self.Bosses.yOffset)
frame:SetSize(self.Bosses.Width, self.Bosses.Height)
local BossColor = i <= 3 and self.BossName.CompletionColor or self.BossName.Color
self:ApplyTextSettings(frame["BossName"..i], self.BossName, name, BossColor)
local timercolor = (i == 1 and self.BossTimer.FailColor) or (i == 2 and self.BossTimer.EqualColor) or (i == 3 and self.BossTimer.SuccessColor) or self.BossTimer.Color
local splitcolor = (i == 1 and self.BossSplit.FailColor) or (i == 2 and self.BossSplit.EqualColor) or (i == 3 and self.BossSplit.SuccessColor) or self.BossSplit.Color
local splittext = (i == 2 and "+-0") or (i == 1 and "+"..self:FormatTime(math.random(20, 60))) or (i == 3 and "-"..self:FormatTime(math.random(20, 60)))
self:ApplyTextSettings(frame["BossTimer"..i], self.BossTimer, time, timercolor)
frame:Show()
if splittext then self:ApplyTextSettings(frame["BossSplit"..i], self.BossSplit, splittext, splitcolor) end
end
elseif Start and not self.IsPreview then
self:SetKeyInfo()
self.BossSplitted = {}
self.BossTimes = {}
self.BossNames = {}
local max = select(3, C_Scenario.GetStepInfo())
if C_ScenarioInfo.GetCriteriaInfo(max) and C_ScenarioInfo.GetCriteriaInfo(max).isWeightedProgress then max = max-1 end -- if last criteria is enemy forces
local mapID = C_Map.GetBestMapForUnit("player")
if count <= 4 then -- check again in 2 seconds a few times to make sure data is correct
C_Timer.After(2, function()
self:UpdateBosses(true, count+1)
end)
end
self:HideBossFrames()
self.MaxBossFrame = 0
if max > 0 then
if C_ScenarioInfo.GetCriteriaInfo(max) and C_ScenarioInfo.GetCriteriaInfo(max).isWeightedProgress then max = max-1 end
local pb = self.BossSplit.enabled and self:GetPB(self.cmap, self.level, self.seasonID, MPTSV.LowerKey)
local pb2 = self.BossTimer.enabled and self:GetPB(self.cmap, self.level, self.seasonID, MPTSV.LowerKey)
for i=1, max do
-- manually offset which bossname we want for megadungeons
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
-- limit how many bosses to show for some of the lower parts of megadungeons
local maxbosses = (self.cmap == 391 and 5) or (self.cmap == 463 and 4) or (self.cmap == 227 and 3) or (self.cmap == 369 and 4)
local criteria = C_ScenarioInfo.GetCriteriaInfo(i)
local name = criteria.description and criteria.description:match("^(.+)%s+%S+$") or criteria.description
self.BossNames[i] = name
if self.cmap == 227 and num == 3 then name = L["Opera Hall"] end
if name and name ~= "" and ((not maxbosses) or i <= maxbosses) then
name = self:Utf8Sub(name, 1, self.BossName.MaxLength)
self.MaxBossFrame = i
local completed = criteria.completed
local defeated = criteria.elapsed
local frame = self:CreateBossFrame(i)
local parent = self.Bosses.AnchoredTo == "MainFrame" and F or F[self.Bosses.AnchoredTo]
local spacing = parent == F and 0 or self.Spacing
self:SetPoint(frame, self.Bosses.Anchor, parent, self.Bosses.RelativeTo, self.Bosses.xOffset, -(i*spacing)-(i-1)*(self.Bosses.Height)+self.Bosses.yOffset)
frame:SetSize(self.Bosses.Width, self.Bosses.Height)
local BossColor = completed and self.BossName.CompletionColor or self.BossName.Color
self:ApplyTextSettings(frame["BossName"..i], self.BossName, name, BossColor)
if not completed then
frame["BossTimer"..i]:SetText("")
frame["BossSplit"..i]:SetText("")
end
if self.cmap == 556 and i == 3 then -- Pit of Saron Quarry liberated display
self:ApplyTextSettings(frame["BossTimer"..i], self.BossTimer, criteria.quantityString.."/"..criteria.totalQuantity, BossColor)
elseif pb2 and pb2[i] then
local time = completed and (self.BossTimes[i] or select(2, GetWorldElapsedTime(1))-defeated) or pb2[i]
local timercolor = completed and ((pb2[i] == time and self.BossTimer.EqualColor) or (pb2[i] > time and self.BossTimer.SuccessColor) or self.BossTimer.FailColor) or self.BossTimer.Color
self:ApplyTextSettings(frame["BossTimer"..i], self.BossTimer, self:FormatTime(time), timercolor)
elseif completed then
local time = self.BossTimes[i] or select(2, GetWorldElapsedTime(1))-defeated or 0
local timercolor = self.BossTimer.SuccessColor -- if there is no pb the default color should be the "success" color
self:ApplyTextSettings(frame["BossTimer"..i], self.BossTimer, self:FormatTime(time), timercolor)
end
if completed and defeated and pb and pb[i] and not self.BossSplitted[i] then
local time = self.BossTimes[i] or select(2, GetWorldElapsedTime(1))-defeated or 0
if self.cmap == 556 and i == 3 then time = select(2, GetWorldElapsedTime(1)) end -- This one doesn't give info about the actual completion
local splitcolor = (pb[i] == time and self.BossSplit.EqualColor) or (pb[i] > time and self.BossSplit.SuccessColor) or self.BossSplit.FailColor
local prefix = (pb[i] == time and "+-0") or (pb[i] > time and "-") or "+"
local diff = time-pb[i]
if diff < 0 then diff = diff*-1 end
self:ApplyTextSettings(frame["BossSplit"..i], self.BossSplit, prefix..self:FormatTime(diff), splitcolor)
else
frame["BossSplit"..i]:SetText("")
end
if completed then
self.BossSplitted[i] = true
if self.cmap == 556 and i == 3 then
self.BossTimes[i] = self.QuarryTime or select(2, GetWorldElapsedTime(1))
else
self.BossTimes[i] = self.BossTimes[i] or select(2, GetWorldElapsedTime(1))-defeated
end
end
frame:Show()
end
end
if self.MaxBossFrame == 0 then
local frame = self:CreateBossFrame(1)
frame:Show()
self.MaxBossFrame = 1
end
if self.MaxBossFrame ~= self.PreviousMaxBossFrame then -- re-anchor other elements if they are anchored to Bosses
if self.KeyInfo.AnchoredTo == "Bosses" then self:UpdateKeyInfo(true, true) end
if self.TimerBar.AnchoredTo == "Bosses" then self:UpdateTimerBar(true) end
if self.ForcesBar.AnchoredTo == "Bosses" then self:UpdateEnemyForces(true) end
self:UpdateMainFrame(true)
end
self.PreviousMaxBossFrame = self.MaxBossFrame
end
elseif not self.IsPreview then
self.BossTimes = self.BossTimes or {}
local max = select(3, C_Scenario.GetStepInfo())
if C_ScenarioInfo.GetCriteriaInfo(max) and C_ScenarioInfo.GetCriteriaInfo(max).isWeightedProgress then max = max-1 end
local pb = self.BossSplit.enabled and self:GetPB(self.cmap, self.level, self.seasonID, MPTSV.LowerKey)
for i=1, max do
local criteria = C_ScenarioInfo.GetCriteriaInfo(i)
if criteria.completed and not self.BossSplitted[i] then
local frame = self:CreateBossFrame(i)
local defeated = criteria.elapsed
frame["BossName"..i]:SetTextColor(unpack(self.BossName.CompletionColor))
local timercolor = self.BossTimer.SuccessColor -- if there is no pb the default color should be the "success" color
local time = self.BossTimes[i] or select(2, GetWorldElapsedTime(1))-defeated
if self.cmap == 556 and i == 3 then -- Pit of Saron Quarry returns info about 1/6 instead of 6/6 so gotta store the value on completion.
time = self.QuarryTime or select(2, GetWorldElapsedTime(1))
self.QuarryTime = time
end
self.BossTimes[i] = time
if pb and pb[i] then
timercolor = (pb[i] == time and self.BossTimer.EqualColor) or (pb[i] > time and self.BossTimer.SuccessColor) or self.BossTimer.FailColor
end
self:ApplyTextSettings(frame["BossTimer"..i], self.BossTimer, self:FormatTime(time), timercolor)
if defeated and pb and pb[i] then
local splitcolor = (pb[i] == time and self.BossSplit.EqualColor) or (pb[i] > time and self.BossSplit.SuccessColor) or self.BossSplit.FailColor
local prefix = (pb[i] == time and "+-0") or (pb[i] > time and "-") or "+"
local diff = time-pb[i]
if diff < 0 then diff = diff*-1 end
self:ApplyTextSettings(frame["BossSplit"..i], self.BossSplit, prefix..self:FormatTime(diff), splitcolor)
end
self.BossSplitted[i] = true
elseif self.cmap == 556 and i == 3 and not self.BossSplitted[i] then -- Quarry Camps in Pit of Saron
local frame = self:CreateBossFrame(i)
self:ApplyTextSettings(frame["BossTimer"..i], self.BossTimer, criteria.quantityString.."/"..criteria.totalQuantity, self.BossName.Color)
end
end
end
end
function MPT:UpdateEnemyForces(Start, preview, completion)
local F = self.Frame
local steps = preview and 5 or select(3, C_Scenario.GetStepInfo())
if not steps or steps <= 0 then
return
end
local criteria = preview and {} or C_ScenarioInfo.GetCriteriaInfo(steps)
local total = preview and 550 or criteria.totalQuantity
self.totalcount = total
local current = preview and math.random(100, 450) or criteria.quantityString:gsub("%%", "")
current = tonumber(current)
local percent = 0
if current then
percent = (current / total) * 100
end
if Start or preview then
local parent = (self.ForcesBar.AnchoredTo == "MainFrame" and F) or (self.ForcesBar.AnchoredTo == "Bosses" and F["Bosses"..self.MaxBossFrame]) or F[self.ForcesBar.AnchoredTo]
local spacing = parent == F and 0 or self.Spacing
self:SetPoint(F.ForcesBar, self.ForcesBar.Anchor, parent, self.ForcesBar.RelativeTo, self.ForcesBar.xOffset, -spacing+self.ForcesBar.yOffset)
F.ForcesBar:SetSize(self.ForcesBar.Width, self.ForcesBar.Height)
F.ForcesBar:SetStatusBarTexture(self.LSM:Fetch("statusbar", self.ForcesBar.Texture))
F.ForcesBar:SetBackdropColor(unpack(self.ForcesBar.BackgroundColor))
F.ForcesBarBorder:ClearAllPoints()
F.ForcesBarBorder:SetPoint("TOPLEFT", 0, 0)
F.ForcesBarBorder:SetPoint("BOTTOMRIGHT", 0, 0)
F.ForcesBarBorder:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = self.ForcesBar.BorderSize
})
F.ForcesBarBorder:SetBackdropBorderColor(unpack(self.ForcesBar.BorderColor))
F.ForcesBar:SetMinMaxValues(0, total)
F.ForcesBar:SetValue(current)
local forcesColor =
(percent < 20 and self.ForcesBar.Color[1]) or
(percent < 40 and self.ForcesBar.Color[2]) or
(percent < 60 and self.ForcesBar.Color[3]) or
(percent < 80 and self.ForcesBar.Color[4]) or
(percent < 100 and self.ForcesBar.Color[5]) or self.ForcesBar.CompletionColor
F.ForcesBar:SetStatusBarColor(unpack(forcesColor))
local completed = percent >= 100
local remaining = self.RealCount.remaining and total-current or current
local remainingText = self.RealCount.total and string.format("%s/%s", remaining, total) or remaining
local percentText = self.PercentCount.remaining and 100-percent or percent
local currentPull = preview and math.random(50, 120) or 0 -- edit this to whatever new API blizzard hopefully comes up with
local currentPullPercent = preview and (currentPull/total)*100 or 0 -- edit this to whatever new API blizzard hopefully comes up with
if not completed then -- protection because I anticipate blizzard's current pull API might still return data if we're already at 100%
local bracket1 = self.RealCount.SquareBrackets and "[" or "("
local bracket2 = self.RealCount.SquareBrackets and "]" or ")"
if self.RealCount.afterPull then
local afterpull = self.RealCount.remaining and (total-(current+currentPull)) or (current+currentPull)
remainingText = self.RealCount.pullcount and currentPull and currentPull > 0 and string.format("%s "..bracket1.."%s"..bracket2, remainingText, afterpull) or remainingText
else
local prefix = self.RealCount.remaining and "-" or "+"
remainingText = self.RealCount.pullcount and currentPull and currentPull > 0 and string.format("%s "..bracket1.."%s%s"..bracket2, remainingText, prefix, currentPull) or remainingText
end
bracket1 = self.PercentCount.SquareBrackets and "[" or "("
bracket2 = self.PercentCount.SquareBrackets and "]" or ")"
if self.PercentCount.afterPull then
local afterpull = self.PercentCount.remaining and (100-((current+currentPull)/total)*100) or (((current+currentPull)/total)*100)
percentText = self.PercentCount.pullcount and currentPullPercent and currentPullPercent > 0 and string.format("%.2f%% "..bracket1.."%.2f%%"..bracket2, percentText, afterpull) or string.format("%.2f%%", percentText)
else
local percentprefix = self.PercentCount.remaining and "-" or "+"
percentText = self.PercentCount.pullcount and currentPullPercent and currentPullPercent > 0 and string.format("%.2f%% "..bracket1.."%s%.2f%%"..bracket2, percentText, percentprefix, currentPullPercent) or string.format("%.2f%%", percentText)
end
end
self:ApplyTextSettings(F.ForcesBarBorder.PercentCount, self.PercentCount, percentText)
self:ApplyTextSettings(F.ForcesBarBorder.RealCount, self.RealCount, remainingText)
F.ForcesBar:Show()
if self.CurrentPullBar.enabled and currentPull and currentPull > 0 and currentPullPercent and currentPullPercent > 0 and current < total then
local xOffset = (F.ForcesBar:GetValue()/total)*F.ForcesBar:GetWidth()
F.ForcesBar.CurrentPullBar:SetSize(self.ForcesBar.Width-xOffset, self.ForcesBar.Height)
F.ForcesBar.CurrentPullBar:ClearAllPoints()
self:SetPoint(F.ForcesBar.CurrentPullBar, "LEFT", F.ForcesBar, "LEFT", xOffset, 0)
F.ForcesBar.CurrentPullBar:SetStatusBarTexture(self.LSM:Fetch("statusbar", self.CurrentPullBar.Texture))
F.ForcesBar.CurrentPullBar:SetMinMaxValues(0, total-current) -- set max to remaining forces
F.ForcesBar.CurrentPullBar:SetValue(currentPull)
F.ForcesBar.CurrentPullBar:SetStatusBarColor(unpack(self.CurrentPullBar.Color))
F.ForcesBar.CurrentPullBar:SetFrameLevel(F.ForcesBar:GetFrameLevel())
F.ForcesBar.CurrentPullBar:Show()
else
F.ForcesBar.CurrentPullBar:Hide()
end
if preview then
local diff = math.random(-200, 200)
local color = (diff == 0 and self.ForcesSplits.EqualColor) or (diff < 0 and self.ForcesSplits.SuccessColor) or self.ForcesSplits.FailColor
local prefix = (diff == 0 and "+-0") or (diff < 0 and "-") or "+"
if diff < 0 then diff = diff * -1 end
self:ApplyTextSettings(F.ForcesBarBorder.Splits, self.ForcesSplits, prefix..self:FormatTime(diff), color)
self:ApplyTextSettings(F.ForcesBarBorder.Completion, self.ForcesCompletion, self:FormatTime(math.random(900, 2000)), self.ForcesCompletion.Color)
else
F.ForcesBarBorder.Splits:Hide()
F.ForcesBarBorder.Completion:Hide()
end
else
percent = completion and 100 or percent
count = completion and total or count
local forcesColor =
(percent < 20 and self.ForcesBar.Color[1]) or
(percent < 40 and self.ForcesBar.Color[2]) or
(percent < 60 and self.ForcesBar.Color[3]) or
(percent < 80 and self.ForcesBar.Color[4]) or
(percent < 100 and self.ForcesBar.Color[5]) or self.ForcesBar.CompletionColor
if percent >= 100 or criteria.completed then
local cur = criteria.elapsed and select(2, GetWorldElapsedTime(1)) - criteria.elapsed
local pb = self.ForcesSplits.enabled and self:GetPB(self.cmap, self.level, self.seasonID, MPTSV.LowerKey)
if pb and pb["forces"] and not self.done then
local diff = cur - pb["forces"]
local color = (diff == 0 and self.ForcesSplits.EqualColor) or (diff < 0 and self.ForcesSplits.SuccessColor) or self.ForcesSplits.FailColor
local prefix = (diff == 0 and "+-0") or (diff < 0 and "-") or "+"
if diff < 0 then diff = diff * -1 end
self:ApplyTextSettings(F.ForcesBarBorder.Splits, self.ForcesSplits, prefix..self:FormatTime(diff), color)
end
if not self.done then
self.forcesTime = cur or 0
local completionText = cur and self:FormatTime(cur) or ""
self:ApplyTextSettings(F.ForcesBarBorder.Completion, self.ForcesCompletion, completionText, self.ForcesCompletion.Color)
end
self.done = true
F.ForcesBar:SetStatusBarColor(unpack(self.ForcesBar.CompletionColor))
F.ForcesBar:SetMinMaxValues(0, 1)
F.ForcesBar:SetValue(1)
F.ForcesBarBorder.PercentCount:Hide()
F.ForcesBarBorder.RealCount:Hide()
F.ForcesBar.CurrentPullBar:Hide()
elseif not self.done then
local remaining = self.RealCount.remaining and total-current or current
local remainingText = self.RealCount.total and string.format("%s/%s", remaining, total) or remaining
percent = self.PercentCount.remaining and 100-percent or percent
F.ForcesBar:SetStatusBarColor(unpack(forcesColor))
F.ForcesBar:SetMinMaxValues(0, total)
F.ForcesBar:SetValue(current)
self:ApplyTextSettings(F.ForcesBarBorder.PercentCount, self.PercentCount, string.format("%.2f%%", percent))
self:ApplyTextSettings(F.ForcesBarBorder.RealCount, self.RealCount, remainingText)
-- self:UpdateCurrentPull() -- disabled for now until blizzard provides a new API for current pull in Midnight
-- probably have to call this on some other event too
end
end
end
function MPT:UpdatePBInfo(preview)
local pb = self:GetPB(self.cmap, self.level, self.seasonID, MPTSV.LowerKey)
local F = self.Frame
F.ForcesBar.PBInfo:Hide()
if preview or (pb and pb.finish) then
local finishtime = preview and math.random(1500000, 2000000) or pb.finish
local date = self:GetDateFormat(preview and {11, 10, 2025, 17, 30} or pb.date)
local text = string.format(L["PB: +%s %s %s"], preview and 29 or self.level, self:FormatTime(finishtime/1000), date)
local parent = (self.PBInfo.AnchoredTo == "MainFrame" and F) or (self.PBInfo.AnchoredTo == "Bosses" and F["Bosses"..self.MaxBossFrame]) or F[self.PBInfo.AnchoredTo]
self:ApplyTextSettings(F.ForcesBar.PBInfo, self.PBInfo, text, false, parent)
end
end
function MPT:UpdateCurrentPull()
local rawValue, percentValue = 0, 0
for _, value in pairs(self.CurrentPull or {}) do
if value ~= "DEAD" then
rawValue = rawValue + value[1]
percentValue = percentValue + value[2]
end
end
local steps = preview and 5 or select(3, C_Scenario.GetStepInfo())
if not steps or steps <= 0 then
return
end
local criteria = C_ScenarioInfo.GetCriteriaInfo(steps)
local total = criteria.totalQuantity
local current = criteria.quantityString:gsub("%%", "")
current = tonumber(current)
local percent = 0
if current then
percent = current / total * 100
end
local currentPercent = (current/total)*100
local F = self.Frame
local currentText = ""
local percentText = ""
if self.RealCount.enabled and self.RealCount.pullcount and current < total then
local bracket1 = self.RealCount.SquareBrackets and "[" or "("
local bracket2 = self.RealCount.SquareBrackets and "]" or ")"
local color = current + rawValue >= total and self.RealCount.CurrentPullColor or self.RealCount.Color
if self.RealCount.total then
currentText = self.RealCount.remaining and string.format("%s/%s", total-current, total) or string.format("%s/%s", current, total)
else
currentText = self.RealCount.remaining and total-current or current
end
if self.RealCount.afterPull then
local currentValue = current
local countValue = rawValue
if self.RealCount.remaining then
countValue = rawValue * -1
currentValue = total - current
end
currentText = rawValue ~= 0 and string.format("%s "..bracket1.."%s"..bracket2, currentText, currentValue+countValue) or currentText
else
currentText = rawValue ~= 0 and string.format("%s "..bracket1.."%s"..bracket2, currentText, self.RealCount.remaining and "-" or "+", rawValue) or currentText
end
self:ApplyTextSettings(F.ForcesBarBorder.RealCount, self.RealCount, currentText, color)
end
if self.PercentCount.enabled and self.PercentCount.pullcount and current < total then
local bracket1 = self.PercentCount.SquareBrackets and "[" or "("
local bracket2 = self.PercentCount.SquareBrackets and "]" or ")"
local color = current + rawValue >= total and self.PercentCount.CurrentPullColor or self.PercentCount.Color
percentText = string.format("%.2f%%", self.PercentCount.remaining and 100-percent or percent)
if self.PercentCount.afterPull then
if self.PercentCount.remaining then
percentValue = percentValue * -1
percent = 100 - percent
end
percentText = percentValue ~= 0 and string.format("%s "..bracket1.."%.2f%%"..bracket2, percentText, percent+percentValue) or percentText
else
percentText = percentValue ~= 0 and string.format("%s "..bracket1.."%s%.2f%%"..bracket2, percentText, self.PercentCount.remaining and "-" or "+", percentValue) or percentText
end
self:ApplyTextSettings(F.ForcesBarBorder.PercentCount, self.PercentCount, percentText, color)
end
if self.CurrentPullBar.enabled and rawValue and rawValue > 0 and current < total then
local xOffset = (F.ForcesBar:GetValue()/total)*F.ForcesBar:GetWidth()
F.ForcesBar.CurrentPullBar:SetSize(self.ForcesBar.Width-xOffset, self.ForcesBar.Height)
F.ForcesBar.CurrentPullBar:ClearAllPoints()
self:SetPoint(F.ForcesBar.CurrentPullBar, "LEFT", F.ForcesBar, "LEFT", xOffset, 0)
F.ForcesBar.CurrentPullBar:SetStatusBarTexture(self.LSM:Fetch("statusbar", self.CurrentPullBar.Texture))
F.ForcesBar.CurrentPullBar:SetMinMaxValues(0, total-current) -- set max to remaining forces
F.ForcesBar.CurrentPullBar:SetValue(rawValue)
F.ForcesBar.CurrentPullBar:SetStatusBarColor(unpack(self.CurrentPullBar.Color))
F.ForcesBar.CurrentPullBar:SetFrameLevel(F.ForcesBar:GetFrameLevel())
F.ForcesBar.CurrentPullBar:Show()
else
F.ForcesBar.CurrentPullBar:Hide()
end
end