Advertisement
Guest User

Bird Hunter

a guest
Feb 28th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.62 KB | None | 0 0
  1. public class BirdHunter extends Script{
  2.  
  3.     private final int MOUSE_SPEED = 140;
  4.     private final int BIRD_SNARE_INV = 10006;
  5.     private final int BIRD_SNARE_GND = 9345;
  6.     private final int FEATHERS_ID = 10087;
  7.     private final int BONES = 526;
  8.     private final int[] INVENT_ITEMS = {526,10006,10087,9978,10091};
  9.     private final int[] SNARE_DOWN = {9344,9379,9346,9378,9348,9347};
  10.     private RSTile startSpot;
  11.     private RSObject[] birdSnares;
  12.     private RSObject[] allSnares;
  13.     private RSItem[] snares;
  14.     private int trapAmount = 2;
  15.     ABCUtil test = new ABCUtil();
  16.  
  17.  
  18.     @Override
  19.     public void run() {
  20.         startScript();
  21.         while(loop()){}
  22.     }
  23.  
  24.     private boolean loop() {
  25.         if(Inventory.getCount(INVENT_ITEMS) > 25){
  26.             drop();
  27.         } else if(shouldClickSnare()){
  28.             collectSnare();
  29.         } else if(snareIsOnGround()){
  30.             waitForBird();
  31.         } else{
  32.             placeSnareOnGround();
  33.         }
  34.         return true;
  35.     }
  36.  
  37.     private boolean shouldClickSnare(){
  38.         allSnares = Objects.find(15,SNARE_DOWN);
  39.  
  40.         if(allSnares.length > 0)
  41.             return true;
  42.         return false;
  43.     }
  44.     private void placeSnareOnGround() {
  45.         snares = Inventory.find(BIRD_SNARE_INV);
  46.  
  47.         if(Player.getPosition() != startSpot) {
  48.             if (Walking.walkTo(startSpot)) {
  49.  
  50.             }
  51.         }
  52.  
  53.         sleep(750,1000);
  54.  
  55.         for(int i = 0; i<trapAmount; i++) {
  56.  
  57.             snares[i].click();
  58.  
  59.             while (getAnimationContinuous(2000)) {
  60.                 if (test.shouldCheckTabs())
  61.                     test.checkTabs();
  62.  
  63.                 if (test.shouldMoveMouse())
  64.                     test.moveMouse();
  65.  
  66.                 if (test.shouldCheckXP())
  67.                     test.checkXP();
  68.  
  69.                 if (test.shouldCheckTabs())
  70.                     test.checkTabs();
  71.  
  72.                 if (test.shouldExamineEntity())
  73.                     test.examineEntity();
  74.  
  75.                 if (test.shouldRotateCamera())
  76.                     test.rotateCamera();
  77.  
  78.                 if (test.shouldPickupMouse())
  79.                     test.pickupMouse();
  80.  
  81.                 if (test.shouldLeaveGame())
  82.                     test.leaveGame();
  83.  
  84.                 if (test.shouldRightClick())
  85.                     test.rightClick();
  86.  
  87.             }
  88.         }
  89.  
  90.     }
  91.  
  92.     private boolean getAnimationContinuous(int MSTime){
  93.         for(int i = 0; i < MSTime; i++){
  94.             sleep(1);
  95.             if(Player.getAnimation() != -1){
  96.                 return true;
  97.             }
  98.         }
  99.         return false;
  100.     }
  101.  
  102.     private void waitForBird() {
  103.         while(snareIsOnGround()){
  104.             sleep(50,100);
  105.  
  106.             RSGroundItem[] groundSnares = GroundItems.find(BIRD_SNARE_INV);
  107.             if(groundSnares.length > 0){
  108.                 groundSnares[0].click("Take");
  109.             }
  110.  
  111.  
  112.             if(test.shouldCheckTabs())
  113.                 test.checkTabs();
  114.  
  115.             if(test.shouldMoveMouse())
  116.                 test.moveMouse();
  117.  
  118.             if(test.shouldCheckXP())
  119.                 test.checkXP();
  120.  
  121.             if(test.shouldCheckTabs())
  122.                 test.checkTabs();
  123.  
  124.             if(test.shouldExamineEntity())
  125.                 test.examineEntity();
  126.  
  127.             if(test.shouldRotateCamera())
  128.                 test.rotateCamera();
  129.  
  130.             if(test.shouldPickupMouse())
  131.                 test.pickupMouse();
  132.  
  133.             if(test.shouldLeaveGame())
  134.                 test.leaveGame();
  135.  
  136.             if(test.shouldRightClick())
  137.                 test.rightClick();
  138.  
  139.         }
  140.     }
  141.  
  142.     private boolean snareIsOnGround() {
  143.         birdSnares = Objects.find(15,BIRD_SNARE_GND);
  144.         if(birdSnares.length > 0)
  145.             return true;
  146.         return false;
  147.     }
  148.  
  149.     private void collectSnare() {
  150.         sleep(1000,2000);
  151.         allSnares[0].click();
  152.         while(getAnimationContinuous(500)){};
  153.  
  154.     }
  155.  
  156.     private void drop() {
  157.         RSItem[] allBones = Inventory.find(BONES);
  158.  
  159.         while(allBones.length > 0){
  160.             allBones[0].click();
  161.             while(getAnimationContinuous(250)){}
  162.             allBones = Inventory.find(BONES);
  163.         }
  164.  
  165.  
  166.         Inventory.dropAllExcept(BIRD_SNARE_INV,FEATHERS_ID);
  167.     }
  168.  
  169.     private void startScript(){
  170.         startSpot = Player.getPosition();
  171.         Mouse.setSpeed(MOUSE_SPEED);
  172.  
  173.         JFrame frame = new JFrame();
  174.         trapAmount = Integer.parseInt(JOptionPane.showInputDialog(frame, "How Many Traps Should We Place?", "How Many Traps Should we Place?", 1));
  175.  
  176.         General.useAntiBanCompliance(true);
  177.     }
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement