Examples of RSInterface


Examples of org.rsbot.script.wrappers.RSInterface

   * Access the last message spoken by a player.
   *
   * @return The last message spoken by a player or "" if none.
   */
  public String getLastMessage() {
    final RSInterface chatBox = methods.interfaces.get(INTERFACE_CHAT_BOX);
    for (int i = 279; i >= 180; i--) {// Valid text is from 180 to 279, was 58-157
      final String text = chatBox.getComponent(i).getText();
      if (!text.isEmpty() && text.contains("<")) {
        return text;
      }
    }
    return "";
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

      final org.rsbot.client.RSInterface tab = methods.gui.getTab(t);
      if (tab != null && tab.getTextureID() != -1) {
        return t;
      }
    }
    final RSInterface logout = methods.interfaces.get(INTERFACE_LOGOUT);
    return logout != null && logout.isValid() ? Tab.LOGOUT : Tab.NONE;
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

   * Are we in the first stage of a trade?
   *
   * @return <tt>true</tt> if in first stage.
   */
  public boolean inTradeMain() {
    final RSInterface tradeInterface = methods.interfaces.get(INTERFACE_TRADE_MAIN);
    return tradeInterface != null && tradeInterface.isValid();
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

   * Are we in the second stage of a trade?
   *
   * @return <tt>true</tt> if in second stage.
   */
  public boolean inTradeSecond() {
    final RSInterface tradeInterface = methods.interfaces.get(INTERFACE_TRADE_SECOND);
    return tradeInterface != null && tradeInterface.isValid();
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

      return new RSInterface[0];
    }
    final List<RSInterface> out = new ArrayList<RSInterface>();
    for (int i = 0; i < inters.length; i++) {
      if (inters[i] != null) {
        final RSInterface in = get(i);
        if (in.isValid()) {
          out.add(in);
        }
      }
    }
    return out.toArray(new RSInterface[out.size()]);
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

  /**
   * @param index The index of the interface.
   * @return The <tt>RSInterface</tt> for the given index.
   */
  public synchronized RSInterface get(final int index) {
    RSInterface inter;
    final int cacheLen = mainCache.length;
    if (index < cacheLen) {
      inter = mainCache[index];
      if (inter == null) {
        inter = new RSInterface(methods, index);
        mainCache[index] = inter;
      }
    } else {
      inter = sparseMap.get(index);
      if (inter == null) {
        enlargeCache();
        if (index < cacheLen) {
          inter = mainCache[index];
          if (inter == null) {
            inter = new RSInterface(methods, index);
            mainCache[index] = inter;
          }
        } else {
          inter = new RSInterface(methods, index);
          sparseMap.put(index, inter);
        }
      }
    }
    return inter;
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

    final org.rsbot.client.RSInterface[][] inters = methods.client.getRSInterfaceCache();
    if (inters != null && mainCache.length < inters.length) { // enlarge
      // cache
      mainCache = Arrays.copyOf(mainCache, inters.length);
      for (int i = mainCache.length; i < mainCache.length; i++) {
        final RSInterface tmp = sparseMap.get(i);
        if (tmp != null) {
          sparseMap.remove(i);
          mainCache[i] = tmp;
        }
      }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

      interfaces.getComponent(ID_InterfaceTalk, ID_InterfaceTalkText).doClick();
      return random(900, 1200);
    }
    // Check if the sandwhich window is open
    if (interfaces.get(ID_InterfaceSandwhichWindow).isValid()) {
      final RSInterface window = interfaces.get(ID_InterfaceSandwhichWindow);
      int offset = -1;
      final String txt = window.getComponent(ID_InterfaceSandwhichWindowText).getText();
      for (int off = 0; off < Item_Names.length; off++) {
        if (txt.contains(Item_Names[off])) {
          offset = off;
          if (DEBUG) {
            log.info("Found: " + Item_Names[off] + " - ID: " + ID_Items[off]);
          }
        }
      }
      for (int i = 7; i < 48; i++) {
        final RSComponent inf = window.getComponent(i);
        if (DEBUG) {
          log.info("child[" + i + "] ID: " + inf.getModelID() + " == " + ID_Items[offset]);
        }
        if (inf.getModelID() == ID_Items[offset]) {
          inf.doClick();
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

   *
   * @return The items equipped as seen when the equipment tab was last
   *         opened.
   */
  public RSItem[] getCachedItems() {
    final RSInterface equipment = methods.interfaces.get(INTERFACE_EQUIPMENT);
    final RSComponent[] components = equipment.getComponents();
    final RSItem[] items = new RSItem[slotArray.length];
    for (int i = 0; i < items.length; i++) {
      items[i] = new RSItem(methods, components[slotArray[i].componentID()]);
    }
    return items;
View Full Code Here

Examples of org.rsbot.script.wrappers.RSInterface

          }
        }
        break;

      case SOLVE:
        final RSInterface solver = interfaces.get(CHEST_INTERFACE_PARENT);
        if (solver.isValid()) {
          if (solved()) {
            if (solver.getComponent(CHEST_INTERFACE_UNLOCK).doClick()) {
              return random(600, 900);
            }
            return 0;
          }
          final RSComponent container = solver.getComponent(CHEST_INTERFACE_CENTER);
          final String s = solver.getComponent(32).getText();
          if (s.contains("Bowl")) {
            index = 0;
          } else if (s.contains("Ring")) {
            index = 1;
          } else if (s.contains("Coin")) {
            index = 2;
          } else if (s.contains("Bar")) {
            index = 3;
          }
          for (int i = 0; i < 3; i++) {
            final RSComponent target = solver.getComponent(INTERFACE_SOLVE_IDS[index][i]);
            final int y = target.getRelativeY();
            int direction;
            if (y < 50 && y > -50) {
              direction = 0;
            } else if (y >= 50) {
              direction = 1;
            } else {
              direction = random(0, 2);
            }
            final RSComponent arrow = solver.getComponent(ARROWS[i][direction]);
            while (container.isValid() && target.isValid() && arrow.isValid() &&
                !container.getArea().contains(target.getCenter()) && new Timer(10000).isRunning()) {
              if (arrow.doClick()) {
                sleep(random(800, 1200));
              }
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.