Examples of RSNPC


Examples of org.rsbot.script.wrappers.RSNPC

    for (final int element : ctx.client.getRSNPCIndexArray()) {
      final Node node = ctx.nodes.lookup(ctx.client.getRSNPCNC(), element);
      if (node == null || !(node instanceof RSNPCNode)) {
        continue;
      }
      final RSNPC npc = new RSNPC(ctx, ((RSNPCNode) node).getRSNPC());
      final Point location = ctx.calc.tileToScreen(npc.getLocation(), npc.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 = npc.getID() + (npc.getLevel() > 0 ? " (" + npc.getLevel() + ")" : "");
      render.setColor(npc.isInCombat() ? (npc.isDead() ? Color.gray : Color.red) : npc.isMoving() ? Color.green : Color.WHITE);
      render.drawString(s, location.x - metrics.stringWidth(s) / 2, location.y - metrics.getHeight() / 2);
      if (npc.getAnimation() != -1 || npc.getGraphic() > 0) {
        s = "(A: " + npc.getAnimation() + " | G: " + npc.getGraphic() + ")";
        render.drawString(s, location.x - metrics.stringWidth(s) / 2, location.y - metrics.getHeight() * 3 / 2);
      }
    }
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

          }
        }
      }
    }
    if (!interfaces.clickContinue() && getMyPlayer().getAnimation() == -1) {
      final RSNPC demon = npcs.getNearest(demonID);
      demon.interact("Talk-to");
    }
    return random(2000, 2500);
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

  }


  @Override
  public boolean activateCondition() {
    final RSNPC captain = npcs.getNearest(ARNAV_ID);
    final RSObject portal = objects.getNearest(EXIT_PORTAL);
    return portal != null && captain != null;
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

    }
    if (interfaces.get(INTERFACE_COFFIN).isValid()) {
      atCloseInterface(INTERFACE_COFFIN, INTERFACE_COFFIN_CLOSE);
      sleep(500, 800);
    }
    RSNPC theNPC;
    if ((theNPC = npcs.getNearest(NPC_NAME)) == null) {
      return -1;
    }
    if (inventory.getCountExcept(GraveDigger.COFFINS) > 23) {
      if (interfaces.canContinue()) {
        interfaces.clickContinue();
        sleep(1500, 2000);
      }
      final RSObject depo = objects.getNearest(12731);
      if (depo != null) {
        if (!calc.tileOnScreen(depo.getLocation())) {
          walking.getPath(depo.getLocation()).traverse();
          camera.turnTo(depo);
        } else {
          depo.interact("Deposit");
        }
      }
      if (interfaces.get(Bank.INTERFACE_DEPOSIT_BOX).isValid()) {
        for (int i = 27; i > 23; i--) {
          interfaces.get(11).getComponent(17).getComponent(i).interact("Deposit-All");
          sleep(900, 1200);
        }
        interfaces.getComponent(11, 15).doClick();
        return random(500, 700);
      }
      return random(2000, 3000);
    }
    if (interfaces.get(236).isValid()) {
      if (interfaces.getComponent(236, 2).getText().trim().contains("know")) {
        interfaces.getComponent(236, 2).doClick();
      } else {
        interfaces.getComponent(236, 1).doClick();
      }
    }
    if (interfaces.canContinue()) {
      final String text = interfaces.getComponent(242, 4).getText().toLowerCase().trim();
      interfaces.clickContinue();
      if (text.contains("empty") || text.contains("not")) {
        removedGraves = false;
        talkToNPC = false;
        for (final Coffin coffin : coffins) {//Rinse and reuse data.
          coffin.setCoffinID(-1);
          coffin.setStoneID(-1);
          coffin.set = false;
        }
      }
      return random(500, 1200);
    }
    if (talkToNPC) {
      getNPCInView(theNPC);
      return theNPC.interact("Talk-to") ? random(800, 2000) : 0;
    }
    if (interfaces.get(220).isValid()) {
      return atCloseInterface(220, 16) ? random(500, 800) : 0;
    }
    if (getMyPlayer().isMoving() || getMyPlayer().getAnimation() != -1) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

    return npcs.getNearest("Mr. Mordaut") != null;
  }

  @Override
  public int loop() {
    final RSNPC mordaut = npcs.getNearest("Mr. Mordaut");
    if (mordaut == null) {
      return -1;
    }
    if (getMyPlayer().isMoving() || getMyPlayer().getAnimation() != -1) {
      return random(800, 1200);
    }
    if (door != null) {
      if (!calc.tileOnScreen(door.getLocation())) {
        walking.walkTileMM(door.getLocation());
        sleep(random(1400, 2500));
      }
      for (int i = 0; i < doorIDs.length; i++) {
        if (door.getID() == doorIDs[i]) {
          camera.setCompass(directions[i]);
          break;
        }
      }
      if (door != null) {
        if (door.interact("Open")) {
          return random(4500, 5700);
        }
      }
      return random(500, 1000);
    }
    final RSComponent inter = searchInterfacesText("To exit,");
    if (inter != null) {
      for (int i = 0; i < colors.length; i++) {
        if (inter.getText().toLowerCase().contains(colors[i])) {
          door = objects.getNearest(doorIDs[i]);
          break;
        }
      }
      return random(500, 1000);
    }
    if (!interfaces.get(nextObjectInterface).isValid() && !getMyPlayer().isMoving()
        && !interfaces.get(relatedCardsInterface).isValid() && !interfaces.canContinue()
        && door == null) {
      if (!calc.tileOnScreen(mordaut.getLocation())) {
        walking.walkTileMM(mordaut.getLocation());
      }
      if (mordaut != null) {
        mordaut.interact("Talk-to");
      }
      return random(1500, 1700);
    }
    if (interfaces.get(nextObjectInterface).isValid()) {
      log.info("Question Type: Next Object");
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

    final int[] indices = methods.client.getRSNPCIndexArray();
    final Set<RSNPC> npcs = new HashSet<RSNPC>();
    for (final int index : indices) {
      final Node node = methods.nodes.lookup(methods.client.getRSNPCNC(), index);
      if (node instanceof RSNPCNode) {
        final RSNPC npc = new RSNPC(methods, ((RSNPCNode) node).getRSNPC());
        if (npc != null && filter.accept(npc)) {
          npcs.add(npc);
        }
      }
    }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

   *         provided Filter; or null if there are no matching NPCs in the
   *         current region.
   */
  public RSNPC getNearest(final Filter<RSNPC> filter) {
    int min = 20;
    RSNPC closest = null;
    final int[] indices = methods.client.getRSNPCIndexArray();
    for (final int index : indices) {
      final Node node = methods.nodes.lookup(methods.client.getRSNPCNC(), index);
      if (node instanceof RSNPCNode) {
        final RSNPC npc = new RSNPC(methods, ((RSNPCNode) node).getRSNPC());
        if (npc != null && filter.accept(npc)) {
          final int distance = methods.calc.distanceTo(npc);
          if (distance < min) {
            min = distance;
            closest = npc;
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

    }
    if (interfaces.canContinue()) {
      interfaces.clickContinue();
      return random(1000, 1200);
    }
    final RSNPC certer = npcs.getNearest("Giles", "Miles", "Niles");
    if (certer != null) {
      if (calc.distanceTo(certer) < 4) {
        certer.interact("Talk-to");
        return random(2500, 3000);
      } else {
        final RSTile certerLocation = certer.getLocation();
        walking.walkTileMM(certerLocation.randomize(2, 1));
        return random(3000, 3500);
      }
    }
    if (failCount++ > 10) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

    for (final int element : methods.client.getRSNPCIndexArray()) {
      final Node node = methods.nodes.lookup(methods.client.getRSNPCNC(), element);
      if (node == null || !(node instanceof RSNPCNode)) {
        continue;
      }
      final RSNPC npc = new RSNPC(methods, ((RSNPCNode) node).getRSNPC());
      if (npc.getInteracting() != null && npc.getInteracting().equals(methods.players.getMyPlayer())) {
        for (final Familiar f : Familiar.values()) {
          if (f != null && npc.getName().equals(f.getName())) {
            f.setNPCObject(npc);
            return f;
          }
        }
      }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSNPC

    animation = -1;
  }

  @Override
  public boolean activateCondition() {
    final RSNPC mime = npcs.getNearest(1056);
    return mime != null && calc.distanceTo(mime.getLocation()) < 15;
  }
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.