-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.lua
1049 lines (991 loc) · 34.8 KB
/
Config.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
local ATG_display_name, ATG = ...
-- Config.lua
-- $Id$
-- Localize some lua globals
local _G = getfenv(0)
local assert = _G.assert
local geterrorhandler = _G.geterrorhandler
local next = _G.next
local pairs = _G.pairs
local pairs = _G.pairs
local select = _G.select
local time = _G.time
local tonumber = _G.tonumber
local tostringall = _G.tostringall
local function err(msg,...) geterrorhandler()(msg:format(tostringall(...)) .. " - " .. time()) end
local LibStub = _G.LibStub
if not _G.AlltheGold_revision then _G.AlltheGold_revision = {} end
_G.AlltheGold_revision.config = ("$Revision$"):match("(%d+)")
local AlltheGold = _G.AlltheGold
-- Localizations
local L = LibStub("AceLocale-3.0"):GetLocale("AlltheGold")
-- Local functions
local GetVersionString
local ReturnConfigMenu
local DisplayConfigMenu
local InitConfig
-- Icons
local valor_icon = "\124TInterface\\Icons\\pvecurrency-valor:0:0:2:0:64:64\124t"
local justice_icon = "\124TInterface\\Icons\\pvecurrency-justice:0:0:2:0:64:64\124t"
local honor_alliance_icon = '\124TInterface\\Icons\\PVPCurrency-Honor-Alliance:0:0:2:0:64:64\124t'
local honor_horde_icon = '\124TInterface\\Icons\\PVPCurrency-Honor-Horde:0:0:2:0:64:64\124t'
local conquest_alliance_icon = '\124TInterface\\Icons\\PVPCurrency-Conquest-Alliance:0:0:2:0:64:64\124t'
local conquest_horde_icon = '\124TInterface\\Icons\\PVPCurrency-Conquest-Horde:0:0:2:0:64:64\124t'
local kill_icon = '\124TInterface\\Icons\\Spell_Holy_BlessingOfStrength:0:0:2:0:64:64\124t'
local ATG_icon = '\124TInterface\\Icons\\INV_Misc_PocketWatch_02:0:0\124t'
-- Version iditification management
do
local version_string = nil
function GetVersionString()
if not version_string then
-- Find the curent revision number from all the files revisions
local revision = 0
if _G.AlltheGold_revision then
for _, rev in pairs(_G.AlltheGold_revision) do
local rev = tonumber(rev)
if rev and rev > revision then revision = rev end
end
else
assert(false,"No AlltheGold_revision")
end
-- Find the curent version
local version = _G.C_AddOns.GetAddOnMetadata("AlltheGold", "Version"):match("([^ ]+)")
-- version_string = (L["Version %s (r%s)"]):format(version, revision)
end
return version_string
end
end -- do
-- Menu management
local function ReturnConfigMenu()
-- This funciton is called only once. Otherwise, I would recycle the table
local config_menu = {
[1] = {
text = L["AlltheGold Configuration"];
isTitle = true;
},
[2] = {
isTitle = true;
},
[3] = {
text = " ";
disabled = true;
},
[4] = {
text = L["Display"],
tooltipText = L["Set the display options"];
hasArrow = true;
menuList = {
[1] = {
text = L["All Factions"];
tooltipText = L["All factions will be displayed"];
checked = 'all_factions';
},
[2] = {
text = L["All Realms"];
tooltipText = L["All realms will de displayed"];
checked = 'all_realms';
},
[3] = {
text = L["Show Played Time"];
tooltipText = L["Display the total time played per character"];
checked = 'show_played_time';
},
[4] = {
text = L["Show Last Loggin"];
tooltipText = L["Display the elapsed time since the character was last logged in"];
checked = 'show_last_login';
},
[5] = {
text = L["Show Seconds"];
tooltipText = L["Display the seconds in the time strings"];
checked = 'show_seconds';
},
[6] = {
text = L["Show Gold"];
tooltipText = L["Display the gold each character pocess"];
checked = 'show_coins';
},
[7] = {
text = L["Show XP Progress"];
tooltipText = L["Display XP progress as a decimal value appended to the level"];
checked = 'show_progress';
},
[8] = {
text = L["Show XP total"];
tooltipText = L["Show the total XP for all characters"];
checked = 'show_xp_total';
},
[9] = {
text = L["Show level total"];
tooltipText = L["Show the total levels for all characters"];
checked = 'show_lvl_totals';
},
[10] = {
text = L["Show Location"];
tooltipText = L["Show the character location"];
hasArrow = true;
menuList = {
[1] = {
text = L["Don't show location"];
list = 'show_location';
arg1 = "none";
},
[2] = {
text = L["Show zone"];
list = 'show_location';
arg1 = "loc";
},
[3] = {
text = L["Show subzone"];
list = 'show_location';
arg1 = "sub";
},
[4] = {
text = L["Show zone/subzone"];
list = 'show_location';
arg1 = "loc/sub";
},
},
},
[11] = {
text = (L["%s (%s)"]):format(L["Valor Points"],valor_icon);
hasArrow = true;
menuList = {
[1] = {
text = (L["Show %s"]):format(L["Valor Points"]);
tooltipText = (L["Display the %s each character pocess"]):format(L["Valor Points"]);
checked = 'show_valor_points';
},
[2] = {
text = (L["Show %s total"]):format(L["Valor Points"]);
tooltipText = (L["Show the total %s for all characters"]):format(L["Valor Points"]);
checked = 'show_valor_total';
},
},
},
[12] = {
text = (L["%s (%s)"]):format(L["Justice Points"],justice_icon);
hasArrow = true;
menuList = {
[1] = {
text = (L["Show %s"]):format(L["Justice Points"]);
tooltipText = (L["Display the %s each character pocess"]):format(L["Justice Points"]);
checked = 'show_justice_points';
},
[2] = {
text = (L["Show %s total"]):format(L["Justice Points"]);
tooltipText = (L["Show the total %s for all characters"]):format(L["Justice Points"]);
checked = 'show_justice_total';
},
},
},
[13] = {
text = L["Rested XP"];
tooltipText = L["Set the rested XP options"];
hasArrow = true;
menuList = {
[1] = {
text = L["Rested XP Total"];
tooltipText = L["Show the character rested XP"];
checked = 'show_rested_xp';
},
[2] = {
text = L["Percent Rest"];
tooltipText = L["Set the base for % display of rested XP"];
hasArrow = true;
menuList = {
[1] = {
text = L["None"];
list = 'percent_rest';
arg1 = "0";
},
[2] = {
text = L["100%"];
list = 'percent_rest';
arg1 = "100";
},
[3] = {
text = L["150%"];
list = 'percent_rest';
arg1 = "150";
},
},
},
[3] = {
text = L["Rested XP Countdown"];
tooltipText = L["Show the time remaining before the character is 100% rested"];
checked = 'show_rested_xp_countdown';
},
},
},
[14] = {
text = L["PVP"];
tooltipText = L["Set the PVP options"];
hasArrow = true;
menuList = {
[1] = {
text = (L["%s (%s)"]):format(L["Honor Kills"], kill_icon);
tooltipText = L["Show the character honor kills"];
checked = 'show_honor_kills';
},
[2] = {
text = (L["%s (%s or %s)"]):format(L["Honor Points"], honor_alliance_icon, honor_horde_icon);
tooltipText = (L['Display the %s each character pocess']):format(L["Honor Points"]);
checked = 'show_honor_points';
},
[3] = {
text = (L['Display the %s each character pocess']):format(
L["Conquest Points"],
conquest_alliance_icon,
conquest_horde_icon);
tooltipText = (L['Display the %s each character pocess']):format(L["Conquest Points"]);
checked = 'show_conquest_points';
},
[4] = {
text = L["Show PVP Totals"];
tooltipText = L["Show the honor related stats for all characters"];
checked = 'show_pvp_totals';
},
},
},
[15] = {
text = L["Show Class Name"];
tooltipText = L["Show the character class beside the level"];
checked = 'show_class_name';
},
[16] = {
text = L["Colorize Class"];
tooltipText = L["Colorize the character name based on class"];
checked = 'colorize_class';
},
[17] = {
text = L["Show Item Level"];
tooltipText = L["Show the character item level (iLevel)"];
checked = 'show_ilevel';
},
[18] = {
text = L["Show Guild Name"];
tooltipText = L["Show the character guild name"];
checked = 'show_guild';
},
[19] = {
text = L["Use Icons"];
tooltipText = L["Use graphics for coin and PvP currencies"];
checked = 'use_icons';
},
[20] = {
text = L["Use Old Shaman Colour"];
tooltipText = L["Use the pre-210 patch colour for the Shaman class"];
checked = 'use_pre_210_shaman_colour';
},
},
},
[5] = {
text = L["Sort"],
tooltipText = L["Set the sort options"];
hasArrow = true;
menuList = {
[1] = {
text = L["Sort Type"],
tooltipText = L["Select the sort type"];
hasArrow = true;
menuList = {
[1] = {
text = L["By name"];
list = 'sort_type';
arg1 = "alpha";
},
[2] = {
text = L["By level"];
list = 'sort_type';
arg1 = "level";
},
[3] = {
text = L["By item level"];
list = 'sort_type';
arg1 = "ilevel";
},
[4] = {
text = L["By experience"];
list = 'sort_type';
arg1 = "xp";
},
[5] = {
text = L["By rested XP"];
list = 'sort_type';
arg1 = "rested_xp";
},
[6] = {
text = L["By money"];
list = 'sort_type';
arg1 = "coin";
},
[7] = {
text = L["By time played"];
list = 'sort_type';
arg1 = "time_played";
},
},
},
[2] = {
text = L["Sort in reverse order"];
tooltipText = L["Use the curent sort type in reverse order"];
checked = 'reverse_sort';
},
},
},
[6] = {
text = L["Ignore Characters"],
tooltipText = L["Hide characters from display"];
hasArrow = true;
menuList = {
},
},
[7] = {
text = " ";
disabled = true;
},
[8] = {
text = L["Minimap Icon"];
tooltipText = L["Show Minimap Icon"];
checked = 'show_minimap_icon';
},
[9] = {
text = L["Configuration"];
tooltipText = L["Open configuration dialog"];
tooltipOnButton = 1;
func = function() _G.InterfaceOptionsFrame_OpenToCategory(ATG_display_name); _G.InterfaceOptionsFrame_OpenToCategory(ATG_display_name) end;
},
}
-- Set version for display
config_menu[2].text = GetVersionString()
-- Deal with the deprecated values
if not AlltheGold:GetOption('show_deprecated') then
config_menu[4].menuList[11] = config_menu[4].menuList[13]
config_menu[4].menuList[12] = config_menu[4].menuList[15]
config_menu[4].menuList[13] = config_menu[4].menuList[16]
config_menu[4].menuList[14] = config_menu[4].menuList[16]
config_menu[4].menuList[15] = config_menu[4].menuList[17]
config_menu[4].menuList[16] = config_menu[4].menuList[18]
config_menu[4].menuList[17] = config_menu[4].menuList[19]
config_menu[4].menuList[18] = config_menu[4].menuList[20]
config_menu[4].menuList[19] = nil
config_menu[4].menuList[20] = nil
end
-- All the checkbox options need to have their menu with the menu button
-- and a pair of function to get and set the options
local function AddCheckboxOption(menu)
local foundCheck = false
for i=1,#menu do
if menu[i] then
menu[i].isNotRadio = true
if not menu[i].checked and not menu[i].list then
menu[i].notCheckable = true
end
if menu[i].checked then
menu[i].tooltipOnButton = 1
menu[i].keepShownOnClick = 1
menu[i].value = menu[i].checked
menu[i].checked = function() return AlltheGold:GetOption(menu[i].value) end
menu[i].func = function(dropdownmenu, arg1, arg2, checked)
AlltheGold:SetOption(dropdownmenu.value, not AlltheGold:GetOption(dropdownmenu.value))
end
foundCheck = true
end
-- For options where you choose one choice from a list of set arguments
-- arg1 contains the choice
if menu[i].list then
menu[i].isNotRadio = nil
menu[i].tooltipOnButton = 1
menu[i].value = menu[i].list
menu[i].checked = function() return AlltheGold:GetOption(menu[i].value) == menu[i].arg1 end
menu[i].func = function(dropdownmenu, arg1, arg2, checked)
AlltheGold:SetOption(dropdownmenu.value, arg1)
end
menu[i].list = nil
foundCheck = true
end
-- Submenus
if menu[i].menuList then AddCheckboxOption(menu[i].menuList) end
end
end
end
AddCheckboxOption(config_menu)
-- Build the ignored list
local i = 1
for faction, faction_table in pairs(ATG.db.global.data) do
for realm, realm_table in pairs(faction_table) do
for pc, _ in pairs(realm_table) do
local pc_name = (L["%s : %s"]):format(realm, pc)
config_menu[6].menuList[i] = {
text = pc_name;
tooltipText = (L["Hide %s of %s from display"]):format(pc, realm);
tooltipOnButton = 1;
keepShownOnClick = 1;
isNotRadio = true;
checked = function() return AlltheGold:GetOption('is_ignored',realm, pc) end;
func = function(dropdownmenu, arg1, arg2, checked)
AlltheGold:SetOption(
'is_ignored',
not AlltheGold:GetOption('is_ignored',realm, pc),
realm,
pc
)
end;
}
i = i + 1
end
end
end
return config_menu
end
do
local dropdownFrame = _G.CreateFrame("Frame", "AlltheGoldDropdownMenu", nil, "UIDropDownMenuTemplate")
function DisplayConfigMenu(anchorFrame)
local anchor
if anchorFrame then
anchor = anchorFrame:GetName()
else
anchor = "cursor"
end
_G.EasyMenu(ATG.config_menu, dropdownFrame, anchor, nil, nil, "MENU")
end
end -- do
-- Option management
local function GetOptions()
local options = {
name = ATG_icon .. " " .. ATG_display_name,
childGroups = "tab",
type = "group",
order = 1,
args = {
display = {
type = 'group', name = L["Display"], desc = L["Specify what to display"], args = {
main = {
type = 'header',
name = L["Main Settings"],
order = 1,
},
show_coins = {
name = L["Show Gold"],
desc = L["Display the gold each character pocess"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_coins') end,
set = function(info, v) AlltheGold:SetOption('show_coins',v) end,
order = 1.1,
},
use_icons = {
name = L["Use Icons"],
desc = L["Use graphics for coin and PvP currencies"],
type = 'toggle',
get = function() return AlltheGold:GetOption('use_icons') end,
set = function(info, v) AlltheGold:SetOption('use_icons',v) end,
order = 1.2,
},
show_class_name = {
name = L["Show Class Name"],
desc = L["Show the character class beside the level"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_class_name') end,
set = function(info, v) AlltheGold:SetOption('show_class_name',v) end,
order = 1.3,
},
colorize_class = {
name = L["Colorize Class"],
desc = L["Colorize the character name based on class"],
type = 'toggle',
get = function() return AlltheGold:GetOption('colorize_class') end,
set = function(info, v) AlltheGold:SetOption('colorize_class',v) end,
order = 1.4,
},
show_ilevel = {
name = L["Show Item Level"],
desc = L["Show the character item level (iLevel)"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_ilevel') end,
set = function(info, v) AlltheGold:SetOption('show_ilevel',v) end,
order = 1.5,
},
show_guild = {
name = L["Show Guild Name"],
desc = L["Show the character guild name"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_guild') end,
set = function(info, v) AlltheGold:SetOption('show_guild',v) end,
order = 1.55,
},
use_pre_210_shaman_colour = {
name = L["Use Old Shaman Colour"],
desc = L["Use the pre-210 patch colour for the Shaman class"],
type = 'toggle',
get = function() return AlltheGold:GetOption('use_pre_210_shaman_colour') end,
set = function(info, v) AlltheGold:SetOption('use_pre_210_shaman_colour',v) end,
order = 1.6,
},
show_location = {
name = L["Show Location"],
desc = L["Show the character location"],
width = "full",
type = 'select',
get = function() return AlltheGold:GetOption('show_location') end,
set = function(info, v) AlltheGold:SetOption('show_location',v) end,
values = { ["none"] = L["Don't show location"],
["loc"] = L["Show zone"],
["sub"] = L["Show subzone"],
["loc/sub"] = L["Show zone/subzone"]
},
order = 1.7,
},
valor = {
type = 'header',
name = (L["%s (%s)"]):format(L["Valor Points"],valor_icon),
order = 1.8,
},
show_valor_points = {
name = (L["Show %s"]):format(L["Valor Points"]),
desc = (L["Display the %s each character pocess"]):format(L["Valor Points"]),
type = 'toggle',
get = function() return AlltheGold:GetOption('show_valor_points') end,
set = function(info, v) AlltheGold:SetOption('show_valor_points',v) end,
order = 1.81,
},
show_valor_total = {
name = (L["Show %s total"]):format(L["Valor Points"]),
desc = (L["Show the total %s for all characters"]):format(L["Valor Points"]),
type = 'toggle',
get = function() return AlltheGold:GetOption('show_valor_total') end,
set = function(info, v) AlltheGold:SetOption('show_valor_total',v) end,
order = 1.82,
},
justice = {
type = 'header',
name = (L["%s (%s)"]):format(L["Justice Points"],justice_icon),
order = 1.9,
},
show_justice_points = {
name = (L["Show %s"]):format(L["Justice Points"]),
desc = (L["Display the %s each character pocess"]):format(L["Justice Points"]),
type = 'toggle',
get = function() return AlltheGold:GetOption('show_justice_points') end,
set = function(info, v) AlltheGold:SetOption('show_justice_points',v) end,
order = 1.91,
},
show_justice_total = {
name = (L["Show %s total"]):format(L["Justice Points"]),
desc = (L["Show the total %s for all characters"]):format(L["Justice Points"]),
type = 'toggle',
get = function() return AlltheGold:GetOption('show_justice_total') end,
set = function(info, v) AlltheGold:SetOption('show_justice_total',v) end,
order = 1.92,
},
faction_and_realms = {
type = 'header',
name = L["Factions and Realms"],
order = 2,
},
all_factions = {
name = L["All Factions"],
desc = L["All factions will be displayed"],
type = 'toggle',
get = function() return AlltheGold:GetOption('all_factions') end,
set = function(info, v) AlltheGold:SetOption('all_factions',v) end,
order = 2.1,
},
all_realms = {
name = L["All Realms"],
desc = L["All realms will de displayed"],
type = 'toggle',
get = function() return AlltheGold:GetOption('all_realms') end,
set = function(info, v) AlltheGold:SetOption('all_realms',v) end,
order = 2.2,
},
time = {
type = 'header',
name = L["Time Played"],
order = 3,
},
show_played_time = {
name = L["Show Played Time"],
desc = L["Display the total time played per character"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_played_time') end,
set = function(info, v) AlltheGold:SetOption('show_played_time',v) end,
order = 3.1,
},
show_last_login = {
name = L["Show Last Loggin"],
desc = L["Display the elapsed time since the character was last logged in"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_last_login') end,
set = function(info, v) AlltheGold:SetOption('show_last_login',v) end,
order = 3.2,
},
show_seconds = {
name = L["Show Seconds"],
desc = L["Display the seconds in the time strings"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_seconds') end,
set = function(info, v) AlltheGold:SetOption('show_seconds',v) end,
order = 3.3,
},
xp = {
type = 'header',
name = L["Experience Points"],
order = 5,
},
show_progress = {
name = L["Show XP Progress"],
desc = L["Display XP progress as a decimal value appended to the level"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_progress') end,
set = function(info, v) AlltheGold:SetOption('show_progress',v) end,
order = 5.1,
},
show_xp_total = {
name = L["Show XP total"],
desc = L["Show the total XP for all characters"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_xp_total') end,
set = function(info, v) AlltheGold:SetOption('show_xp_total',v) end,
order = 5.2,
},
show_lvl_totals = {
name = L["Show level total"],
desc = L["Show the total levels for all characters"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_lvl_totals') end,
set = function(info, v) AlltheGold:SetOption('show_lvl_totals',v) end,
order = 5.25,
},
show_rested_xp = {
name = L["Rested XP Total"],
desc = L["Show the character rested XP"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_rested_xp') end,
set = function(info, v) AlltheGold:SetOption('show_rested_xp',v) end,
order = 5.3,
},
show_rested_xp_countdown = {
name = L["Rested XP Countdown"],
desc = L["Show the time remaining before the character is 100% rested"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_rested_xp_countdown') end,
set = function(info, v) AlltheGold:SetOption('show_rested_xp_countdown',v) end,
order = 5.4,
},
percent_rest = {
name = L["Percent Rest"],
desc = L["Set the base for % display of rested XP"],
type = 'select',
get = function() return AlltheGold:GetOption('percent_rest') end,
set = function(info, v) AlltheGold:SetOption('percent_rest',v) end,
values = { ["0"] = L["Do not show Percent Rest"], ["100"] = L["100%"], ["150"] = L["150%"] },
order = 5.5,
},
sort = {
type = 'header',
name = L["Sort Order"],
order = 9,
},
sort_type = {
name = L["Sort Type"],
desc = L["Select the sort type"],
type = 'select',
get = function() return AlltheGold:GetOption('sort_type') end,
set = function(info, v) AlltheGold:SetOption('sort_type',v) end,
values = {
["alpha"] = L["By name"],
["level"] = L["By level"],
["ilevel"] = L["By item level"],
["xp"] = L["By experience"],
["rested_xp"] = L["By rested XP"],
["percent_rest"] = L["By % rested"],
["coin"] = L["By money"],
["time_played"] = L["By time played"],
},
order = 9.1,
},
reverse_sort = {
name = L["Sort in reverse order"],
desc = L["Use the curent sort type in reverse order"],
type = 'toggle',
get = function() return AlltheGold:GetOption('reverse_sort') end,
set = function(info, v) AlltheGold:SetOption('reverse_sort',v) end,
order = 9.2,
},
pvp = {
type = 'header',
name = L["PVP"],
desc = L["Set the PVP options"],
order = 11,
},
show_honor_kills= {
name = L["Honor Kills"],
name = (L["%s (%s)"]):format(L["Honor Kills"], kill_icon),
desc = L["Show the character honor kills"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_honor_kills') end,
set = function(info, v) AlltheGold:SetOption('show_honor_kills',v) end,
order = 11.1,
},
show_honor_points = {
name = (L["%s (%s or %s)"]):format(L["Honor Points"], honor_alliance_icon, honor_horde_icon),
desc = (L['Display the %s each character pocess']):format(L["Honor Points"]),
type = 'toggle',
get = function() return AlltheGold:GetOption('show_honor_points') end,
set = function(info, v) AlltheGold:SetOption('show_honor_points',v) end,
order = 11.2,
},
show_conquest_points = {
name = (L["%s (%s or %s)"]):format(L["Conquest Pts"], conquest_alliance_icon, conquest_horde_icon),
desc = (L['Display the %s each character pocess']):format(L["Conquest Points"]),
type = 'toggle',
get = function() return AlltheGold:GetOption('show_conquest_points') end,
set = function(info, v) AlltheGold:SetOption('show_conquest_points',v) end,
order = 11.3,
},
show_pvp_totals = {
name = L["Show PVP Totals"],
desc = L["Show the honor related stats for all characters"],
type = 'toggle',
get = function() return AlltheGold:GetOption('show_pvp_totals') end,
set = function(info, v) AlltheGold:SetOption('show_pvp_totals',v) end,
order = 11.4,
},
}, order = 10,
},
ignore = {
name = L["Ignore Characters"],
desc = L["Hide characters from display"],
type = 'group',
args = {
ignore_desc = {
name = L["Hide characters from display"],
type = 'description',
order = .5,
},
ignore_desc2 = {
name = " ",
type = 'description',
order = .7,
},
},
order = 20
},
delete = {
name = L["Delete Characters"],
desc = L["Erase character data permanantely"],
type = 'group',
args = {
delete_desc = {
name = L["Erase character data permanantely"],
type = 'description',
order = .5,
},
delete_desc2 = {
name = " ",
type = 'description',
order = .7,
},
},
order = 25
},
ui = {
type = 'group', name = L["UI"], desc = L["Set UI options"], args = {
show_minimap_icon = {
name = L["Minimap Icon"],
desc = L["Show Minimap Icon"],
width = "full",
type = 'toggle',
get = function() return AlltheGold:GetOption('show_minimap_icon') end,
set = function(info, v) AlltheGold:SetOption('show_minimap_icon',v) end,
order = .5,
},
tooltip_scale = {
name = L["Scale"],
desc = L["Scale the tooltip (70% to 150%)"],
width = "full",
type = 'range',
min = .7,
max = 1.5,
step = .05,
isPercent = true,
get = function() return AlltheGold:GetOption('tooltip_scale') end,
set = function(info, v) AlltheGold:SetOption('tooltip_scale',v) end,
order = .6,
},
opacity = {
name = L["Opacity"],
desc = L["% opacity of the tooltip background"],
width = "full",
type = 'range',
min = 0,
max = 1,
step = .05,
isPercent = true,
get = function() return AlltheGold:GetOption('opacity') end,
set = function(info, v) AlltheGold:SetOption('opacity',v) end,
order = .7,
},
tooltip_delay = {
name = L["Display Delay"],
desc = L["How long should the tooltip be displayed after the mouse is moved out."],
width = "full",
type = 'range',
min = 0,
max = 1.5,
step = .05,
isPercent = false,
get = function() return AlltheGold:GetOption('tooltip_delay') end,
set = function(info, v) AlltheGold:SetOption('tooltip_delay',v) end,
order = .8,
},
tooltip_keep_on_mouseover = {
name = L["Sticky Tooltip"],
desc = L["Keep displaying the tooltip when the mouse is over it. If uncheck, the tooltip is displayed only when mousing over the icon."],
width = "full",
type = 'toggle',
get = function() return AlltheGold:GetOption('tooltip_keep_on_mouseover') end,
set = function(info, v) AlltheGold:SetOption('tooltip_keep_on_mouseover',v) end,
order = .9,
},
}, order = 30,
},
},
}
-- Remove deprecated options
-- Deal with the deprecated values
if not AlltheGold:GetOption('show_deprecated') then
options.args.display.args.valor = nil
options.args.display.args.show_valor_points = nil
options.args.display.args.show_valor_total = nil
options.args.display.args.justice = nil
options.args.display.args.show_justice_points = nil
options.args.display.args.show_justice_total = nil
options.args.display.args.pvp = nil
options.args.display.args.show_honor_kills = nil
options.args.display.args.show_honor_points = nil
options.args.display.args.show_conquest_points = nil
options.args.display.args.show_pvp_totals = nil
end
-- Ignore section
local faction_order = 1
for faction, faction_table in pairs(ATG.db.global.data) do
local faction_id = "faction" .. faction_order
options.args.ignore.args[faction_id] = {
type = 'group',
name = faction,
args = {},
}
faction_order = faction_order + 1
local realm_order = 1
for realm, realm_table in pairs(faction_table) do
local realm_id = "realm" .. realm_order
options.args.ignore.args[faction_id].args[realm_id] = {
type = 'group',
name = realm,
args = {},
}
local pc_order = 1
for pc, _ in pairs(realm_table) do
local pc_id = "pc" .. pc_order
options.args.ignore.args[faction_id].args[realm_id].args[pc_id] = {
name = pc,
desc = (L["Hide %s of %s from display"]):format(pc, realm),
type = 'toggle',
get = function() return AlltheGold:GetOption('is_ignored',realm, pc) end,
set = function(info, value) AlltheGold:SetOption('is_ignored', value, realm, pc) end
}
pc_order = pc_order + 1
end
realm_order = realm_order + 1
end
end
-- Delete section
faction_order = 1
for faction, faction_table in pairs(ATG.db.global.data) do
local faction_id = "faction" .. faction_order
options.args.delete.args[faction_id] = {
type = 'group',
name = faction,
args = {},
}
faction_order = faction_order + 1
local realm_order = 1
for realm, realm_table in pairs(faction_table) do
local realm_id = "realm" .. realm_order
options.args.delete.args[faction_id].args[realm_id] = {
type = 'group',
name = realm,
args = {},
}
local pc_order = 1
for pc, _ in pairs(realm_table) do
-- Skip the current toon
if pc ~= _G.UnitName("player") or realm ~= _G.GetRealmName() then
local pc_id = "pc" .. pc_order
options.args.delete.args[faction_id].args[realm_id].args[pc_id] = {
name = pc,
desc = (L["Erase data for %s of %s"]):format(pc, realm),
type = 'execute',
icon = [[Interface\GossipFrame\Unlearngossipicon]],
func = function(info)
_G.ericinfo = info
local dialog = _G.StaticPopupDialogs.AlltheGold_CONFIRM_DELETE
dialog.text = (L.DELETE_WARNING):format(pc, realm, pc, realm)
dialog.OnAccept = function()
AlltheGold:Print(L["Erasing data for %s of %s"], pc, realm)
-- Remove the options button
options.args.delete.args[faction_id].args[realm_id].args[pc_id] = nil
LibStub("AceConfigRegistry-3.0"):NotifyChange("AlltheGold")
-- Erase the character data
realm_table[pc] = nil
if not next(realm_table) then faction_table[realm] = nil end
if not next(faction_table) then ATG.db.global.data[faction] = nil end
-- Force addon refresh
AlltheGold.sort_tables_done = nil
AlltheGold:MyUpdate()
end
_G.StaticPopup_Show("AlltheGold_CONFIRM_DELETE")
end
}
pc_order = pc_order + 1
end
end