Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package seersbot;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.image.BufferedImage;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.text.DecimalFormat;
- import javax.imageio.ImageIO;
- import org.osbot.script.Script;
- import org.osbot.script.ScriptManifest;
- import org.osbot.script.rs2.model.Entity;
- import org.osbot.script.rs2.model.Player;
- import org.osbot.script.rs2.ui.Bank;
- import org.osbot.script.rs2.ui.Inventory;
- import org.osbot.script.rs2.utility.Area;
- @ScriptManifest(author = "xFADE48x", info = "Picks flax at seer's village and banks it (START AT SEER'S VILLAGE BANK)", name = "xFADE48x SeersBot", version = 1.7)
- public class SEERSBOT extends Script {
- private static long startTime = 0;
- static Timer runTime;
- final String FLAX_NAME = "Flax";
- final Area BANK_AREA = new Area(2721, 3490, 2726, 3493);
- final Area FLAX_AREA = new Area(2737, 3438, 2741, 3442);
- final Area MIDWAY_AREA = new Area(2718, 3463, 2730, 3476);
- final Area BANKOTHER_AREA = new Area(2727, 3490, 2730, 3493);
- final Area BANKOTHER2_AREA = new Area(2725, 3487, 2726, 3490);
- final Area FRONTBANK_AREA = new Area(2722, 3480, 2729, 3486);
- final Area FLAXFIELD_AREA = new Area(2719, 3441, 2736, 3459);
- final int BANK_BOOTH_ID = 25808;
- int flaxpicked = 0;
- BufferedImage img;
- // code used at start
- public void onStart() {
- try {
- img = ImageIO.read(new URL("http://i.imgur.com/3aUvHFl.png"));
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- runTime = new Timer(0);
- startTime = System.currentTimeMillis();
- }
- // code to be executed at the end
- public void onExit() {
- }
- // code in loop
- @Override
- public int onLoop() throws InterruptedException {
- if (client.getRunEnergy() > 50) {
- setRunning(true);
- }
- Inventory inven = client.getInventory();
- Player player = client.getMyPlayer();
- Bank bank = client.getBank();
- if (!inven.isFull()) {
- // pick
- if (FLAX_AREA.contains(player)) {
- Entity flax = closestObjectForName(FLAX_NAME);
- if (flax != null) {
- if (flax.isVisible()) {
- flax.interact("Pick");
- sleep(random(300, 400));
- }
- } else {
- client.moveCameraToEntity(flax);
- }
- } else {
- walk(FLAX_AREA);
- }
- } else {
- // bank
- if (FRONTBANK_AREA.contains(player)) {
- walk(BANK_AREA);
- }
- if (BANKOTHER_AREA.contains(player)) {
- walk(BANK_AREA);
- sleep(random(800, 1000));
- }
- if (BANKOTHER2_AREA.contains(player)) {
- walk(BANK_AREA);
- sleep(random(800, 1000));
- }
- if (MIDWAY_AREA.contains(player)) {
- walk(FRONTBANK_AREA);
- }
- if (FLAXFIELD_AREA.contains(player)) {
- walk(MIDWAY_AREA);
- }
- if (BANK_AREA.contains(player)) {
- Entity bankbooth = closestObject(BANK_BOOTH_ID);
- if (bank.isOpen()) {
- bank.depositAll();
- bank.close();
- } else {
- if (bankbooth != null) {
- if (bankbooth.isVisible()) {
- bankbooth.interact("Bank");
- sleep(random(1200, 1300));
- } else {
- client.moveCameraToEntity(bankbooth);
- }
- }
- }
- } else {
- if (FLAX_AREA.contains(player)) {
- walk(MIDWAY_AREA);
- sleep(random(800, 1000));
- }
- }
- }
- return 50;
- }
- public void onMessage(String message) {
- if (message.contains("You pick some flax.")) {
- flaxpicked++;
- }
- }
- // paint
- public void onPaint(Graphics g) {
- Graphics2D gr = (Graphics2D) g;
- g.drawImage(img, 0, 287, null);
- gr.setColor(Color.WHITE);
- gr.setFont(new Font("Arial", Font.PLAIN, 13));
- gr.drawString(": " + flaxpicked, 467, 300);
- gr.drawString(": " + getPerHour(flaxpicked), 330, 329);
- gr.drawString(": " + runTime(startTime), 295, 300);
- }
- 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);
- }
- public static int getPerHour(int value) {
- if (runTime != null && runTime.getElapsed() > 0) {
- return (int) (value * 3600000d / runTime.getElapsed());
- } else {
- return 0;
- }
- }
- public static long getPerHour(long value) {
- if (runTime != null && runTime.getElapsed() > 0) {
- return (long) (value * 3600000d / runTime.getElapsed());
- } else {
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment