Mercurial > wow > reaction
comparison Profile.lua @ 213:8ba8ab8bf6dd
Demodularize LBF
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Thu, 18 Nov 2010 20:07:48 -0800 |
| parents | UpdateDB.lua@97949dbe987f |
| children | 258ca67bde4a |
comparison
equal
deleted
inserted
replaced
| 212:e275a8663a16 | 213:8ba8ab8bf6dd |
|---|---|
| 1 local _, addonTable = ... | |
| 2 local ReAction = addonTable.ReAction | |
| 3 | |
| 4 ReAction.PROFILEVERSION_LATEST = 1 | |
| 5 | |
| 6 ReAction.defaultProfile = { | |
| 7 profile = { | |
| 8 dbversion = nil, | |
| 9 bars = { }, | |
| 10 options = { | |
| 11 hideBlizzardBars = false, | |
| 12 hideBlizzardVehicleBar = false, | |
| 13 }, | |
| 14 }, | |
| 15 global = { | |
| 16 skipKeybindWarning = false, | |
| 17 } | |
| 18 } | |
| 19 | |
| 20 function ReAction:UpgradeProfile() | |
| 21 local db = self.db | |
| 22 | |
| 23 if not db.profile.dbversion then | |
| 24 -- upgrade from legacy db to v1 | |
| 25 | |
| 26 -- (1) remove unused defaultBars table (cleanup) | |
| 27 db.profile.defaultBars = nil | |
| 28 | |
| 29 -- (2) HideBlizzard is no longer a module | |
| 30 local hb = db:RegisterNamespace("HideBlizzard") | |
| 31 if hb then | |
| 32 db.profile.options.hideBlizzardBars = hb.profile.hide | |
| 33 db.profile.options.hideBlizzardVehicleBar = hb.profile.hideVehicle | |
| 34 hb:ResetProfile() | |
| 35 end | |
| 36 | |
| 37 -- (3) LBF is no longer a module | |
| 38 local bf = db:RegisterNamespace("ButtonFacade") | |
| 39 if bf then | |
| 40 for name, bar in pairs(db.profile.bars) do | |
| 41 bar.ButtonFacade = bf.profile[name] or bar.ButtonFacade | |
| 42 end | |
| 43 bf:ResetProfile() | |
| 44 end | |
| 45 | |
| 46 db.profile.dbversion = 1 | |
| 47 end | |
| 48 | |
| 49 db.profile.dbversion = self.PROFILEVERSION_LATEST | |
| 50 end |
