changeset 127:65c285394049 v59

Fixed an issue with reading bank data.
author yellowfive
date Tue, 17 Jul 2018 16:32:12 -0700
parents c005f9a393c1
children b16e1f4d100e
files AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc Core.lua Export.lua
diffstat 4 files changed, 38 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Tue Jul 17 09:59:18 2018 -0700
+++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Tue Jul 17 16:32:12 2018 -0700
@@ -1,6 +1,6 @@
 -- AskMrRobot-Serializer will serialize and communicate character data between users.
 
-local MAJOR, MINOR = "AskMrRobot-Serializer", 58
+local MAJOR, MINOR = "AskMrRobot-Serializer", 59
 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
 if not Amr then return end -- already loaded by something else
@@ -731,9 +731,9 @@
 				end
 	        end
 	    end
-	    if data.BankItems then
+		if data.BankItems then
 	        for i, itemData in ipairs(data.BankItems) do
-				if itemData then
+				if itemData then					
 					table.insert(itemObjects, itemData)
 				end
 	        end
--- a/AskMrRobot.toc	Tue Jul 17 09:59:18 2018 -0700
+++ b/AskMrRobot.toc	Tue Jul 17 16:32:12 2018 -0700
@@ -1,7 +1,7 @@
 ## Interface: 80000
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 58
+## Version: 59
 ## Notes: Gear import/export, combat logging, and more.
 ## URL: www.askmrrobot.com
 ## SavedVariables: AskMrRobotDb4
--- a/Core.lua	Tue Jul 17 09:59:18 2018 -0700
+++ b/Core.lua	Tue Jul 17 16:32:12 2018 -0700
@@ -4,6 +4,8 @@
 
 Amr.ADDON_NAME = "AskMrRobot"
 
+local VAR_VERSION = 1
+
 -- types of inter-addon messages that we receive, used to parcel them out to the proper handlers
 Amr.MessageTypes = {
 	Version = "_V",
@@ -41,24 +43,26 @@
 -- initialize the database
 local function initializeDb()
 
+	local charDefaults = {			
+		FirstUse = true,           -- true if this is first time use, gets cleared after seeing the export help splash window
+		Talents = {},              -- for each spec, selected talents
+		Equipped = {},             -- for each spec, slot id to item info
+		BagItems = {},             -- list of item info for bags
+		BankItems = {},            -- list of item info for bank
+		BagItemsAndCounts = {},    -- used mainly for the shopping list
+		BankItemsAndCounts = {},   -- used mainly for the shopping list			
+		GearSets = {},             -- imported gear sets
+		ExtraEnchantData = {},     -- enchant id to enchant display information and material information
+		Logging = {                -- character logging settings
+			Enabled = false,       -- whether logging is currently on or not
+			LastZone = nil,        -- last zone the player was in
+			LastDiff = nil,        -- last difficulty for the last zone the player was in
+			LastWipe = nil         -- last time a wipe was called by this player
+		}
+	}
+
 	local defaults = {
-		char = {
-			FirstUse = true,           -- true if this is first time use, gets cleared after seeing the export help splash window
-			Talents = {},              -- for each spec, selected talents
-			Equipped = {},             -- for each spec, slot id to item info
-			BagItems = {},             -- list of item info for bags
-			BankItems = {},            -- list of item info for bank
-			BagItemsAndCounts = {},    -- used mainly for the shopping list
-			BankItemsAndCounts = {},   -- used mainly for the shopping list			
-			GearSets = {},             -- imported gear sets
-			ExtraEnchantData = {},     -- enchant id to enchant display information and material information
-			Logging = {                -- character logging settings
-				Enabled = false,       -- whether logging is currently on or not
-				LastZone = nil,        -- last zone the player was in
-				LastDiff = nil,        -- last difficulty for the last zone the player was in
-				LastWipe = nil         -- last time a wipe was called by this player
-			}
-		},
+		char = charDefaults,
 		profile = {
 			minimap = {                -- minimap hide/show and position settings
 				hide = false
@@ -88,6 +92,11 @@
 	
 	Amr.db = LibStub("AceDB-3.0"):New("AskMrRobotDb4", defaults)
 	
+	-- make sure character data is on current version
+	if not Amr.db.char.VarVersion or Amr.db.char.VarVersion ~= VAR_VERSION then
+		Amr.db.char = charDefaults
+	end
+
 	-- set defaults for auto logging; if a new zone is added and some other stuff was turned on, turn on the new zone too
 	local hasSomeLogging = false
 	local addedLogging = {}
--- a/Export.lua	Tue Jul 17 09:59:18 2018 -0700
+++ b/Export.lua	Tue Jul 17 16:32:12 2018 -0700
@@ -178,10 +178,15 @@
 
 	local bankItems = {}
 	local itemsAndCounts = {}
+	
+	local bagList = {}
+	table.insert(bagList, BANK_CONTAINER)
+	table.insert(bagList, REAGENTBANK_CONTAINER)
+	for bagId = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do
+		table.insert(bagList, bagId)
+	end
 
-	scanBag(BANK_CONTAINER, true, bankItems, itemsAndCounts)
-	scanBag(REAGENTBANK_CONTAINER, true, bankItems, itemsAndCounts)
-	for bagId = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do
+	for i,bagId in ipairs(bagList) do
 		local bagItems = {}
 		local bagItemsAndCounts = {}
 		scanBag(bagId, true, bagItems, bagItemsAndCounts)