diff ICU.lua @ 4:8ec216b40ded

Added report of no missing buffs. Fixed chat filtering.
author Xiiph
date Thu, 10 Feb 2011 22:46:11 +0100
parents 43155c3c1700
children 45a45aa0f492
line wrap: on
line diff
--- a/ICU.lua	Sun Feb 06 14:07:20 2011 +0100
+++ b/ICU.lua	Thu Feb 10 22:46:11 2011 +0100
@@ -3,6 +3,9 @@
 
 local icu = LibStub("AceAddon-3.0"):NewAddon("ICU", "AceEvent-3.0", "AceTimer-3.0");
 
+-- Move global namespace to local
+local _G = _G;
+
 -- UTF8
 -- Accepted flasks
 local flaskID = {
@@ -352,7 +355,7 @@
 		
 	end
 	
-	if self.db.profile.reportResults and (#noFlask > 0 or #noFood > 0) and self.db.profile.advertiseICU and self.db.profile.reportDestination ~= "SELF" then
+	if self.db.profile.reportResults and self.db.profile.reportDestination ~= "SELF" then
 		SendChatMessage("---- "..L["ICU"].." "..L["Report"].." ----",self.db.profile.reportDestination,nil,nil);
 	end
 	
@@ -365,6 +368,12 @@
 			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 #noFood > 0 and self.db.profile.checkFood then
@@ -375,7 +384,14 @@
 			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
 	
 	noFlask, noFood, hasLowDuration = {},{},{};
@@ -440,9 +456,9 @@
 	return self.db;
 end
 
-function filterChat(self, event, msg)
+local function filterChat(self, event, msg)
 	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
+	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)