blahs44

Untitled

Oct 14th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. private int[][] MinePos = { { 2845, 2968, 0 }, { 2838, 2970, 0 },
  2.             { 2832, 2970, 0 }, { 2829, 2983, 0 }, { 2824, 2997, 0 } };
  3.  
  4. public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath,
  5.             int distanceFromEnd) {
  6.         if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0]
  7.                 : path[0][0], AscendThroughPath ? path[path.length - 1][1]
  8.                 : path[0][1]) <= distanceFromEnd)
  9.             return true;
  10.         else {
  11.             WalkAlongPath(path, AscendThroughPath);
  12.             return false;
  13.         }
  14.     }
  15.  
  16.     public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
  17.         int destination = 0;
  18.         for (int i = 0; i < path.length; i++)
  19.             if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(
  20.                     path[destination][0], path[destination][1]))
  21.                 destination = i;
  22.         if (client.getMyPlayer().isMoving()
  23.                 && distanceToPoint(path[destination][0], path[destination][1]) > (isRunning() ? 3
  24.                         : 2))
  25.             return;
  26.         if (AscendThroughPath && destination != path.length - 1
  27.                 || !AscendThroughPath && destination != 0)
  28.             destination += (AscendThroughPath ? 1 : -1);
  29.         try {
  30.             log("Walking to node:" + destination);
  31.             walk(new Position(path[destination][0], path[destination][1], 0));
  32.             Thread.sleep(700 + MethodProvider.random(600));
  33.         } catch (InterruptedException e) {
  34.             e.printStackTrace();
  35.         }
  36.     }
  37.  
  38.     private int distanceToPoint(int pointX, int pointY) {
  39.         return (int) Math.sqrt(Math
  40.                 .pow(client.getMyPlayer().getX() - pointX, 2)
  41.                 + Math.pow(client.getMyPlayer().getY() - pointY, 2));
  42.     }
  43.  
  44. try {
  45.             WalkAlongPath(MinePos, true);
  46.         } catch (Exception localException) {
  47.         }
Advertisement
Add Comment
Please, Sign In to add comment