changeset 3:43155c3c1700

Fixes to the zone check feature
author Xiiph
date Sun, 06 Feb 2011 14:07:20 +0100
parents e883b490ff93
children 8ec216b40ded
files ICU.lua enUS.lua
diffstat 2 files changed, 49 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ICU.lua	Sat Feb 05 21:31:50 2011 +0100
+++ b/ICU.lua	Sun Feb 06 14:07:20 2011 +0100
@@ -44,6 +44,7 @@
 		noFlaskMessage = L["Flask reminder!"],
 		lowFlaskDurationMessage = L["Your Flask runs out in less than 10 minutes!"],
 		disabledZones = {},
+		enableAllZones = true,
 	}
 }
 
@@ -62,9 +63,9 @@
 	AceConfig:RegisterOptionsTable("ICU", self.options, {"icu"})
 	
 	AceConfigDialog:AddToBlizOptions("ICU", nil, nil, "general")
-	AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile")
 	AceConfigDialog:AddToBlizOptions("ICU", "Whispers","ICU","messages")
 	AceConfigDialog:AddToBlizOptions("ICU", "Disabled Zones","ICU","zones")
+	AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile")
 end
 
 function icu:refreshConfig()
@@ -222,8 +223,12 @@
 			zones = {
 				name = L["Disabled Zones"],
 				type = 'group',
-				set = function(i,v) self.db.profile.disabledZones[i[#i]] = v end,
-				get = function(i) return self.db.profile.disabledZones[i[#i]] end,
+				set = 	function(i,v)
+							self.db.profile.disabledZones[i[#i]] = v;
+						end,
+				get = 	function(i)
+							return self.db.profile.disabledZones[i[#i]];
+						end,
 				args = {
 					help = {
 						type = 'description',
@@ -231,26 +236,57 @@
 						width = 'full',
 						order = 0,
 					},
+					breakOne = {
+						type = 'description',
+						name = '',
+						order = 1,
+						width = 'full',
+					},
+					enableAllZones = {
+						type = 'toggle',
+						name = L["Enable ICU in all zones"],
+						order = 2,
+						width = 'full',
+						set = 	function (i,v) 
+									self.db.profile.enableAllZones = v;
+									self.options.args.zones.args.bwd.disabled = v;
+									self.options.args.zones.args.bot.disabled = v;
+									self.options.args.zones.args.tfw.disabled = v;
+									self.options.args.zones.args.bh.disabled = v;
+								end,
+						get = function (i) return self.db.profile.enableAllZones end,
+					},
+					breakTwo = {
+						type = 'description',
+						name = '',
+						order = 3,
+						width = 'full',
+					},
 					bwd = {
 						type = 'toggle',
 						name = L["Blackwing Descent"],
 						width = 'double',
+						disabled = self.db.profile.enableAllZones,
 					},
 					bot = {
 						type = 'toggle',
 						name = L["Bastion of Twilight"],
 						width = 'double',
+						disabled = self.db.profile.enableAllZones,
 					},
 					tfw = {
 						type = 'toggle',
 						name = L["Throne of the Four Winds"],
 						width = 'double',
+						disabled = self.db.profile.enableAllZones,
 					},
 					bh = {
 						type = 'toggle',
 						name = L["Baradin Hold"],
 						width = 'double',
+						disabled = self.db.profile.enableAllZones,
 					},
+
 				}
 			},
 			profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db),
@@ -261,17 +297,22 @@
 
 function icu:inspectRaid(silent,automatic)
 	-- Check if any zones have been disabled
-	if #self.db.profile.disabledZones > 0 and automatic then
+	if automatic and not self.db.profile.enableAllZones then
 		local currentZone = GetRealZoneText();
 		
 		for i = 1, #self.db.profile.disabledZones do
-			if currentZone == self.db.profile.disabledZones[i] then return true end
+			if currentZone == self.db.profile.disabledZones[i] and self.db.profile.disabledZones[i] then 
+				--@debug@
+				print(currentZone,self.db.profile.disabledZones[i],"Cancelling ICU inspection");
+				--@end-debug@
+				return true 
+			end
 		end	
 	end
 	
-	-- Not in a raid group
 	local icuAd = "";
 	
+	-- Not in a raid group
 	if GetNumRaidMembers() == 0 then
 		return true
 	end
--- a/enUS.lua	Sat Feb 05 21:31:50 2011 +0100
+++ b/enUS.lua	Sun Feb 06 14:07:20 2011 +0100
@@ -66,6 +66,8 @@
 
 -- Zones
 L['Toggle ICU automatic checking |cffcc0000off|r in the selected zones.'] = true
+L["Enable ICU in all zones"] = true
+
 L["Blackwing Descent"] = true
 L["Baradin Hold"] = true
 L["Throne of the Four Winds"] = true