-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.lua
156 lines (151 loc) · 4.78 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
local
---@class string
addonName,
---@class ns
addon = ...
local L = addon.L
local ldbi = LibStub('LibDBIcon-1.0', true)
local function buildCheckbox(key, order)
return {
type = 'toggle',
name = L[key],
order = order or 0,
desc = L[key .. "Description"],
}
end
local function buildDropdown(label, opts, order)
return {
type = 'select',
name = label,
order = order or 0,
values = opts,
style = 'dropdown',
}
end
local function build()
---@type AceConfig.OptionsTable
local t = {
name = "Socialite",
type = 'group',
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) return addon:setDB(info[#info], value) end,
args = {
---@diagnostic disable-next-line: missing-fields
showMinimapIcon = {
type = 'toggle',
name = L['Show minimap button'],
desc = L['Show the Socialite minimap button'],
order = 0,
get = function(info) return not addon.db.minimap.hide end,
set = function(info, value)
local config = addon.db.minimap
config.hide = not value
addon:setDB("minimap", config)
ldbi:Refresh(addonName, config)
end,
},
---@diagnostic disable-next-line: missing-fields
showInAddonCompartment = {
type = 'toggle',
name = L.showInAddonCompartment,
desc = L.showInAddonCompartmentDescription,
order = 1,
set = function(info, value)
addon:setDB(info[#info], value)
if value then
ldbi:AddButtonToCompartment(addonName)
else
ldbi:RemoveButtonFromCompartment(addonName)
end
end,
},
DisableUsageText = buildCheckbox("DisableUsageText", 2),
battleNetFriends = {
type = "group",
name = L["Battle.net Friends"],
order = 10,
args = {
ShowRealID = buildCheckbox("ShowRealID", 11),
ShowRealIDBroadcasts = buildCheckbox("ShowRealIDBroadcasts", 12),
ShowRealIDFactions = buildCheckbox("ShowRealIDFactions", 13),
ShowRealIDNotes = buildCheckbox("ShowRealIDNotes", 14),
ShowRealIDApp = buildCheckbox("ShowRealIDApp", 15),
}
},
characterFriends = {
type = "group",
name = L["Character Friends"],
order = 20,
args = {
ShowFriends = buildCheckbox("ShowFriends", 21),
ShowFriendsNote = buildCheckbox("ShowFriendsNote", 22),
}
},
dataText = {
type = "group",
name = L["Data text"],
order = 25,
args = {
ShowLabel = buildCheckbox("ShowLabel", 3),
},
},
tooltip = {
type = "group",
name = L["Tooltip Settings"],
order = 30,
args = {
ShowStatus = buildDropdown(L.MENU_STATUS, {
icon = L.MENU_STATUS_ICON,
text = L.MENU_STATUS_TEXT,
none = L.MENU_STATUS_NONE,
}, 31),
TooltipInteraction = buildDropdown(L.MENU_INTERACTION, {
always = L.MENU_INTERACTION_ALWAYS,
outofcombat = L.MENU_INTERACTION_OOC,
never = L.MENU_INTERACTION_NEVER,
}, 32),
ShowGroupMembers = buildCheckbox("ShowGroupMembers", 33),
---@diagnostic disable-next-line: missing-fields
TooltipWidth = {
name = L["Tooltip Width"],
type = "range",
min = 0,
max = 1,
step = 0.1,
},
},
},
guild = {
type = 'group',
name = L['Guild Members'],
order = 40,
args = {
ShowGuild = buildCheckbox("ShowGuild", 41),
ShowGuildLabel = buildCheckbox("ShowGuildLabel", 42),
ShowGuildNote = buildCheckbox("ShowGuildNote", 43),
ShowGuildONote = buildCheckbox("ShowGuildONote", 44),
---@diagnostic disable-next-line: missing-fields
GuildSorting = {
type = 'header',
name = L["Guild Sorting"],
order = 46,
},
GuildSort = buildCheckbox("GuildSort", 47),
GuildSortKey = buildDropdown(L.MENU_GUILD_SORT, {
name = L.MENU_GUILD_SORT_NAME,
rank = L.MENU_GUILD_SORT_RANK,
class = L.MENU_GUILD_SORT_CLASS,
note = L.MENU_GUILD_SORT_NOTE,
level = L.MENU_GUILD_SORT_LEVEL,
zone = L.MENU_GUILD_SORT_ZONE,
}, 48),
GuildSortAscending = buildCheckbox("GuildSortAscending", 49),
},
},
},
}
return t
end
LibStub("AceConfig-3.0"):RegisterOptionsTable("Socialite", build)
addon.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, "Socialite")
LibStub("AceConsole-3.0"):RegisterChatCommand("socialite", function() Settings.OpenToCategory(addonName) end)