Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ScriptManifest(name = "Spooky_Fletcher", author = "SP00k", version = 1.0, info = "nigger", logo = "http://i.imgur.com/7k74Br4.png" )
- public class Fletcher extends Script {
- private String bowName;
- private int bowID;
- private int stringID;
- private String bowString;
- private String toMakeInv;
- public void onStart() {
- this.bowName = "Yew longbow (u)";
- this.bowID = 66;
- this.bowString = "Bow string";
- this.stringID = 1777;
- this.toMakeInv = "Yew longbow";
- this.log("Start");
- }
- public int onLoop() throws InterruptedException{
- State current = this.getState();
- this.log(current.toString());
- switch(current) {
- case DEPOSIT:
- this.deposit();;
- break;
- case WITHDRAW:
- this.withdraw();
- break;
- case FLETCH:
- break;
- case FLETCHING:
- break;
- case IDLE:
- }
- return gRandom(700,50);
- }
- public void onExit() {
- this.log("Stop");
- }
- public void deposit() throws InterruptedException {
- if (this.openBank()) {
- sleep(random(500,1000));
- this.getBank().depositAll(); {
- sleep(random(400,1000));
- }
- }
- }
- public boolean withdraw() throws InterruptedException {
- if (this.openBank()) {
- while (!this.getInventory().contains(this.bowName)) {
- this.getBank().withdraw(14, bowID);
- while (!this.getInventory().contains(this.bowString)) {
- this.getBank().withdraw(14, stringID);
- sleep(random(500, 700));
- }
- this.closeBank();
- }
- }
- public boolean openBank() throws InterruptedException {
- if (this.getBank().isOpen()) {
- return true;
- }
- RS2Object bank = this.objects.closest("Bank booth");
- if (bank != null) {
- while (this.getBank().isOpen()) {
- bank.interact("Bank");
- sleep(gRandom(500, 800));
- }
- return true;
- }
- return false;
- }
- public void closeBank() throws InterruptedException {
- while(this.getBank().isOpen()) {
- this.getBank().close();
- sleep(gRandom(500,700));
- }
- }
- public State getState() {
- if (this.getInventory().contains(this.bowName) && !this.myPlayer().isAnimating()) {
- return getState().FLETCH;
- } else if (this.myPlayer().isAnimating() && this.getInventory().contains(this.bowString)) {
- return State.FLETCHING;
- } else if (this.getInventory().contains(this.toMakeInv) && !this.getInventory().contains(this.bowString)) {
- return State.DEPOSIT;
- } else if (!this.getInventory().contains(this.toMakeInv) && !this.getInventory().contains(this.bowString)) {
- return State.WITHDRAW;
- }
- return State.IDLE;
- }
- public enum State {
- DEPOSIT, WITHDRAW, FLETCH, FLETCHING, IDLE
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement