class BankBooth extends RGBCluster
{
public BankBooth(GameScreenMethods methods)
{
super(new RGB[] { new RGB(77, 58, 9), new RGB(102, 77, 9),
new RGB(82, 63, 9) }, methods);
}
public boolean bank() throws InterruptedException
{
Timer t = new Timer(20000);
while (!t.isUp())
{
gatherNewPoints(10);
if (!BankScreenUp())
{
if (!OpenBank())
{
Thread
.sleep(500);
continue;
}
theScript.waitTillStopMoving();
}
theScript
.doActionAtInventory(new String[] { "net" }, "All", 28);
CloseBank();
Thread.sleep(500);
return true;
}
return false;
}
private boolean BankScreenUp()
{
XY axy[] = findRGBCluster(new RGB(255, 152, 31), new Rectangle(241,
161, 180, 30), 100);
return axy.length > 0;
}
private boolean CloseBank() throws InterruptedException
{
Timer t = new Timer(20000);
while (BankScreenUp())
{
if (!t.isUp())
{
return false;
}
mouseMove(new Rectangle(476, 31, 20, 20));
// this is bc the Runescape client has to have the mouse hover
// for 0.5 seconds before clicking, the button has to go down
// before one can click
sleep(random(1000, 1500));
mouseClickLeft(currentMouseX(), currentMouseY());
sleep(random(1000, 1500));
}
return true;
}
private boolean OpenBank() throws InterruptedException
{
return doTopTextAndMenu("Bank", "quickly");
}
}