Пример #1
0
 /*
 public boolean clickCenterOfModel(){
 	if(isOnScreen() && getLDModel()!=null){
 		Point p = new Point(getCenterOfModel());
 		if(p.x>0 && p.x<515 && p.y>54 && p.y<388){
 			Mouse.clickMouse(p, 1);
 			return true;
 		}
 	}
 	return false;
 }*/
 public boolean clickModel() {
   if (isOnScreen() && getLDModel() != null) {
     int[][] pts = projectVertices();
     int randInd = new Random().nextInt(pts.length);
     Point p = new Point(pts[randInd][0], pts[randInd][1]);
     if (p.x > 0 && p.x < 515 && p.y > 54 && p.y < 388) {
       Mouse.move(p);
       try {
         Thread.sleep(100);
       } catch (Exception e) {
       }
       Mouse.click();
       return true;
     }
   }
   return false;
 }
Пример #2
0
 public boolean clickTile() {
   if (isOnScreen()) {
     Polygon p = Calculations.getTilePolygon(getLocationX(), getLocationY());
     Rectangle r = p.getBounds();
     Point pt =
         new Point(new Random().nextInt(r.width) + r.x, new Random().nextInt(r.height) + r.y);
     if (pt.x > 0 && pt.x < 515 && pt.y > 54 && pt.y < 388) {
       Mouse.move(pt);
       try {
         Thread.sleep(100);
       } catch (Exception e) {
       }
       Mouse.click();
       return true;
     }
   }
   return false;
 }
Пример #3
0
 public boolean doAction(String action) {
   if (!Menu.isOpen()) {
     Point p = getRandomPoint();
     if (p.equals(new Point(-1, -1))) {
       return false;
     }
     if (!containsPoint(p)) return false;
     Mouse.move(p);
     try {
       Thread.sleep(100);
     } catch (Exception e) {
     }
     if (Menu.getIndex(action) == 0) {
       Mouse.click();
       for (int i = 0; i < 20; ++i) {
         if (Client.getMouseCrosshairState() == 2) return true;
         if (Client.getMouseCrosshairState() == 1) return false;
         try {
           Thread.sleep(100);
         } catch (InterruptedException e) {
         }
       }
       return false;
     }
     if (Menu.getIndex(action) > 0) {
       Mouse.rightClick();
       for (int i = 0; i < 10; ++i) {
         if (Menu.isOpen()) break;
         try {
           Thread.sleep(100);
         } catch (Exception e) {
         }
       }
     }
   }
   return Menu.click(action);
 }