예제 #1
0
        /// <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);
        }
예제 #2
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
        // "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 );
        }
예제 #3
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
 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 );
 }
예제 #4
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
 public Rectangle2D( int x, int y, int width, int height )
 {
     m_Start = new Point2D( x, y );
     m_End = new Point2D( x + width, y + height );
 }
예제 #5
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
 public Rectangle2D( IPoint2D start, IPoint2D end )
 {
     m_Start = new Point2D( start );
     m_End = new Point2D( end );
 }
예제 #6
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
 public Line2D( IPoint2D start, IPoint2D end )
 {
     m_Start = new Point2D( start );
     m_End = new Point2D( end );
     Fix();
 }
예제 #7
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
 public void Fix()
 {
     if ( m_Start > m_End )
     {
         Point2D temp = m_Start;
         m_Start = m_End;
         m_End = temp;
     }
 }
예제 #8
0
파일: Geometry.cs 프로젝트: sorsarre/Razor
 public Line2D(IPoint2D start, IPoint2D end)
 {
     m_Start = new Point2D(start);
     m_End   = new Point2D(end);
     Fix();
 }
예제 #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();
        }
예제 #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;
        }
예제 #11
0
파일: Geometry.cs 프로젝트: sorsarre/Razor
 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 );
 }
예제 #12
0
파일: Geometry.cs 프로젝트: sorsarre/Razor
 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);
 }
예제 #13
0
파일: Geometry.cs 프로젝트: sorsarre/Razor
 public Rectangle2D(int x, int y, int width, int height)
 {
     m_Start = new Point2D(x, y);
     m_End   = new Point2D(x + width, y + height);
 }
예제 #14
0
파일: Geometry.cs 프로젝트: sorsarre/Razor
 public Rectangle2D(IPoint2D start, IPoint2D end)
 {
     m_Start = new Point2D(start);
     m_End   = new Point2D(end);
 }
예제 #15
0
파일: Geometry.cs 프로젝트: WildGenie/Razor
 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 );
 }
예제 #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;
 }
예제 #17
0
 public Direction GetDirectionTo(Point2D p)
 {
     return(GetDirectionTo(p.m_X, p.m_Y));
 }