Mercurial > wow > reaction
view Profile.lua @ 226:76932cdb3d57
Removed tag 1.1 Beta 1
author | Flick |
---|---|
date | Sat, 19 Mar 2011 10:23:34 -0700 |
parents | d08a74e86c96 |
children | 741c4f9b251e |
line wrap: on
line source
local _, addonTable = ... local ReAction = addonTable.ReAction ReAction.PROFILEVERSION_LATEST = 1 ReAction.defaultProfile = { profile = { dbversion = nil, bars = { }, options = { hideBlizzardBars = false, hideBlizzardVehicleBar = false, }, }, global = { skipKeybindWarning = false, } } function ReAction:UpgradeProfile() local db = self.db if not db.profile.dbversion then -- upgrade from legacy db to v1 -- (1) remove unused defaultBars table (cleanup) db.profile.defaultBars = nil -- (2) HideBlizzard is no longer a module local hb = db:GetNamespace("HideBlizzard",true) or db:RegisterNamespace("HideBlizzard") if hb then db.profile.options.hideBlizzardBars = hb.profile.hide db.profile.options.hideBlizzardVehicleBar = hb.profile.hideVehicle hb:ResetProfile() end -- (3) LBF is no longer a module local bf = db:GetNamespace("ButtonFacade",true) or db:RegisterNamespace("ButtonFacade") if bf then for name, bar in pairs(db.profile.bars) do bar.ButtonFacade = bf.profile[name] or bar.ButtonFacade end bf:ResetProfile() end -- (4) Action module uses the bar config directly local action = db:GetNamespace("Action",true) or db:RegisterNamespace("Action") if action then for name, bar in pairs(db.profile.bars) do local ac = action.profile.bars and action.profile.bars[name] if ac then for key, value in pairs(ac) do bar[key] = value end end end action:ResetProfile() end -- (5) Bags module uses the bar config directly local bag = db:GetNamespace("Bag",true) or db:RegisterNamespace("Bag") if bag then for name, bar in pairs(db.profile.bars) do local bc = bag.profile.buttons and bag.profile.buttons[name] if bc then bar.buttons = bc end end bag:ResetProfile() end -- (6) Pet module uses the bar config directly local pet = db:GetNamespace("PetAction",true) or db:RegisterNamespace("PetAction") if pet then for name, bar in pairs(db.profile.bars) do local pc = pet.profile.buttons and pet.profile.buttons[name] if pc then bar.buttons = pc end end pet:ResetProfile() end -- (7) Stance module uses the bar config directly local stance = db:GetNamespace("Stance",true) or db:RegisterNamespace("Stance") if stance then for name, bar in pairs(db.profile.bars) do local sc = stance.profile.buttons and stance.profile.buttons[name] if sc then bar.buttons = sc end end stance:ResetProfile() end -- (8) Totem module uses the bar config directly local totem = db:GetNamespace("Totem",true) or db:RegisterNamespace("Totem") if totem then for name, bar in pairs(db.profile.bars) do local tc = totem.profile.buttons and totem.profile.buttons[name] if tc then bar.buttons = tc end end totem:ResetProfile() end -- (9) Vehicle exit button uses the bar config directly local vehicle = db:GetNamespace("VehicleExit",true) or db:RegisterNamespace("VehicleExit") if vehicle then for name, bar in pairs(db.profile.bars) do local vc = vehicle.profile.buttons and vehicle.profile.buttons[name] if vc then bar.buttons = vc end end vehicle:ResetProfile() end db.profile.dbversion = 1 end db.profile.dbversion = self.PROFILEVERSION_LATEST end