Saw some people asking questions about choosing last withdrawal amount. I decided to write this up. Enjoy.
public int getBankSlotForName(String name){
for (Item item : client.getBank().getItems()){
if (item != null && item.getName().equalsIgnoreCase(name)){
return client.getBank().getSlotForId(item.getId());
}
}
return -1;
}
private boolean withdrawLastAmount() throws InterruptedException {
int slot = getBankSlotForName(name);
if (!client.getBank().isSlotVisible(slot)){
client.getBank().scrollToSlot(slot);
sleep(100);
}
if (client.getBank().isSlotVisible(slot)){
if (!client.isMenuOpen()){
MouseDestination item = new RectangleDestination(client.getBank().getAbsoluteSlotPosition(slot));
client.moveMouseTo(item, false, false, true);
sleep(100);
}
if (client.isMenuOpen()){
MouseDestination click = new RectangleDestination(new Rectangle(client.getMenuX(), client.getMenuY() + 18 + (6 * 14 + 1), client.getMenuWidth(), 14));
client.moveMouse(click, false);
sleep(100);
if (click.destinationReached(client.getMousePosition())) {
client.clickMouse(false);
return true;
}
}
}
return false;
}