/** * @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); } } } } }
/** * Deposits all the items excluding the specified IDs. * * @param ids Item IDs not to deposit. * @return Whether or not the deposit was successful. * @author Ampzz */ public boolean depositAllExcept(int... ids) { if (!isOpen()) return false; Item[] allItems = botEnv.inventory.getItems(); if (allItems.length == 0) return false; ArrayList<Item> possItems = new ArrayList<Item>(); for (Item iItem : allItems) { boolean add = true; for (int id : ids) { if (iItem.getID() == id) add = false; } if (possItems.size() > 0 && add) { for (Item kItem : possItems) { if (kItem.getID() == iItem.getID()) add = false; } } if (add) possItems.add(iItem); } if (possItems.size() == 0) return true; for (Item jItem : possItems) { jItem.doAction("Deposit-all"); sleep(300, 700); } return true; }
/** * Deposits all of the specified item in the inventory. * * @param itemID Name of item to be deposited. * @return Whether or not the items were deposited. */ public boolean depositAll(int itemID) { if (!isOpen() || botEnv.inventory.getItems().length == 0) { return false; } int count = 0; for (Item it : botEnv.inventory.getItems()) { if (it.getID() == itemID) { count++; it.doAction("Deposit-all"); sleep(100, 200); } if (botEnv.inventory.getCount(false, itemID) == 0) { break; } } return count != 0; }
/** * Deposits all of the specified item in the inventory. * * @param itemName Name of item to be deposited. * @return Whether or not the items were deposited. */ public boolean depositAll(String itemName) { if (!isOpen()) { return false; } int count = 0; for (Item it : botEnv.inventory.getItems()) { if (it.getName().contains(itemName)) { count++; it.doAction("Deposit-all"); sleep(100, 200); } if (botEnv.inventory.getCount(false, itemName) == 0) { break; } } return count != 0; }