/// <summary> /// Will be called internally to close this Channel. /// Call SpellCast.Cancel to cancel channeling. /// </summary> internal void Close(bool cancelled) { if (!m_channeling) { return; } m_channeling = false; var caster = m_cast.CasterUnit; var handlers = m_channelHandlers; foreach (var handler in handlers) { handler.OnChannelClose(cancelled); } var auras = m_auras; if (auras != null) { foreach (var aura in auras) { aura.Remove(false); } auras.Clear(); SpellCast.AuraListPool.Recycle(auras); m_auras = null; } m_channelHandlers.Clear(); SpellCast.SpellEffectHandlerListPool.Recycle(m_channelHandlers); m_channelHandlers = null; m_timer.Stop(); if (cancelled) { SpellHandler.SendChannelUpdate(m_cast, 0); } var obj = caster.ChannelObject; if (obj is DynamicObject) { ((WorldObject)obj).Delete(); } caster.ChannelObject = null; caster.ChannelSpell = 0; }
/// <summary> /// Will be called internally to close this Channel. /// Call SpellCast.Cancel to cancel channeling. /// </summary> internal void Close(bool cancelled) { if (!this.m_channeling) { return; } this.m_channeling = false; Unit casterUnit = this.m_cast.CasterUnit; foreach (SpellEffectHandler channelHandler in this.m_channelHandlers) { channelHandler.OnChannelClose(cancelled); } List <IAura> auras = this.m_auras; if (auras != null) { foreach (IAura aura in auras) { aura.Remove(false); } auras.Clear(); SpellCast.AuraListPool.Recycle(auras); this.m_auras = (List <IAura>)null; } this.m_channelHandlers.Clear(); SpellCast.SpellEffectHandlerListPool.Recycle(this.m_channelHandlers); this.m_channelHandlers = (List <SpellEffectHandler>)null; this.m_timer.Stop(); if (cancelled) { SpellHandler.SendChannelUpdate(this.m_cast, 0U); } WorldObject channelObject = casterUnit.ChannelObject; if (channelObject is DynamicObject) { channelObject.Delete(); } casterUnit.ChannelObject = (WorldObject)null; casterUnit.ChannelSpell = SpellId.None; }