Mercurial > wow > reaction
comparison Profile.lua @ 232:afb5ff4eccc0
db version 2 (State namespace removed)
| author | Flick |
|---|---|
| date | Tue, 22 Mar 2011 11:35:33 -0700 |
| parents | ad40cd3fc7e9 |
| children | 36a29870bf34 |
comparison
equal
deleted
inserted
replaced
| 231:158c9299185b | 232:afb5ff4eccc0 |
|---|---|
| 1 local _, addonTable = ... | 1 local _, addonTable = ... |
| 2 local ReAction = addonTable.ReAction | 2 local ReAction = addonTable.ReAction |
| 3 | 3 |
| 4 ReAction.PROFILEVERSION_LATEST = 1 | 4 ReAction.PROFILEVERSION_LATEST = 2 |
| 5 | 5 |
| 6 ReAction.defaultProfile = { | 6 ReAction.defaultProfile = { |
| 7 profile = { | 7 profile = { |
| 8 dbversion = nil, | 8 dbversion = nil, |
| 9 bars = { }, | 9 bars = { }, |
| 115 end | 115 end |
| 116 end | 116 end |
| 117 vehicle:ResetProfile() | 117 vehicle:ResetProfile() |
| 118 end | 118 end |
| 119 | 119 |
| 120 db.profile.dbversion = 1 | |
| 121 end | |
| 122 | |
| 123 | |
| 124 if db.profile.dbversion < 2 then | |
| 125 -- upgrade from v1 to v2 | |
| 126 | |
| 120 -- (10) State module uses the bar config directly | 127 -- (10) State module uses the bar config directly |
| 121 local state = db:GetNamespace("State",true) or db:RegisterNamespace("State") | 128 local state = db:GetNamespace("State",true) or db:RegisterNamespace("State") |
| 122 if state then | 129 if state then |
| 123 for name, bar in pairs(db.profile.bars) do | 130 for name, bar in pairs(db.profile.bars) do |
| 124 local sc = state.profile.bars and state.profile.bars[name] and state.profile.bars[name].states | 131 local sc = state.profile.bars and state.profile.bars[name] and state.profile.bars[name].states |
| 125 if sc then | 132 if sc then |
| 126 bar.states = sc | 133 bar.states = sc |
| 127 end | 134 end |
| 128 end | 135 end |
| 129 vehicle:ResetProfile() | 136 state:ResetProfile() |
| 130 end | 137 end |
| 131 | 138 |
| 132 db.profile.dbversion = 1 | 139 db.profile.dbversion = 2 |
| 133 end | 140 end |
| 134 | 141 |
| 135 db.profile.dbversion = self.PROFILEVERSION_LATEST | 142 db.profile.dbversion = self.PROFILEVERSION_LATEST |
| 136 end | 143 end |
| 137 | 144 |
