/// <summary>
        /// Execute target on specific land point with offset distance from Mobile. Distance is calculated by target Mobile.Direction.
        /// </summary>
        /// <param name="mobile">Mobile object to target.</param>
        /// <param name="offset">Distance from the target.</param>
        public static void TargetExecuteRelative(Mobile mobile, int offset)
        {
            Assistant.Point2D relpos = new Assistant.Point2D();
            switch (mobile.Direction)
            {
            case "North":
                relpos.X = mobile.Position.X;
                relpos.Y = mobile.Position.Y - offset;
                break;

            case "South":
                relpos.X = mobile.Position.X;
                relpos.Y = mobile.Position.Y + offset;
                break;

            case "West":
                relpos.X = mobile.Position.X - offset;
                relpos.Y = mobile.Position.Y;
                break;

            case "East":
                relpos.X = mobile.Position.X + offset;
                relpos.Y = mobile.Position.Y;
                break;

            case "Up":
                relpos.X = mobile.Position.X - offset;
                relpos.Y = mobile.Position.Y - offset;
                break;

            case "Down":
                relpos.X = mobile.Position.X + offset;
                relpos.Y = mobile.Position.Y + offset;
                break;

            case "Left":
                relpos.X = mobile.Position.X - offset;
                relpos.Y = mobile.Position.Y + offset;
                break;

            case "Right":
                relpos.X = mobile.Position.X + offset;
                relpos.Y = mobile.Position.Y - offset;
                break;
            }
            Assistant.Point3D location = new Assistant.Point3D(relpos.X, relpos.Y, Statics.GetLandZ(relpos.X, relpos.Y, Player.Map));
            Assistant.Targeting.Target(location, true);
        }
Exemple #2
0
        // "test" must be smaller than this rectangle!
        public bool Insersects( Rectangle2D test )
        {
            Point2D e1 = new Point2D( test.Start.X + test.Width, test.Start.Y );
            Point2D e2 = new Point2D( test.Start.X, test.Start.Y + test.Width );

            return Contains( test.Start ) || Contains( test.End ) || Contains( e1 ) || Contains( e2 );
        }
Exemple #3
0
 public bool Contains( Point2D p )
 {
     return ( m_Start.m_X <= p.m_X && m_Start.m_Y <= p.m_Y && m_End.m_X > p.m_X && m_End.m_Y > p.m_Y );
     //return ( m_Start <= p && m_End > p );
 }
Exemple #4
0
 public Rectangle2D( int x, int y, int width, int height )
 {
     m_Start = new Point2D( x, y );
     m_End = new Point2D( x + width, y + height );
 }
Exemple #5
0
 public Rectangle2D( IPoint2D start, IPoint2D end )
 {
     m_Start = new Point2D( start );
     m_End = new Point2D( end );
 }
Exemple #6
0
 public Line2D( IPoint2D start, IPoint2D end )
 {
     m_Start = new Point2D( start );
     m_End = new Point2D( end );
     Fix();
 }
Exemple #7
0
 public void Fix()
 {
     if ( m_Start > m_End )
     {
         Point2D temp = m_Start;
         m_Start = m_End;
         m_End = temp;
     }
 }
Exemple #8
0
 public Line2D(IPoint2D start, IPoint2D end)
 {
     m_Start = new Point2D(start);
     m_End   = new Point2D(end);
     Fix();
 }
Exemple #9
0
        public static void BeginCalibratePosition()
        {
            if ( World.Player == null || IsCalibrated() )
                return;

            if ( m_CalTimer != null )
                m_CalTimer.Stop();

            m_CalPos = new Point2D( World.Player.Position );

            m_CalTimer = Timer.DelayedCallback( TimeSpan.FromSeconds( 0.5 ), m_CalibrateNow );
            m_CalTimer.Start();
        }
Exemple #10
0
        private static void CalibrateNow()
        {
            m_CalTimer = null;

            if ( World.Player == null )
                return;

            PlayerData.ExternalZ = false;

            Point3D pos = World.Player.Position;

            if ( pos != Point3D.Zero && m_CalPos == pos )
            {
                CalibratePosition( pos.X, pos.Y, pos.Z );
                System.Threading.Thread.Sleep( TimeSpan.FromSeconds( 0.1 ) );
            }

            m_CalPos = Point2D.Zero;

            PlayerData.ExternalZ = true;
        }
Exemple #11
0
 public bool Contains(Point2D p)
 {
     return(m_Start.m_X <= p.m_X && m_Start.m_Y <= p.m_Y && m_End.m_X > p.m_X && m_End.m_Y > p.m_Y);
     //return ( m_Start <= p && m_End > p );
 }
Exemple #12
0
 public void Set(int x, int y, int width, int height)
 {
     m_Start = new Point2D(x, y);
     m_End   = new Point2D(x + width, y + height);
 }
Exemple #13
0
 public Rectangle2D(int x, int y, int width, int height)
 {
     m_Start = new Point2D(x, y);
     m_End   = new Point2D(x + width, y + height);
 }
Exemple #14
0
 public Rectangle2D(IPoint2D start, IPoint2D end)
 {
     m_Start = new Point2D(start);
     m_End   = new Point2D(end);
 }
Exemple #15
0
 public void Set( int x, int y, int width, int height )
 {
     m_Start = new Point2D( x, y );
     m_End = new Point2D( x + width, y + height );
 }
Exemple #16
0
 private static bool InBounds(this Point3D p, Point2D upperLeft, Point2D bottomRight)
 {
     return p.X >= upperLeft.X && p.X <= bottomRight.X & p.Y >= upperLeft.Y && p.Y <= bottomRight.Y;
 }
Exemple #17
0
 public Direction GetDirectionTo(Point2D p)
 {
     return(GetDirectionTo(p.m_X, p.m_Y));
 }