-
Notifications
You must be signed in to change notification settings - Fork 215
Expand file tree
/
Copy pathCrown.lua
More file actions
1034 lines (929 loc) · 33.3 KB
/
Copy pathCrown.lua
File metadata and controls
1034 lines (929 loc) · 33.3 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
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--------------------------------------------------------------------------------
-- Module Declaration
--
local mod, CL = BigWigs:NewBoss("Crown of the Cosmos", 2912, 2738)
if not mod then return end
mod:RegisterEnableMob(240430, 243805, 243810, 243811) -- Alleria, Morium, Demiar, Vorelus
mod:SetEncounterID(3181)
mod:SetRespawnTime(30)
mod:UseCustomTimers(true)
mod:SetStage(1)
mod:SetPrivateAuraSounds({
1233602, -- Silverstrike Arrow (Targetted)
{1232470, 1260027, sound = "alert"}, -- Grasp of Emptiness
1283236, -- Void Expulsion (Targetted)
{1242553, sound = "underyou"}, -- Void Remnants
{1233865, 1233887, sound = "alarm"}, -- Null Corona
{1243753, sound = "alert"}, -- Ravenous Abyss
{1243981, sound = "none"}, -- Silverstrike Barrage
{1234570, sound = "alert"}, -- Stellar Emission
{1246462, sound = "alarm"}, -- Rift Slash
{1238206, sound = "underyou"}, -- Volatile Fissure
{1237623, 1259861}, -- Ranger Captain's Mark (Targetted)
{1237038, sound = "none"}, -- Voidstalker's Sting
{1227557, sound = "underyou"}, -- Devouring Cosmos
1239111, -- Aspect of the End
{1255453, sound = "alarm"}, -- Gravity Collapse
{1238708, sound = "info"}, -- Dark Rush
})
--------------------------------------------------------------------------------
-- Locals
--
local activeBars = {}
local backupBars = {}
local function getBarInfoFromKey(key)
for _, barInfo in next, activeBars do
if barInfo.key == key then
return barInfo
end
end
end
local function updateBar(key, callback, duration)
local barInfo
local oldBarInfo = getBarInfoFromKey(key)
if oldBarInfo then
local oldDuration = type(oldBarInfo.duration) == "table" and oldBarInfo.duration[2] or oldBarInfo.duration
mod:StopBar(oldBarInfo.msg)
activeBars[oldBarInfo.eventID] = nil
barInfo = oldBarInfo
barInfo.duration = {duration, oldDuration}
else
barInfo = mod[callback](mod, duration)
end
return barInfo
end
local timelineEventCount = 0
local durationEventCount = {}
local substage = 1
local silverstrikeArrowCount = 1
local graspOfEmptinessCount = 1
local voidExpulsionCount = 1
local nullCoronaCount = 1
local darkHandCount = 1
local interruptingTremorCount = 1
local ravenousAbyssCount = 1
local silverstrikeBarrageCount = 1
local markCount = 1
local stingCount = 1
local callOfTheVoidCount = 1
local cosmicBarrierCount = 1
local riftSlashCount = 1
local riftSimulacrumCount = 1
local devouringCosmosCount = 1
local aspectOfTheEndCount = 1
local cosmicPortalCount = 1
--------------------------------------------------------------------------------
-- Localization
--
local L = mod:SetDefaultLocale({ -- SetOption:skip-locale
grasp_of_emptiness = "Obelisks",
interrupting_tremor = "Interrupt",
ravenous_abyss = "Move Out",
silverstrike_barrage = "Lines",
cosmic_barrier = "Barrier",
voidstalker_sting = "Stings",
aspect_of_the_end = "Tethers",
devouring_cosmos = "Next Platform",
})
--------------------------------------------------------------------------------
-- Renames
--
mod:SetRenames({
["stages"] = {CL.intermission, CL.stage:format(2), CL.stage:format(3), original = false, notes = {CL.intermission, CL.stage:format(2), CL.stage:format(3)}}, -- Stages
[1233602] = {CL.arrows, CL.you:format(CL.arrow), notes={CL.generalNote, CL.messageOnYouNote}, original = {1233602, CL.you:format(mod:SpellName(1233602))}}, -- Silverstrike Arrow (Arrows)
[1232467] = {L.grasp_of_emptiness}, -- Grasp of Emptiness (Obelisks)
[1255368] = {1255368}, -- Void Expulsion
[1233865] = {CL.heal_absorb}, -- Null Corona (Heal Absorb)
[1233787] = {1233787}, -- Dark Hand
[1243743] = {L.interrupting_tremor, CL.cast:format(L.interrupting_tremor), notes={CL.generalNote, CL.castTimerNote}, original = {1243743, CL.cast:format(mod:SpellName(1243743))}}, -- Interrupting Tremor (Interrupt)
[1243753] = {L.ravenous_abyss}, -- Ravenous Abyss (Move Out)
[1243982] = {L.silverstrike_barrage}, -- Silverstrike Barrage (Lines)
[1237614] = {CL.mark}, -- Ranger Captain's Mark (Mark)
[1237038] = {L.voidstalker_sting}, -- Voidstalker's Sting (Stings)
[1237837] = {1237837}, -- Call of the Void
[1246918] = {L.cosmic_barrier}, -- Cosmic Barrier (Barrier)
[1246461] = {1246461}, -- Rift Slash
[1261016] = {1261016}, -- Rift Simulacrum
[1238843] = {L.devouring_cosmos}, -- Devouring Cosmos (Next Platform)
[1239080] = {L.aspect_of_the_end, CL.you:format(L.aspect_of_the_end), notes={CL.generalNote, CL.messageOnYouNote}, original = {1239080, CL.you:format(mod:SpellName(1239080))}}, -- Aspect of the End (Tethers)
[1261339] = {CL.big_add}, -- Cosmic Portal (Big Add)
})
--------------------------------------------------------------------------------
-- Initialization
--
function mod:GetOptions()
return {
"stages",
-- Stage One: The Void's Spire
1233602, -- Silverstrike Arrow
1232467, -- Grasp of Emptiness
1255368, -- Void Expulsion
{1233865, "HEALER"}, -- Null Corona
{1233787, "TANK"}, -- Dark Hand [Morium]
{1243743, "CASTBAR"}, -- Interrupting Tremor [Demiar]
1243753, -- Ravenous Abyss [Vorelus]
-- Intermission: Crushing Singularity
1243982, -- Silverstrike Barrage
-- Stage Two: The Severed Rift
1237614, -- Ranger Captain's Mark
{1237038, "OFF"}, -- Voidstalker's Sting
1237837, -- Call of the Void
1246918, -- Cosmic Barrier
{1246461, "TANK"}, -- Rift Slash
1261016, -- Rift Simulacrum
-- Stage Three: The End of the End
1238843, -- Devouring Cosmos
1239080, -- Aspect of the End
1261339, -- Cosmic Portal
},{
{ tabName = CL.stage:format(1), { "stages", 1233602, 1232467, 1255368, 1233865, 1233787, 1243743, 1243753 }, },
{ tabName = CL.stage:format(2), { "stages", 1237614, 1255368, 1237038, 1237837, 1246918, 1246461, 1261016 }, },
{ tabName = CL.stage:format(3), { "stages", 1238843, 1239080, 1232467, 1233865, 1237038, 1261016, 1261339 }, },
{ tabName = CL.intermission, { "stages", 1243982, }, },
[1233787] = -32458, -- Morium
[1243743] = -33152, -- Demiar
[1243753] = -33153, -- Vorelus
[1233602] = -32196, -- Stage 1
[1237614] = -32455, -- Stage 2
[1261016] = "mythic",
[1238843] = -32456, -- Stage 3
}
end
function mod:OnBossEnable()
backupBars = {}
if self:Mythic() then
self:RegisterEvent("ENCOUNTER_TIMELINE_EVENT_ADDED", "TimersMythic")
else
self:RegisterEvent("ENCOUNTER_TIMELINE_EVENT_ADDED", "TimersOther")
end
self:RegisterEvent("ENCOUNTER_TIMELINE_EVENT_STATE_CHANGED")
self:RegisterEvent("ENCOUNTER_TIMELINE_EVENT_REMOVED")
end
function mod:OnEncounterStart()
self:SetStage(1)
self:ResetCounts()
substage = 1
devouringCosmosCount = 1
end
function mod:ResetCounts()
timelineEventCount = 0
durationEventCount = {}
silverstrikeArrowCount = 1
graspOfEmptinessCount = 1
voidExpulsionCount = 1
nullCoronaCount = 1
darkHandCount = 1
interruptingTremorCount = 1
ravenousAbyssCount = 1
silverstrikeBarrageCount = 1
markCount = 1
stingCount = 1
callOfTheVoidCount = 1
cosmicBarrierCount = 1
riftSlashCount = 1
riftSimulacrumCount = 1
aspectOfTheEndCount = 1
cosmicPortalCount = 1
end
function mod:OnBossDisable()
for eventID in next, backupBars do
self:SendMessage("BigWigs_StopBar", nil, nil, eventID)
end
end
--------------------------------------------------------------------------------
-- Timeline Event Handlers
--
local prev = 0
function mod:TimersMythic(_, eventInfo)
if eventInfo.source ~= 0 or self:IsWiping() then return end
local barInfo
timelineEventCount = timelineEventCount + 1
local now = GetTime()
local timeSinceLastEvent = now - prev
prev = now
local stage = self:GetStage()
local duration = eventInfo.duration
local durationRoundedOne = self:RoundNumber(duration, 1)
local durationRounded = self:RoundNumber(durationRoundedOne, 0) -- round 1 first to get our .5s to round up instead of .499 rounding down
if stage == 2 and timelineEventCount == 1 then
-- set by IntermissionEnd
if self:ShouldShowBars() then
self:Message("stages", "cyan", self:GetRename("stages", stage), false)
self:PlaySound("stages", "long")
end
self:ResetCounts()
timelineEventCount = 1
elseif stage == 2 and timeSinceLastEvent > 15 then
stage = 3
self:SetStage(stage)
if self:ShouldShowBars() then
self:Message("stages", "cyan", self:GetRename("stages", stage), false)
self:PlaySound("stages", "long")
end
self:ResetCounts()
timelineEventCount = 1
end
if stage == 1 then
-- intermision start
if durationRoundedOne == 1.5 then
barInfo = self:SilverstrikeBarrage(duration)
elseif durationRoundedOne == 25 then -- Stage Two
-- callback sets intermission, resets counts
barInfo = self:IntermissionEvent(duration)
barInfo.timer = self:ScheduleTimer(function() barInfo:onEnd() end, duration)
-- pull timers
elseif durationRoundedOne == 20 then
durationEventCount[durationRoundedOne] = (durationEventCount[durationRoundedOne] or 0) + 1
if durationEventCount[durationRoundedOne] == 1 then
barInfo = self:SilverstrikeArrow(duration)
else
barInfo = self:InterruptingTremor(duration)
end
elseif durationRoundedOne == 4.2 or durationRoundedOne == 103.8 then
barInfo = self:GraspOfEmptiness(duration)
elseif durationRoundedOne == 10 then
barInfo = self:VoidExpulsion(duration)
elseif durationRoundedOne == 1.7 then
barInfo = self:NullCorona(duration)
elseif durationRoundedOne == 4 then
durationEventCount[durationRoundedOne] = (durationEventCount[durationRoundedOne] or 0) + 1
local count = durationEventCount[durationRoundedOne]
if count == 1 then
barInfo = self:InterruptingTremor(duration)
elseif count == 2 then
barInfo = self:DarkHand(duration)
elseif count == 3 then
-- this only gets cast when someone is in range, so the timer events are weird
barInfo = self:RavenousAbyss(duration)
end
-- the order of these can change, so just fire bars for them and we'll
-- figure out the message on the next timer
if barInfo then
if self:ShouldShowBars() then
self:CDBar(barInfo.key, duration, barInfo.msg)
end
return false -- don't want callback to fire
end
-- repeating timers
elseif durationRoundedOne == 17.5 or durationRoundedOne == 19.2 or durationRoundedOne == 19.6 then
barInfo = self:SilverstrikeArrow(duration)
elseif durationRoundedOne == 23.3 or durationRoundedOne == 26.7 or durationRoundedOne == 26.3 or durationRoundedOne == 26.2 or durationRoundedOne == 3.8 or durationRoundedOne == 103.3 then
if durationRoundedOne == 3.8 then
barInfo = updateBar(1232467, "GraspOfEmptiness", duration)
else
barInfo = self:GraspOfEmptiness(duration)
end
elseif durationRoundedOne == 40 then
durationEventCount[durationRoundedOne] = (durationEventCount[durationRoundedOne] or 0) + 1
if durationEventCount[durationRoundedOne] % 2 == 0 then
barInfo = self:NullCorona(duration)
else
barInfo = self:VoidExpulsion(duration)
end
elseif durationRoundedOne == 32.5 or durationRoundedOne == 9.6 then
barInfo = self:VoidExpulsion(duration)
elseif durationRoundedOne == 37.1 or durationRoundedOne == 22.5 or durationRoundedOne == 1.3 or durationRoundedOne == 1.2 then
if durationRoundedOne == 1.3 or durationRoundedOne == 1.2 then
barInfo = updateBar(1233865, "NullCorona", duration)
else
barInfo = self:NullCorona(duration)
end
elseif durationRoundedOne == 26 then
barInfo = self:DarkHand(duration)
elseif durationRoundedOne == 19.5 then
barInfo = self:RavenousAbyss(duration)
end
elseif stage == 2 then
if durationRounded == 13 or durationRounded == 11 then
barInfo = self:GraspOfEmptiness(duration)
elseif durationRounded == 12 or durationRounded == 16 then
if durationRounded == 12 and stingCount == 1 then -- p2 initial timer
barInfo = self:VoidstalkerSting(duration)
else
barInfo = self:RiftSlash(duration)
end
elseif durationRounded == 27 then
barInfo = self:RangerCaptainsMark(duration)
elseif durationRounded == 20 or durationRounded == 18 then
barInfo = self:VoidExpulsion(duration)
elseif durationRounded == 50 then
barInfo = self:CallOfTheVoid(duration)
elseif durationRounded == 2 or durationRounded == 10 or durationRounded == 23 then
if durationRoundedOne == 1.5 then
barInfo = self:RiftSimulacrum(duration)
else
barInfo = self:VoidstalkerSting(duration)
end
elseif durationRounded == 25 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
local count = durationEventCount[durationRounded]
if count % 4 == 1 then
barInfo = self:GraspOfEmptiness(duration)
elseif count % 4 == 2 then
barInfo = self:VoidExpulsion(duration)
else
barInfo = self:RangerCaptainsMark(duration)
end
elseif durationRounded == 6 or durationRounded == 4 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
local count = durationEventCount[durationRounded]
if count % 2 == 1 then -- Rift Slash
barInfo = updateBar(1246461, "RiftSlash", duration)
else -- Call of the Void
barInfo = updateBar(1237837, "CallOfTheVoid", duration)
end
end
elseif stage == 3 then
if durationRounded == 60 or durationRounded == 59 then
-- callback handles substage
barInfo = self:DevouringCosmos(duration)
elseif durationRounded == 10 then
if graspOfEmptinessCount == 1 then -- initial p3 timer
barInfo = self:GraspOfEmptiness(duration)
else
barInfo = self:RiftSimulacrum(duration)
end
elseif durationRounded == 35 or durationRounded == 9 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
local count = durationEventCount[durationRounded]
if durationRounded == 9 and (substage > 1 and count == 1) then -- only try to extend on initial substage timer
barInfo = updateBar(1232467, "GraspOfEmptiness", duration)
else
barInfo = self:GraspOfEmptiness(duration)
end
elseif durationRounded == 7 or durationRounded == 6 or durationRounded == 41 or durationRounded == 19 then
if durationRounded == 6 then
barInfo = updateBar(1239080, "AspectOfTheEnd", duration)
else
barInfo = self:AspectOfTheEnd(duration)
end
elseif durationRounded == 37 or durationRounded == 36 then
barInfo = self:VoidExpulsion(duration)
elseif durationRounded == 16 then
if cosmicPortalCount == 1 then -- initial p3 timer
barInfo = self:CosmicPortal(duration)
elseif durationRoundedOne == 15.5 then
barInfo = self:VoidstalkerSting(duration)
else
barInfo = self:GraspOfEmptiness(duration)
end
elseif durationRounded == 15 then
barInfo = self:CosmicPortal(duration)
elseif durationRounded == 17 and ((substage == 1 and stingCount == 1) or stingCount == 2) then -- initial p3 timer and first recast (actually 16.5)
barInfo = self:VoidstalkerSting(duration)
elseif durationRounded == 30 or durationRounded == 29 then
barInfo = self:NullCorona(duration)
elseif durationRounded == 11 then
barInfo = self:RiftSimulacrum(duration)
elseif durationRounded == 12 then
barInfo = self:VoidstalkerSting(duration)
elseif durationRounded == 14 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
local count = durationEventCount[durationRounded]
if substage == 3 and count % 2 == 1 then
-- XXX if add is killed before the first cast, Voidstalker Sting will use this
-- maybe track if the last Dark Hand got canceled?
barInfo = self:DarkHand(duration)
else
barInfo = self:VoidstalkerSting(duration)
end
-- add casts, bad things probably happen if you have multiple up
elseif riftSimulacrumCount == 2 and (durationRounded == 8 or durationRounded == 17) then -- actually 16.5 but the only other 17 cast is sting 2 which should already be caught
barInfo = self:RavenousAbyss(duration)
elseif riftSimulacrumCount == 3 and (durationRounded == 8 or durationRounded == 17) then -- all but the first 17 for substage 2
barInfo = self:InterruptingTremor(duration)
elseif durationRounded == 20 then
if riftSimulacrumCount == 4 then
barInfo = self:DarkHand(duration)
elseif riftSimulacrumCount == 5 then
interruptingTremorCount = 1
barInfo = self:InterruptingTremor(duration)
end
elseif riftSimulacrumCount == 5 and durationRounded == 8 then -- all adds are up again
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
local count = durationEventCount[durationRounded]
if count == 1 then
ravenousAbyssCount = 1
barInfo = self:RavenousAbyss(duration)
elseif count == 2 then
darkHandCount = 1
barInfo = self:DarkHand(duration)
end
if barInfo then
-- same as initial p1 add casts
if self:ShouldShowBars() then
self:CDBar(barInfo.key, duration, barInfo.msg)
end
return false
end
end
else -- Intermission
if durationRounded == 6 then
barInfo = self:SilverstrikeBarrage(duration)
end
end
if barInfo then
barInfo.eventID = eventInfo.id
barInfo.duration = barInfo.duration or eventInfo.duration
activeBars[eventInfo.id] = barInfo
if self:ShouldShowBars() then
self:CDBar(barInfo.key, barInfo.duration, barInfo.msg, barInfo.icon, eventInfo.id)
end
elseif barInfo == nil and self:ShouldShowBars() then
self:ErrorForTimelineEvent(eventInfo)
backupBars[eventInfo.id] = true
self:SendMessage("BigWigs_StartBar", nil, nil, ("[B] %s"):format(eventInfo.spellName), eventInfo.duration, eventInfo.iconFileID, eventInfo.maxQueueDuration, nil, eventInfo.id, eventInfo.id)
local state = C_EncounterTimeline.GetEventState(eventInfo.id)
if state == 1 then -- Enum.EncounterTimelineEventState.Paused = 1
self:SendMessage("BigWigs_PauseBar", nil, nil, eventInfo.id)
end
end
end
function mod:TimersOther(_, eventInfo)
if eventInfo.source ~= 0 or self:IsWiping() then return end
local barInfo
timelineEventCount = timelineEventCount + 1
local now = GetTime()
local timeSinceLastEvent = now - prev
prev = now
local stage = self:GetStage()
local duration = eventInfo.duration
local durationRounded = self:RoundNumber(duration, 1)
-- counts reset on intermission end, show phase message with first new timer
if stage == 2 and timelineEventCount == 1 then
if self:ShouldShowBars() then
self:Message("stages", "cyan", self:GetRename("stages", stage), false)
self:PlaySound("stages", "long")
end
self:ResetCounts()
timelineEventCount = 1
elseif stage == 3 and timelineEventCount == 1 and substage == 1 then
if self:ShouldShowBars() then
self:Message("stages", "cyan", self:GetRename("stages", stage), false)
self:PlaySound("stages", "long")
end
self:ResetCounts()
timelineEventCount = 1
end
if stage == 1 then
-- Intermision 1 start
if durationRounded == 1.5 and timeSinceLastEvent > 1 then
-- Silverstrike Barrage is always have after rp
barInfo = self:SilverstrikeBarrage(duration)
elseif durationRounded == 25 then -- Stage Two
-- callback sets intermission, resets counts
barInfo = self:IntermissionEvent(duration)
barInfo.timer = self:ScheduleTimer(function() barInfo:onEnd() end, duration)
-- pull timers
elseif durationRounded == 24 then
barInfo = self:SilverstrikeArrow(duration)
elseif durationRounded == 5 then
barInfo = self:GraspOfEmptiness(duration)
elseif durationRounded == (self:Easy() and 60 or 12) then
barInfo = self:VoidExpulsion(duration)
elseif durationRounded == 2 or durationRounded == 46.5 then
barInfo = self:NullCorona(duration)
elseif durationRounded == 4 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
local count = durationEventCount[durationRounded]
if count == 1 then
barInfo = self:InterruptingTremor(duration)
elseif count == 2 then
barInfo = self:DarkHand(duration)
elseif count == 3 then
barInfo = self:RavenousAbyss(duration)
end
-- the order of these can change, so just fire bars for them and we'll
-- figure out the message on the next timer
if self:ShouldShowBars() then
self:CDBar(barInfo.key, duration, barInfo.msg)
end
return false -- don't want callback to fire
-- repeating timers
elseif (self:Easy() and durationRounded == 48) or durationRounded == 44.5 or durationRounded == 27 then
barInfo = self:NullCorona(duration)
elseif durationRounded == 48 then -- not self:Easy()
if voidExpulsionCount % 3 == 2 then
barInfo = self:VoidExpulsion(duration)
else
barInfo = self:NullCorona(duration)
end
elseif durationRounded == 21 or durationRounded == 23 then
barInfo = self:SilverstrikeArrow(duration)
elseif durationRounded == 28 or durationRounded == 32 or durationRounded == 31.5 then
barInfo = self:GraspOfEmptiness(duration)
elseif durationRounded == 39 then
barInfo = self:VoidExpulsion(duration)
elseif durationRounded == (self:Easy() and 17 or 26) then
barInfo = self:DarkHand(duration)
elseif durationRounded == 20 then
barInfo = self:InterruptingTremor(duration)
elseif durationRounded == 19.5 then
barInfo = self:RavenousAbyss(duration)
-- at 2min in p1, p1 restarts - 0.5 (excluding add timers), canceling and restarting active bars
elseif durationRounded == 4.5 then
barInfo = updateBar(1232467, "GraspOfEmptiness", duration)
elseif durationRounded == (self:Easy() and 46 or 1.5) then
barInfo = updateBar(1233865, "NullCorona", duration)
elseif durationRounded == (self:Easy() and 59.5 or 11.5) then
barInfo = self:VoidExpulsion(duration)
elseif durationRounded == 23.5 then
barInfo = self:SilverstrikeArrow(duration)
end
elseif stage == 2 then
if durationRounded == 1.5 then
barInfo = self:SilverstrikeBarrage(duration)
elseif silverstrikeBarrageCount > 1 and durationRounded == 20 then -- Stage Three
-- callback sets intermission, resets counts
barInfo = self:IntermissionEvent(duration)
barInfo.timer = self:ScheduleTimer(function() barInfo:onEnd() end, duration)
elseif durationRounded == 13 or durationRounded == 11 then
barInfo = self:NullCorona(duration)
elseif durationRounded == 21 or durationRounded == 19 then
barInfo = self:RangerCaptainsMark(duration)
elseif durationRounded == 16 or durationRounded == 14 then
barInfo = self:VoidExpulsion(duration)
elseif durationRounded == 8 then
barInfo = self:VoidstalkerSting(duration)
elseif (durationRounded == 12 and callOfTheVoidCount == 1) or durationRounded == 10 then
barInfo = self:CallOfTheVoid(duration)
elseif durationRounded == 24 or durationRounded == 22 then
barInfo = self:CosmicBarrier(duration)
elseif durationRounded == 20 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
if durationEventCount[durationRounded] == 1 then
barInfo = self:VoidExpulsion(duration)
else
barInfo = self:VoidstalkerSting(duration)
end
elseif durationRounded == 6 then
if riftSlashCount == 1 then
barInfo = self:RiftSlash(duration)
else
barInfo = self:VoidstalkerSting(duration)
end
elseif durationRounded == 5 then
barInfo = self:VoidstalkerSting(duration)
elseif durationRounded == 12 then
if riftSlashCount == 2 then
-- fake, finishes with the first 6s cast
return false
end
barInfo = self:RiftSlash(duration)
end
elseif stage == 3 then
-- stage start timers
if durationRounded == 60 or durationRounded == 59 then
-- callback handles substage
barInfo = self:DevouringCosmos(duration)
elseif durationRounded == 30 or durationRounded == 29 then
barInfo = self:NullCorona(duration)
elseif durationRounded == 19 or durationRounded == 11 then
barInfo = self:GraspOfEmptiness(duration)
elseif durationRounded == 15 or durationRounded == 14 then
barInfo = self:VoidstalkerSting(duration)
elseif durationRounded == 9 or durationRounded == 8 then
-- 8 is a refresh of previous 21s cast
if durationRounded == 8 then
barInfo = updateBar(1239080, "AspectOfTheEnd", duration)
else
barInfo = self:AspectOfTheEnd(duration)
end
-- repeating timers
elseif durationRounded == 18 then
durationEventCount[durationRounded] = (durationEventCount[durationRounded] or 0) + 1
if not self:Easy() or durationEventCount[durationRounded] % 2 == 1 then
barInfo = self:VoidstalkerSting(duration)
else
barInfo = self:GraspOfEmptiness(duration)
end
elseif durationRounded == 12 then
if not self:Easy() and graspOfEmptinessCount == 1 then
barInfo = self:GraspOfEmptiness(duration)
else
barInfo = self:VoidstalkerSting(duration)
end
elseif durationRounded == 7 or durationRounded == 20 or durationRounded == 17 then
barInfo = self:GraspOfEmptiness(duration)
elseif durationRounded == 39 or durationRounded == 21 then
barInfo = self:AspectOfTheEnd(duration)
end
else -- Intermission
if durationRounded == 3 or durationRounded == 6 or durationRounded == 9.5 then
barInfo = self:SilverstrikeBarrage(duration)
end
end
if barInfo then
barInfo.eventID = eventInfo.id
barInfo.duration = barInfo.duration or eventInfo.duration
activeBars[eventInfo.id] = barInfo
if self:ShouldShowBars() then
self:CDBar(barInfo.key, barInfo.duration, barInfo.msg, barInfo.icon, eventInfo.id)
end
elseif barInfo == nil and self:ShouldShowBars() then
self:ErrorForTimelineEvent(eventInfo)
backupBars[eventInfo.id] = true
self:SendMessage("BigWigs_StartBar", nil, nil, ("[B] %s"):format(eventInfo.spellName), eventInfo.duration, eventInfo.iconFileID, eventInfo.maxQueueDuration, nil, eventInfo.id, eventInfo.id)
local state = C_EncounterTimeline.GetEventState(eventInfo.id)
if state == 1 then -- Enum.EncounterTimelineEventState.Paused = 1
self:SendMessage("BigWigs_PauseBar", nil, nil, eventInfo.id)
end
end
end
function mod:ENCOUNTER_TIMELINE_EVENT_STATE_CHANGED(_, eventID)
local barInfo = activeBars[eventID]
if barInfo then
local state = C_EncounterTimeline.GetEventState(eventID)
if state == 2 or state == 3 then
self:StopBar(barInfo.msg)
if self:ShouldShowBars() then
if state == 2 and barInfo.onFinished then
barInfo:onFinished()
elseif state == 3 and barInfo.onCanceled then
barInfo:onCanceled()
end
end
activeBars[eventID] = nil
end
elseif backupBars[eventID] then
local newState = C_EncounterTimeline.GetEventState(eventID)
if newState == 0 then
self:SendMessage("BigWigs_ResumeBar", nil, nil, eventID)
elseif newState == 1 then
self:SendMessage("BigWigs_PauseBar", nil, nil, eventID)
elseif newState == 2 or newState == 3 then
self:SendMessage("BigWigs_StopBar", nil, nil, eventID)
end
end
end
function mod:ENCOUNTER_TIMELINE_EVENT_REMOVED(_, eventID)
activeBars[eventID] = nil
backupBars[eventID] = nil
end
--------------------------------------------------------------------------------
-- Event Handlers
--
function mod:IntermissionEvent(duration)
local stage = self:GetStage()
local nextStage = stage + 1
self:SetStage(stage + 0.5)
if self:ShouldShowBars() then
self:Message("stages", "cyan", self:GetRename("stages", 1), false)
self:PlaySound("stages", "long")
end
return {
msg = self:GetRename("stages", nextStage),
key = "stages",
icon = 1280127,
onEnd = function(barInfo)
barInfo.timer = nil
self:SetStage(nextStage)
self:ResetCounts()
end,
onCanceled = function(barInfo)
if barInfo.timer then
self:CancelTimer(barInfo.timer)
barInfo:onEnd()
end
end,
}
end
function mod:SilverstrikeBarrage()
local barText = CL.count:format(self:GetRename(1243982), silverstrikeBarrageCount)
silverstrikeBarrageCount = silverstrikeBarrageCount + 1
return {
msg = barText,
key = 1243982,
unused = function() -- not used, just for the parser
mod:Bar(1243982, 0)
end,
}
end
-- Stage 1
function mod:SilverstrikeArrow()
local barText = CL.count:format(self:GetRename(1233602), silverstrikeArrowCount)
silverstrikeArrowCount = silverstrikeArrowCount + 1
return {
msg = barText,
key = 1233602,
onFinished = function()
self:Message(1233602, "cyan", barText)
self:PersonalMessageFromBlizzMessage(1233602, 0.5, false, self:GetRename(1233602, 2))
-- PA target sound
end,
}
end
function mod:GraspOfEmptiness()
local count = graspOfEmptinessCount
if self:Mythic() and self:GetStage() == 1 and count > 1 then
-- 1 2 3 4 5 6 7 8 9
-- 1 3 4 5 2>(6) 7 8 9 6
if count % 4 == 2 then
count = count + 3
else
count = count - 1
end
end
local barText = CL.count:format(self:GetRename(1232467), count)
graspOfEmptinessCount = graspOfEmptinessCount + 1
return {
msg = barText,
key = 1232467,
onFinished = function()
self:Message(1232467, "yellow", barText)
-- PA target sound
end,
}
end
function mod:VoidExpulsion()
local barText = CL.count:format(self:GetRename(1255368), voidExpulsionCount)
voidExpulsionCount = voidExpulsionCount + 1
return {
msg = barText,
key = 1255368,
onFinished = function()
self:StopBlizzMessages(1)
self:Message(1255368, "red", barText)
self:PlaySound(1255368, "alert") -- big damage
end,
}
end
function mod:NullCorona()
local barText = CL.count:format(self:GetRename(1233865), nullCoronaCount)
nullCoronaCount = nullCoronaCount + 1
return {
msg = barText,
key = 1233865,
onFinished = function()
self:Message(1233865, "yellow", barText)
end,
}
end
function mod:DarkHand()
if darkHandCount == 2 and (self:GetStage() == 1 or riftSimulacrumCount == 5) and self:ShouldShowBars() then
local text = CL.count:format(self:GetRename(1233787), 1)
self:StopBar(text)
self:Message(1233787, "purple", text)
end
local barText = CL.count:format(self:GetRename(1233787), darkHandCount)
darkHandCount = darkHandCount + 1
return {
msg = barText,
key = 1233787,
onFinished = function()
self:Message(1233787, "purple", barText)
end,
}
end
function mod:InterruptingTremor()
if interruptingTremorCount == 2 and (self:GetStage() == 1 or riftSimulacrumCount == 5) and self:ShouldShowBars() then
local text = CL.count:format(self:GetRename(1243743), 1)
self:StopBar(text)
self:StopBlizzMessages(0.5)
self:Message(1243743, "red", text)
self:CastBar(1243743, 5, 2)
self:PlaySound(1243743, "alert")
end
local barText = CL.count:format(self:GetRename(1243743), interruptingTremorCount)
interruptingTremorCount = interruptingTremorCount + 1
return {
msg = barText,
key = 1243743,
onFinished = function()
self:StopBlizzMessages(1)
self:Message(1243743, "orange", barText)
self:CastBar(1243743, 5, 2)
self:PlaySound(1243743, "alert")
end,
}
end
function mod:RavenousAbyss()
if ravenousAbyssCount == 2 and (self:GetStage() == 1 or riftSimulacrumCount == 5) and self:ShouldShowBars() then
local text = CL.count:format(self:GetRename(1243753), 1)
self:StopBar(text)
self:Message(1243753, "orange", text)
end
local barText = CL.count:format(self:GetRename(1243753), ravenousAbyssCount)
ravenousAbyssCount = ravenousAbyssCount + 1
return {
msg = barText,
key = 1243753,
onFinished = function()
self:Message(1243753, "orange", barText)
end,
}
end
-- Stage 2
function mod:RangerCaptainsMark()
local barText = CL.count:format(self:GetRename(1237614), markCount)
markCount = markCount + 1
return {
msg = barText,
key = 1237614,
onFinished = function()
self:StopBlizzMessages(1)
self:Message(1237614, "cyan", barText)
-- self:PlaySound(1237614, "alarm", "spread") -- spread
end,
}
end
function mod:VoidstalkerSting()
local barText = self:GetRename(1237038)
stingCount = stingCount + 1
return {
msg = barText,
key = 1237038,
unused = function() -- not used, just for the parser
mod:Bar(1237038, 0)
end,
}
end
function mod:CallOfTheVoid()
local barText = CL.count:format(self:GetRename(1237837), callOfTheVoidCount)
callOfTheVoidCount = callOfTheVoidCount + 1
return {
msg = barText,
key = 1237837,
onFinished = function()
self:Message(1237837, "cyan", barText)
self:PlaySound(1237837, "info") -- adds
end,
}
end
function mod:CosmicBarrier()
local barText = CL.count:format(self:GetRename(1246918), cosmicBarrierCount)
cosmicBarrierCount = cosmicBarrierCount + 1
return {
msg = barText,
key = 1246918,
onFinished = function()
self:Message(1246918, "orange", barText)
-- XXX gets held then canceled alot?
self:StopBlizzMessages(0.5)
end,
}
end
function mod:RiftSlash()
local barText = CL.count:format(self:GetRename(1246461), riftSlashCount)
riftSlashCount = riftSlashCount + 1
return {
msg = barText,
key = 1246461,
onFinished = function()
self:Message(1246461, "purple", barText)
end,
}
end
function mod:RiftSimulacrum()
local barText = CL.count:format(self:GetRename(1261016), riftSimulacrumCount)
riftSimulacrumCount = riftSimulacrumCount + 1
return {
msg = barText,
key = 1261016,
onFinished = function()
self:Message(1261016, "cyan", barText)
self:PlaySound(1261016, "info")
end,
}
end
-- Stage 3
function mod:DevouringCosmos()
local barText = CL.count:format(self:GetRename(1238843), devouringCosmosCount)
devouringCosmosCount = devouringCosmosCount + 1
return {
msg = barText,
key = 1238843,
onFinished = function()
durationEventCount = {}
substage = substage + 1