changeset 51:6f1bb8fcf64d v18

AskMrRobot.toc - Added line for new SettingsTab file AskMrRobotUi.lua - Added code for new Settings menu amr-constants.lua - Added instance IDs for all WoD 6.0 5-mans and Raids. - Removed legacy SoO IDs. config.lua - Removed "Interface/Addons" options area, migrated all settings to main addon window. localization/localization.en.lua - Added new strings for new Settings tab and new Raid auto-logging ui/CombatLogTab.lua - Removed legacy SoO code - Added auto-logging settings for Highmaul and Blackrock Foundry. ui/SettingsTab.lua - new main window tab for Minimap and Auction House settings options
author TuhMuffinMan <TuhMuffinMan>
date Fri, 28 Nov 2014 13:09:52 -0600
parents af0dc99cbedb
children 57e5795c8c29
files AskMrRobot.toc AskMrRobotUi.lua amr-constants.lua config.lua localization/localization.en.lua ui/CombatLogTab.lua ui/SettingsTab.lua
diffstat 7 files changed, 160 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot.toc	Sun Nov 09 11:48:42 2014 -0800
+++ b/AskMrRobot.toc	Fri Nov 28 13:09:52 2014 -0600
@@ -50,6 +50,7 @@
 ui\ShoppingListTab.lua
 ui\GearComparisonTab.lua
 ui\CombatLogTab.lua
+ui\SettingsTab.lua
 
 AskMrRobot.xml
 
--- a/AskMrRobotUi.lua	Sun Nov 09 11:48:42 2014 -0800
+++ b/AskMrRobotUi.lua	Fri Nov 28 13:09:52 2014 -0600
@@ -6,8 +6,9 @@
 local _menuIds = {
 	export = 1,
 	gear = 2,
-	combatLog = 3,
-	help = 4    
+	settings = 3,
+	combatLog = 4,
+	help = 5    
 }
 
 function AskMrRobot.AmrUI:new()
@@ -66,6 +67,9 @@
     o.gearComparisonTab = AskMrRobot.GearComparisonTab:new(tabArea)
     o.menu[_menuIds["gear"]].element = o.gearComparisonTab
     
+	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
 
@@ -120,6 +124,7 @@
 
 	createButton(L.AMR_UI_MENU_EXPORT, -35)
 	createButton(L.AMR_UI_MENU_GEAR, -20)
+	createButton(L.AMR_UI_MENU_SETTINGS, 0)
 	createButton(L.AMR_UI_MENU_COMBAT_LOG, 0)
 	createButton(L.AMR_UI_MENU_HELP, 0)
 
--- a/amr-constants.lua	Sun Nov 09 11:48:42 2014 -0800
+++ b/amr-constants.lua	Fri Nov 28 13:09:52 2014 -0600
@@ -100,16 +100,30 @@
 end
 
 AskMrRobot.instanceIds = {
-	HeartOfFear = 1009,
-	MogushanVaults = 1008,	
-	SiegeOfOrgrimmar = 1136,
-	TerraceOfEndlessSpring = 996,
-	ThroneOfThunder = 1098
+	Auchindoun = 1182,
+	BloodmaulSlagMines = 1175,
+	GrimrailDepot = 1208,
+	IronDocks = 1195,
+	ShadowmoonBurialGrounds = 1176,
+	Skyreach = 1209,
+	TheEverbloom = 1279,
+	UpperBlackrockSpire = 1358,
+	Highmaul = 1228,
+	BlackrockFoundry = 1205
 }
 
 -- instances that we currently support logging for
 AskMrRobot.supportedInstanceIds = {
-	[1136] = true
+	[1182] = true,
+	[1175] = true,
+	[1208] = true,
+	[1195] = true,
+	[1176] = true,
+	[1209] = true,
+	[1279] = true,
+	[1358] = true,
+	[1228] = true,
+	[1205] = true
 }
 
 -- returns true if currently in a supported instance
@@ -298,4 +312,4 @@
         if a == nil and b == nil then return 0 end
         return _slotIdToOrder[a] < _slotIdToOrder[b]
     end)
-end
+end
\ No newline at end of file
--- a/config.lua	Sun Nov 09 11:48:42 2014 -0800
+++ b/config.lua	Fri Nov 28 13:09:52 2014 -0600
@@ -5,77 +5,3 @@
 local wow_500 = wow_ver >= 50000
 local UIPanelButtonTemplate = wow_500 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2"
 
-local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
-frame.name = addonName
-frame:Hide()
-
--- Credits to Ace3, Tekkub, cladhaire and Tuller for some of the widget stuff.
-
-local function newCheckbox(label, tooltipTitle, description, onClick)
-	local check = CreateFrame("CheckButton", "AmrCheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate")
-	check:SetScript("OnClick", function(self)
-		PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff")
-		onClick(self, self:GetChecked() and true or false)
-	end)
-	check.label = _G[check:GetName() .. "Text"]
-	check.label:SetText(label)
-	check.tooltipText = tooltipTitle
-	check.tooltipRequirement = description
-	return check
-end
-
-frame:SetScript("OnShow", function(frame)
-	local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
-	title:SetPoint("TOPLEFT", 16, -16)
-	title:SetText(addonName)
-
-	local subTitleWrapper = CreateFrame("Frame", nil, frame)
-	subTitleWrapper:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
-	subTitleWrapper:SetPoint("RIGHT", -16, 0)
-	local subtitle = subTitleWrapper:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
-	subtitle:SetPoint("TOPLEFT", subTitleWrapper)
-	subtitle:SetWidth(subTitleWrapper:GetRight() - subTitleWrapper:GetLeft())
-	subtitle:SetJustifyH("LEFT")
-	subtitle:SetNonSpaceWrap(false)
-	subtitle:SetJustifyV("TOP")
-	subtitle:SetText(L.AMR_CONFIG_EXIMPORT)
-	subTitleWrapper:SetHeight(subtitle:GetHeight())
-
-    -- hide minimap icon
-	local autoPopup = newCheckbox(
-		L.AMR_CONFIG_CHECKBOX_MINIMAP_LABEL,
-		L.AMR_CONFIG_CHECKBOX_MINIMAP_TOOLTIP_TITLE,
-		L.AMR_CONFIG_CHECKBOX_MINIMAP_DESCRIPTION,
-		function(self, value) 
-			if AmrDb.Options.hideMapIcon then
-				AmrDb.Options.hideMapIcon = false
-			else
-				AmrDb.Options.hideMapIcon = true
-			end
-			AskMrRobot.AmrUpdateMinimap();
-		end
-	)
-	autoPopup:SetChecked(not AmrDb.Options.hideMapIcon)
-	autoPopup:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -16)
-
-
-    -- auto-show at auction house
-	local autoAh = newCheckbox(
-		L.AMR_CONFIG_CHECKBOX_AUTOAH_LABEL,
-		L.AMR_CONFIG_CHECKBOX_AUTOAH_TOOLTIP_TITLE,
-		L.AMR_CONFIG_CHECKBOX_AUTOAH_DESCRIPTION,
-		function(self, value) 
-			if AmrDb.Options.manualShowShop then
-				AmrDb.Options.manualShowShop = false
-			else
-				AmrDb.Options.manualShowShop = true
-			end
-		end
-	)
-	autoAh:SetChecked(not AmrDb.Options.manualShowShop)
-	autoAh:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -58)
-
-	frame:SetScript("OnShow", nil)
-end)
-InterfaceOptions_AddCategory(frame)
-
--- a/localization/localization.en.lua	Sun Nov 09 11:48:42 2014 -0800
+++ b/localization/localization.en.lua	Fri Nov 28 13:09:52 2014 -0600
@@ -62,6 +62,7 @@
 --createMainMenu
 L.AMR_UI_MENU_EXPORT = "Export"
 L.AMR_UI_MENU_GEAR = "Load a Gear Set"
+L.AMR_UI_MENU_SETTINGS = "Settings"
 L.AMR_UI_MENU_COMBAT_LOG = "Combat Log"
 L.AMR_UI_MENU_HELP = "Help"
 
@@ -90,13 +91,17 @@
 
 --dir ui
 --ui/CombatLogTab.lua
+L.AMR_SETTINGSTAB_SETTINGS = "Settings"
 L.AMR_COMBATLOGTAB_COMBAT_LOGGING = "Combat Logging"
 L.AMR_COMBATLOGTAB_START_LOGGING = "Start Logging"
 L.AMR_COMBATLOGTAB_CURRENTLY_LOGGING = "|c0000ff00Currently Logging|r"
 L.AMR_COMBATLOGTAB_STOP_LOGGING = "Stop Logging"
-L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_LABEL = "Always log Siege of Orgrimmar"
-L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_TOOLTIP_TITLE = "Auto-Log Siege of Orgrimmar"
-L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_DESCRIPTION =  "Automatically start logging when you enter SoO and stop when you leave SoO.\n\nNote that you should disable similar features in other addons to avoid conflicts."
+L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_HM_LABEL = "Always log Highmaul"
+L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_HM_TOOLTIP_TITLE = "Auto-Log Highmaul"
+L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_HM_DESCRIPTION =  "Automatically start logging when you enter Highmaul and stop when you leave Highmaul.\n\nNote that you should disable similar features in other addons to avoid conflicts."
+L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_BRF_LABEL = "Always log Blackrock Foundry"
+L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_BRF_TOOLTIP_TITLE = "Auto-Log Blackrock Foundry"
+L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_BRF_DESCRIPTION =  "Automatically start logging when you enter Blackrock Foundry and stop when you leave Blackrock Foundry.\n\nNote that you should disable similar features in other addons to avoid conflicts."
 L.AMR_COMBATLOGTAB_HEADLINE_OVER_BUTTON = "Save Characters"
 L.AMR_COMBATLOGTAB_SAVE_CHARACTER = "Save Character Data"
 L.AMR_COMBATLOGTAB_INSTRUCTIONS = "INSTRUCTIONS"
--- a/ui/CombatLogTab.lua	Sun Nov 09 11:48:42 2014 -0800
+++ b/ui/CombatLogTab.lua	Fri Nov 28 13:09:52 2014 -0600
@@ -82,15 +82,15 @@
 	text:SetPoint("LEFT", btn, "RIGHT", 10, 0)
 	tab.loggingStatus = text;
 
-	local autoChk = newCheckbox(content,
-		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_LABEL,
-		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_TOOLTIP_TITLE,
-		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_DESCRIPTION,
+	local hmAutoChk = newCheckbox(content,
+		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_HM_LABEL,
+		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_HM_TOOLTIP_TITLE,
+		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_HM_DESCRIPTION,
 		function(self, value) 
 			if value then
-				AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "enabled"
+				AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] = "enabled"
 			else
-				AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled" 
+				AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] = "disabled" 
 			end
 
 			AmrDb.LogData._lastZone = nil
@@ -98,14 +98,33 @@
 			tab:UpdateAutoLogging()
 		end
 	)
-	autoChk:SetChecked(AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled")
-	autoChk:SetPoint("TOPLEFT", btn, "BOTTOMLEFT", 0, -10)
-    autoChk:SetHeight(30)
+	hmAutoChk:SetChecked(AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] == "enabled")
+	hmAutoChk:SetPoint("TOPLEFT", btn, "BOTTOMLEFT", 0, -10)
+    hmAutoChk:SetHeight(30)
+	
+	local brfAutoChk = newCheckbox(content,
+		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_BRF_LABEL,
+		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_BRF_TOOLTIP_TITLE,
+		L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_BRF_DESCRIPTION,
+		function(self, value) 
+			if value then
+				AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] = "enabled"
+			else
+				AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] = "disabled" 
+			end
 
+			AmrDb.LogData._lastZone = nil
+			AmrDb.LogData._lastDiff = nil
+			tab:UpdateAutoLogging()
+		end
+	)
+	brfAutoChk:SetChecked(AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] == "enabled")
+	brfAutoChk:SetPoint("TOPLEFT", hmAutoChk, "BOTTOMLEFT", 0, -10)
+    brfAutoChk:SetHeight(30)	
 
-	local text = CreateText(content, "GameFontNormalLarge", autoChk, 0, -20, L.AMR_COMBATLOGTAB_INFIGHT)
+	local text = CreateText(content, "GameFontNormalLarge", brfAutoChk, 0, -20, L.AMR_COMBATLOGTAB_INFIGHT)
 
-    btn = CreateFrame("Button", "AmrCombatLogWipe", autoChk, "UIPanelButtonTemplate")
+    btn = CreateFrame("Button", "AmrCombatLogWipe", brfAutoChk, "UIPanelButtonTemplate")
 	btn:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -10)
 	btn:SetText("Wipe")
 	btn:SetWidth(70)
@@ -182,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.SiegeOfOrgrimmar] == "enabled" then
+	if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] == "enabled" or  AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] == "enabled" then
 		tab:UpdateAutoLogging()
 	end
 
@@ -364,8 +383,8 @@
 	AmrDb.LogData._lastZone = zone
 	AmrDb.LogData._lastDiff = difficultyIndex
 
-	if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled" then
-		if tonumber(instanceMapID) == AskMrRobot.instanceIds.SiegeOfOrgrimmar then
+	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 not AskMrRobot.CombatLogTab.IsLogging() then
 				self:StartLogging()
@@ -419,9 +438,12 @@
 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.SiegeOfOrgrimmar] then 
-		AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled" 
+	if not AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] then 
+		AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] = "disabled" 
 	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
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/SettingsTab.lua	Fri Nov 28 13:09:52 2014 -0600
@@ -0,0 +1,85 @@
+local _, AskMrRobot = ...
+local L = AskMrRobot.L;
+
+-- initialize the CombatLogTab class
+AskMrRobot.SettingsTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
+
+-- helper to create text for this tab
+local function CreateText(tab, font, relativeTo, xOffset, yOffset, text)
+    local t = tab:CreateFontString(nil, "ARTWORK", font)
+	t:SetPoint("TOPLEFT", relativeTo, "BOTTOMLEFT", xOffset, yOffset)
+	t:SetPoint("RIGHT", tab, "RIGHT", -5, 0)
+	t:SetWidth(t:GetWidth())
+	t:SetJustifyH("LEFT")
+	t:SetText(text)
+    
+    return t
+end
+
+local function newCheckbox(tab, label, tooltipTitle, description, onClick)
+	local check = CreateFrame("CheckButton", "AmrCheck" .. label, tab, "InterfaceOptionsCheckButtonTemplate")
+	check:SetScript("OnClick", function(self)
+		PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff")
+		onClick(self, self:GetChecked() and true or false)
+	end)
+	check.label = _G[check:GetName() .. "Text"]
+	check.label:SetText(label)
+	check.tooltipText = tooltipTitle
+	check.tooltipRequirement = description
+	return check
+end
+
+function AskMrRobot.SettingsTab:new(parent)
+
+	local tab = AskMrRobot.Frame:new(nil, parent)
+	setmetatable(tab, { __index = AskMrRobot.SettingsTab })
+	tab:SetPoint("TOPLEFT")
+	tab:SetPoint("BOTTOMRIGHT")
+	tab:Hide()
+
+	-- tab header
+	local text = tab:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
+	text:SetPoint("TOPLEFT", 0, -5)
+	text:SetText(L.AMR_SETTINGSTAB_SETTINGS)
+
+	--scrollframe 
+	tab.scrollframe = AskMrRobot.ScrollFrame:new(nil, tab)
+	tab.scrollframe:SetPoint("TOPLEFT", tab, "TOPLEFT", 0, -30)
+	tab.scrollframe:SetPoint("BOTTOMRIGHT", tab, "BOTTOMRIGHT", -30, 10)
+
+	local content = tab.scrollframe.content
+	content:SetHeight(730)
+	
+	local autoPopup = newCheckbox(content,
+		L.AMR_CONFIG_CHECKBOX_MINIMAP_LABEL,
+		L.AMR_CONFIG_CHECKBOX_MINIMAP_TOOLTIP_TITLE,
+		L.AMR_CONFIG_CHECKBOX_MINIMAP_DESCRIPTION,
+		function(self, value) 
+			if AmrDb.Options.hideMapIcon then
+				AmrDb.Options.hideMapIcon = false
+			else
+				AmrDb.Options.hideMapIcon = true
+			end
+			AskMrRobot.AmrUpdateMinimap();
+		end
+	)
+	autoPopup:SetChecked(not AmrDb.Options.hideMapIcon)
+	autoPopup:SetPoint("TOPLEFT", content, "TOPLEFT", 0, 0)	
+	
+	local autoAh = newCheckbox(content,
+		L.AMR_CONFIG_CHECKBOX_AUTOAH_LABEL,
+		L.AMR_CONFIG_CHECKBOX_AUTOAH_TOOLTIP_TITLE,
+		L.AMR_CONFIG_CHECKBOX_AUTOAH_DESCRIPTION,
+		function(self, value) 
+			if AmrDb.Options.manualShowShop then
+				AmrDb.Options.manualShowShop = false
+			else
+				AmrDb.Options.manualShowShop = true
+			end
+		end
+	)
+	autoAh:SetChecked(not AmrDb.Options.manualShowShop)
+	autoAh:SetPoint("TOPLEFT", autoPopup, "BOTTOMLEFT", 0, -10)	
+
+    return tab
+end
\ No newline at end of file