-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathPlater_O_BossMod.lua
344 lines (313 loc) · 13.1 KB
/
Plater_O_BossMod.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
local addonId, platerInternal = ...
local Plater = Plater
---@type detailsframework
local DF = DetailsFramework
local _
--font select
local on_select_blizzard_nameplate_font = function (_, _, value)
Plater.db.profile.blizzard_nameplate_font = value
end
local on_select_blizzard_nameplate_large_font = function (_, _, value)
Plater.db.profile.blizzard_nameplate_large_font = value
end
function platerInternal.CreateBossModOptions()
if platerInternal.LoadOnDemand_IsLoaded.BossModOptions then return end -- already loaded
--templates
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
---@diagnostic disable-next-line: undefined-global
local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
---@diagnostic disable-next-line: undefined-global
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
local dropdownStatusBarTexture = platerInternal.Defaults.dropdownStatusBarTexture
local dropdownStatusBarColor = platerInternal.Defaults.dropdownStatusBarColor
local L = DF.Language.GetLanguageTable(addonId)
--outline table
local outline_modes = {"NONE", "MONOCHROME", "OUTLINE", "THICKOUTLINE", "MONOCHROME, OUTLINE", "MONOCHROME, THICKOUTLINE"}
local outline_modes_names = {"None", "Monochrome", "Outline", "Thick Outline", "Monochrome Outline", "Monochrome Thick Outline"}
local build_outline_modes_table = function (actorType, member)
local t = {}
for i = 1, #outline_modes do
local value = outline_modes[i]
local label = outline_modes_names[i]
tinsert (t, {
label = label,
value = value,
statusbar = dropdownStatusBarTexture,
statusbarcolor = dropdownStatusBarColor,
onclick = function (_, _, value)
if (actorType) then
Plater.db.profile.plate_config [actorType][member] = value
Plater.RefreshDBUpvalues()
Plater.UpdateAllPlates()
Plater.UpdateAllNames()
else
Plater.db.profile [member] = value
Plater.RefreshDBUpvalues()
Plater.UpdateAllPlates()
Plater.UpdateAllNames()
end
end
})
end
return t
end
--anchor table
local build_anchor_side_table = function (actorType, member)
local anchorOptions = {}
local phraseIdTable = Plater.AnchorNamesByPhraseId
local languageId = DF.Language.GetLanguageIdForAddonId(addonId)
for i = 1, 13 do
tinsert (anchorOptions, {
label = DF.Language.GetText(addonId, phraseIdTable[i]),
languageId = languageId,
phraseId = phraseIdTable[i],
value = i,
statusbar = dropdownStatusBarTexture,
statusbarcolor = dropdownStatusBarColor,
onclick = function (_, _, value)
if (actorType) then
Plater.db.profile.plate_config [actorType][member].side = value
Plater.RefreshDBUpvalues()
Plater.UpdateAllPlates()
Plater.UpdateAllNames()
else
Plater.db.profile [member].side = value
Plater.RefreshDBUpvalues()
Plater.UpdateAllPlates()
Plater.UpdateAllNames()
end
end
})
end
return anchorOptions
end
-- glow types
local glow_types = { "Pixel", "Proc", "Ants", "Button"}
local build_glow_types_table = function (option)
local glow_types_table = {}
for index, name in ipairs (glow_types) do
tinsert (glow_types_table, {
label = name,
value = index,
onclick = function (_, _, value)
if (option) then
Plater.db.profile [option] = value
Plater.UpdateAllPlates()
end
end
})
end
return glow_types_table
end
local bossmod_options = {
{type = "label", get = function() return "DBM / BigWigs Support:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_support_enabled end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_support_enabled = value
Plater.UpdateAllPlates()
end,
name = "OPTIONS_ENABLED",
desc = "Enable the boss mod icon support for BigWigs and DBM.",
},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_castrename_enabled end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_castrename_enabled = value
--Plater.UpdateAllPlates()
end,
name = "Enable boss-mod cast spell renaming",
desc = "Enable cast rename based on BigWigs or DBM spell names.",
},
{type = "blank"},
{type = "label", get = function() return "Global Icon Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--width
{
type = "range",
get = function() return Plater.db.profile.bossmod_aura_width end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_aura_width = value
Plater.UpdateAllPlates()
end,
min = 8,
max = 64,
step = 1,
name = "OPTIONS_WIDTH",
desc = "OPTIONS_WIDTH",
},
--height
{
type = "range",
get = function() return Plater.db.profile.bossmod_aura_height end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_aura_height = value
Plater.UpdateAllPlates()
end,
min = 8,
max = 64,
step = 1,
name = "OPTIONS_HEIGHT",
desc = "OPTIONS_HEIGHT",
},
--anchor
{
type = "select",
get = function() return Plater.db.profile.bossmod_icons_anchor.side end,
values = function() return build_anchor_side_table (nil, "bossmod_icons_anchor") end,
name = "OPTIONS_ANCHOR",
desc = "Which side of the nameplate the icons should attach to.",
},
--x offset
{
type = "range",
get = function() return Plater.db.profile.bossmod_icons_anchor.x end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_icons_anchor.x = value
Plater.UpdateAllPlates()
end,
min = -40,
max = 40,
step = 1,
usedecimals = true,
name = "OPTIONS_XOFFSET",
desc = "OPTIONS_XOFFSET_DESC",
},
--y offset
{
type = "range",
get = function() return Plater.db.profile.bossmod_icons_anchor.y end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_icons_anchor.y = value
Plater.UpdateAllPlates()
end,
min = -60,
max = 60,
step = 1,
usedecimals = true,
name = "OPTIONS_YOFFSET",
desc = "OPTIONS_YOFFSET_DESC",
},
{type = "blank"},
{type = "label", get = function() return "Icon Spell-Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
--text enabled
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_support_bars_text_enabled end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_support_bars_text_enabled = value
Plater.UpdateAllPlates()
end,
name = "Icon text enabled",
desc = "Enable Bar Text (Spell-Name).",
},
{type = "blank"},
{type = "label", get = function() return "Icon Cooldown Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_cooldown_text_enabled end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_cooldown_text_enabled = value
Plater.UpdateAllPlates()
end,
name = "OPTIONS_ENABLED",
desc = "Enable Cooldown Text.",
},
--cd text size
{
type = "range",
get = function() return Plater.db.profile.bossmod_cooldown_text_size end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_cooldown_text_size = value
Plater.RefreshAuras()
Plater.UpdateAllPlates()
end,
min = 6,
max = 32,
step = 1,
name = "OPTIONS_SIZE",
desc = "Size",
},
{type = "breakline"},
{type = "label", get = function() return "DBM Options:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_support_bars_enabled end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_support_bars_enabled = value
Plater.UpdateAllPlates()
end,
name = "DBM CD-Bar Icons enabled",
desc = "Enable the boss mod bar support for DBM, to show timer bars as icons on the nameplates.",
},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_aura_glow_cooldown end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_aura_glow_cooldown = value
Plater.UpdateAllPlates()
end,
name = "Cooldown Icon Glow",
desc = "Enable glow on expiring cooldown timer icons.",
},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_aura_glow_important_only end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_aura_glow_important_only = value
Plater.UpdateAllPlates()
end,
name = "Glow only important cooldowns",
desc = "Enable glow on important expiring timer icons only.",
},
{
type = "toggle",
get = function() return Plater.db.profile.bossmod_aura_glow_casts end,
set = function (self, fixedparam, value)
Plater.db.profile.bossmod_aura_glow_casts = value
Plater.UpdateAllPlates()
end,
name = "Cast Icon Glow",
desc = "Enable glow on expiring cast timer icons.",
},
{
type = "select",
get = function() return Plater.db.profile.bossmod_aura_glow_cooldown_glow_type end,
values = function() return build_glow_types_table ("bossmod_aura_glow_cooldown_glow_type") end,
name = "Cooldown Icon Glow Type",
desc = "Select glow type for important expiring timer icons.",
},
{
type = "select",
get = function() return Plater.db.profile.bossmod_aura_glow_casts_glow_type end,
values = function() return build_glow_types_table ("bossmod_aura_glow_casts_glow_type") end,
name = "Cast Icon Glow Type",
desc = "Select glow type for expiring timer icons.",
},
}
---@diagnostic disable-next-line: undefined-global
local bossmodFrame = PlaterOptionsPanelContainerBossModConfig
--bossmod_options.align_as_pairs = true
--bossmod_options.align_as_pairs_string_space = 181
--bossmod_options.widget_width = 150
--bossmod_options.use_scrollframe = true
bossmod_options.language_addonId = addonId
bossmod_options.always_boxfirst = true
bossmod_options.Name = "Boss-Mods"
--local canvasFrame = DF:CreateCanvasScrollBox(bossmodFrame, nil, "PlaterOptionsPanelCanvasBossModConfig")
--canvasFrame:SetPoint("topleft", bossmodFrame, "topleft", 0, platerInternal.optionsYStart)
--canvasFrame:SetPoint("bottomright", bossmodFrame, "bottomright", -26, 25)
--bossmodFrame.canvasFrame = canvasFrame
local startX, startY, heightSize = 10, platerInternal.optionsYStart, 755
--DF:BuildMenu (canvasFrame, bossmod_options, startX, 0, heightSize, false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template, platerInternal.OptionsGlobalCallback)
DF:BuildMenu (bossmodFrame, bossmod_options, startX, startY, heightSize, false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template, platerInternal.OptionsGlobalCallback)
platerInternal.LoadOnDemand_IsLoaded.BossModOptions = true
---@diagnostic disable-next-line: undefined-global
table.insert(PlaterOptionsPanelFrame.AllSettingsTable, bossmod_options)
platerInternal.CreateBossModOptions = function() end
end