Ejemplo n.º 1
0
  /**
   * Clicks a tile on the minimap.
   *
   * @param mobile The mobile to click (global).
   * @return <tt>true</tt> if the mobile was clicked; otherwise <tt>false</tt>.
   */
  public static boolean walk(final Locatable mobile) {
    Tile stepDirection = mobile.getLocation();
    if (!stepDirection.isOnMap()) {
      stepDirection = getClosestOnMap(stepDirection);
    }
    final Tile tile = stepDirection;
    return Mouse.apply(
        new ViewportEntity() {
          public Point getCentralPoint() {
            return Calculations.worldToMap(tile.getX(), tile.getY());
          }

          public Point getNextViewportPoint() {
            return getCentralPoint();
          }

          public boolean contains(final Point point) {
            return getCentralPoint().distance(point) <= 2;
          }

          public boolean validate() {
            return tile.isOnMap();
          }
        },
        new Filter<Point>() {
          public boolean accept(final Point point) {
            Mouse.click(true);
            return true;
          }
        });
  }
Ejemplo n.º 2
0
 public void setCameraRelativeTo(final Locatable reference) {
   final Tile playerTile = Players.getLocal().getLocation();
   final Tile referenceTile = reference.getLocation();
   if (playerTile.getX() < referenceTile.getX()) {
     Camera.setAngle(Random.nextInt(250, 270));
   } else if (playerTile.getX() > referenceTile.getX()) {
     Camera.setAngle(Random.nextInt(80, 100));
   } else if (playerTile.getY() > referenceTile.getY()) {
     Camera.setAngle(Random.nextInt(170, 180));
   } else if (playerTile.getY() < referenceTile.getY()) {
     Camera.setAngle(Random.nextInt(350, 360));
   }
 }
Ejemplo n.º 3
0
 public static LocalPath findPath(final Locatable mobile) {
   return new LocalPath(mobile.getLocation());
 }