コード例 #1
0
ファイル: AbilityHandler.java プロジェクト: unknown909/RSBot
 public static BookAbility getAbility(AbilityType type) {
   for (int i = 11; i >= 0; i--) {
     Ability a = ActionBar.getAbilityInSlot(i);
     if (a != null && a instanceof BookAbility && ActionBar.isReady(i)) {
       BookAbility ability = (BookAbility) a;
       if (ability.getType() == type) return ability;
     }
   }
   return null;
 }
コード例 #2
0
ファイル: AbilityHandler.java プロジェクト: unknown909/RSBot
  public static void sendAbility(final BookAbility ability) {

    BookAbility[] castTimes = {
      BookAbility.ASPHYXIATE,
      BookAbility.SNIPE,
      BookAbility.RAPID_FIRE,
      BookAbility.UNLOAD,
      BookAbility.FRENZY,
      BookAbility.ASSAULT,
      BookAbility.DESTROY,
      BookAbility.FURY,
      BookAbility.FLURRY
    };

    // ActionBar.makeReadyForInteract();

    WidgetChild w = Widgets.get(137, 56);
    if (w.getText().equals("[Press Enter to Chat]")) {
      new TimedCondition(1500) {
        @Override
        public boolean isDone() {
          return ActionBar.useAbility(ability);
        }
      }.waitStop();
    } else {
      new TimedCondition(1500) {
        @Override
        public boolean isDone() {
          return ActionBar.getItemChild(ActionBar.findAbility(ability)).click(true);
        }
      }.waitStop();
    }

    // Logger.log("Using ability: " + ability.name());

    for (BookAbility cast : castTimes) {
      if (ability.equals(cast)) {
        waitForAbility = true;
        Task.sleep(4000);
        waitForAbility = false;
      }
    }
  }