-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.lua
2000 lines (1925 loc) · 63 KB
/
core.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 addonName, adherent = ...
local addon = LibStub("AceAddon-3.0"):NewAddon(adherent, addonName, "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceBucket-3.0", "AceComm-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale(addonName)
local AC = LibStub("AceConfig-3.0")
local ACD = LibStub("AceConfigDialog-3.0")
local ADBO = LibStub("AceDBOptions-3.0")
local LDB = LibStub("LibDataBroker-1.1"):NewDataObject(addonName)
local LDI = LibStub("LibDBIcon-1.0")
local C = LibStub("LibCrayon-3.0")
local DF = LibStub("LibDeformat-3.0")
local T = LibStub("LibQTip-1.0")
adherent._DEBUG = false
local _,_,_,tocNum = GetBuildInfo()
tocNum = tonumber(tocNum)
adherent._wrath = tocNum < 40000 and tocNum > 30000 -- temp until we get a wrath project id
adherent._classic = _G.WOW_PROJECT_ID and (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC) or false
adherent._bcc = _G.WOW_PROJECT_ID and (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC) or false
adherent._bcc = adherent._bcc and not adherent._wrath -- temp until we get a wrath project id
adherent._playerName = GetUnitName("player")
adherent._playerFullName = adherent._playerName
local label = string.format("|cff33ff99%s|r",addonName)
local out_chat = string.format("%s: %%s",addonName)
local special_frames = {}
local alreadyPinged, alreadyPonged, pongReceived = {}, {}, {}
local InviteToGroup = _G.InviteToGroup or C_PartyInfo.InviteUnit
local CanGroupInvite = _G.CanGroupInvite or C_PartyInfo.CanInvite
local ConvertToRaid = _G.ConvertToRaid or C_PartyInfo.ConvertToRaid
local GuildRoster = _G.GuildRoster or C_GuildInfo.GuildRoster
local COMM_PREFIX = format("%s_PFX",addonName)
local default_keywords = {
follow = {"!fme"},
followstop = {"!fno"},
groupsend = {"!invme"},
}
local default_emotes = {
follow = {L[EMOTE163_TOKEN], L[EMOTE7_TOKEN]}, -- /followme /beckon
followstop = {L[EMOTE164_TOKEN], L[EMOTE130_TOKEN]}, -- /wait /shoo
groupsend = {L[EMOTE382_TOKEN], L[EMOTE112_TOKEN]}, -- /arm /cuddle
}
local defaults = {
profile = {
guild = {},
adherents = {},
},
char = {
suspend = false,
echo = false,
inform = true,
tooltip = true,
notbusy = false,
notinstance = false,
notcombat = false,
friends = {},
follow = {
friend = true,
guild = true,
group = false,
all = false,
whostarted = false,
blacklist = {},
whitelist = {},
keywords = {
follow = {},
followstop = {},
},
customonly = false,
chat = {
RAID_LEADER = true,
RAID = true,
PARTY_LEADER = true,
PARTY = true,
SAY = false,
WHISPER = true,
},
TEXT_EMOTE = true,
},
groupjoin = {
friend = true,
guild = true,
all = false,
blacklist = {},
whitelist = {},
},
groupsend = {
friend = true,
guild = true,
autoraid = false,
blacklist = {},
whitelist = {},
keywords = {},
customonly = false,
chat = {
SAY = false,
WHISPER = true,
},
TEXT_EMOTE = true,
},
minimap = {
hide = true,
},
},
}
local cmd = {
type = "group", handler = adherent, args =
{
toggle = {
type = "execute",
name = L["Toggle"],
func = function()
if adherent:IsEnabled() then
adherent:Disable()
else
adherent:Enable()
adherent.db.char.suspend = false
end
end,
order = 1,
},
options = {
type = "execute",
name = _G.OPTIONS,
func = function()
adherent:showOptions()
end,
order = 2,
},
known = {
type = "input",
name = L["Known"],
desc = L["Print discovered Adherents.\nUse a partial name to limit results"],
get = function() end,
set = function(info, val)
local filter = val and #(val:gsub("%s",""))>0 and val or ".+"
for k,v in pairs(adherent.db.profile.adherents) do
if k:find(filter) then
adherent:debugPrint(format("%s v%s",k,v))
end
end
end,
order = 3,
},
greet = {
type = "input",
name = L["Greet"],
desc = L["Send a backchannel greeting to a player to discover if they have an Adherent"],
get = function() end,
set = function(info, val)
local name = adherent:GetSlashCmdTarget(val)
if name and adherent:validName(info, name) then
adherent:ping(name)
end
end,
}
}
}
function adherent:options()
if not (self._options) then
self._options =
{
type = "group",
handler = adherent,
args = {
general = {
type = "group",
name = _G.OPTIONS,
childGroups = "tab",
args = {
settings = {
type = "group",
name = _G.SETTINGS,
order = 1,
args = { },
},
acceptfollow = {
type = "group",
name = _G.FOLLOW,
desc = L["Auto follow Options"],
order = 3,
args = {
what = {
type = "group",
name = format(L["Keywords monitored by %s"],addonName),
inline = true,
order = 1,
args = { },
},
where = {
type = "group",
name = format(L["%s will listen to"],addonName),
inline = true,
order = 2,
args = { },
},
who = {
type = "group",
name = format(L["Who can command %s?"],addonName),
inline = true,
order = 3,
args = { },
},
},
},
acceptgroup = {
type = "group",
name = _G.GROUP,
desc = L["Auto group Join Options"],
order = 4,
args = {
who = {
type = "group",
name = L["Auto accept Group Invites from"],
inline = true,
order = 1,
args = { },
},
},
},
sendgroup = {
type = "group",
name = L["Group Invite"],
desc = L["Auto group Invite Options"],
order = 5,
args = {
what = {
type = "group",
name = format(L["Keywords monitored by %s"],addonName),
inline = true,
order = 1,
args = { },
},
where = {
type = "group",
name = format(L["%s will listen to"],addonName),
inline = true,
order = 2,
args = { },
},
who = {
type = "group",
name = format(L["Who can command %s?"],addonName),
inline = true,
order = 3,
args = { },
},
},
},
}
}
}
}
self._options.args.general.args.settings.args["title"] = {
type = "header",
name = _G.HELP_LABEL,
order = 1,
}
self._options.args.general.args.settings.args["usage"] = {
type = "description",
fontSize = "medium",
image = function()
return LDB.icon or 666623 -- "Interface\\COMMON\\friendship-FistHuman"
end,
name = L.USAGE,
order = 5,
}
self._options.args.general.args.settings.args["separator0"] = {
type = "header",
name = "",
order = 6,
}
self._options.args.general.args.settings.args["suspend"] = {
type = "toggle",
name = format(L["Suspend %s"], addonName),
desc = format(L["Suspend %s"], addonName),
order = 10,
get = function() return adherent.db.char.suspend end,
set = function(info, val)
adherent.db.char.suspend = val
if adherent.db.char.suspend then
adherent:Disable()
else
adherent:Enable()
end
end,
}
self._options.args.general.args.settings.args["notcombat"] = {
type = "toggle",
name = L["Not in Combat"],
desc = format(L["%s will not automate when you are in Combat"], addonName),
order = 11,
get = function() return adherent.db.char.notcombat end,
set = function(info, val)
adherent.db.char.notcombat = val
end,
}
self._options.args.general.args.settings.args["notinstance"] = {
type = "toggle",
name = L["Not in Instances"],
desc = format(L["%s will not automate when you are in a PvE Instance"], addonName),
order = 12,
get = function() return adherent.db.char.notinstance end,
set = function(info, val)
adherent.db.char.notinstance = val
end,
}
self._options.args.general.args.settings.args["notbusy"] = {
type = "toggle",
name = L["Not when busy"],
desc = format(L["%s will not interrupt Trade/Mail/Auction/Bank/Professions/Queues"], addonName),
order = 13,
get = function() return adherent.db.char.notbusy end,
set = function(info, val)
adherent.db.char.notbusy = val
end,
}
self._options.args.general.args.settings.args["echo"] = {
type = "toggle",
name = format(L["Echo %s actions"], addonName),
desc = format(L["Print %s actions to your chatframe"], addonName),
order = 14,
get = function() return adherent.db.char.echo end,
set = function(info, val)
adherent.db.char.echo = val
end,
}
self._options.args.general.args.settings.args["inform"] = {
type = "toggle",
name = L["Inform Initiator"],
desc = L["Send a tell to action initiator when accepting or declining"],
order = 15,
get = function() return adherent.db.char.inform end,
set = function(info, val)
adherent.db.char.inform = val
end,
}
self._options.args.general.args.settings.args["tooltip"] = {
type = "toggle",
name = L["Player Tooltip Hint"],
desc = format(L["Indicate known %s in player tooltips with an icon after their Name|T%s:15|t"], addonName, (LDB.icon or 666623)),
order = 16,
get = function() return adherent.db.char.tooltip end,
set = function(info, val)
adherent.db.char.tooltip = val
adherent:tooltipHook()
end,
}
self._options.args.general.args.settings.args["minimap"] = {
type = "toggle",
name = L["Hide from Minimap"],
desc = L["Hide addon Minimap Button."],
order = 17,
get = function() return adherent.db.char.minimap.hide end,
set = function(info, val)
adherent.db.char.minimap.hide = val
if adherent.db.char.minimap.hide then
LDI:Hide(addonName)
else
LDI:Show(addonName)
end
end
}
self._options.args.general.args.settings.args["defaults"] = {
type = "execute",
name = _G.RESET_TO_DEFAULT,
desc = L["|T357854:16|tWarning!|T357854:16|t\nThis action will wipe ALL addon data."],
func = "resetToDefaults",
order = 20,
}
local acceptfollow_args = self._options.args.general.args.acceptfollow.args
acceptfollow_args.what.args["desckeywords"] = {
type = "description",
name = function()
local custom_start = table.concat(adherent:table_val_array(adherent.db.char.follow.keywords.follow),", ")
local custom_stop = table.concat(adherent:table_val_array(adherent.db.char.follow.keywords.followstop),", ")
if #custom_start > 0 then
custom_start = format(", |cffffff00%s|r",custom_start)
else
custom_start = ""
end
if #custom_stop > 0 then
custom_stop = format(", |cffffff00%s|r",custom_stop)
else
custom_stop = ""
end
return format(L.DEFAULT_KEYWORDS,custom_start,custom_stop)
end,
width = "full",
order = 1,
}
acceptfollow_args.what.args["separator1"] = {
type = "header",
name = "",
order = 2,
}
acceptfollow_args.what.args["customonly"] = {
type = "toggle",
name = L["Only Custom"],
desc = L["Only react to |cffffff00custom|r keywords (ignore |cffdcdcdcdefaults|r)"],
order = 3,
get = function(info, val)
return adherent.db.char.follow.customonly
end,
set = function(info, val)
adherent.db.char.follow.customonly = val
end,
}
acceptfollow_args.what.args["kwstartadd"] = {
type = "input",
name = L["Follow Keywords"],
desc = L["Save custom keywords for auto Follow."],
order = 5,
get = function(info) return "" end,
set = function(info, val)
if not adherent.db.char.follow.keywords.follow[val] then
adherent.db.char.follow.keywords.follow[val] = val
end
adherent:optionsKWHash()
end,
validate = function(info, val)
-- check that it contains at least one control character
return true
end,
}
acceptfollow_args.what.args["kwstartrem"] = {
type = "select",
name = L["Remove Keyword"],
desc = L["Remove keywords from Custom Keywords"],
order = 10,
set = function(info, val)
if adherent.db.char.follow.keywords.follow[val] then
adherent.db.char.follow.keywords.follow[val] = nil
end
adherent:optionsKWHash()
end,
values = function(info)
return adherent.db.char.follow.keywords.follow
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.follow.keywords.follow) == 0
end,
}
acceptfollow_args.what.args["kwstopadd"] = {
type = "input",
name = L["Stop Keywords"],
desc = L["Save custom keywords for stopping Follow."],
order = 15,
get = function(info) return "" end,
set = function(info, val)
if not adherent.db.char.follow.keywords.followstop[val] then
adherent.db.char.follow.keywords.followstop[val] = val
end
adherent:optionsKWHash()
end,
validate = function(info, val)
-- check that it contains at least one control character
return true
end,
}
acceptfollow_args.what.args["kwstoprem"] = {
type = "select",
name = L["Remove Keyword"],
desc = L["Remove keywords from Custom Keywords"],
order = 20,
set = function(info, val)
if adherent.db.char.follow.keywords.followstop[val] then
adherent.db.char.follow.keywords.followstop[val] = nil
end
adherent:optionsKWHash()
end,
values = function(info)
return adherent.db.char.follow.keywords.followstop
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.follow.keywords.followstop) == 0
end,
}
acceptfollow_args.who.args["followstop"] = {
type = "group",
name = L["Stop Follow"],
order = 1,
inline = false,
args = {
whostarteddesc = {
type = "description",
name = C:Silver(L.FOLLOWSTOP_DETAIL),
order = 1,
width = "full",
},
whostarted = {
type = "toggle",
name = L["Starter only"],
order = 2,
get = function(info, val)
return adherent.db.char.follow.whostarted
end,
set = function(info, val)
adherent.db.char.follow.whostarted = val
end
}
}
}
acceptfollow_args.who.args["friend"] = {
type = "toggle",
name = _G.FRIEND,
order = 5,
get = function(info, val)
return adherent.db.char.follow.friend
end,
set = function(info, val)
adherent.db.char.follow.friend = val
end,
}
acceptfollow_args.who.args["guild"] = {
type = "toggle",
name = _G.GUILD,
order = 10,
get = function(info, val)
return adherent.db.char.follow.guild
end,
set = function(info, val)
adherent.db.char.follow.guild = val
end,
}
acceptfollow_args.who.args["group"] = {
type = "toggle",
name = _G.GROUP,
order = 15,
get = function(info, val)
return adherent.db.char.follow.group
end,
set = function(info, val)
adherent.db.char.follow.group = val
end,
}
acceptfollow_args.who.args["all"] = {
type = "toggle",
name = L["Anyone"],
order = 20,
get = function(info, val)
return adherent.db.char.follow.all
end,
set = function(info, val)
adherent.db.char.follow.all = val
end,
}
acceptfollow_args.who.args["separator2"] = {
type = "header",
name = "",
order = 22,
}
acceptfollow_args.who.args["blacklistadd"] = {
type = "input",
name = L["Add to Blacklist"],
desc = format(L["Names of players you never want to permit control of %s.\nSupercedes other options."],addonName),
order = 25,
get = function(info) return "" end,
set = function(info, val)
if val~="" then
adherent:blacklist(val,"follow","+")
end
end,
validate = "validName",
}
acceptfollow_args.who.args["blacklistrem"] = {
type = "select",
name = L["Remove from Blacklist"],
desc = L["Remove a player from Blacklist."],
order = 30,
set = function(info, val)
if val~="" then
adherent:blacklist(val,"follow","-")
end
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.follow.blacklist) == 0
end,
values = function(info)
return adherent.db.char.follow.blacklist
end,
}
acceptfollow_args.who.args["blacklistcopy"] = {
type = "select",
name = L["Copy from another Blacklist"],
desc = L["Copies the contents from another Blacklist\n|cffff0000Warning|r: Current contents will be overwritten!"],
order = 35,
set = function(info, val)
adherent.db.char.follow.blacklist = CopyTable(adherent.db.char[val].blacklist,true)
end,
values = { groupjoin = _G.GROUP, groupsend = L["Group Invite"] },
}
acceptfollow_args.who.args["whitelistadd"] = {
type = "input",
name = L["Add to Whitelist"],
desc = L["Names of players you always want to permit control.\nSupercedes other options except Blacklist."],
order = 40,
get = function(info) return "" end,
set = function(info, val)
if val~="" then
adherent:whitelist(val,"follow","+")
end
end,
validate = "validName",
}
acceptfollow_args.who.args["whitelistrem"] = {
type = "select",
name = L["Remove from Whitelist"],
desc = L["Remove a player from Whitelist."],
order = 45,
set = function(info, val)
if val~="" then
adherent:whitelist(val,"follow","-")
end
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.follow.whitelist) == 0
end,
values = function(info)
return adherent.db.char.follow.whitelist
end,
}
acceptfollow_args.who.args["whitelistcopy"] = {
type = "select",
name = L["Copy from another Whitelist"],
desc = L["Copies the contents from another Whitelist\n|cffff0000Warning|r: Current contents will be overwritten!"],
order = 47,
set = function(info, val)
adherent.db.char.follow.whitelist = CopyTable(adherent.db.char[val].whitelist,true)
end,
values = { groupjoin = _G.GROUP, groupsend = L["Group Invite"] },
}
acceptfollow_args.where.args["emote"] = {
type = "toggle",
name = _G.EMOTE,
desc = L["React to Emotes."],
order = 1,
get = function(info, val)
return adherent.db.char.follow.TEXT_EMOTE
end,
set = function(info, val)
adherent.db.char.follow.TEXT_EMOTE = val
end,
}
acceptfollow_args.where.args["descemotes"] = {
type = "description",
name = format(L.DEFAULT_EMOTES,string.lower(_G.EMOTE163_TOKEN),string.lower(_G.EMOTE7_TOKEN),string.lower(_G.EMOTE164_TOKEN),string.lower(_G.EMOTE130_TOKEN)),
width = "double",
order = 5,
}
acceptfollow_args.where.args["chat"] = {
type = "multiselect",
dialogControl = "Dropdown",
name = L["Keywords in Chat"],
desc = format(L["Which channels should %s monitor?"],addonName),
order = 10,
get = function(info, key)
return adherent.db.char.follow.chat[key]
end,
set = function(info, key, val)
adherent.db.char.follow.chat[key] = val
if key == "PARTY" or key == "RAID" then
adherent.db.char.follow.chat[key.."_LEADER"] = val
end
end,
values = {
PARTY = _G.PARTY,
RAID = _G.RAID,
SAY = _G.SAY,
WHISPER = _G.WHISPER,
},
}
local acceptgroup_args = self._options.args.general.args.acceptgroup.args
acceptgroup_args.who.args["friend"] = {
type = "toggle",
name = _G.FRIEND,
order = 5,
get = function(info, val)
return adherent.db.char.groupjoin.friend
end,
set = function(info, val)
adherent.db.char.groupjoin.friend = val
end,
}
acceptgroup_args.who.args["guild"] = {
type = "toggle",
name = _G.GUILD,
order = 10,
get = function(info, val)
return adherent.db.char.groupjoin.guild
end,
set = function(info, val)
adherent.db.char.groupjoin.guild = val
end,
}
acceptgroup_args.who.args["all"] = {
type = "toggle",
name = L["Anyone"],
order = 20,
get = function(info, val)
return adherent.db.char.groupjoin.all
end,
set = function(info, val)
adherent.db.char.groupjoin.all = val
end,
}
acceptgroup_args.who.args["separator2"] = {
type = "header",
name = "",
order = 22,
}
acceptgroup_args.who.args["blacklistadd"] = {
type = "input",
name = L["Add to Blacklist"],
desc = format(L["Names of players you never want to permit control of %s.\nSupercedes other options."],addonName),
order = 25,
get = function(info) return "" end,
set = function(info, val)
if val~="" then
adherent:blacklist(val,"groupjoin","+")
end
end,
validate = "validName",
}
acceptgroup_args.who.args["blacklistrem"] = {
type = "select",
name = L["Remove from Blacklist"],
desc = L["Remove a player from Blacklist."],
order = 30,
set = function(info, val)
if val~="" then
adherent:blacklist(val,"groupjoin","-")
end
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.groupjoin.blacklist) == 0
end,
values = function(info)
return adherent.db.char.groupjoin.blacklist
end,
}
acceptgroup_args.who.args["blacklistcopy"] = {
type = "select",
name = L["Copy from another Blacklist"],
desc = L["Copies the contents from another Blacklist\n|cffff0000Warning|r: Current contents will be overwritten!"],
order = 35,
set = function(info, val)
adherent.db.char.groupjoin.blacklist = CopyTable(adherent.db.char[val].blacklist,true)
end,
values = { follow = _G.FOLLOW, groupsend = L["Group Invite"] },
}
acceptgroup_args.who.args["whitelistadd"] = {
type = "input",
name = L["Add to Whitelist"],
desc = L["Names of players you always want to permit control.\nSupercedes other options except Blacklist."],
order = 40,
get = function(info) return "" end,
set = function(info, val)
if val~="" then
adherent:whitelist(val,"groupjoin","+")
end
end,
validate = "validName",
}
acceptgroup_args.who.args["whitelistrem"] = {
type = "select",
name = L["Remove from Whitelist"],
desc = L["Remove a player from Whitelist."],
order = 45,
set = function(info, val)
if val~="" then
adherent:whitelist(val,"groupjoin","-")
end
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.groupjoin.whitelist) == 0
end,
values = function(info)
return adherent.db.char.groupjoin.whitelist
end,
}
acceptgroup_args.who.args["whitelistcopy"] = {
type = "select",
name = L["Copy from another Whitelist"],
desc = L["Copies the contents from another Whitelist\n|cffff0000Warning|r: Current contents will be overwritten!"],
order = 47,
set = function(info, val)
adherent.db.char.follow.whitelist = CopyTable(adherent.db.char[val].whitelist,true)
end,
values = { follow = _G.FOLLOW, groupsend = L["Group Invite"] },
}
local sendgroup_args = self._options.args.general.args.sendgroup.args
sendgroup_args.what.args["desckeywords"] = {
type = "description",
name = function()
local custom_send = table.concat(adherent:table_val_array(adherent.db.char.groupsend.keywords),", ")
if #custom_send > 0 then
custom_send = format(", |cffffff00%s|r",custom_send)
else
custom_send = ""
end
return format(L.DEFAULT_KEYWORDS_GROUP,custom_send)
end,
width = "full",
order = 1,
}
sendgroup_args.what.args["separator1"] = {
type = "header",
name = "",
order = 2,
}
sendgroup_args.what.args["customonly"] = {
type = "toggle",
name = L["Only Custom"],
desc = L["Only react to |cffffff00custom|r keywords (ignore |cffdcdcdcdefaults|r)"],
order = 3,
get = function(info, val)
return adherent.db.char.groupsend.customonly
end,
set = function(info, val)
adherent.db.char.groupsend.customonly = val
end,
}
sendgroup_args.what.args["kwstartadd"] = {
type = "input",
name = L["Send Group Invite Keywords"],
desc = L["Save custom keywords for auto Group Invite."],
order = 5,
get = function(info) return "" end,
set = function(info, val)
if not adherent.db.char.groupsend.keywords[val] then
adherent.db.char.groupsend.keywords[val] = val
end
adherent:optionsKWHash()
end,
validate = function(info, val)
-- check that it contains at least one control character
return true
end,
}
sendgroup_args.what.args["kwstartrem"] = {
type = "select",
name = L["Remove Keyword"],
desc = L["Remove keywords from Custom Keywords"],
order = 10,
set = function(info, val)
if adherent.db.char.groupsend.keywords[val] then
adherent.db.char.groupsend.keywords[val] = nil
end
adherent:optionsKWHash()
end,
values = function(info)
return adherent.db.char.groupsend.keywords
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.groupsend.keywords) == 0
end,
}
sendgroup_args.who.args["friend"] = {
type = "toggle",
name = _G.FRIEND,
order = 5,
get = function(info, val)
return adherent.db.char.groupsend.friend
end,
set = function(info, val)
adherent.db.char.groupsend.friend = val
end,
}
sendgroup_args.who.args["guild"] = {
type = "toggle",
name = _G.GUILD,
order = 10,
get = function(info, val)
return adherent.db.char.groupsend.guild
end,
set = function(info, val)
adherent.db.char.groupsend.guild = val
end,
}
sendgroup_args.who.args["separator2"] = {
type = "header",
name = "",
order = 22,
}
sendgroup_args.who.args["blacklistadd"] = {
type = "input",
name = L["Add to Blacklist"],
desc = format(L["Names of players you never want to permit control of %s.\nSupercedes other options."],addonName),
order = 25,
get = function(info) return "" end,
set = function(info, val)
if val~="" then
adherent:blacklist(val,"groupsend","+")
end
end,
validate = "validName",
}
sendgroup_args.who.args["blacklistrem"] = {
type = "select",
name = L["Remove from Blacklist"],
desc = L["Remove a player from Blacklist."],
order = 30,
set = function(info, val)
if val~="" then
adherent:blacklist(val,"groupsend","-")
end
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.groupsend.blacklist) == 0
end,
values = function(info)
return adherent.db.char.groupsend.blacklist
end,
}
sendgroup_args.who.args["blacklistcopy"] = {
type = "select",
name = L["Copy from another Blacklist"],
desc = L["Copies the contents from another Blacklist\n|cffff0000Warning|r: Current contents will be overwritten!"],
order = 35,
set = function(info, val)
adherent.db.char.groupsend.blacklist = CopyTable(adherent.db.char[val].blacklist,true)
end,
values = { follow = _G.FOLLOW, groupjoin = _G.GROUP },
}
sendgroup_args.who.args["whitelistadd"] = {
type = "input",
name = L["Add to Whitelist"],
desc = L["Names of players you always want to permit control.\nSupercedes other options except Blacklist."],
order = 40,
get = function(info) return "" end,
set = function(info, val)
if val~="" then
adherent:whitelist(val,"groupsend","+")
end
end,
validate = "validName",
}
sendgroup_args.who.args["whitelistrem"] = {
type = "select",
name = L["Remove from Whitelist"],
desc = L["Remove a player from Whitelist."],
order = 45,
set = function(info, val)
if val~="" then
adherent:whitelist(val,"groupsend","-")
end
end,
disabled = function(info)
return adherent:table_count(adherent.db.char.groupsend.whitelist) == 0
end,
values = function(info)
return adherent.db.char.groupsend.whitelist
end,
}
sendgroup_args.who.args["whitelistcopy"] = {
type = "select",
name = L["Copy from another Whitelist"],
desc = L["Copies the contents from another Whitelist\n|cffff0000Warning|r: Current contents will be overwritten!"],
order = 47,
set = function(info, val)
adherent.db.char.groupsend.whitelist = CopyTable(adherent.db.char[val].whitelist,true)
end,
values = { follow = _G.FOLLOW, groupjoin = _G.GROUP },
}
sendgroup_args.where.args["emote"] = {
type = "toggle",
name = _G.EMOTE,
desc = L["React to Emotes."],
order = 1,
get = function(info, val)
return adherent.db.char.groupsend.TEXT_EMOTE
end,
set = function(info, val)
adherent.db.char.groupsend.TEXT_EMOTE = val
end,
}
sendgroup_args.where.args["descemotes"] = {
type = "description",
name = format(L.DEFAULT_EMOTES_GROUP,string.lower(_G.EMOTE382_TOKEN),string.lower(_G.EMOTE112_TOKEN)),
width = "double",
order = 5,
}
sendgroup_args.where.args["chat"] = {
type = "multiselect",
dialogControl = "Dropdown",
name = L["Keywords in Chat"],
desc = format(L["Which channels should %s monitor?"],addonName),
order = 10,
get = function(info, key)
return adherent.db.char.groupsend.chat[key]
end,
set = function(info, key, val)
adherent.db.char.groupsend.chat[key] = val
end,
values = {
SAY = _G.SAY,
WHISPER = _G.WHISPER,