Ejemplo n.º 1
0
 /**
  * Moves the mouse to (x,y).
  *
  * @param x x
  * @param y y
  */
 public static void move(int x, int y) {
   while (distTo(x, y) > 2) {
     List<Point> list = genLine(last.x, last.y, x, y);
     for (Point p : list) {
       hop(p);
       Task.sleep(Random.nextGaussian(25 / speed.ordinal(), Random.nextInt(5, 15)));
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Left or right clicks with the mouse.
  *
  * @param left boolean indicating left-click or right-click
  */
 public static void click(boolean left) {
   com.infibot.client.accessors.Mouse m = Game.getClient().getMouse();
   m.mousePressed(
       new MouseEvent(
           Game.getCanvas(),
           MouseEvent.MOUSE_PRESSED,
           System.currentTimeMillis(),
           0,
           last.x,
           last.y,
           1,
           false,
           left ? MouseEvent.BUTTON1 : MouseEvent.BUTTON3));
   Task.sleep(Random.nextGaussian(100, 50));
   long l = System.currentTimeMillis();
   m.mouseReleased(
       new MouseEvent(
           Game.getCanvas(), MouseEvent.MOUSE_RELEASED, l, 0, last.x, last.y, 1, false));
   m.mouseClicked(
       new MouseEvent(Game.getCanvas(), MouseEvent.MOUSE_CLICKED, l, 0, last.x, last.y, 1, false));
 }