Beispiel #1
0
 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;
         }
       }
     }
   }
 }
Beispiel #2
0
  @Override
  public boolean onStart() {
    System.out.println("JJ's RuneCrafter started");
    startTime = System.currentTimeMillis();

    // Setting up GUI
    gui = new GUI();
    gui.setVisible(true);
    while (gui.isVisible()) {
      sleep(100, 200);
    }
    chosenAltar = gui.getChosenAltar();
    chosenBank = gui.getChosenBank();
    chosenPouches = gui.getChosenPouches();
    chosenEssence = gui.getChosenEssence();
    usingTiara = gui.usingTiara();
    if (chosenPouches != null && chosenPouches.length > 0) {
      usingPouches = true;
    }

    // Setting up instance variables
    startXp = Skills.getXp(Skill.RUNECRAFT);
    currentXp = startXp;
    startTime = System.currentTimeMillis();

    // Creating objects containing methods
    banking = new Banking(chosenAltar, chosenEssence, chosenPouches);
    runecraft = new RuneCraft(chosenAltar, chosenPouches, usingTiara);
    walk = new Walk(chosenAltar, chosenBank);

    switch (chosenAltar) {
      case AIR:
        path = new AirPath();
        break;

      case BODY:
        path = new BodyPath();
        break;

      case EARTH:
        path = new EarthPath();
        break;

      case FIRE:
        path = new FirePath();
        break;

      case LAW:
        System.out.println("UNSUPPORTED!");
        this.stop();
        break;

      case MIND:
        if (chosenBank.equals(BankLoc.EDGEVILLE)) {
          path = new MindPathEdge();
        } else {
          path = new MindPathFally();
        }
        break;

      case WATER:
        path = new WaterPath();
        break;
    }

    return true;
  }