/// <summary> /// Opens this SpellChannel. /// Will be called by SpellCast class. /// Requires an active Caster. /// </summary> internal void Open(List <SpellEffectHandler> channelHandlers, List <IAura> auras) { if (!m_channeling && m_cast != null) { m_channeling = true; m_auras = auras; var spell = m_cast.Spell; var caster = m_cast.CasterUnit; m_duration = spell.Durations.Max; m_amplitude = spell.ChannelAmplitude; if (m_amplitude < 1) { // only one tick m_amplitude = m_duration; } caster.ChannelSpell = spell.SpellId; var now = Environment.TickCount; m_ticks = 0; m_maxTicks = m_duration / m_amplitude; m_channelHandlers = channelHandlers; // get duration again, this time with modifiers m_duration = spell.GetDuration(caster.SharedReference); if (m_amplitude < 1) { // only one tick m_amplitude = m_duration; } m_until = now + m_duration; SpellHandler.SendChannelStart(m_cast, spell.SpellId, m_duration); if (m_channeling) { m_timer.Start(m_amplitude, m_amplitude); } // Send Initial Tick? // Keep in mind: Aura is not initialized at this point! } else { log.Warn(this + " was opened more than once or after disposal!"); } }
/// <summary> /// Opens this SpellChannel. /// Will be called by SpellCast class. /// Requires an active Caster. /// </summary> internal void Open(List <SpellEffectHandler> channelHandlers, List <IAura> auras) { if (!this.m_channeling && this.m_cast != null) { this.m_channeling = true; this.m_auras = auras; Spell spell = this.m_cast.Spell; Unit casterUnit = this.m_cast.CasterUnit; this.m_duration = spell.Durations.Max; this.m_amplitude = spell.ChannelAmplitude; if (this.m_amplitude < 1) { this.m_amplitude = this.m_duration; } casterUnit.ChannelSpell = spell.SpellId; int tickCount = Environment.TickCount; this.m_ticks = 0; this.m_maxTicks = this.m_duration / this.m_amplitude; this.m_channelHandlers = channelHandlers; this.m_duration = spell.GetDuration(casterUnit.SharedReference); if (this.m_amplitude < 1) { this.m_amplitude = this.m_duration; } this.m_until = tickCount + this.m_duration; SpellHandler.SendChannelStart(this.m_cast, spell.SpellId, this.m_duration); if (!this.m_channeling) { return; } this.m_timer.Start(this.m_amplitude, this.m_amplitude); } else { SpellChannel.log.Warn(this.ToString() + " was opened more than once or after disposal!"); } }