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 java.awt.Point;
- import java.util.Map;
- import org.rsbot.bot.Bot;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.wrappers.RSInterface;
- @ScriptManifest(authors = { "Boolean & Extinct" }, keywords = "Crafting", name = "Glass Blower", description = "Make sure you scroll the interface all the way over to the right")
- public class EGlassOrbs extends Script implements PaintListener,
- ServerMessageListener {
- public int orb = 567, glass = 1775, pipe = 1785;
- public long startTime = 0, millis = 0, hours = 0, minutes = 0, seconds = 0,
- tri = 0;
- public int currentLevel, craft = 0;
- public int startExp = 0, startLevel = 0;
- public double expGained = 0, expPerOrb = 52.5, expPerHour = 0;
- public int count = 0, countPerHour = 0;
- public int orbCheck = -1, currentOrbs = 0;
- public boolean onStart() {
- log.info("Getting data for script...");
- startTime = System.currentTimeMillis();
- craft = Skills.CRAFTING;
- startLevel = skills.getCurrentLevel(craft);
- startExp = skills.getCurrentExp(craft);
- camera.setPitch(true);
- log.info("Done, starting!");
- return true;
- }
- public void antiBan() {
- int randomNum = random(1, 45);
- int r = random(1, 50);
- if (randomNum == 6) {
- if (r == 1) {
- try {
- Thread.sleep(random(2000, 6000));
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- if (r == 2) {
- game.openTab(random(1, 14));
- }
- if (r == 3) {
- mouse.moveRandomly(250);
- }
- if (r == 4) {
- mouse.moveRandomly(300);
- }
- if (r == 5) {
- mouse.moveRandomly(350);
- }
- if (r == 6) {
- mouse.moveRandomly(200);
- }
- if (r == 7) {
- camera.setAngle(random(100, 360));
- }
- if (r == 8) {
- camera.setAngle(random(100, 360));
- }
- if (r == 9) {
- camera.setAngle(random(100, 360));
- }
- if (r == 10) {
- camera.setAngle(random(100, 360));
- }
- if (r == 11) {
- if (game.getCurrentTab() != Game.TAB_INVENTORY) {
- game.openTab(Game.TAB_INVENTORY);
- } else
- return;
- }
- if (r == 35) {
- if (game.getCurrentTab() != Game.TAB_STATS) {
- game.openTab(Game.TAB_STATS);
- mouse.move(random(680, 730), random(355, 370));
- sleep(random(1500, 5000));
- }
- }
- }
- }
- public boolean doOrbs() {
- if (inventory.contains(pipe) && inventory.contains(glass)) {
- if (!bank.isOpen()) {
- if (System.currentTimeMillis() - tri > 4500) {
- sleep(random(2000, 2800));
- inventory.getItem(pipe).doClick(true);
- sleep(random(350, 400));
- if (inventory.isItemSelected()) {
- inventory.getItem(glass).doClick(true);
- sleep(random(2500, 3000));
- mouse.move(random(250, 305), random(452, 448));
- mouse.click(true);
- sleep(random(5500,7400)); {
- }
- }
- } else {
- antiBan();
- }
- } else {
- bank.close();
- }
- }
- return false;
- }
- public boolean manageBanking() {
- if (!inventory.contains(glass)) {
- if (bank.isOpen()) {
- if (inventory.contains(pipe)) {
- if (inventory.contains(orb)) {
- bank.depositAllExcept(pipe);
- sleep(random(1800, 2100));
- } else {
- if (bank.getCount(glass) > 0) {
- bank.withdraw(glass, 0);
- sleep(random(1400, 1600));
- } else {
- log.info("No more glass in bank. Stopping.");
- stopScript();
- }
- }
- } else {
- if (bank.getCount(pipe) > 0) {
- bank.withdraw(pipe, 1);
- sleep(random(1500, 2000));
- } else {
- log.info("No pipe in inventory or in bank. Stopping.");
- stopScript();
- }
- }
- } else {
- bank.open();
- sleep(random(2000, 2600));
- }
- }
- return false;
- }
- @Override
- public int loop() {
- doOrbs();
- manageBanking();
- return 100;
- }
- private final Color color1 = new Color(255, 204, 0, 180);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Gill Sans MT", 1, 12);
- private final Font font2 = new Font("Gisha", 0, 11);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D) g1;
- count = (int) (expGained / expPerOrb);
- currentLevel = skills.getCurrentLevel(craft);
- expGained = skills.getCurrentExp(craft) - startExp;
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- countPerHour = (int) ((count) * 3600000D / (System.currentTimeMillis() - startTime));
- expPerHour = (int) ((expGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- g.setColor(color1);
- g.fillRoundRect(4, 5, 146, 180, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(4, 5, 146, 180, 16, 16);
- g.setFont(font1);
- g.drawString("Glass Blower - Boolean", 15, 25);
- g.setFont(font2);
- g.drawString("Exp. gained: " + (int) (expGained), 10, 50);
- g.drawString("Exp. p/h: " + (int) (expPerHour), 10, 70);
- g.drawString("Glass blowed: " + count, 10, 90);
- g.drawString("Blowed p/h: " + countPerHour, 10, 110);
- g.drawString("Exp TNL: " + skills.getExpToNextLevel(craft), 10, 130);
- g.drawLine(4, 155, 150, 155);
- g.drawLine(4, 164, 150, 164);
- g.drawString("Blows TNL: "
- + (int) (skills.getExpToNextLevel(craft) / expPerOrb), 10, 150);
- g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds,
- 10, 180);
- }
- public void onFinish() {
- env.saveScreenshot(true);
- expGained = skills.getCurrentExp(craft) - startExp;
- 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;
- log.info("Thanks for using.");
- log.info("Runtime: " + hours + ":" + minutes + ":" + seconds);
- log.info("Glass blowed: " + count);
- log.info("Experience earned: " + expGained);
- }
- @Override
- public void serverMessageRecieved(ServerMessageEvent e) {
- String m = e.getMessage().toLowerCase();
- if (m.contains("make an orb")) {
- count++;
- tri = System.currentTimeMillis();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement