changeset 53:be5dc6c02f77 v19

minor tweaks for combat logging
author yellowfive
date Tue, 02 Dec 2014 16:57:32 -0800
parents 57e5795c8c29
children 54614dcd56b5
files AskMrRobot.toc AskMrRobotUi.lua amr-constants.lua config.lua ui/CombatLogTab.lua
diffstat 5 files changed, 46 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot.toc	Fri Nov 28 13:12:01 2014 -0600
+++ b/AskMrRobot.toc	Tue Dec 02 16:57:32 2014 -0800
@@ -1,7 +1,7 @@
 ## Interface: 60000
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 17
+## Version: 19
 ## Notes: Exports/Imports data to/from askmrrobot.com.
 ## URL: www.askmrrobot.com
 ## DefaultState: Enabled
@@ -30,7 +30,6 @@
 ui\Components.lua
 amr-constants.lua
 AskMrRobot.lua
-config.lua
 AskMrRobotUi.lua
 ui\RobotStamp.lua
 ui\ItemTooltipFrame.lua
--- a/AskMrRobotUi.lua	Fri Nov 28 13:12:01 2014 -0600
+++ b/AskMrRobotUi.lua	Tue Dec 02 16:57:32 2014 -0800
@@ -6,8 +6,8 @@
 local _menuIds = {
 	export = 1,
 	gear = 2,
-	settings = 3,
-	combatLog = 4,
+	combatLog = 3,
+	settings = 4,
 	help = 5    
 }
 
@@ -67,12 +67,12 @@
     o.gearComparisonTab = AskMrRobot.GearComparisonTab:new(tabArea)
     o.menu[_menuIds["gear"]].element = o.gearComparisonTab
     
+    o.combatLogTab = AskMrRobot.CombatLogTab:new(tabArea)
+    o.menu[_menuIds["combatLog"]].element = o.combatLogTab
+
 	o.settingsTab = AskMrRobot.SettingsTab:new(tabArea)
     o.menu[_menuIds["settings"]].element = o.settingsTab	
 	
-    o.combatLogTab = AskMrRobot.CombatLogTab:new(tabArea)
-    o.menu[_menuIds["combatLog"]].element = o.combatLogTab
-
     o.helpTab = AskMrRobot.HelpTab:new(tabArea)
     o.menu[_menuIds["help"]].element = o.helpTab
     
@@ -124,8 +124,8 @@
 
 	createButton(L.AMR_UI_MENU_EXPORT, -35)
 	createButton(L.AMR_UI_MENU_GEAR, -20)
+	createButton(L.AMR_UI_MENU_COMBAT_LOG, 0)
 	createButton(L.AMR_UI_MENU_SETTINGS, 0)
-	createButton(L.AMR_UI_MENU_COMBAT_LOG, 0)
 	createButton(L.AMR_UI_MENU_HELP, 0)
 
 	return buttons
--- a/amr-constants.lua	Fri Nov 28 13:12:01 2014 -0600
+++ b/amr-constants.lua	Tue Dec 02 16:57:32 2014 -0800
@@ -114,14 +114,14 @@
 
 -- instances that we currently support logging for
 AskMrRobot.supportedInstanceIds = {
-	[1182] = true,
-	[1175] = true,
-	[1208] = true,
-	[1195] = true,
-	[1176] = true,
-	[1209] = true,
-	[1279] = true,
-	[1358] = true,
+	--[1182] = true,
+	--[1175] = true,
+	--[1208] = true,
+	--[1195] = true,
+	--[1176] = true,
+	--[1209] = true,
+	--[1279] = true,
+	--[1358] = true,
 	[1228] = true,
 	[1205] = true
 }
@@ -137,6 +137,14 @@
 	end
 end
 
+function AskMrRobot.IsSupportedInstanceId(instanceMapID)
+	if AskMrRobot.supportedInstanceIds[tonumber(instanceMapID)] then
+		return true
+	else
+		return false
+	end
+end
+
 AskMrRobot.regionNames = {
 	[1] = "US",
 	[2] = "KR",
--- a/config.lua	Fri Nov 28 13:12:01 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-local addonName, AskMrRobot = ...
-local L = AskMrRobot.L
-
-local wow_ver = select(4, GetBuildInfo())
-local wow_500 = wow_ver >= 50000
-local UIPanelButtonTemplate = wow_500 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2"
-
--- a/ui/CombatLogTab.lua	Fri Nov 28 13:12:01 2014 -0600
+++ b/ui/CombatLogTab.lua	Tue Dec 02 16:57:32 2014 -0800
@@ -201,7 +201,7 @@
     end
     
 	-- if auto-logging is enabled, do a check when the addon is loaded to make sure that state is set correctly
-	if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] == "enabled" or  AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] == "enabled" then
+	if tab:IsAutoLoggingEnabled() then
 		tab:UpdateAutoLogging()
 	end
 
@@ -363,6 +363,17 @@
 
 end
 
+-- returns true if any auto-logging options are enabled
+function AskMrRobot.CombatLogTab:IsAutoLoggingEnabled()
+	-- see if any auto-logging is enabled
+	for k,v in pairs(AmrDb.LogData._autoLog) do
+		if v == "enabled" then
+			return true
+		end
+	end
+	return false
+end
+
 -- called to update logging state when auto-logging is enabled
 function AskMrRobot.CombatLogTab:UpdateAutoLogging()
 
@@ -383,14 +394,15 @@
 	AmrDb.LogData._lastZone = zone
 	AmrDb.LogData._lastDiff = difficultyIndex
 
-	if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] == "enabled"  or AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] == "enabled"  then
-		if tonumber(instanceMapID) == AskMrRobot.instanceIds.Highmaul or tonumber(instanceMapID) == AskMrRobot.instanceIds.BlackrockFoundry then
-			-- if in SoO, make sure logging is on
+	if self:IsAutoLoggingEnabled() then
+		if AskMrRobot.IsSupportedInstanceId(instanceMapID) and AmrDb.LogData._autoLog[tonumber(instanceMapID)] == "enabled" then
+			-- we are in a supported zone that we want to auto-log, turn logging on 
+			-- (supported check is probably redundant, but just in case someone has old settings lying around)
 			if not AskMrRobot.CombatLogTab.IsLogging() then
 				self:StartLogging()
 			end
 		else
-			-- not in SoO, turn logging off
+			-- not in a zone that we want to auto-log, turn logging off
 			if AskMrRobot.CombatLogTab.IsLogging() then
 				self:StopLogging()
 			end
@@ -438,12 +450,13 @@
 function AskMrRobot.CombatLogTab.InitializeVariable()
     if not AmrDb.LogData then AmrDb.LogData = {} end
 	if not AmrDb.LogData._autoLog then AmrDb.LogData._autoLog = {} end
-	if not AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] then 
-		AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] = "disabled" 
+	
+	for k,v in pairs(AskMrRobot.supportedInstanceIds) do
+		if not AmrDb.LogData._autoLog[k] then
+			AmrDb.LogData._autoLog[k] = "disabled"
+		end
 	end
-	if not AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] then 
-		AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] = "disabled" 
-	end	
+	
 	AmrDb.LogData._wipes = AmrDb.LogData._wipes or {}
 end