示例#1
0
 // Walk to the specified location, and set the nextState once you get there
 private void walk(Location loc, State nextState) {
   if (getFarmingArea(loc).contains(getMyPlayer().getLocation())) {
     currentLocation = loc;
     currentState = nextState; // This is the last spot of each run. Break here.
   } else {
     checkEnergy();
     status = "Walking to " + loc.toString() + " herb patch";
     step(pathList);
   }
 }
示例#2
0
 // Teleport to the specified location
 private void teleport(Location loc) {
   status = "Teleporting to " + loc.toString();
   if (magic.castSpell(getSpell(loc))) {
     sleep(random(9000, 11000));
     if (getTeleArea(loc)
         .contains(
             getMyPlayer().getLocation())) { // Teleport successful if player is in the tele area
       currentState = State.WALKING;
       pathList = generatePath(getPath(loc));
     }
   }
 }