Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.rsbuddy.script.ActiveScript;
- import com.rsbuddy.script.methods.Environment;
- import com.rsbuddy.script.methods.Game;
- import com.rsbuddy.script.methods.Players;
- import com.rsbuddy.script.methods.Walking;
- import com.rsbuddy.script.util.Random;
- import com.rsbuddy.script.wrappers.Path;
- import com.rsbuddy.script.wrappers.Player;
- import com.rsbuddy.script.wrappers.Tile;
- import org.rsbuddy.widgets.*;
- import org.rsbuddy.net.*;
- import org.rsbuddy.tabs.*;
- public class MyVialFiller extends ActiveScript {
- private static final int EMPTY_VIAL_ID = 229;
- private static final int WATER_SOURCE_ID = 11661;
- private static final Tile BANK_POS = new Tile(2947, 3368);
- private static final Tile WATER_SOURCE_TILE = new Tile(2949, 3382);
- private static enum State {
- BANK, FILL
- }
- public boolean onStart() {
- log("Starting...");
- return true;
- }
- private State getState() {
- Player myPlayer = Players.getLocal();
- if (Inventory.isFull() || !Inventory.contains(EMPTY_VIAL_ID))
- return State.BANK;
- else
- return State.FILL;
- }
- private void bank() {
- if (!Players.getLocal().isIdle())
- return;
- Path myBankPath = Walking.findPath(BANK_POS);
- if (myBankPath == null) {
- log("Could not get bank path.");
- }
- while (Players.getLocal().getLocation() != BANK_POS)
- if (!Players.getLocal().isMoving())
- myBankPath.traverse();
- if(!Bank.open()) {
- log("Could not open bank.");
- return;
- }
- Bank.depositAll();
- if(Bank.getCount(EMPTY_VIAL_ID) == 0) {
- log("No more vials!");
- log("Exiting script...");
- Game.logout(true);
- return;
- }
- Bank.withdraw(EMPTY_VIAL_ID, 28);
- }
- private void fill() {
- if (!Players.getLocal().isIdle())
- return;
- }
- @Override
- public int loop() {
- return Random.nextInt(750, 1750);
- }
- public void onFinish() {
- log("Exiting script...");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement