コード例 #1
0
ファイル: Walking.java プロジェクト: Greyn/RSBot-API
  /**
   * 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;
          }
        });
  }
コード例 #2
0
ファイル: Fisher.java プロジェクト: ekux44/autobot
 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));
   }
 }
コード例 #3
0
ファイル: Walking.java プロジェクト: Greyn/RSBot-API
 public static LocalPath findPath(final Locatable mobile) {
   return new LocalPath(mobile.getLocation());
 }