comparison 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
comparison
equal deleted inserted replaced
3:43155c3c1700 4:8ec216b40ded
1 local L = LibStub("AceLocale-3.0"):GetLocale("ICU") 1 local L = LibStub("AceLocale-3.0"):GetLocale("ICU")
2 if not L then return end 2 if not L then return end
3 3
4 local icu = LibStub("AceAddon-3.0"):NewAddon("ICU", "AceEvent-3.0", "AceTimer-3.0"); 4 local icu = LibStub("AceAddon-3.0"):NewAddon("ICU", "AceEvent-3.0", "AceTimer-3.0");
5
6 -- Move global namespace to local
7 local _G = _G;
5 8
6 -- UTF8 9 -- UTF8
7 -- Accepted flasks 10 -- Accepted flasks
8 local flaskID = { 11 local flaskID = {
9 79469, -- Flask of Steelskin 12 79469, -- Flask of Steelskin
350 end 353 end
351 end 354 end
352 355
353 end 356 end
354 357
355 if self.db.profile.reportResults and (#noFlask > 0 or #noFood > 0) and self.db.profile.advertiseICU and self.db.profile.reportDestination ~= "SELF" then 358 if self.db.profile.reportResults and self.db.profile.reportDestination ~= "SELF" then
356 SendChatMessage("---- "..L["ICU"].." "..L["Report"].." ----",self.db.profile.reportDestination,nil,nil); 359 SendChatMessage("---- "..L["ICU"].." "..L["Report"].." ----",self.db.profile.reportDestination,nil,nil);
357 end 360 end
358 361
359 if self.db.profile.reportResults then 362 if self.db.profile.reportResults then
360 if #noFlask > 0 and self.db.profile.checkFlask then 363 if #noFlask > 0 and self.db.profile.checkFlask then
362 365
363 if self.db.profile.reportDestination == "SELF" then 366 if self.db.profile.reportDestination == "SELF" then
364 DEFAULT_CHAT_FRAME:AddMessage(reportFlaskMessage); 367 DEFAULT_CHAT_FRAME:AddMessage(reportFlaskMessage);
365 else 368 else
366 SendChatMessage(reportFlaskMessage,self.db.profile.reportDestination,nil,nil); 369 SendChatMessage(reportFlaskMessage,self.db.profile.reportDestination,nil,nil);
370 end
371 elseif self.db.profile.checkFlask then -- Nobody is missing a flask
372 if self.db.profile.reportDestination == "SELF" then
373 DEFAULT_CHAT_FRAME:AddMessage(L["Nobody is missing a proper flask."]);
374 else
375 SendChatMessage(L["Nobody is missing a proper flask."],self.db.profile.reportDestination,nil,nil);
367 end 376 end
368 end 377 end
369 378
370 if #noFood > 0 and self.db.profile.checkFood then 379 if #noFood > 0 and self.db.profile.checkFood then
371 local reportFoodMessage = L["Missing Food"]..": " .. table.concat(noFood, ", "); 380 local reportFoodMessage = L["Missing Food"]..": " .. table.concat(noFood, ", ");
373 if self.db.profile.reportDestination == "SELF" then 382 if self.db.profile.reportDestination == "SELF" then
374 DEFAULT_CHAT_FRAME:AddMessage(reportFoodMessage); 383 DEFAULT_CHAT_FRAME:AddMessage(reportFoodMessage);
375 else 384 else
376 SendChatMessage(reportFoodMessage,self.db.profile.reportDestination,nil,nil); 385 SendChatMessage(reportFoodMessage,self.db.profile.reportDestination,nil,nil);
377 end 386 end
387 elseif self.db.profile.checkFood then -- Nobody is missing a food buff
388 if self.db.profile.reportDestination == "SELF" then
389 DEFAULT_CHAT_FRAME:AddMessage(L["Nobody is missing a proper food buff."]);
390 else
391 SendChatMessage(L["Nobody is missing a proper food buff."],self.db.profile.reportDestination,nil,nil);
392 end
378 end 393 end
394
379 end 395 end
380 396
381 noFlask, noFood, hasLowDuration = {},{},{}; 397 noFlask, noFood, hasLowDuration = {},{},{};
382 end 398 end
383 399
438 454
439 function icu:getDB() 455 function icu:getDB()
440 return self.db; 456 return self.db;
441 end 457 end
442 458
443 function filterChat(self, event, msg) 459 local function filterChat(self, event, msg)
444 local db = icu:getDB(); 460 local db = icu:getDB();
445 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 461 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
446 end 462 end
447 ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_ICU_INFORM", filterChat) 463 ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_ICU_INFORM", filterChat)
448 464
449 icu:RegisterEvent("READY_CHECK"); 465 icu:RegisterEvent("READY_CHECK");
450 466