/** * Checks how many of the specified item the bank contains. * * @param itemName Case-insensitive item name to count. * @return itemAmount Stack size of item in bank. */ public int getCount(String itemName) { if (!isOpen()) return 0; for (Item item : getItems()) { if (item == null) continue; else if (item.getName().equalsIgnoreCase(itemName)) return item.getStackSize(); } return 0; }
/** * Gets the Item for a specified item name. * * @param itemName Case-insensitive item name to look for. * @return Object of type Item with the specified name. */ public Item getItem(String itemName) { if (!isOpen()) return null; for (Item item : getItems()) { if (item == null) { continue; } if (item.getName().equalsIgnoreCase(itemName)) { return item; } } return null; }
/** * Checks if the bank contains any of the given items. * * @param names Item names. Must be exact (case ignored). * @return Whether or not the bank contains the specified item(s). */ public boolean contains(String... names) { Item[] items = getItems(); for (Item item : items) { if (item == null) { continue; } for (String name : names) { if (item.getName().equalsIgnoreCase(name)) { return true; } } } return false; }
/** * 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; }