-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.lua
More file actions
380 lines (330 loc) · 10.5 KB
/
options.lua
File metadata and controls
380 lines (330 loc) · 10.5 KB
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
local addonName, addonTable = ...
local bReadyCheck = addonTable.bReadyCheck
function bReadyCheck:ADDON_LOADED(addonName)
if not self.LSM then
local LSM = LibStub and LibStub("LibSharedMedia-3.0", true)
if LSM then
self.LSM = LSM
end
end
end
function bReadyCheck:RegisterOptions()
local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale("bReadyCheck")
local function NormalizeKey(str)
if not str then
return ""
end
return str:gsub("%s+", ""):lower()
end
local predefinedFonts = {
["FRIZQT"] = "Friz Quadrata",
["ARIALN"] = "Arial Narrow",
["MORPHEUS"] = "Morpheus",
["SKURRI"] = "Skurri",
["UbuntuMedium"] = "Ubuntu Medium",
["TelluralAlt"] = "Tellural Alt",
["TaurusNormal"] = "Taurus Normal",
["FiraSansMedium"] = "Fira Sans Medium",
["ariblk"] = "Arial Black",
["alphapixels"] = "AlphaPixels",
["default"] = "Default",
}
local function GenerateFontOptions()
local fonts = {}
local addedKeys = {}
if bReadyCheck.LSM then
for _, name in ipairs(bReadyCheck.LSM:List("font")) do
local norm = NormalizeKey(name)
fonts[name] = name
addedKeys[norm] = true
end
end
for key, displayName in pairs(predefinedFonts) do
local norm = NormalizeKey(displayName)
if not addedKeys[norm] then
fonts[key] = displayName
addedKeys[norm] = true
end
end
return fonts
end
local fontSourcesCache = nil
local function getFontPath(key)
if key == "FRIZQT" then return "Fonts\\FRIZQT__.TTF"
elseif key == "ARIALN" then return "Fonts\\ARIALN.TTF"
elseif key == "MORPHEUS" then return "Fonts\\MORPHEUS.TTF"
elseif key == "SKURRI" then return "Fonts\\SKURRI.TTF"
elseif key == "UbuntuMedium" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\UbuntuMedium.ttf"
elseif key == "TelluralAlt" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\TelluralAlt.ttf"
elseif key == "TaurusNormal" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\TaurusNormal.ttf"
elseif key == "FiraSansMedium" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\FiraSansMedium.ttf"
elseif key == "ariblk" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\ariblk.ttf"
elseif key == "alphapixels" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\alphapixels.ttf"
elseif key == "default" then return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\default.ttf"
end
if bReadyCheck.LSM then
local success, fontPath = pcall(bReadyCheck.LSM.Fetch, bReadyCheck.LSM, "font", key)
if success and fontPath then
return fontPath
end
end
return "Interface\\AddOns\\bReadyCheck\\media\\fonts\\default.ttf"
end
local function GetEnabledText()
local enabled = bReadyCheck.db.profile.enabled
local color = enabled and "|cff00ff00" or "|cffff0000"
return color .. L["Enable"] .. "|r"
--return color .. "Включить" .. "|r"
end
local options = {
type = "group",
name = "bReadyCheck",
childGroups = "tab",
args = {
--1=============================================
General = {
type = "group",
name = L["General Settings"],
order = 1,
args = {
enabled = {
type = "toggle",
name = GetEnabledText,
--desc = "Включить/выключить",
desc = L["EnableDesc"],
get = function()
return bReadyCheck.db.profile.enabled
end,
set = function(_, val)
bReadyCheck.db.profile.enabled = val
if val then
bReadyCheck:RegisterEvent("READY_CHECK", "OnReadyCheck")
bReadyCheck:RegisterEvent("READY_CHECK_FINISHED", "OnReadyCheckFinished")
bReadyCheck:RegisterEvent("READY_CHECK_CONFIRM", "OnReadyCheckConfirm")
else
bReadyCheck:UnregisterEvent("READY_CHECK")
bReadyCheck:UnregisterEvent("READY_CHECK_FINISHED")
bReadyCheck:UnregisterEvent("READY_CHECK_CONFIRM")
if bReadyCheck.buffFrame then
bReadyCheck.buffFrame:Hide()
end
end
LibStub("AceConfigRegistry-3.0"):NotifyChange("bReadyCheck")
end,
order = 1,
width = "full",
},
onlyForRL = {
type = "toggle",
--name = "Только для рейд-лидера",
name = L["OnlyRL"],
desc = L["OnlyRLDesc"],
--desc = "Показывать информацию только рейд-лидеру иили ассистентам"
get = function()
return bReadyCheck.db.profile.onlyForRL
end,
set = function(_, val)
bReadyCheck.db.profile.onlyForRL = val
end,
order = 2,
width = "full",
},
sortByClass = {
type = "toggle",
--name = "Сортировка по классам",
name = L["SortByClass"],
desc = L["SortByClassDesc"],
--desc = "При включении игроки будут отображаться отсортированными по классам",
get = function()
return bReadyCheck.db.profile.sortByClass
end,
set = function(_, val)
bReadyCheck.db.profile.sortByClass = val
--bReadyCheck:UpdateRoster(true)
end,
order = 3,
width = "full",
},
scale = {
type = "range",
name = L["FrameScale"],
min = 0.1,
max = 2,
step = 0.05,
get = function()
return bReadyCheck.db.profile.scale
end,
set = function(_, val)
bReadyCheck.db.profile.scale = val
if bReadyCheck.buffFrame then
local frame = bReadyCheck.buffFrame
local oldScale = frame:GetScale()
local left = frame:GetLeft()
local top = frame:GetTop()
if not (left and top and oldScale) then return end
local uiScale = UIParent:GetScale()
local absLeft = left * oldScale / uiScale
local absTop = top * oldScale / uiScale
frame:SetScale(val)
local newLeft = absLeft * uiScale / val
local newTop = absTop * uiScale / val
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", newLeft, newTop)
end
end,
width = "full",
order = 4,
},
disappearDelay = {
type = "range",
--name = "Время в секундах, через которое окно исчезает после окончания проверки",
name = L["TimerTooltip"],
min = 0,
max = 180,
step = 1,
bigStep = 5,
get = function()
return bReadyCheck.db.profile.ReadyCheckFadeDelay or 10
end,
set = function(_, val)
bReadyCheck.db.profile.ReadyCheckFadeDelay = val
end,
width = "full",
order = 5,
},
},
},
--2=============================================
Buffs = {
type = "group",
name = L["BuffSettings"],
order = 2,
args = {
flaskExpireOption = {
type = "select",
--name = "Показывать заканчивающиеся фласки",
name = L["MinFlaskExp"],
desc = L["MinFlaskExpDesc"],
--desc = "Выберите, за сколько минут до окончания фласок показывать предупреждение",
values = {
[0] = L["MinFlaskExpNo"],
[5] = "5 " .. L["MinFlaskExpMin"],
[10] = "10 " .. L["MinFlaskExpMin"],
},
sorting = { 0, 5, 10 },
get = function()
return bReadyCheck.db.profile.flaskExpireOption or 0
end,
set = function(_, val)
bReadyCheck.db.profile.flaskExpireOption = val
end,
style = "radio",
width = "full",
order = 1,
},
showSourceName = {
type = "toggle",
name = L["ShowSourceName"],
desc = L["ShowSourceNameDesc"],
get = function()
return bReadyCheck.db.profile.showSourceName
end,
set = function(_, val)
bReadyCheck.db.profile.showSourceName = val
end,
order = 2,
width = "full",
},
},
},
--3=============================================
Font = {
type = "group",
name = L["FontSettings"],
order = 3,
args = {
fontSelect = {
type = "select",
--name = "Выбор шрифта",
name = L["Fonts"],
desc = L["FontsDesc"],
--desc = "Выберите шрифт для отображения текста",
values = function()
return GenerateFontOptions()
end,
get = function()
return bReadyCheck.db.profile.fontKey or "default"
end,
set = function(_, val)
bReadyCheck.db.profile.fontKey = val
bReadyCheck.db.profile.fontPath = getFontPath(val)
bReadyCheck:UpdateFont()
end,
width = "hulf",
order = 1,
},
fontOutline = {
type = "select",
name = L["FontOutline"],
desc = L["FontOutlineDesc"],
values = {
NONE = "None",
OUTLINE = "Outline",
THICKOUTLINE = "Thick Outline",
},
get = function()
return bReadyCheck.db.profile.fontOutline or "NONE"
end,
set = function(_, val)
bReadyCheck.db.profile.fontOutline = val
bReadyCheck:UpdateFont()
end,
width = "hulf",
order = 2,
},
fontSpacer = {
type = "description",
name = "\n",
order = 3,
},
fontSize = {
type = "range",
name = L["FontSize"],
--desc = L["FontSizeDesc"],
min = 6,
max = 32,
step = 1,
get = function()
return bReadyCheck.db.profile.fontSize or 12
end,
set = function(_, val)
bReadyCheck.db.profile.fontSize = val
bReadyCheck:UpdateFont()
end,
width = "hulf",
order = 4,
},
fontShadow = {
type = "toggle",
name = L["FontShadow"],
--desc = L["FontShadowDesc"],
get = function()
return bReadyCheck.db.profile.fontShadow
end,
set = function(_, val)
bReadyCheck.db.profile.fontShadow = val
bReadyCheck:UpdateFont()
end,
width = "hulf",
order = 5,
},
},
},
},
}
--===========================
AceConfig:RegisterOptionsTable("bReadyCheck", options)
AceConfigDialog:AddToBlizOptions("bReadyCheck", "bReadyCheck")
end