Johnny C. Lam [11-26-13 - 14:05]
diff --git a/OvaleAura.lua b/OvaleAura.lua
index 270ebcb..aee9d36 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -211,20 +211,28 @@ end
function OvaleAura:OnEnable()
self_guid = API_UnitGUID("player")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
- self:RegisterEvent("PLAYER_ENTERING_WORLD")
- self:RegisterEvent("PLAYER_REGEN_ENABLED", "Cleanup")
+ self:RegisterEvent("PLAYER_ALIVE")
+ self:RegisterEvent("PLAYER_ENTERING_WORLD", "ScanAllUnitAuras")
+ self:RegisterEvent("PLAYER_REGEN_ENABLED")
+ self:RegisterEvent("PLAYER_UNGHOST", "PLAYER_ALIVE")
self:RegisterEvent("UNIT_AURA")
- self:RegisterMessage("Ovale_GroupChanged", "Cleanup")
+ self:RegisterMessage("Ovale_GroupChanged", "RemoveAurasOnInactiveUnits")
OvaleState:RegisterState(self, self.statePrototype)
end
function OvaleAura:OnDisable()
OvaleState:UnregisterState(self)
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
+ self:UnregisterEvent("PLAYER_ALIVE")
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
+ self:UnregisterEvent("PLAYER_UNGHOST")
self:UnregisterEvent("UNIT_AURA")
self:UnregisterMessage("Ovale_GroupChanged")
+ for guid in pairs(self_aura) do
+ RemoveAurasOnGUID(self_aura, guid)
+ end
+ self_pool:Drain()
end
function OvaleAura:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
@@ -263,25 +271,30 @@ function OvaleAura:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
end
end
-function OvaleAura:PLAYER_ENTERING_WORLD(event)
- Ovale:DebugPrint(OVALE_AURA_DEBUG, event)
- -- Update auras on all visible units.
- for unitId in pairs(OvaleGUID.UNIT_AURA_UNITS) do
- self:UNIT_AURA(event, unitId)
- end
- self:Cleanup()
+function OvaleAura:PLAYER_ALIVE(event)
+ Ovale:DebugPrintf(OVALE_AURA_DEBUG, "%s", event)
+ self:ScanAurasOnGUID(self_guid)
+end
+
+function OvaleAura:PLAYER_REGEN_ENABLED(event)
+ self:RemoveAurasOnInactiveUnits()
+ self_pool:Drain()
end
function OvaleAura:UNIT_AURA(event, unitId)
Ovale:DebugPrintf(OVALE_AURA_DEBUG, "%s: %s", event, unitId)
- local guid = OvaleGUID:GetGUID(unitId)
- if guid then
- self:ScanAurasOnGUID(guid)
+ self:ScanAuras(unitId)
+end
+
+function OvaleAura:ScanAllUnitAuras()
+ -- Update auras on all visible units.
+ for unitId in pairs(OvaleGUID.UNIT_AURA_UNITS) do
+ self:ScanAuras(unitId)
end
end
-function OvaleAura:Cleanup()
- -- Rmove all auras from GUIDs that can no longer be referenced by a unit ID,
+function OvaleAura:RemoveAurasOnInactiveUnits()
+ -- Remove all auras from GUIDs that can no longer be referenced by a unit ID,
-- i.e., not in the group or not targeted by anyone in the group or focus.
for guid in pairs(self_aura) do
local unitId = OvaleGUID:GetUnitId(guid)
@@ -290,7 +303,6 @@ function OvaleAura:Cleanup()
self_serial[guid] = nil
end
end
- self_pool:Drain()
end
function OvaleAura:IsActiveAura(aura, now)
@@ -446,6 +458,13 @@ function OvaleAura:ScanAurasOnGUID(guid)
end
end
+function OvaleAura:ScanAuras(unitId)
+ local guid = OvaleGUID:GetGUID(unitId)
+ if guid then
+ return self:ScanAurasOnGUID(guid)
+ end
+end
+
function OvaleAura:GetAuraByGUID(guid, spellId, filter, mine)
-- If this GUID has no auras in the database, then do an aura scan.
if not self_serial[guid] then
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 2f7f731..5706ddc 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -857,6 +857,7 @@ function OvaleCompile:OnInitialize()
end
function OvaleCompile:OnEnable()
+ self:RegisterMessage("PLAYER_REGEN_ENABLED")
self:RegisterMessage("Ovale_CheckBoxValueChanged", "EventHandler")
self:RegisterMessage("Ovale_EquipmentChanged")
self:RegisterMessage("Ovale_GlyphsChanged", "EventHandler")
@@ -879,9 +880,8 @@ function OvaleCompile:OnDisable()
self_pool:Drain()
end
-function OvaleCompile:EventHandler(event)
- Ovale:DebugPrint(OVALE_COMPILE_DEBUG, event)
- self:Compile()
+function OvaleCompile:PLAYER_REGEN_ENABLED(event)
+ self_pool:Drain()
end
function OvaleCompile:Ovale_EquipmentChanged(event)
@@ -896,6 +896,11 @@ function OvaleCompile:Ovale_StanceChanged(event)
end
end
+function OvaleCompile:EventHandler(event)
+ Ovale:DebugPrint(OVALE_COMPILE_DEBUG, event)
+ self:Compile()
+end
+
function OvaleCompile:Compile()
local profile = OvaleOptions:GetProfile()
local source = profile.source
diff --git a/OvaleDamageTaken.lua b/OvaleDamageTaken.lua
index e9eedbd..910302d 100644
--- a/OvaleDamageTaken.lua
+++ b/OvaleDamageTaken.lua
@@ -62,6 +62,7 @@ end
function OvaleDamageTaken:OnDisable()
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
+ self_pool:Drain()
end
function OvaleDamageTaken:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
diff --git a/OvaleFuture.lua b/OvaleFuture.lua
index 55ac872..8720435 100644
--- a/OvaleFuture.lua
+++ b/OvaleFuture.lua
@@ -287,6 +287,7 @@ function OvaleFuture:OnEnable()
self_guid = API_UnitGUID("player")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
+ self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
@@ -302,6 +303,7 @@ function OvaleFuture:OnDisable()
OvaleState:UnregisterState(self)
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
+ self:UnregisterEvent("PLAYER_REGEN_ENABLED")
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START")
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED")
@@ -310,6 +312,8 @@ function OvaleFuture:OnDisable()
self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
self:UnregisterMessage("Ovale_AuraAdded")
self:UnregisterMessage("Ovale_InactiveUnit")
+ self:PLAYER_ENTERING_WORLD("OnDisable")
+ self_pool:Drain()
end
function OvaleFuture:PLAYER_ENTERING_WORLD(event)
@@ -319,6 +323,10 @@ function OvaleFuture:PLAYER_ENTERING_WORLD(event)
end
end
+function OvaleFuture:PLAYER_REGEN_ENABLED(event)
+ self_pool:Drain()
+end
+
function OvaleFuture:Ovale_AuraAdded(event, timestamp, guid, spellId, caster)
if guid == self_guid then
self_timeAuraAdded = timestamp
diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua
index 4156473..9e1692c 100644
--- a/OvalePaperDoll.lua
+++ b/OvalePaperDoll.lua
@@ -197,6 +197,7 @@ function OvalePaperDoll:OnDisable()
self:UnregisterEvent("UNIT_STATS")
self:UnregisterMessage("Ovale_EquipmentChanged")
self:UnregisterMessage("Ovale_StanceChanged")
+ self_pool:Drain()
end
function OvalePaperDoll:COMBAT_RATING_UPDATE(event)