Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.36 KB | None | 0 0
  1. import java.awt.Graphics;
  2.  
  3. import xobot.client.callback.listeners.MessageListener;
  4. import xobot.client.callback.listeners.PaintListener;
  5. import xobot.script.ActiveScript;
  6. import xobot.script.Manifest;
  7. import xobot.script.methods.*;
  8. import xobot.script.util.Time;
  9. import xobot.script.wrappers.Path;
  10. import xobot.script.wrappers.Tile;
  11. import xobot.script.wrappers.interactive.GameObject;
  12.  
  13. @Manifest(authors = { "xBear" }, name = "monster", version = 1.0, description = "Cuts gems into Bolt Tips.")
  14.  
  15. public final class monster extends ActiveScript implements PaintListener, MessageListener {
  16.  
  17.     public boolean isAtHillGiantsLadder = false;
  18.     public boolean isAtDestination = false;
  19.  
  20.  
  21.     private int state = -1;
  22.  
  23.     public void walkTo() {
  24.         getState();
  25.         switch (state) {
  26.             case 1:
  27.                 walkToMonster();
  28.                 break;
  29.  
  30.             case 2:
  31.                 climbDownLadder();
  32.                 break;
  33.  
  34.             case 3:
  35.                 //Fight
  36.                 System.out.println("At Hill Giants!");
  37.                 break;
  38.  
  39.             case 0:
  40.                 //goHome();
  41.                 break;
  42.         }
  43.     }
  44.  
  45.     Tile one = new Tile(3097, 3502);
  46.     Tile two = new Tile(3112, 3508);
  47.     Tile three = new Tile(3127, 3515);
  48.     Tile four = new Tile(3133, 3500);
  49.     Tile five = new Tile(3129, 3484);
  50.     Tile six = new Tile(3136, 3469);
  51.     Tile seven = new Tile(3124,3456);
  52.     Tile eigth = new Tile(3115, 3452);
  53.  
  54.     Tile atHillGiants = new Tile(3118, 9859);
  55.  
  56.  
  57.  
  58.     Tile[] tileArray = {
  59.            one, two, three, four, five, six, seven, eigth
  60.     };
  61.  
  62.     public void walkToMonster() {
  63.         System.out.println("Walking to ladder");
  64.         Path p = new Path(tileArray);
  65.         while (Calculations.distanceTo(new Tile(1, 1)) > 5 && !Players.getMyPlayer().isMoving()) {
  66.             Tile a = p.getNextTile();
  67.             Walking.walkTo(a);
  68.             Time.sleep(3500);
  69.             isAtHillGiantsLadder = true;
  70.         }
  71.  
  72.     }
  73.  
  74.     public void climbDownLadder(){
  75.         System.out.println("Climbing down ladder");
  76.         GameObject hillGiantLadder = GameObjects.getNearest(17384);
  77.         if (hillGiantLadder != null){
  78.             hillGiantLadder.interact("Climb-down");
  79.             Time.sleep(3000);
  80.             isAtHillGiantsLadder = false;
  81.         }
  82.     }
  83.  
  84.     /*private void goHome() {
  85.         KeyBoard.typeWord("::home", true);
  86.         Time.sleep(2400, 3000);
  87.  
  88.     }*/
  89.  
  90.     public void getState(){
  91.         if (Calculations.distanceTo(eigth) > 4
  92.                 && Calculations.distanceTo(eigth) < 80) {
  93.             state = 1;
  94.             isAtDestination = false;
  95.         } else if (Calculations.distanceTo(eigth) < 6) {
  96.             isAtHillGiantsLadder = true;
  97.             state = 2;
  98.         }  else if (Calculations.distanceTo(atHillGiants) < 8){
  99.             isAtDestination = true;
  100.             state = 3;
  101.         }
  102.         else {
  103.             state = 0;
  104.             isAtDestination = false;
  105.         }
  106.     }
  107.  
  108.     public boolean onStart() {
  109.  
  110.         return true;
  111.     }
  112.  
  113.  
  114.  
  115.  
  116.         @Override
  117.         public void repaint(Graphics g1) {
  118.  
  119.  
  120.         }
  121.  
  122.  
  123.         @Override
  124.         public int loop() {
  125.             walkTo();
  126.  
  127.  
  128.             return 200;
  129.         }
  130.  
  131.     @Override
  132.     public void MessageRecieved(int i, String s, String s1, String s2) {
  133.  
  134.     }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement