コード例 #1
0
        public void MoveForwardTowardsPosition(
            position_t TargetPosition, bool useObjectAvoidance)
        {
            if (DistanceTo(TargetPosition) > 3)
            {
                var player = Character.Api.Player;
                var i      = DistanceTo(TargetPosition);
                SetViewMode(ViewMode.FirstPerson);
                FaceHeading(TargetPosition);
                KeepRunningWithKeyboard();
                //Character.Api.AutoFollow.SetAutoFollowCoords(
                // TargetPosition.X - player.X,
                // TargetPosition.Y - player.Y,
                //  TargetPosition.Z - player.Z);

                //  Character.Api.AutoFollow.IsAutoFollowing = true;

                if (useObjectAvoidance)
                {
                    AvoidObstacles();
                }
            }

            //Character.Api.AutoFollow.IsAutoFollowing = false;
        }
コード例 #2
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
 /// <summary>
 /// Destis the specified end.
 /// </summary>
 /// <param name="End">The end.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool Destination(position_t End)
 {
     if (Character.Api.Player.X == End.X + -3 && Character.Api.Player.Z == End.Z + -3)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Gotoes the NPC.
        /// </summary>
        /// <param name="ID">The identifier.</param>
        public void GotoNPC(int ID)
        {
            var entity   = Character.Api.Entity.GetEntity(ID);
            var position = new position_t {
                X = entity.X, Y = entity.Y, Z = entity.Z
            };

            Reset();
            // FaceHeading(position);
            MoveForwardTowardsPosition(position, true);
        }
コード例 #4
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Distances to.
        /// </summary>
        /// <param name="mobid">The mobid.</param>
        /// <returns>System.Double.</returns>
        public double DistanceTo(int mobid)
        {
            var start = new position_t {
                X = Character.Api.Player.X, Z = Character.Api.Player.Z
            };
            var dest = new position_t {
                X = Character.Api.Entity.GetEntity(mobid).X, Z = Character.Api.Entity.GetEntity(mobid).Z
            };

            return(Math.Sqrt(Math.Pow(start.X - dest.X, 2) + Math.Pow(start.Z - dest.Z, 2)));
        }
コード例 #5
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Goes to.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="z">The z.</param>
        public void GoTo(float x, float z)
        {
            var position = new position_t {
                X = x, Z = z
            };

            if (!(DistanceTo(position) > 1))
            {
                return;
            }
            MoveForwardTowardsPosition(position, true);
        }
コード例 #6
0
        public void FaceHeading(position_t position)
        {
            var player = Character.Api.Entity.GetLocalPlayer();
            var angle  = (byte)(Math.Atan((position.Z - player.Z) / (position.X - player.X)) * -(128.0f / Math.PI));

            if (player.X > position.X)
            {
                angle += 128;
            }
            var radian = (float)angle / 255 * 2 * Math.PI;

            Character.Api.Entity.SetEntityHPosition(Character.Api.Entity.LocalPlayerIndex, (float)radian);
        }
コード例 #7
0
ファイル: ToonControl.cs プロジェクト: xathei/FFXINAV
 public ToonControl(MainForm mf, Dictionary <string, EliteAPI> chars, EliteAPI api)
 {
     InitializeComponent();
     Character = new Character(mf.Logger, this, chars, api);
     TargetComboBox.SelectedIndex = 0;
     FFxiNAV    = new FFXINAV();
     Waypoints  = new List <position_t>();
     TestWorker = new BackgroundWorker();
     TestWorker.WorkerSupportsCancellation        = true;
     TestWorker.WorkerReportsProgress             = true;
     backgroundWorker1.WorkerSupportsCancellation = true;
     backgroundWorker1.WorkerReportsProgress      = true;
     Ppoint             = new PointsOfInterest();
     TestWorker.DoWork += TestWorker_DoWork;
     Posi = new position_t();
     KeepMovingStartPosi = new position_t();
 }
コード例 #8
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Faces the heading.
        /// </summary>
        /// <param name="position">The position.</param>
        public void FaceHeading(position_t position)
        {
            var player    = Character.Api.Entity.GetLocalPlayer();
            var Playerpos = new position_t {
                X = Character.Api.Player.X, Y = Character.Api.Player.Y, Z = Character.Api.Player.Z, Moving = 0, Rotation = (sbyte)Character.Api.Player.H
            };
            var angle = (byte)(Math.Atan((position.Z - player.Z) / (position.X - player.X)) * -(128.0f / Math.PI));

            if (player.X > position.X)
            {
                angle += 128;
            }
            var radian = (float)angle / 255 * 2 * Math.PI;

            Character.Api.Entity.SetEntityHPosition(Character.Api.Entity.LocalPlayerIndex, (float)radian);
            // Character.Logger.AddDebugText(Character.Tc.rtbDebug, string.Format(@"radian {0}
            // Rotation {1}", radian.ToString(), Character.FFxiNAV.Getrotation(Playerpos, position).ToString()));
        }
コード例 #9
0
ファイル: FFXINAVTOOLS.cs プロジェクト: xathei/FFXINAV
        public unsafe void TryGetWaypoints()
        {
            waypoints.Clear();
            WPz.Clear();
            WPx.Clear();
            if (pathpoints() > 0)
            {
                double *items;
                int     itemsCount;

                using (FFXINAV.Get_m_points_XWrapper(out items, out itemsCount))
                {
                    for (int i = 0; i < itemsCount; i++)
                    {
                        WPx.Add(ToSingle(items[i]));
                    }
                }
            }
            if (pathpoints() > 0)
            {
                double *items2;
                int     itemsCount2;

                using (FFXINAV.Get_m_points_ZWrapper(out items2, out itemsCount2))
                {
                    for (int i = 0; i < itemsCount2; i++)
                    {
                        WPz.Add(ToSingle(items2[i]));
                    }
                }
            }

            if (WPx.Count > 0 && WPz.Count > 0)
            {
                for (var i = 0; i < pathpoints(); i++)
                {
                    x = WPx[i]; z = WPz[i];
                    var position = new position_t {
                        X = x, Z = z
                    };
                    waypoints.Add(position);
                }
            }
        }
コード例 #10
0
 /// <summary>
 /// Distances to wall.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <returns>System.Double.</returns>
 public double DistanceToWall(position_t start)
 {
     try
     {
         if (start.X != 0 && start.Z != 0)
         {
             return(GetDistanceToWall(this.m_pNativeObject, start));
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         return(0);
     }
 }
コード例 #11
0
        public void Chess960_RooksOnEitherSideOfKing()
        {
            mf.NewGame(2);
            mf.m_defaultGamePlayType = false;
            ChessBoard board   = mf.GetBoard();
            position_t KingPos = new position_t(board.Kings[Player.WHITE].letter, board.Kings[Player.WHITE].number);

            List <position_t> Rooks = new List <position_t>();

            for (int i = 0; i < 8; i++)
            {
                if (board.Grid[0][i].piece == Piece.ROOK)
                {
                    Rooks.Add(new position_t(0, i));
                }
            }

            Assert.IsTrue(Rooks.Count == 2);
        }
コード例 #12
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Keeps the one yalm back.
        /// </summary>
        /// <param name="position">The position.</param>
        public void KeepOneYalmBack(position_t position)
        {
            if (DistanceTo(position) > TooCloseDistance)
            {
                return;
            }

            DateTime duration = DateTime.Now.AddSeconds(5);

            Character.Api.ThirdParty.KeyDown(EliteMMO.API.Keys.NUMPAD2);

            while (DistanceTo(position) <= TooCloseDistance && DateTime.Now < duration)
            {
                SetViewMode(ViewMode.FirstPerson);
                FaceHeading(position);
                Thread.Sleep(30);
            }

            Character.Api.ThirdParty.KeyUp(EliteMMO.API.Keys.NUMPAD2);
        }
コード例 #13
0
        /// <summary>
        /// Gets the waypoints.
        /// </summary>
        public unsafe void GetWaypoints()
        {
            Waypoints.Clear();
            if (pathpoints(this.m_pNativeObject) > 0)
            {
                double *xitems;
                double *zitems;
                int     itemsCount;

                using (Get_WayPoints_Wrapper(out xitems, out zitems, out itemsCount))
                {
                    for (int i = 0; i < itemsCount; i++)
                    {
                        var position = new position_t {
                            X = (float)xitems[i], Z = (float)zitems[i]
                        };
                        Waypoints.Add(position);
                    }
                }
            }
        }
コード例 #14
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Gets the waypoint closest to.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="z">The z.</param>
        /// <returns>position_t.</returns>
        public position_t GetWaypointClosestTo(float x, float z)
        {
            position_t ClosestWP       = new position_t();
            double     ClosestDistance = 9999;

            foreach (position_t wp in Waypoints)
            {
                position_t start = new position_t {
                    X = x, Z = z
                };
                position_t end = new position_t {
                    X = wp.X, Z = wp.Z
                };
                if (DistancetoWaypoint(start, end) < ClosestDistance)
                {
                    ClosestWP       = wp;
                    ClosestDistance = DistancetoWaypoint(start, end);
                }
            }
            return(ClosestWP);
        }
コード例 #15
0
ファイル: ToonControl.cs プロジェクト: xathei/FFXINAV
        private void button5_Click_1(object sender, EventArgs e)
        {
            try
            {
                var mob = Character.Target.FindBestTarget();

                var start = new position_t();
                var end   = new position_t();
                start.X        = (float)Character.Api.Player.X;
                start.Y        = (float)Character.Api.Player.Y;
                start.Z        = (float)Character.Api.Player.Z;
                start.Rotation = 0;
                start.Moving   = 0;

                end.X        = (float)Character.Api.Entity.GetEntity(mob).X;
                end.Y        = (float)Character.Api.Entity.GetEntity(mob).Y;
                end.Z        = (float)Character.Api.Entity.GetEntity(mob).Z;
                end.Rotation = 0;
                end.Moving   = 0;

                if (mob != 0)
                {
                    var i    = Character.Api.Entity.GetEntity(mob).Render0000;
                    var i2   = Character.Api.Entity.GetEntity(mob).Render0000 & 0x200;
                    var name = Character.Api.Entity.GetEntity(mob).Name;
                    var dist = Character.Navi.DistanceTo(mob);
                    Character.Logger.AddDebugText(Character.Tc.rtbDebug, string.Format(@"render flags {0} {1}", i.ToString(), i2.ToString()));
                    Character.Logger.AddDebugText(rtbDebug, string.Format("Looking for path to {0} distance {1}y", name, dist.ToString()));
                    FFxiNAV.FindPath(start, end);
                }
                if (mob == 0)
                {
                    Character.Logger.AddDebugText(rtbDebug, "Mob id = 0 so unable to find a path");
                }
            }
            catch (Exception ex)
            {
                Character.Logger.AddDebugText(rtbDebug, ex.ToString());
            }
        }
コード例 #16
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Moves the forward towards position.
        /// </summary>
        /// <param name="TargetPosition">The target position.</param>
        /// <param name="useObjectAvoidance">if set to <c>true</c> [use object avoidance].</param>
        public void MoveForwardTowardsPosition(
            position_t TargetPosition, bool useObjectAvoidance)
        {
            if (DistanceTo(TargetPosition) > 1)
            {
                var player = Character.Api.Player; var i = DistanceTo(TargetPosition);

                float normalized = (float)i;
                float goToX      = 0;
                float goToZ      = 0;
                float goToY      = 0;
                if (player.X != 0 || player.Z != 0 || TargetPosition.X != 0 || TargetPosition.Z != 0)
                {
                    goToX = (TargetPosition.X - player.X) / normalized;
                    goToZ = (TargetPosition.Z - player.Z) / normalized;
                    goToY = (TargetPosition.Y - player.Y) / normalized;
                }
                // FaceHeading(TargetPosition);
                Character.Api.AutoFollow.SetAutoFollowCoords(goToX, 0, goToZ);
                Character.Api.AutoFollow.IsAutoFollowing = true;
            }
        }
コード例 #17
0
ファイル: Types.cs プロジェクト: V01dPr0xy/Chess_NewFeature
 public piece_t(Piece piece, Player player)
 {
     this.piece        = piece;
     this.player       = player;
     this.lastPosition = new position_t(-1, -1);
 }
コード例 #18
0
ファイル: Types.cs プロジェクト: V01dPr0xy/Chess_NewFeature
 public position_t(position_t copy)
 {
     this.letter = copy.letter;
     this.number = copy.number;
 }
コード例 #19
0
ファイル: Types.cs プロジェクト: bdidemus/chess
 public position_t(position_t copy)
 {
     this.letter = copy.letter;
     this.number = copy.number;
 }
コード例 #20
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
        /// <summary>
        /// Distances to.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <returns>System.Double.</returns>
        public double DistanceTo(position_t position)
        {
            var player = Character.Api.Entity.GetLocalPlayer();

            return(Math.Sqrt(Math.Pow(player.X - position.X, 2) + Math.Pow(player.Z - position.Z, 2)));
        }
コード例 #21
0
 /// <summary>
 /// Finds the closest path.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 /// <param name="UseCustonNavMeshes">if set to <c>true</c> [use custon nav meshes].</param>
 public void findClosestPath(position_t start, position_t end, bool UseCustonNavMeshes)
 {
     //set false if using DSP Nav files or meshes made with PathFinder & FFXINAV.dll
     //set true if using Meshes made with Noesis map data
     FindClosestPath(this.m_pNativeObject, start, end, UseCustonNavMeshes);
 }
コード例 #22
0
 /// <summary>
 /// Enables the or disable nearest poly.
 /// </summary>
 /// <param name="Pos">The position.</param>
 /// <param name="Enable">if set to <c>true</c> [enable].</param>
 /// <param name="UseCustom">if set to <c>true</c> to use meshes made with noesis data [use custom].</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> Always Set to false if using my meshes </returns>
 public bool EnableOrDisableNearestPoly(position_t Pos, bool Enable, bool UseCustom)
 {
     return(EnableNearestPoly(this.m_pNativeObject, Pos, Enable, UseCustom));
 }
コード例 #23
0
ファイル: FFXINAVTOOLS.cs プロジェクト: xathei/FFXINAV
 public void FindPathToPosi(position_t start, position_t end)
 {
     findPathToPosi(start, end);
 }
コード例 #24
0
ファイル: Connections.cs プロジェクト: xathei/Pathfinder
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="to">To.</param>
 /// <param name="length">The length.</param>
 public Connection(position_t to, float length)
 {
     To     = to;
     Length = length;
 }
コード例 #25
0
ファイル: Types.cs プロジェクト: V01dPr0xy/Chess_NewFeature
 public piece_t(piece_t copy)
 {
     this.piece        = copy.piece;
     this.player       = copy.player;
     this.lastPosition = copy.lastPosition;
 }
コード例 #26
0
ファイル: Types.cs プロジェクト: bdidemus/chess
 public piece_t(Piece piece, Player player)
 {
     this.piece = piece;
     this.player = player;
     this.lastPosition = new position_t(-1, -1);
 }
コード例 #27
0
ファイル: Types.cs プロジェクト: bdidemus/chess
 public piece_t(piece_t copy)
 {
     this.piece = copy.piece;
     this.player = copy.player;
     this.lastPosition = copy.lastPosition;
 }
コード例 #28
0
ファイル: Types.cs プロジェクト: bdidemus/chess
 public move_t(position_t from, position_t to)
 {
     this.from = from;
     this.to = to;
 }
コード例 #29
0
ファイル: Types.cs プロジェクト: V01dPr0xy/Chess_NewFeature
 public move_t(position_t from, position_t to)
 {
     this.from = from;
     this.to   = to;
 }
コード例 #30
0
 /// <summary>
 /// Determines whether [is valid position] [the specified start].
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="UseCustom">if set to <c>true</c> [use custom].</param>
 /// <returns><c>true</c> if [is valid position] [the specified start]; otherwise, <c>false</c>.</returns>
 public bool isValidPosition(position_t start, bool UseCustom)
 {
     return(IsValidPosition(this.m_pNativeObject, start, UseCustom));
 }
コード例 #31
0
ファイル: FFXINAVTOOLS.cs プロジェクト: xathei/FFXINAV
 public void FindPath_DSP_NAV_Files(position_t start, position_t end)
 {
     findPath_DSP_NAV_Files(start, end);
 }
コード例 #32
0
 /// <summary>
 /// Finds the random path.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="maxRadius">The maximum radius.</param>
 /// <param name="maxTurns">The maximum turns.</param>
 /// <param name="UseCustom">if set to <c>true</c> [use custom].</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool findRandomPath(position_t start, float maxRadius, sbyte maxTurns, bool UseCustom)
 {
     return(FindRandomPath(this.m_pNativeObject, start, maxRadius, maxTurns, UseCustom));
 }
コード例 #33
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
 /// <summary>
 /// Distancetoes the waypoint.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 /// <returns>System.Double.</returns>
 public double DistancetoWaypoint(position_t start, position_t end)
 {
     return(Math.Sqrt(Math.Pow(start.X - end.X, 2) + Math.Pow(start.Z - end.Z, 2)));
 }
コード例 #34
0
 /// <summary>
 /// Getrotations the specified start.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 /// <returns>System.SByte.</returns>
 public sbyte Getrotation(position_t start, position_t end)
 {
     return(GetRotation(this.m_pNativeObject, start, end));
 }