コード例 #1
0
 void isPossibleToMove(int x, int y, ref NextPos np) //чтоб не писать одно и тоже 100500 раз сделал функцию
 {
     //если доступность данной клетки меньше той, что лежит в np и в эту клетку ранее не ходили, то np стает этой клеткой
     if (board[y][x] < np.access && board[y][x] > 0)
     {
         np.x      = x;
         np.y      = y;
         np.access = board[y][x];
     }
 }
コード例 #2
0
ファイル: GrindingNavigation.cs プロジェクト: semi420/lazybot
 public void Pulse()
 {
     if (GrindingEngine.Navigator.GetDestination.DistanceToSelf2D < 1.1 && _standingStillToLong.IsReady)
     {
         Reset();
     }
     if (ObjectManager.MyPlayer.IsMoving)
     {
         _standingStillToLong.Reset();
     }
     if (IsLastWaypoints)
     {
         if (SpotToHit.DistanceToSelf2D < 10)
         {
             SetNextWaypoint();
         }
         else
         {
             if (!SpotToHit.Equals(GrindingEngine.Navigator.GetDestination))
             {
                 GrindingEngine.Navigator.SetDestination(SpotToHit);
             }
         }
         GrindingEngine.Navigator.Start();
         return;
     }
     if (ObjectManager.MyPlayer.IsAlive)
     {
         if (NextPos.NodeType == NodeType.GroundMount)
         {
             if (GrindingSettings.Mount && !ObjectManager.MyPlayer.IsMounted)
             {
                 Mount.MountUp();
             }
         }
         else if (NextPos.NodeType == NodeType.Normal)
         {
             if (ObjectManager.MyPlayer.IsMounted)
             {
                 GrindingEngine.Navigator.Stop();
                 Mount.Dismount();
                 Thread.Sleep(500);
             }
         }
     }
     if (NextWaypointDistance < 3)
     {
         SetNextWaypoint();
     }
     if (!NextPos.Equals(GrindingEngine.Navigator.GetDestination))
     {
         GrindingEngine.Navigator.SetDestination(NextPos);
     }
     GrindingEngine.Navigator.Start();
 }
コード例 #3
0
            void move(ref int x, ref int y) //цель функции найти клетку с наименьшей доступностью и походить туда
            {
                NextPos np = new NextPos(); //чтобы было удобнее передавать в параметры пихнул все в структурку

                np.access = 100500;
                np.x      = -1;
                np.y      = -1;
                //буквы Г по y
                if (y + 2 < size && x + 1 < size)
                {
                    isPossibleToMove(x + 1, y + 2, ref np);
                }
                if (y + 2 < size && x - 1 >= 0)
                {
                    isPossibleToMove(x - 1, y + 2, ref np);
                }
                if (y - 2 >= 0 && x - 1 >= 0)
                {
                    isPossibleToMove(x - 1, y - 2, ref np);
                }
                if (y - 2 >= 0 && x + 1 < size)
                {
                    isPossibleToMove(x + 1, y - 2, ref np);
                }

                //буквы Г по x
                if (x + 2 < size && y + 1 < size)
                {
                    isPossibleToMove(x + 2, y + 1, ref np);
                }
                if (x + 2 < size && y - 1 >= 0)
                {
                    isPossibleToMove(x + 2, y - 1, ref np);
                }
                if (x - 2 >= 0 && y - 1 >= 0)
                {
                    isPossibleToMove(x - 2, y - 1, ref np);
                }
                if (x - 2 >= 0 && y + 1 < size)
                {
                    isPossibleToMove(x - 2, y + 1, ref np);
                }

                x = np.x;
                y = np.y;
            }
コード例 #4
0
ファイル: FlyingNavigation.cs プロジェクト: semi420/lazybot
 public void Pulse()
 {
     if (Mount.IsMounted() && !ObjectManager.MyPlayer.IsFlying && !ObjectManager.MyPlayer.InVashjir)
     {
         KeyHelper.PressKey("Space");
         while (!ObjectManager.MyPlayer.IsFlying && Mount.IsMounted())
         {
             Thread.Sleep(5);
         }
         KeyHelper.ReleaseKey("Space");
     }
     if (NextWaypointDistance <= 18)
     {
         SetNextWaypoint();
     }
     if (!NextPos.Equals(FlyingEngine.Navigator.GetDestination))
     {
         FlyingEngine.Navigator.SetDestination(NextPos);
     }
     FlyingEngine.Navigator.Start();
 }
コード例 #5
0
ファイル: FlyingNavigation.cs プロジェクト: semi420/lazybot
 public void FaceNextWaypoint()
 {
     NextPos.Face();
 }