示例#1
0
 public void withdrawInventory() {
   if (Inventory.getCount(Ids.FLASK_RANGING[0]) != 2) {
     Log.log("withdrawing", "Ranging Flasks");
     Log.log("amount", "Have: " + Inventory.getCount(Ids.FLASK_RANGING[0]));
     withdrawItem(Ids.FLASK_RANGING, 2);
   }
   if (Inventory.getCount(Ids.FLASK_SUMMONING[0]) != 1) {
     Log.log("withdrawing", "Summoning Flasks");
     Log.log("amount", "Have: " + Inventory.getCount(Ids.FLASK_SUMMONING[0]));
     withdrawItem(Ids.FLASK_SUMMONING, 1);
   }
   if (Inventory.getCount(Ids.UNICORN_POUCH[0]) != 2) {
     Log.log("withdrawing", "Unicorn Pouch");
     Log.log("amount", "Have: " + Inventory.getCount(Ids.UNICORN_POUCH[0]));
     withdrawItem(Ids.UNICORN_POUCH, 2);
   }
   if (Inventory.getItem(Ids.UNICORN_SCROLL[0]) == null
       || Inventory.getItem(Ids.UNICORN_SCROLL[0]) != null
           && Inventory.getItem(Ids.UNICORN_SCROLL[0]).getStackSize() != 100) {
     Log.log("withdrawing", "Unicorn Scroll");
     Log.log(
         "amount",
         "Have: "
             + (Inventory.getItem(Ids.UNICORN_SCROLL[0]) != null
                 ? Inventory.getItem(Ids.UNICORN_SCROLL[0]).getStackSize()
                 : 0));
     withdrawItem(Ids.UNICORN_SCROLL, 100);
   }
   if (Inventory.getCount(Ids.FOOD_SHARK[0]) != 14) {
     Log.log("withdrawing", "Shark");
     Log.log("amount", "Have: " + Inventory.getCount(Ids.FOOD_SHARK[0]));
     withdrawItem(Ids.FOOD_SHARK, 14);
   }
 }
示例#2
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);
   }
 }
示例#3
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();
   }
 }