Examples of RSPlayer


Examples of org.rsbot.script.wrappers.RSPlayer

  public void onRepaint(final Graphics render) {
    if (!ctx.game.isLoggedIn()) {
      return;
    }
    final RSPlayer player = ctx.players.getMyPlayer();
    if (player == null) {
      return;
    }
    final FontMetrics metrics = render.getFontMetrics();
    final RSTile location = player.getLocation();
    final int locX = location.getX();
    final int locY = location.getY();
    final int tHeight = metrics.getHeight();
    for (int x = locX - 25; x < locX + 25; x++) {
      for (int y = locY - 25; y < locY + 25; y++) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

  }

  public int drawLine(final Graphics render, int idx) {
    final int[] a = { -1, -1 };
    if (ctx.game.isLoggedIn()) {
      final RSPlayer player = ctx.players.getMyPlayer();
      a[0] = player.getAnimation();
      a[1] = player.getPassiveAnimation();
    }
    StringUtil.drawLine(render, idx++, "Animation " + a[0]);
    StringUtil.drawLine(render, idx++, "Stance Animation " + a[1]);
    return idx;
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

  public void onRepaint(final Graphics render) {
    if (!ctx.game.isLoggedIn()) {
      return;
    }
    final RSPlayer player = ctx.players.getMyPlayer();
    if (player == null) {
      return;
    }
    final FontMetrics metrics = render.getFontMetrics();
    final RSTile location = player.getLocation();
    final int locX = location.getX();
    final int locY = location.getY();
    final int tHeight = metrics.getHeight();
    for (int x = locX - 25; x < locX + 25; x++) {
      for (int y = locY - 25; y < locY + 25; y++) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

  public void onRepaint(final Graphics render) {
    if (!ctx.game.isLoggedIn()) {
      return;
    }
    final RSPlayer player = ctx.players.getMyPlayer();
    if (player == null) {
      return;
    }
    final RSTile oT = player.getLocation();
    final int plane = ctx.game.getPlane();
    final Iterator<Map.Entry<RSTile, Integer>> rs = Web.rs_map.entrySet().iterator();
    while (rs.hasNext()) {
      final Map.Entry<RSTile, Integer> e = rs.next();
      final RSTile tile = e.getKey();
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

    final FontMetrics metrics = render.getFontMetrics();
    for (final org.rsbot.client.RSPlayer element : players) {
      if (element == null) {
        continue;
      }
      final RSPlayer player = new RSPlayer(ctx, element);
      final Point location = ctx.calc.tileToScreen(player.getLocation(), player.getHeight() / 2);
      if (!ctx.calc.pointOnScreen(location)) {
        continue;
      }
      render.setColor(Color.RED);
      render.fillRect((int) location.getX() - 1, (int) location.getY() - 1, 2, 2);
      String s = player.getName() + " (" + player.getCombatLevel() + ")";
      render.setColor(player.isInCombat() ? (player.isDead() ? Color.GRAY : Color.RED) : player.isMoving() ? Color.GREEN : Color.WHITE);
      render.drawString(s, location.x - metrics.stringWidth(s) / 2, location.y - metrics.getHeight() / 2);
      final String msg = player.getMessage();
      boolean raised = false;
      if (player.getAnimation() != -1 || player.getGraphic() > 0 || player.getNPCID() != -1) {
        if (player.getNPCID() != -1) {
          s = "(NPC: " + player.getNPCID() + " | L: " + player.getLevel() + " | A: " + player.getAnimation() + " | G: " + player.getGraphic() + ")";
        } else {
          s = "(A: " + player.getAnimation() + " | G: " + player.getGraphic() + ")";
        }
        render.drawString(s, location.x - metrics.stringWidth(s) / 2, location.y - metrics.getHeight() * 3 / 2);
        raised = true;
      }
      if (msg != null) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

   * Returns an <tt>RSPlayer</tt> object representing the current player.
   *
   * @return An <tt>RSPlayer</tt> object representing the player.
   */
  public RSPlayer getMyPlayer() {
    return new RSPlayer(methods, methods.client.getMyRSPlayer());
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

    final int[] indices = methods.client.getRSPlayerIndexArray();
    final org.rsbot.client.RSPlayer[] array = methods.client.getRSPlayerArray();
    final Set<RSPlayer> players = new HashSet<RSPlayer>();
    for (final int index : indices) {
      if (index != 0 && array[index] != null) {
        final RSPlayer player = new RSPlayer(methods, array[index]);
        if (filter.accept(player)) {
          players.add(player);
        }
      }
    }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

   *         was accepted by the provided Filter; or null if there are no
   *         matching players in the current region.
   */
  public RSPlayer getNearest(final Filter<RSPlayer> filter) {
    int min = 20;
    RSPlayer closest = null;
    final org.rsbot.client.RSPlayer[] players = methods.client.getRSPlayerArray();
    final int[] indices = methods.client.getRSPlayerIndexArray();
    for (final int index : indices) {
      if (players[index] == null) {
        continue;
      }
      final RSPlayer player = new RSPlayer(methods, players[index]);
      if (filter.accept(player)) {
        final int distance = methods.calc.distanceTo(player);
        if (distance < min) {
          min = distance;
          closest = player;
View Full Code Here

Examples of org.rsbot.script.wrappers.RSPlayer

   * @param tradeWait  Timeout to wait for the trade.
   * @return <tt>true</tt> if traded.
   */
  public boolean tradePlayer(final String playerName, final int tradeWait) {
    if (!inTrade()) {
      final RSPlayer targetPlayer = methods.players.getNearest(playerName);
      return targetPlayer != null && targetPlayer.interact("Trade with ", targetPlayer.getName()) && waitForTrade(TRADE_TYPE_MAIN, tradeWait);
    } else {
      return isTradingWith(playerName);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.