Quantcast

Generalize state:AddEclipse() to state:AddAuraToGUID().

Johnny C. Lam [11-15-13 - 19:56]
Generalize state:AddEclipse() to state:AddAuraToGUID().

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1165 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleAura.lua
OvaleEclipse.lua
diff --git a/OvaleAura.lua b/OvaleAura.lua
index 81bf982..cc40838 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -691,7 +691,7 @@ do
 				end

 				local start, ending, currentStacks, tick = state:GetAuraByGUID(guid, auraId, filter, true, target)
-				local newAura = state:NewAura(guid, auraId, filter)
+				local newAura = state:NewAura(guid, auraId, filter, OvaleState.currentTime)
 				newAura.mine = true

 				--[[
@@ -864,7 +864,7 @@ do
 		return start, ending, count
 	end

-	function statePrototype:NewAura(guid, spellId, filter)
+	function statePrototype:NewAura(guid, spellId, filter, gain)
 		local state = self
 		if not state.aura[guid] then
 			state.aura[guid] = {}
@@ -878,7 +878,7 @@ do
 		local aura = state.aura[guid][filter][spellId]
 		aura.serial = state.serial
 		aura.mine = true
-		aura.gain = OvaleState.currentTime
+		aura.gain = gain
 		return aura
 	end

@@ -944,12 +944,13 @@ do
 		end
 	end

-	-- Track a new Eclipse buff that starts at timestamp.
-	function statePrototype:AddEclipse(timestamp, spellId)
+	-- Add a new aura to the unit specified by GUID.
+	function statePrototype:AddAuraToGUID(guid, spellId, filter, mine, start, ending)
 		local state = self
-		local aura = state:NewAura(self_guid, spellId, "HELPFUL")
-		aura.start = timestamp
-		aura.ending = nil
+		local aura = state:NewAura(guid, spellId, filter, start)
+		aura.mine = mine
+		aura.start = start
+		aura.ending = ending
 		aura.stacks = 1
 	end
 end
diff --git a/OvaleEclipse.lua b/OvaleEclipse.lua
index 7615103..77c71ea 100644
--- a/OvaleEclipse.lua
+++ b/OvaleEclipse.lua
@@ -179,13 +179,13 @@ function OvaleEclipse:ApplySpellOnPlayer(state, spellId, startCast, endCast, nex
 			if eclipse <= -100 then
 				eclipse = -100
 				direction = 1
-				state:AddEclipse(endCast, LUNAR_ECLIPSE)
+				state:AddAuraToGUID(self_guid, LUNAR_ECLIPSE, "HELPFUL", true, endCast, math.huge)
 				-- Reaching Lunar Eclipse resets the cooldown of Starfall.
 				state:ResetSpellCooldown(LUNAR_ECLIPSE, endCast)
 			elseif eclipse >= 100 then
 				eclipse = 100
 				direction = -1
-				state:AddEclipse(endCast, SOLAR_ECLIPSE)
+				state:AddAuraToGUID(self_guid, SOLAR_ECLIPSE, "HELPFUL", true, endCast, math.huge)
 			end
 		end
 		state.eclipse = eclipse