public boolean withdrawX(int itemID, int amount) throws InterruptedException {
if(!client.getBank().isOpen() || !client.getBank().contains(itemID)) {
return false;
}
int firstVisibleSlot = -1;
int lastVisibleSlot = -1;
int itemSlot = client.getBank().getSlotForId(itemID);
if(!client.getBank().isSlotVisible(itemSlot)) {
for(int i = 0; i < 1000; i++) {
if(firstVisibleSlot == -1 && client.getBank().isSlotVisible(i)) {
firstVisibleSlot = i;
} else if(firstVisibleSlot != -1 && !client.getBank().isSlotVisible(i)) {
lastVisibleSlot = i - 1;
break;
}
}
if(itemSlot >= firstVisibleSlot && itemSlot <= lastVisibleSlot) {
//Visible //No Scrolling!
} else {
//Invisible //Scrolling!
if(itemSlot < firstVisibleSlot) {
//Scrolling up!
MouseDestination md = new RectangleDestination(new Rectangle(481, 60, 12, 12));
client.moveMouse(md, true);
while(!client.getBank().isSlotVisible(itemSlot)) {
client.clickMouse(false);
}
} else if(itemSlot > lastVisibleSlot) {
//Scrolling down!
MouseDestination md = new RectangleDestination(new Rectangle(481, 272, 12, 12));
client.moveMouse(md, true);
while(!client.getBank().isSlotVisible(itemSlot)) {
client.clickMouse(false);
}
}
}
}
return client.getBank().withdrawX(itemID, amount);
}
public boolean withdrawAll(int itemID) throws InterruptedException {
if(!client.getBank().isOpen() || !client.getBank().contains(itemID)) {
return false;
}
int firstVisibleSlot = -1;
int lastVisibleSlot = -1;
int itemSlot = client.getBank().getSlotForId(itemID);
if(!client.getBank().isSlotVisible(itemSlot)) {
for(int i = 0; i < 1000; i++) {
if(firstVisibleSlot == -1 && client.getBank().isSlotVisible(i)) {
firstVisibleSlot = i;
} else if(firstVisibleSlot != -1 && !client.getBank().isSlotVisible(i)) {
lastVisibleSlot = i - 1;
break;
}
}
if(itemSlot >= firstVisibleSlot && itemSlot <= lastVisibleSlot) {
//Visible //No Scrolling!
} else {
//Invisible //Scrolling!
if(itemSlot < firstVisibleSlot) {
//Scrolling up!
MouseDestination md = new RectangleDestination(new Rectangle(481, 60, 12, 12));
client.moveMouse(md, true);
while(!client.getBank().isSlotVisible(itemSlot)) {
client.clickMouse(false);
}
} else if(itemSlot > lastVisibleSlot) {
//Scrolling down!
MouseDestination md = new RectangleDestination(new Rectangle(481, 272, 12, 12));
client.moveMouse(md, true);
while(!client.getBank().isSlotVisible(itemSlot)) {
client.clickMouse(false);
}
}
}
}
return client.getBank().withdrawAll(itemID);
}