blahs44

Untitled

Sep 28th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.55 KB | None | 0 0
  1. import org.osbot.script.Script;
  2. import org.osbot.script.ScriptManifest;
  3. import org.osbot.script.rs2.map.Position;
  4. import org.osbot.script.rs2.model.NPC;
  5.  
  6.        
  7.        
  8.         @ScriptManifest(name = "Pickpocketing", author = "Murded", version = 1D, info="")
  9.         public class pickpocketing extends Script {
  10.        
  11.        private int[][] path1 = new int[][] { { 3206, 3209 }, { 3215, 3211 }, { 3217, 3218 }, { 3225, 3218 },
  12.             { 3235, 3220 }, { 3242, 3226 }, { 3252, 3226 }, { 3251, 3235 }, };
  13.                
  14.         enum State {
  15.                         fishing,banking;
  16.                 }
  17.        
  18.                 private State state;
  19.                        
  20.                 public void onStart(){
  21.                 walker = new DicloniusWalking(this);
  22.  
  23.                 }
  24.  
  25. public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath, int distanceFromEnd) {
  26.         if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0] : path[0][0],
  27.                 AscendThroughPath ? path[path.length - 1][1] : path[0][1]) <= distanceFromEnd)
  28.             return true;
  29.         else {
  30.             WalkAlongPath(path, AscendThroughPath);
  31.             return false;
  32.         }
  33.     }
  34.  
  35.     public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
  36.         int destination = 0;
  37.         for (int i = 0; i < path.length; i++)
  38.             if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(path[destination][0], path[destination][1]))
  39.                 destination = i;
  40.         if (script.client.getMyPlayer().isMoving() && distanceToPoint(path[destination][0], path[destination][1]) > (script.isRunning() ? 3 : 2))
  41.             return;
  42.         if (AscendThroughPath && destination != path.length - 1 || !AscendThroughPath && destination != 0)
  43.             destination += (AscendThroughPath ? 1 : -1);
  44.         try {
  45.             log("Walking to node:" + destination);
  46.             script.walk(new Position(path[destination][0], path[destination][1], 0));
  47.             Thread.sleep(700 + MethodProvider.random(600));
  48.         } catch (InterruptedException e) {
  49.             e.printStackTrace();
  50.         }
  51.     }
  52.  
  53.     private int distanceToPoint(int pointX, int pointY) {
  54.         return (int) Math.sqrt(Math.pow(script.client.getMyPlayer().getX() - pointX, 2)
  55.                 + Math.pow(script.client.getMyPlayer().getY() - pointY, 2));
  56.     }
  57.                 public int onLoop() throws InterruptedException{
  58.                        
  59.                         if(client.getInventory().isFull() == false) {
  60.                                 state = State.fishing;
  61.                         } else {
  62.                                 state = State.banking;
  63.                         }
  64.                        
  65.                        
  66.                         switch (state){
  67.                         case fishing:
  68.                                 return chopping();
  69.                         case banking:
  70.                                 return banking();
  71.                         }
  72.                 return random(10, 20);
  73.                 }
  74.        
  75.                
  76.                
  77.                 int chopping() throws InterruptedException {
  78.                        
  79.                         if(client.getMyPlayer().isAnimating() == false) {
  80.                         NPC fish = closestNPCForName("Fishing Spot");
  81.                         fish.interact("Net");
  82.                         }
  83.                        
  84.                         return 2000;
  85.                 }
  86.                
  87.                 int banking() throws InterruptedException {
  88.                        
  89.                         if(client.getInventory().isFull()) {
  90.                         }
  91.                          WalkAlongPath(path1, true);
  92.                         return 2000;
  93.                 }
  94.         }
Advertisement
Add Comment
Please, Sign In to add comment