Joseph Posted November 8, 2013 Posted November 8, 2013 (edited) ~Hopefully this could make us look less like a bot.~ i made a couple of bank methods that contains withdraw-(last amount) Both item id and item name. deposit Inventory tab. deposit worn item tab. only method you need to use are withdrawAmount(int itemId, int amount); withdrawAmount(String itemName, int amount); depositInventory(); depositEquipments(); link http://pastebin.com/j9ngMFDB source code: public boolean withdrawAmount(int itemId, int amount) throws InterruptedException { int slot = this.client.getBank().getSlotForId(itemId); Rectangle rec = client.getBank().getAbsoluteSlotPosition(slot); MouseDestination des = new RectangleDestination((int)rec.getMinX(), (int)rec.getMinY(), 30, 30); MouseDestination selection = new RectangleDestination(this.client.getMenuX(), this.client.getMenuY()+65, this.client.getMenuWidth(), 10); if (!client.getBank().isOpen()) { return false; }else{ if (!client.getBank().contains(itemId)) { return false; }else{ if (!client.getBank().isSlotVisible(slot)) { this.client.getBank().scrollToSlot(slot); }else{ if (!client.isMenuOpen()) { this.client.moveMouseTo(des, false, true, true); }else{ if (client.getMenu() != null) { if (hasOption("withdraw-"+amount)) { return this.client.moveMouseTo(selection, false, true, false); }else{ //fix this, mouse move off of screen, withdraw x too fast, add a wait for interface. return this.client.getBank().withdrawX(itemId, amount); } } } } } } return false; } public boolean withdrawAmount(String itemName, int amount) throws InterruptedException{ int slot = this.client.getBank().getSlotForId(getIdOfItemName(itemName)); Rectangle rec = client.getBank().getAbsoluteSlotPosition(slot); MouseDestination des = new RectangleDestination((int)rec.getMinX(), (int)rec.getMinY(), 30, 30); MouseDestination selection = new RectangleDestination(this.client.getMenuX(), this.client.getMenuY()+65, this.client.getMenuWidth(), 10); if (!client.getBank().isOpen()) { return false; }else{ if (!client.getBank().contains(itemName)) { return false; }else{ if (!client.getBank().isSlotVisible(slot)) { this.client.getBank().scrollToSlot(slot); }else{ if (!client.isMenuOpen()) { this.client.moveMouseTo(des, false, true, true); }else{ if (client.getMenu() != null) { if (hasOption("withdraw-"+amount)) { return this.client.moveMouseTo(selection, false, true, false); }else{ //fix this, mouse move off of screen, withdraw x too fast, add a wait for interface. return this.client.getBank().withdrawX(getIdOfItemName(itemName), amount); } } } } } } return false; } public boolean hasOption(String option){ for (int i = 0; i < client.getMenuCount(); i++){ if (client.getMenu().get(i).action.equalsIgnoreCase(option)) { return true; } } return false; } public int getIdOfItemName(String name) { for (Item item : client.getBank().getItems()) { if (item != null && item.getName().equalsIgnoreCase(name)) { return item.getId(); } } return -1; } public boolean depositInventory() throws InterruptedException { MouseDestination des = new RectangleDestination(426,288,33,33); if (!client.getBank().isOpen()) { return false; }else{ if (!client.getInventory().isEmpty()) { return this.client.moveMouseTo(des, false, true, false); }else{ log("You inventory is empty"); return true; } } } public boolean depositEquipments() throws InterruptedException { MouseDestination des = new RectangleDestination(463,288,33,33); if (!client.getBank().isOpen()) { return false; }else{ if (equipmentTab.isWearingItem(EquipmentSlot.AMULET)|| equipmentTab.isWearingItem(EquipmentSlot.ARROWS)|| equipmentTab.isWearingItem(EquipmentSlot.CAPE)|| equipmentTab.isWearingItem(EquipmentSlot.CHEST)|| equipmentTab.isWearingItem(EquipmentSlot.FEET)||equipmentTab.isWearingItem(EquipmentSlot.HANDS)|| equipmentTab.isWearingItem(EquipmentSlot.HAT)|| equipmentTab.isWearingItem(EquipmentSlot.LEGS)|| equipmentTab.isWearingItem(EquipmentSlot.RING)|| equipmentTab.isWearingItem(EquipmentSlot.SHIELD)|| equipmentTab.isWearingItem(EquipmentSlot.WEAPON)) { return client.moveMouseTo(des, false, true, false); }else{ log("Your not wearing anything"); return true; } } } Depending on the community, i might add more methods like: search tab withdraw-all-but-one credits to @Pain: for helping me with menu contains string method Edited November 8, 2013 by josedpay 1
Swizzbeat Posted November 8, 2013 Posted November 8, 2013 Looks great, these could come in a lot of use for me! Thank you
Joseph Posted November 8, 2013 Author Posted November 8, 2013 Looks great, these could come in a lot of use for me! Thank you your welcome
hydragon Posted November 8, 2013 Posted November 8, 2013 Nice One thing tho instead of checking isWearning items Try check if the #getItems is not null or empty(length of array is 0)
a L i a s Posted November 8, 2013 Posted November 8, 2013 Why does it matter whether or not you're wearing anything? You could have saved typing out that horrendously long series of OR's..
Mr Asshole Posted November 8, 2013 Posted November 8, 2013 You could have saved time writing all those conditions for checking if their wearing equipment in each slot. Just have it iterate through the array of equipment slots.