-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinit.lua
275 lines (223 loc) · 8.1 KB
/
init.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
local addonName, ns = ...
local E, C, D, M, L, P = ns.E, ns.C, ns.D, ns.M, ns.L, ns.P
-- Lua
local _G = getfenv(0)
local next = _G.next
--[[ luacheck: globals
AdiButtonAuras hooksecurefunc LibStub MaxDps MinimapButtonFrame
]]
-- Mine
local function cleanUpStep1()
local bars = {"bar1", "bar2", "bar3", "bar4", "bar5", "bar6", "bar7", "pet_battle", "extra", "zone"}
-- -> 90001.05
if C.db.profile.version and C.db.profile.version < 9000105 then
for _, bar in next, bars do
if C.db.profile.bars[bar] then
if C.db.profile.bars[bar].hotkey then
C.db.profile.bars[bar].hotkey.flag = nil
end
if C.db.profile.bars[bar].macro then
C.db.profile.bars[bar].macro.flag = nil
end
if C.db.profile.bars[bar].count then
C.db.profile.bars[bar].count.flag = nil
end
if C.db.profile.bars[bar].cooldown then
C.db.profile.bars[bar].cooldown.text.flag = nil
end
end
end
C.db.profile.bars.xpbar.text.flag = nil
C.db.profile.auras.HELPFUL.cooldown.text.flag = nil
C.db.profile.auras.HARMFUL.cooldown.text.flag = nil
C.db.profile.auras.TOTEM.cooldown.text.flag = nil
end
if C.db.char.version and C.db.char.version < 9000105 then
C.db.char.auratracker.cooldown.text.flag = nil
end
-- -> 90002.04
if C.db.global.version and C.db.global.version < 9000204 then
if C.db.global.fonts.units then
E:CopyTable(C.db.global.fonts.units, C.db.global.fonts.unit)
C.db.global.fonts.units = nil
end
if C.db.global.fonts.bars then
E:CopyTable(C.db.global.fonts.bars, C.db.global.fonts.button)
C.db.global.fonts.bars = nil
end
end
if C.db.profile.version and C.db.profile.version < 9000204 then
C.db.profile.units.traditional.player.auras.count.outline = nil
C.db.profile.units.traditional.player.auras.count.shadow = nil
C.db.profile.auras.HELPFUL.count.flag = nil
C.db.profile.auras.HARMFUL.count.flag = nil
C.db.profile.blizzard.digsite_bar.text.flag = nil
C.db.profile.blizzard.timer.text.flag = nil
end
if C.db.char.version and C.db.char.version < 9000204 then
C.db.char.auratracker.count.enabled = nil
C.db.char.auratracker.count.outline = nil
C.db.char.auratracker.count.shadow = nil
C.db.char.auratracker.count.flag = nil
end
end
local function cleanUpStep2()
local units = {"player", "pet", "target", "targettarget", "focus", "focustarget", "boss"}
-- -> 90001.05
if C.db.profile.version and C.db.profile.version < 9000105 then
for _, unit in next, units do
if C.db.profile.units[unit] then
if C.db.profile.units[unit].health then
C.db.profile.units[unit].health.text.outline = nil
C.db.profile.units[unit].health.text.shadow = nil
if C.db.profile.units[unit].health.prediction then
if C.db.profile.units[unit].health.prediction.absorb_text then
C.db.profile.units[unit].health.prediction.absorb_text.outline = nil
C.db.profile.units[unit].health.prediction.absorb_text.shadow = nil
end
if C.db.profile.units[unit].health.prediction.heal_absorb_text then
C.db.profile.units[unit].health.prediction.heal_absorb_text.outline = nil
C.db.profile.units[unit].health.prediction.heal_absorb_text.shadow = nil
end
end
end
if C.db.profile.units[unit].power then
C.db.profile.units[unit].power.text.outline = nil
C.db.profile.units[unit].power.text.shadow = nil
end
if C.db.profile.units[unit].castbar then
C.db.profile.units[unit].castbar.text.outline = nil
C.db.profile.units[unit].castbar.text.shadow = nil
end
if C.db.profile.units[unit].name then
C.db.profile.units[unit].name.outline = nil
C.db.profile.units[unit].name.shadow = nil
end
if C.db.profile.units[unit].auras then
if C.db.profile.units[unit].auras.cooldown then
C.db.profile.units[unit].auras.cooldown.text.outline = nil
C.db.profile.units[unit].auras.cooldown.text.shadow = nil
end
end
end
end
end
-- -> 90002.04
if C.db.profile.version and C.db.profile.version < 9000204 then
for _, unit in next, units do
if C.db.profile.units[unit] then
if C.db.profile.units[unit].auras then
C.db.profile.units[unit].auras.count.outline = nil
C.db.profile.units[unit].auras.count.shadow = nil
end
end
end
end
end
local function addRefs()
C.db.profile.units.player = C.db.profile.units[E.UI_LAYOUT].player
C.db.profile.units.pet = C.db.profile.units[E.UI_LAYOUT].pet
C.db.global.colors.power[ 0] = C.db.global.colors.power.MANA
C.db.global.colors.power[ 1] = C.db.global.colors.power.RAGE
C.db.global.colors.power[ 2] = C.db.global.colors.power.FOCUS
C.db.global.colors.power[ 3] = C.db.global.colors.power.ENERGY
C.db.global.colors.power[ 4] = C.db.global.colors.power.CHI
C.db.global.colors.power[ 5] = C.db.global.colors.power.RUNES
C.db.global.colors.power[ 6] = C.db.global.colors.power.RUNIC_POWER
C.db.global.colors.power[ 7] = C.db.global.colors.power.SOUL_SHARDS
C.db.global.colors.power[ 8] = C.db.global.colors.power.LUNAR_POWER
C.db.global.colors.power[ 9] = C.db.global.colors.power.HOLY_POWER
C.db.global.colors.power[10] = C.db.global.colors.power.ALTERNATE
C.db.global.colors.power[11] = C.db.global.colors.power.MAELSTROM
C.db.global.colors.power[13] = C.db.global.colors.power.INSANITY
C.db.global.colors.power[17] = C.db.global.colors.power.FURY
C.db.global.colors.power[18] = C.db.global.colors.power.PAIN
end
local function removeRefs()
C.db.profile.units.player = nil
C.db.profile.units.pet = nil
C.db.global.colors.power[ 0] = nil
C.db.global.colors.power[ 1] = nil
C.db.global.colors.power[ 2] = nil
C.db.global.colors.power[ 3] = nil
C.db.global.colors.power[ 4] = nil
C.db.global.colors.power[ 5] = nil
C.db.global.colors.power[ 6] = nil
C.db.global.colors.power[ 7] = nil
C.db.global.colors.power[ 8] = nil
C.db.global.colors.power[ 9] = nil
C.db.global.colors.power[10] = nil
C.db.global.colors.power[11] = nil
C.db.global.colors.power[13] = nil
C.db.global.colors.power[17] = nil
C.db.global.colors.power[18] = nil
end
local function updateAll()
cleanUpStep1()
addRefs()
cleanUpStep2()
P:UpdateModules()
P.Movers:UpdateConfig()
end
E:RegisterEvent("ADDON_LOADED", function(arg1)
if arg1 ~= addonName then return end
C.db = LibStub("AceDB-3.0"):New("LS_UI_GLOBAL_CONFIG", D)
LibStub("LibDualSpec-1.0"):EnhanceDatabase(C.db, "LS_UI_GLOBAL_CONFIG")
-- layout type change shouldn't affect anything after SVs are loaded
E.UI_LAYOUT = C.db.char.layout
D.profile.units.player = D.profile.units[E.UI_LAYOUT].player
D.profile.units.pet = D.profile.units[E.UI_LAYOUT].pet
cleanUpStep1()
addRefs()
cleanUpStep2()
if AdiButtonAuras and AdiButtonAuras.RegisterLAB then
AdiButtonAuras:RegisterLAB("LibActionButton-1.0-ls")
end
if MaxDps then
if MaxDps.RegisterLibActionButton then
MaxDps:RegisterLibActionButton("LibActionButton-1.0-ls")
else
local LAB = LibStub("LibActionButton-1.0-ls")
if MaxDps.FetchLibActionButton then
hooksecurefunc(MaxDps, "FetchLibActionButton", function(self)
for button in next, LAB:GetAllButtons() do
self:AddButton(button:GetSpellId(), button)
end
end)
end
if MaxDps.UpdateButtonGlow then
hooksecurefunc(MaxDps, "UpdateButtonGlow", function(self)
if self.db.global.disableButtonGlow then
LAB.eventFrame:UnregisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW")
else
LAB.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW")
end
end)
end
end
end
if MinimapButtonFrame then
C.db.profile.minimap.collect.enabled = false
end
C.db:RegisterCallback("OnDatabaseShutdown", function()
C.db.char.version = E.VER.number
C.db.global.version = E.VER.number
C.db.profile.version = E.VER.number
removeRefs()
P.Movers:CleanUpConfig()
end)
C.db:RegisterCallback("OnProfileShutdown", function()
C.db.profile.version = E.VER.number
removeRefs()
P.Movers:CleanUpConfig()
end)
C.db:RegisterCallback("OnProfileChanged", updateAll)
C.db:RegisterCallback("OnProfileCopied", updateAll)
C.db:RegisterCallback("OnProfileReset", updateAll)
E:RegisterEvent("PLAYER_LOGIN", function()
E:UpdateConstants()
P:InitModules()
end)
-- No one needs to see these
ns.C, ns.D, ns.L, ns.P = nil, nil, nil, nil
end)