Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- //What happens when script stops.
- @ScriptManifest(authors = "Themanhunt", name = "AirCrafter", version = 1.0, description = "AirCrafter")
- public class airCrafter extends Script {
- // Object ID's
- public int ruinID = 2452; // Ruin id.
- public int bankBoothID = 11402; // Bank booth id
- public int airAltarID = 2478; // Altar id.
- public int portalID = 2465; // Portal id.
- RSObject ruin = objects.getNearest(2452);
- // Item ID's
- public int airTalismonID = 1438;
- public int airRuneID = 556;
- public int essenceID = 1436;
- // Area and Tile
- public RSArea bankArea = new RSArea(new RSTile(3179, 3432), new RSTile(3196, 3446)); // The bank area
- public RSTile bankToRuin[] = new RSTile[] { new RSTile(3180, 3430),new RSTile(3172, 3429), new RSTile(3165, 3425),new RSTile(3158, 3419), new RSTile(3149, 3416), new RSTile(3141, 3410), new RSTile(3134, 3408), new RSTile(3128, 3407) }; // Bank to altar path
- public RSArea ruinArea = new RSArea(new RSTile(3123, 3402), new RSTile(3130, 3409)); // The ruin area
- // Misc
- public enum State {
- WALKTORUINS, ENTERINGRUIN, STOPSCRIPT;
- }
- private State getState() {
- if (atRuins() && inventory.contains(essenceID)) {
- return State.ENTERINGRUIN;
- } else if (atBank() && inventory.contains(essenceID)) {
- return State.WALKTORUINS;
- }
- return State.STOPSCRIPT;
- }
- //Walking
- // Walk randomly to the bank.
- private void bankToAir() {
- log("Walking to airaltar");
- walking.walkPathMM(bankToRuin);
- sleep(100);
- }
- // At the bank
- private boolean atBank() {
- return (bankArea.contains(getMyPlayer().getLocation()));
- }
- private boolean atRuins() {
- return (ruinArea.contains(getMyPlayer().getLocation()));
- }
- // What happens when the script start.
- public boolean onStart() {
- log("Welcome to AirCrafter.");
- return true;
- }
- private void openBank() {
- RSObject bankBooth = objects.getNearest(bankBoothID);
- if (bankBooth.isOnScreen()) {
- bankBooth.doAction("Use-quickly");
- }
- sleep(100);
- }
- private void depositItemsAndClose() {
- if (bank.isOpen() && inventory.isFull()) {
- bank.depositAllExcept(essenceID);
- bank.close();
- } else if (bank.isOpen() && !inventory.isFull()) {
- bank.close();
- }
- }
- private void bank() {
- openBank();
- depositItemsAndClose();
- }
- public void onFinish() {
- log("Air Crafter stopped.");
- }
- public int loop() {
- switch (getState()) {
- case WALKTORUINS:
- bankToAir();
- case ENTERINGRUIN:
- ruin.doAction("Enter");
- case STOPSCRIPT:
- log("Script stopped.");
- }
- return 100;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement