comparison Core.lua @ 127:65c285394049 v59

Fixed an issue with reading bank data.
author yellowfive
date Tue, 17 Jul 2018 16:32:12 -0700
parents e31b02b24488
children d9a059484b22
comparison
equal deleted inserted replaced
126:c005f9a393c1 127:65c285394049
1 AskMrRobot = LibStub("AceAddon-3.0"):NewAddon("AskMrRobot", "AceEvent-3.0", "AceComm-3.0", "AceConsole-3.0", "AceSerializer-3.0") 1 AskMrRobot = LibStub("AceAddon-3.0"):NewAddon("AskMrRobot", "AceEvent-3.0", "AceComm-3.0", "AceConsole-3.0", "AceSerializer-3.0")
2 local Amr = AskMrRobot 2 local Amr = AskMrRobot
3 Amr.Serializer = LibStub("AskMrRobot-Serializer") 3 Amr.Serializer = LibStub("AskMrRobot-Serializer")
4 4
5 Amr.ADDON_NAME = "AskMrRobot" 5 Amr.ADDON_NAME = "AskMrRobot"
6
7 local VAR_VERSION = 1
6 8
7 -- types of inter-addon messages that we receive, used to parcel them out to the proper handlers 9 -- types of inter-addon messages that we receive, used to parcel them out to the proper handlers
8 Amr.MessageTypes = { 10 Amr.MessageTypes = {
9 Version = "_V", 11 Version = "_V",
10 VersionRequest = "_VR" 12 VersionRequest = "_VR"
39 41
40 42
41 -- initialize the database 43 -- initialize the database
42 local function initializeDb() 44 local function initializeDb()
43 45
46 local charDefaults = {
47 FirstUse = true, -- true if this is first time use, gets cleared after seeing the export help splash window
48 Talents = {}, -- for each spec, selected talents
49 Equipped = {}, -- for each spec, slot id to item info
50 BagItems = {}, -- list of item info for bags
51 BankItems = {}, -- list of item info for bank
52 BagItemsAndCounts = {}, -- used mainly for the shopping list
53 BankItemsAndCounts = {}, -- used mainly for the shopping list
54 GearSets = {}, -- imported gear sets
55 ExtraEnchantData = {}, -- enchant id to enchant display information and material information
56 Logging = { -- character logging settings
57 Enabled = false, -- whether logging is currently on or not
58 LastZone = nil, -- last zone the player was in
59 LastDiff = nil, -- last difficulty for the last zone the player was in
60 LastWipe = nil -- last time a wipe was called by this player
61 }
62 }
63
44 local defaults = { 64 local defaults = {
45 char = { 65 char = charDefaults,
46 FirstUse = true, -- true if this is first time use, gets cleared after seeing the export help splash window
47 Talents = {}, -- for each spec, selected talents
48 Equipped = {}, -- for each spec, slot id to item info
49 BagItems = {}, -- list of item info for bags
50 BankItems = {}, -- list of item info for bank
51 BagItemsAndCounts = {}, -- used mainly for the shopping list
52 BankItemsAndCounts = {}, -- used mainly for the shopping list
53 GearSets = {}, -- imported gear sets
54 ExtraEnchantData = {}, -- enchant id to enchant display information and material information
55 Logging = { -- character logging settings
56 Enabled = false, -- whether logging is currently on or not
57 LastZone = nil, -- last zone the player was in
58 LastDiff = nil, -- last difficulty for the last zone the player was in
59 LastWipe = nil -- last time a wipe was called by this player
60 }
61 },
62 profile = { 66 profile = {
63 minimap = { -- minimap hide/show and position settings 67 minimap = { -- minimap hide/show and position settings
64 hide = false 68 hide = false
65 }, 69 },
66 window = {}, -- main window position settings 70 window = {}, -- main window position settings
86 } 90 }
87 } 91 }
88 92
89 Amr.db = LibStub("AceDB-3.0"):New("AskMrRobotDb4", defaults) 93 Amr.db = LibStub("AceDB-3.0"):New("AskMrRobotDb4", defaults)
90 94
95 -- make sure character data is on current version
96 if not Amr.db.char.VarVersion or Amr.db.char.VarVersion ~= VAR_VERSION then
97 Amr.db.char = charDefaults
98 end
99
91 -- set defaults for auto logging; if a new zone is added and some other stuff was turned on, turn on the new zone too 100 -- set defaults for auto logging; if a new zone is added and some other stuff was turned on, turn on the new zone too
92 local hasSomeLogging = false 101 local hasSomeLogging = false
93 local addedLogging = {} 102 local addedLogging = {}
94 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do 103 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do
95 local byDiff = Amr.db.profile.Logging.Auto[instanceId] 104 local byDiff = Amr.db.profile.Logging.Auto[instanceId]