return random(500, 600);
}
if (inventory.getCount(false) == 28
&& !inventory.containsAll(DOOR_KEY)) {
log("Not enough space for this random. Depositing an Item");
final RSObject depo = objects.getNearest(32924);
if (depo != null) {
if (!calc.tileOnScreen(depo.getLocation())) {
if (!walking.walkTileMM(depo.getLocation().randomize(2,
2))) {
walking.getPath(depo.getLocation().randomize(2, 2))
.traverse();
return random(500, 700);
}
return random(700, 1500);
}
camera.turnTo(depo, 20);
if (depo.interact("Deposit")) {
sleep(random(1600, 2000));
if (getMyPlayer().isMoving()) {
sleep(random(200, 500));
}
if (interfaces.get(Bank.INTERFACE_DEPOSIT_BOX)
.isValid()) {
sleep(random(700, 1200));
interfaces.get(11).getComponent(17)
.getComponent(random(16, 17))
.interact("All");
sleep(random(700, 1200));
interfaces.getComponent(11, 15).doClick();
}
return random(400, 500);
}
return random(500, 800);
}
return random(500, 600);
}
if (getMyPlayer().isMoving()) {
return random(250, 500);
}
if (anInterfaceContains("minute")) {
talkedtopete = true;
if (interfaces.canContinue()) {
interfaces.clickContinue();
return random(500, 600);
}
return random(500, 600);
}
if (interfaces.get(228).isValid()
&& interfaces.get(228).containsText("How do")) {
interfaces.get(228).getComponent(3).doClick();
return random(500, 600);
}
if (interfaces.canContinue()) {
interfaces.clickContinue();
return random(1000, 1200);
}
if (!talkedtopete && PrisonPete != null
&& !interfaces.get(228).isValid()
&& !interfaces.canContinue()) {
if (!calc.tileOnScreen(PrisonPete.getLocation())) {
walking.walkTileMM(PrisonPete.getLocation());
return random(1000, 1400);
}
if (PrisonPete.interact("talk")) {
return random(1500, 1600);
} else {
camera.turnTo(PrisonPete.getLocation());
return random(500, 600);
}
}
if (unlocked == 3) {
state = 4;
return random(250, 500);
}
if (unlocked <= 2 && talkedtopete) {
state = 1;
return random(500, 600);
}
return random(350, 400);
case 1:
// Figures out the balloon
if (anInterfaceContains("Lucky you!")) {
if (interfaces.canContinue()) {
interfaces.clickContinue();
}
state = 4;
taskDone = true;
return random(500, 600);
}
if (anInterfaceContains("should leave")) {
if (interfaces.canContinue()) {
interfaces.clickContinue();
}
state = 4;
unlocked = 10;
return random(500, 600);
}
if (interfaces.get(273).getComponent(3).isValid()) {
if (atLever()) {
if (balloonToPop != null
&& interfaces.get(273).getComponent(4)
.interact("Close")) {
state = 2;
return random(800, 900);
}
return random(500, 700);
}
}
final RSObject lever = objects.getNearest(LEVER_ID);
if (lever != null && talkedtopete) {
if (!calc.tileOnScreen(lever.getLocation())) {
walking.walkTileMM(lever.getLocation());
return random(1000, 1200);
}
if (!getMyPlayer().isMoving()
&& calc.tileOnScreen(lever.getLocation())) {
// if (tiles.doAction(lever.getLocation(), 0.5, 0.5, 170,
// "Pull")) {
if (lever.interact("Pull")) {
sleep(random(1400, 1600));
if (atLever()) {
if (balloonToPop != null
&& interfaces.get(273).getComponent(4)
.interact("Close")) {
state = 2;
return random(800, 900);
}
return random(500, 700);
}
return random(500, 600);
} else {
camera.turnTo(lever.getLocation());
return random(500, 600);
}
}
}
if (!talkedtopete) {
state = 0;
return random(500, 600);
}
return random(500, 600);
case 2:
// Finds animal and pops it
if (anInterfaceContains("Lucky you!")) {
if (interfaces.canContinue()) {
interfaces.clickContinue();
}
state = 4;
taskDone = true;
return random(500, 600);
}
if (anInterfaceContains("should leave")) {
if (interfaces.canContinue()) {
interfaces.clickContinue();
}
state = 4;
unlocked = 10;
return random(500, 600);
}
if (getMyPlayer().isMoving()) {
return random(250, 500);
}
if (balloonToPop == null && unlocked <= 2) {
state = 1;
return random(500, 700);
}
if (unlocked == 3) {
state = 4;
}
if (!inventory.containsAll(DOOR_KEY)) {
if (calc.tileOnScreen(balloonToPop.getLocation())) {
balloonToPop.interact("Pop");
return random(1200, 1800);
} else {
if (!getMyPlayer().isMoving()) {
walking.walkTileMM(balloonToPop.getLocation()
.randomize(2, 2));
return random(500, 750);
}
return random(500, 750);
}
}
if (inventory.contains(DOOR_KEY)) {
hasKey = false;
state = 3;
return random(500, 700);
}
return random(350, 400);
case 3:
// Goes to pete
PrisonPete = npcs.getNearest("Prison Pete");
if (getMyPlayer().isMoving()) {
return random(250, 500);
}
if (anInterfaceContains("Lucky you!")) {
if (interfaces.canContinue()) {
interfaces.clickContinue();
}
state = 4;
taskDone = true;
return random(500, 600);
}
if (anInterfaceContains("should leave")) {
if (interfaces.canContinue()) {
interfaces.clickContinue();
}
state = 4;
unlocked = 10;
return random(500, 600);
}
if (anInterfaceContains("you got all the keys")) {
hasKey = true;
unlocked = 5;
state = 4;
balloonToPop = null;
if (interfaces.canContinue()) {
interfaces.clickContinue();
return random(500, 600);
}
return random(250, 500);
}
if (anInterfaceContains("Hooray")) {
hasKey = true;
if (interfaces.canContinue()) {
interfaces.clickContinue();
return random(500, 600);
}
}
if (interfaces.canContinue()) {
interfaces.clickContinue();
return random(500, 600);
}
if (PrisonPete != null && !calc.tileOnScreen(PrisonPete.getLocation())
&& !interfaces.get(243).isValid()) {
walking.walkTileMM(PrisonPete.getLocation());
return random(400, 600);
}
if (!inventory.contains(DOOR_KEY)
&& npcs.getNearest(PRISON_MATE) != null
&& unlocked <= 2 && hasKey) {
unlocked++;
state = 0;
balloonToPop = null;
return random(350, 400);
}
if (inventory.contains(DOOR_KEY) && !getMyPlayer().isMoving()) {
inventory.getItem(DOOR_KEY).interact("Return");
return random(1000, 2000);
}
if (!inventory.contains(DOOR_KEY)
&& npcs.getNearest(PRISON_MATE) != null
&& unlocked <= 2 && !hasKey) {
state = 0;
balloonToPop = null;
return random(350, 400);
}
return random(350, 400);
case 4:
// exits
final RSTile doorTile = new RSTile(2086, 4459);
if (unlocked <= 2 && !taskDone) {
state = 0;
return random(500, 600);
}
if (!calc.tileOnScreen(doorTile)) {
walking.walkTileMM(doorTile);
return random(400, 500);
}
if (calc.tileOnScreen(doorTile)) {
final RSObject gate = objects.getNearest(11177, 11178);
if (gate != null) {
gate.interact("Open");
}
// tiles.doAction(new RSTile(2085, 4459), 1, 0, 30, "Open");
return random(500, 600);
}
return random(200, 400);