示例#1
0
 private void noteHerbs() {
   if (inventory.containsOneOf(grimyID)) {
     status = "Noting herbs";
     RSNPC leprechaun = npcs.getNearest(leprechaunID);
     if (!leprechaun.isOnScreen() || calc.distanceTo(leprechaun) > 4) {
       walking.walkTileMM(leprechaun.getLocation(), 1, 1);
       sleep(random(3000, 4000));
     }
     int tmp = inventory.getCount(grimyID);
     for (int i = 0; i < 5; i++) {
       if (tmp == inventory.getCount(grimyID)) {
         inventory.getItem(grimyID).doAction("Use");
         sleep(200, 300);
         if (inventory.isItemSelected()) {
           leprechaun.doAction("Use");
           sleep(3000, 4000);
         }
       } else break;
     }
     RSObject plot = objects.getNearest(herbPlot);
     if (plot != null) {
       if (!plot.isOnScreen()) {
         walking.walkTileMM(plot.getLocation(), 1, 1);
         sleep(random(3000, 4000));
       }
     }
   }
 }
 private void attackSpider() {
   RSNPC spider = npc.getNearestFreeToAttackByID(4400);
   run();
   if (spider != null) {
     try {
       if (spider.isOnScreen() && spider.action("Attack")) {
         if (tries != 0) {
           tries = 0;
         }
         wait(random(800, 900));
         waitToStop();
         waitSafely(random(2200, 2400));
       } else {
         if (tries > 60) { // if there is no spider on screen in 6-12 seconds
           if (room == 1) {
             walk.to(room1.getRandomTile());
           } else {
             walk.to(room2);
           }
           tries = 0;
         } else {
           tries++;
         }
       }
     } catch (final Exception e) {
     }
   }
 }
示例#3
0
  private void compostPatch() {
    status = "Adding supercompost";
    RSObject plot = objects.getNearest(herbPlot);
    if (plot != null) {
      if (!inventory.contains(compostID)) {
        RSNPC leprechaun = npcs.getNearest(leprechaunID);
        if (!leprechaun.isOnScreen() || calc.distanceTo(leprechaun) > 4) {
          walking.walkTileMM(leprechaun.getLocation(), 1, 1);
          sleep(random(3000, 4000));
        }

        leprechaun.doAction("Exchange");
        sleep(random(1500, 2000));
        mouse.click(359, 265, 10, 10, true);
        sleep(random(300, 900));
        interfaces.getComponent(leprechaunInterface, closeInterface).doClick();
        sleep(random(200, 300));
        if (!plot.isOnScreen() || calc.distanceTo(plot) > 4) {
          walking.walkTileMM(plot.getLocation(), 1, 1);
          sleep(random(3000, 4000));
        }
      }
      if (inventory.contains(compostID)) {
        int tmp = inventory.getCount(compostID);
        for (int i = 0; i < 5; i++) {
          if (tmp == inventory.getCount(compostID) && currentState == State.COMPOST) {
            if (i > 0) camera.setAngle(random(0, 360));
            if (inventory.contains(compostID)) {
              inventory.getItem(compostID).doClick(true);
              plot.doClick();
            }
            sleep(random(4000, 5000));
          } else break;
        }
      }
    }
    currentState = State.CHECK_CROPS;
  }