Example #1
0
 /**
  * @param id ID of the item you want to withdraw.
  * @param amount Amount of the item you want to withdraw.
  * @param type Withdraw type: WITHDRAW_
  */
 private void withdraw(int id, int amount, int type) {
   boolean doAction = false;
   Item item = getItem(id);
   if (isOpen() && contains(id) && item != null) {
     doAction = scrollToItem(item);
   }
   if (doAction) {
     String action = "Withdraw-" + amount;
     if (type == WITHDRAW_ALL) {
       action = "Withdraw-All";
     } else if (type == WITHDRAW_ALL_BUT_ONE) {
       action = "Withdraw-All but one";
     }
     if (item.hasAction(action)) {
       item.doAction(action);
     } else { // withdraw X
       if (item.doAction("Withdraw-X")) {
         for (int i = 0; i < random(2000, 3000); i += 50) {
           IComponent c = botEnv.interfaces.getComponent(752, 5);
           if (c != null && c.isValid() && c.isVisible()) {
             sleep(500, 1000);
             botEnv.keyboard.writeText(Integer.toString(amount), true);
             break;
           }
           sleep(50);
         }
       }
     }
   }
 }
Example #2
0
  /**
   * @param depositType Inventory, equipment, or familiar.
   * @return
   */
  private boolean depositByButton(int depositType) {
    if (!isOpen()) return false;

    IComponent depButton = botEnv.interfaces.getComponent(Bank.BANK_INTERFACE_ID, depositType);
    if (depButton != null && depButton.isVisible()) {
      if (depButton.doClick()) {
        sleep(300, 500);
        return true;
      }
    }

    return false;
  }
Example #3
0
 /**
  * Checks if the bank is open.
  *
  * @return Whether or not the bank interface is up.
  */
 public boolean isOpen() {
   IComponent iComponent = botEnv.interfaces.getComponent(BANK_INTERFACE_ID, BANK_ITEM_PANE_ID);
   return iComponent != null && iComponent.isVisible();
 }