Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package core;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import nodes.Banking;
- import nodes.Drinking;
- import java.awt.*;
- import java.util.ArrayList;
- import java.util.Collections;
- @ScriptManifest(author = "TheWind", info = "Drinks Wine Jugs", name = "Wine Jug Drinker", version = 1, logo = "")
- public class Main extends Script {
- //private String status = "";
- private ArrayList<Node> nodes = new ArrayList<Node>();
- @Override
- public void onStart() {
- log("Starting Script!");
- Collections.addAll(nodes,
- new Banking(this),
- new Drinking(this)
- );
- }
- @Override
- public int onLoop() throws InterruptedException {
- for(Node n : nodes) {
- if(n.validate()) {
- //status = n.status();
- if(n.execute()) {
- return random(200, 400);
- }
- }
- }
- return random(200, 300);
- }
- @Override
- public void onExit() {
- log("Thanks for running my Wine Jug Drinker!");
- }
- @Override
- public void onPaint(Graphics2D g) {
- }
- }
- package nodes;
- import org.osbot.rs07.script.Script;
- import core.Node;
- public class Banking extends Node{
- public Banking(Script s) {
- super(s);
- }
- @Override
- public boolean validate() throws InterruptedException {
- s.getBank().open();
- if(s.getBank().isOpen())
- return true;
- s.log("No bank within range!");
- return false;
- }
- @Override
- public boolean execute() throws InterruptedException {
- if(!(s.getBank().contains("Jug of wine")) && !(s.getInventory().contains("Jug of wine")))
- s.stop();
- else if(s.getInventory().isFull())
- s.getBank().depositAll("Jug");
- else if(s.getBank().contains("Jug of wine")) {
- s.getBank().withdraw("Jug of wine", 28);
- s.getBank().close();
- } else {
- s.getBank().close();
- return false;
- }
- return true;
- }
- }
- package nodes;
- import org.osbot.rs07.api.model.Item;
- import org.osbot.rs07.script.MethodProvider;
- import org.osbot.rs07.script.Script;
- import core.Node;
- public class Drinking extends Node{
- public Drinking(Script s) {
- super(s);
- }
- @Override
- public boolean validate() throws InterruptedException {
- if(s.getInventory().contains("Jug of wine"))
- return true;
- return false;
- }
- @Override
- public boolean execute() throws InterruptedException {
- for(Item item : s.getInventory().getItems()) {
- if(item.hasAction("Drink")) {
- item.interact("Drink");
- MethodProvider.sleep(MethodProvider.random(1500, 1800));
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement