Exemplo n.º 1
0
 /**
  * Gets the users in the channel.
  *
  * @return The users in the channel or null if unavailable
  */
 public String[] getChannelUsers() {
   String[] temp = null;
   ArrayList<String> tempList = new ArrayList<String>();
   if (methods.game.getCurrentTab() != Game.TAB_CLAN_CHAT) {
     methods.game.openTab(Game.TAB_CLAN_CHAT);
   }
   if (methods.game.getCurrentTab() == Game.TAB_CLAN_CHAT) {
     if (methods.interfaces.getComponent(INTERFACE_CLAN_CHAT, INTERFACE_CLAN_CHAT_USERS_LIST)
         != null) {
       for (RSComponent comp :
           methods
               .interfaces
               .getComponent(INTERFACE_CLAN_CHAT, INTERFACE_CLAN_CHAT_USERS_LIST)
               .getComponents()) {
         if (comp.getText() != null) {
           tempList.add(comp.getText().trim());
         } else {
           break;
         }
       }
     }
   }
   tempList.toArray(temp);
   return temp;
 }
Exemplo n.º 2
0
 /**
  * Gets the users in the channel.
  *
  * @return The users in the channel or null if unavailable
  */
 public String[] getChannelUsers() {
   ArrayList<String> tempList = new ArrayList<String>();
   if (methods.game.getCurrentTab() != Game.TAB_FRIENDS_CHAT) {
     methods.game.openTab(Game.TAB_FRIENDS_CHAT);
   }
   if (methods.game.getCurrentTab() == Game.TAB_FRIENDS_CHAT) {
     if (getChannelName() != null) {
       lastCachedChannel = getChannelName();
     }
     if (methods.interfaces.getComponent(INTERFACE_FRIEND_CHAT, INTERFACE_FRIEND_CHAT_USERS_LIST)
         != null) {
       for (RSComponent comp :
           methods
               .interfaces
               .getComponent(INTERFACE_FRIEND_CHAT, INTERFACE_FRIEND_CHAT_USERS_LIST)
               .getComponents()) {
         if (comp.getText() != null) {
           tempList.add(comp.getText().trim());
         } else {
           break;
         }
       }
     }
   }
   if (tempList != null) {
     String[] temp = new String[tempList.size()];
     tempList.toArray(temp);
     return temp;
   }
   return null;
 }
Exemplo n.º 3
0
  public RSComponent searchInterfacesText(final String string) {
    final RSInterface[] inters = interfaces.getAll();
    for (final RSInterface inter : inters) {
      for (final RSComponent interfaceChild : inter.getComponents()) {
        if (interfaceChild.getText().toLowerCase().contains(string.toLowerCase())) {
          return interfaceChild;
        }
      }
    }

    return null;
  }
 RSComponentListener(final RSComponent child) {
   a = child;
   type = child.getType();
   specialtype = child.getSpecialType();
   bounds = child.getBoundsArrayIndex();
   model = child.getModelID();
   color = child.getBackgroundColor();
   getID = child.getParentID();
   getText = child.getText();
   tooltip = child.getTooltip();
   selectionname = child.getSelectedActionName();
   compID = child.getComponentID();
   compStackSize = child.getComponentStackSize();
   relativeloc = new Point(child.getRelativeX(), child.getRelativeY());
   absoluteloc = new Point(child.getAbsoluteX(), child.getAbsoluteY());
   area = child.getArea();
   xRot = child.getXRotation();
   yRot = child.getYRotation();
   zRot = child.getZRotation();
 }
 public boolean searchMatches(final RSComponent iface, final String contains) {
   return iface.getText().toLowerCase().contains(contains.toLowerCase());
 }
Exemplo n.º 6
0
  @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.distanceTo(door) > 3) {
        walking.getPath(door.getLocation()).traverse();
        sleep(random(1400, 2500));
      }
      if (!calc.tileOnScreen(door.getLocation())) {
        walking.walkTileMM(door.getLocation());
        sleep(random(1400, 2500));
      }
      if (door.getID() == 2188) {
        camera.setCompass('w');
      }
      if (door.getID() == 2193) {
        camera.setCompass('e');
      }
      if (door.getID() == 2189) {
        camera.setCompass('w');
      }
      if (door.getID() == 2192) {
        camera.setCompass('n');
      }
      clickObject(door, "Open");
      return random(500, 1000);
    }
    final RSComponent inter = searchInterfacesText("To exit,");
    if (inter != null) {
      if (inter.getText().toLowerCase().contains("red")) {
        door = objects.getNearest(2188);
      }
      if (inter.getText().toLowerCase().contains("green")) {
        door = objects.getNearest(2193);
      }
      if (inter.getText().toLowerCase().contains("blue")) {
        door = objects.getNearest(2189);
      }
      if (inter.getText().toLowerCase().contains("purple")) {
        door = objects.getNearest(2192);
      }
      return random(500, 1000);
    }
    if (!interfaces.get(nextObjectInterface).isValid()
        && !getMyPlayer().isMoving()
        && !interfaces.get(relatedCardsInterface).isValid()
        && !interfaces.canContinue()
        && door == null) {
      if (calc.distanceTo(mordaut) > 4) {
        walking.getPath(mordaut.getLocation()).traverse();
      }
      if (!calc.tileOnScreen(mordaut.getLocation())) {
        walking.walkTileMM(mordaut.getLocation());
      }
      clickCharacter(mordaut, "Talk-to");
      return (random(1500, 1700));
    }
    if (interfaces.get(nextObjectInterface).isValid()) {
      log.info("Question Type: Next Object");
      final NextObjectQuestion noq = new NextObjectQuestion();
      if (noq.getObjects()) {
        if (noq.clickAnswer()) {
          return random(800, 1200);
        } else {
          noq.guess();
          return random(800, 1200);
        }
      } else {
        log.info("Could not find get object. Making educated guess.");
        noq.guess();
        return random(800, 1200);
      }
    }

    if (interfaces.get(relatedCardsInterface).isValid()) {
      log.info("Question Type: Similar Objects");
      int z = 0;
      for (final SimilarObjectQuestion obj : simObjects) {
        if (obj.activateCondition()) {
          z = 1;
          if (obj.clickObjects()) {
            obj.accept();
          }
        }
      }
      if (z == 0) {
        log.severe("This is a new question.");
        log.severe("Please post this on the forums.");
        log.severe("The Missing Question is :");
        log(interfaces.get(nextObjectInterface).getComponent(25).getText().toLowerCase());
      }
      return random(800, 1200);
    }

    if (interfaces.clickContinue()) {
      return random(800, 3500);
    }

    return random(800, 1200);
  }