@Override public int loop() { System.out.println("Inside loop"); scriptState = getState(); currentXp = Skills.getXp(Skill.RUNECRAFT); switch (scriptState) { case BANKING: banking.depositRunes(); banking.withdrawEss(usingPouches); break; case CRAFT_RUNES: runecraft.craftRunes(usingPouches); break; case ENTER_RUINS: runecraft.enterRuins(); break; case EXIT_ALTAR: runecraft.exitPortal(); break; case OPEN_BANK: if (!banking.openBank()) { walk.toBankFailsafe(); } break; case WALK_TO_ALTAR: path.toAltar(); // walk.toAltar(); break; case WALK_TO_PORTAL: path.toPortal(); // walk.toPortal(); break; case WALK_TO_BANK: path.toBank(); // walk.toBank(); break; case WALK_TO_RUINS: path.toRuins(); // walk.toMysteriousRuins(); break; case GUI: System.out.println("Waiting for GUI"); break; } return Random.nextInt(50, 150); }
private State getState() { if (gui.isVisible()) { return State.GUI; } else { if (Inventory.isFull()) { if (walk.insideAltar()) { if (walk.nearAltar()) { return State.CRAFT_RUNES; } else { return State.WALK_TO_ALTAR; } } else { if (walk.nearRuins()) { return State.ENTER_RUINS; } else { return State.WALK_TO_RUINS; } } } else { if (walk.insideAltar()) { if (!walk.nearPortal()) { return State.WALK_TO_PORTAL; } else { return State.EXIT_ALTAR; } } else { if (banking.nearBank()) { if (Bank.isOpen()) { return State.BANKING; } else { return State.OPEN_BANK; } } else { return State.WALK_TO_BANK; } } } } }