From 59d495d651bcb99ff996814631a9de15cca12ab3 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Mon, 9 Dec 2013 02:14:48 +0000 Subject: [PATCH] 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 --- OvaleAura.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 -- 1.7.9.5