daily pastebin goal
96%
SHARE
TWEET

Untitled

a guest Jul 21st, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private boolean BuyByID(int id, int amount, double price, boolean tobank) {
  2.         if (!BuySupplies) {
  3.             Log.fine("SqAlch", "Out of supplies. Stopping the bot.");
  4.             setStopping(true);
  5.             return true;
  6.         } else {
  7.             Log.fine("SqAlch", "We need to buy " + amount + " " + Definitions.getItem(id).getName() + " for " + (int) price + "gp each");
  8.             if (amount == 0) return true;
  9.             else {
  10.                 Time.sleepUntil(this::OpenBank, 99999);
  11.                 Bank.withdrawAll("Coins");
  12.                 Time.sleep(400,600);
  13.                 Bank.close();
  14.                 if (BankLocation.GRAND_EXCHANGE.getPosition().distance() <= 40)
  15.                     SceneObjects.getNearest(d -> d.containsAction("Exchange")).interact("Exchange");
  16.                 else Movement.setWalkFlag(BankLocation.GRAND_EXCHANGE.getPosition());
  17.                 Time.sleepUntil(GrandExchange::isOpen, 99999);
  18.                 if (Interfaces.getComponent(465, 6, 0).isVisible()) {
  19.                     Log.fine("SqAlch", "Collecting items first");
  20.                     Time.sleepUntil(() -> CollectFromGE(tobank, id), 99999);
  21.                     return true;
  22.                 } else {
  23.                     if (GrandExchange.getOffers(i -> i.getItemId() == id).length == 0) {
  24.                         Time.sleepUntil(() -> GrandExchange.placeOffer(false, id, amount, price), 99999);
  25.                         Time.sleepUntil(() -> GrandExchange.getView().equals(GrandExchange.View.OVERVIEW), 9999);
  26.                         Time.sleepUntil(() -> CollectFromGE(tobank, id), 99999);
  27.                         return true;
  28.                     } else {
  29.                         Log.info("SqAlch", "offer already exist");
  30.                         Time.sleep(5000, 7000);
  31.                         Time.sleepUntil(() -> CollectFromGE(tobank, id), 99999);
  32.                         return true;
  33.                     }
  34.                 }
  35.             }
  36.         }
  37.     }
  38.  
  39.     private boolean CollectFromGE(boolean tobank, int id) {
  40.         if (!GrandExchange.isOpen()) return false;
  41.         else if (Interfaces.getComponent(465, 6, 0).isVisible()) {
  42.             GrandExchange.collectAll(tobank);
  43.             Time.sleep(2499, 3064);
  44.             if (tobank) OpenBank();
  45.             else Time.sleepUntil(() -> Inventory.contains(id), 99999);
  46.             return true;
  47.         }
  48.         Time.sleep(200,600);
  49.         return false;
  50.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Pastebin PRO 'SUMMER SPECIAL'!
Get 40% OFF Pastebin PRO accounts!
 
Top