-
Notifications
You must be signed in to change notification settings - Fork 8
/
GRM_Roster.lua
2554 lines (2105 loc) · 122 KB
/
GRM_Roster.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
-- Creating a new Guild Roster window
GRM_R = {};
-- Method: GRM_R.BuildRosterFrames()
-- What it Does: Initiates building of all o the Custom GRM Guild Roster window
-- Purpose: Provide players more controls than default communities offers.
GRM_R.BuildRosterFrames = function ()
local coreSize = 1035;
local coreHybridSize = 980;
local anchorFrame1;
if GRM_G.BuildVersion >= 80000 then -- Account for Mythic Rating which only existed in 8.0+
coreSize = coreSize + 90;
coreHybridSize = coreHybridSize + 90;
end
GRM_UI.CreateCoreFrame ( "GRM_RosterFrame" , GRM_UI , UIParent , coreSize , 525 , "TranslucentFrameTemplate" , false , { "CENTER" , UIParent , "CENTER" , 0 , 300 } , "MEDIUM" , true , true );
GRM_UI.GRM_RosterFrame.SortType = 3;
GRM_UI.GRM_RosterFrame.FormerSortType = 3;
if not GRM_UI.GRM_RosterFrame.Loaded then
GRM_UI.GRM_RosterFrame.Loaded = true;
GRM_UI.GRM_RosterFrame:Hide();
end
-- So it can be called in AddonSkins
GRM_UI.RosterFrameSetScript = function()
GRM_R.RefreshRosterName();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameScrollFrameSlider.ThumbTexture:Show()
GRM_UI.GRM_MemberDetailMetaData:Hide();
GRM_R.ConfigureRosterOptions();
end
if not GRM_UI.GRM_RosterFrame:GetScript("OnShow") then
GRM_UI.GRM_RosterFrame:SetScript ( "OnShow" , GRM_UI.RosterFrameSetScript )
end
-- This will query the guild log to trigger, which triggers the roster to be updated every 10 seconds
if not GRM_UI.GRM_RosterFrame.isHooked then
GRM_UI.GRM_RosterFrame.isHooked = true;
GRM_UI.GRM_RosterFrame.timer = 0;
GRM_UI.GRM_RosterFrame:SetScript ( "OnUpdate" , function ( self , elapsed )
GRM_UI.GRM_RosterFrame.timer = GRM_UI.GRM_RosterFrame.timer + elapsed;
if GRM_UI.GRM_RosterFrame.timer >= 10 then
-- Refresh the log every 10 seconds when it is open, just to be certain. There is a problem with the guild roster not updating properly when guild changes occur in status.
GRM.GuildRoster();
QueryGuildEventLog();
GRM_UI.GRM_RosterFrame.timer = 0;
end
end)
end
-- Options Menu
GRM_UI.CreateCoreFrame ( "GRM_RosterOptions" , GRM_UI.GRM_RosterFrame , nil , coreSize , 90 , "TranslucentFrameTemplate" , false , { "TOP" , "BOTTOM" , 0 , 8 } , "FULLSCREEN_DIALOG" , false , false );
-- Must buiold hybrid first since columns will be pinned to it.
GRM_UI.CreateHybridScrollFrame ( "GRM_RosterFrameScrollFrame" , GRM_UI.GRM_RosterFrame , coreHybridSize , 400 , { "BOTTOMLEFT" , GRM_UI.GRM_RosterFrame , "BOTTOMLEFT" , 5 , 5 } , "TranslucentFrameTemplate" , GRM_R.BuildGuildRoster , false );
-- Guild Roster Title
GRM_UI.CreateString ( "GRM_RosterFrameTitle" , GRM_UI.GRM_RosterFrame , "GameFontNormal" , GRM.L ( "Guild Roster" ) , 18 , { "TOP" , GRM_UI.GRM_RosterFrame , "TOP" , 0 , -17 } );
-- Level
GRM_UI.CreateButton ( "GRM_RosterColumnLvl" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Lvl" ) , 40 , 22 , { "BOTTOMLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameScrollFrameBorder, "TOPLEFT" , 10 , -3 } , GRM_R.SortLevel , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
-- Name
GRM_UI.CreateButton ( "GRM_RosterColumnName" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Name" ) , 200 , 22 , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnLvl, "RIGHT" , -1.5 , 0 } , GRM_R.SortNames , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
-- Last Online
GRM_UI.CreateButton ( "GRM_RosterColumnLastOnline" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Last Online" ) , 150 , 22 , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnName, "RIGHT" , -1.5 , 0 } , GRM_R.SortLastOnline , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
-- Rank
GRM_UI.CreateButton ( "GRM_RosterColumnRank" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Rank" ) , 125 , 22 , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnLastOnline, "RIGHT" , -1.5 , 0 } , GRM_R.SortRank , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
if GRM_G.BuildVersion >= 80000 then
-- M+
GRM_UI.CreateButton ( "GRM_RosterColumnMythicPlus" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "M+ Score" ) , 90 , 22 , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnRank, "RIGHT" , -1.5 , 0 } , GRM_R.SortMythicScore , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
anchorFrame1 = GRM_UI.GRM_RosterFrame.GRM_RosterColumnMythicPlus;
else
anchorFrame1 = GRM_UI.GRM_RosterFrame.GRM_RosterColumnRank;
end
-- Note
GRM_UI.CreateButton ( "GRM_RosterColumnNote" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Note" ) , 150 , 22 , { "LEFT" , anchorFrame1, "RIGHT" , -1.5 , 0 } , GRM_R.SortNote , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
-- OfficerNote
GRM_UI.CreateButton ( "GRM_RosterColumnOfficerNote" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Officer's Note" ) , 150 , 22 , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnNote, "RIGHT" , -1.5 , 0 } , GRM_R.SortOfficerNote , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
-- customNote
GRM_UI.CreateButton ( "GRM_RosterColumnCustomNote" , GRM_UI.GRM_RosterFrame , "ColumnDisplayButtonTemplate" , GRM.L ( "Custom Note" ) , 150 , 22 , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnOfficerNote, "RIGHT" , -1.5 , 0 } , GRM_R.SortCustomNote , "GameFontWhite" , 13 , "LEFT" , 10 , -3 );
-- Right click menu
GRM_UI.CreateCoreFrame ( "GRM_RosterFrameDropDown" , GRM_UI.GRM_RosterFrame , nil , 110 , 177 , BackdropTemplateMixin and "BackdropTemplate" , false , nil , "FULLSCREEN_DIALOG" , false , true );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:Hide();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:SetBackdrop ( GRM_UI.noteBackdrop2 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.playerName = "";
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numPromoteRanks = 0;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numDemoteRanks = 0;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.rankIndex = 0;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.canKick = false
GRM_UI.GRM_RosterFrame:SetScript ( "OnHide" , function()
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:Hide();
end)
-- Guild Roster Title
GRM_UI.CreateString ( "GRM_RosterFrameDropDownName" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , "GameFontNormal" , "" , 13 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , "TOPLEFT" , 7 , -7 } , 100 , nil , "LEFT" , false );
-- Promote
GRM_UI.CreateButton ( "GRM_RosterDropDownPromote" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , nil , "" , 100 , 22 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownName , "BOTTOMLEFT" , 0 , -1 } , nil , "GameFontWhite" , 12 , "LEFT" , 5 , -5 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownPromote:SetHitRectInsets ( -10 , 0 , -15 , -15 ); -- Necessary for :IsMouseOver() on the left side, to not hide
-- Demote
GRM_UI.CreateButton ( "GRM_RosterDropDownDemote" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , nil , "" , 100 , 22 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownPromote , "BOTTOMLEFT" , 0 , -3 } , nil , "GameFontWhite" , 12 , "LEFT" , 5 , -5 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownDemote:SetHitRectInsets ( -10 , 0 , -15 , -15 );
-- Kick
GRM_UI.CreateButton ( "GRM_RosterDropDownKick" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , nil , GRM.L ( "Kick" ) , 100 , 22 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownDemote , "BOTTOMLEFT" , 0 , -3 } , GRM_R.KickPlayer , "GameFontWhite" , 12 , "LEFT" , 5 , -5 );
-- Divider
GRM_UI.CreateString ( "GRM_RosterFrameDropDownDivider" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , "GameFontWhite" , "__________" , 12 , { "TOP" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownKick , "BOTTOM" , 0 , -10} , 100 , nil , "CENTER" , false );
-- Whisper
GRM_UI.CreateButton ( "GRM_RosterDropDownWhisper" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , nil , GRM.L ( "Whisper" ) , 100 , 22 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownDivider , "BOTTOMLEFT" , 0 , -5 } , GRM_R.RosterRightClickWhisper , "GameFontWhite" , 12 , "LEFT" , 5 , -5 );
-- Cancel
GRM_UI.CreateButton ( "GRM_RosterDropDownCancel" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , nil , GRM.L ( "Cancel" ) , 100 , 22 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownWhisper , "BOTTOMLEFT" , 0 , -3 } , GRM_R.RosterRightClickCancel , "GameFontWhite" , 12 , "LEFT" , 5 , -5 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownPromote:SetHighlightTexture (
"Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownDemote:SetHighlightTexture ( "Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownKick:SetHighlightTexture ( "Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownWhisper:SetHighlightTexture ( "Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownCancel:SetHighlightTexture ( "Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight" );
-- Tooltip Promote
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownPromote:SetScript ( "OnEnter" , function( self )
if GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numPromoteRanks == 0 then
GRM_UI.SetTooltipScale()
GameTooltip:SetOwner ( self , "ANCHOR_CURSOR" );
if CanGuildPromote() then
GameTooltip:AddLine( GRM.L ( "Unable to Promote players at this rank" ) );
else
GameTooltip:AddLine( GRM.L ( "No Rank Permission to Promote" ) );
end
GameTooltip:Show();
else
GRM_R.BuildPromotionRankSelectionDropDown( self );
end
end);
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownPromote:SetScript ( "OnLeave" , function()
GRM.RestoreTooltip()
if not GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:IsMouseOver() then
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:Hide();
end
end)
-- Tooltip Demote
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownDemote:SetScript ( "OnEnter" , function( self )
if GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numDemoteRanks == 0 then
GRM_UI.SetTooltipScale()
GameTooltip:SetOwner ( self , "ANCHOR_CURSOR" );
if CanGuildDemote() then
GameTooltip:AddLine( GRM.L ( "Unable to Demote players at this rank" ) );
else
GameTooltip:AddLine( GRM.L ( "No Rank Permission to Demote" ) );
end
GameTooltip:Show();
else
GRM_R.BuildDemotionRankSelectionDropDown( self );
end
end);
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownDemote:SetScript ( "OnLeave" , function()
GRM.RestoreTooltip()
if not GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:IsMouseOver() then
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:Hide();
end
end)
-- Tooltip Kick
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownKick:SetScript ( "OnEnter" , function( self )
if not GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.canKick then
GRM_UI.SetTooltipScale()
GameTooltip:SetOwner ( self , "ANCHOR_CURSOR" );
if CanGuildRemove() then
GameTooltip:AddLine( GRM.L ( "Unable to kick players at this rank" ) );
else
GameTooltip:AddLine( GRM.L ( "No Rank Permission to Kick" ) );
end
GameTooltip:Show();
end
end);
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownKick:SetScript ( "OnLeave" , function()
GRM.RestoreTooltip();
end)
-- Rank selection - Right click menu
GRM_UI.CreateCoreFrame ( "GRM_RosterFrameDropDownRank" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown , nil , 135 , 210 , BackdropTemplateMixin and "BackdropTemplate" , false , nil , "FULLSCREEN_DIALOG" , false , true );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:Hide();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetBackdrop ( GRM_UI.noteBackdrop2 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetHitRectInsets ( -10 , -10 , -10 , -10 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.promote = false;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.promote = false;
-- Guild Roster Title
GRM_UI.CreateString ( "GRM_RosterFrameDropDownRankText" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank , "GameFontNormal" , "" , 12 , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank , "TOPLEFT" , 7 , -7 } , 125 , nil , "LEFT" , false );
-- Set the 9 possible rank options
local points = { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.GRM_RosterFrameDropDownRankText , "BOTTOMLEFT" , 0 , -8 };
for i = 1 , 9 do
if i > 1 then
points = { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton" .. ( i-1 )] , "BOTTOMLEFT" , 0 , -1 };
end
GRM_UI.CreateButton ( "GRM_RosterDropDownRankButton" .. i , GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank , nil , "" , ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:GetWidth() - 5 ) , 20 , points , GRM_R.RankSelection , "GameFontWhite" , 12 , "LEFT" , 10 , 0 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton" .. i]:SetHighlightTexture ( "Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton" .. i].destinationRank = 0;
end
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:SetScript ( "OnHide" , function()
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:Hide();
end);
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetScript ( "OnLeave" , function( self )
if not GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownPromote:IsMouseOver() and not GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterDropDownDemote:IsMouseOver() and not GRM_R.IsOverAnyRankSelectionButtons() then
self:Hide();
end
end)
-- SEARCH EDIT BOX
GRM_UI.CreateEditBox ( "GRM_RosterFrameNameEditBox" , GRM_UI.GRM_RosterFrame , "InputBoxTemplate" , 165 , 30 , { "BOTTOMLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnName , "TOPLEFT" , 5 , 2 } , "CENTER" , nil , 50 , false , GRM_R.NameSearchTT , GRM_R.TooltipReset , GRM_R.RefreshRosterName , true , true );
-- Guild Roster Search Title
GRM_UI.CreateString ( "GRM_RosterFrameNameEditBoxText" , GRM_UI.GRM_RosterFrame , "GameFontNormal" , GRM.L ( "Player Search" ) , 16 , { "BOTTOM" , GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox , "TOP" , 0 , 3 } , 155 , nil , "CENTER" , false );
-- NOTE SEARCH EDIT BOX
GRM_UI.CreateEditBox ( "GRM_RosterNoteEditBox" , GRM_UI.GRM_RosterFrame , "InputBoxTemplate" , 220 , 30 , { "BOTTOM" , GRM_UI.GRM_RosterFrame.GRM_RosterColumnOfficerNote , "TOP" , 0 , 5 } , "LEFT" , nil , 31 , false , GRM_R.NoteSearchTT , GRM_R.TooltipReset , GRM_R.RefreshRosterName , true , false );
-- Note Search Title
GRM_UI.CreateString ( "GRM_RosterNoteEditBoxText" , GRM_UI.GRM_RosterFrame , "GameFontNormal" , GRM.L ( "Note Search" ) , 16 , { "BOTTOM" , GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox , "TOP" , 0 , 3 } , 225 , nil , "CENTER" , false );
GRM_R.ClearPlayerSearch = function()
GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:SetText("");
end
GRM_R.ClearNoteSearch = function()
GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:SetText("");
end
-- Show Offline Checkbox
GRM_UI.CreateCheckBox ( "GRM_RosterShowOfflineCheckBox" , GRM_UI.GRM_RosterFrame , nil , nil , { "TOPLEFT" , GRM_UI.GRM_RosterFrame , "TOPLEFT" , 15 , -15 } , GRM_R.ShowOfflineLogic , GRM.L ( "Show Offline Members" ) , "GameFontNormal" , 11 );
-- Member Count
GRM_UI.CreateString ( "GRM_RosterMemberCount" , GRM_UI.GRM_RosterFrame , "GameFontNormal" , "" , 11 , { "TOPRIGHT" , GRM_UI.GRM_RosterFrame , "TOPRIGHT" , -30 , -20 } );
-- Show Options Button
GRM_UI.CreateButton ( "GRM_RosterOptionsButton" , GRM_UI.GRM_RosterFrame , "UIPanelScrollUpButtonTemplate" , nil , 20 , 20 , { "BOTTOMRIGHT" , GRM_UI.GRM_RosterFrame , "BOTTOMLEFT" , 0 , 8 } , GRM_R.OpenRosterOptions , nil , nil , nil , 10 , -5 , GRM_R.OpenRosterOptionsButtonTT , GRM_R.TooltipReset );
-- Show Mains Checkbox
GRM_UI.CreateCheckBox ( "GRM_RosterOptionsShowMains" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , nil , nil , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , "TOPLEFT" , 15 , -15 } , GRM_R.ShowMainsLogic , GRM.L ( "Show Mains" ) , "GameFontNormal" , 11 );
-- Show Alts Checkbox
GRM_UI.CreateCheckBox ( "GRM_RosterOptionsShowAlts" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , nil , nil , { "TOPLEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions.GRM_RosterOptionsShowMains , "BOTTOMLEFT" , 0 , -6 } , GRM_R.ShowAltsLogic , GRM.L ( "Show Alts" ) , "GameFontNormal" , 11 );
-- Show Main Tag Checkbox
GRM_UI.CreateCheckBox ( "GRM_RosterOptionsShowMainTag" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , nil , nil , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions.GRM_RosterOptionsShowMains , "RIGHT" , 100 , 0 } , GRM_R.ShowMainTag , GRM.L ( "Show Tag" ) , "GameFontNormal" , 11 );
-- Show Alt Tag Checkbox
GRM_UI.CreateCheckBox ( "GRM_RosterOptionsShowAltTag" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , nil , nil , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions.GRM_RosterOptionsShowAlts , "RIGHT" , 100 , 0 } , GRM_R.ShowAltTag , GRM.L ( "Show Tag" ) , "GameFontNormal" , 11 );
-- Group by Main Checkbox
GRM_UI.CreateCheckBox ( "GRM_RosterOptionsGroupByMain" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , nil , nil , { "LEFT" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions.GRM_RosterOptionsShowMainTag , "RIGHT" , 100 , 0 } , GRM_R.GroupByMainLogic , GRM.L ( "Group Alts With Main" ) , "GameFontNormal" , 11 , GRM_R.GroupByMainTT , GRM_R.TooltipReset );
-- Number of Rows Options Slider
GRM_UI.CreateOptionsSlider( "GRM_RowsCountSlider" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , "MinimalSliderWithSteppersTemplate" , { "RIGHT" , GRM_UI.GRM_RosterFrame.GRM_RosterOptions , "RIGHT" , -90 , 5 } , 10 , 40 , 1 , 11 , GRM.L ( "Rows:" ) , 18 , "GameFontNormal" , GRM_R.NumRowsSliderLogic, GRM_R.NumRowsSliderTT , GRM_R.TooltipReset ,GRM_R.SliderMouseUpLogic , false )
end
-- Method: GRM_R.ResetColumnTextColors()
-- What it Does: It changes the columm header text to emphasize where the sorting is happening.
-- Purpose: Quality of life feature so you can know what is being sorted.
GRM_R.ResetColumnTextColors = function()
local columnHeaders = {
{ min = 1 , max = 2 , column = "GRM_RosterColumnName" } ,
{ min = 3 , max = 4 , column = "GRM_RosterColumnLastOnline" } ,
{ min = 5 , max = 6 , column = "GRM_RosterColumnRank" } ,
{ min = 7 , max = 8 , column = "GRM_RosterColumnLvl" } ,
{ min = 9 , max = 10 , column = "GRM_RosterColumnMythicPlus" } ,
{ min = 11 , max = 12 , column = "GRM_RosterColumnNote" } ,
{ min = 13 , max = 14 , column = "GRM_RosterColumnOfficerNote" },
{ min = 15 , max = 16 , column = "GRM_RosterColumnCustomNote" }
};
local function lookupValue ( input )
local result = "";
for _ , entry in ipairs ( columnHeaders ) do
if input >= entry.min and input <= entry.max then
result = entry.column;
break;
end
end
return result;
end
local sortFrame1 = lookupValue ( GRM_UI.GRM_RosterFrame.SortType );
local sortFrame2 = lookupValue ( GRM_UI.GRM_RosterFrame.FormerSortType );
-- Set back to white all default column text
for _ , entry in ipairs ( columnHeaders ) do
if entry.column ~= sortFrame1 and entry.column ~= sortFrame2 and ( entry.column ~= "GRM_RosterColumnMythicPlus" or GRM_G.BuildVersion >= 80000 ) then
GRM_UI.GRM_RosterFrame[entry.column][entry.column.. "Text" ]:SetTextColor ( 1 , 1 , 1 );
end
end
-- Set to color the selected columns
GRM_UI.GRM_RosterFrame[sortFrame1][sortFrame1.. "Text" ]:SetTextColor ( 0 , 0.8 , 1 );
if ( GRM_UI.GRM_RosterFrame.SortType == 5 or GRM_UI.GRM_RosterFrame.SortType == 6 ) and GRM_UI.GRM_RosterFrame.FormerSortType < 15 then
GRM_UI.GRM_RosterFrame[sortFrame2][sortFrame2.. "Text" ]:SetTextColor ( 0 , 0.8 , 1 );
elseif sortFrame1 ~= sortFrame2 then
GRM_UI.GRM_RosterFrame[sortFrame2][sortFrame2.. "Text" ]:SetTextColor ( 1 , 1 , 1 );
end
end
-- Method: GRM_R.IsOverAnyRankSelectionButtons()
-- What it Does: Returns true if over any mouseover button, for hide/show purposes/
-- Purpose: Quality of life UI controls.
GRM_R.IsOverAnyRankSelectionButtons = function()
local frame;
local name = "";
-- Compatibility issue with Classic vs 11.0 TWW update.
if GetMouseFoci then
frame = GetMouseFoci();
if frame[1] then
name = frame[1]:GetName();
end
else
frame = GetMouseFocus();
if frame then
name = frame:GetName();
end
end
if name and name ~= "" then
for i = 1 , 9 do
if name == "GRM_RosterDropDownRankButton" .. i then
return true;
end
end
end
return false;
end
-- Method: GRM_R.BuildPromotionRankSelectionDropDown ( buttonObject )
-- What it Does: Builds the rankPromotionWindow
-- Purpose: Easily give people ability to bump ranks with menus.
GRM_R.BuildPromotionRankSelectionDropDown = function ( buttonFrame )
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.GRM_RosterFrameDropDownRankText:SetText ( GRM.L ( "Promote Player to:" ) );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:ClearAllPoints();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetPoint ( "BOTTOMRIGHT" , buttonFrame , "BOTTOMLEFT" , -6 , -20 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.promote = true;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.demote = false;
for i = 1 , 9 do
if i <= GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numPromoteRanks then
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]["GRM_RosterDropDownRankButton"..i.."Text"]:SetText ( GuildControlGetRankName ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.rankIndex - GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numPromoteRanks + i ) );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]:Show();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i].destinationRank = ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.rankIndex - GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numPromoteRanks + i ) - 1;
else
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]["GRM_RosterDropDownRankButton"..i.."Text"]:SetText ( "" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]:Hide();
end
end
local height = 60;
height = height + ( ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numPromoteRanks - 1 ) * 21 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetHeight ( height );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:Show();
end
-- Method: GRM_R.BuildDemotionRankSelectionDropDown ( buttonObject )
-- What it Does: Builds the rankDemotionWindow
-- Purpose: Easily give people ability to bump ranks with menus.
GRM_R.BuildDemotionRankSelectionDropDown = function ( buttonFrame )
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.GRM_RosterFrameDropDownRankText:SetText ( GRM.L ( "Demote Player to:" ) );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.promote = false;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.demote = true;
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:ClearAllPoints();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetPoint ( "TOPRIGHT" , buttonFrame , "TOPLEFT" , -6 , 15 );
for i = 1 , 9 do
if i <= GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numDemoteRanks then
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]["GRM_RosterDropDownRankButton"..i.."Text"]:SetText ( GuildControlGetRankName ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.rankIndex + 1 + i ) );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]:Show();
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i].destinationRank = ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.rankIndex + i );
else
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]["GRM_RosterDropDownRankButton"..i.."Text"]:SetText ( "" );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank["GRM_RosterDropDownRankButton"..i]:Hide();
end
end
local height = 60;
height = height + ( ( GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.numDemoteRanks - 1 ) * 21 );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:SetHeight ( height );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank:Show();
end
-- Method: GRM_R.RankSelection ( buttonObject )
-- What it Does: Determines to use the demote or promote logic
-- Purpose: Quality of life feature
GRM_R.RankSelection = function( button )
if GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.promote then
GRM_R.PromotePlayer ( button )
elseif GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.GRM_RosterFrameDropDownRank.demote then
GRM_R.DemotePlayer ( button )
end
end
-- Method: GRM_R.PromotePlayer ( button )
-- What it Does: Takes the player to be promoted and builds macr otool
-- Purpose: Quality of life feature for the custom guild roster
GRM_R.PromotePlayer = function ( button )
local promoEntries = GRM.BuildCustomPromoteEntries ( { GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.playerName } , false , button );
if not GRM_UI.GRM_ToolCoreFrame or ( GRM_UI.GRM_ToolCoreFrame and not GRM_UI.GRM_ToolCoreFrame:IsVisible() ) then
GRM_UI.GRM_ToolCoreFrame:Show();
end
GRM_UI.GRM_ToolCoreFrame.GRM_PromoTab:Click();
GRM_UI.RefreshManagementTool( false , false , true , promoEntries );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:Hide();
end
-- Method: GRM_R.DemotePlayer ( button )
-- What it Does: Takes the player to be Demoted and builds macro otool
-- Purpose: Quality of life feature for the custom guild roster
GRM_R.DemotePlayer = function( button )
local demoteEntries = GRM.BuildCustomDemoteEntries ( { GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.playerName } , false , button );
if not GRM_UI.GRM_ToolCoreFrame or ( GRM_UI.GRM_ToolCoreFrame and not GRM_UI.GRM_ToolCoreFrame:IsVisible() ) then
GRM_UI.GRM_ToolCoreFrame:Show();
end
GRM_UI.GRM_ToolCoreFrame.GRM_DemoteTab:Click();
GRM_UI.RefreshManagementTool( false , false , true , demoteEntries );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:Hide();
end
-- Method: GRM_R.KickPlayer()
-- What it Does: Takes the player to be kicked, builds it for the macro tool, and builds the macro
-- Purpose: Quality of Life ease of taking advantage of the macro tool
GRM_R.KickPlayer = function()
if GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.canKick then
local kickEntries = GRM.BuildCustomKickEntries ( { GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown.playerName } , false );
if not GRM_UI.GRM_ToolCoreFrame or ( GRM_UI.GRM_ToolCoreFrame and not GRM_UI.GRM_ToolCoreFrame:IsVisible() ) then
GRM_UI.GRM_ToolCoreFrame:Show();
end
GRM_UI.GRM_ToolCoreFrame.GRM_KickTab:Click();
GRM_UI.RefreshManagementTool( false , false , true , kickEntries );
GRM_UI.GRM_RosterFrame.GRM_RosterFrameDropDown:Hide();
end
end
-- Method: GRM_R.RefreshOnlineStatus();
-- What it Does: Refreshes the online status of all the players in the guild for the DB
-- Purpose: To ensure the GRM custom roster is accurate always.
GRM_R.RefreshOnlineStatus = function( guildData )
local count = 0;
if guildData then
local members = C_Club.GetClubMembers ( GRM_G.gClubID );
local player = {};
local fullName = "";
for i = 1 , #members do
player = C_Club.GetMemberInfo ( GRM_G.gClubID , members[i] );
fullName = GRM.GetFullNameClubMember ( player.guid );
if guildData[fullName] then
guildData[fullName].isOnline = ( player.presence ~= 3 and player.presence ~= 0 );
if guildData[fullName].isOnline then
count = count + 1;
end
end
end
GRM_UI.GRM_RosterFrame.GRM_RosterMemberCount:SetText ( GRM.L ( "{num}/{custom1} Online" , nil , nil , count , GRM.GetNumGuildies() ) );
end
end
-- Method: GRM_R.GetAllMembersAsArray( string , string )
-- What it Does: Returns an unsorted list of all guild members as an array, as well as some accompanying details.
-- Purpose: A sorted list is useful for columns
GRM_R.GetAllMembersAsArray = function( nameSearch , noteSearch )
local result = {};
local guildData = GRM.GetGuild();
local addPlayer;
-- Refresh the online status for accuracy
GRM_R.RefreshOnlineStatus ( guildData );
addPlayer = function ( player , altAdd )
local tempPlayer = {};
local toAdd = false;
-- No need to do all this extra processing if the player is offline.
if GRM.S().showRosterOffline or ( not GRM.S().showRosterOffline and player.isOnline ) then
if ( not nameSearch or string.find ( string.lower ( GRM.RemoveSpecialCharacters ( player.name ) ) , nameSearch , 1 , true ) or string.find ( string.lower ( player.name ) , nameSearch , 1 , true ) ) and ( not noteSearch or string.find ( string.lower ( GRM.RemoveSpecialCharacters ( player.note ) ) , noteSearch , 1 , true ) or string.find ( string.lower ( player.note ) , noteSearch , 1 , true ) or string.find ( string.lower ( GRM.RemoveSpecialCharacters ( player.customNote[4] ) ) , noteSearch , 1 , true ) or string.find ( string.lower ( player.customNote[4] ) , noteSearch , 1 , true ) or ( GRM.CanEditOfficerNote() and ( string.find ( string.lower ( GRM.RemoveSpecialCharacters ( player.officerNote ) ) , noteSearch , 1 , true ) or string.find ( string.lower ( player.officerNote ) , noteSearch , 1 , true ) ) ) ) then
if GRM.IsMain ( player.name ) then
tempPlayer.isMain = true;
tempPlayer.isAlt = false;
else
tempPlayer.isMain = false;
if player.altGroup == "" then
tempPlayer.isAlt = false;
else
tempPlayer.isAlt = true;
end
end
if ( not GRM.S().showMains and tempPlayer.isMain ) or ( not GRM.S().showAlts and tempPlayer.isAlt ) then
return false; -- Break it here. No need to proceed
end
-- Onily need to add alts if necessary.
-- This function is for setting up the sub alt table.
if GRM.S().showMains and GRM.S().groupByMain and not altAdd then
if tempPlayer.isAlt then
toAdd = false;
else
if tempPlayer.isMain then
if GRM.PlayerHasAlts ( player ) then
tempPlayer.alts = {};
-- Ok, let's add alts
local alts = GRM.GetAltNamesList ( player );
local addAlt , altDetails;
for i = 1 , #alts do
addAlt , altDetails = addPlayer ( guildData[alts[i]] , true );
if addAlt then
table.insert ( tempPlayer.alts , altDetails );
end
end
end
end
toAdd = true; -- Add if Main or no designation - only not showing if designated as an alt.
end
else
toAdd = true;
end
if toAdd then
tempPlayer.name = player.name;
tempPlayer.rankName = player.rankName;
tempPlayer.rankIndex = player.rankIndex;
tempPlayer.lastOnline = player.lastOnline;
tempPlayer.classColor = GRM.GetClassColorRGB ( player.class , false );
tempPlayer.level = player.level;
tempPlayer.note = player.note;
tempPlayer.customNote = player.customNote[4]
if GRM_G.HardcoreActive then
if player.HC.isDead then
tempPlayer.isDead = true;
else
tempPlayer.isDead = false;
end
end
-- Alts Logic only add if necessary
if GRM.CanEditOfficerNote() then
tempPlayer.officerNote = player.officerNote;
else
tempPlayer.officerNote = "";
end
if GRM_G.BuildVersion >= 80000 then
tempPlayer.MythicScore = player.MythicScore;
end
if not player.isOnline then
tempPlayer.hoursReport = GRM.Time.HoursReport ( player.lastOnlineTime );
else
tempPlayer.hoursReport = GRM.L ( "Online" );
tempPlayer.lastOnline = 0;
end
end
end
end
return toAdd , GRM.DeepCopyArray ( tempPlayer );
end
local toAdd , playerDetails;
for _ , player in pairs ( guildData ) do
if type ( player ) == "table" then
toAdd , playerDetails = addPlayer ( player );
if toAdd then
table.insert ( result , playerDetails );
end
end
end
return result;
end
-- Method: GRM_R.SortNames( buttonObject , bool , bool )
-- What it Does: Sorts all of the names ascending or descending in the guild
-- Purpose: For the Guild roster
GRM_R.SortNames = function ( _ , keepType , reSizeButtons )
local nameSearch = GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:GetText();
local noteSearch = GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:GetText();
if nameSearch == "" then
nameSearch = nil;
else
nameSearch = string.lower ( GRM.RemoveSpecialCharacters ( nameSearch ) );
end
if noteSearch == "" then
noteSearch = nil;
else
noteSearch = string.lower ( GRM.RemoveSpecialCharacters ( noteSearch ) );
end
if not keepType then
if GRM_UI.GRM_RosterFrame.SortType > 2 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 1;
elseif GRM_UI.GRM_RosterFrame.SortType == 1 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 2;
else
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 1;
end
end
local members = GRM_R.GetAllMembersAsArray ( nameSearch , noteSearch );
if GRM_UI.GRM_RosterFrame.SortType == 1 then
sort ( members , function ( a , b ) return a.name < b.name end );
else
sort ( members , function ( a , b ) return a.name > b.name end );
end
if GRM.S().groupByMain then
local i = 1;
while i <= #members do
if members[i].alts and #members[i].alts > 0 then
if GRM_UI.GRM_RosterFrame.SortType == 1 then
sort ( members[i].alts , function ( a , b ) return a.name < b.name end );
else
sort ( members[i].alts , function ( a , b ) return a.name > b.name end );
end
-- Now, need need to insert into main entries table by merging
for j = 1 , #members[i].alts do
table.insert ( members , i + j , members[i].alts[j] );
end
i = i + #members[i].alts
members[i].alts = nil;
end
i = i + 1;
end
end
GRM_R.BuildGuildRoster ( true , true , members , reSizeButtons );
end
-- Method: GRM_R.SortLastOnline( buttonObject , bool , bool )
-- What it Does: Sorts all of the players by last online, longest or shortes
-- Purpose: For the Guild roster
GRM_R.SortLastOnline = function ( _ , keepType , reSizeButtons )
local nameSearch = GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:GetText();
local noteSearch = GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:GetText();
if nameSearch == "" then
nameSearch = nil;
else
nameSearch = string.lower ( GRM.RemoveSpecialCharacters ( nameSearch ) );
end
if noteSearch == "" then
noteSearch = nil;
else
noteSearch = string.lower ( GRM.RemoveSpecialCharacters ( noteSearch ) );
end
if not keepType then
if GRM_UI.GRM_RosterFrame.SortType ~= 3 and GRM_UI.GRM_RosterFrame.SortType ~= 4 then
GRM_UI.GRM_RosterFrame.SortType = 3;
elseif GRM_UI.GRM_RosterFrame.SortType == 3 then
GRM_UI.GRM_RosterFrame.SortType = 4;
else
GRM_UI.GRM_RosterFrame.SortType = 3;
end
end
local members = GRM_R.GetAllMembersAsArray ( nameSearch , noteSearch );
if GRM_UI.GRM_RosterFrame.SortType == 3 then
sort ( members , function ( a , b ) return a.lastOnline < b.lastOnline end );
else
sort ( members , function ( a , b ) return a.lastOnline > b.lastOnline end );
end
if GRM.S().groupByMain then
local i = 1;
while i <= #members do
if members[i].alts and #members[i].alts > 0 then
if GRM_UI.GRM_RosterFrame.SortType == 3 then
sort ( members[i].alts , function ( a , b ) return a.lastOnline < b.lastOnline end );
else
sort ( members[i].alts , function ( a , b ) return a.lastOnline > b.lastOnline end );
end
-- Now, need need to insert into main entries table by merging
for j = 1 , #members[i].alts do
table.insert ( members , i + j , members[i].alts[j] );
end
i = i + #members[i].alts
members[i].alts = nil;
end
i = i + 1;
end
end
GRM_R.BuildGuildRoster ( true , true , members , reSizeButtons );
end
-- Method: GRM_R.SortMythicScore ( buttonObject, bool , bool )
-- What it Does: Sorts the players by M+ Score
-- Purpose: For the GRM Guild Roster
GRM_R.SortMythicScore = function ( _ , keepType , reSizeButtons )
local nameSearch = GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:GetText();
local noteSearch = GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:GetText();
if nameSearch == "" then
nameSearch = nil;
else
nameSearch = string.lower ( GRM.RemoveSpecialCharacters ( nameSearch ) );
end
if noteSearch == "" then
noteSearch = nil;
else
noteSearch = string.lower ( GRM.RemoveSpecialCharacters ( noteSearch ) );
end
if not keepType then
if GRM_UI.GRM_RosterFrame.SortType ~= 9 and GRM_UI.GRM_RosterFrame.SortType ~= 10 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 9;
elseif GRM_UI.GRM_RosterFrame.SortType == 9 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 10;
else
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 9;
end
end
local members = GRM_R.GetAllMembersAsArray ( nameSearch , noteSearch );
if GRM_UI.GRM_RosterFrame.SortType == 9 then
sort ( members , function ( a , b ) return a.MythicScore > b.MythicScore end );
else
sort ( members , function ( a , b ) return a.MythicScore < b.MythicScore end );
end
if GRM.S().groupByMain then
local i = 1;
while i <= #members do
if members[i].alts and #members[i].alts > 0 then
if GRM_UI.GRM_RosterFrame.SortType == 9 then
sort ( members[i].alts , function ( a , b ) return a.MythicScore > b.MythicScore end );
else
sort ( members[i].alts , function ( a , b ) return a.MythicScore < b.MythicScore end );
end
-- Now, need need to insert into main entries table by merging
for j = 1 , #members[i].alts do
table.insert ( members , i + j , members[i].alts[j] );
end
i = i + #members[i].alts
members[i].alts = nil;
end
i = i + 1;
end
end
GRM_R.BuildGuildRoster ( true , true , members , reSizeButtons );
end
-- Method: GRM_R.SortNote ( buttonObject , bool , bool )
-- What it Does: Sorts all of the names ascending or descending in the guild
-- Purpose: For the Guild roster
GRM_R.SortNote = function ( _ , keepType , reSizeButtons )
local nameSearch = GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:GetText();
local noteSearch = GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:GetText();
if nameSearch == "" then
nameSearch = nil;
else
nameSearch = string.lower ( GRM.RemoveSpecialCharacters ( nameSearch ) );
end
if noteSearch == "" then
noteSearch = nil;
else
noteSearch = string.lower ( GRM.RemoveSpecialCharacters ( noteSearch ) );
end
if not keepType then
if GRM_UI.GRM_RosterFrame.SortType ~= 11 and GRM_UI.GRM_RosterFrame.SortType ~= 12 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 11;
elseif GRM_UI.GRM_RosterFrame.SortType == 11 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 12;
else
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 11;
end
end
local members = GRM_R.GetAllMembersAsArray ( nameSearch , noteSearch );
if GRM_UI.GRM_RosterFrame.SortType == 11 then
sort ( members , function ( a , b ) return string.lower ( GRM.Trim ( a.note ) ) < string.lower ( GRM.Trim ( b.note ) ) end );
else
sort ( members , function ( a , b ) return string.lower ( GRM.Trim ( a.note ) ) > string.lower ( GRM.Trim ( b.note ) ) end );
end
if GRM.S().groupByMain then
local i = 1;
while i <= #members do
if members[i].alts and #members[i].alts > 0 then
if GRM_UI.GRM_RosterFrame.SortType == 11 then
sort ( members[i].alts , function ( a , b ) return string.lower ( GRM.Trim ( a.note ) ) < string.lower ( GRM.Trim ( b.note ) ) end );
else
sort ( members[i].alts , function ( a , b ) return string.lower ( GRM.Trim ( a.note ) ) > string.lower ( GRM.Trim ( b.note ) ) end );
end
-- Now, need need to insert into main entries table by merging
for j = 1 , #members[i].alts do
table.insert ( members , i + j , members[i].alts[j] );
end
i = i + #members[i].alts
members[i].alts = nil;
end
i = i + 1;
end
end
GRM_R.BuildGuildRoster ( true , true , members , reSizeButtons );
end
-- Method: GRM_R.SortOfficerNote ( buttonObject , bool , bool )
-- What it Does: Sorts all of the names ascending or descending in the guild
-- Purpose: For the Guild roster
GRM_R.SortOfficerNote = function ( _ , keepType , reSizeButtons )
local nameSearch = GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:GetText();
local noteSearch = GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:GetText();
if nameSearch == "" then
nameSearch = nil;
else
nameSearch = string.lower ( GRM.RemoveSpecialCharacters ( nameSearch ) );
end
if noteSearch == "" then
noteSearch = nil;
else
noteSearch = string.lower ( GRM.RemoveSpecialCharacters ( noteSearch ) );
end
if not keepType then
if GRM_UI.GRM_RosterFrame.SortType ~= 13 and GRM_UI.GRM_RosterFrame.SortType ~= 14 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 13;
elseif GRM_UI.GRM_RosterFrame.SortType == 13 then
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 14;
else
GRM_UI.GRM_RosterFrame.FormerSortType = GRM_UI.GRM_RosterFrame.SortType;
GRM_UI.GRM_RosterFrame.SortType = 13;
end
end
local members = GRM_R.GetAllMembersAsArray ( nameSearch , noteSearch );
if GRM_UI.GRM_RosterFrame.SortType == 13 then
sort ( members , function ( a , b ) return string.lower ( GRM.Trim ( a.officerNote ) ) < string.lower ( GRM.Trim ( b.officerNote ) ) end );
else
sort ( members , function ( a , b ) return string.lower ( GRM.Trim ( a.officerNote ) ) > string.lower ( GRM.Trim ( b.officerNote ) ) end );
end
if GRM.S().groupByMain then
local i = 1;
while i <= #members do
if members[i].alts and #members[i].alts > 0 then
if GRM_UI.GRM_RosterFrame.SortType == 13 then
sort ( members[i].alts , function ( a , b ) return string.lower ( GRM.Trim ( a.officerNote ) ) < string.lower ( GRM.Trim ( b.officerNote ) ) end );
else
sort ( members[i].alts , function ( a , b ) return string.lower ( GRM.Trim ( a.officerNote ) ) > string.lower ( GRM.Trim ( b.officerNote ) ) end );
end
-- Now, need need to insert into main entries table by merging
for j = 1 , #members[i].alts do
table.insert ( members , i + j , members[i].alts[j] );
end
i = i + #members[i].alts
members[i].alts = nil;
end
i = i + 1;
end
end
GRM_R.BuildGuildRoster ( true , true , members , reSizeButtons );
end
-- Method: GRM_R.SortCustomNote ( buttonObject , bool , bool )
-- What it Does: Sorts all of the names ascending or descending in the guild
-- Purpose: For the Guild roster
GRM_R.SortCustomNote = function ( _ , keepType , reSizeButtons )
local nameSearch = GRM_UI.GRM_RosterFrame.GRM_RosterFrameNameEditBox:GetText();
local noteSearch = GRM_UI.GRM_RosterFrame.GRM_RosterNoteEditBox:GetText();
if nameSearch == "" then
nameSearch = nil;
else
nameSearch = string.lower ( GRM.RemoveSpecialCharacters ( nameSearch ) );
end
if noteSearch == "" then
noteSearch = nil;
else
noteSearch = string.lower ( GRM.RemoveSpecialCharacters ( noteSearch ) );
end