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 long startTime = 0;
- public long millis = 0;
- 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(2956, 3371), new RSTile(2956, 3374),
- new RSTile(2955, 3377), new RSTile(2955, 3380),
- new RSTile(2952, 3378), new RSTile(2950, 3376),
- new RSTile(2947, 3375), new RSTile(2944, 3374),
- new RSTile(2945, 3372), new RSTile(2944, 3370)
- };
- RSTilePath bankToBeer;
- 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 2:
- if (random(0, 13) == 2) {
- camera.setAngle(random(30, 70));
- sleep(400, 500);
- }
- break;
- case 3:
- if (random(0, 24) == 6) {
- mouse.moveOffScreen();
- sleep(600, 700);
- }
- break;
- case 5:
- if (random(0, 30) == 4) {
- camera.setPitch(random(10, 99));
- sleep(800, 900);
- }
- break;
- default:
- break;
- }
- }
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- log("Welcome");
- bankToBeer = walking.newTilePath(path);
- 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 {
- bankToBeer.traverse();
- }
- } else {
- if (atBeer.contains(getMyPlayer().getLocation())) {
- buyBeer();
- } else {
- bankToBeer.reverse();
- bankToBeer.traverse();
- bankToBeer.reverse();
- }
- }
- return random(500, 1000);
- }
- public boolean buyBeer() {
- RSNPC Emily = npcs.getNearest(736);
- if (Emily != null);
- {
- Emily.interact("Talk");
- sleep(1500, 2000);
- interfaces.clickContinue();
- sleep(1000, 1500);
- interfaces.clickContinue();
- sleep(1000, 1500);
- interfaces.clickContinue();
- sleep(500, 1000);
- interfaces.getComponent(232, 3).doClick();
- sleep(1000, 1500);
- interfaces.clickContinue();
- sleep(1000, 1500);
- interfaces.clickContinue();
- sleep(1000, 1500);
- return true;
- }
- }
- private void bank() {
- if (bank.isOpen()) {
- bank.depositAllExcept(995);
- sleep(1000, 2000);
- bank.close();
- } else {
- 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);
- private final Font font2 = new Font("Arial", 0, 20);
- 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(3, 339, 515, 138);
- g.setColor(color2);
- g.setStroke(stroke1);
- // g.drawRect(3, 339, 515, 138);
- g.setFont(font1);
- g.drawString("Time Running" + hours + ":" + minutes + ":" + seconds, 28, 368);
- g.setFont(font2);
- g.drawString("Beers Bought", 28, 399);
- }
- }
Add Comment
Please, Sign In to add comment