Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.85 KB | None | 0 0
  1. import com.rsbuddy.script.ActiveScript;
  2. import com.rsbuddy.script.methods.Environment;
  3. import com.rsbuddy.script.methods.Game;
  4. import com.rsbuddy.script.methods.Players;
  5. import com.rsbuddy.script.methods.Walking;
  6. import com.rsbuddy.script.util.Random;
  7. import com.rsbuddy.script.wrappers.Path;
  8. import com.rsbuddy.script.wrappers.Player;
  9. import com.rsbuddy.script.wrappers.Tile;
  10. import org.rsbuddy.widgets.*;
  11. import org.rsbuddy.net.*;
  12. import org.rsbuddy.tabs.*;
  13.  
  14. public class MyVialFiller extends ActiveScript {
  15.  
  16.     private static final int EMPTY_VIAL_ID = 229;
  17.     private static final int WATER_SOURCE_ID = 11661;
  18.     private static final Tile BANK_POS = new Tile(2947, 3368);
  19.     private static final Tile WATER_SOURCE_TILE = new Tile(2949, 3382);
  20.  
  21.     private static enum State {
  22.         BANK, FILL
  23.     }
  24.  
  25.     public boolean onStart() {
  26.         log("Starting...");
  27.         return true;
  28.  
  29.     }
  30.  
  31.     private State getState() {
  32.         Player myPlayer = Players.getLocal();
  33.         if (Inventory.isFull() || !Inventory.contains(EMPTY_VIAL_ID))
  34.             return State.BANK;
  35.         else
  36.             return State.FILL;
  37.     }
  38.  
  39.     private void bank() {
  40.         if (!Players.getLocal().isIdle())
  41.             return;
  42.         Path myBankPath = Walking.findPath(BANK_POS);
  43.         if (myBankPath == null) {
  44.             log("Could not get bank path.");
  45.         }
  46.         while (Players.getLocal().getLocation() != BANK_POS)
  47.             if (!Players.getLocal().isMoving())
  48.                 myBankPath.traverse();
  49.         if(!Bank.open()) {
  50.             log("Could not open bank.");
  51.             return;
  52.         }
  53.         Bank.depositAll();
  54.         if(Bank.getCount(EMPTY_VIAL_ID) == 0) {
  55.             log("No more vials!");
  56.             log("Exiting script...");
  57.             Game.logout(true);
  58.             return;
  59.         }
  60.         Bank.withdraw(EMPTY_VIAL_ID, 28);
  61.     }
  62.  
  63.     private void fill() {
  64.         if (!Players.getLocal().isIdle())
  65.             return;
  66.     }
  67.  
  68.     @Override
  69.     public int loop() {
  70.         return Random.nextInt(750, 1750);
  71.     }
  72.  
  73.     public void onFinish() {
  74.         log("Exiting script...");
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement