Examples of RSObject


Examples of org.rsbot.script.wrappers.RSObject

            obj = node.getRSAnimable();
            if (obj != null
                && obj instanceof org.rsbot.client.RSObject) {
              rsObj = (org.rsbot.client.RSObject) obj;
              if (rsObj.getID() != -1) {
                objects.add(new RSObject(methods, rsObj, RSObject.Type.INTERACTABLE, plane));
              }
            }
          }
        }

        // Ground Decorations
        if ((mask & TYPE_FLOOR_DECORATION) != 0) {
          obj = rsGround.getFloorDecoration();
          if (obj != null) {
            rsObj = (org.rsbot.client.RSObject) obj;
            if (rsObj.getID() != -1) {
              objects.add(new RSObject(methods, rsObj, RSObject.Type.FLOOR_DECORATION, plane));
            }
          }
        }

        // Boundaries / Doors / Fences / Walls
        if ((mask & TYPE_BOUNDARY) != 0) {
          obj = rsGround.getBoundary1();
          if (obj != null) {
            rsObj = (org.rsbot.client.RSObject) obj;
            if (rsObj.getID() != -1) {
              objects.add(new RSObject(methods, rsObj, RSObject.Type.BOUNDARY, plane));
            }
          }

          obj = rsGround.getBoundary2();
          if (obj != null) {
            rsObj = (org.rsbot.client.RSObject) obj;
            if (rsObj.getID() != -1) {
              objects.add(new RSObject(methods, rsObj, RSObject.Type.BOUNDARY, plane));
            }
          }
        }

        // Wall Decorations
        if ((mask & TYPE_WALL_DECORATION) != 0) {
          obj = rsGround.getWallDecoration1();
          if (obj != null) {
            rsObj = (org.rsbot.client.RSObject) obj;
            if (rsObj.getID() != -1) {
              objects.add(new RSObject(methods, rsObj, RSObject.Type.WALL_DECORATION, plane));
            }
          }

          obj = rsGround.getWallDecoration2();
          if (obj != null) {
            rsObj = (org.rsbot.client.RSObject) obj;
            if (rsObj.getID() != -1) {
              objects.add(new RSObject(methods, rsObj, RSObject.Type.WALL_DECORATION, plane));
            }
          }
        }
      }
    } catch (final Exception ignored) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

   * @return An <tt>RSObject</tt> representing the nearest object that was
   *         accepted by the filter; or null if there are no matching objects
   *         in the current region.
   */
  public RSObject getNearest(final Filter<RSObject> filter) {
    RSObject cur = null;
    double dist = -1;
    for (int x = 0; x < 104; x++) {
      for (int y = 0; y < 104; y++) {
        final Set<RSObject> objs = getAtLocal(x, y, -1);
        for (final RSObject o : objs) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

    if (getMyPlayer().getAnimation() != -1) {
      return random(500, 1000);
    }
    //Leaves random
    if (interfaces.getComponent(242, 4).containsText("The exit portal's")) {
      final RSObject portal = objects.getNearest(12731, 11373);
      if (portal != null) {
        if (!calc.tileOnScreen(portal.getLocation())) {
          walking.walkTileOnScreen(portal.getLocation());
        } else {
          if (portal.interact("Enter")) {
            return random(2000, 3000);
          }
          return 200;
        }
      }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

    if (interfaces.clickContinue()) {
      return 100;
    }
    final int appendage = getOddAppendage();
    try {
      final RSObject obj = objects.getNearest(appendage);
      if (!obj.isOnScreen()) {
        if (walking.walkTileMM(obj.getLocation())) {
          sleep(500, 750);
        }
      } else {
        if (obj.interact("Operate")) {
          sleep(1000, 1500);
        }
      }
    } catch (final Exception ignored) {
    }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject


  @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.RSObject

    if (getMyPlayer().isMoving()) {
      return random(700, 1200);
    }
    switch (getState()) {
      case EXIT:
        final RSObject portal = objects.getNearest(EXIT_PORTAL);
        if (portal != null) {
          if (!portal.isOnScreen()) {
            if (random(0, 2) == 1) {
              camera.turnTo(portal);
            } else {
              if (walking.walkTileMM(portal.getLocation())) {
                sleep(800, 1000);
              }
            }
          }
          if (portal.interact("Enter")) {
            return random(3000, 3500);
          }
        }
        break;

      case OPEN_CHEST:
        final RSObject chest = objects.getNearest(ARNAV_CHEST);
        if (chest != null) {
          if (chest.interact("Open")) {
            return random(1000, 1300);
          }
        }
        break;
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

          return random(500, 600);
        }
        if (inventory.getCount(false) == 28
            && !inventory.containsAll(DOOR_KEY)) {
          log("Not enough space for this random. Depositing an Item");
          final RSObject depo = objects.getNearest(32924);
          if (depo != null) {
            if (!calc.tileOnScreen(depo.getLocation())) {
              if (!walking.walkTileMM(depo.getLocation().randomize(2,
                  2))) {
                walking.getPath(depo.getLocation().randomize(2, 2))
                    .traverse();
                return random(500, 700);
              }
              return random(700, 1500);
            }
            camera.turnTo(depo, 20);
            if (depo.interact("Deposit")) {
              sleep(random(1600, 2000));
              if (getMyPlayer().isMoving()) {
                sleep(random(200, 500));
              }
              if (interfaces.get(Bank.INTERFACE_DEPOSIT_BOX)
                  .isValid()) {
                sleep(random(700, 1200));
                interfaces.get(11).getComponent(17)
                    .getComponent(random(16, 17))
                    .interact("All");
                sleep(random(700, 1200));
                interfaces.getComponent(11, 15).doClick();
              }
              return random(400, 500);
            }
            return random(500, 800);
          }
          return random(500, 600);
        }

        if (getMyPlayer().isMoving()) {
          return random(250, 500);
        }
        if (anInterfaceContains("minute")) {
          talkedtopete = true;
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
            return random(500, 600);
          }
          return random(500, 600);
        }

        if (interfaces.get(228).isValid()
            && interfaces.get(228).containsText("How do")) {
          interfaces.get(228).getComponent(3).doClick();
          return random(500, 600);
        }
        if (interfaces.canContinue()) {
          interfaces.clickContinue();
          return random(1000, 1200);
        }
        if (!talkedtopete && PrisonPete != null
            && !interfaces.get(228).isValid()
            && !interfaces.canContinue()) {
          if (!calc.tileOnScreen(PrisonPete.getLocation())) {
            walking.walkTileMM(PrisonPete.getLocation());
            return random(1000, 1400);
          }
          if (PrisonPete.interact("talk")) {
            return random(1500, 1600);
          } else {
            camera.turnTo(PrisonPete.getLocation());
            return random(500, 600);
          }
        }
        if (unlocked == 3) {
          state = 4;
          return random(250, 500);
        }
        if (unlocked <= 2 && talkedtopete) {
          state = 1;
          return random(500, 600);
        }
        return random(350, 400);

      case 1:
        // Figures out the balloon
        if (anInterfaceContains("Lucky you!")) {
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
          }
          state = 4;
          taskDone = true;
          return random(500, 600);
        }
        if (anInterfaceContains("should leave")) {
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
          }
          state = 4;
          unlocked = 10;
          return random(500, 600);
        }
        if (interfaces.get(273).getComponent(3).isValid()) {
          if (atLever()) {
            if (balloonToPop != null
                && interfaces.get(273).getComponent(4)
                .interact("Close")) {
              state = 2;
              return random(800, 900);
            }
            return random(500, 700);
          }
        }
        final RSObject lever = objects.getNearest(LEVER_ID);
        if (lever != null && talkedtopete) {
          if (!calc.tileOnScreen(lever.getLocation())) {
            walking.walkTileMM(lever.getLocation());
            return random(1000, 1200);
          }
          if (!getMyPlayer().isMoving()
              && calc.tileOnScreen(lever.getLocation())) {
            // if (tiles.doAction(lever.getLocation(), 0.5, 0.5, 170,
            // "Pull")) {
            if (lever.interact("Pull")) {
              sleep(random(1400, 1600));
              if (atLever()) {
                if (balloonToPop != null
                    && interfaces.get(273).getComponent(4)
                    .interact("Close")) {
                  state = 2;
                  return random(800, 900);
                }
                return random(500, 700);
              }
              return random(500, 600);
            } else {
              camera.turnTo(lever.getLocation());
              return random(500, 600);
            }
          }
        }
        if (!talkedtopete) {
          state = 0;
          return random(500, 600);
        }
        return random(500, 600);
      case 2:
        // Finds animal and pops it
        if (anInterfaceContains("Lucky you!")) {
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
          }
          state = 4;
          taskDone = true;
          return random(500, 600);
        }
        if (anInterfaceContains("should leave")) {
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
          }
          state = 4;
          unlocked = 10;
          return random(500, 600);
        }
        if (getMyPlayer().isMoving()) {
          return random(250, 500);
        }
        if (balloonToPop == null && unlocked <= 2) {
          state = 1;
          return random(500, 700);
        }
        if (unlocked == 3) {
          state = 4;
        }

        if (!inventory.containsAll(DOOR_KEY)) {
          if (calc.tileOnScreen(balloonToPop.getLocation())) {
            balloonToPop.interact("Pop");
            return random(1200, 1800);
          } else {
            if (!getMyPlayer().isMoving()) {
              walking.walkTileMM(balloonToPop.getLocation()
                  .randomize(2, 2));
              return random(500, 750);
            }
            return random(500, 750);
          }
        }
        if (inventory.contains(DOOR_KEY)) {
          hasKey = false;
          state = 3;
          return random(500, 700);
        }
        return random(350, 400);

      case 3:
        // Goes to pete
        PrisonPete = npcs.getNearest("Prison Pete");
        if (getMyPlayer().isMoving()) {
          return random(250, 500);
        }
        if (anInterfaceContains("Lucky you!")) {
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
          }
          state = 4;
          taskDone = true;
          return random(500, 600);
        }
        if (anInterfaceContains("should leave")) {
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
          }
          state = 4;
          unlocked = 10;
          return random(500, 600);
        }
        if (anInterfaceContains("you got all the keys")) {
          hasKey = true;
          unlocked = 5;
          state = 4;
          balloonToPop = null;
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
            return random(500, 600);
          }
          return random(250, 500);
        }
        if (anInterfaceContains("Hooray")) {
          hasKey = true;
          if (interfaces.canContinue()) {
            interfaces.clickContinue();
            return random(500, 600);
          }
        }
        if (interfaces.canContinue()) {
          interfaces.clickContinue();
          return random(500, 600);
        }
        if (PrisonPete != null && !calc.tileOnScreen(PrisonPete.getLocation())
            && !interfaces.get(243).isValid()) {
          walking.walkTileMM(PrisonPete.getLocation());
          return random(400, 600);
        }
        if (!inventory.contains(DOOR_KEY)
            && npcs.getNearest(PRISON_MATE) != null
            && unlocked <= 2 && hasKey) {
          unlocked++;
          state = 0;
          balloonToPop = null;
          return random(350, 400);
        }

        if (inventory.contains(DOOR_KEY) && !getMyPlayer().isMoving()) {
          inventory.getItem(DOOR_KEY).interact("Return");
          return random(1000, 2000);
        }
        if (!inventory.contains(DOOR_KEY)
            && npcs.getNearest(PRISON_MATE) != null
            && unlocked <= 2 && !hasKey) {
          state = 0;
          balloonToPop = null;
          return random(350, 400);
        }

        return random(350, 400);
      case 4:
        // exits
        final RSTile doorTile = new RSTile(2086, 4459);
        if (unlocked <= 2 && !taskDone) {
          state = 0;
          return random(500, 600);
        }
        if (!calc.tileOnScreen(doorTile)) {
          walking.walkTileMM(doorTile);
          return random(400, 500);
        }
        if (calc.tileOnScreen(doorTile)) {
          final RSObject gate = objects.getNearest(11177, 11178);
          if (gate != null) {
            gate.interact("Open");
          }
          // tiles.doAction(new RSTile(2085, 4459), 1, 0, 30, "Open");
          return random(500, 600);
        }
        return random(200, 400);
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

    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) {
      return random(1000, 1300);
    }
    RSObject interactionObject;
    if (!removedGraves && (interactionObject = objects.getNearest(FILLED_GRAVES)) != null) {
      getObjectInView(interactionObject);
      interactionObject.interact("Take-coffin");
      return random(1200, 2000);
    } else {
      removedGraves = true;
    }
    int undecidedID;
    if ((undecidedID = getUndecidedGrave()) != -1) {
      final RSObject theGrave = objects.getNearest(undecidedID);
      getObjectInView(theGrave);
      if (theGrave.interact("Read")) {
        final long systemTime = System.currentTimeMillis();
        while (System.currentTimeMillis() - systemTime < 8000 && !interfaces.get(INTERFACE_GRAVE).isValid()) {
          sleep(50, 150);
        }
        sleep(1200, 2500);
        RSComponent inter;
        if ((inter = interfaces.getComponent(INTERFACE_GRAVE, INTERFACE_GRAVE_ID)) != null) {
          final int theID = inter.getComponentID();
          boolean found = false;
          for (Coffin coffin : coffins) {
            if (coffin.modelID == theID) {
              coffin.setStoneID(undecidedID);
              found = true;
              break;
            }
          }
          if (!found) {
            log("IDs have changed, please alert Timer.");
            return -1;
          }
        }
      }
      if (interfaces.get(INTERFACE_GRAVE).isValid()) {
        atCloseInterface(INTERFACE_GRAVE, INTERFACE_GRAVE_CLOSE);
        sleep(500, 800);
      }
    } else if ((undecidedID = getUndecidedCoffin()) != -1) {
      final RSItem item = inventory.getItem(undecidedID);
      if (item != null) {
        if (item.interact("Check")) {
          final long systemTime = System.currentTimeMillis();
          while (System.currentTimeMillis() - systemTime < 8000 && !interfaces.get(INTERFACE_COFFIN).isValid()) {
            sleep(50, 150);
          }
          sleep(1200, 2500);
          if (interfaces.getComponent(INTERFACE_COFFIN) != null) {
            final Integer[] allItems = new Integer[INTERFACE_COFFIN_IDS.length];
            final List<Integer> ids = new ArrayList<Integer>();
            for (final int index : INTERFACE_COFFIN_IDS) {
              ids.add(interfaces.getComponent(INTERFACE_COFFIN, index).getComponentID());
            }
            ids.toArray(allItems);
            boolean found = false;
            for (Coffin coffin : coffins) {
              if (coffin.doesMatch(allItems)) {
                coffin.setCoffinID(undecidedID);
                found = true;
                break;
              }
            }
            if (!found) {
              log("IDs have changed, please alert Timer.");
              return -1;
            }
          }
        }
        if (interfaces.get(INTERFACE_COFFIN).isValid()) {
          atCloseInterface(INTERFACE_COFFIN, INTERFACE_COFFIN_CLOSE);
          sleep(500, 800);
        }
      }
    } else {
      boolean done = true;
      for (Coffin coffin : coffins) {
        if (!coffin.set) {
          done = false;
          final int graveID = getEmptyGrave(coffin.stoneID);
          final RSObject grave = objects.getNearest(graveID);
          if (grave != null) {
            getObjectInView(grave);
            final RSItem theCoffin = inventory.getItem(coffin.coffinID);
            if (theCoffin != null) {
              if (useItem(theCoffin, grave)) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

    }
    if (getMyPlayer().isMoving() || getMyPlayer().getAnimation() != -1) {
      return random(300, 500);
    }
    if (getScore() >= 10) {
      final RSObject exit = objects.getNearest(15010);
      if (exit != null) {
        if (calc.tileOnScreen(exit.getLocation())) {
          if (exit.interact("Exit")) {
            return random(4000, 4200);
          }
        } else {
          camera.setCompass('s');
          walking.walkTileOnScreen(exit.getLocation());
          return random(1400, 1500);
        }
      }
    }
    final RSObject pillar = objects.getNearest(ACTIVE_PILLARS);
    if (pillar != null) {
      if (calc.distanceTo(pillar) > 2 && !pillar.isOnScreen()) {
        walking.walkTileOnScreen(pillar.getLocation());
        return random(500, 600);
      }
      if (pillar.interact("Tag")) {
        final int before = getScore();
        for (int i = 0; i < 50; i++) {
          if (getScore() > before) {
            return random(50, 100);
          }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSObject

      return random(150, 200);
    }

    if (getMyPlayer().getLocation().equals(new RSTile(2911, 4576))) {
      if (getMyPlayer().getAnimation() == -1) {
        final RSObject ob = objects.getNearest(3634);
        ob.interact("Touch");
        return random(5000, 6000);
      }
    }
    if (usePath.equals("None")) {
      getPath();
      return random(900, 1100);
    }

    if (getMyPlayer().getLocation().equals(tileAfterDoor())) {
      doorIndex += 1;
      log("Getting new wall");
      getNewWall();
      return random(200, 300);
    }

    if (walkToTile != null && calc.distanceTo(walkToTile) >= 3) {
      if (!walking.getPath(walkToTile).traverse()) {
        walking.walkTileMM(walkToTile.randomize(2, 2));
      }

      return random(500, 600);
    }

    if (walkToTile != null && calc.distanceTo(walkToTile) <= 3) {
      if (doorDir != 'a' && !getMyPlayer().isMoving()) {
        if (camera.getAngle() - turnCameraTo() < 30 || camera.getAngle() - turnCameraTo() > 30) {
          camera.setAngle(turnCameraTo());
        }
        final RSObject obj = objects.getTopAt(walkToTile, Objects.TYPE_BOUNDARY);
        if (obj != null && obj.interact("Open") || atDoor(walkToTile, doorDir)) {
          return random(2750, 3250);
        }
      }
    }
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.