-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDefaults.lua
More file actions
409 lines (380 loc) · 19.8 KB
/
Defaults.lua
File metadata and controls
409 lines (380 loc) · 19.8 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
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
-- Enhanced Cooldown Manager addon for World of Warcraft
-- Author: Argium
-- Licensed under the GNU General Public License v3.0
local _, ns = ...
---@class ECM_Color RGBA color definition.
---@field r number Red channel (0-1).
---@field g number Green channel (0-1).
---@field b number Blue channel (0-1).
---@field a number Alpha channel (0-1).
---@class ECM_EditModePosition Saved position for one Edit Mode layout.
---@field point string Anchor point (e.g. "CENTER", "TOPLEFT").
---@field x number X offset from anchor.
---@field y number Y offset from anchor.
---@alias ns.Constants.ANCHORMODE_CHAIN "chain"
---@alias ns.Constants.ANCHORMODE_DETACHED "detached"
---@alias ns.Constants.ANCHORMODE_FREE "free"
---@class ECM_BarConfigBase Shared bar layout configuration.
---@field enabled boolean Whether the bar is enabled.
---@field editModePositions table<string, ECM_EditModePosition>|nil Per-layout positions saved via Edit Mode.
---@field width number|nil Bar width override.
---@field height number|nil Bar height override.
---@field texture string|nil Bar texture override.
---@field overrideFont boolean|nil Whether this bar overrides global font settings.
---@field font string|nil Font face override for bar text.
---@field fontSize number|nil Font size override for bar text.
---@field showText boolean|nil Whether to show text.
---@field bgColor ECM_Color|nil Background color override.
---@field anchorMode ns.Constants.ANCHORMODE_CHAIN|ns.Constants.ANCHORMODE_DETACHED|ns.Constants.ANCHORMODE_FREE|nil Anchor mode for the bar.
---@class ECM_PowerBarConfig : ECM_BarConfigBase Power bar configuration.
---@field showManaAsPercent boolean Whether to show mana as a percent.
---@field colors table<ECM_ResourceType, ECM_Color> Resource colors.
---@field border ECM_BorderConfig Border configuration.
---@field ticks ECM_PowerBarTicksConfig Tick mark configuration.
---@class ECM_ResourceBarConfig : ECM_BarConfigBase Resource bar configuration.
---@field colors table<ECM_ResourceType, ECM_Color> Resource colors.
---@field maxColors table<ECM_ResourceType, ECM_Color> Colors used when a resource is at its maximum value.
---@field maxColorsEnabled table<ECM_ResourceType, boolean> Whether the max-value color override is enabled per type.
---@field border ECM_BorderConfig Border configuration.
---@class ECM_RuneBarConfig : ECM_BarConfigBase Rune bar configuration.
---@field useSpecColor boolean Whether to use class/spec colors instead of custom color.
---@field color ECM_Color Rune bar color.
---@field colorBlood ECM_Color Blood rune color.
---@field colorFrost ECM_Color Frost rune color.
---@field colorUnholy ECM_Color Unholy rune color.
---@alias ECM_ResourceType number|string Resource type identifier.
---@class ECM_GlobalConfig Global configuration.
---@field debug boolean Whether debug logging is enabled.
---@field warnings boolean Whether targeted warning logging is enabled.
---@field debugToChat boolean Whether debug output is also printed to chat.
---@field releasePopupSeenVersion string|nil Last release popup version acknowledged by the player.
---@field hideWhenMounted boolean Whether to hide when mounted or in a vehicle.
---@field hideOutOfCombatInRestAreas boolean Whether to hide out of combat in rest areas.
---@field updateFrequency number Update frequency in seconds.
---@field barHeight number Default bar height.
---@field barWidth number|nil Legacy global free-mode bar width fallback.
---@field barBgColor ECM_Color Default bar background color.
---@field offsetY number Global vertical offset.
---@field moduleSpacing number Vertical gap between chained modules.
---@field moduleGrowDirection "down"|"up"|nil Vertical grow direction for chained modules.
---@field texture string|nil Default bar texture.
---@field font string Font face.
---@field fontSize number Font size.
---@field fontOutline "NONE"|"OUTLINE"|"THICKOUTLINE"|"MONOCHROME" Font outline style.
---@field fontShadow boolean Whether font shadow is enabled.
---@field outOfCombatFade ECM_CombatFadeConfig Out of combat fade configuration.
---@field detachedAnchorPositions table<string, ECM_EditModePosition>|nil Per-layout positions for the detached anchor frame.
---@field detachedBarWidth number|nil Shared width for all detached bars.
---@field detachedModuleSpacing number|nil Vertical gap between detached modules.
---@field detachedGrowDirection "down"|"up"|nil Vertical grow direction for detached modules.
---@class ECM_BorderConfig Border configuration.
---@field enabled boolean Whether border is enabled.
---@field thickness number Border thickness in pixels.
---@field color ECM_Color Border color.
---@class ECM_BarCacheEntry Cached bar metadata.
---@field spellName string|nil Spell name.
---@field lastSeen number Last seen timestamp.
---@class ECM_SpellColorsConfig Spell color configuration.
---@field byName table<number, table<number, table<string, table>>> Per-name colors by class/spec/spellName.
---@field bySpellID table<number, table<number, table<number, table>>> Per-spellID colors by class/spec/spellID.
---@field byCooldownID table<number, table<number, table<number, table>>> Per-cooldownID colors by class/spec/cooldownID.
---@field byTexture table<number, table<number, table<number, table>>> Per-texture colors by class/spec/textureId.
---@field cache table<number, table<number, table<number, ECM_BarCacheEntry>>> Cached bar metadata by class/spec/index.
---@field defaultColor ECM_Color Default color when no per-spell override applies.
---@class ECM_BuffBarsConfig Buff bars configuration.
---@field enabled boolean Whether buff bars are enabled.
---@field anchorMode ns.Constants.ANCHORMODE_CHAIN|ns.Constants.ANCHORMODE_DETACHED|ns.Constants.ANCHORMODE_FREE|nil Anchor behavior for buff bars.
---@field verticalSpacing number|nil Vertical gap between buff bars (pixels).
---@field showIcon boolean|nil Whether to show buff icons.
---@field showSpellName boolean|nil Whether to show spell names.
---@field showDuration boolean|nil Whether to show durations.
---@field overrideFont boolean|nil Whether aura bars override global font settings.
---@field font string|nil Font face override for aura bar text.
---@field fontSize number|nil Font size override for aura bar text.
---@field colors ECM_SpellColorsConfig Per-spell color settings.
---@class ECM_ExternalBarsConfig External cooldown bars configuration.
---@field enabled boolean Whether external cooldown bars are enabled.
---@field hideOriginalIcons boolean Whether Blizzard's original external cooldown icons are hidden.
---@field anchorMode ns.Constants.ANCHORMODE_CHAIN|ns.Constants.ANCHORMODE_DETACHED|ns.Constants.ANCHORMODE_FREE|nil Anchor behavior for external cooldown bars.
---@field editModePositions table<string, ECM_EditModePosition>|nil Per-layout positions saved via Edit Mode.
---@field width number|nil Bar width override.
---@field height number|nil Bar height override.
---@field verticalSpacing number|nil Vertical gap between bars (pixels).
---@field showIcon boolean|nil Whether to show external cooldown icons.
---@field showSpellName boolean|nil Whether to show spell names.
---@field showDuration boolean|nil Whether to show durations.
---@field overrideFont boolean|nil Whether external cooldown bars override global font settings.
---@field font string|nil Font face override for bar text.
---@field fontSize number|nil Font size override for bar text.
---@field colors ECM_SpellColorsConfig Per-spell color settings.
---@class ECM_ExtraIconEntry
---@field stackKey string|nil Built-in stack key resolved via `BUILTIN_STACKS`.
---@field kind string|nil Entry kind for custom or racial rows.
---@field ids table|nil Entry spell/item priority list.
---@field itemStackId number|string|nil Stable item stack ID for `kind == "itemStack"` rows.
---@field slotId number|nil Slot ID for equip-slot entries.
---@field disabled boolean|nil When true, the entry stays in settings but is skipped at runtime.
---@class ECM_ItemStackConfig Named item priority list.
---@field name string Display name.
---@field ids ECM_ItemStackEntry[] Ordered item priority list.
---@field hideInInstances boolean|nil Whether to hide in non-PvP instances.
---@field hideInRatedPvp boolean|nil Whether to hide in rated PvP maps.
---@field showIfMissing boolean|nil Gets whether to show this stack greyscale when its active item is missing from inventory.
---@class ECM_ItemStackEntry Item priority entry.
---@field itemID number Gets the item ID.
---@field quality number|nil Gets the profession quality rank for display.
---@class ECM_ItemStacksConfig Item stack collection.
---@field nextId number Next stable custom item stack ID.
---@field order table Ordered item stack IDs.
---@field byId table<number|string, ECM_ItemStackConfig> Item stacks by stable ID.
---@class ECM_ExtraIconsConfig Extra icons configuration.
---@field enabled boolean Whether extra icons are enabled.
---@field showStackCount boolean Whether to show item stack counts.
---@field showCharges boolean Whether to show spell charges.
---@field overrideFont boolean|nil Whether stack/charge counts override global font settings.
---@field font string|nil Font face override for stack/charge counts.
---@field fontSize number|nil Font size override for stack/charge counts.
---@field viewers table<string, ECM_ExtraIconEntry[]> Per-viewer ordered icon lists.
---@field itemStacks ECM_ItemStacksConfig Named item stacks that can be referenced by viewer entries.
---@class ECM_TickMark Tick mark definition.
---@field value number Tick mark value.
---@field color ECM_Color Tick mark color.
---@field width number Tick mark width.
---@class ECM_PowerBarTicksConfig Power bar tick configuration.
---@field mappings table<number, table<number, ECM_TickMark[]>> Mappings by class/spec.
---@field defaultColor ECM_Color Default tick color.
---@field defaultWidth number Default tick width.
---@class ECM_CombatFadeConfig Combat fade configuration.
---@field enabled boolean Whether combat fade is enabled.
---@field opacity number Target opacity percent.
---@field exceptIfTargetCanBeAttacked boolean Skip fade if target is attackable.
---@field exceptIfTargetCanBeHelped boolean Skip fade if target is assistable.
---@field exceptInInstance boolean Skip fade in instances.
---@class ECM_Profile Profile settings.
---@field schemaVersion number Saved variables schema version.
---@field global ECM_GlobalConfig Global appearance settings.
---@field powerBar ECM_PowerBarConfig Power bar settings.
---@field resourceBar ECM_ResourceBarConfig Resource bar settings.
---@field runeBar ECM_RuneBarConfig Rune bar settings.
---@field buffBars ECM_BuffBarsConfig Buff bars configuration.
---@field externalBars ECM_ExternalBarsConfig External cooldown bars configuration.
---@field extraIcons ECM_ExtraIconsConfig Extra icons configuration.
local C = ns.Constants
local defaultItemStacks = {
nextId = 1,
order = { "combatPotions", "healthPotions", "healthstones" },
byId = {
combatPotions = {
name = "Combat Potions",
hideInInstances = false,
hideInRatedPvp = true,
ids = {
{ itemID = 241288, quality = 2 }, -- https://www.wowhead.com/item=241288/potion-of-recklessness
{ itemID = 241289, quality = 1 }, -- https://www.wowhead.com/item=241289/potion-of-recklessness
{ itemID = 245898, quality = 2 }, -- https://www.wowhead.com/item=245898/fleeting-lights-potential
{ itemID = 245897, quality = 1 }, -- https://www.wowhead.com/item=245897/fleeting-lights-potential
{ itemID = 241308, quality = 2 }, -- https://www.wowhead.com/item=241308/lights-potential
{ itemID = 241309, quality = 1 }, -- https://www.wowhead.com/item=241309/lights-potential
},
},
healthPotions = {
name = "Health Potions",
hideInInstances = false,
hideInRatedPvp = true,
ids = {
{ itemID = 241305, quality = 2 }, -- Silvermoon Health Potion R2 https://www.wowhead.com/item=241305/silvermoon-health-potion
{ itemID = 241304, quality = 1 }, -- Silvermoon Health Potion R1 https://www.wowhead.com/item=241304/silvermoon-health-potion
{ itemID = 258138, quality = 1 }, -- Potent Healing Potion https://www.wowhead.com/item=258138/potent-healing-potion
},
},
healthstones = {
name = "Healthstones",
hideInInstances = false,
hideInRatedPvp = false,
ids = {
{ itemID = 224464 }, -- Demonic Healthstone
{ itemID = 5512 }, -- Healthstone
},
},
},
}
-- Defines default tick marks for specific specialisations
local powerBarTickMappings = {}
powerBarTickMappings[C.DEMONHUNTER_CLASS_ID] = {
[C.DEMONHUNTER_DEVOURER_SPEC_INDEX] = {
{ value = 90, color = { r = 2 / 3, g = 2 / 3, b = 2 / 3, a = 0.8 } },
{ value = 100 },
},
}
local defaults = {
profile = {
schemaVersion = C.CURRENT_SCHEMA_VERSION,
global = {
debug = false,
warnings = false,
debugToChat = false,
releasePopupSeenVersion = "",
hideWhenMounted = true,
hideOutOfCombatInRestAreas = false,
updateFrequency = 0.04,
barHeight = 22,
barBgColor = { r = 0.08, g = 0.08, b = 0.08, a = 0.75 },
offsetY = 4,
moduleSpacing = 0,
moduleGrowDirection = C.GROW_DIRECTION_DOWN,
texture = "Solid",
font = "Expressway",
fontSize = 11,
fontOutline = "OUTLINE",
fontShadow = false,
outOfCombatFade = {
enabled = false,
opacity = 60,
exceptIfTargetCanBeAttacked = true,
exceptIfTargetCanBeHelped = false,
exceptInInstance = true,
},
detachedAnchorPositions = {},
detachedBarWidth = 300,
detachedModuleSpacing = 0,
detachedGrowDirection = C.GROW_DIRECTION_DOWN,
},
powerBar = {
enabled = true,
anchorMode = C.ANCHORMODE_CHAIN,
width = 300,
editModePositions = {},
showText = true,
overrideFont = false,
ticks = {
mappings = powerBarTickMappings, -- [classID][specID] = { { value = 50, color = {r,g,b,a}, width = 1 }, ... }
defaultColor = C.DEFAULT_POWERBAR_TICK_COLOR,
defaultWidth = 1,
},
showManaAsPercent = true,
border = {
enabled = false,
thickness = C.DEFAULT_BORDER_THICKNESS,
color = C.DEFAULT_BORDER_COLOR,
},
colors = {
[Enum.PowerType.Mana] = { r = 0.00, g = 0.00, b = 1.00, a = 1 },
[Enum.PowerType.Rage] = { r = 1.00, g = 0.00, b = 0.00, a = 1 },
[Enum.PowerType.Focus] = { r = 1.00, g = 0.57, b = 0.31, a = 1 },
[Enum.PowerType.Energy] = { r = 0.85, g = 0.65, b = 0.13, a = 1 },
[Enum.PowerType.RunicPower] = { r = 0.00, g = 0.82, b = 1.00, a = 1 },
[Enum.PowerType.LunarPower] = { r = 0.30, g = 0.52, b = 0.90, a = 1 },
[Enum.PowerType.Maelstrom] = { r = 0.00, g = 0.439, b = 0.871, a = 1 },
[Enum.PowerType.Insanity] = { r = 0.40, g = 0.00, b = 0.80, a = 1 },
[Enum.PowerType.Fury] = { r = 0.788, g = 0.259, b = 0.992, a = 1 },
},
},
resourceBar = {
enabled = true,
showText = false,
overrideFont = false,
anchorMode = C.ANCHORMODE_CHAIN,
width = 300,
editModePositions = {},
border = {
enabled = false,
thickness = C.DEFAULT_BORDER_THICKNESS,
color = C.DEFAULT_BORDER_COLOR,
},
colors = {
[C.RESOURCEBAR_TYPE_VENGEANCE_SOULS] = { r = 0.259, g = 0.6, b = 0.91, a = 1 },
[C.RESOURCEBAR_TYPE_DEVOURER_NORMAL] = { r = 0.416, g = 0.435, b = 0.910, a = 1 },
[C.RESOURCEBAR_TYPE_DEVOURER_META] = { r = 0.494, g = 0.549, b = 1.000, a = 1 },
[C.RESOURCEBAR_TYPE_ICICLES] = { r = 0.72, g = 0.9, b = 1.0, a = 1 },
[Enum.PowerType.ArcaneCharges] = { r = 102 / 255, g = 195 / 255, b = 250 / 255, a = 1 },
[Enum.PowerType.Chi] = { r = 0.00, g = 1.00, b = 0.59, a = 1 },
[Enum.PowerType.ComboPoints] = { r = 1.00, g = 0.96, b = 0.41, a = 1 },
[Enum.PowerType.Essence] = { r = 0.20, g = 0.58, b = 0.50, a = 1 },
[Enum.PowerType.HolyPower] = { r = 0.8863, g = 0.8235, b = 0.2392, a = 1 },
[C.RESOURCEBAR_TYPE_MAELSTROM_WEAPON] = { r = 0.043, g = 0.631, b = 0.890, a = 1 },
[Enum.PowerType.SoulShards] = { r = 0.58, g = 0.51, b = 0.79, a = 1 },
},
-- Remember to enable the resource type in Constants too.
maxColorsEnabled = {
[C.RESOURCEBAR_TYPE_ICICLES] = true,
[C.RESOURCEBAR_TYPE_DEVOURER_NORMAL] = true,
[C.RESOURCEBAR_TYPE_DEVOURER_META] = true,
},
maxColors = {
[C.RESOURCEBAR_TYPE_ICICLES] = { r = 0.8, g = 0.8, b = 0.8, a = 1 },
[C.RESOURCEBAR_TYPE_DEVOURER_NORMAL] = { r = 0.8, g = 0.8, b = 0.8, a = 1 },
[C.RESOURCEBAR_TYPE_DEVOURER_META] = { r = 0.8, g = 0.8, b = 0.8, a = 1 },
},
},
runeBar = {
enabled = true,
anchorMode = C.ANCHORMODE_CHAIN,
width = 300,
editModePositions = {},
overrideFont = false,
useSpecColor = true,
color = { r = 0.87, g = 0.10, b = 0.22, a = 1 },
colorBlood = { r = 0.87, g = 0.10, b = 0.22, a = 1 },
colorFrost = { r = 0.33, g = 0.69, b = 0.87, a = 1 },
colorUnholy = { r = 0.00, g = 0.61, b = 0.00, a = 1 },
},
buffBars = {
enabled = true,
anchorMode = C.ANCHORMODE_CHAIN,
editModePositions = {},
verticalSpacing = 0,
showIcon = false,
showSpellName = true,
showDuration = true,
overrideFont = false,
colors = {
byName = {},
bySpellID = {},
byCooldownID = {},
byTexture = {},
cache = {},
defaultColor = { r = 228 / 255, g = 233 / 255, b = 235 / 255, a = 1 },
},
},
externalBars = {
enabled = false,
hideOriginalIcons = false,
anchorMode = C.ANCHORMODE_CHAIN,
editModePositions = {},
width = C.DEFAULT_BAR_WIDTH,
height = 0,
verticalSpacing = 0,
showIcon = true,
showSpellName = true,
showDuration = true,
overrideFont = false,
colors = {
byName = {},
bySpellID = {},
byCooldownID = {},
byTexture = {},
cache = {},
defaultColor = { r = 0.40, g = 0.78, b = 0.95, a = 1 },
},
},
extraIcons = {
enabled = true,
showStackCount = true,
showCharges = true,
overrideFont = false,
itemStacks = defaultItemStacks,
viewers = {
utility = {
{ stackKey = "trinket1" },
{ stackKey = "trinket2" },
{ kind = "itemStack", itemStackId = "combatPotions" },
{ kind = "itemStack", itemStackId = "healthPotions" },
{ kind = "itemStack", itemStackId = "healthstones" },
},
main = {},
},
},
},
}
-- Export defaults for Options module to access
ns.defaults = defaults