-
Notifications
You must be signed in to change notification settings - Fork 1
/
Register_Mainline.lua
4472 lines (4353 loc) · 151 KB
/
Register_Mainline.lua
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
--[[
Register custom functions, to-dos, categories, and lists for Mainline WoW
]]
local ADDON_NAME, Internal = ...
local External = _G[ADDON_NAME]
local L = Internal.L
local DEFAULT_COMPLETED_FUNCTION = "return self:IsFlaggedCompleted()"
local DEFAULT_TEXT_FUNCTION = [[return self:IsCompleted() and Images.COMPLETE or "-"]]
local DEFAULT_CLICK_FUNCTION = [[self:SetFlaggedCompleted(not self:IsFlaggedCompleted())]]
local DEFAULT_QUEST_TOOLTIP = [[
tooltip:AddLine(self:GetName())
for i=1,#states do
local state = states[i]
local name = state:GetTitle()
if name == "" then
name = L["Unknown"]
end
if state:IsCompleted() then
tooltip:AddLine(Images.COMPLETE .. name, 0, 1, 0)
elseif state:IsComplete() then
tooltip:AddLine(Images.QUEST_TURN_IN .. name, 1, 1, 0)
elseif state:IsActive() then
local objectiveType = state:GetObjectiveType(1)
local fulfilled, required = state:GetObjectiveProgress(1)
if objectiveType == "progressbar" then
tooltip:AddLine(Images.PADDING .. format("%s (%d%%)", name, math.ceil(fulfilled / required * 100)), 1, 1, 1)
else
tooltip:AddLine(Images.PADDING .. format("%s (%d/%d)", name, fulfilled, required), 1, 1, 1)
end
else
tooltip:AddLine(Images.QUEST_PICKUP .. name, 1, 1, 1)
end
end
]]
-- DST doesnt effect daily/weekly/halfweekly resets so these should always be accurate
local SECONDS_PER_HOUR = 60 * 60
local SECONDS_PER_WEEK = 60 * 60 * 24 * 7
local SECONDS_PER_HALF_WEEK = 60 * 60 * 24 * 3.5
local SEASON_91_START_TIMESTAMP = {
[1] = 1625583600, -- US
[2] = 1625698800, -- TW (+115200)
[3] = 1625641200, -- EU (+57600)
[4] = 1625698800, -- KR (+115200)
[5] = 1625698800, -- CN (+115200)
[72] = 1625583600, -- US
}
local SEASON_92_START_TIMESTAMP = {
[1] = 1645542000, -- US
[2] = 1645657200, -- TW (+115200)
[3] = 1645599600, -- EU (+57600)
[4] = 1645657200, -- KR (+115200)
[5] = 1645657200, -- CN (+115200)
[72] = 1645542000, -- US
}
-- Week 0 is preseason week
-- Week 1 is Normal/Heroic week
-- Week 2 is Mythic
-- Sometimes there is a 1 to 3 second difference, we need to make sure this doesnt mess with the result
-- hopefully rounding to the nearest hour will work
local function Get91SeasonWeek()
local nextWeeklyReset = Internal.GetNextWeeklyResetTimestamp()
local secondsSinceSeasonStart = nextWeeklyReset - SEASON_91_START_TIMESTAMP[GetCurrentRegion()]
return secondsSinceSeasonStart / SECONDS_PER_WEEK
end
Internal.Get91SeasonWeek = Get91SeasonWeek
Internal.RegisterCustomStateFunction("Get91SeasonWeek", Get91SeasonWeek)
Internal.RegisterCustomStateFunction("GetSeasonWeek", Get91SeasonWeek) -- Deprecated GetSeasonWeek, use the specific season ones
local function Get92SeasonWeek()
local nextWeeklyReset = Internal.GetNextWeeklyResetTimestamp()
local secondsSinceSeasonStart = nextWeeklyReset - SEASON_92_START_TIMESTAMP[GetCurrentRegion()]
return secondsSinceSeasonStart / SECONDS_PER_WEEK
end
Internal.Get92SeasonWeek = Get92SeasonWeek
Internal.RegisterCustomStateFunction("Get92SeasonWeek", Get92SeasonWeek)
local function GetDFPreSeasonTimestamp(region)
local timestamps = {
[1] = 1669734000, -- US
[2] = 1669849200, -- TW (+115200)
[3] = 1669780800, -- EU (+46800)
[4] = 1669849200, -- KR (+115200)
[5] = 1669849200, -- CN (+115200)
[72] = 1669734000, -- PTR
}
return timestamps[region or GetCurrentRegion()];
end
Internal.RegisterCustomStateFunction("GetDFPreSeasonTimestamp", GetDFPreSeasonTimestamp)
local MAX_RENOWN_FOR_WEEK = {
[0] = 42,
[1] = 45,
[2] = 48,
[3] = 51,
[4] = 54,
[5] = 57,
[6] = 60,
}
local function GetMaxRenownForWeek(week)
if week <= 6 then
return MAX_RENOWN_FOR_WEEK[week]
end
return math.min(MAX_RENOWN_FOR_WEEK[6] + (week - 6) * 2, 80)
end
Internal.RegisterCustomStateFunction("GetMaxRenownForWeek", GetMaxRenownForWeek)
local function GetSeason91StartTimestamp()
return SEASON_91_START_TIMESTAMP[GetCurrentRegion()]
end
Internal.GetSeason91StartTimestamp = GetSeason91StartTimestamp
Internal.RegisterCustomStateFunction("GetSeason91StartTimestamp", GetSeason91StartTimestamp)
local function GetSeasonStartTimestamp()
return SEASON_92_START_TIMESTAMP[GetCurrentRegion()]
end
Internal.GetSeasonStartTimestamp = GetSeasonStartTimestamp
Internal.RegisterCustomStateFunction("GetSeasonStartTimestamp", GetSeasonStartTimestamp)
local function FormatDuration(duration, format)
if not format then
format = {hours = true, minutes = true, seconds = true}
end
if type(format) == "number" then
format = {hours = true, minutes = true, seconds = true, count = format}
end
local count = format.count or 10
local result = {}
if format.hours then
local amount = (format.minutes and math.floor or math.ceil)(duration / 3600)
if amount ~= 0 then
result[#result+1] = amount .. " h"
duration = duration - amount * 3600
count = count - 1
end
end
if format.minutes and count > 0 then
local amount = (format.seconds and math.floor or math.ceil)(duration / 60)
if amount ~= 0 then
result[#result+1] = amount .. " m"
duration = duration - amount * 60
count = count - 1
end
end
if format.seconds and count > 0 then
if duration ~= 0 then
result[#result+1] = duration .. " s"
end
end
return table.concat(result, " ")
end
Internal.RegisterCustomStateFunction("FormatDuration", FormatDuration)
-- Verified for NA and EU
local function GetDragonbaneKeepCountdown()
local start = GetDFPreSeasonTimestamp()
local current = GetServerTime()
local seconds = (current - start) % 7200
if seconds < 3600 then
return true, 3600 - seconds
else
return false, 7200 - seconds
end
end
Internal.RegisterCustomStateFunction("GetDragonbaneKeepCountdown", GetDragonbaneKeepCountdown)
-- Verified for NA and EU
local function GetGrandHuntCountdown()
local start = GetDFPreSeasonTimestamp()
local current = GetServerTime()
local seconds = (current - start) % 7200
return 7200 - seconds
end
Internal.RegisterCustomStateFunction("GetGrandHuntCountdown", GetGrandHuntCountdown)
local function GetCommunityFeastCountdown()
local start = GetDFPreSeasonTimestamp()
if GetCurrentRegion() == 1 then
start = start - 1800
end
local current = GetServerTime()
local seconds = (current - start) % 5400
if seconds < 900 then
return true, 900 - seconds
else
return false, 5400 - seconds
end
end
Internal.RegisterCustomStateFunction("GetCommunityFeastCountdown", GetCommunityFeastCountdown)
local function GetPrimalStormCountdown()
local start = GetDFPreSeasonTimestamp()
local current = GetServerTime()
local seconds = (current - start) % 10800
if seconds < 7200 then
return true, 7200 - seconds
else
return false, 10800 - seconds
end
end
Internal.RegisterCustomStateFunction("GetPrimalStormCountdown", GetPrimalStormCountdown)
local function tMap(tbl, func)
local result = {}
for k,v in pairs(tbl) do
result[k] = func(k, v, tbl)
end
return result
end
-- Korthia Dailies
do
local korthiaDailies = {
[64271] = true,
[63783] = true,
[63779] = true,
[63934] = true,
[63793] = true,
[63964] = true,
[63794] = true,
[63790] = true,
[63792] = true,
[63963] = true,
[63791] = true,
[64129] = true,
[63787] = true,
[63788] = true,
[63789] = true,
[63785] = true,
[63775] = true,
[63936] = true,
[64080] = true,
[64240] = true,
[63784] = true,
[64015] = true,
[64065] = true,
[63781] = true,
[63782] = true,
[63937] = true,
[63962] = true,
[63959] = true,
[63776] = true,
[63957] = true,
[63958] = true,
[63960] = true,
[64103] = true,
[64040] = true,
[64017] = true,
[64016] = true,
[63989] = true,
[63935] = true,
[64166] = true,
[63950] = true,
[63961] = true,
[63777] = true,
[63954] = true,
[63955] = true,
[63956] = true,
[63780] = true,
[64430] = true,
[64070] = true,
[64432] = true,
[63786] = true,
[64089] = true,
[64101] = true,
[64018] = true,
[64104] = true,
[64194] = true,
[63778] = true,
[64043] = true,
[63965] = true,
}
local SharedDataID = "KORTHIA_DAILIES"
Internal.RegisterSharedData(SharedDataID, function (id, data)
if not data or not data.unlocked then
return false
end
local count = 0
for k in pairs(data) do
if type(k) == "number" then
count = count + 1
end
end
return count == 4 or count == 5
end)
local function GetKorthiaDailies()
local dailies = Internal.GetSharedData(SharedDataID)
if C_Map.GetBestMapForUnit("player") == 1961 then
local unlocked = C_QuestLog.IsQuestFlaggedCompleted(63727)
local quests = tMap(tFilter(C_TaskQuest.GetQuestsForPlayerByMapID(1961), function (item)
return korthiaDailies[item.questId]
end, true), function (k, v)
return v.questId
end)
local questIDs = {}
for _,questID in ipairs(quests) do
questIDs[questID] = true
end
-- Complete quests arent returned by C_TaskQuest.GetQuestsForPlayerByMapID so we will add those ourselves
for questID in pairs(korthiaDailies) do
if not questIDs[questID] and C_QuestLog.IsQuestFlaggedCompleted(questID) then
questIDs[questID] = true
quests[#quests+1] = questID
end
end
if not questIDs[64103] and C_QuestLog.GetLogIndexForQuestID(64103) then -- This one doesnt show on the map for some reason so we add it if we are on it
questIDs[64103] = true
quests[#quests+1] = 64103
end
if not unlocked and dailies then -- Fill in missing quests that unlock later
for k in pairs(dailies) do
if type(k) == "number" then
if not questIDs[k] then
questIDs[k] = true
quests[#quests+1] = k
end
end
end
end
questIDs.n = #quests
questIDs.unlocked = unlocked
Internal.SaveSharedData(SharedDataID, questIDs)
dailies = questIDs
end
return dailies
end
Internal.RegisterCustomStateFunction("GetKorthiaDailies", GetKorthiaDailies)
local baseDailies = {
[64271] = nil, -- A More Civilized Way
[63783] = true, -- Anima Reclamation
[63779] = false, -- A Semblance of Normalcy
[63934] = true, -- Assail Mail
[63793] = true, -- Broker's Bounty: Ensydius the Defiler
[63964] = true, -- ? Broker's Bounty: Grimtalon
[63794] = true, -- Broker's Bounty: Hungering Behemoth
[63790] = true, -- Broker's Bounty: Lord Azzorak
[63792] = true, -- ? Broker's Bounty: Nocturnus the Unraveler
[63963] = true, -- Broker's Bounty: Ripmaul
[63791] = true, -- Broker's Bounty: Valdinar the Curseborn
[64129] = false, -- Charge of the Wild Hunt
[63787] = true, -- Continued Efforts: Mauler's Outlook
[63788] = true, -- Continued Efforts: Sanctuary of Guidance
[63789] = true, -- Continued Efforts: Scholar's Den
[63785] = true, -- ? Continued Efforts: Seeker's Quorum
[63775] = false, -- Cryptograms and Keys
[63936] = true, -- Devoured Anima
[64080] = nil, -- Down to Earth
[64240] = nil, -- Flight of the Kyrian
[63784] = true, -- Gold's No Object
[64015] = nil, -- Into the Meat Grinder
[64065] = false, -- Local Reagents
[63781] = nil, -- Mawsworn Battle Plans
[63782] = true, -- Mawsworn Rituals
[63937] = nil, -- Nasty, Big, Pointy Teeth
[63962] = true, -- Observational Records
[63959] = true, -- Observational Records
[63776] = true, -- ? Observational Records
[63957] = true, -- ? Observational Records
[63958] = true, -- Observational Records
[63960] = true, -- ? Observational Records
[64103] = false, -- Old Tricks Work Best
[64040] = nil, -- Once More, with Healing
[64017] = false, -- Oozing with Character
[64016] = false, -- Oozing with Character
[63989] = false, -- Oozing with Character
[63935] = true, -- Precious Roots
[64166] = false, -- Random Memory Access
[63965] = nil, -- Razorwing Egg Rescue
[63950] = true, -- Razorwing Talons
[63961] = true, -- Sealed Secrets
[63777] = true, -- Sealed Secrets
[63954] = true, -- Sealed Secrets
[63955] = true, -- Sealed Secrets
[63956] = true, -- ? Sealed Secrets
[63780] = true, -- See How THEY Like It!
[64430] = nil, -- Spill the Tea
[64070] = false, -- Staying Scrappy
[64432] = false, -- Strength to Weakness
[63786] = false, -- Sweep the Windswept Aerie
[64089] = nil, -- Teas and Tinctures
[64101] = true, -- The Proper Procedures
[64018] = false, -- The Weight of Stone
[64104] = nil, -- Think of the Critters
[64194] = nil, -- War Prototype
[63778] = false, -- We Move Forward
[64043] = nil, -- We Need a Healer - You!
}
Internal.RegisterCustomStateFunction("IsBaseKorthiaDaily", function (questID)
return baseDailies[questID]
end)
Internal.RegisterEvent("DAILY_RESET", function ()
BtWTodoCache.korthiaDailies = nil
Internal.WipeSharedData(SharedDataID)
end)
end
-- Tormentors of Torghast
do
local bosses = {
(GetAchievementCriteriaInfoByID(15054, 52105)), -- L["Manifestation of Pain"],
(GetAchievementCriteriaInfoByID(15054, 51655)), -- L["Versya the Damned"],
(GetAchievementCriteriaInfoByID(15054, 52101)), -- L["Zul'gath the Flayer"],
(GetAchievementCriteriaInfoByID(15054, 52106)), -- L["Golmak the Monstrosity"],
(GetAchievementCriteriaInfoByID(15054, 51643)), -- L["Sentinel Pyrophus"],
(GetAchievementCriteriaInfoByID(15054, 51660)), -- L["Mugrem the Soul Devourer"],
(GetAchievementCriteriaInfoByID(15054, 52104)), -- L["Kazj the Sentinel"],
(GetAchievementCriteriaInfoByID(15054, 51644)), -- L["Promathiz"],
(GetAchievementCriteriaInfoByID(15054, 52103)), -- L["Sentinel Shakorzeth"],
(GetAchievementCriteriaInfoByID(15054, 51661)), -- L["Intercessor Razzram"],
(GetAchievementCriteriaInfoByID(15054, 51653)), -- L["Gruukuuek the Elder"],
(GetAchievementCriteriaInfoByID(15054, 52102)), -- L["Algel the Haunter"],
(GetAchievementCriteriaInfoByID(15054, 51648)), -- L["Malleus Grakizz"],
(GetAchievementCriteriaInfoByID(15054, 51654)), -- L["Gralebboih"],
(GetAchievementCriteriaInfoByID(15054, 51639)), -- L["The Mass of Souls"],
}
local bossRegionOffset = {
[1] = 3, -- US
[2] = 0, -- TW
[3] = 0, -- EU
[4] = 0, -- KR
[5] = 0, -- CN
[72] = 3, -- PTR
}
Internal.RegisterCustomStateFunction("GetTormentorsBoss", function ()
local seasonStartTimestamp = Internal.GetSeason91StartTimestamp()
local previous = math.floor((GetServerTime() - seasonStartTimestamp) / (2 * 60 * 60)) + bossRegionOffset[GetCurrentRegion()]
return bosses[previous % #bosses + 1], bosses[(previous + 1) % #bosses + 1], bosses[(previous + 2) % #bosses + 1], bosses[(previous + 3) % #bosses + 1], bosses[(previous + 4) % #bosses + 1]
end)
local vignetteIDs = {
[4723] = true,
[4773] = true,
}
-- returns vignette table and if the tormentors is within countdown
Internal.RegisterCustomStateFunction("GetActiveTormentorsInfo", function ()
for _,vignetteGUID in ipairs(C_VignetteInfo.GetVignettes()) do
local vignette = C_VignetteInfo.GetVignetteInfo(vignetteGUID)
if vignette and vignetteIDs[vignette.vignetteID] then
local widgets = C_UIWidgetManager.GetAllWidgetsBySetID(vignette.widgetSetID)
local widget = C_UIWidgetManager.GetTextWithStateWidgetVisualizationInfo(widgets[1].widgetID)
return vignette, widget.hasTimer
end
end
end)
Internal.RegisterCustomStateFunction("GetTormentorTimers", function ()
local seasonStartTimestamp = Internal.GetSeasonStartTimestamp()
local previous = seasonStartTimestamp + math.floor((GetServerTime() - seasonStartTimestamp) / (2 * 60 * 60)) * (2 * 60 * 60)
if GetServerTime() - previous <= 5 * 60 then
return date("%H:%M:%S", previous + (2 * 60 * 60)), date("%H:%M:%S", previous), false, true
elseif (previous + (2 * 60 * 60)) - GetServerTime() <= 5 * 60 then
return date("%H:%M:%S", previous + (2 * 60 * 60)), date("%H:%M:%S", previous), true, false
else
return date("%H:%M:%S", previous + (2 * 60 * 60)), date("%H:%M:%S", previous), false, false
end
end)
Internal.RegisterCustomStateFunction("GetTormentorCountdown", function ()
local seasonStartTimestamp = Internal.GetSeason91StartTimestamp()
local previous = seasonStartTimestamp + math.floor((GetServerTime() - seasonStartTimestamp) / (2 * 60 * 60)) * (2 * 60 * 60)
local result = previous + (2 * 60 * 60) - GetServerTime()
return result, GetServerTime() - previous <= 420
end)
end
-- Maw Assault
do
local SharedDataID = "MAW_ASSAULT_QUESTS"
local assaultOrder = {
63823, 63822, 63824, 63543,
63822, 63823, 63543, 63824,
}
local assaultQuests = {
[63543] = { -- Necrolord Assault
63774,
63455,
63664,
63625,
63669,
59004,
63773,
63772,
63753,
63621,
63545,
},
[63824] = { -- Kyrian Assault
63858,
63827,
63843,
63853,
63828,
63829,
63859,
63864,
63846,
63863,
},
[63823] = { -- Night Fae Assault
63951,
63968,
63973,
63952,
63972,
63969,
63970,
63971,
63974,
63945,
},
[63822] = { -- Venthyr Assault
63837,
63838,
63836,
63839,
63841,
63833,
63842,
63840,
63834,
63835,
}
}
local function GetActiveMawAssaultQuest()
local week = Internal.Get91SeasonWeek() % 4
local index = week * 2 + (Internal.IsBeforeHalfWeeklyReset() and 0 or 1) + 1
return assaultOrder[index]
end
Internal.RegisterSharedData(SharedDataID, function (id, data)
local assaultQuest = GetActiveMawAssaultQuest()
if not data or not data.quests or data.assaultQuest ~= assaultQuest then
return
end
local count = 0
for k in pairs(data.quests) do
if k ~= 63772 then
count = count + 1
end
end
return count == 4
end)
-- Returns which assaults for the current week
Internal.RegisterCustomStateFunction("GetMawAssaults", function ()
local week = Internal.Get91SeasonWeek() % 4
local index = week * 2 + 1
return unpack(assaultOrder, index, index + 1)
end)
Internal.RegisterCustomStateFunction("GetActiveMawAssaultQuests", function ()
local data = Internal.GetSharedData(SharedDataID) or {}
local assaultQuest = GetActiveMawAssaultQuest()
if data.assaultQuest ~= assaultQuest then
data.quests = {}
end
data.assaultQuest = assaultQuest
data.quests = data.quests or {}
local save = false
for _,k in pairs(assaultQuests[assaultQuest]) do
if C_QuestLog.GetLogIndexForQuestID(k) or C_QuestLog.IsQuestFlaggedCompleted(k) then
data.quests[k] = true
save = true
end
end
if save then
Internal.SaveSharedData(SharedDataID, data)
end
return data
end)
Internal.RegisterEvent("HALF_WEEKLY_RESET", function (event, isWeekly)
Internal.WipeSharedData(SharedDataID)
end, -1)
end
-- Reservoir Anima
local reservoirQuests = {
61982, -- Replenish the Reservoir - Kyrian
61981, -- Replenish the Reservoir - Venthyr
61984, -- Replenish the Reservoir - Night Fae
61983, -- Replenish the Reservoir - Necrolord
}
Internal.RegisterCustomStateFunction("GetReservoirQuestForCovenant", function (covenantID)
return reservoirQuests[covenantID]
end)
-- Return Lost Souls
local returnLostSouls = {
61332, 62861, 62862, 62863, -- Return Lost Souls - Kyrian
61334, 62867, 62868, 62869, -- Return Lost Souls - Venthyr
61331, 62858, 62859, 62860, -- Return Lost Souls - Night Fae
61333, 62864, 62865, 62866, -- Return Lost Souls - Necrolord
}
Internal.RegisterCustomStateFunction("GetReturnLostSoulQuestsForCovenant", function (covenantID)
local index = (covenantID - 1) * 4
return returnLostSouls[index + 1], returnLostSouls[index + 2], returnLostSouls[index + 3], returnLostSouls[index + 4]
end)
External.RegisterTodos({
{
id = "btwtodo:renown",
name = L["Renown"],
version = 1,
changeLog = {
L["Updated for new season start"],
},
states = {
{ type = "currency", id = 1822, },
},
completed = [[return states[1]:GetQuantity() + 1 == Custom.GetMaxRenownForWeek(Custom.Get91SeasonWeek())]],
text = [[return format("%d / %d", states[1]:GetQuantity() + 1, Custom.GetMaxRenownForWeek(Custom.Get91SeasonWeek()))]],
},
{
id = "btwtodo:91campaign",
name = L["9.1 Campaign"],
states = {
{ type = "campaign", id = 138, },
},
completed = "return states[1]:IsCompleted() -- Test Comment for editor",
text = [=[
if self:IsCompleted() then -- Last chapter doesnt show as completed correctly, it has an extra quest
return format("%s / %s", states[1]:GetChaptersTotal(), states[1]:GetChaptersTotal())
end
local text = format("%s / %s", states[1]:GetChaptersCompleted(), states[1]:GetChaptersTotal())
if states[1]:IsStalled() then
return Colors.STALLED:WrapTextInColorCode(text)
else
return text
end
]=],
tooltip = [[
tooltip:AddLine(self:GetName())
for i=1,states[1]:GetChaptersTotal() do
local name = states[1]:GetChapterName(i)
if self:IsCompleted() or states[1]:IsChapterCompleted(i) then
tooltip:AddLine(name, 0, 1, 0)
elseif states[1]:IsChapterInProgress(i) then
tooltip:AddLine(name, 1, 1, 1)
else
tooltip:AddLine(name, 0.5, 0.5, 0.5)
end
end
]],
},
{
id = "btwtodo:thearchivistscodex",
name = L["The Archivists' Codex"],
states = {
{ type = "faction", id = 2472, },
},
completed = "return states[1]:IsCapped()",
text = [[
if self:IsCompleted() then
return Images.COMPLETE
else
return format("%s / %s", states[1]:GetStandingQuantity(), states[1]:GetStandingMaxQuantity())
end
]],
},
{
id = "btwtodo:deathsadvance",
name = L["Death's Advance"],
states = {
{ type = "faction", id = 2470, },
},
completed = "return states[1]:HasParagonAvailable()",
text = [[return format("%s / %s", states[1]:GetStandingQuantity(), states[1]:GetStandingMaxQuantity())]],
},
{
id = "btwtodo:deathsadvanceexalted",
name = L["Death's Advance"],
states = {
{ type = "faction", id = 2470, },
},
completed = "return states[1]:IsCapped()",
text = [[
if self:IsCompleted() then
return Images.COMPLETE
else
return format("%s / %s", states[1]:GetStandingQuantity(), states[1]:GetStandingMaxQuantity())
end
]],
},
{
id = "btwtodo:callings",
name = L["Callings"],
states = {
{ type = "calling", id = 1, },
{ type = "calling", id = 2, },
{ type = "calling", id = 3, },
},
completed = [[return tCount(states, "IsCompleted") == 3]],
text = [[return format("%s / %s", tCount(states, "IsCompleted"), 3)]],
tooltip = [[
tooltip:AddLine(self:GetName())
for i=1,#states do
local state = states[i]
local name = state:GetTitle()
if name == "" then
name = L["Unknown"]
end
if state:IsCompleted() then
tooltip:AddLine(Images.COMPLETE .. name, 0, 1, 0)
elseif state:IsComplete() then
tooltip:AddLine(Images.QUEST_TURN_IN .. name, 1, 1, 0)
elseif state:IsActive() then
local objectiveType = state:GetObjectiveType(1)
local fulfilled, required = state:GetObjectiveProgress(1)
if objectiveType == "progressbar" then
tooltip:AddLine(Images.PADDING .. format("%s (%d%%)", name, math.ceil(fulfilled / required * 100)), 1, 1, 1)
else
tooltip:AddLine(Images.PADDING .. format("%s (%d/%d)", name, fulfilled, required), 1, 1, 1)
end
else
tooltip:AddLine(Images.QUEST_PICKUP .. name, 1, 1, 1)
end
end
]],
},
{
id = "btwtodo:korthiadailies",
name = L["Korthia"],
states = {
{ type = "quest", id = 63727, }, -- Last Quest of The Last Sigal chapter of the campaign, changes how many dailies are available
{ type = "quest", id = 64271, },
{ type = "quest", id = 63783, },
-- { type = "quest", id = 64560, }, -- One of the "fake" daily quests when unlocking Korthia
{ type = "quest", id = 63779, },
{ type = "quest", id = 63934, },
{ type = "quest", id = 63793, },
{ type = "quest", id = 63964, },
{ type = "quest", id = 63794, },
{ type = "quest", id = 63790, },
{ type = "quest", id = 63792, },
{ type = "quest", id = 63963, },
{ type = "quest", id = 63791, },
{ type = "quest", id = 64129, },
{ type = "quest", id = 63787, },
{ type = "quest", id = 63788, },
{ type = "quest", id = 63789, },
{ type = "quest", id = 63785, },
{ type = "quest", id = 63775, },
{ type = "quest", id = 63936, },
{ type = "quest", id = 64080, },
{ type = "quest", id = 64240, },
{ type = "quest", id = 63784, },
{ type = "quest", id = 64015, },
{ type = "quest", id = 64065, },
{ type = "quest", id = 63781, },
{ type = "quest", id = 63782, },
{ type = "quest", id = 63937, },
{ type = "quest", id = 63962, },
{ type = "quest", id = 63959, },
{ type = "quest", id = 63776, },
{ type = "quest", id = 63957, },
{ type = "quest", id = 63958, },
{ type = "quest", id = 63960, },
-- { type = "quest", id = 64561, }, -- One of the "fake" daily quests when unlocking Korthia
{ type = "quest", id = 64103, },
{ type = "quest", id = 64040, },
{ type = "quest", id = 64017, },
{ type = "quest", id = 64016, },
{ type = "quest", id = 63989, },
{ type = "quest", id = 63935, },
{ type = "quest", id = 64166, },
{ type = "quest", id = 63950, },
{ type = "quest", id = 63961, },
{ type = "quest", id = 63777, },
{ type = "quest", id = 63954, },
{ type = "quest", id = 63955, },
{ type = "quest", id = 63956, },
{ type = "quest", id = 63780, },
{ type = "quest", id = 64430, },
{ type = "quest", id = 64070, },
{ type = "quest", id = 64432, },
{ type = "quest", id = 63786, },
{ type = "quest", id = 64089, },
{ type = "quest", id = 64101, },
{ type = "quest", id = 64018, },
{ type = "quest", id = 64104, },
{ type = "quest", id = 64194, },
{ type = "quest", id = 63778, },
{ type = "quest", id = 64043, },
-- { type = "quest", id = 64562, }, -- One of the "fake" daily quests when unlocking Korthia
{ type = "quest", id = 63965, },
},
completed = [[
local unlocked = states[1]:IsCompleted() -- The Last Sigil
local active = Custom.GetKorthiaDailies()
local count = 3
if unlocked then
count = active and active.n or 5
end
return tCount(states, "IsCompleted", 2) == count
]],
text = [[
local unlocked = states[1]:IsCompleted() -- The Last Sigil
local active = Custom.GetKorthiaDailies()
local count = 3
local default = active == nil
if unlocked then
if active and active.n <= 3 then
count = 5
default = true
else
count = active and active.n or 5
end
end
if default then
return format("%s / %s*", tCount(states, "IsCompleted", 2), count)
else
return format("%s / %s", tCount(states, "IsCompleted", 2), count)
end
]],
tooltip = [[
local unlocked = states[1]:IsCompleted() -- The Last Sigil
local active = Custom.GetKorthiaDailies()
tooltip:AddLine(self:GetName())
if active then
for i=2,#states do
local state = states[i]
local questID = state:GetID()
if state:IsCompleted() or state:IsActive() or (active[questID] and (unlocked or Custom.IsBaseKorthiaDaily(questID))) then
Custom.AddQuestToTooltip(state, tooltip)
end
end
end
]],
},
{
id = "btwtodo:renownquests",
name = L["Renown Quests"],
states = {
{ type = "quest", id = 61982, }, -- Replenish the Reservoir - Kyrian
{ type = "quest", id = 61981, }, -- Replenish the Reservoir - Venthyr
{ type = "quest", id = 61984, }, -- Replenish the Reservoir - Night Fae
{ type = "quest", id = 61983, }, -- Replenish the Reservoir - Necrolord
{ type = "quest", id = 63949, }, -- Shaping Fates
},
completed = [[
local covenantID = character:GetCovenant()
local state = covenantID ~= 0 and states["quest:" .. Custom.GetReservoirQuestForCovenant(covenantID)] or states[1]
return state:IsCompleted() and states["quest:63949"]:IsCompleted()
]],
text = [[
local covenantID = character:GetCovenant()
local state = covenantID ~= 0 and states["quest:" .. Custom.GetReservoirQuestForCovenant(covenantID)] or states[1]
return format("%d / %d", (state:IsCompleted() and 1 or 0) + (states["quest:63949"]:IsCompleted() and 1 or 0), 2)
]],
tooltip = [[
tooltip:AddLine(self:GetName())
local covenantID = character:GetCovenant()
local state = covenantID ~= 0 and states["quest:" .. Custom.GetReservoirQuestForCovenant(covenantID)] or states[1]
Custom.AddQuestToTooltip(state, tooltip)
Custom.AddQuestToTooltip(states["quest:63949"], tooltip)
]]
},
{
id = "btwtodo:raidvault",
name = L["Raid Vault"],
version = 1,
changeLog = {
L["Fixed tooltip displaying entire lockout instead of only bosses the character has defeated."],
},
states = {
{ type = "vault", id = Enum.WeeklyRewardChestThresholdType.Raid, },
},
completed = "return states[1]:IsThreshold(3)",
text = [[
local text = format("%s / %s / %s", states[1]:GetLevelInitial(1), states[1]:GetLevelInitial(2), states[1]:GetLevelInitial(3))
if self:IsCompleted() then
return text -- Already color coded
elseif states[1]:IsThreshold(2) then
return Colors.STALLED:WrapTextInColorCode(text)
elseif states[1]:IsThreshold(1) then
return Colors.STARTED:WrapTextInColorCode(text)
else
return text
end
]],
tooltip = [[
tooltip:AddLine(self:GetName())
local instanceName = nil
for _,encounter in ipairs(states[1]:GetEncounters()) do
if instanceName ~= encounter.instanceName then
tooltip:AddLine(format("%s", encounter.instanceName), 1, 1, 1)
instanceName = encounter.instanceName
end
local name = encounter.name
if encounter.bestDifficulty == 16 then
tooltip:AddLine(format("- %s (%s)", name, encounter.difficultyName), Colors.LEGENDARY:GetRGB())
elseif encounter.bestDifficulty == 15 then
tooltip:AddLine(format("- %s (%s)", name, encounter.difficultyName), Colors.EPIC:GetRGB())
elseif encounter.bestDifficulty == 14 then
tooltip:AddLine(format("- %s (%s)", name, encounter.difficultyName), Colors.RARE:GetRGB())
elseif encounter.bestDifficulty == 17 then
tooltip:AddLine(format("- %s (%s)", name, encounter.difficultyName), Colors.UNCOMMON:GetRGB())
else
tooltip:AddLine(format("- %s", name), 0.5, 0.5, 0.5)
end
end
]],
click = [[Custom.OpenVaultFrame()]]
},
{
id = "btwtodo:dungeonvault",
name = L["Dungeon Vault"],
states = {
{ type = "vault", id = Enum.WeeklyRewardChestThresholdType.Activities, },
{ type = "mythicplusruns", },
},
version = 1,
changeLog = {
L["Fixed showing the tenth run as a gear item instead of 8th"],
},
completed = "return states[1]:GetLevel(3) >= 15",
text = [[
local a, b, c = states[1]:GetLevel(1), states[1]:GetLevel(2), states[1]:GetLevel(3)
local text = format("%s / %s / %s", a == 0 and "-" or a, b == 0 and "-" or b, c == 0 and "-" or c)
if self:IsCompleted() then
return text -- Already color coded
elseif states[1]:IsThreshold(2) then
return Colors.STALLED:WrapTextInColorCode(text)
elseif states[1]:IsThreshold(1) then
return Colors.STARTED:WrapTextInColorCode(text)
else
return text
end
]],
tooltip = [[
tooltip:AddLine(self:GetName())
for index, _, name, level, completed in states[2]:IterateRuns() do
local text
if completed then
text = format("%s (%d)", name, level)
else
text = format("%s- (%d)", name, level)
end
if index == 1 or index == 4 or index == 8 then
tooltip:AddLine(format("%s : %d ilvl", text, Custom.GetRewardLevelForDifficultyLevel(level)), 0, 1, 0)
else
tooltip:AddLine(text, 1, 1, 1)
end
-- Only show max top 8
if index == 8 then
break
end
end
]],
click = [[Custom.OpenVaultFrame()]]
},
{
id = "btwtodo:keystone",
name = L["Keystone"],
version = 1,
changeLog = {
L["Added shift clicking keystone to chat"],
},
states = {
{ type = "keystone", },
},
completed = "return states[1]:GetChallengeMapID() ~= nil",
text = [[
local short, level = states[1]:GetChallengeShortMapName(), states[1]:GetLevel()
if short then
return format("%s (%d)", short, level)
else
return ""
end
]],
tooltip = [[
if states[1]:GetChallengeMapID() then
local name, level = states[1]:GetChallengeMapName(), states[1]:GetLevel()
local _, ilvl = Custom.GetRewardLevelForDifficultyLevel(level)
tooltip:AddLine(format(L["%s (Level %d)"], name, level))
tooltip:AddLine(format(L["Rewards item level %d"], ilvl), 1, 1, 1)
end