-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassOrderHallsComplete.lua
1749 lines (1749 loc) · 85.1 KB
/
ClassOrderHallsComplete.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
--------------------------------------------------------------------------------------------------------------------------------------------
-- Initialize Variables
--------------------------------------------------------------------------------------------------------------------------------------------
local NS = select( 2, ... );
local L = NS.localization;
NS.releasePatch = "11.0.2";
NS.versionString = "1.40";
NS.version = tonumber( NS.versionString );
--
NS.initialized = false;
--
NS.lastTimeUpdateRequest = nil;
NS.lastTimeUpdateRequestSent = nil;
NS.lastTimeUpdateAll = nil;
NS.updateAllInterval = 10;
--
NS.shipmentConfirmsRequired = 3; -- Bypassed for players without a Class Order Hall
NS.shipmentConfirmsCount = 0;
NS.shipmentConfirmsFlaggedComplete = false;
NS.refresh = false;
--
NS.minimapButtonFlash = nil;
NS.alertFlashing = false;
--
NS.selectedCharacterKey = nil;
NS.charactersTabItems = {};
--
NS.allCharacters = {
seals = {},
missions = {},
advancement = {},
orders = {},
--
missionsComplete = 0,
missionsTotal = 0,
nextMissionTimeRemaining = nil,
allMissionsTimeRemaining = nil,
nextMissionCharName = "",
--
advancementsComplete = 0,
advancementsTotal = 0,
nextAdvancementTimeRemaining = nil,
allAdvancementsTimeRemaining = nil,
nextAdvancementCharName = "",
--
workOrdersReady = 0,
workOrdersTotal = 0,
nextWorkOrderTimeRemaining = nil,
allWorkOrdersTimeRemaining = nil,
nextWorkOrderCharName = "",
--
alertCurrentCharacter = false,
alertAnyCharacter = false,
};
NS.currentCharacter = {
name = UnitName( "player" ) .. "-" .. GetRealmName(),
class = select( 2, UnitClass( "player" ) ), -- Permanent
classID = select( 3, UnitClass( "player" ) ), -- Permanent
key = nil, -- Set on initialize and reset after character deletion
level = nil, -- Reset in UpdateCharacter()
troops = nil, -- Set on events
};
--
NS.classRef = {
--
-- Class Reference
--
-- Quests or Talents that signify the character is capable of starting Research or Work Orders
--
-- advancement = "Order Advancement" - questID
-- armaments = Champion Armaments or Equipment Work Orders Talent - Tier 3 - talent.id
-- bonusroll = Bonus Roll Work Order Talent - Tier 5 - talent.id
-- missions = "Missions" - questID
--
["WARRIOR"] = {
advancement = 42611, -- Einar the Runecaster
armaments = 411, -- Heavenly Forge
missions = 42598, -- Champions of Skyhold
icon = 626008,
},
["DEATHKNIGHT"] = {
advancement = 43268, -- Tech It Up A Notch
armaments = 433, -- Brothers in Arms
missions = 43264, -- Rise, Champions
icon = 625998,
},
["PALADIN"] = {
advancement = 42850, -- Tech It Up A Notch
armaments = 400, -- Plowshares to Swords
bonusroll = 398, -- Holy Purpose
missions = 42846, -- The Blood Matriarch
icon = 626003,
},
["MONK"] = {
advancement = 42191, -- Tech It Up A Notch
bonusroll = 256, -- One with Destiny
missions = 42187, -- Rise, Champions
icon = 626002,
},
["PRIEST"] = {
advancement = 43277, -- Tech It Up A Notch
armaments = 455, -- Armaments of Light
bonusroll = 454, -- Blessed Seals
missions = 43270, -- Rise, Champions
icon = 626004,
},
["SHAMAN"] = {
advancement = 41740, -- Tech It Up A Notch
bonusroll = 49, -- Spirit Walk
missions = 42383, -- Rise, Champions
icon = 626006,
},
["DRUID"] = {
advancement = 42588, -- Branching Out
bonusroll = 355, -- Elune's Chosen
missions = 42583, -- Rise, Champions
icon = 625999,
},
["ROGUE"] = {
advancement = 43015, -- What Winstone Suggests
armaments = 444, -- Weapons Smuggler
bonusroll = 443, -- Plunder
missions = 42139, -- Rise, Champions
icon = 626005,
},
["MAGE"] = {
advancement = 42696, -- Tech It Up A Notch
armaments = 389, -- Arcane Armaments
bonusroll = 387, -- Arcane Divination
missions = 42663, -- Rise, Champions
icon = 626001,
},
["WARLOCK"] = {
advancement = 42601, -- Tech It Up A Notch
armaments = 364, -- Shadow Pact
missions = 42608, -- Rise, Champions
icon = 626007,
},
["HUNTER"] = {
advancement = 42526, -- Tech It Up A Notch
armaments = 378, -- Fletchery
bonusroll = 377, -- Unseen Path
missions = 42519, -- Rise, Champions
icon = 626000,
},
["DEMONHUNTER"] = {
advancement = 42683, -- Demonic Improvements
armaments = 422, -- Fel Armaments
bonusroll = 420, -- Focused War Effort
missions = { 42670, 42671 }, -- Rise, Champions
icon = 1260827,
},
["EVOKER"] = {
-- Not available during Legion when Class Order Halls were introduced.
advancement = nil,
armaments = nil,
bonusroll = nil,
missions = nil,
icon = 4574311,
}
};
NS.troopTextureRef = {
--
-- Troop Texture Reference
--
-- Some troops have Work Orders that use a different icon than the Order Hall Command Bar.
-- In some cases the Work Order name may be misspelled or simply doesn't match the troop.
-- This reference table matches troops to work orders when icon and name both fail.
--
-- [OrderHallCommandBarTexture] = <WorkOrderTexture>, -- <Class: Troop>
--
[1396706] = 1452569, -- Monk: Tiger Initiates
[1396702] = 1489388, -- Paladin: Shieldbearer Phalanx
[1396703] = 1489392, -- Paladin: Silver Hand Knights
[1396691] = 1489422, -- Warlock: Black Harvest Acolytes
[1401874] = 1489383, -- Warrior: Valkyra Shieldmaidens
[1396696] = 1489377, -- Mage: Tirisguarde Apprentices
[1401852] = 1452570, -- Mage: Arcane Golems
[1401889] = 1489438, -- Demon Hunter: Naga Myrmidons
[1401892] = 1489385, -- Rogue: Defias Thieves
[1401894] = 1489411, -- Rogue: Crew of Pirates
[1066217] = 1452631, -- Priest: Netherlight Paragons
[1066169] = 1452634, -- Priest: Band of Zealots
[1401884] = 1489417, -- Shaman: Earthen Ring Geomancers
[1396660] = 1396659, -- Shaman: Ascendants
[1396686] = 1452562, -- Druid: Daughters of Cenarius
[1396668] = 1489448, -- Druid: Druids of the Claw
};
-- Ignored Work Order Textures
-- Instant Nomi Cooking Recipe
-- Blessing of the Order
-- Instant Complete World Quest Items
NS.ignoredWorkOrderTextures = { 1387621, 135987, 135705, 341980, 1411833, 1033908, 1367345, 1135365 };
-- Sealing Fate Quests in Dalaran
-- 43892 = Sealing Fate: Order Resources (1000)
-- 43893 = Sealing Fate: Stashed Order Resources (2000)
-- 43894 = Sealing Fate: Extraneous Order Resources (4000)
-- 43895 = Sealing Fate: Gold (1000)
-- 43896 = Sealing Fate: Piles of Gold (2000)
-- 43897 = Sealing Fate: Immense Fortune of Gold (4000)
-- 47851 = Sealing Fate: Marks of Honor (5)
-- 47864 = Sealing Fate: Additional Marks of Honor (10)
-- 47865 = Sealing Fate: Piles of Marks of Honor (20)
NS.sealingFateQuests = { 43892, 43893, 43894, 43895, 43896, 43897, 47851, 47864, 47865 };
--
NS.sealofBrokenFateMax = 6;
NS.sealofBrokenFateWeeklyMax = 3;
NS.maxAdvancementTiers = 7;
--
NS.ldbTooltip = {
--header = {},
--missions = {},
--advancements = {},
--orders = {},
available = false,
};
--------------------------------------------------------------------------------------------------------------------------------------------
-- SavedVariables
--------------------------------------------------------------------------------------------------------------------------------------------
NS.DefaultSavedVariables = function()
return {
["version"] = NS.version,
["characters"] = {},
["orderCharactersAutomatically"] = true,
["currentCharacterFirst"] = true,
["showCharacterRealms"] = true,
["forgetDragPosition"] = true,
["dragPosition"] = nil,
["monitorRows"] = 8,
["monitorColumn"] = {
"missions",
"advancement",
"cooking-recipes",
"troop1",
"troop2",
"champion-armaments",
"bonus-roll",
"troop3",
"troop4",
"troop5",
"troop6",
"troop7",
},
["alert"] = "current",
["alertMissions"] = true,
["alertClassHallUpgrades"] = true,
["alertTroops"] = true,
["alertChampionArmaments"] = true,
["alertLegionCookingRecipes"] = true,
["alertBonusRollToken"] = true,
["alertBonusRollTokenDisableWhenMaxSeals"] = true,
["alertDisableInInstances"] = true,
["ldbSource"] = "current",
["ldbTextFormat"] = "missions-upgrades-orders",
["ldbShowLabels"] = true,
["ldbShowWhenNone"] = true,
["ldbShowNextMission"] = true,
["ldbShowNextMissionCharacter"] = true,
["ldbShowNextUpgrade"] = true,
["ldbShowNextUpgradeCharacter"] = true,
["ldbShowNextOrder"] = true,
["ldbShowNextOrderCharacter"] = true,
["ldbi"] = { hide = false },
["ldbiShowCharacterTooltip"] = true,
};
end
--
NS.Upgrade = function()
local vars = NS.DefaultSavedVariables();
local version = NS.db["version"];
-- 1.01
if version < 1.01 then
-- Add
NS.db["alertMissions"] = vars["alertMissions"];
NS.db["alertClassHallUpgrades"] = vars["alertClassHallUpgrades"];
NS.db["alertTroops"] = vars["alertTroops"];
NS.db["alertChampionArmaments"] = vars["alertChampionArmaments"];
NS.db["alertLegionCookingRecipes"] = vars["alertLegionCookingRecipes"];
--REMOVED--NS.db["alertInstantCompleteWorldQuest"] = vars["alertInstantCompleteWorldQuest"];
NS.db["alertBonusRollToken"] = vars["alertBonusRollToken"];
end
-- 1.02
if version < 1.02 then
-- Add
NS.db["forgetDragPosition"] = vars["forgetDragPosition"];
end
-- 1.03
if version < 1.03 then
-- Add
NS.db["orderCharactersAutomatically"] = vars["orderCharactersAutomatically"];
NS.db["currentCharacterFirst"] = vars["currentCharacterFirst"];
NS.db["monitorRows"] = vars["monitorRows"];
end
-- 1.05
if version < 1.05 then
-- Fixes missing field "order" in "characters" table introduced in v1.03
NS.ResetCharactersOrderPositions();
end
-- 1.06
if version < 1.06 then
-- Add
NS.db["monitorColumn"] = vars["monitorColumn"];
end
-- 1.10
if version < 1.10 then
-- Change
local mck = NS.FindKeyByValue( NS.db["monitorColumn"], "world-quest-complete/bonus-roll" );
if mck then
NS.db["monitorColumn"][mck] = "world-quest-complete/blessing-order/bonus-roll";
end
-- Add
--REMOVED--NS.db["alertBlessingOfTheOrder"] = vars["alertBlessingOfTheOrder"];
end
-- 1.23
if version < 1.23 then
-- Add
if not NS.FindKeyByValue( NS.db["monitorColumn"], "troop5" ) then
table.insert( NS.db["monitorColumn"], "troop5" );
end
end
-- 1.26
if version < 1.26 then
-- Add
NS.db["ldbSource"] = vars["ldbSource"];
NS.db["ldbTextFormat"] = vars["ldbTextFormat"];
NS.db["ldbShowLabels"] = vars["ldbShowLabels"];
NS.db["ldbShowWhenNone"] = vars["ldbShowWhenNone"];
NS.db["ldbShowNextMission"] = vars["ldbShowNextMission"];
NS.db["ldbShowNextMissionCharacter"] = vars["ldbShowNextMissionCharacter"];
NS.db["ldbShowNextUpgrade"] = vars["ldbShowNextUpgrade"];
NS.db["ldbShowNextUpgradeCharacter"] = vars["ldbShowNextUpgradeCharacter"];
NS.db["ldbShowNextOrder"] = vars["ldbShowNextOrder"];
NS.db["ldbShowNextOrderCharacter"] = vars["ldbShowNextOrderCharacter"];
NS.db["ldbi"] = vars["ldbi"];
NS.db["ldbiShowCharacterTooltip"] = vars["ldbiShowCharacterTooltip"];
if not NS.FindKeyByValue( NS.db["monitorColumn"], "troop6" ) then
table.insert( NS.db["monitorColumn"], "troop6" );
end
-- Remove
NS.db["alertArtifactResearchNotes"] = nil;
NS.db["alertAnyArtifactResearchNotes"] = nil;
NS.db["alertChatArtifactResearchNotes"] = nil;
NS.RemoveKeysByFunction( NS.db["monitorColumn"], function( mc ) return ( mc == "artifact-research-notes" ); end );
end
-- 1.28
if version < 1.28 then
-- Add
if not NS.FindKeyByValue( NS.db["monitorColumn"], "troop7" ) then
table.insert( NS.db["monitorColumn"], "troop7" );
end
end
-- 1.30
if version < 1.30 then
-- Add
NS.db["alertBonusRollTokenDisableWhenMaxSeals"] = vars["alertBonusRollTokenDisableWhenMaxSeals"]
end
-- 1.33
if version < 1.33 then
-- Remove
NS.db["alertBlessingOfTheOrder"] = nil;
NS.db["alertInstantCompleteWorldQuest"] = nil;
-- Change
local mck = NS.FindKeyByValue( NS.db["monitorColumn"], "world-quest-complete/blessing-order/bonus-roll" );
if mck then
NS.db["monitorColumn"][mck] = "bonus-roll";
end
end
-- 1.36
if version < 1.36 then
-- Wipe characters because of level squish and other bad data that may have been introduced due to major changes in patch 9.0.1
NS.db["characters"] = {};
NS.Print("Character data has been wiped to due to significant changes in patch 9.0.1. Please log back into any characters you wish to track a Class Order Hall on to repopulate the information.");
end
-- 1.38
if version < 1.38 then
-- Got rid of custom minimap button, so enable LibDBIcon minimap button by default now
NS.db["ldbi"] = vars["ldbi"];
end
--
NS.db["version"] = NS.version;
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Misc
--------------------------------------------------------------------------------------------------------------------------------------------
NS.SortCharacters = function( order, move )
local selectedCharacterName = NS.selectedCharacterKey and NS.db["characters"][NS.selectedCharacterKey]["name"] or NS.currentCharacter.name;
--
if order == "automatic" then
table.sort ( NS.db["characters"],
function ( char1, char2 )
if char1["realm"] == char2["realm"] then
return char1["name"] < char2["name"];
else
return char1["realm"] < char2["realm"];
end
end
);
elseif order == "manual" then
for i = 1, #NS.db["characters"] do
if i == move["ck"] then
-- Order
NS.db["characters"][i]["order"] = move["order"];
elseif move["ck"] > move["order"] then
-- Moving Up, Reorder Downward
if i == move["order"] or ( i < move["ck"] and i > move["order"] ) then
NS.db["characters"][i]["order"] = i + 1;
end
elseif move["ck"] < move["order"] then
-- Moving Down, Reorder Upward
if i == move["order"] or ( i > move["ck"] and i < move["order"] ) then
NS.db["characters"][i]["order"] = i - 1;
end
end
end
NS.Sort( NS.db["characters"], "order", "ASC" );
end
--
NS.currentCharacter.key = NS.FindKeyByField( NS.db["characters"], "name", NS.currentCharacter.name );
NS.selectedCharacterKey = NS.FindKeyByField( NS.db["characters"], "name", selectedCharacterName );
end
--
NS.ChangeColumns = function( old, new )
-- Create temp table for column slugs that require change
local t = {};
-- Write column slugs to temp table that require change
for i = 1, #NS.db["monitorColumn"] do
if i == old then
-- New
t[new] = NS.db["monitorColumn"][i];
elseif old > new then
-- Moving Up, Reorder Downward
if i == new or ( i < old and i > new ) then
t[i + 1] = NS.db["monitorColumn"][i];
end
elseif old < new then
-- Moving Down, Reorder Upward
if i == new or ( i > old and i < new ) then
t[i - 1] = NS.db["monitorColumn"][i];
end
end
end
-- Copy changed column slugs to primary table
for k,v in pairs( t ) do
NS.db["monitorColumn"][k] = v;
end
end
--
NS.ResetCharactersOrderPositions = function()
for i = 1, #NS.db["characters"] do
NS.db["characters"][i]["order"] = i;
end
end
--
NS.OrdersReadyForPickup = function( ready, total, duration, nextSeconds, passedTime )
-- Calculate how many orders could have completed in the time passed, which could not be larger than the
-- amount of orders in progress ( i.e. total - ready ), then we just add the orders that were already ready
if not total then
return 0;
elseif duration == 0 then
return total;
else
return math.min( math.floor( ( passedTime + ( duration - nextSeconds ) ) / duration ), ( total - ready ) ) + ready;
end
end
--
NS.OrdersReadyToStart = function( capacity, total, troopCount )
total = total and total or 0;
troopCount = troopCount and troopCount or 0;
return ( capacity - ( total + troopCount ) );
end
--
NS.OrdersAllSeconds = function( duration, total, ready, nextSeconds, passedTime )
if not total or duration == 0 then
return 0;
else
local seconds = duration * ( total - ready ) - ( duration - ( nextSeconds - passedTime ) );
return math.max( seconds, 0 );
end
end
--
NS.OrdersNextSeconds = function( allSeconds, duration )
if allSeconds == 0 then
return 0;
elseif allSeconds == duration then
return duration;
else
return allSeconds % duration;
end
end
--
NS.OrdersOrigNextSeconds = function( duration, creationTime, currentTime )
if not creationTime or duration == 0 or creationTime == 0 then
return 0;
else
local passedTime = math.max( ( currentTime - creationTime ), 0 );
return ( duration - passedTime );
end
end
--
NS.ToggleAlert = function()
if not NS.minimapButtonFlash then
NS.minimapButtonFlash = _G[NS.ldbiButtonName]:CreateAnimationGroup();
NS.minimapButtonFlash:SetLooping( "REPEAT" );
local a1 = NS.minimapButtonFlash:CreateAnimation( "Alpha" );
a1:SetDuration( 0.5 );
a1:SetFromAlpha( 1 );
a1:SetToAlpha( -1 );
a1:SetOrder( 1 );
local a2 = NS.minimapButtonFlash:CreateAnimation( "Alpha" );
a2:SetDuration( 0.5 );
a2:SetFromAlpha( -1 );
a2:SetToAlpha( 1 );
a2:SetOrder( 2 );
end
--
if not NS.db["ldbi"].hide and ( not NS.db["alertDisableInInstances"] or not IsInInstance() ) and (
( NS.db["alert"] == "current" and NS.allCharacters.alertCurrentCharacter ) or ( NS.db["alert"] == "any" and NS.allCharacters.alertAnyCharacter )
) then
if not NS.alertFlashing then
NS.alertFlashing = true;
NS.minimapButtonFlash:Play();
end
else
if NS.alertFlashing then
NS.alertFlashing = false;
NS.minimapButtonFlash:Stop();
end
end
end
--
NS.ShipmentConfirmsComplete = function()
NS.shipmentConfirmsFlaggedComplete = true;
_G[NS.UI.SubFrames[1]:GetName() .. "MessageShipmentConfirmsText"]:SetText( "" );
if NS.UI.SubFrames[1]:IsShown() then
NS.refresh = true;
end
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Updates
--------------------------------------------------------------------------------------------------------------------------------------------
NS.UpdateCharacter = function()
--------------------------------------------------------------------------------------------------------------------------------------------
-- Find/Add Character
--------------------------------------------------------------------------------------------------------------------------------------------
local newCharacter = false;
local k = NS.FindKeyByField( NS.db["characters"], "name", NS.currentCharacter.name ) or #NS.db["characters"] + 1;
if not NS.db["characters"][k] then
newCharacter = true; -- Flag for sort
NS.db["characters"][k] = {
["name"] = NS.currentCharacter.name, -- Permanent
["realm"] = GetRealmName(), -- Permanent
["class"] = NS.currentCharacter.class, -- Permanent
["level"] = 0, -- Reset below every update
["orderResources"] = 0, -- Reset below every update
["advancement"] = {}, -- Reset below every update
["orders"] = {}, -- Reset below every update
["troops"] = {}, -- Reset below based on event driven data collection
["missions"] = {}, -- Reset below every update
["seals"] = {}, -- Reset below every update
["monitor"] = {}, -- Set below for each item when first added
};
end
--------------------------------------------------------------------------------------------------------------------------------------------
NS.currentCharacter.level = UnitLevel( "player" );
NS.db["characters"][k]["level"] = NS.currentCharacter.level;
NS.db["characters"][k]["orderResources"] = C_CurrencyInfo.GetCurrencyInfo( 1220 )["quantity"];
NS.db["characters"][k]["sealOfBrokenFate"] = C_CurrencyInfo.GetCurrencyInfo( 1273 )["quantity"];
--------------------------------------------------------------------------------------------------------------------------------------------
-- Class Order Hall ?
--------------------------------------------------------------------------------------------------------------------------------------------
local hasOrderHall = C_Garrison.HasGarrison( Enum.GarrisonType.Type_7_0_Garrison );
if hasOrderHall then
--------------------------------------------------------------------------------------------------------------------------------------------
-- Shipment Confirm: Avoids incomplete and inaccurate data being recorded following login, reloads, and pickups
--------------------------------------------------------------------------------------------------------------------------------------------
local shipmentsNum,shipmentsNumReady = 0,0;
--
local followerShipments = C_Garrison.GetFollowerShipments( Enum.GarrisonType.Type_7_0_Garrison );
shipmentsNum = shipmentsNum + #followerShipments;
for i = 1, #followerShipments do
local name,texture,shipmentCapacity,shipmentsReady,shipmentsTotal,creationTime,duration,timeleftString = C_Garrison.GetLandingPageShipmentInfoByContainerID( followerShipments[i] );
if name and texture and shipmentCapacity > 0 and shipmentsReady and shipmentsTotal > 0 then
shipmentsNumReady = shipmentsNumReady + 1;
end
end
--
local looseShipments = C_Garrison.GetLooseShipments( Enum.GarrisonType.Type_7_0_Garrison );
shipmentsNum = shipmentsNum + #looseShipments;
for i = 1, #looseShipments do
local name,texture,shipmentCapacity,shipmentsReady,shipmentsTotal,creationTime,duration,timeleftString = C_Garrison.GetLandingPageShipmentInfoByContainerID( looseShipments[i] );
if name and texture and shipmentCapacity > 0 and shipmentsReady and shipmentsTotal > 0 then
shipmentsNumReady = shipmentsNumReady + 1;
end
end
--
local shipmentConfirmed = false;
if shipmentsNum == shipmentsNumReady then
shipmentConfirmed = true;
if not NS.shipmentConfirmsFlaggedComplete and NS.shipmentConfirmsCount < NS.shipmentConfirmsRequired then
NS.shipmentConfirmsCount = NS.shipmentConfirmsCount + 1;
if NS.shipmentConfirmsCount == NS.shipmentConfirmsRequired then
NS.ShipmentConfirmsComplete();
end
end
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Update Class Order Hall info the moment shipments are confirmed
--------------------------------------------------------------------------------------------------------------------------------------------
if NS.shipmentConfirmsFlaggedComplete and shipmentConfirmed then
local monitorable = {};
local currentTime = time();
--------------------------------------------------------------------------------------------------------------------------------------------
-- Order Advancement
--------------------------------------------------------------------------------------------------------------------------------------------
wipe( NS.db["characters"][k]["advancement"] ); -- Start fresh every update
local talentTiers = {}; -- Selected talents by tier
if C_QuestLog.IsQuestFlaggedCompleted( NS.classRef[NS.currentCharacter.class].advancement ) or C_QuestLog.GetLogIndexForQuestID( NS.classRef[NS.currentCharacter.class].advancement ) ~= nil then
if NS.db["characters"][k]["monitor"]["advancement"] == nil then
NS.db["characters"][k]["monitor"]["advancement"] = true;
end
monitorable["advancement"] = true;
--
local talentTreeIDs = C_Garrison.GetTalentTreeIDsByClassID( Enum.GarrisonType.Type_7_0_Garrison, NS.currentCharacter.classID );
local completeTalentID = C_Garrison.GetCompleteTalent( Enum.GarrisonType.Type_7_0_Garrison );
if talentTreeIDs and talentTreeIDs[1] then -- Talent trees and first treeID available
local talentTree = C_Garrison.GetTalentTreeInfo( talentTreeIDs[1] )["talents"];
for _,talent in ipairs( talentTree ) do
talent.tier = talent.tier + 1; -- Fix tiers starting at 0
talent.uiOrder = talent.uiOrder + 1; -- Fix order starting at 0
if talent.selected or talent.isBeingResearched then
talentTiers[talent.tier] = talent;
if talent.isBeingResearched or talent.id == completeTalentID then
NS.db["characters"][k]["advancement"]["talentBeingResearched"] = CopyTable( talent );
end
end
end
-- Talent Tier Available?
if ( not NS.db["characters"][k]["advancement"]["talentBeingResearched"] and #talentTiers < NS.maxAdvancementTiers ) then
NS.db["characters"][k]["advancement"]["newTalentTier"] = {};
local newTier = #talentTiers + 1;
for _,talent in ipairs( talentTree ) do
if talent.tier == newTier then
NS.db["characters"][k]["advancement"]["newTalentTier"][talent.uiOrder] = CopyTable( talent );
end
end
end
end
--
NS.db["characters"][k]["advancement"]["numTalents"] = #talentTiers;
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Work Orders
--------------------------------------------------------------------------------------------------------------------------------------------
wipe( NS.db["characters"][k]["orders"] ); -- Start fresh every update
-- Follower Shipments
local followerShipments = C_Garrison.GetFollowerShipments( Enum.GarrisonType.Type_7_0_Garrison );
for i = 1, #followerShipments do
local name,texture,capacity,ready,total,creationTime,duration = C_Garrison.GetLandingPageShipmentInfoByContainerID( followerShipments[i] );
table.insert( NS.db["characters"][k]["orders"], {
["name"] = name,
["texture"] = texture,
["capacity"] = capacity,
["ready"] = ready,
["total"] = total,
["duration"] = duration,
["nextSeconds"] = NS.OrdersOrigNextSeconds( duration, creationTime, currentTime ),
} );
--NS.Print( texture .. ":" .. name ); -- DEBUG
end
-- Troops => Follower Shipments
if NS.currentCharacter.troops then
NS.db["characters"][k]["troops"] = CopyTable( NS.currentCharacter.troops );
NS.currentCharacter.troops = nil;
end
local troops = NS.db["characters"][k]["troops"];
for i = 1, #troops do
local ordersKey = NS.FindKeyByField( NS.db["characters"][k]["orders"], "texture", troops[i].icon ) or NS.FindKeyByField( NS.db["characters"][k]["orders"], "name", troops[i].name ) or NS.FindKeyByField( NS.db["characters"][k]["orders"], "texture", NS.troopTextureRef[troops[i].icon] );
local texture;
if ordersKey then
-- Troop order FOUND
local order = NS.db["characters"][k]["orders"][ordersKey];
texture = order["texture"];
-- Texture Fix
if troops[i].icon ~= texture then
texture = troops[i].icon;
order["name"] = troops[i].name; -- Fix name too since it may not have matched.
order["texture"] = texture;
end
--
order["capacity"] = troops[i].limit;
order["troopCount"] = troops[i].count;
else
-- Troop order NOT FOUND
texture = troops[i].icon;
table.insert( NS.db["characters"][k]["orders"], {
["name"] = troops[i].name,
["texture"] = texture,
["capacity"] = troops[i].limit,
["troopCount"] = troops[i].count,
} );
-- Troop not gained thru an order but instead thru an item:
-- Abomination (1401851:Death Knight:7.0)
-- Grimtotem Warrior (1551342:Shaman:7.2)
-- Coilskar Brute (1551349:Demon Hunter:7.2)
-- Krokul Ridgestalker (1712229:All:7.3)
-- Void-Purged Krokul (1712228:All:7.3)
-- Lightforged Bulwark (1694048:All:7.3)
local troopSummonItem = ( texture == 1401851 and 140767 ) or ( texture == 1551342 and 143850 ) or ( texture == 1551349 and 143849 ) or ( texture == 1712229 and 152095 ) or ( texture == 1712228 and 152096 ) or ( texture == 1694048 and 152097 ) or nil;
if troopSummonItem then
local ordersKey = #NS.db["characters"][k]["orders"]; -- Last order inserted
local troopSummonItemCount = GetItemCount( troopSummonItem, true );
NS.db["characters"][k]["orders"][ordersKey]["troopSummonItemCount"] = texture == 1401851 and ( troopSummonItemCount < 5 and 0 or 1 ) or troopSummonItemCount; -- Death Knight: Abomination - Combine (5) Piles of Bits and Bones
end
end
if NS.db["characters"][k]["monitor"][texture] == nil then
NS.db["characters"][k]["monitor"][texture] = true; -- Monitored by default
end
monitorable[texture] = true;
end
NS.RemoveKeysByFunction( NS.db["characters"][k]["orders"], function( order ) if not order.troopCount then return true end end ); -- Remove unexpected followerShipments without a matching troop
NS.Sort( NS.db["characters"][k]["orders"], "capacity", "DESC" ); -- Order troops by capacity for a more consistent display
-- Loose Shipments
local looseShipments = C_Garrison.GetLooseShipments( Enum.GarrisonType.Type_7_0_Garrison );
for i = 1, #looseShipments do
local name,texture,capacity,ready,total,creationTime,duration = C_Garrison.GetLandingPageShipmentInfoByContainerID( looseShipments[i] );
if not NS.FindKeyByValue( NS.ignoredWorkOrderTextures, texture ) then -- Ignore certain work orders
table.insert( NS.db["characters"][k]["orders"], {
["name"] = name,
["texture"] = texture,
["capacity"] = capacity,
["ready"] = ready,
["total"] = total,
["duration"] = duration,
["nextSeconds"] = NS.OrdersOrigNextSeconds( duration, creationTime, currentTime ),
} );
if NS.db["characters"][k]["monitor"][texture] == nil then
NS.db["characters"][k]["monitor"][texture] = true;
end
monitorable[texture] = true;
end
end
-- Champion Armaments (Tier 3)
if talentTiers[3] and not talentTiers[3].isBeingResearched and talentTiers[3].id == NS.classRef[NS.currentCharacter.class].armaments then
local texture = 975736;
local capacity = 4;
local ordersKey = NS.FindKeyByField( NS.db["characters"][k]["orders"], "texture", texture );
local orders = ordersKey and NS.db["characters"][k]["orders"][ordersKey]["total"] or 0;
if orders == 0 then
table.insert( NS.db["characters"][k]["orders"], {
["name"] = C_Item.GetItemInfo( 139308 ) or L["Champion Armaments"],
["texture"] = texture,
["capacity"] = capacity,
} );
if NS.db["characters"][k]["monitor"][texture] == nil then
NS.db["characters"][k]["monitor"][texture] = true;
end
monitorable[texture] = true;
end
end
-- Bonus Roll (Tier 5)
if NS.classRef[NS.currentCharacter.class].bonusroll and talentTiers[5] and not talentTiers[5].isBeingResearched and talentTiers[5].id == NS.classRef[NS.currentCharacter.class].bonusroll then
local texture = 133858;
local capacity = 1;
local ordersKey = NS.FindKeyByField( NS.db["characters"][k]["orders"], "texture", texture );
local orders = ordersKey and NS.db["characters"][k]["orders"][ordersKey]["total"] or 0;
if orders == 0 then
table.insert( NS.db["characters"][k]["orders"], {
["name"] = C_Item.GetItemInfo( 139460 ) or L["Seal of Broken Fate"],
["texture"] = texture,
["capacity"] = capacity,
} );
if NS.db["characters"][k]["monitor"][texture] == nil then
NS.db["characters"][k]["monitor"][texture] = true;
end
monitorable[texture] = true;
end
end
-- Cooking Recipes
if C_QuestLog.IsQuestFlaggedCompleted( 40991 ) then
local texture = 134939;
local capacity = 24;
local ordersKey = NS.FindKeyByField( NS.db["characters"][k]["orders"], "texture", texture );
local orders = ordersKey and NS.db["characters"][k]["orders"][ordersKey]["total"] or 0;
if orders == 0 then
table.insert( NS.db["characters"][k]["orders"], {
["name"] = L["Legion Cooking Recipes"],
["texture"] = texture,
["capacity"] = capacity,
} );
if NS.db["characters"][k]["monitor"][texture] == nil then
NS.db["characters"][k]["monitor"][texture] = true;
end
monitorable[texture] = true;
end
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Missions
--------------------------------------------------------------------------------------------------------------------------------------------
wipe( NS.db["characters"][k]["missions"] );
if ( NS.currentCharacter.class ~= "DEMONHUNTER" and C_QuestLog.IsQuestFlaggedCompleted( NS.classRef[NS.currentCharacter.class].missions ) ) or ( NS.currentCharacter.class == "DEMONHUNTER" and ( C_QuestLog.IsQuestFlaggedCompleted( NS.classRef[NS.currentCharacter.class].missions[1] ) or C_QuestLog.IsQuestFlaggedCompleted( NS.classRef[NS.currentCharacter.class].missions[2] ) ) ) then
NS.db["characters"][k]["missions"] = C_Garrison.GetLandingPageItems( Enum.GarrisonType.Type_7_0_Garrison ); -- In Progress or Complete
for i = 1, #NS.db["characters"][k]["missions"] do
local mission = NS.db["characters"][k]["missions"][i];
-- Success Chance
mission.successChance = C_Garrison.GetMissionSuccessChance( mission.missionID );
-- Rewards
mission.rewardsList = {};
for _,reward in pairs( mission.rewards ) do
if reward.quality then
mission.rewardsList[#mission.rewardsList + 1] = ITEM_QUALITY_COLORS[reward.quality + 1].hex .. reward.title .. FONT_COLOR_CODE_CLOSE;
elseif reward.itemID then
local itemName,_,itemRarity,_,_,_,_,_,_,itemTexture = C_Item.GetItemInfo( reward.itemID );
if not itemTexture then
_,_,_,_,itemTexture = C_Item.GetItemInfoInstant( reward.itemID );
end
if itemName then
mission.rewardsList[#mission.rewardsList + 1] = "|T" .. itemTexture .. ":20:20:-2:0|t" .. ITEM_QUALITY_COLORS[itemRarity].hex .. itemName .. FONT_COLOR_CODE_CLOSE;
else
mission.rewardsList[#mission.rewardsList + 1] = "|T" .. itemTexture .. ":20:20:0:0|t";
end
elseif reward.followerXP then
mission.rewardsList[#mission.rewardsList + 1] = HIGHLIGHT_FONT_COLOR_CODE .. reward.title .. FONT_COLOR_CODE_CLOSE;
else
mission.rewardsList[#mission.rewardsList + 1] = HIGHLIGHT_FONT_COLOR_CODE .. reward.title .. FONT_COLOR_CODE_CLOSE;
end
end
-- Followers
for x = 1, #mission.followers do
mission.followers[x] = C_Garrison.GetFollowerName( mission.followers[x] ) or UNKNOWN;
end
end
if NS.db["characters"][k]["monitor"]["missions"] == nil then
NS.db["characters"][k]["monitor"]["missions"] = true; -- Monitored by default
end
monitorable["missions"] = true;
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Seals
--------------------------------------------------------------------------------------------------------------------------------------------
wipe( NS.db["characters"][k]["seals"] );
if NS.currentCharacter.level >= 45 then
-- Bonus Roll Work Order (Talent)
if NS.classRef[NS.currentCharacter.class].bonusroll and talentTiers[5] then
NS.db["characters"][k]["seals"]["bonusRollWorkOrderCompleted"] = C_QuestLog.IsQuestFlaggedCompleted( 43510 ); -- 43510 = Seal of Fate: Class Hall
end
-- Sealing Fate Quests (Dalaran)
local sealingFateQuestsCompleted = 0;
for i = 1, #NS.sealingFateQuests do
if C_QuestLog.IsQuestFlaggedCompleted( NS.sealingFateQuests[i] ) then
sealingFateQuestsCompleted = sealingFateQuestsCompleted + 1;
if sealingFateQuestsCompleted == NS.sealofBrokenFateWeeklyMax then
break; -- Stop early when possible
end
end
end
NS.db["characters"][k]["seals"]["sealingFateQuestsCompleted"] = sealingFateQuestsCompleted;
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Update Time / Monitor Clean Up
--------------------------------------------------------------------------------------------------------------------------------------------
NS.db["characters"][k]["updateTime"] = currentTime;
NS.db["characters"][k]["weeklyResetTime"] = NS.GetWeeklyQuestResetTime();
if not newCharacter then
-- Monitor Clean Up, only when NOT a new character
for monitor in pairs( NS.db["characters"][k]["monitor"] ) do
if not monitorable[monitor] then
NS.db["characters"][k]["monitor"][monitor] = nil;
end
end
end
end
elseif not NS.shipmentConfirmsFlaggedComplete then
NS.ShipmentConfirmsComplete(); -- shipmentConfirms bypassed if no Class Order Hall
end
--------------------------------------------------------------------------------------------------------------------------------------------
-- Sort Characters by realm and name, only when a new character was added
--------------------------------------------------------------------------------------------------------------------------------------------
if newCharacter then
if NS.db["orderCharactersAutomatically"] then
NS.SortCharacters( "automatic" );
NS.ResetCharactersOrderPositions();
else
NS.db["characters"][k]["order"] = k;
end
end
end
--
NS.UpdateCharacters = function()
-- All Characters
local seals = {};
local missions = {};
local advancement = {};
local orders = {};
--
local missionsComplete = 0;
local missionsTotal = 0;
local nextMissionTimeRemaining = 0; -- Lowest time remaining for a mission to complete.
local allMissionsTimeRemaining = 0; -- Highest Time remaining for a mission to complete.
local nextMissionCharName = "";
--
local advancementsComplete = 0;
local advancementsTotal = 0;
local nextAdvancementTimeRemaining = 0; -- Lowest time remaining for an order advancement to complete.
local allAdvancementsTimeRemaining = 0; -- Highest time remaining for an order advancement to complete.
local nextAdvancementCharName = "";
--
local workOrdersReady = 0;
local workOrdersTotal = 0;
local nextWorkOrderTimeRemaining = 0; -- Lowest time remaining for a work order to complete.
local allWorkOrdersTimeRemaining = 0; -- Highest time remaining for a work order to complete.
local nextWorkOrderCharName = "";
--
local alertCurrentCharacter = false;
local alertAnyCharacter = false;
--
-- Loop thru each character
--
local currentTime = time();
for ck,char in ipairs( NS.db["characters"] ) do
local passedTime = char["updateTime"] and ( currentTime > char["updateTime"] and ( currentTime - char["updateTime"] ) or 0 ) or nil; -- Characters without Class Order Hall info will not have an updateTime
--
-- Seals
--
seals[char["name"]] = {};
if char["seals"]["sealingFateQuestsCompleted"] then
local s = seals[char["name"]];
s.sealOfBrokenFate = {
text = string.format( L["Seal of Broken Fate - %d/%d"], char["sealOfBrokenFate"], NS.sealofBrokenFateMax ),
lines = {},
thisWeekQuests = 0,
thisWeekWorkOrder = 0,
thisWeek = 0,
};
--
local sealsThisWeekQuests,sealsThisWeekWorkOrder,sealsThisWeek = 0,0,0;
if currentTime <= char["weeklyResetTime"] then
s.sealOfBrokenFate.thisWeekWorkOrder = char["seals"]["bonusRollWorkOrderCompleted"] and 1 or 0;
s.sealOfBrokenFate.thisWeekQuests = char["seals"]["sealingFateQuestsCompleted"];
s.sealOfBrokenFate.thisWeek = s.sealOfBrokenFate.thisWeekWorkOrder + s.sealOfBrokenFate.thisWeekQuests;
end
--
if char["seals"]["bonusRollWorkOrderCompleted"] ~= nil then
s.sealOfBrokenFate.lines[1] = HIGHLIGHT_FONT_COLOR_CODE .. string.format( L["%d/%d - This week's \"Seal of Broken Fate\" Work Order"], s.sealOfBrokenFate.thisWeekWorkOrder, 1 ) .. FONT_COLOR_CODE_CLOSE;
end
s.sealOfBrokenFate.lines[#s.sealOfBrokenFate.lines + 1] = HIGHLIGHT_FONT_COLOR_CODE .. string.format( L["%d/%d - This week's \"Sealing Fate\" Quests in Dalaran"], s.sealOfBrokenFate.thisWeekQuests, ( NS.sealofBrokenFateWeeklyMax - s.sealOfBrokenFate.thisWeekWorkOrder ) ) .. FONT_COLOR_CODE_CLOSE;
s.sealOfBrokenFate.lines[#s.sealOfBrokenFate.lines + 1] = " ";
s.sealOfBrokenFate.lines[#s.sealOfBrokenFate.lines + 1] = string.format( L["%sTotal Weekly:|r %s%d/%d|r"], NORMAL_FONT_COLOR_CODE, ( s.sealOfBrokenFate.thisWeek == NS.sealofBrokenFateWeeklyMax and RED_FONT_COLOR_CODE or HIGHLIGHT_FONT_COLOR_CODE ), s.sealOfBrokenFate.thisWeek, NS.sealofBrokenFateWeeklyMax );
end
--
-- Missions
--
missions[char["name"]] = {};
if char["monitor"]["missions"] then
local mip = missions[char["name"]];
mip.texture = 1044517;
mip.text = string.format( L["Missions In Progress - %d"], #char["missions"] );
mip.lines = {};
mip.total = #char["missions"];
mip.incomplete = mip.total;
mip.nextMissionTimeRemaining = 0;
missionsTotal = missionsTotal + mip.total; -- All characters
for _,m in ipairs( char["missions"] ) do
-- m is for mission, that's good enough for me
if not m["typeInlineTexture"] then
m["typeInlineTexture"] = NS.GetAtlasInlineTexture( m.typeAtlas, 24, 24 ); -- Update char missions for LDB tooltip use / Also prevents excessive use of GetAtlasInlineTexture()
end
mip.lines[#mip.lines + 1] = " ";
mip.lines[#mip.lines + 1] = m.typeInlineTexture .. " " .. m.name;
mip.lines[#mip.lines + 1] = HIGHLIGHT_FONT_COLOR_CODE .. LEVEL .. " " .. m.level .. " (" .. m.iLevel .. ")" .. FONT_COLOR_CODE_CLOSE;
mip.lines[#mip.lines + 1] = HIGHLIGHT_FONT_COLOR_CODE .. ( m.successChance and string.format( GARRISON_MISSION_PERCENT_CHANCE, m.successChance ) or UNKNOWN ) .. FONT_COLOR_CODE_CLOSE;
--
mip.lines[#mip.lines + 1] = REWARDS;
for i = 1, #m.rewardsList do
mip.lines[#mip.lines + 1] = m.rewardsList[i];
end
--
mip.lines[#mip.lines + 1] = L["Followers"];
for i = 1, #m.followers do
mip.lines[#mip.lines + 1] = HIGHLIGHT_FONT_COLOR_CODE .. ( m.followers[i] or UNKNOWN ) .. FONT_COLOR_CODE_CLOSE;
end
--
local timeLeftSeconds = ( m.timeLeftSeconds and m.timeLeftSeconds >= passedTime ) and ( m.timeLeftSeconds - passedTime ) or 0;
m["lastKnownTimeLeftSeconds"] = timeLeftSeconds; -- Update char missions for LDB tooltip use
if timeLeftSeconds == 0 then
mip.lines[#mip.lines + 1] = GREEN_FONT_COLOR_CODE .. COMPLETE .. FONT_COLOR_CODE_CLOSE;
mip.incomplete = mip.incomplete - 1;
missionsComplete = missionsComplete + 1; -- All characters
else
mip.lines[#mip.lines + 1] = RED_FONT_COLOR_CODE .. SecondsToTime( timeLeftSeconds ) .. FONT_COLOR_CODE_CLOSE;
mip.nextMissionTimeRemaining = mip.nextMissionTimeRemaining == 0 and timeLeftSeconds or math.min( mip.nextMissionTimeRemaining, timeLeftSeconds ); -- Character
nextMissionTimeRemaining = nextMissionTimeRemaining == 0 and timeLeftSeconds or math.min( nextMissionTimeRemaining, timeLeftSeconds ); -- All characters
allMissionsTimeRemaining = allMissionsTimeRemaining == 0 and timeLeftSeconds or math.max( allMissionsTimeRemaining, timeLeftSeconds ); -- All characters
nextMissionCharName = nextMissionTimeRemaining == timeLeftSeconds and ( "|c" .. RAID_CLASS_COLORS[char["class"]].colorStr .. ( NS.db["showCharacterRealms"] and char["name"] or strsplit( "-", char["name"], 2 ) ) .. FONT_COLOR_CODE_CLOSE ) or nextMissionCharName;
end
end
if #mip.lines == 0 then
mip.lines[#mip.lines + 1] = HIGHLIGHT_FONT_COLOR_CODE .. GARRISON_EMPTY_IN_PROGRESS_LIST .. FONT_COLOR_CODE_CLOSE;
elseif mip.incomplete == 0 then
if NS.db["alertMissions"] then
alertCurrentCharacter = ( not alertCurrentCharacter and char["name"] == NS.currentCharacter.name ) and true or alertCurrentCharacter; -- All characters