Esempio n. 1
0
 public static void make() {
   if (Bank.isOpen()) {
     Bank.close();
   } else {
     if (Inventory.getCount(Variables.glassID) != 0) {
       Variables.status = "Crafting";
       Item glass = Inventory.getItem(Variables.glassID);
       if (Widgets.get(1371, 0).validate()) {
         if (Widgets.get(1370, 56).getText().equals(Variables.urnType)) {
           Crafting.clickStart();
           final Timer glassTimer = new Timer(60000);
           while (glassTimer.isRunning() && Inventory.getCount(Variables.glassID) != 0) {
             Task.sleep(50);
           }
         } else {
           Widgets.get(1371, 44).getChild(20).click(true);
           Task.sleep(500, 600);
           Crafting.clickStart();
           final Timer glassTimer = new Timer(60000);
           while (glassTimer.isRunning() && Inventory.getCount(Variables.glassID) != 0) {
             Task.sleep(50);
           }
         }
       } else {
         if (glass != null) {
           if (glass.getWidgetChild() != null) {
             Variables.status = "Crafting";
             glass.getWidgetChild().click(true);
             Task.sleep(800, 900);
           }
         }
       }
     }
   }
 }
Esempio n. 2
0
  @Override
  public void execute() {
    // TODO Auto-generated method stub
    try {
      SceneObject well = SceneEntities.getNearest(Constants.WELL_ID);
      Timer wait = new Timer(1000);
      if (!Constants.edgevillArea.contains(Players.getLocal())) {
        Teleport.teleportTo(Teleport.EDGEVILL);
      }

      if (well != null) {
        if (well.isOnScreen()) {
          if (Bank.isOpen()) Bank.close();

          if (Widgets.get(905, 14).validate()) {
            boolean isInteracted = false;
            if (Widgets.get(905, 14).getBoundingRectangle().contains(Mouse.getLocation())) {
              Mouse.click(true);
              isInteracted = true;
            } else {
              Widgets.get(905, 14).interact("Make All");
              isInteracted = true;
            }
            Task.sleep(1000);
            if (isInteracted) {
              Utilities.showDebug(
                  "Softening clays for profit of " + Progress.profitSoftening + "gp each.");
              softeningTimer.setEndIn(2500);
            }

          } else {
            if (!softeningTimer.isRunning()) {
              if (Inventory.selectItem(Constants.CLAY_ID)) {
                if (well.interact("Use")) {
                  Utilities.showDebug("Interacting well.");
                  Mouse.move(271, 475, 5, 5);
                }
              }
              wait.setEndIn(2000);
              while (wait.isRunning() && !Widgets.get(905, 14).validate()) {
                if (Players.getLocal().isMoving()) wait.setEndIn(1000);
                Task.sleep(100);
              }
            }
          }
        } else {
          Utilities.showDebug("Found well but not on screen. Walking..");

          Walking.walk(Walking.findPath(well).getEnd());
          wait.setEndIn(3000);
          while (wait.isRunning() && !well.isOnScreen()) {
            Task.sleep(300);
          }
        }
      }
    } catch (Exception e) {
    }
    ;
  }
Esempio n. 3
0
 private void bank() throws Exception {
   if (Bank.open()) System.out.println("opened bank");
   else {
     sleep(Times.SHORT);
     Bank.open();
   }
   sleep(Times.SHORT);
   Bank.depositInventory();
   sleep(Times.SHORT);
   Bank.close();
   sleep(Times.BANK);
 }
Esempio n. 4
0
 public void withdrawItem(int[] ids, int amount) {
   if (containsAtleastOneOf(ids)) {
     Log.log("amount", "Need: " + (amount - numberOfPotions(ids)));
     if (numberOfPotions(ids) < amount)
       Bank.withdraw(greatestDoseAvailable(ids), amount - numberOfPotions(ids));
     else if (numberOfPotions(ids) > amount) {
       System.out.println("deposit");
       depositAll(ids);
     }
   } else {
     Log.log("amount", "Need: " + amount);
     Bank.withdraw(greatestDoseAvailable(ids), amount);
   }
 }
Esempio n. 5
0
 /**
  * Gets the equipment widget.
  *
  * @return the equipment <code>Widget</code>
  */
 public static Widget getWidget() {
   if (!Bank.isOpen()) {
     Tabs.EQUIPMENT.open();
     return Widgets.get(WIDGET);
   }
   return Widgets.get(WIDGET_BANK);
 }
Esempio n. 6
0
 @Override
 public void execute() {
   if (Bank.isOpen()) {
     if (containsLoot(Ids.ALL_ITEMS)) {
       Log.log("depositing", "Clearing Inventory for new trip.");
       Bank.depositInventory();
     }
     if (finished()) {
       Log.log("banking", "Completed inventory. Attempting to close.");
       Bank.close();
     } else withdrawInventory();
   } else {
     Log.log("banking", "Opening bank.");
     Bank.open();
   }
 }
 public boolean withdraw(boolean n, final int num) {
   final boolean noted = n && canNote();
   int startNum = getCount(noted);
   int dif = num - startNum;
   if (dif <= 0) return true;
   if (!Bank.isOpen()) return false;
   if (!Bank.setWithdrawNoted(noted)) return false;
   int bcount = getCount(Bank.getItems());
   return bcount >= dif
       && Bank.withdraw((noted ? notedId : itemId), (bcount > dif ? dif : 0))
       && Bank.setWithdrawNoted(false)
       && new TimedCondition(1000) {
         @Override
         public boolean isDone() {
           return getCount(noted) >= num;
         }
       }.waitStop();
 }
Esempio n. 8
0
 public static boolean neckyCheck() {
   if (Bank.isOpen()) {
     Widgets.get(762).getChild(120).interact("Show Equipment Stats");
     Task.sleep(50, 80);
     if (Widgets.get(667).getChild(190).getChild(2).getActions() != null) {
       Widgets.get(667).getChild(13).interact("Show Bank");
       Task.sleep(50, 80);
       return true;
     } else {
       Widgets.get(667).getChild(13).interact("Show Bank");
       Task.sleep(50, 80);
     }
   }
   return false;
 }
Esempio n. 9
0
  @Override
  public void execute() {
    if (Bank.open()) {
      GcSuperheater.logger.log("Opened bank.");
      for (Item i : Inventory.getItems()) {
        if (i != null && i.getId() != Runes.NATURE && i.getId() != Runes.FIRE) {
          Bank.deposit(i.getId(), Amount.ALL);
        }
      }
      int slotsAvailable = 0;
      for (Item i : Inventory.getAllItems(false)) {
        if (i == null) {
          ++slotsAvailable;
        }
      }

      int primaryOreId = GcSuperheater.primaryOre[0];
      Item primaryOre = Bank.getItem(primaryOreId);
      int primaryOreAmount = GcSuperheater.primaryOre[1];
      int primaryOreWithdrawAmount = 0;

      int secondaryOreId = 0;
      Item secondaryOre = null;
      int secondaryOreAmount = 0;
      int secondaryOreWithdrawAmount = 0;

      if (GcSuperheater.secondaryOre != null) {
        secondaryOre = Bank.getItem(GcSuperheater.secondaryOre[0]);
        secondaryOreId = GcSuperheater.secondaryOre[0];
        secondaryOreAmount = GcSuperheater.secondaryOre[1];
        while (slotsAvailable >= (primaryOreAmount + secondaryOreAmount)) {
          ++primaryOreWithdrawAmount;
          secondaryOreWithdrawAmount += secondaryOreAmount;
          slotsAvailable -= primaryOreAmount + secondaryOreAmount;
        }
      } else {
        primaryOreWithdrawAmount = slotsAvailable;
      }

      if (primaryOre != null) {
        primaryOre = Bank.getItem(primaryOreId);
        Bank.search(primaryOre.getName());
        GcSuperheater.logger.log(
            "Withdrawing " + primaryOreWithdrawAmount + " " + primaryOre.getName() + ".");
        Bank.withdraw(primaryOreId, primaryOreWithdrawAmount);
      } else {
        GcSuperheater.logger.log("Out of primary ore, stopping.");
        GcSuperheater.problemFound = true;
      }

      if (secondaryOre != null) {
        secondaryOre = Bank.getItem(secondaryOreId);
        Bank.search(secondaryOre.getName());
        GcSuperheater.logger.log(
            "Withdrawing " + secondaryOreWithdrawAmount + " " + secondaryOre.getName() + ".");
        Bank.withdraw(secondaryOreId, secondaryOreWithdrawAmount);
      } else {
        GcSuperheater.logger.log("Out of secondary ore, stopping.");
        GcSuperheater.problemFound = true;
      }

      primaryOreWithdrawAmount = 0;
      secondaryOreWithdrawAmount = 0;

      Bank.close();
      GcSuperheater.isBanking = false;
      GcSuperheater.logger.log("Finished banking.");
    } else {
      GcSuperheater.logger.log("Unable to bank, stopping.");
      GcSuperheater.problemFound = true;
      return;
    }
  }
Esempio n. 10
0
  public static void DyanmicSleep() {
    Area InsideBank = Areas.Bank;
    String SleepType = SleepName;

    // Dynamic Sleeps
    switch (SleepType) {
      case "EnterAlter": // Dynamic EnterAlter Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In EnterAlter";
          Area OutsideAlter = Areas.AlterEntrence;
          if (!OutsideAlter.contains(Players.getLocal().getLocation())) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "CraftRunes": // Dynamic Crafting Runes Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In CraftRunes";
          if (Inventory.getItem(CRAFTEDRUNE_ID) != null) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "ExitPortal": // Dynamic Leaving Alter Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In ExitPortal";
          Area InsideAlter = Areas.InsideAlter;
          if (!InsideAlter.contains(Players.getLocal().getLocation())) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "Resting": // Dynamic Resting Sleep
        while (twoMinutes.isRunning()) {
          dynamicSleepStatus = "In Resting";
          int EnergyLevel = Walking.getEnergy();
          if (EnergyLevel == Random.nextInt(90, 100)) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "OpenBank": // Dynamic Bank is Open Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In OpenBank";
          if (Bank.isOpen()) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "PlayerIsIdle": // Dynamic Player is Idle Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In PlayerIsIdle";
          if (Players.getLocal().isIdle()) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "EssenceInInventory": // Dynamic Essences in Inventory Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In EssenceInInventory";
          if (Inventory.getItem(ESSENCE_ID) == null) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
    }
  }
Esempio n. 11
0
 /**
  * Gets the component index of the slot
  *
  * @return the index of the slot for either the bank or the regular Equipment tab
  */
 public int getIndex() {
   return getIndex(Bank.isOpen());
 }
Esempio n. 12
0
 public int greatestDoseAvailable(int[] ids) {
   for (int i : ids) if (Bank.getItem(i) != null && Bank.getItem(i).getStackSize() > 1) return i;
   return -1;
 }
Esempio n. 13
0
 @Override
 public boolean validate() {
   return Areas.ZANARIS_BANK.contains(Players.getLocal())
       && Bank.getNearest() != null
       && !finished();
 }
Esempio n. 14
0
 public void depositAll(int[] ids) {
   for (int i : ids) {
     Bank.deposit(i, 1000);
   }
 }