forked from TheGeneticsGuy/Guild-Roster-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGRM_Patches.lua
4911 lines (4372 loc) · 238 KB
/
GRM_Patches.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
---UPDATES AND BUG PATCHES
GRM_Patch = {};
local patchNeeded = false;
local DBGuildNames = {};
-- Method: GRM_Patch.SettingsCheck ( float )
-- What it Does: Holds the patch logic for when people upgrade the addon
-- Purpose: To keep the database healthy and corrected from dev design errors and unanticipated consequences of code.
GRM_Patch.SettingsCheck = function ( numericV , count , patch )
local numActions = count or 0;
local baseValue = patch or 0;
-- Purpose of this function...
-- Updates are not that computationally intensive on their own, but I'd imagine if a player has not updated GRM is a very very long time the process might cause the game to hang for several seconds and possible
-- timeout. This prevents that and makes it more obvious to the player what is occurring.
local loopCheck = function ( actionValue )
local needsUpdate = false;
numActions = numActions + 1;
baseValue = actionValue;
-- Announce in chat that GRM is updating for patches... Only state this one time in the cycle.
if numActions == 1 then
GRM.Report ( GRM.L ( "GRM:" ) .. " " .. GRM.L ( "Applying update patches... one moment." ) )
patchNeeded = true;
end
if numActions % 5 == 0 then
needsUpdate = true;
C_Timer.After ( 2 , function()
GRM_Patch.SettingsCheck ( numericV , numActions , baseValue );
end);
end
return needsUpdate;
end
-- Introduced Patch R1.092
-- Alt tracking of the player - so it can auto-add the player's own alts to the guild info on use.
if numericV < 1.092 and baseValue < 1.092 and #GRM_PlayerListOfAlts_Save == 0 then
GRM_Patch.SetupAltTracking();
if loopCheck ( 1.092 ) then -- this can be checked again, so can hold previous value
return;
end
end
-- Introduced Patch R1.100
-- Updating the version for ALL saved accounts.
if numericV < 1.100 and baseValue < 1.100 then
GRM_Patch.UpdateRankControlSettingDefault();
if loopCheck ( 1.100 ) then
return;
end
end
-- Introduced Patch R1.111
-- Added some more booleans to the options for future growth.
if numericV < 1.111 and baseValue < 1.111 and #GRM_AddonSettings_Save[GRM_G.FID][2][2] == 26 then
GRM_Patch.ExpandOptions();
if loopCheck ( 1.111 ) then
return;
end
end
-- Intoduced Patch R1.122
-- Adds an additional point of logic for "Unknown" on join date...
if numericV < 1.122 and baseValue < 1.122 then
GRM_Patch.IntroduceUnknown();
if loopCheck ( 1.122 ) then
return;
end
end
-- Introduced Patch R1.125
-- Bug fix... need to purge of repeats
if numericV < 1.125 and baseValue < 1.125 and GRM_AddonSettings_Save[GRM_G.FID][2][2][24] == 0 then
GRM_Patch.RemoveRepeats();
GRM_Patch.EstablishThrottleSlider();
if loopCheck ( 1.125 ) then
return;
end
end
-- Introduced Patch R.1.126
-- Need some more options booleans
if numericV < 1.126 and baseValue < 1.126 then
GRM_Patch.CleanupSettings ( 30 );
if #GRM_AddonSettings_Save[GRM_G.FID][2][2] == 30 then
GRM_Patch.ExpandOptionsScalable( 10 , 30 , true ); -- Adding 10 boolean spots
end
-- Need some more options int placeholders for dropdown menus
if #GRM_AddonSettings_Save[GRM_G.FID][2][2] == 40 then
GRM_Patch.ExpandOptionsScalable( 5 , 40 , false ); -- Adding 5 boolean spots
end
-- Minimap Created!!!
if GRM_AddonSettings_Save[GRM_G.FID][2][2][25] == 0 or GRM_AddonSettings_Save[GRM_G.FID][2][2][26] == 0 then
GRM_Patch.SetMinimapValues();
end
if loopCheck ( 1.126 ) then
return;
end
end
-- Introduced R1.129
-- Some erroneous promo date formats occurred due to a faulty previous update. These cleans them up.
if numericV < 1.129 and baseValue < 1.129 then
GRM_Patch.CleanupPromoDatesOrig();
if loopCheck ( 1.129 ) then
return;
end
end
-- Introduced R1.130
-- Sync addon settings should not be enabled by default.
-- Greenwall users sync was getting slower and slower and slower... this resolves it.
if numericV < 1.130 and baseValue < 1.130 then
GRM_Patch.TurnOffDefaultSyncSettingsOption();
GRM_Patch.ResetSyncThrottle();
if loopCheck ( 1.130 ) then
return;
end
end
-- R1.131
-- Some messed up date formatting needs to be re-cleaned up due to failure to take into consideration month/date formating issues on guildInfo system message on creation date.
if numericV < 1.131 and baseValue < 1.131 then
GRM_Patch.ResetCreationDates();
if loopCheck ( 1.131 ) then
return;
end
end
-- Some flaw in the left players I noticed... this cleans up old database issues.
if numericV < 1.132 and baseValue < 1.132 then
GRM_Patch.CleanupLeftPlayersDatabaseOfRepeats();
if loopCheck ( 1.132 ) then
return;
end
end
-- Introduced in 1.133 - placed in the beginning to to critcal issue with database
if numericV < 1.133 and baseValue < 1.133 then
GRM_Patch.CleanupGuildNames();
if loopCheck ( 1.133 ) then
return;
end
end
-- Sets the settings menu configuration and updates the auto backup arrays to include room for the autobackups...
if numericV < 1.137 and baseValue < 1.137 then
GRM_Patch.ConfigureAutoBackupSettings();
if loopCheck ( 1.137 ) then
return;
end
end
-- Cleanup the guild backups feature. This will affect almost no one, but I had the methods in the code, this just protects some smarter coders who noticed it and utilized them.
if numericV < 1.140 and baseValue < 1.140 then
GRM.Report ( "GRM: Warning!!! Due to a flaw in the database build of the backups that I had missed, the entire backup database had to be wiped and rebuilt. There was a critical flaw in it. I apologize, but this really is the best solution. A new auto-backup will be established the first time you logout, but a manual save is also encouraged." , 1 , 0 , 0 , 1 );
GRM_Patch.ResetAllBackupsPatch();
if loopCheck ( 1.140 ) then
return;
end
end
-- Cleans up the Promo dates.
if numericV < 1.142 and baseValue < 1.142 then
GRM_Patch.CleanupPromoDates();
GRM_Patch.ExpandOptionsType ( 3 , 3 , 45 );
GRM_Patch.ModifyNewDefaultSetting ( 46 , { 1 , 0 , 0 } );
if loopCheck ( 1.142 ) then
return;
end
end
if numericV < 1.143 and baseValue < 1.143 then
GRM_Patch.ModifyNewDefaultSetting ( 36 , false );
GRM_Patch.ModifyNewDefaultSetting ( 37 , false );
GRM_Patch.ModifyNewDefaultSetting ( 43 , GRM_G.LocalizedIndex );
if loopCheck ( 1.143 ) then
return;
end
end
if numericV < 1.144 and baseValue < 1.144 then
GRM_Patch.FixBrokenLanguageIndex();
if loopCheck ( 1.144 ) then
return;
end
end
if numericV < 1.1461 and baseValue < 1.1461 then
GRM_Patch.SetProperFontIndex();
GRM_Patch.ModifyNewDefaultSetting( 45 , 0 );
if loopCheck ( 1.1461 ) then
return;
end
end
if numericV < 1.1471 and baseValue < 1.1471 then
GRM_Patch.SetMiscConfiguration();
if loopCheck ( 1.1471 ) then
return;
end
end
if numericV < 1.1480 and baseValue < 1.1480 then
GRM_Patch.ExpandOptionsType ( 1 , 2 , 48 );
GRM_Patch.ModifyNewDefaultSetting ( 49 , 2 );
GRM_Patch.ModifyPlayerMetadata ( 23 , { true , 0 , "" , GRM_AddonSettings_Save[GRM_G.FID][GRM_G.setPID][2][49] , false , "" } , false , -1 ); -- Adding custom note logic
GRM_Patch.AddNewDefaultSetting ( 3 , true , true ); -- Print log report for custom note boolean
GRM_Patch.AddNewDefaultSetting ( 13 , true , true ); -- Chat log report for custom note boolean
GRM_Patch.SetProperRankRestrictions();
if loopCheck ( 1.1480 ) then
return;
end
end
if numericV < 1.1482 and baseValue < 1.1482 then
GRM_Patch.FixAltData();
GRM_Patch.ExpandOptionsType ( 1 , 1 , 49 );
if loopCheck ( 1.1482 ) then
return;
end
end
if numericV < 1.1490 and baseValue < 1.1490 then
GRM_Patch.FixAltData();
if loopCheck ( 1.1490 ) then
return;
end
end
if numericV < 1.1492 and baseValue < 1.1492 then
GRM_Patch.RemoveAllAutoBackups();
if loopCheck ( 1.1492 ) then
return;
end
end
if numericV < 1.1500 and baseValue < 1.1500 then
GRM_Patch.CleanupAnniversaryEvents();
GRM_Patch.RemoveTitlesEventDataAndUpdateBirthday();
GRM_Patch.UpdateCalendarEventsDatabase();
if loopCheck ( 1.1500 ) then
return;
end
end
if numericV < 1.1501 and baseValue < 1.1501 then
GRM_Patch.RemoveTitlesEventDataAndUpdateBirthday();
if loopCheck ( 1.1501 ) then
return;
end
end
if numericV < 1.1510 and baseValue < 1.1510 then
GRM_Patch.ExpandOptionsType ( 1 , 1 , 50 );
GRM_Patch.ExpandOptionsType ( 2 , 1 , 51 );
GRM_Patch.MatchLanguageTo24HrFormat();
if loopCheck ( 1.1510 ) then
return;
end
end
if numericV < 1.1530 and baseValue < 1.1530 then
GRM_Patch.FixBanListNameGrammar();
if loopCheck ( 1.1530 ) then
return;
end
end
if numericV < 1.20 and baseValue < 1.20 then
GRM_Patch.FixDoubleCopiesInLeftPLayers();
GRM_Patch.ExpandOptionsType ( 2 , 1 , 52 );
GRM_Patch.ModifyNewDefaultSetting ( 53 , false );
GRM_Patch.ModifyNewDefaultSetting ( 24 , 1 );
GRM_Patch.AddPlayerMetaDataSlot ( 41 , "" ); -- Adding the GUID position...
GRM_Patch.FixPlayerListOfAltsDatabase();
if loopCheck ( 1.20 ) then
return;
end
end
if numericV < 1.21 and baseValue < 1.21 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 53 );
GRM_Patch.ModifyNewDefaultSetting ( 54 , false );
if loopCheck ( 1.21 ) then
return;
end
end
if numericV < 1.22 and baseValue < 1.22 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 54 );
if loopCheck ( 1.22 ) then
return;
end
end
if numericV < 1.25 and baseValue < 1.25 then
GRM_Patch.ExpandOptionsType ( 2 , 2 , 55 ); -- adding 56 and 57
GRM_Patch.ModifyNewDefaultSetting ( 56 , false ); -- 57 can be true
if loopCheck ( 1.25 ) then
return;
end
end
if numericV < 1.26 and baseValue < 1.26 then
GRM_Patch.AddStreamViewMarker();
GRM_Patch.PratCompatibilityCheck();
if loopCheck ( 1.26 ) then
return;
end
end
if numericV < 1.27 and baseValue < 1.27 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 57 );
if loopCheck ( 1.27 ) then
return;
end
end
if numericV < 1.28 and baseValue < 1.28 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 57 ); -- Needs to be repeated as unfortunately new characters this was not updated properly.
GRM_Patch.ExpandOptionsType ( 2 , 2 , 58 );
GRM_Patch.ModifyNoteSavedSettings();
if loopCheck ( 1.28 ) then
return;
end
end
if numericV < 1.29 and baseValue < 1.29 then
GRM_Patch.RemoveRepeats();
GRM_Patch.LogDatabaseRepair();
GRM_Patch.ExpandOptionsType ( 2 , 1 , 60 ); -- add a boolean
GRM_Patch.ModifyNewDefaultSetting ( 61 , false ); -- Set all booleans to false (default adds it as true)
GRM_Patch.ExpandOptionsType ( 4 , 1 , 61 ); -- Add string
if loopCheck ( 1.29 ) then
return;
end
end
if numericV < 1.30 and baseValue < 1.30 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 62 ); -- Add a boolean
GRM_Patch.ModifyNewDefaultSetting ( 63 , false ); -- needs to be off by default
GRM_Patch.ExpandOptionsType ( 3 , 1 , 63 ); -- for keeping the setpoints...
GRM_Patch.ModifyNewDefaultSetting ( 64 , { "" , "" } ); -- needs to be off by default
if loopCheck ( 1.30 ) then
return;
end
end
if numericV < 1.31 and baseValue < 1.31 then
-- need to repeat this check as I forgot to build it in the settings last time for new player alts...
GRM_Patch.FixCustomMinimapPosition(); -- need to fix a minimap bug I accidentally introduced...
GRM_Patch.ExpandOptionsType ( 3 , 1 , 63 ); -- for keeping the setpoints...
GRM_Patch.ModifyNewDefaultSetting ( 64 , { "" , "" } ); -- needs to be off by default
GRM_Patch.ExpandOptionsType ( 2 , 1 , 64 ); -- Add boolean for main tag controls
GRM_Patch.ModifyNewDefaultSetting ( 65 , false ); -- put them off by default.
if loopCheck ( 1.31 ) then
return;
end
end
if numericV < 1.32 and baseValue < 1.32 then
GRM_Patch.ConvertLeaderNoteControlFormatToGuildInfo(); -- Formatting the guild controls to be in the player note window...
GRM_Patch.ExpandOptionsType ( 2 , 1 , 65 ); -- Add boolean for leader purge controls
GRM_Patch.ModifyNewDefaultSetting ( 66 , false ); -- put them off by default.
if loopCheck ( 1.32 ) then
return;
end
end
if numericV < 1.33 and baseValue < 1.33 then
GRM_Patch.ModifyNewDefaultSetting ( 53 , true ); -- set the guild reputation visual to true
GRM_Patch.ModifyNewDefaultSetting ( 17 , true ); -- Sets it by default to make sure only "mains" are announced as a bday approaches, to avoid event chat spam.
GRM_Patch.ExpandOptionsType ( 2 , 1 , 66 ); -- Add boolean for showing birthday
GRM_Patch.ExpandOptionsType ( 2 , 1 , 67 ); -- Add boolean for allowing birthday sync
GRM_Patch.ConvertAndModifyAnniversaryStorageFormat(); -- Modify the way events are stored and changed!
GRM_Patch.ModifyPlayerMetadata ( 22 , { { 0 , 0 , 0 } , false , "" , 0 } , true , 2 ); -- Modify member record details for birthday, resets it to base value
if loopCheck ( 1.33 ) then
return;
end
end
if numericV < 1.34 and baseValue < 1.34 then
GRM_Patch.EventDatabaseIntegrityCheckAndRebuild();
if loopCheck ( 1.34 ) then
return;
end
end
if numericV < 1.35 and baseValue < 1.35 then
GRM_Patch.AltListRepeatAndSelfCleanup();
GRM_Patch.FixEventCalendarAdvanceScanTimeFrame();
if loopCheck ( 1.35 ) then
return;
end
end
if numericV < 1.39 and baseValue < 1.39 then
GRM_Patch.ModifyNewDefaultSetting ( 55 , true ); -- Ensures the setting to only announce returning from inactivity if ALL alts meet the criteria.
GRM_Patch.ModifyNewDefaultSetting ( 56 , true ); -- Record leveling data
GRM_Patch.ModifyNewDefaultSetting ( 47 , { true , true , true , true , true , true , true , true } ); -- Level filtering options
GRM_Patch.CleanupErroneousSlashesInBanNames(); -- Custom names from ban list cleaned up a little.
GRM_Patch.AddBanSlotIndex();
if loopCheck ( 1.39 ) then
return;
end
end
if numericV < 1.40 and baseValue < 1.40 then
GRM_Patch.AddBanSlotIndex();
if loopCheck ( 1.40 ) then
return;
end
end
if numericV < 1.41 and baseValue < 1.41 then
GRM_Patch.ModifyNewDefaultSetting ( 66 , false ); -- Auto Focus the search bar.
if loopCheck ( 1.41 ) then
return;
end
end
if numericV < 1.42 and baseValue < 1.42 then
GRM_Patch.FixUnknownPromoShowing();
if loopCheck ( 1.42 ) then
return;
end
end
if numericV < 1.43 and baseValue < 1.43 then
GRM_Patch.ConvertEmptyGUID();
GRM_Patch.FixLeftPlayersClassToUppercase();
GRM_Patch.AddPlayerMetaDataSlot ( 42 , false ); -- Adding the ban flag and is currently no longer on server position...
GRM_Patch.BuildGUIDProfilesForAllNoLongerInGuild();
if loopCheck ( 1.43 ) then
return;
end
end
if numericV < 1.44 and baseValue < 1.44 then
GRM_Patch.FixLogOfNilEntries();
if loopCheck ( 1.44 ) then
return;
end
end
if numericV < 1.45 and baseValue < 1.45 then
GRM_Patch.FixBanData();
GRM_Patch.FixAltListsDatabaseWide();
GRM_Patch.ModifyPlayerMetadata ( 37 , {} , false );
if loopCheck ( 1.45 ) then
return;
end
end
if numericV < 1.50 and baseValue < 1.50 then
GRM_Patch.IntegrityCheckAndFixBdayAndAnniversaryEvents();
GRM_Patch.ModifyNewDefaultSetting ( 19 , true ); -- Needs to be reset to only sync with players with current version due to overhaul
GRM_Patch.ModifyNewDefaultSetting ( 24 , 1 ); -- Due to the changes in sync, resetting people back to defautl 100% as some are killing themselves too low lol
GRM_Patch.SortGuildRosterDeepArray();
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanUpAltLists , true , false , true );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.RemoveUnnecessaryHours , true , true , false );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupPromoDateSyncErrorForRejoins , true , true , false );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupPromoJoinDateOriginalTemplateDates , true , true , false );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupBirthdayRepeats , true , false , true );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupBanFormat , true , true , false );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.SlimBanReason , true , true , false );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupRemovedAlts , true , true , true );
GRM_Patch.FinalAltListCleanup()
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupCustomNoteError , true , true , false );
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupJoinAndPromosSetUnknownError , true , true , false );
if loopCheck ( 1.50 ) then
return;
end
end
if numericV < 1.51 and baseValue < 1.51 then
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupPromoDateSituation , true , true , false );
if loopCheck ( 1.51 ) then
return;
end
end
if numericV < 1.53 and baseValue < 1.53 then
GRM_Patch.GuildDataDatabaseWideEdit ( GRM_Patch.CleanupJoinDateError );
if loopCheck ( 1.53 ) then
return;
end
end
if numericV < 1.56 and baseValue < 1.56 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 68 ); -- Add boolean for checkbox for JD Audit tool
GRM_Patch.ModifyNewDefaultSetting ( 69 , false );
if loopCheck ( 1.56 ) then
return;
end
end
if numericV < 1.57 and baseValue < 1.57 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 69 ); -- Add boolean for checkbox for the log tooltip enablement
if loopCheck ( 1.57 ) then
return;
end
end
if numericV < 1.59 and baseValue < 1.59 then
DeleteMacro("GRM_Roster") -- Deleting the macro to rebuild it in general.
GRM_Patch.ExpandOptionsType ( 2 , 1 , 70 ); -- Add boolean to enable or disable the GRM window on the old roster.
GRM_Patch.ModifyNewDefaultSetting ( 71 , false );
if loopCheck ( 1.59 ) then
return;
end
end
if numericV < 1.61 and baseValue < 1.61 then
GRM_Patch.RemoveOneAutoAndOneManualBackup();
if loopCheck ( 1.61 ) then
return;
end
end
if numericV < 1.63 and baseValue < 1.63 then
GRM_Patch.ExpandOptionsType ( 3 , 1 , 71 ); -- for keeping the setpoints of GRM window...
GRM_Patch.ModifyNewDefaultSetting ( 72 , { "" , "" , 0 , 0 } ); -- Center position default
GRM_Patch.AddPlayerMetaDataSlot ( 43 , false ); -- Adding the position to have an "unknown" option in regards to bdays
if loopCheck ( 1.63 ) then
return;
end
end
if numericV < 1.64 and baseValue < 1.64 then
GRM_Patch.ExpandOptionsType ( 4 , 1 , 72 );
if loopCheck ( 1.64 ) then
return;
end
end
if numericV < 1.66 and baseValue < 1.66 then
GRM_Patch.ModifyNewDefaultSetting ( 48 , { "" , "" } );
if loopCheck ( 1.66 ) then
return;
end
end
if numericV < 1.67 and baseValue < 1.67 then
GRM_Patch.ExpandOptionsType ( 3 , 1 , 73 ); -- for keeping the setpoints of GRM window...
GRM_Patch.ModifyNewDefaultSetting ( 74 , { "" , "" , 0 , 0 } ); -- Center position default
GRM_Patch.ExpandOptionsType ( 3 , 1 , 74 ); -- Adding slots 75 for storing the names and rules for kick/promote/demote tool
GRM_Patch.AddPlayerMetaDataSlot ( 44 , false ); -- Rule if player rules should be ignored.
GRM_Patch.ModifyNewDefaultSetting ( 10 , true ); -- Needs to be done before the conversion because I WANT players to use this feature
GRM_Patch.ConvertRecommendedKickDateToRule ( 75 ); -- Converts the old month date to the new feature
GRM_Patch.ExpandOptionsType ( 3 , 1 , 75 ); -- Adding slot 76 for the GRM tool safe list to only show players where actions were ignored
if loopCheck ( 1.67 ) then
return;
end
end
if numericV < 1.69 and baseValue < 1.69 and GRM_G.BuildVersion < 80000 then
GRM_Patch.FixClassIncompatibilityBuild();
if loopCheck ( 1.69 ) then
return;
end
end
if numericV < 1.70 and baseValue < 1.70 then
if GRM_G.BuildVersion < 80000 then
GRM_Patch.RemoveMacroInClassic();
end
if GRM_G.BuildVersion < 40000 then
GRM_Patch.ModifyNewDefaultSetting ( 53 , false );
end
GRM_Patch.PlayerMetaDataDatabaseWideEdit ( GRM_Patch.CleanupPromotionDateMouseOverError , true , true , false );
GRM_Patch.FixMonthDateRecommendationError();
GRM_Patch.ClearExtraBackups();
if loopCheck ( 1.70 ) then
return;
end
end
if numericV < 1.73 and baseValue < 1.73 then
GRM_Patch.ModifyNewDefaultSetting ( 10 , true ); -- Mouseover control checkbox on whether to show the tooltip or not.
if loopCheck ( 1.73 ) then
return;
end
end
if numericV < 1.74 and baseValue < 1.74 then
GRM_Patch.ModifyNewDefaultSetting ( 9 , true ); -- Colorcode Names in Chat
if loopCheck ( 1.74 ) then
return;
end
end
if numericV < 1.75 and baseValue < 1.75 then
GRM_Patch.ExpandOptionsType ( 2 , 1 , 76 ); -- Add boolean for checkbox to enable or disable the !note feature
if loopCheck ( 1.75 ) then
return;
end
end
if numericV < 1.76 and baseValue < 1.76 then
GRM_Patch.ExpandOptionsType ( 1 , 1 , 77 ); -- Log specific font size modifier - default 100% size = 0;
GRM_Patch.ModifyNewDefaultSetting ( 78 , 0 );
if loopCheck ( 1.76 ) then
return;
end
end
if numericV < 1.77 and baseValue < 1.77 then
GRM_Patch.ExpandOptionsType ( 3 , 2 , 78 ); -- Export delimiter selection and export details
GRM_Patch.ModifyNewDefaultSetting ( 79 , { true , ";" } );
if GRM_G.BuildVersion < 40000 then
GRM_Patch.ModifyNewDefaultSetting ( 80 , { true , true , true , true , true , true , true , true , true , false , true , true , true , true } ); -- Export filters with Guild rep disabled
else
GRM_Patch.ModifyNewDefaultSetting ( 80 , { true , true , true , true , true , true , true , true , true , true , true , true , true , true } ); -- Export filters
end
GRM_Patch.ExpandOptionsType ( 2 , 1 , 80 ); -- Auto include export headers
GRM_Patch.ModifyNewDefaultSetting ( 81 , false ); -- Don't keep it ON as default
if loopCheck ( 1.77 ) then
return;
end
end
if numericV < 1.80 and baseValue < 1.80 then
GRM_Patch.ExpandOptionsType ( 3 , 1 , 81 );
GRM_Patch.ModifyNewDefaultSetting ( 82 , { 1.0 , 1.33 , 1.0 , 1.0 , 1.0 } ); -- Adding Scaler controls to the addon settings.
if loopCheck ( 1.80 ) then
return;
end
end
if numericV < 1.801 and baseValue < 1.801 then
GRM_Patch.AddPlayerMetaDataSlot ( 45 , "" ); -- Adding the position to have an "unknown" option in regards to bdays
GRM_Patch.AddPlayerMetaDataSlot ( 46 , 1 );
if loopCheck ( 1.801 ) then
return;
end
end
if numericV < 1.81 and baseValue < 1.81 then
GRM_Patch.FixOptionsSetting ( 82 , { 1.0 , 1.33 , 1.0 , 1.0 , 1.0 } , GRM_Patch.FixScalingOption );
if loopCheck ( 1.81 ) then
return;
end
end
if numericV < 1.812 and baseValue < 1.812 then
if GRM_G.BuildVersion < 40000 then
GRM_Patch.FixOptionsSetting ( 80 , { true , true , true , true , true , true , true , true , true , false , true , true , true , true , true , true } , GRM_Patch.ExpandExportFilters );
else
GRM_Patch.FixOptionsSetting ( 80 , { true , true , true , true , true , true , true , true , true , true , true , true , true , true , true , true } , GRM_Patch.ExpandExportFilters );
end
if loopCheck ( 1.812 ) then
return;
end
end
if numericV < 1.82 and baseValue < 1.82 then
GRM_Patch.FixOptionsSetting ( 6 , 20 , GRM_Patch.UpdateMinimumScanTime ); -- New default setting to max 20 seconds
if loopCheck ( 1.82 ) then
return;
end
end
if numericV < 1.831 and baseValue < 1.831 then
GRM_Patch.FixDoubleCopiesInCurrentGuilds(); -- Due to an error reported... this was likely due to a bug that existed for a couple of hours before I noticed, but a couple hundred people had downloaded it... it was still somewhat edge case but it opened the door. Well, someone won the lottery!
GRM_Patch.FixDoubleCopiesInLeftPLayers(); -- Prob not necessary, but need to cover all my bases here on this one...
GRM_Patch.FixDoubleCopiesInBackup(); -- Same as above.
GRM_Patch.RealignDatabaseDueToMisSort(); -- Due to a faulty insert that I created in 1.82 /sigh
if GRM_G.BuildVersion < 80000 then
GRM_Patch.ModifyNewDefaultSetting ( 71 , true ); -- needs to fix mouseover In Classic. Might have been forced disabled on accident.
end
if loopCheck ( 1.831 ) then
return;
end
end
-- Not an actual patch, but I want to force this rebuild to be split up
if numericV < 1.832 and baseValue < 1.832 then
if GRM_Patch.IsAnySettingsTooLow() then
for i = 1 , #GRM_AddonSettings_Save do
for j = 2 , #GRM_AddonSettings_Save[i] do
GRM_AddonSettings_Save[i][j][2][1] = "8.2.5R1.76"; -- Trigger the setting to reload for all.
end
end;
numericV = 1.76;
loopCheck ( 1.76 );
return;
end
GRM_Patch.FixAltGroupings();
if loopCheck ( 1.832 ) then
return;
end
end
-- Additional Database Rebuilding!
if numericV < 1.833 and baseValue < 1.833 then
-- Update the database now!!!
GRM_Patch.ConvertAddonSettings();
GRM_Patch.ConvertListOfAddonAlts();
GRM_Patch.ConvertMiscToNewDB();
GRM_Patch.ConvertBackupDB();
if loopCheck ( 1.833 ) then
return;
end
end
-- Additional Database Rebuilding!
if numericV < 1.834 and baseValue < 1.834 then
GRM_Patch.ConvertLogDB();
GRM_Patch.ConvertCalenderDB();
if loopCheck ( 1.834 ) then
return;
end
end
-- Additional DB Rebuilding
-- Additional Database Rebuilding!
if numericV < 1.835 and baseValue < 1.835 then
GRM_GuildMemberHistory_Save = GRM_Patch.ConvertPlayerMetaDataDB ( GRM_GuildMemberHistory_Save , 1 );
GRM_PlayersThatLeftHistory_Save = GRM_Patch.ConvertPlayerMetaDataDB ( GRM_PlayersThatLeftHistory_Save , 2 );
if loopCheck ( 1.835 ) then
return;
end
end
-- For those coming off the beta...
if numericV == 1.84 then
GRM_Patch.FixNameChangePreReleaseBug();
end
if numericV < 1.865 and baseValue < 1.865 then
GRM_Patch.FixMemberDataError ( GRM_Patch.AddVerifiedPromotionDatesToHistory , true , true , false );
GRM_Patch.ModifyPlayerSetting ( "kickRules" , GRM_Patch.updateKickRules );
GRM_Patch.ModifyPlayerSetting ( "promoteRules" , {} );
GRM_Patch.ModifyPlayerSetting ( "demoteRules" , {} );
GRM_Patch.ModifyPlayerSetting ( "allAltsApplyToKick" , nil );
if loopCheck ( 1.865 ) then
return;
end
end
if numericV < 1.87 and baseValue < 1.87 then
GRM_Patch.AddPlayerSetting ( "colorizeClassicRosterNames" , true );
if loopCheck ( 1.87 ) then
return;
end
end
if numericV < 1.88 and baseValue < 1.88 then
GRM_Patch.ModifyPlayerSetting ( "exportFilters" , nil , "class" );
GRM_Patch.ModifyPlayerSetting ( "kickRules" , nil , "allAltsApplyToKick" );
GRM_Patch.FixMemberDataError ( GRM_Patch.fixAltGroups , true , false , true );
GRM_Patch.FixManualBackupsFromDBLoad();
GRM_Patch.AddGroupInfoModuleSettings();
GRM_Patch.AddPlayerSetting ( "useFullName" , false );
GRM_Patch.AddTextColoringValues();
GRM_Patch.ModifyPlayerSetting ( "reportChannel" , GRM_Patch.ModifyPlayerChannelToMulti , nil );
if loopCheck ( 1.88 ) then
return;
end
end
GRM_Patch.FinalizeReportPatches( patchNeeded , numActions );
end
-- Final report is good to go!
GRM_Patch.FinalizeReportPatches = function ( patchNeeded , numActions )
if patchNeeded then
if numActions > 1 then
GRM.Report ( GRM.L ( "GRM:" ) .. " " .. GRM.L ( "Update Complete... {num} patches applied." , nil , nil , numActions ) );
else
GRM.Report ( GRM.L ( "GRM:" ) .. " " .. GRM.L ( "Update Complete... 1 patch applied." ) );
end
end
-- Ok, let's update the version!
GRM.Report ( GRM.L ( "GRM Updated:" ) .. " v" .. string.sub ( GRM_G.Version , string.find ( GRM_G.Version , "R" ) + 1 ) );
-- Updating the version for ALL saved accoutns.
for f in pairs ( GRM_AddonSettings_Save ) do
for p in pairs ( GRM_AddonSettings_Save[f] ) do
GRM_AddonSettings_Save[f][p].version = GRM_G.Version;
end
end
GRM.FinalSettingsConfigurations();
end
---------------------
-- INTEGRITY CHECK --
---------------------
-- Only applies to updating much older databases so mostly deprecated, but if someone has a significantly old version they will need to run it through this on their update.
-- Method: GRM_Patch.PlayerSettingsIntegrityCheck()
-- What it Does: Checks for broken player addon settings in relation to some previous errors that could be introduced. Returns a boolean to determine if the player settings need to be rebuilt for that current player
-- Purpose: To fix any issues in regards to previous bug.
GRM_Patch.PlayerSettingsIntegrityCheck = function()
local g = GRM_AddonSettings_Save;
local needsToKeep = true;
for i = 1 , #g do
for j = #g[i] , 2 , -1 do
if g[i][j][2] == nil then
if needsToKeep and g[i][j][1] == GRM_G.addonUser then
needsToKeep = false;
end
table.remove ( g[i] , j );
end
end
end
return needsToKeep;
end
------------------------
--- CLASSIC ISSUES -----
------------------------
-- Method: GRM_Patch.FixClassIncompatibilityBuild()
-- What it Does: Activates the popup window to enable wiping and hard restting the addon data due to a previous incompatible load
-- Purpose: Resolves issues from players who enabled an outdated version of the addon.
GRM_Patch.FixClassIncompatibilityBuild = function()
GRM_AddonSettings_Save = {};
local hardReset = function()
GRM_AddonSettings_Save = {};
ReloadUI();
end
GRM.SetConfirmationWindow ( hardReset , GRM.L ( "GRM has errored due to a previous incompatible build with Classic that was enabled. Click YES to reload UI and fix the issue" ) );
end
-- Method: GRM_Patch.RemoveMacroInClassic()
-- What it Does: Checks if macro exists and then removes it if it does.
-- Purpose:
GRM_Patch.RemoveMacroInClassic = function()
if GetMacroInfo ( "GRM_Roster" ) ~= nil then
DeleteMacro ( "GRM_Roster" );
end
end
-------------------------------
--- START PATCH LOGIC ---------
-------------------------------
-- Introduced Patch R1.092
-- Alt tracking of the player - so it can auto-add the player's own alts to the guild info on use.
GRM_Patch.SetupAltTracking = function()
-- Need to check if already added to the guild...
local guildNotFound = true;
if GRM_G.guildName ~= nil then
for i = 2 , #GRM_GuildMemberHistory_Save[ GRM_G.FID ] do
if GRM_GuildMemberHistory_Save[GRM_G.FID][i][1][1] == GRM_G.guildName then
guildNotFound = false;
break;
end
end
end
-- Build the table for the first time! It will be unique to the faction and the guild.
table.insert ( GRM_PlayerListOfAlts_Save , { "Horde" } );
table.insert ( GRM_PlayerListOfAlts_Save , { "Alliance" } );
if IsInGuild() and not guildNotFound then
-- guild is found, let's add the guild!
table.insert ( GRM_PlayerListOfAlts_Save[ GRM_G.FID ] , { { GRM_G.guildName , GRM_G.guildCreationDate } } ); -- alts list, let's create an index for the guild!
-- Insert player name too...
end
end
-- Introduced Patch R1.100
-- Updating the version for ALL saved accounts.
GRM_Patch.UpdateRankControlSettingDefault = function()
local needsUpdate = true;
for i = 1 , #GRM_AddonSettings_Save do
for j = 2 , #GRM_AddonSettings_Save[i] do
if GRM_AddonSettings_Save[i][j][2][22] > 0 then
-- This will signify that the addon has already been updated to current state and will not need update.
needsUpdate = false;
break;
else
GRM_AddonSettings_Save[i][j][2][22] = 2; -- Updating rank to general officer rank to be edited.
end
end
if not needsUpdate then -- No need to cycle through everytime. Resource saving here!
break;
end
end
end
-- Introduced Patch R1.111
-- Added some more booleans to the options for future growth.
GRM_Patch.ExpandOptions = function()
-- Updating settings for all
for i = 1 , #GRM_AddonSettings_Save do
for j = 2 , #GRM_AddonSettings_Save[i] do
if #GRM_AddonSettings_Save[i][j][2] == 26 then
table.insert ( GRM_AddonSettings_Save[i][j][2] , true ); -- 27th option
table.insert ( GRM_AddonSettings_Save[i][j][2] , true ); -- 28th option
table.insert ( GRM_AddonSettings_Save[i][j][2] , true ); -- 29th option
table.insert ( GRM_AddonSettings_Save[i][j][2] , false ); -- 30th option
end
end
end
end
-- Intoduced Patch R1.122
-- Adds an additional point of logic for "Unknown" on join date...
GRM_Patch.IntroduceUnknown = function()
for i = 1 , #GRM_GuildMemberHistory_Save do -- Horde and Alliance
for j = 2 , #GRM_GuildMemberHistory_Save[i] do -- The guilds in each faction
for r = 2 , #GRM_GuildMebmerHistory_Save[i][j] do -- The players in each guild (starts at 2 as position 1 is the name of the guild).
if #GRM_GuildMemberHistory_Save[i][j][r] == 39 then
table.insert ( GRM_GuildMemberHistory_Save[i][j][r] , false ); -- isUnknown join
table.insert ( GRM_GuildMemberHistory_Save[i][j][r] , false ); -- isUnknown promo
end
end
end
end
for i = 1 , #GRM_PlayersThatLeftHistory_Save do -- Horde and Alliance
for j = 2 , #GRM_PlayersThatLeftHistory_Save[i] do -- The guilds in each faction
for r = 2 , #GRM_PlayersThatLeftHistory_Save[i][j] do -- The players in each guild (starts at 2 as position 1 is the name of the guild).
if #GRM_PlayersThatLeftHistory_Save[i][j][r] == 39 then
table.insert ( GRM_PlayersThatLeftHistory_Save[i][j][r] , false ); -- isUnknown join
table.insert ( GRM_PlayersThatLeftHistory_Save[i][j][r] , false ); -- isUnknown promo
end
end
end
end
end
-- Introduced Patch R1.125
-- Bug fix... need to purge of repeats
GRM_Patch.RemoveRepeats = function()
local t;
for i = 1 , #GRM_GuildMemberHistory_Save do -- Horde and Alliance
for j = 2 , #GRM_GuildMemberHistory_Save[i] do -- The guilds in each faction
local r = 2;
while r <= #GRM_GuildMemberHistory_Save[i][j] do -- Using while loop to manually increment, rather than auto in a for loop, as table.remove will remove an index.
t = GRM_GuildMemberHistory_Save[i][j];
local isRemoved = false;
for s = 2 , #t do
if s ~= r and GRM_GuildMemberHistory_Save[i][j][r][1] == t[s][1] then
isRemoved = true;
table.remove ( GRM_GuildMemberHistory_Save[i][j] , r );
break;
end
end
if not isRemoved then
r = r + 1;
end
end
end
end
end
-- Introduced Patch R1.125
-- Establishing the slider default value to be 40 for throttle controls ( 100% )
GRM_Patch.EstablishThrottleSlider = function()
for i = 1 , #GRM_AddonSettings_Save do
for j = 2 , #GRM_AddonSettings_Save[i] do
GRM_AddonSettings_Save[i][j][2][24] = 40;
end
end
end