-
Notifications
You must be signed in to change notification settings - Fork 6
/
Upgrades.lua
97 lines (83 loc) · 3.25 KB
/
Upgrades.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
local addonName,addonTable = ...
local DA = _G[addonName] -- for DebugAids.lua
--[[
Skillet: A tradeskill window replacement.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]--
--[[
Contains methods to upgrade Skillet from previous versions. This is
for when I screw up the SavedVariables layout and need to fix it somehow.
]]--
-- Runs all the update functions, should they be required
function Skillet:UpgradeDataAndOptions()
DA.DEBUG(0,"UpgradeDataAndOptions()")
if not self.db.realm.options then
self.db.realm.options = {}
end
local player = self.currentPlayer
local options = self.db.realm.options[player]
if options then
--DA.DEBUG(0,"UpgradeDataAndOptions: options= "..DA.DUMP1(options))
for trade in pairs(options) do
if options[trade].filtertext then
options[trade].searchtext = options[trade].filtertext
options[trade].filtertext = nil
end
end
end
if SkilletDB.servers then
SkilletDB.realms = SkilletDB.servers
SkilletDB.servers = nil
self.db = LibStub("AceDB-3.0"):New("SkilletDB")
end
if self.db.profile.transparency<0.1 or self.db.profile.transparency>1 then
self.db.profile.transparency=1
end
if self.db.profile.scale<0.1 or self.db.profile.scale>2 then
self.db.profile.scale=1
end
-- Upgrade from Skillet 1.2 and earlier where recipes where (stupidly)
-- stored per-charcter where no one else could see them
if self.db.char.recipes then
self.db.char.recipes = nil
end
if self.db.realm.recipes then
self.db.realm.recipes = nil
end
-- Update from Skillet 1.5 or earlier where profile options were
-- actually stored per character
if self.db.char.vendor_buy_button then
self.db.profile.vendor_buy_button = self.db.char.vendor_buy_button
self.db.char.vendor_buy_button = nil
end
if self.db.char.vendor_auto_buy then
self.db.profile.vendor_auto_buy = self.db.char.vendor_auto_buy
self.db.char.vendor_auto_buy = nil
end
if self.db.char.show_item_notes_tooltip then
self.db.profile.show_item_notes_tooltip = self.db.char.show_item_notes_tooltip
self.db.char.show_item_notes_tooltip = nil
end
if self.db.char.show_detailed_recipe_tooltip then
self.db.profile.show_detailed_recipe_tooltip = self.db.char.show_detailed_recipe_tooltip
self.db.char.show_detailed_recipe_tooltip = nil
end
if self.db.char.link_craftable_reagents then
self.db.profile.link_craftable_reagents = self.db.char.link_craftable_reagents
self.db.char.link_craftable_reagents = nil
end
-- Moved any recipe notes to the server level so all alts can see then
if self.db.char.notes then
self.db.realm.notes[UnitName("player")] = self.db.char.notes
self.db.char.notes = nil
end
end