}
if (!isOpen()) {
return false;
}
final int inventoryCount = methods.inventory.getCount(true);
final RSItem item = getItem(itemID);
if (item != null) {
if (count >= 500) {
if (item.interact("Buy 500")) {
sleep(random(500, 700));
return buy(itemID, (count - 500));
} else {
return false;
}
} else if (count >= 50 && count < 500) {
if (item.interact("Buy 50")) {
sleep(random(500, 700));
return buy(itemID, (count - 50));
} else {
return false;
}
} else if (count >= 10 && count < 50) {
if (item.interact("Buy 10")) {
sleep(random(500, 700));
return buy(itemID, (count - 10));
} else {
return false;
}
} else if (count >= 5 && count < 10) {
if (item.interact("Buy 5")) {
sleep(random(500, 700));
return buy(itemID, (count - 5));
} else {
return false;
}
} else if (count >= 1 && count < 5) {
if (item.interact("Buy 1")) {
sleep(random(500, 700));
return buy(itemID, (count - 1));
} else {
return false;
}