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.util.logging.Level;
- import java.util.logging.Logger;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSTilePath;
- @ScriptManifest(name = "myfirstScript", authors = "beharon", keywords = "Moneymaking", version = 2.7, description = "Buys Beers")
- public class myfirstScript extends Script implements PaintListener {
- public int numOfBeers;
- public long startTime = 0;
- public long millis = 0;
- public double ph;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- public RSArea atBeer = new RSArea(new RSTile(2953, 3366), new RSTile(2960, 3376));
- RSArea atBank = new RSArea(new RSTile(2943, 3365), new RSTile(2949, 3373));
- /* public final RSTile[] path = {
- new RSTile(2944, 3370), new RSTile(2944, 3372),
- new RSTile(2945, 3374), new RSTile(2947, 3376),
- new RSTile(2949, 3377), new RSTile(2951, 3378),
- new RSTile(2953, 3379), new RSTile(2955, 3380),
- new RSTile(2955, 3377), new RSTile(2956, 3375),
- new RSTile(2955, 3372)
- };
- public final RSTile[] path1 = {
- new RSTile(2958, 3371), new RSTile(2956, 3374),
- new RSTile(2955, 3378), new RSTile(2954, 3380),
- new RSTile(2952, 3377), new RSTile(2950, 3376),
- new RSTile(2946, 3375), new RSTile(2944, 3373),
- new RSTile(2945, 3370), new RSTile(2945, 3368)
- };
- RSTilePath bankToBeer;
- RSTilePath beerToBank;*/
- RSTile beerPlace = new RSTile(2956, 3372);
- RSTile bankPlace = new RSTile(2945, 3368);
- public void Antiban() {
- int b = random(0, 10);
- switch (b) {
- case 1:
- if (random(0, 10) == 5) {
- mouse.moveSlightly();
- sleep(200, 300);
- mouse.moveRandomly(150, 350);
- }
- break;
- case 3:
- if (random(0, 24) == 6) {
- mouse.moveOffScreen();
- sleep(600, 700);
- }
- break;
- default:
- break;
- }
- }
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- numOfBeers = 0;
- //beerToBank = walking.newTilePath(path1);
- //bankToBeer = walking.newTilePath(path);
- log("Welcome to my Beer Buyer Bot! by beharon");
- return true;
- }
- public void onFinish() {
- log("Thank you for using my BeerBot by beharon");
- }
- public int loop() {
- if (random(1, 1000) < 100) {
- Antiban();
- }
- if (inventory.isFull()) {
- if (atBank.contains(getMyPlayer().getLocation())) {
- bank();
- } else {
- log("finished buying beers");
- walking.walkTileMM(bankPlace);
- sleep(4000, 5000);
- //beerToBank.randomize(2, 2);
- //beerToBank.traverse();
- }
- } else {
- if (atBeer.contains(getMyPlayer().getLocation())) {
- buyBeer();
- } else {
- walking.walkTileMM(beerPlace);
- sleep(4000, 5000);
- }
- }
- return random(500, 1000);
- }
- public void buyBeer() {
- RSNPC Emily = npcs.getNearest(736);
- if (Emily != null);
- {
- Emily.interact("Talk");
- sleep(750, 1250);
- interfaces.clickContinue();
- sleep(500, 1250);
- interfaces.clickContinue();
- sleep(500, 1250);
- ;
- interfaces.clickContinue();
- sleep(750, 1250);
- interfaces.getComponent(232, 3).doClick();
- sleep(1000, 1500);
- interfaces.clickContinue();
- sleep(500, 1250);
- interfaces.clickContinue();
- numOfBeers++;
- }
- }
- //banks all of your inventory except your gold
- private void bank() {
- if (bank.isOpen()) { //if banks open, banks inventory, and closes bank
- bank.depositAllExcept(995);
- sleep(1000, 2000);
- bank.close();
- } else { //if bank is closed, opens bank
- bank.open();
- sleep(1000, 1500);
- }
- }
- private final Color color1 = new Color(255, 255, 255);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 9);
- public void onRepaint(Graphics g1) {
- 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;
- Graphics2D g = (Graphics2D) g1;
- g.setColor(color1);
- g.fillRect(1, 477, 517, 25);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(1, 477, 517, 25);
- g.setFont(font1);
- g.drawString("Beers Bought: " + numOfBeers, 8, 494);
- g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 160, 495);
- g.drawString("Estimated Profit: " + numOfBeers * 100, 288, 495);
- ph = millis / (1000 * 60 * 60);
- g.drawString("P/h: " + (numOfBeers*100*3600*1000/millis), 405, 493);
- }
- }
Add Comment
Please, Sign In to add comment