Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import com.rsbuddy.event.events.MessageEvent;
- import com.rsbuddy.event.listeners.MessageListener;
- import com.rsbuddy.event.listeners.PaintListener;
- import com.rsbuddy.script.ActiveScript;
- import com.rsbuddy.script.Manifest;
- import com.rsbuddy.script.methods.Bank;
- import com.rsbuddy.script.methods.Calculations;
- import com.rsbuddy.script.methods.Inventory;
- import com.rsbuddy.script.methods.Objects;
- import com.rsbuddy.script.methods.Players;
- import com.rsbuddy.script.methods.Skills;
- import com.rsbuddy.script.methods.Walking;
- import com.rsbuddy.script.wrappers.Area;
- import com.rsbuddy.script.wrappers.GameObject;
- import com.rsbuddy.script.wrappers.Tile;
- import com.rsbuddy.script.wrappers.TilePath;
- @Manifest(name = "WaterCrafter", description = "Crafts water runes P2P and F2P", authors = "skutr3")
- public class WaterCrafter extends ActiveScript implements
- PaintListener {
- long startExp;
- long gainedExp;
- long currentExp;
- int[] essenceID = {7936, 1436};
- int ruinsID = 2454;
- int altarID = 2480;
- int waterRuneID = 555;
- int portalID = 7389;
- int boothID = 2213;
- Tile entranceTile = (new Tile(3183, 3164));
- Tile altarTile = (new Tile(3491, 4832));
- Tile portalTile = (new Tile(3492, 4833));
- Area bankArea = new Area(new Tile(3092, 3240), new Tile(3095, 3246));
- Area altarArea = new Area(new Tile(3494, 4831), new Tile(3479, 4839));
- Area ruinsArea = new Area(new Tile(3175, 3156), new Tile(3191, 3170));
- TilePath altarWalk = Walking.newTilePath(new Tile[]{new Tile(3092, 3247),
- new Tile(3101, 3250), new Tile(3104, 3238), new Tile(3110, 3228),
- new Tile(3121, 3226), new Tile(3134, 3218), new Tile(3144, 3210),
- new Tile(3153, 3200), new Tile(3156, 3188), new Tile(3160, 3175),
- new Tile(3167, 3164), new Tile(3176, 3160), new Tile(3183, 3164)});
- TilePath walking = Walking.newTilePath(new Tile[]{new Tile(3490, 4833),
- new Tile(3486, 4385)});
- public enum State {
- WALK_TO_ALTAR, WALK_TO_BANK, BANKING, CRAFTING_RUNES, ENTER_RUINS, EXIT_RUINS, WAITING
- }
- private State getState() {
- if (needBank() && atBank()) {
- return State.BANKING;
- } else if (Inventory.getCount(essenceID) > 0) {
- if (!atAltar() && Inventory.getCount(essenceID) > 0) {
- return State.WALK_TO_ALTAR;
- } else if (ruinsArea.contains(Players.getLocal().getLocation())) {
- return State.ENTER_RUINS;
- } else if (altarArea.contains(Players.getLocal().getLocation())) {
- return State.CRAFTING_RUNES;
- }
- } else {
- if (altarArea.contains(Players.getLocal().getLocation())) {
- return State.EXIT_RUINS;
- } else if (!atBank() && Inventory.contains(waterRuneID)) {
- return State.WALK_TO_BANK;
- }
- }
- return State.WAITING;
- }
- public boolean onStart() {
- startExp = Skills.getCurrentExp(Skills.RUNECRAFTING);
- log("Hello. This script is in alpha stages. That is the one before Beta. Please Report bugs.....");
- log("Start at Draynor bank with essence you want in a separate bank tab");
- return true;
- }
- boolean needBank() {
- return Inventory.contains(waterRuneID)
- || Inventory.getCount(essenceID) == 0;
- }
- boolean atBank() {
- return bankArea.contains(Players.getLocal().getLocation());
- }
- boolean atAltar() {
- return altarArea.contains(Players.getLocal().getLocation());
- }
- public void craftRune() {
- log("Crafting");
- sleep(150, 200);
- GameObject altar = Objects.getNearest(altarID);
- altar.interact("Craft-rune");
- }
- public void enterRuins() {
- log("Entering Ruins");
- GameObject ruins = Objects.getNearest(ruinsID);
- ruins.interact("Enter");
- }
- public void PortalTravel() {
- log("Exiting Ruins");
- GameObject portal = Objects.getNearest(portalID);
- portal.interact("Enter");
- sleep(2000, 3000);
- }
- public void Bank() {
- log("Banking");
- GameObject booth = Objects.getNearest(boothID);
- if (booth.isOnScreen() && booth != null) {
- booth.interact("Use-Quickly");
- sleep(150, 200);
- Bank.depositAll();
- sleep(100, 250);
- Bank.withdraw(7936, 28);
- Bank.withdraw(1436, 28);
- sleep(100, 250);
- Bank.close();
- }
- }
- public void setRun() {
- Walking.setRun(true);
- }
- public void walkToAltar() {
- altarWalk.traverse();
- sleep(600, 950);
- }
- @Override
- public int loop() {
- switch (getState()) {
- case BANKING:
- Bank();
- break;
- case WALK_TO_ALTAR:
- log("To Altar");
- walkToAltar();
- break;
- case ENTER_RUINS:
- enterRuins();
- break;
- case CRAFTING_RUNES:
- log("Hello Altar");
- walking.traverse();
- sleep(150, 200);
- craftRune();
- break;
- case EXIT_RUINS:
- log("Goodbye altar");
- walking.reverse().traverse();
- sleep(150, 250);
- PortalTravel();
- break;
- case WALK_TO_BANK:
- log("To bank");
- altarWalk.reverse().traverse();
- sleep(600, 950);
- break;
- }
- return 590;
- }
- private final Color color1 = new Color(18, 16, 16, 129);
- private final Color color2 = new Color(232, 231, 236);
- private final Color color3 = new Color(238, 234, 234);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Bitstream Charter", 0, 16);
- private final Font font2 = new Font("Bitstream Charter", 0, 15);
- public void onRepaint(Graphics g1) {
- currentExp = Skills.getCurrentExp(Skills.RUNECRAFTING);
- gainedExp = (currentExp - startExp);
- Graphics2D g = (Graphics2D) g1;
- g.setColor(color1);
- g.fillRoundRect(550, 207, 182, 255, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(550, 207, 182, 255, 16, 16);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("WaterCrafter by skutr3", 559, 225);
- g.setFont(font2);
- g.drawString("Xp gained:" + gainedExp, 563, 263);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement