Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.io.IOException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import org.osbot.script.MessageListener;
- import org.osbot.script.Script;
- import org.osbot.script.ScriptManifest;
- import org.osbot.script.rs2.model.Player;
- import org.osbot.script.rs2.model.RS2Object;
- @ScriptManifest(author = "BrownBird", name = "BBtoadLegRemover", version = 1.0, info = "Removes toad's legs.")
- public class BBtoadLegRemover extends Script implements MessageListener{
- public int leg = 2152;
- public int frog = 2150;
- public long startTime = 0;
- String FROG = "Toad's legs";
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- public int legsRemoved;
- public int legsPH;
- public int moneyMade;
- public long startTar;
- public int moneyPH;
- public int toadPrice = 538;
- String status = "Starting Script";
- @Override
- public void onStart() {
- startTime = System.currentTimeMillis();
- }
- @Override
- public void onExit() {
- try {
- logoutTab.logOut();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- log("Thanks for using BBtarCollector!");
- log("Ran for: " + hours + ":" + minutes + ":" + seconds);
- log("Legs Removed: " + legsRemoved);
- log("Legs Removed P/H: " + legsPH);
- log("Money Made: " + moneyMade);
- log("Money Made PH: " + moneyPH);
- log("Toad's Legs price: " + toadPrice);
- }
- public void onMessage(String message) throws InterruptedException{
- if(message.contains("You pull the legs off the toad.")) {
- legsRemoved++;
- }
- }
- @Override
- public int onLoop() throws InterruptedException {
- Player player = myPlayer();
- if (client.getInventory().getTotalItemsAmount() == 0) {
- status = "Banking";
- withdraw();
- }
- if (client.getInventory().getAmount(frog) == 0
- && client.getInventory().getAmount(leg) >= 27
- && !player.isAnimating() && !player.isMoving()) {
- status = "Banking";
- bank();
- }
- if(client.getBank().isOpen() && client.getInventory().contains(frog)) {
- status = " Error Occured Closing Bank";
- client.getBank().close();
- }
- if(client.getBank().isOpen() && client.getBank().getAmount(frog) == 0 && client.getInventory().getAmount(frog) == 0) {
- status = "Stopping script";
- client.getBank().close();
- sleep(random(100, 150));
- stop();
- }
- if(client.getInventory().contains(frog)) {
- status = "Removing frog legs";
- client.getInventory().interactWithId(frog, "Remove-legs");
- sleep(random(150, 200));
- }
- AntiBan();
- return random(500, 650);
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch (IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(0, 0, 0);
- private final Font font1 = new Font("Arial", 0, 14);
- private final Image img1 = getImage("http://i39.tinypic.com/2uh8kt1.png");
- public void onPaint(Graphics graphics) {
- 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;
- legsPH = (int) ((legsRemoved) * 3600000D / (System.currentTimeMillis() - startTime));
- moneyMade = legsRemoved * toadPrice;
- moneyPH = (int) ((moneyMade) * 3600000D / (System.currentTimeMillis() - startTime));
- Graphics2D g = (Graphics2D) graphics;
- g.drawImage(img1, 1, 196, null);
- g.setFont(font1);
- g.setColor(color1);
- g.drawString(" " + hours + " hours " + minutes + " minutes " + seconds + " seconds", 98, 292);
- g.drawString(" " + legsRemoved, 133, 310);
- g.drawString(" " + legsPH, 164, 327);
- g.drawString(" " + moneyMade, 407, 293);
- g.drawString(" " + moneyPH, 430, 313);
- g.drawString(" " + status, 362, 334);
- }
- public void bank() throws InterruptedException {
- RS2Object booth = closestObjectForName(new String[] { "Bank booth" });
- if ((booth != null) && (booth.interact("Bank"))) {
- booth.interact("Bank");
- sleep(random(300, 500));
- }
- if (client.getBank().isOpen()) {
- client.getBank().depositAll();
- sleep(random(500, 700));
- if (client.getInventory().getAmount(leg) == 0) {
- client.getBank().withdrawAll(frog);
- sleep(random(500, 700));
- } else {
- client.getBank().depositAll();
- sleep(random(500, 700));
- }
- }
- sleep(random(800, 1000));
- if (client.getInventory().getAmount(frog) == 28) {
- client.getBank().close();
- sleep(random(500, 700));
- } else {
- client.getBank().withdrawAll(frog);
- sleep(random(500, 700));
- }
- }
- public void withdraw() throws InterruptedException {
- status = "Withdrawing frogs";
- RS2Object booth = closestObjectForName(new String[] { "Bank booth" });
- if ((booth != null) && (booth.interact("Bank"))) {
- booth.interact("Bank");
- sleep(random(300, 500));
- }
- client.getBank().withdrawAll(frog);
- sleep(random(500, 700));
- if (client.getInventory().getAmount(frog) == 28) {
- client.getBank().close();
- sleep(random(500, 700));
- } else {
- client.getBank().withdrawAll(frog);
- sleep(random(500, 700));
- }
- }
- public void AntiBan() throws InterruptedException {
- switch (random(1, 100)) {
- case 14:
- status = "Anti-ban";
- client.rotateCameraToAngle(random(100, 180));
- case 6:
- status = "Anti-ban";
- client.rotateCameraToAngle(random(100, 180));
- case 3:
- status = "Anti-ban";
- client.rotateCameraToAngle(random(100, 180));
- case 56:
- status = "Anti-ban";
- client.rotateCameraToAngle(random(100, 180));
- case 16:
- status = "Anti-ban";
- client.rotateCameraToAngle(random(100, 180));
- case 30:
- status = "Anti-ban";
- client.rotateCameraToAngle(random(100, 180));
- }
- random(100, 500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment