Examples of RSComponent


Examples of org.rsbot.script.wrappers.RSComponent

   *
   * @return <tt>true</tt> if the setting was clicked; otherwise <tt>false</tt>.
   */
  public boolean disableAid() {
    if (methods.settings.getSetting(427) == 1 && openTab(Tab.OPTIONS)) {
      final RSComponent toggle = methods.interfaces.getComponent(Tab.OPTIONS.interfaceID(), 7);
      return toggle != null && toggle.doClick();
    }
    return false;
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

   * @return <tt>RSComponent</tt> of the current valid talk interface; otherwise null.
   * @see #INTERFACE_TALKS
   */
  public RSComponent getTalkInterface() {
    for (final int talk : INTERFACE_TALKS) {
      final RSComponent child = methods.interfaces.getComponent(talk, 0);
      if (child.isValid()) {
        return child;
      }
    }
    return null;
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

    if (methods.client.isSpellSelected() || methods.inventory.isItemSelected()) {
      return false;
    }
    if (getTab() != Tab.LOGOUT) {
      final int idx = methods.client.getGUIRSInterfaceIndex();
      RSComponent exitComponent = methods.interfaces.getComponent(idx, isFixed() ? 182 : 176);
      if (exitComponent == null || !exitComponent.doClick()) {
        return false;
      }
      long time = System.currentTimeMillis();
      while (getTab() != Tab.LOGOUT) {
        if (System.currentTimeMillis() - time > 2000) {
          break;
        }
        sleep(random(50, 100));
      }
    }
    RSComponent exitToComponent = methods.interfaces.getComponent(INTERFACE_LOGOUT, lobby ? 2 : 13);
    if (exitToComponent != null && exitToComponent.doClick()) {
      sleep(random(1500, 2000));
    }
    return !isLoggedIn();
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

   */
  public boolean mouseChatButton(final ChatButton button, final boolean left) {
    if (button == null || (left && isButtonSelected(button))) {
      return false;
    }
    final RSComponent chatButton = methods.interfaces.getComponent(CHAT_OPTION, button.idx());
    return chatButton.isValid() && chatButton.doClick(left);
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

   *
   * @param name The name of the quest.
   * @return <tt>true</tt> if the quest was opened.
   */
  public boolean openQuest(final String name) {
    RSComponent quest = getComponent(name);
    RSComponent scrollBar = methods.interfaces.getComponent(QUESTS, SCROLL_COMPONENT);
    if (quest != null && scrollBar != null) {
      if (methods.interfaces.scrollTo(quest, scrollBar)) {
        return quest.doClick();
      }
    }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

   * @return The users in the channel or null if unavailable
   */
  public User[] getUsers() {
    if (isInChannel()) {
      final java.util.ArrayList<User> users = new java.util.ArrayList<User>();
      final RSComponent list = methods.interfaces.getComponent(FriendChat.INTERFACE_FRIEND_CHAT, FriendChat.INTERFACE_FRIEND_CHAT_USERS_LIST);
      if (list != null) {
        for (final RSComponent c : list.getComponents()) {
          if (c == null) {
            continue;
          }
          String name = c.getText();
          if (name != null && !name.isEmpty() && name.contains("..")) {
            final String[] actions = c.getActions();
            if (actions != null) {
              for (final String action : actions) {
                if (action != null) {
                  if (action.contains("Add") || action.contains("Remove")) {
                    name = action.substring(action.indexOf(32, action.indexOf(32) + 1) + 1);
                    break;
                  }
                }
              }
            }
          }
          final int componentIndex = c.getComponentIndex();
          RSComponent rank = methods.interfaces.getComponent(FriendChat.INTERFACE_FRIEND_CHAT, 6);
          rank = rank.getComponent(componentIndex);
          RSComponent world = methods.interfaces.getComponent(FriendChat.INTERFACE_FRIEND_CHAT, 8);
          world = world.getComponent(componentIndex);
          users.add(new User(name, rank, world));
        }
        return users.toArray(new User[users.size()]);
      }
    }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

     * @return <tt>true</tt> if successful; otherwise <tt>false</tt>
     */
    public boolean add(final String name) {
      if (name != null && !name.isEmpty()) {
        openTab();
        final RSComponent c = methods.interfaces.getComponent(FriendsList.FRIENDSLIST, FriendsList.FRIENDSLIST_BUTTON_ADD_FRIEND);
        if (c != null) {
          c.doClick();
          sleep(random(300, 550));
          methods.keyboard.sendText(name, true);
          sleep(random(600, 800));
          return getFriend(name) != null;
        }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

     *
     * @return an array instance of <code>Friend</code>
     */
    public Friend[] getFriends() {
      openTab();
      final RSComponent list = methods.interfaces.getComponent(FriendsList.FRIENDSLIST, FriendsList.FRIENDSLIST_LIST_FRIENDS);
      if (list != null) {
        final java.util.ArrayList<Friend> friends = new java.util.ArrayList<Friend>();
        for (final RSComponent c : list.getComponents()) {
          if (c == null) {
            continue;
          }
          String name = c.getComponentName();
          name = name.substring(name.indexOf(62) + 1);
          RSComponent world = methods.interfaces.getComponent(FriendsList.FRIENDSLIST, 5);
          world = world.getComponent(c.getIndex());
          friends.add(new Friend(name, world));
        }
        return friends.toArray(new Friend[friends.size()]);
      }
      return new Friend[0];
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

     * @param name the name of the friend to remove
     * @return <tt>true</tt> if successful; otherwise <tt>false</tt>
     */
    public boolean remove(final String name) {
      if (name != null && getFriend(name) != null) {
        final RSComponent c = methods.interfaces.getComponent(FriendsList.FRIENDSLIST, FriendsList.FRIENDSLIST_BUTTON_REMOVE_FRIEND);
        if (c != null) {
          c.doClick();
          sleep(random(300, 550));
          methods.keyboard.sendText(name, true);
          sleep(random(600, 800));
          return getFriend(name) != null;
        }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

     *
     * @return the count of this end-user's friends
     */
    public int getCount() {
      openTab();
      final RSComponent c = methods.interfaces.getComponent(FriendsList.FRIENDSLIST, FriendsList.FRIENDSLIST_LABEL_FRIENDS_COUNT);
      if (c != null) {
        final String text = c.getText();
        return Integer.parseInt(text.split(" ")[0]);
      }
      return -1;
    }
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.