Пример #1
0
  /**
   * Checks the xp in the GameTab.Skills of one of the skills we are currently training.
   *
   * @return true if succesfully checked a skill
   */
  public static boolean doCheckXP() {

    General.println(
        "Current time: "
            + System.currentTimeMillis()
            + ". Next XP_CHECK at: "
            + (System.currentTimeMillis() - getUtil().TIME_TRACKER.CHECK_XP.next())
            + ". (next(): "
            + getUtil().TIME_TRACKER.CHECK_XP.next()
            + ")");
    if (getUtil().TIME_TRACKER.CHECK_XP.next() > 0L
        && System.currentTimeMillis() < getUtil().TIME_TRACKER.CHECK_XP.next()) return false;

    General.println("Checking XP");

    List<SKILLS> gainedXPInSkill = new ArrayList<SKILLS>();

    for (Entry<SKILLS, Integer> set : PaintMgr.startSkillInfo.entrySet()) {
      if (Skills.getXP(set.getKey()) > set.getValue()) gainedXPInSkill.add(set.getKey());
    }

    if (gainedXPInSkill.isEmpty()) return false;

    LANChaosKiller.statusText = "Antiban - Check XP";

    TABS oldTab = GameTab.getOpen();
    GameTab.open(TABS.STATS);

    SKILLS skillToCheck = gainedXPInSkill.get(General.random(1, gainedXPInSkill.size()) - 1);

    int index = 0;

    switch (skillToCheck) {
      case ATTACK:
        index = 1;
        break;
      case STRENGTH:
        index = 2;
        break;
      case DEFENCE:
        index = 3;
        break;
      case HITPOINTS:
        index = 9;
        break;
      case RANGED:
        index = 4;
        break;
      case MAGIC:
        index = 6;
        break;
      default:
        break;
    }

    if (index > 0) {

      final RSInterfaceChild skillInterface = Interfaces.get(320, index);

      if (skillInterface != null) {

        if (Clicking.hover(skillInterface)) {

          General.sleep(2500, 4000);
          GameTab.open(oldTab);

          return true;
        }
      }
    }

    getUtil().TIME_TRACKER.CHECK_XP.reset();

    return false;
  }
Пример #2
0
  public static boolean toggleRun(boolean enable, Timer timer) {

    if (!timer.isRunning()) {
      final int settings[] = Game.getSettingsArray();

      if (settings != null) {
        if (settings[173] == 0) {
          if (enable) {
            if (GameTab.open(GameTab.TABS.OPTIONS)) {
              if (Interfaces.get(261, 0) != null) {

                Interfaces.get(261, 0).click("Toggle Run");

                if (settings[173] == 1) {
                  GameTab.open(GameTab.TABS.OPTIONS);

                  CSleep(
                      new Timing.Condition() {
                        @Override
                        public boolean validate() {
                          return settings[173] == 1;
                        }
                      },
                      random(2000, 3000));
                }

                GameTab.open(GameTab.TABS.INVENTORY);
                CSleep(
                    new Timing.Condition() {
                      @Override
                      public boolean validate() {
                        return GameTab.open(GameTab.TABS.INVENTORY);
                      }
                    },
                    random(2000, 3000));
                timer.reset();
                return true;
              }
            } else {

              return true;
            }
          }
        } else {
          if (!enable) {
            if (GameTab.open(GameTab.TABS.OPTIONS)) {
              if (Interfaces.get(261, 0) != null) {

                Interfaces.get(261, 0).click("Toggle Run");
              }
            } else {
              GameTab.open(GameTab.TABS.OPTIONS);
              sleep(1000, 2000);
              return true;
            }
          }
        }
      }
    }

    return false;
  }