Ejemplo n.º 1
0
 private void bank() throws InterruptedException {
   if (!Constants.EDGEVILLE_LOCATION.isInZone(getLocation())) {
     if (theTabs.Equipment.isWearing(Constants.AMULET_OF_GLORY)) {
       if (!theTabs.Equipment.isSelected()) {
         theTabs.Equipment.key();
       }
       EquipmentReflectionItemSlot gloryAmulet = null;
       for (EquipmentReflectionItemSlot slot : theTabs.Equipment.SLOTS2) {
         if (slot != null && Constants.AMULET_OF_GLORY.valid(slot.getItem())) {
           gloryAmulet = slot;
           break;
         }
       }
       if (gloryAmulet != null) {
         status = "Teleporting to Edgeville";
         gloryAmulet.mouseClickRightOn();
         theMenuFinder.doMenuContains("Edgeville");
         for (Timer t = new Timer(10000);
             t.isNotUp() && Utilities.isPlayerInsidePOH();
             sleep(200, 300)) ;
         // sleep(750, 800);
         /*
          * if
          * (!theTabs.Equipment.isWearing(Constants.AMULET_OF_GLORY)
          * && theTabs.Equipment.isWearing(" of glory")) { for
          * (EquipmentReflectionItemSlot slot :
          * theTabs.Equipment.SLOTS2) { if (slot != null &&
          * Constants.AMULET_OF_GLORY_NO_CHARGES
          * .valid(slot.getItem())) { gloryAmulet = slot; break; } }
          * if (gloryAmulet != null) {
          * gloryAmulet.mouseClickLeftOn(); } }
          */
       }
     } else {
       PhysicalObject portal = Utilities.findPhysicalObject(Constants.PORTAL_IDS);
       if (portal != null) {
         RulerScriptUtils.clickWorldObject(this, null, portal, null, null, null, null);
         for (Timer t = new Timer(4000);
             !Utilities.isPlayerInsidePOH() && t.isNotUp();
             sleep(200, 300)) ;
       }
     }
   }
   status = "Opening bank interface";
   BankInterface.open();
   int emptySlots = theTabs.Inventory.countEmptySlots();
   if (emptySlots < 24) {
     status = "Depositng junk items";
     HashMap<Integer, String> depositedItems = new HashMap<Integer, String>();
     for (InventoryReflectionItemSlot item : theTabs.Inventory.SLOTS) {
       if (item != null && item.isItemInSlot()) {
         String itemName = null;
         if ((itemName = item.getItemName()) != null
             && !Constants.CRUCIAL_ITEMS.validItem(itemName)
             && !depositedItems.containsKey(item.getId())) {
           depositedItems.put(item.getId(), itemName);
           BankInterface.depositBankObject(null, itemName, -1);
         }
       }
     }
   }
   if (theTabs.Equipment.isUsingWeapon(Constants.AIR_SUPPORTED_STAFF)
       && theTabs.Inventory.countStackOf("Earth rune") <= 0) {
     BankInterface.withdrawBankObject(null, "Earth rune", -1);
   } else if (theTabs.Equipment.isUsingWeapon(Constants.EARTH_SUPPORTED_STAFF)
       && theTabs.Inventory.countStackOf("Air rune") <= 0) {
     BankInterface.withdrawBankObject(null, "Air rune", -1);
   }
   if (theTabs.Inventory.countStackOf("Law rune") <= 0) {
     BankInterface.withdrawBankObject(null, "Law rune", -1);
   }
   if (!theTabs.Equipment.isWearing(Constants.AMULET_OF_GLORY)) {
     if (emptySlots == 0) {
       BankInterface.depositBankObject(Constants.OAK_PLANK, "Oak plank", 1);
     }
     status = "Withdrawing charged glory amulet";
     BankInterface.withdrawBankObject(Constants.AMULET_OF_GLORY, "Amulet of glory (", 1);
     for (Timer t = new Timer(4000);
         t.isNotUp() && theTabs.Inventory.count(Constants.AMULET_OF_GLORY) <= 0;
         sleep(200, 300)) ;
     if (theTabs.Inventory.count(Constants.AMULET_OF_GLORY) > 0) {
       status = "Equipping glory amulet";
       theTabs.Inventory.doAction(Constants.AMULET_OF_GLORY, "Wear", 1, false);
       for (Timer t = new Timer(5000);
           t.isNotUp() && theTabs.Inventory.count(Constants.AMULET_OF_GLORY_NO_CHARGES) <= 0;
           sleep(200, 300)) ;
       if (theTabs.Inventory.count(Constants.AMULET_OF_GLORY_NO_CHARGES) > 0) {
         BankInterface.depositBankObject(Constants.AMULET_OF_GLORY_NO_CHARGES, null, -1);
       }
     }
   }
   if (theTabs.Inventory.count(hammerCondition) <= 0) {
     status = "Withdrawing new hammer";
     BankInterface.withdrawBankObject(hammerCondition, "ammer", 1);
   }
   status = "Withdrawing oak planks";
   BankInterface.withdrawBankObject(Constants.OAK_PLANK, "Oak plank", -1);
   status = "Exiting bank interface";
   BankInterface.exitBank();
   botState = ConstructionState.BUILD;
 }
Ejemplo 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();
 }