Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.teaGrabber;
- import javax.imageio.ImageIO;
- import org.tribot.api.General;
- import java.awt.*;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import java.text.DecimalFormat;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.GroundItems;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.PathFinding;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.types.RSGroundItem;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Painting;
- @ScriptManifest(authors = { "Floplie" }, category = "Thieving", name = "teaGrabber", description = "Thank you for using my teaGrabber script, love from Floplie.")
- public class TeaGrabber extends Script implements Painting {
- private final int[] cupoftea = {1978};
- private final RSTile bank = new RSTile(3254, 3420), stall = new RSTile(3268, 3410);
- private final int[] cupofteas = {635};
- private boolean counted = false;
- private int count = 0;
- private long startTime = System.currentTimeMillis();
- private final Color color1 = new Color(255, 255, 255);
- private int startxp = Skills.getXP(SKILLS.THIEVING);
- private final Font font1 = new Font("Arial", 0, 24);
- private final Image img1 = getImage("http://i.imgur.com/KMjSNXy.png");
- public void clickStall() {
- RSObject[] stall = Objects.findNearest(20, 635);
- if (stall.length > 0) {
- if (!Player.getPosition().equals(this.stall)) {
- Walking.walkTo(this.stall);
- sleep(400, 600);
- while (Player.isMoving()) {
- sleep(100, 200);
- }
- }
- if (!stall[0].isOnScreen()) {
- Camera.turnToTile(stall[0].getPosition());
- } else {
- stall[0].click("Steal-from");
- sleep(500, 800);
- }
- while (Player.isMoving()) {
- sleep(100, 200);
- }
- }
- }
- public void banking() {
- if (counted == false) {
- count = count + Inventory.getCount(cupoftea);
- counted = true;
- }
- if (Player.getPosition().distanceTo(bank) > 10) {
- Mouse.setSpeed(100);
- Walking.blindWalkTo(bank);
- Mouse.setSpeed(300);
- } else {
- if (!Banking.isBankScreenOpen()) {
- Banking.openBankBooth();
- } else {
- Banking.depositAll();
- }
- }
- }
- public void walkback() {
- if (Player.getPosition().distanceTo(stall) > 10) {
- Mouse.setSpeed(100);
- Walking.blindWalkTo(stall);
- Mouse.setSpeed(300);
- }
- }
- @Override
- public void onPaint(Graphics g) {
- int currentxp = Skills.getXP(SKILLS.THIEVING);
- g.drawImage(img1, 3, 340, null);
- g.setFont(font1);
- g.setColor(color1);
- g.drawString(" " + runTime(startTime), 329, 419);
- g.drawString(" " + (currentxp - startxp), 368, 462);
- }
- public String runTime(long i) {
- DecimalFormat nf = new DecimalFormat("00");
- long millis = System.currentTimeMillis() - i;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- return nf.format(hours) + ":" + nf.format(minutes) + ":"
- + nf.format(seconds);
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch (IOException e) {
- return null;
- }
- }
- @Override
- public void run() {
- Mouse.setSpeed(300);
- while (true) {
- if (Player.getPosition().getPlane() == 0
- && Player.getPosition().distanceTo(stall) < 10) {
- if (Inventory.isFull()) {
- banking();
- } else {
- clickStall();
- }
- } else {
- if (Inventory.isFull()) {
- banking();
- } else {
- walkback();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement