changeset 13:ed15bd476bbb beta

+ Added notification when checking is cancelled due to a disabled zone. Fixed a bug causing players to sometimes show as away/not ready more than once (event fire a third time if player is targeted and in your raid sub-group). Fixed chat filter for outgoing whispers sent by ICU.
author Xiiph
date Mon, 21 Feb 2011 23:58:36 +0100
parents 2d952bc9897a
children 4c6367b8e640
files ICU.lua enUS.lua
diffstat 2 files changed, 56 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/ICU.lua	Sat Feb 19 19:22:44 2011 +0100
+++ b/ICU.lua	Mon Feb 21 23:58:36 2011 +0100
@@ -46,7 +46,8 @@
 
 local minFlaskDuration = 10;
 local noFlask, noFood, hasLowDuration = {},{},{};
-local notReady, notReadyAFK, responders = {}, {}, {};
+local notReady, notReadyAFK, responders = {},{},{};
+local disabledZone = false;
 
 local defaults = {
 	profile = {
@@ -376,7 +377,8 @@
 		local currentZone = GetRealZoneText();
 		for k,v in pairs(self.db.profile.disabledZones) do
 			if currentZone == raidMap[k] and v then
-				return true 
+				disabledZone = true;
+				return true;
 			end
 		end
 	end
@@ -432,40 +434,48 @@
 function icu:announceReport(automatic)
 	SendChatMessage("---- "..L["ICU"].." "..L["Report"].." ----",self.db.profile.reportDestination,nil,nil);
 	
-	-- Check flask
-	if #noFlask > 0 and self.db.profile.checkFlask then
-		local reportFlaskMessage = L["Missing Flask"]..": " .. table.concat(noFlask, ", ");
+	-- Check if inspection got aborted due to the current zone being disabled
+	if disabledZone then
+		if self.db.profile.reportDestination == "SELF" then
+			DEFAULT_CHAT_FRAME:AddMessage(L["No checking performed, zone disabled."]);
+		else
+			SendChatMessage(L["No checking performed, zone disabled."],self.db.profile.reportDestination,nil,nil);
+		end
+	else
+		-- Check flask
+		if #noFlask > 0 and self.db.profile.checkFlask then
+			local reportFlaskMessage = L["Missing Flask"]..": " .. table.concat(noFlask, ", ");
+			
+			if self.db.profile.reportDestination == "SELF" then
+				DEFAULT_CHAT_FRAME:AddMessage(reportFlaskMessage);
+			else
+				SendChatMessage(reportFlaskMessage,self.db.profile.reportDestination,nil,nil);
+			end
+		elseif self.db.profile.checkFlask then	-- Nobody is missing a flask
+			if self.db.profile.reportDestination == "SELF" then
+				DEFAULT_CHAT_FRAME:AddMessage(L["Nobody is missing a proper flask."]);
+			else
+				SendChatMessage(L["Nobody is missing a proper flask."],self.db.profile.reportDestination,nil,nil);
+			end
+		end
 		
-		if self.db.profile.reportDestination == "SELF" then
-			DEFAULT_CHAT_FRAME:AddMessage(reportFlaskMessage);
-		else
-			SendChatMessage(reportFlaskMessage,self.db.profile.reportDestination,nil,nil);
-		end
-	elseif self.db.profile.checkFlask then	-- Nobody is missing a flask
-		if self.db.profile.reportDestination == "SELF" then
-			DEFAULT_CHAT_FRAME:AddMessage(L["Nobody is missing a proper flask."]);
-		else
-			SendChatMessage(L["Nobody is missing a proper flask."],self.db.profile.reportDestination,nil,nil);
+		-- Check food
+		if #noFood > 0 and self.db.profile.checkFood then
+			local reportFoodMessage = L["Missing Food"]..": " .. table.concat(noFood, ", ");
+			
+			if self.db.profile.reportDestination == "SELF" then
+				DEFAULT_CHAT_FRAME:AddMessage(reportFoodMessage);
+			else
+				SendChatMessage(reportFoodMessage,self.db.profile.reportDestination,nil,nil);
+			end
+		elseif self.db.profile.checkFood then	-- Nobody is missing a food buff
+			if self.db.profile.reportDestination == "SELF" then
+				DEFAULT_CHAT_FRAME:AddMessage(L["Nobody is missing a proper food buff."]);
+			else
+				SendChatMessage(L["Nobody is missing a proper food buff."],self.db.profile.reportDestination,nil,nil);
+			end
 		end
 	end
-	
-	-- Check food
-	if #noFood > 0 and self.db.profile.checkFood then
-		local reportFoodMessage = L["Missing Food"]..": " .. table.concat(noFood, ", ");
-		
-		if self.db.profile.reportDestination == "SELF" then
-			DEFAULT_CHAT_FRAME:AddMessage(reportFoodMessage);
-		else
-			SendChatMessage(reportFoodMessage,self.db.profile.reportDestination,nil,nil);
-		end
-	elseif self.db.profile.checkFood then	-- Nobody is missing a food buff
-		if self.db.profile.reportDestination == "SELF" then
-			DEFAULT_CHAT_FRAME:AddMessage(L["Nobody is missing a proper food buff."]);
-		else
-			SendChatMessage(L["Nobody is missing a proper food buff."],self.db.profile.reportDestination,nil,nil);
-		end
-	end
-	
 	-- Check ready
 	if automatic and self.db.profile.announceReadyCheck then -- Check was initialized by ready check event
 		if (#notReady > 0) or (#notReadyAFK > 0) then
@@ -508,7 +518,7 @@
 				if v == spellId then
 					hasFlask = true;
 					-- Check if low duration
-					if expirationTime and ((expirationTime-GetTime())/60) <= minFlaskDuration then
+					if expirationTime and ((expirationTime-GetTime())/60) < minFlaskDuration then
 						hasLowDuration = true;
 					end
 				end
@@ -546,6 +556,7 @@
 	wipe(notReady);
 	wipe(notReadyAFK);
 	wipe(responders);
+	disabledZone = false;
 end
 
 function icu:READY_CHECK_FINISHED()
@@ -567,12 +578,15 @@
 
 function icu:READY_CHECK_CONFIRM(event,unit,status)
 	local raider = UnitName(unit);
-	-- Seeing we only check in raids, and this event fires twice for unites in your subgroup
-	-- Such as Raid1, and Party1 == Same unit
-	-- Dont parse the party event
-	if string.match(unit,"party") then
-		return true;
-	end
+
+	--@debug@
+	print(unit);
+	--@end-debug@
+	
+	-- Check if the latest entires contain the raider... 
+	-- The event fires twice for units in your party, 
+	-- and may fire a THIRD time if you have the person targetted ...
+	if (responders[#responders] == raider or responders[#responders-1] == raider) then return end
 	
 	-- Raider is NOT afk, but might not be ready
 	responders[#responders+1] = raider;
@@ -637,5 +651,5 @@
 	local db = icu:getDB();
 	if msg == db.profile.noFoodMessage or msg == db.profile.noFlaskMessage or msg == db.profile.lowFlaskDurationMessage or msg == (L["ICU"]..": "..db.profile.noFoodMessage) or msg == (L["ICU"]..": "..db.profile.noFlaskMessage) or msg == (L["ICU"]..": "..db.profile.lowFlaskDurationMessage) then return true end
 end
-ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_ICU_INFORM", filterChat)
+ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", filterChat)
 
--- a/enUS.lua	Sat Feb 19 19:22:44 2011 +0100
+++ b/enUS.lua	Mon Feb 21 23:58:36 2011 +0100
@@ -37,6 +37,7 @@
 L["Nobody is missing a proper flask."] = true
 L["Nobody is missing a proper food buff."] = true
 L["Not Ready"] = true
+L["No checking performed, zone disabled."] = true
 L["Officer"] = true
 L["Only perform buff checks if initiated manually (via /icu check)"] = true
 L["Options"] = true