Add state method to remove an aura on a GUID.
Johnny C. Lam [12-09-13 - 02:14]
Add state method to remove an aura on a GUID.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1247 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleAura.lua b/OvaleAura.lua
index ead75ac..1b9b821 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -963,6 +963,33 @@ statePrototype.AddAuraToGUID = function(state, guid, auraId, casterGUID, filter,
return aura
end
+-- Remove an aura from the unit specified by GUID.
+statePrototype.RemoveAuraOnGUID = function(state, guid, auraId, filter, mine, atTime)
+ local auraFound = state:GetAuraByGUID(guid, auraId, filter, mine)
+ if state:IsActiveAura(auraFound, atTime) then
+ local aura
+ if auraFound.state then
+ -- Re-use existing aura in the simulator.
+ aura = auraFound
+ else
+ -- Add an aura in the simulator and copy the existing aura information over.
+ aura = state:AddAuraToGUID(guid, auraId, auraFound.source, filter, 0, math.huge)
+ for k, v in pairs(auraFound) do
+ aura[k] = v
+ end
+ if auraFound.snapshot then
+ aura.snapshot = OvalePaperDoll:GetSnapshot(auraFound.snapshot)
+ end
+ -- Reset the aura age relative to the state of the simulator.
+ aura.serial = state.serial
+ end
+
+ -- Expire the aura.
+ aura.stacks = 0
+ aura.ending = atTime
+ end
+end
+
statePrototype.GetStealable = function(state, unitId)
local count = 0
local start, ending = math.huge, 0