public void CancelAim( bool resetAnim )
 {
     if ( m_AimingTimer != null )
     {
         m_AimingTimer.Stop();
         m_AimingTimer = null;
     }
     if ( m_Aiming )
     {
         m_Aiming = false;
         StopAnimating( resetAnim );
     }
 }
        public bool EnterAimingMode()
        {
            Mobile attacker = AttachedTo as Mobile;
            IKhaerosMobile km = attacker as IKhaerosMobile;
            BaseRanged weapon = attacker.Weapon as BaseRanged;
            if ( weapon == null || km == null ) return false;
            if ( m_AimingTimer != null )
            {
                m_AimingTimer.Stop();
                m_AimingTimer = null;
            }

            m_Aiming = true;
            m_AimStart = DateTime.Now;
            if ( weapon.AmmoType == typeof( Bolt ) ) // crossbows
            {
                if ( CanUseAimedShot() )
                {
                    m_AimConverge = DateTime.Now + TimeSpan.FromSeconds( AimedShotConvergenceSpeed() );
                    Timer.DelayCall( TimeSpan.FromSeconds( AimedShotConvergenceSpeed() ),
                    new TimerStateCallback( AimedShotCueCallback ), this );
                }

                if ( attacker.Body.Type == BodyType.Human )
                {
                    if ( !attacker.Mounted )
                        StartAnimating( 19, 3, 1, false, false, 255 );
                    else
                        StartAnimating( 28, 3, 1, false, false, 255 );
                }
                else
                {
                    int[] anim = BAData.GetRangedAnimation( attacker );
                    if ( anim != null )
                        Animate( anim[0], anim[1], 1, false, false, 255 );
                }
            }
            else // bows
            {
                if ( attacker.Body.Type == BodyType.Human )
                {
                    if ( !attacker.Mounted )
                        StartAnimating( 18, 5, 1, false, false, 255 );
                    else
                        StartAnimating( 27, 3, 1, false, false, 255 );
                }
                else
                {
                    int[] anim = BAData.GetRangedAnimation( attacker );
                    if ( anim != null )
                        Animate( anim[0], anim[1], 1, false, false, 255 );
                }
            }

            UpdateACBrainExternal();
            return true;
        }
        public bool BeginAiming( bool playerInitiated )
        {
            Mobile mob = AttachedTo as Mobile;
            BaseRanged weapon = mob.Weapon as BaseRanged;
            if ( playerInitiated && weapon != null && ( !weapon.IsStill( mob ) || m_AimingTimer != null ) ) // queuing purposes
            {
                m_ErrorMessage = "";
                DisplayQueueResultMessage( QueueRanged() );

                return false;
            }

            if ( !CanBeginAttack() || !CanBeginCombatAction() || !CanBeginAiming() )
                return false;

            StopAllActions( false );

            if ( mob.Body.Type == BodyType.Human ) // non humans don't have a pull up animation, they just get an aiming one
            {
                if ( weapon.AmmoType == typeof( Bolt ) ) // crossbows
                {
                    if ( !mob.Mounted )
                        Animate( 19, 3, 1, true, false, 0 );
                    else
                        Animate( 28, 3, 1, true, false, 0 );
                }
                else // bows
                {
                    if ( !mob.Mounted )
                        Animate( 18, 5, 1, true, false, 0 );
                    else
                        Animate( 27, 3, 1, true, false, 0 );
                }
            }

            m_Aiming = false;
            m_AimingTimer = new AimingTimer( mob, TimeSpan.FromSeconds( 0.3 ) );
            m_AimingTimer.Start();
            if ( BandageContext.GetContext( mob ) != null )
            {
                BandageContext.GetContext( mob ).StopHeal();
                if ( mob is IKhaerosMobile )
                {
                    if ( ((IKhaerosMobile)mob).HealingTimer != null )
                    {
                        ((IKhaerosMobile)mob).HealingTimer.Stop();
                        ((IKhaerosMobile)mob).HealingTimer = null;
                    }
                }
            }

            if ( mob.Combatant != null && mob.Direction != mob.GetDirectionTo( mob.Combatant ) && mob.CanSee(mob.Combatant) )
                mob.Direction = mob.GetDirectionTo( mob.Combatant );
            return true;
        }