-
Notifications
You must be signed in to change notification settings - Fork 15
/
options.lua
289 lines (273 loc) · 6.94 KB
/
options.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
if select(2,UnitClass("player")) ~= "HUNTER" then return end
local Addon = select(1, ...)
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local SML = SML or LibStub:GetLibrary("LibSharedMedia-3.0")
local L = YaHT.L
function YaHT:CreateConfig()
local function get(info)
return YaHT.db.profile[info[#info]]
end
local function set(info, value)
YaHT.db.profile[info[#info]] = value
YaHT:ApplySettings()
end
local function getColor(info)
local db = YaHT.db.profile[info[#info]]
return db.r, db.g ,db.b, db.a
end
local function setColor(info, r, g, b, a)
local db = YaHT.db.profile[info[#info]]
db.r = r
db.g = g
db.b = b
db.a = a
YaHT:ApplySettings()
end
local MediaList = {}
local function getMediaData(info)
local mediaType = info[#(info)]
MediaList[mediaType] = MediaList[mediaType] or {}
for k in pairs(MediaList[mediaType]) do MediaList[mediaType][k] = nil end
for _, name in pairs(SML:List(mediaType) or {}) do
MediaList[mediaType][name] = name
end
return MediaList[mediaType]
end
local aceoptions = {
name = "Yet another Hunter Timer",
type = "group",
get = get,
set = set,
icon = "",
args = {
general = {
name = L["Overview"],
type = "group",
order = 1,
args = {
descriptiontext = {
name = "Yet another Hunter Timer by Aviana\nDonate: paypal.me/LunaUnitFrames\n".."Version: "..YaHT.version,
type = "description",
width = "full",
order = 1,
},
optionsheader = {
name = L["Options"],
type = "header",
order = 2,
},
lock = {
name = L["Lock"],
desc = L["Lock / Unlock the timer bar for drag."],
type = "toggle",
order = 3,
},
width = {
name = L["Width"],
desc = L["Set the width."],
width = "full",
type = "range",
order = 4,
min = 10,
max = 600,
step = 1,
},
height = {
name = L["Height"],
desc = L["Set the height."],
width = "full",
type = "range",
order = 5,
min = 5,
max = 50,
step = 1,
},
scale = {
name = L["Scale"],
desc = L["Set the scale."],
type = "range",
order = 6,
isPercent = true,
min = 0.1,
max = 3,
step = 0.1,
},
alpha = {
name = L["Alpha"],
desc = L["Set the alpha."],
type = "range",
order = 6.1,
isPercent = true,
min = 0.1,
max = 1,
step = 0.1,
},
malpha = {
name = L["Movement alpha"],
desc = L["Set the alpha while moving."],
type = "range",
order = 6.2,
isPercent = true,
min = 0.1,
max = 1,
step = 0.1,
},
barheader = {
name = L["Bar options"],
type = "header",
order = 7,
},
statusbar = {
order = 8,
type = "select",
name = L["Bar texture"],
dialogControl = "LSM30_Statusbar",
values = getMediaData,
},
timercolor = {
name = L["Timer Color"],
type = "color",
order = 9,
get = getColor,
set = setColor,
},
drawcolor = {
name = L["Draw Color"],
type = "color",
order = 10,
get = getColor,
set = setColor,
},
fill = {
name = L["Fill from middle"],
desc = L["Extend the bar from the middle outwards."],
type = "toggle",
order = 11,
},
backgroundheader = {
name = L["Background options"],
type = "header",
order = 12,
},
enablebackground = {
name = L["Background"],
desc = L["Show a background."],
type = "toggle",
order = 13,
},
background = {
order = 14,
type = "select",
name = L["Background texture"],
dialogControl = "LSM30_Background",
values = getMediaData,
},
backgroundcolor = {
name = L["Background Color"],
type = "color",
order = 15,
hasAlpha = true,
get = getColor,
set = setColor,
},
borderheader = {
name = L["Border options"],
type = "header",
order = 16,
},
enableborder = {
name = L["Border"],
desc = L["Show a border."],
type = "toggle",
order = 17,
},
border = {
order = 18,
type = "select",
name = L["Border texture"],
dialogControl = "LSM30_Border",
values = getMediaData,
},
bordercolor = {
name = L["Border Color"],
type = "color",
order = 19,
get = getColor,
set = setColor,
},
castbarheader = {
name = L["Castbar options"],
type = "header",
order = 20,
},
showaimed = {
name = GetSpellInfo(19434),
desc = L["Show this on the default castbar."],
type = "toggle",
order = 21,
},
showmulti = {
name = GetSpellInfo(2643),
desc = L["Show this on the default castbar."],
type = "toggle",
order = 22,
},
announceheader = {
name = L["Announce options"],
type = "header",
order = 23,
},
tranqannounce = {
name = string.format(L["Announce %s"],GetSpellInfo(19801)),
desc = L["Enable / disable the announcement."],
type = "toggle",
order = 24,
width = "double",
},
tranqannouncefail = {
name = string.format(L["Announce failed %s"],GetSpellInfo(19801)),
desc = L["Enable / disable the announcement."],
type = "toggle",
order = 25,
width = "double",
},
announcetype = {
name = L["Announce in"],
desc = L["The channel in which to announce."],
type = "select",
order = 26,
values = {["WHISPER"] = L["Whisper"], ["CHANNEL"] = L["Channel"], ["RAID_WARNING"] = L["Raid Warning"], ["SAY"] = L["Say"], ["YELL"] = L["Yell"], ["PARTY"] = L["Party"], ["RAID"] = L["Raid"]},
set = function(info, value) set(info,value) LibStub("AceConfigRegistry-3.0", true):NotifyChange("YaHT") end
},
targetchannel = {
name = L["Channel/Playername"],
desc = L["Set the channel or player for whisper."],
type = "input",
order = 27,
hidden = function() return not (YaHT.db.profile.announcetype == "WHISPER" or YaHT.db.profile.announcetype == "CHANNEL") end,
},
announcemsg = {
name = L["Announce Message"],
desc = L["Set the message to be broadcasted."],
type = "input",
order = 28,
width = "full",
},
announcefailmsg = {
name = L["Announce Fail Message"],
desc = L["Set the message to be broadcasted."],
type = "input",
order = 29,
width = "full",
},
}
}
}
}
AceConfigRegistry:RegisterOptionsTable(Addon, aceoptions, true)
aceoptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
AceConfigDialog:AddToBlizOptions(Addon, nil, nil, "general")
AceConfigDialog:AddToBlizOptions(Addon, L["Profiles"], Addon, "profile")
AceConfigDialog:SetDefaultSize(Addon, 895, 570)
end