Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.rsbuddy.script.ActiveScript;
- import com.rsbuddy.script.Manifest;
- import com.rsbuddy.script.methods.*;
- import com.rsbuddy.script.wrappers.*;
- @Manifest(name = "LobbyBoss", description = "Cages Lobsters in Karajama like a boss.", authors = "skutr3")
- public class LobbyBoss extends ActiveScript {
- int Stiles = 11267;
- int CageID = 301;
- int[] FishingSpot = {323, 324};
- Area StilesArea = new Area(new Tile(2847, 3141), new Tile(2853, 3145));
- public boolean onStart() {
- log("Welcome");
- if (Game.isLoggedIn()) {
- log("Checking For Cage...");
- if (Inventory.contains(CageID)) {
- log("Cage Found");
- } else {
- log("Cage not found...");
- log("This script is not functional without a lobster cage");
- return false;
- }
- }
- return true;
- }
- public enum State {
- FISHING, WALK_TO_STILES, EXCHANGE, WALK_TO_SPOT, WAITING
- }
- private State getState() {
- if (!Inventory.isFull() && atSpot()) {
- return State.FISHING;
- } else if (Inventory.isFull() && !atStiles()) {
- return State.WALK_TO_STILES;
- } else if (Inventory.isFull() && atStiles()) {
- return State.EXCHANGE;
- } else if (!Inventory.isFull() && !atSpot()) {
- return State.WALK_TO_SPOT;
- }
- log("WAITING");
- return State.WAITING;
- }
- @Override
- public int loop() {
- switch (getState()) {
- case FISHING:
- fish();
- break;
- case WALK_TO_STILES:
- walkToStiles();
- break;
- case EXCHANGE:
- exchange();
- break;
- case WALK_TO_SPOT:
- walkToSpots();
- break;
- }
- return 590;
- }
- public void fish() {
- Npc spot = Npcs.getNearest(FishingSpot);
- if (Players.getLocal().isIdle()) {
- if (spot != null) {
- if (containsAction(spot, "Cage")) {
- spot.interact("Cage");
- sleep(600, 1200);
- }
- }
- }
- }
- boolean atStiles() {
- return StilesArea.contains(Players.getLocal().getLocation());
- }
- boolean atSpot() {
- Npc spot = Npcs.getNearest(FishingSpot);
- if (spot != null) {
- return true;
- } else {
- return false;
- }
- }
- public boolean containsAction(Npc spot, String Cage) {
- if (spot != null) {
- for (String a : spot.getActions()) {
- if (spot != null && a.equalsIgnoreCase(Cage)) {
- return true;
- }
- }
- }
- return false;
- }
- public void exchange() {
- Npc stiles = Npcs.getNearest(Stiles);
- if (stiles.isOnScreen()) {
- stiles.interact("Exchange");
- sleep(600, 1200);
- }
- }
- public void walkToStiles() {
- Walking.findPath(new Tile(2851, 3142)).traverse();
- }
- public void walkToSpots() {
- Walking.findPath(new Tile(2924, 3177)).traverse();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement