/// <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); }
// "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 ); }
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 ); }
public Rectangle2D( int x, int y, int width, int height ) { m_Start = new Point2D( x, y ); m_End = new Point2D( x + width, y + height ); }
public Rectangle2D( IPoint2D start, IPoint2D end ) { m_Start = new Point2D( start ); m_End = new Point2D( end ); }
public Line2D( IPoint2D start, IPoint2D end ) { m_Start = new Point2D( start ); m_End = new Point2D( end ); Fix(); }
public void Fix() { if ( m_Start > m_End ) { Point2D temp = m_Start; m_Start = m_End; m_End = temp; } }
public Line2D(IPoint2D start, IPoint2D end) { m_Start = new Point2D(start); m_End = new Point2D(end); Fix(); }
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(); }
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; }
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 ); }
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); }
public Rectangle2D(int x, int y, int width, int height) { m_Start = new Point2D(x, y); m_End = new Point2D(x + width, y + height); }
public Rectangle2D(IPoint2D start, IPoint2D end) { m_Start = new Point2D(start); m_End = new Point2D(end); }
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 ); }
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; }
public Direction GetDirectionTo(Point2D p) { return(GetDirectionTo(p.m_X, p.m_Y)); }