Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.parabot.environment.api.utils.Time;
- import org.parabot.environment.input.Mouse;
- import org.parabot.environment.scripts.Category;
- import org.parabot.environment.scripts.Script;
- import org.parabot.environment.scripts.ScriptManifest;
- import org.parabot.environment.scripts.framework.SleepCondition;
- import org.parabot.environment.scripts.framework.Strategy;
- import org.rev317.min.api.methods.*;
- import org.rev317.min.api.wrappers.Npc;
- import org.rev317.min.api.wrappers.SceneObject;
- import java.awt.Point;
- import java.util.ArrayList;
- @ScriptManifest(
- author = "Fryslan"
- , category = Category.FISHING
- , description = "Fishes and Deposits Rocktails"
- , name = "Fryslan's Rocktail Fisher - Edited by Ark"
- , version = 0.2
- , servers = {"UltimateScape"})
- public class UltimateScapeRockTailer extends Script {
- public static ArrayList<Strategy> strategies = new ArrayList<>();
- @Override
- public boolean onExecute() {
- strategies.add(new Relogger());
- strategies.add(new Fish());
- strategies.add(new BankRocktails());
- provide(strategies);
- return true;
- }
- private class Fish implements Strategy {
- @Override
- public boolean activate() {
- return !Inventory.isFull() && Inventory.getCount(315) > 0 && Inventory.getCount(310) > 0;
- }
- @Override
- public void execute() {
- Npc[] spot = Npcs.getNearest(233);
- //Interacting with the Fishing Spot.
- if (spot != null) {
- if (Players.getMyPlayer().getAnimation() == -1) {
- System.out.println("Fishing...");
- spot[0].interact(0);
- Time.sleep(new SleepCondition() {
- @Override
- public boolean isValid() {
- return Players.getMyPlayer().getAnimation() != -1;
- }
- }, 5000);
- }
- }
- }
- }
- private class BankRocktails implements Strategy {
- @Override
- public boolean activate() {
- return Inventory.isFull();
- }
- @Override
- public void execute() {
- //We Need to bank because we have an full Inventory.
- //Bank is NOT open Opening Bank.
- if (Game.getOpenInterfaceId() != 5292) {
- SceneObject[] bank = SceneObjects.getNearest(5276);
- if (bank != null) {
- //todo Fix the interacting Issue!
- System.out.println("Banking...");
- try {
- bank[0].interact(1);
- } catch (Exception e) {
- //pass
- }
- Time.sleep(new SleepCondition() {
- @Override
- public boolean isValid() {
- return Game.getOpenInterfaceId() == 5292;
- }
- }, 5000);
- }
- }
- //Bank is open Depositing Fish.
- if (Game.getOpenInterfaceId() == 5292) {
- try{
- Bank.depositAllExcept(310,315);
- } catch(Exception e) {
- e.printStackTrace();
- }
- Time.sleep(200);
- }
- //Closing Bank Interface
- Menu.sendAction(200, 9144, 36, 5384, 1);
- }
- }
- public class Relogger implements Strategy {
- public boolean activate() {
- if (isLoggedIn()) {
- return false;
- }
- System.out.println("Logging In....");
- return true;
- }
- public void execute() {
- Point login = new Point(452,280);
- Mouse.getInstance().click(login);
- Time.sleep(new SleepCondition() {
- @Override
- public boolean isValid() {
- return isLoggedIn();
- }
- }, 6000);
- }
- public boolean isLoggedIn() {
- try {
- return SceneObjects.getNearest().length > 0;
- } catch(IllegalArgumentException e) {
- // catch
- }
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement