public virtual void StartCastTimer(GameLiving target) { m_interrupted = false; SendSpellMessages(); int time = CalculateCastingTime(); int step1 = time / 3; if (step1 > ServerProperties.Properties.SPELL_INTERRUPT_MAXSTAGELENGTH) step1 = ServerProperties.Properties.SPELL_INTERRUPT_MAXSTAGELENGTH; if (step1 < 1) step1 = 1; int step3 = time / 3; if (step3 > ServerProperties.Properties.SPELL_INTERRUPT_MAXSTAGELENGTH) step3 = ServerProperties.Properties.SPELL_INTERRUPT_MAXSTAGELENGTH; if (step3 < 1) step3 = 1; int step2 = time - step1 - step3; if (step2 < 1) step2 = 1; if (Caster is GamePlayer && ServerProperties.Properties.ENABLE_DEBUG) { (Caster as GamePlayer).Out.SendMessage("[DEBUG] spell time = " + time + ", step1 = " + step1 + ", step2 = " + step2 + ", step3 = " + step3, eChatType.CT_System, eChatLoc.CL_SystemWindow); } m_castTimer = new DelayedCastTimer(Caster, this, target, step2, step3); m_castTimer.Start(step1); m_started = Caster.CurrentRegion.Time; SendCastAnimation(); if (m_caster.IsMoving || m_caster.IsStrafing) { CasterMoves(); } }
/// <summary> /// Called whenever the casters casting sequence is to interrupt immediately /// </summary> public virtual void InterruptCasting() { if (m_interrupted || !IsCasting) return; m_interrupted = true; if (IsCasting) { foreach (GamePlayer player in m_caster.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { player.Out.SendInterruptAnimation(m_caster); } } if (m_castTimer != null) { m_castTimer.Stop(); m_castTimer = null; if (m_caster is GamePlayer) { ((GamePlayer)m_caster).ClearSpellQueue(); } } m_startReuseTimer = false; OnAfterSpellCastSequence(); }