r18506 - in trunk/BanzaiLib: . Banzai-1.0

0 views
Skip to first unread message

ace...@svn.wowace.com

unread,
Dec 1, 2006, 1:37:27 AM12/1/06
to clad...@gmail.com, wow...@googlegroups.com
Author: rabbit
Date: 2006-12-01 01:37:11 -0500 (Fri, 01 Dec 2006)
New Revision: 18506

Modified:
trunk/BanzaiLib/Banzai-1.0/Banzai-1.0.lua
trunk/BanzaiLib/BanzaiLib.toc
Log:
BanzaiLib: No processing done if none of the events are registered for.

Modified: trunk/BanzaiLib/Banzai-1.0/Banzai-1.0.lua
===================================================================
--- trunk/BanzaiLib/Banzai-1.0/Banzai-1.0.lua 2006-12-01 06:35:50 UTC (rev 18505)
+++ trunk/BanzaiLib/Banzai-1.0/Banzai-1.0.lua 2006-12-01 06:37:11 UTC (rev 18506)
@@ -83,12 +83,31 @@
RL = AceLibrary("RosterLib-2.0")
roster = RL.roster
playerName = UnitName("player")
- self:ScheduleRepeatingEvent("UpdateAggroList", self.UpdateAggroList, 0.2, self)
+ self:RegisterEvent("AceEvent_EventRegistered", "StartOrStop")
+ self:RegisterEvent("AceEvent_EventUnregistered", "StartOrStop")

if oldDeactivate then oldDeactivate(oldLib) end
end

-------------------------------------------------------------------------------
+-- Events
+-------------------------------------------------------------------------------
+
+function lib:StartOrStop()
+ local aceEvent = AceLibrary("AceEvent-2.0")
+ if aceEvent:IsEventRegistered("Banzai_UnitGainedAggro") or
+ aceEvent:IsEventRegistered("Banzai_PlayerGainedAggro") or
+ aceEvent:IsEventRegistered("Banzai_UnitLostAggro") or
+ aceEvent:IsEventRegistered("Banzai_PlayerLostAggro") then
+ if not self:IsEventScheduled("UpdateAggroList") then
+ self:ScheduleRepeatingEvent("UpdateAggroList", self.UpdateAggroList, 0.2, self)
+ end
+ elseif self:IsEventRegistered("UpdateAggroList") then
+ self:CancelScheduledEvent("UpdateAggroList")
+ end
+end
+
+-------------------------------------------------------------------------------
-- Library
-------------------------------------------------------------------------------

Modified: trunk/BanzaiLib/BanzaiLib.toc
===================================================================
--- trunk/BanzaiLib/BanzaiLib.toc 2006-12-01 06:35:50 UTC (rev 18505)
+++ trunk/BanzaiLib/BanzaiLib.toc 2006-12-01 06:37:11 UTC (rev 18506)
@@ -1,4 +1,4 @@
-## Interface: 11200
+## Interface: 20000
## LoadOnDemand: 1

## Title: BanzaiLib

Reply all
Reply to author
Forward
0 new messages