flickerstreak@211
|
1 local _, addonTable = ...
|
flickerstreak@211
|
2 local ReAction = addonTable.ReAction
|
flickerstreak@211
|
3
|
flickerstreak@211
|
4 ReAction.PROFILEVERSION_LATEST = 1
|
flickerstreak@211
|
5
|
flickerstreak@213
|
6 ReAction.defaultProfile = {
|
flickerstreak@213
|
7 profile = {
|
flickerstreak@213
|
8 dbversion = nil,
|
flickerstreak@213
|
9 bars = { },
|
flickerstreak@213
|
10 options = {
|
flickerstreak@213
|
11 hideBlizzardBars = false,
|
flickerstreak@213
|
12 hideBlizzardVehicleBar = false,
|
flickerstreak@213
|
13 },
|
flickerstreak@213
|
14 },
|
flickerstreak@213
|
15 global = {
|
flickerstreak@213
|
16 skipKeybindWarning = false,
|
flickerstreak@213
|
17 }
|
flickerstreak@213
|
18 }
|
flickerstreak@213
|
19
|
flickerstreak@213
|
20 function ReAction:UpgradeProfile()
|
flickerstreak@211
|
21 local db = self.db
|
flickerstreak@211
|
22
|
flickerstreak@211
|
23 if not db.profile.dbversion then
|
flickerstreak@211
|
24 -- upgrade from legacy db to v1
|
flickerstreak@211
|
25
|
flickerstreak@213
|
26 -- (1) remove unused defaultBars table (cleanup)
|
flickerstreak@211
|
27 db.profile.defaultBars = nil
|
flickerstreak@211
|
28
|
flickerstreak@211
|
29 -- (2) HideBlizzard is no longer a module
|
flickerstreak@215
|
30 local hb = db:GetNamespace("HideBlizzard",true) or db:RegisterNamespace("HideBlizzard")
|
flickerstreak@213
|
31 if hb then
|
flickerstreak@213
|
32 db.profile.options.hideBlizzardBars = hb.profile.hide
|
flickerstreak@213
|
33 db.profile.options.hideBlizzardVehicleBar = hb.profile.hideVehicle
|
flickerstreak@213
|
34 hb:ResetProfile()
|
flickerstreak@213
|
35 end
|
flickerstreak@213
|
36
|
flickerstreak@213
|
37 -- (3) LBF is no longer a module
|
flickerstreak@215
|
38 local bf = db:GetNamespace("ButtonFacade",true) or db:RegisterNamespace("ButtonFacade")
|
flickerstreak@213
|
39 if bf then
|
flickerstreak@213
|
40 for name, bar in pairs(db.profile.bars) do
|
flickerstreak@213
|
41 bar.ButtonFacade = bf.profile[name] or bar.ButtonFacade
|
flickerstreak@213
|
42 end
|
flickerstreak@213
|
43 bf:ResetProfile()
|
flickerstreak@211
|
44 end
|
flickerstreak@211
|
45
|
flickerstreak@221
|
46 -- (4) Action module uses the bar config directly
|
flickerstreak@220
|
47 local action = db:GetNamespace("Action",true) or db:RegisterNamespace("Action")
|
flickerstreak@220
|
48 if action then
|
flickerstreak@220
|
49 for name, ac in pairs(action.profile.bars) do
|
flickerstreak@220
|
50 local c = db.profile.bars[name]
|
flickerstreak@220
|
51 if c then
|
flickerstreak@220
|
52 for key, value in pairs(ac) do
|
flickerstreak@220
|
53 c[key] = value
|
flickerstreak@220
|
54 end
|
flickerstreak@220
|
55 end
|
flickerstreak@220
|
56 end
|
flickerstreak@220
|
57 action:ResetProfile()
|
flickerstreak@220
|
58 end
|
flickerstreak@220
|
59
|
flickerstreak@221
|
60 -- (5) Bags module uses the bar config directly
|
flickerstreak@221
|
61 local bag = db:GetNamespace("Bag",true) or db:RegisterNamespace("Bag")
|
flickerstreak@221
|
62 if bag then
|
flickerstreak@221
|
63 for name, bc in pairs(bag.profile.buttons) do
|
flickerstreak@221
|
64 local c = db.profile.bars[name]
|
flickerstreak@221
|
65 c.buttons = bc
|
flickerstreak@221
|
66 end
|
flickerstreak@221
|
67 bag:ResetProfile()
|
flickerstreak@221
|
68 end
|
flickerstreak@221
|
69
|
flickerstreak@211
|
70 db.profile.dbversion = 1
|
flickerstreak@211
|
71 end
|
flickerstreak@211
|
72
|
flickerstreak@211
|
73 db.profile.dbversion = self.PROFILEVERSION_LATEST
|
flickerstreak@211
|
74 end
|