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 org.rsbuddy.net.GeItem;
- import org.rsbuddy.tabs.Inventory;
- import org.rsbuddy.widgets.Bank;
- 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.Calculations;
- import com.rsbuddy.script.methods.Camera;
- import com.rsbuddy.script.methods.Game;
- import com.rsbuddy.script.methods.Mouse;
- 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.util.Random;
- import com.rsbuddy.script.wrappers.Area;
- import com.rsbuddy.script.wrappers.GameObject;
- import com.rsbuddy.script.wrappers.Item;
- import com.rsbuddy.script.wrappers.Tile;
- @Manifest(name = "WaterCrafterPro", authors = "skutr3")
- public class WaterCrafterPro extends ActiveScript implements MessageListener,
- PaintListener {
- Area altarArea = new Area(new Tile(3477, 4830), new Tile(3498, 4844));
- Area bankArea = new Area(new Tile(3092, 3240), new Tile(3096, 3246));
- Area ruinArea = new Area(new Tile(3180, 3160), new Tile(3190, 3169));
- int runeEssence = 1436;
- int ruinID = 2454;
- int waterAltar = 2480;
- int portalID = 2467;
- int waterRune = 555;
- Tile bankTile = new Tile(3093, 3243);
- Tile ruinTile = new Tile(3183, 3162);
- Tile altarTile = new Tile(3488, 4834);
- Tile portalTile = new Tile(3490, 4833);
- private String Status = "Unknown";
- long startXp = 0;
- long currentXp = 0;
- long gainedXp = 0;
- long numOfRuns = 0;
- String word = "runs";
- long startTime = 0;
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- Mouse.setSpeed(5);
- log("Welcome to a script that Crafts Waters in a PROFESSIONAL MANNER");
- startXp = Skills.getCurrentExp(Skills.RUNECRAFTING);
- log("Water Runes are " + GeItem.lookup("Water Rune").getGuidePrice()
- + "gp");
- return true;
- }
- public void onFinish() {
- if (numOfRuns == 1) {
- word = "run";
- }
- log("You made " + numOfRuns + " " + word);
- log("Hope you made lots of money");
- log("Goodbye");
- }
- public enum State {
- WALK_TO_RUIN, ENTER_RUIN, CRAFT, EXIT_RUIN, WALK_TO_BANK, BANK, WAITING
- }
- public State getState() {
- if (Inventory.getCount(runeEssence) > 0 && !atRuin() && !atAltar()) {
- return State.WALK_TO_RUIN;
- } else if (atRuin() && Inventory.getCount(runeEssence) > 0) {
- return State.ENTER_RUIN;
- } else if (Inventory.getCount(runeEssence) > 0 && atAltar()) {
- return State.CRAFT;
- } else if (Inventory.getCount(runeEssence) == 0 && !atRuin()
- && atAltar()) {
- return State.EXIT_RUIN;
- } else if (!atBank() && Inventory.getCount(waterRune) > 0) {
- return State.WALK_TO_BANK;
- } else if (atBank() && Inventory.getCount(waterRune) > 0
- || Inventory.getCount(runeEssence) == 0) {
- return State.BANK;
- }
- return State.WAITING;
- }
- @Override
- public int loop() {
- switch (getState()) {
- case WALK_TO_RUIN:
- antiban();
- walkToRuin();
- break;
- case ENTER_RUIN:
- enterRuin();
- break;
- case CRAFT:
- walkUpToAltar();
- craftRunes();
- break;
- case EXIT_RUIN:
- exitRuins();
- break;
- case WALK_TO_BANK:
- walkToBank();
- break;
- case BANK:
- bank();
- break;
- }
- return 590;
- }
- public void messageReceived(MessageEvent e) {
- if (e != null) { // not needed, if messageevent catches something, then
- // theres something there
- if (e.getMessage()
- .contains(
- "The Lumbridge ring sparkles to life, creating more runes for you.")) {
- log("Run Complete! You gained "
- + Inventory.getCount(runeEssence)
- * GeItem.lookup("Water Rune").getGuidePrice() + " gp");
- }
- }
- if (e != null) {
- if (e.getMessage()
- .contains(
- "The Lumbridge ring sparkles to life, creating more runes for you.")) {
- numOfRuns++;
- }
- }
- }
- // START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(255, 255, 255, 127);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(5, 20, 6);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("SansSerif", 0, 15);
- private final Font font2 = new Font("SansSerif", 0, 14);
- private final Font font3 = new Font("SansSerif", 0, 13);
- public void onRepaint(Graphics g) {
- }
- /*
- * public void onRepaint(Graphics g1) {
- *
- * currentXp = Skills.getCurrentExp(Skills.RUNECRAFTING); gainedXp =
- * currentXp - startXp;
- *
- * long millis = System.currentTimeMillis() - startTime; long hours = millis
- * / (1000 * 60 * 60); millis -= hours * (1000 * 60 * 60); long minutes =
- * millis / (1000 * 60); millis -= minutes * (1000 * 60); long seconds =
- * millis / 1000;
- *
- * Graphics2D g = (Graphics2D) g1; g.setColor(color1); g.fillRoundRect(545,
- * 205, 191, 260, 16, 16); g.setColor(color2); g.setStroke(stroke1);
- * g.drawRoundRect(545, 205, 191, 260, 16, 16); g.setFont(font1);
- * g.setColor(color3); g.drawString("WaterCrafterPro ", 555, 233);
- * g.setFont(font2); g.drawString("[BETA] by skutr3", 559, 259);
- * g.setFont(font3); g.drawString("Status: " + getStatus(), 561, 308);
- * g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds +
- * ".", 560, 346); g.drawString("XP Gained: " + gainedXp, 556, 391);
- * drawMouse(g); }
- */
- // END: Code generated using Enfilade's Easel
- boolean atBank() {
- return bankArea.contains(Players.getLocal().getLocation());
- }
- boolean atRuin() {
- return ruinArea.contains(Players.getLocal().getLocation());
- }
- boolean atAltar() {
- return altarArea.contains(Players.getLocal().getLocation());
- }
- public void enterRuin() {
- setStatus("Entering");
- GameObject ruin = Objects.getNearest(ruinID);
- if (ruin != null && ruin.isOnScreen()) {
- ruin.interact("Enter");
- sleep(750, 1000);
- }
- }
- public void walkToRuin() {
- setStatus("Walking");
- Walking.findPath(ruinTile).traverse();
- }
- public void walkToBank() {
- setStatus("Walking");
- Walking.findPath(bankTile).traverse();
- }
- public void craftRunes() {
- setStatus("Crafting");
- GameObject altar = Objects.getNearest(waterAltar);
- if (Players.getLocal().getAnimation() == -1 && altar != null) {
- altar.interact("Craft-rune");
- sleep(750, 1000);
- }
- }
- public void exitRuins() {
- setStatus("Exiting");
- GameObject portal = Objects.getNearest(portalID);
- if (portal != null) {
- if (!portal.isOnScreen()) {
- Walking.findPath(portalTile).traverse();
- }
- }
- if (portal != null) {
- if (portal.isOnScreen()) {
- portal.interact("Enter");
- sleep(1500, 2000);
- } else {
- Camera.turnTo(portal);
- }
- }
- }
- public void bank() {
- setStatus("Banking");
- if (!Bank.isOpen()) {
- Bank.open();
- }
- if (Inventory.contains(waterRune)) {
- Bank.depositAll();
- sleep(350, 500);
- }
- if (!Inventory.contains(runeEssence)) {
- // Bank.search("Rune Essence");
- withdrawAll(runeEssence);
- sleep(750, 1500);
- }
- Bank.close();
- }
- public void depositAllOf(int i) {
- Item i2 = Inventory.getItem(i);
- if (i2 != null) {
- i2.interact("Deposit-All");
- }
- }
- public void withdrawAll(int i) {
- Item i2 = Bank.getItem(i);
- if (i2 != null) {
- i2.interact("Withdraw-All");
- }
- }
- public void walkUpToAltar() {
- setStatus("Preparing to craft");
- if (Calculations.distanceTo(altarTile) < 10) {
- altarTile.clickOnMap();
- } else {
- Walking.findPath(altarTile).traverse();
- }
- }
- public String getStatus() {
- return Status;
- }
- private void drawMouse(Graphics g) {
- int x = Mouse.getLocation().x, y = Mouse.getLocation().y;
- g.setColor(System.currentTimeMillis() - Mouse.getPressTime() < 300 ? Color.BLACK
- : Color.WHITE);
- g.fillOval(x - 6, y - 6, 12, 12);
- g.setColor(Color.BLACK);
- g.fillOval(x - 3, y - 3, 6, 6);
- g.drawLine(x - 10, y - 10, x + 10, y + 10);
- g.drawLine(x - 10, y + 10, x + 10, y - 10);
- }
- public void setStatus(String s) {
- Status = s;
- }
- public void antiban() {
- int b = Random.nextInt(0, 10);
- switch (b) {
- case 1:
- if (Random.nextInt(0, 10) == 5) {
- log("[Antiban] move mouse");
- Mouse.moveSlightly();
- sleep(200, 600);
- Mouse.moveRandomly(150, 350);
- }
- break;
- case 2:
- if (Random.nextInt(0, 13) == 2) {
- log("[Antiban] Turn screen");
- Camera.setCompassAngle(Random.nextInt(30, 70));
- sleep(400, 1200);
- }
- break;
- case 3:
- if (Random.nextInt(0, 24) == 6) {
- log("[Antiban] mouse off screen");
- Mouse.moveOffScreen();
- sleep(Random.nextInt(600, Random.nextInt(1200, 2000)));
- }
- break;
- case 4:
- if (Random.nextInt(0, 18) == 3) {
- log("[antiban] Checking Xp.");
- Game.openTab(1);
- Skills.hover(Skills.COMPONENT_RUNECRAFTING);
- sleep(Random.nextInt(2100, 3400));
- }
- break;
- default:
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement