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.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.RSArea;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = "BlinkBot", name = "BonesToBanana's", version = 1.3, description = "Turn all The Bones into Banana's!")
- public class BonesToBananas extends Script implements PaintListener,
- ServerMessageListener {
- // script \\
- int waterRuneID = 555;
- int earthRuneID = 557;
- int natureRuneID = 561;
- int BananaID = 1963;
- int waterStaffID = 1383;
- int earthStaffID = 1385;
- int BoneID = 526;
- int BankID = 11402;
- int SPELL_BONES_TO_BANANAS;
- private int tries;
- // Paint \\
- private int startExp;
- private int exp;
- private int expPerHour;
- private long startTime;
- private int profit;
- private int profitPerHour;
- private int costBone, costBanana;
- private int bananaCount;
- private int bananasPerHour;
- private int bonesToBananas = 0;
- // Banking System \\
- private boolean atBank() {
- RSArea area = new RSArea(new RSTile(3179, 3432), new RSTile(3194, 3446));
- return area.contains(getMyPlayer().getLocation());
- }
- private void Bank() {
- openBank();
- depositBanana();
- getBones();
- closeBank();
- }
- private void openBank() {
- RSObject bankBooth = objects.getNearest(BankID);
- if (bankBooth != null && !bank.isOpen()) {
- bankBooth.doAction("Use-quickly");
- }
- }
- private void depositBanana() {
- if (bank.isOpen() && inventory.containsOneOf(BoneID, BananaID)) {
- bank.depositAllExcept(waterRuneID, earthRuneID, natureRuneID, 0);
- sleep(200, 500);
- }
- }
- private void getBones() {
- if (bank.isOpen()) {
- if (!inventory.contains(BoneID)) {
- if (bank.getCount(BoneID) < 26) {
- tries++;
- log("BoneCheck: " + tries + "/3");
- if (tries > 2) {
- sleep(1500);
- log.severe("Out of Bones, script is ending...");
- stopScript(true);
- }
- } else {
- bank.withdraw(BoneID, 0);
- }
- }
- }
- }
- private void closeBank() {
- if (bank.isOpen()) {
- mouse.move(490, 36, 3, 3);
- sleep(200, 500);
- mouse.click(true);
- }
- if (bank.isOpen()) {
- closeBank();
- }
- return;
- }
- // bones to banana system \\
- private void boneToBananas() {
- if (inventory.contains(BoneID)) {
- magic.castSpell(magic.SPELL_BONES_TO_BANANAS);
- bonesToBananas += inventory.getCount(BananaID);
- sleep(random(500, 1000));
- if (!inventory
- .containsOneOf(natureRuneID, waterRuneID, earthRuneID)) {
- log.severe("You runned out of runes, script is ending...");
- stopScript(true);
- }
- }
- }
- // anti ban system \\
- public void antiBan() {
- int i = random(1, 10000);
- if (i == 50) {
- sleep(1200, 2000);
- game.openTab(Game.TAB_STATS);
- skills.doHover(Skills.INTERFACE_MAGIC);
- sleep(1200, 2000);
- } else if (i == 100) {
- mouse.moveOffScreen();
- sleep(500, 2000);
- } else if (i == 500) {
- camera.moveRandomly(3000);
- sleep(500, 1000);
- }
- }
- // onStart price and equipment check \\
- public boolean onStart() {
- startExp = skills.getCurrentExp(Skills.MAGIC);
- startTime = System.currentTimeMillis();
- costBanana = grandExchange.getMarketPrice(BananaID);
- costBone = grandExchange.getMarketPrice(BoneID);
- log.severe("Welcome to BlinkBots BonesToBanana's!");
- if (inventory.containsAll(waterRuneID, earthRuneID, natureRuneID)) {
- log("Good job, you got all the runes that we need in your Inventory!");
- } else if (inventory.containsAll(natureRuneID, waterRuneID)
- && equipment.containsAll(earthStaffID)) {
- log("Good job, you got the right staff in your equipment and the right runes in your inventory!");
- } else if (inventory.containsAll(natureRuneID, earthRuneID)
- && equipment.containsAll(waterStaffID)) {
- log("Good job, you got the right staff in your equipment and the right runes in your inventory!");
- } else if (!inventory.containsOneOf(natureRuneID, earthRuneID,
- waterRuneID)
- && (!equipment.containsOneOf(waterStaffID, earthStaffID))) {
- log.severe("You don't got the right staff in your equipment or runes in your inventory, script is ending now...");
- stopScript(true);
- } else if (!inventory.containsOneOf(natureRuneID, earthRuneID,
- waterRuneID)
- && (equipment.containsOneOf(waterStaffID, earthStaffID))) {
- log.severe("You are missing runes in your inventory, script is ending now...");
- stopScript(true);
- }
- return true;
- }
- // finish \\
- public void onFinish() {
- log("[ ---------------------------------------------------------------------------------------- ]");
- sleep(1000);
- log(" Thank you for using BlinkBots BonesToBanana's!");
- sleep(1000);
- log(" You Gained " + exp + " EXP, You Made " + bananaCount
- + " Banana's And Earned " + profit + " Coins!");
- sleep(1000);
- log(" Bye!");
- sleep(1000);
- log("[ ---------------------------------------------------------------------------------------- ]");
- }
- // paint \\
- private String abbreviateNum(int i) {
- if (i < 1000)
- return "" + i;
- return "" + (i / 1000) + "K";
- }
- private final Color color1 = new Color(0, 0, 0, 155);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(204, 0, 51);
- private final Color color4 = new Color(204, 0, 51, 105);
- private final Color color5 = new Color(255, 255, 255);
- private final Color color6 = new Color(255, 255, 255, 80);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 10);
- @Override
- public void onRepaint(Graphics g1) {
- if (game.isLoggedIn()) {
- long runTime = System.currentTimeMillis() - startTime;
- 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;
- exp = skills.getCurrentExp(Skills.MAGIC) - startExp;
- profit = (costBanana - costBone) * bananaCount;
- bananaCount = bonesToBananas;
- if (runTime / 1000 > 0) {
- expPerHour = (int) (3600000.0 / runTime * exp);
- profitPerHour = (int) (3600000.0 / runTime * profit);
- bananasPerHour = (int) (3600000.0 / runTime * bananaCount);
- }
- Graphics2D g = (Graphics2D) g1;
- g.setColor(color1);
- g.fillRect(1, 324, 517, 14);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(0, 323, 518, 15);
- g.setColor(color3);
- g.fillRect(1, 324, skills.getPercentToNextLevel(Skills.MAGIC), 14);
- g.setColor(color4);
- g.fillRect(1, 324, 100, 14);
- g.setColor(color2);
- g.drawRect(0, 323, 101, 15);
- g.setFont(font1);
- g.drawString("" + skills.getPercentToNextLevel(Skills.MAGIC) + "%",
- 41, 335);
- g.setColor(color5);
- g.drawString("EXP: " + abbreviateNum(exp), 114, 335);
- g.drawString("P/h: " + abbreviateNum(expPerHour), 178, 335);
- g.drawString("||", 233, 334);
- g.drawString("||", 355, 334);
- g.drawString("||", 479, 334);
- g.drawString("P: " + abbreviateNum(profit), 250, 335);
- g.drawString("P/h: " + abbreviateNum(profitPerHour), 300, 335);
- g.drawString("B: " + abbreviateNum(bananaCount), 372, 335);
- g.drawString("P/h : " + abbreviateNum(bananasPerHour), 422, 335);
- g.drawString("BB ©", 490, 335);
- g.setColor(color6);
- g.fillRect(1, 324, 517, 7);
- g.setColor(color2);
- g.drawString("Time Running: " + hours + " : " + minutes + " : "
- + seconds, 4, 319);
- }
- }
- // the loop \\
- @Override
- public int loop() {
- antiBan();
- if (atBank() && inventory.contains(BoneID)) {
- boneToBananas();
- } else if (atBank() && inventory.contains(BananaID)) {
- Bank();
- } else if (atBank() && !inventory.containsOneOf(BananaID, BoneID)) {
- Bank();
- } else if (atBank() && bank.isOpen()) {
- closeBank();
- }
- return (random(500, 1000));
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- String serverString = e.getMessage();
- if (serverString
- .contains("You do not have enough water runes to cast this spell.")) {
- log.severe("You runned out of water runes, script is ending...");
- stopScript(true);
- }
- else if (serverString
- .contains("You do not have enough nature runes to cast this spell.")) {
- log.severe("You runned out of nature runes, script is ending...");
- stopScript(true);
- }
- else if (serverString
- .contains("You do not have enough earth runes to cast this spell.")) {
- log.severe("You runned out of earth runes, script is ending...");
- stopScript(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement