Esempio n. 1
0
  @Override
  public void script() {
    addScriptJob(new MouseSpeedJob(this));
    BankInterface.init(this);
    BankInterface.setLogOutCondition(true);
    OptionsInterface.init(this);
    Utilities.init(this);
    try {
      while (!isLoggedIn()) {
        sleep(750);
      }
      startXp = theTabs.Statistics.getStatExperience(Skill.CONSTRUCTION);
      currentXp = startXp;
      if (theTabs.Inventory.count("ammer") > 0) {
        hammerCondition =
            theTabs.Inventory.count(Constants.SACRED_CLAY_HAMMER) > 0
                ? Constants.SACRED_CLAY_HAMMER
                : Constants.REGULAR_HAMMER;
      } else {
        hammerCondition = Constants.REGULAR_HAMMER;
      }
      runtime.reset();
      botState = getState();
      while (true) {
        if (isLoggedIn()) {
          theTabs.Options.setRunIfHighEnergy();
          switch (botState) {
            case BUILD:
              construct();
              break;
            case BANK:
              bank();
          }
        } else {
          sleep(750);
        }
      }
    } catch (InterruptedException ex) {

    }
  }
Esempio n. 2
0
 private void construct() throws InterruptedException {
   while (theMiniMap.isBlack(this)) {
     sleep(200, 300);
   }
   if (!Utilities.isPlayerInsidePOH()) {
     if (!theTabs.Magic.isSelected()) {
       theTabs.Magic.key();
     }
     status = "Using Home teleport";
     Utilities.clickInterface(this.getInterfaceAtIndex(192, 48), true, null);
     status = "Waiting for POH to load";
     sleep(2000, 2500);
     for (Timer myTimer = new Timer(20000);
         ((!Utilities.isPlayerInsidePOH() || theMiniMap.isBlack(this))) && myTimer.isNotUp();
         sleep(250, 300)) {
       if (theMiniMap.isBlack(this)) {
         myTimer.reset();
       }
     }
     sleep(400, 500);
     if (!Utilities.isPlayerInsidePOH()) {
       while (theMiniMap.isBlack(this)) {
         sleep(250, 300);
       }
       return;
     }
   }
   if (!Utilities.isConstructionModeSet()) {
     OptionsInterface.setConstructionMode(true);
   }
   larder = Utilities.findPhysicalObject(Constants.EMPTY_LARDER, Constants.REAL_LARDER);
   if (larder != null) {
     s:
     switch (larder.getID()) {
       case Constants.EMPTY_LARDER:
         WorldObjectClickingScriptJobV2 sj = null;
         for (sj =
                 RulerScriptUtils.startScriptJobClick(
                     this,
                     null,
                     larder,
                     null,
                     Constants.EMPTY_LARDER_TOPTEXT,
                     Constants.EMPTY_LARDER_ACTION,
                     EnumSet.of(
                         RulerClickOptions.WALK_USING_ANY,
                         RulerClickOptions.GOAL_MENU_CLICK,
                         RulerClickOptions.PEND_FOR_MOVEMENT_TO_STOP));
             !sj.isDone() && !isInterfaceNotNullAndValid(394, 0);
             sleep(200, 300)) {
           if (theNPCChatFinder.isNPCChatUp() && theNPCChatFinder.getNPCChat().contains("yes")) {
             break s;
           }
         }
         if (sj != null && !sj.isDone()) {
           sj.safeKill();
         }
         status = "Waiting for interface to be up";
         for (Timer t = new Timer(3000);
             t.isNotUp() && !this.isInterfaceNotNullAndValid(394, 0);
             sleep(200, 300)) {
           if (theNPCChatFinder.isNPCChatUp() && theNPCChatFinder.getNPCChat().contains("yes")) {
             break s;
           }
         }
         if (isInterfaceNotNullAndValid(394, 0)) {
           Utilities.clickInterfaceDoubleBounds(getInterfaceAtIndex(394, 30), true, null);
           lardersMade++;
           status = "Sleeping to finish larders";
           for (Timer t = new Timer(random(2500));
               t.isNotUp() && Utilities.findPhysicalObject(Constants.REAL_LARDER) == null;
               sleep(200, 300)) {
             currentXp = theTabs.Statistics.getStatExperience(Skill.CONSTRUCTION);
             if (theNPCChatFinder.isNPCChatUp() && theNPCChatFinder.getNPCChat().contains("yes")) {
               break s;
             }
           }
           sleep(100, 200);
         }
         break;
       default:
         if (RulerScriptUtils.clickWorldObject(
                 this,
                 null,
                 larder,
                 null,
                 Constants.LARDER_TOPTEXT,
                 Constants.LARDER_MENU_ACTION,
                 EnumSet.of(
                     RulerClickOptions.WALK_USING_ANY,
                     RulerClickOptions.GOAL_MENU_CLICK,
                     RulerClickOptions.PEND_FOR_MOVEMENT_TO_STOP))
             .possiblySuccessful()) {
           status = "Waiting for NPC chat";
           for (Timer npcChatTimer = new Timer(5000);
               !theNPCChatFinder.isNPCChatUp() && npcChatTimer.isNotUp();
               sleep(200, 300)) ;
           if (theNPCChatFinder.isNPCChatUp()) {
             NPCChat myCurrentNPCChat = theNPCChatFinder.getNPCChat();
             if (myCurrentNPCChat != null) {
               status = "Clicking NPC Chat";
               if (myCurrentNPCChat.selectContains("yes")) {
                 waitTillNPCChatChangesFrom(myCurrentNPCChat);
               }
             }
           }
         }
     }
   }
   botState = getState();
 }