Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package osbotOS;
- import org.osbot.rs07.script.Script;
- public abstract class Node {
- public Script script;
- public BankingMethods bankMethods = new BankingMethods();
- public PositionMethods positionMethods = new PositionMethods();
- public PouchMethods pouchMethods = new PouchMethods();
- public Core coreMethods = new Core();
- public int BANK_ID = 11744;
- public int UNNOTE_ESS = 7937;
- public int NOTE_ESS = 7936;
- public String BANK_OPTION = "Bank";
- public Node(Script script) {
- this.script = script;
- }
- public abstract void execute();
- public abstract boolean validate();
- }
- ^^^ node object
- package osbotOS;
- import java.util.ArrayList;
- import java.util.Collections;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- //imports omitted
- @ScriptManifest(author = "Elliott", info = "Robust AIO Abyss crafter.", name = "Freaky Fast Abyss", version = 1.0, logo = "")
- public class MainCrafter extends Script {
- public static ArrayList<Node> nodes = new ArrayList<>();
- public Core coreMethods = new Core();
- private ActivityInBank InBankNode = new ActivityInBank(this);
- private ActivityOutOfBank OutOfBankNode = new ActivityOutOfBank(this);
- @Override
- public void onStart() {
- int eatAt = 60;
- boolean[] pouchesInUse = new boolean[] { true, true, true, false };
- int foodID = 7946; //monk
- int tabAmount = 10;
- int foodHeals = 16;
- boolean usingGlories = false;
- boolean usingPrayer = true;
- boolean usingStam = true;
- boolean usingTabs = true;
- this.setSettings(eatAt, pouchesInUse, usingTabs, usingGlories,
- tabAmount, usingPrayer, usingStam, foodID, foodHeals);
- Collections.addAll(nodes, this.InBankNode, this.OutOfBankNode); //add all nodes to the ArrayList
- }
- private void setSettings(int eatAt, boolean[] pouchesInUse,
- boolean usingGlories, boolean usingTabs, int tabAmount,
- boolean usingPrayer, boolean usingStam, int foodID, int foodHeals) {
- this.InBankNode.eatAt = eatAt; //user defined from UI eventually;
- this.InBankNode.usingGlory = usingGlories;
- this.InBankNode.usingTabs = usingTabs;
- this.InBankNode.tabAmount = tabAmount;
- this.InBankNode.usingStam = usingStam;
- this.InBankNode.foodID = foodID;
- this.InBankNode.foodHeals = foodHeals;
- this.OutOfBankNode.pouchesInUse[0] = pouchesInUse[0];
- this.OutOfBankNode.pouchesInUse[1] = pouchesInUse[1];
- this.OutOfBankNode.pouchesInUse[2] = pouchesInUse[2];
- this.OutOfBankNode.pouchesInUse[3] = pouchesInUse[3];
- }
- @Override
- public int onLoop() throws InterruptedException {
- for (final Node node : nodes) { //loop through the nodes
- if (node.validate()) { //validate each node
- node.execute(); //execute
- this.coreMethods.waitTime(this.coreMethods.rand(10, 50)); //prevents us from going through the logic as fast as we possibly can
- }
- }
- return this.coreMethods.rand(50, 100);
- }
- }
- ^^^^^ main script class
- package osbotOS;
- import java.awt.Color;
- import java.util.ArrayList;
- import java.util.Collections;
- import org.osbot.rs07.api.ui.EquipmentSlot;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.Script;
- public class ActivityInBank extends Node {
- public boolean pouchesFull = false;
- public boolean bankingIsDone = false;
- public static ArrayList<Node> subnodes = new ArrayList<>();
- public Integer eatAt;
- public int foodID;
- public int foodHeals;
- public boolean usingTabs;
- public boolean usingGlory;
- public boolean usingPrayer;
- public boolean usingStam;
- public int tabAmount;
- public boolean needToWithdrawFood;
- public boolean needToWithdrawGlory;
- public boolean needToWithdrawPrayer;
- public boolean needToWithdrawRunes;
- public boolean needToWithdrawTabs;
- public boolean needToWithdrawStam;
- public boolean nearBank = this.validateNearBank();
- public ActivityInBank(Script script) {
- super(script);
- this.needToWithdrawFood = this.validateFood();
- this.needToWithdrawGlory = this.validateGlory();
- this.needToWithdrawPrayer = this.validatePrayer();
- this.needToWithdrawRunes = this.validateRunes();
- this.needToWithdrawTabs = this.validateTabs();
- this.needToWithdrawStam = this.validateStam();
- // TODO Auto-generated constructor stub
- }
- ^^ ActivityInBank showing constructor
- ...followed by other irrelevant methods to this problem
- activity out of bank is the same way.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement