diff Core.lua @ 110:5021d5125484 v51

Added Tomb of Sargeras to auto-logging.
author yellowfive
date Wed, 14 Jun 2017 21:00:53 -0700
parents b8e9664d3229
children f1da233629be
line wrap: on
line diff
--- a/Core.lua	Thu Mar 30 23:41:46 2017 -0700
+++ b/Core.lua	Wed Jun 14 21:00:53 2017 -0700
@@ -112,22 +112,36 @@
 		}
 	}
 	
-	-- set defaults for auto-logging
+	Amr.db = LibStub("AceDB-3.0"):New("AskMrRobotDb3", defaults)
+	
+	-- 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 = {}
 	for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do
-		local byDiff = defaults.profile.Logging.Auto[instanceId]
+		local byDiff = Amr.db.profile.Logging.Auto[instanceId]
 		if not byDiff then
 			byDiff = {}
-			defaults.profile.Logging.Auto[instanceId] = byDiff
+			Amr.db.profile.Logging.Auto[instanceId] = byDiff
+			addedLogging[instanceId] = byDiff
 		end
 		
 		for k, difficultyId in pairs(Amr.Difficulties) do
-			if byDiff[difficultyId] == nil then
+			if not byDiff[difficultyId] then
 				byDiff[difficultyId] = false
+			else
+				hasSomeLogging = true
 			end
 		end
 	end
 	
-	Amr.db = LibStub("AceDB-3.0"):New("AskMrRobotDb3", defaults)
+	if hasSomeLogging then		
+		for instanceId, byDiff in pairs(addedLogging) do
+			for k, difficultyId in pairs(Amr.Difficulties) do
+				byDiff[difficultyId] = true
+			end
+		end
+	end
+	
 	
 	Amr.db.RegisterCallback(Amr, "OnProfileChanged", "RefreshConfig")
 	Amr.db.RegisterCallback(Amr, "OnProfileCopied", "RefreshConfig")