Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package xfade_firemaker;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.MouseEvent;
- 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.skill.Skill;
- import org.osbot.script.rs2.ui.Bank;
- import org.osbot.script.rs2.ui.Inventory;
- import org.osbot.script.rs2.ui.Spell;
- import org.osbot.script.rs2.ui.Tab;
- import org.osbot.script.rs2.utility.Area;
- import xfade_firemaker.Timer;
- @ScriptManifest(author = "xFADE48x", info = "(BETA 1.1) Please read the FAQ for this script to know how to run this script.", name = "xFADE48x FireMaker", version = 1.1)
- public class XFADE_FIREMAKER extends Script {
- private static long startTime = 0;
- static Timer runTime;
- final String BANK_NAME = "Bank booth";
- final String FIRE_NAME = "Fire";
- boolean hide = false;
- Point p;
- Rectangle close = new Rectangle(2, 323, 17, 338);
- Rectangle open = new Rectangle(2, 318, 52, 338);
- public final Area BANK_AREA = (new Area(3180, 3434, 3185, 3439));
- public final Area SQ_AREA = (new Area(3205, 3428, 3209, 3430));
- public final Area FIREMAKE_AREA = (new Area(3173, 3428, 3209, 3430));
- public final Area TELEPORT_AREA = (new Area(3206, 3420, 3219, 3427));
- public final Area SQ_ERROR_AREA = (new Area(3205, 3431, 3222, 3437));
- public final Area LEFT_AREA = (new Area(3204, 3430, 3207, 3430));
- public final Area MIDDLE_AREA = (new Area(3204, 3429, 3207, 3429));
- public final Area RIGHT_AREA = (new Area(3204, 3428, 3207, 3428));
- final int TINDER_BOX_ID = 590;
- final int MAGIC_RUNE_ID = 563;
- final int FIRE_RUNE_ID = 554;
- final int AIR_RUNE_ID = 556;
- int LOGS_ID;
- int startExp;
- int startLvl;
- int flaxpicked = 0;
- BufferedImage img;
- BufferedImage img2;
- BufferedImage img3;
- public void onStart() {
- try {
- // hide
- img2 = ImageIO.read(new URL("http://i.imgur.com/CoVqqsG.png"));
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- // show
- img3 = ImageIO.read(new URL("http://i.imgur.com/IROKQtJ.png"));
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- // paint
- img = ImageIO.read(new URL("http://i.imgur.com/JiifTdH.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);
- startExp = client.getSkills().getExperience(Skill.FIREMAKING);
- startLvl = client.getSkills().getLevel(Skill.FIREMAKING);
- startTime = System.currentTimeMillis();
- if (client.getInventory().contains(1511)) {
- log("Normal logs has been selected");
- LOGS_ID = 1511;
- } else if (client.getInventory().contains(1521)) {
- log("Oak logs has been selected");
- LOGS_ID = 1521;
- } else if (client.getInventory().contains(1519)) {
- log("Willow logs has been selected");
- LOGS_ID = 1519;
- } else if (client.getInventory().contains(6333)) {
- log("Teak logs has been selected");
- LOGS_ID = 6333;
- } else if (client.getInventory().contains(1517)) {
- log("Maple logs has been selected");
- LOGS_ID = 1517;
- } else if (client.getInventory().contains(1515)) {
- log("Yew logs has been selected");
- LOGS_ID = 1515;
- } else if (client.getInventory().contains(1513)) {
- log("Magic logs has been selected");
- LOGS_ID = 1513;
- } else {
- log("No logs found!");
- }
- }
- public void onExit() {
- log("Thanks for using xFADE48x FireMaker!");
- log("Ran for: " + runTime(startTime));
- log("Fires made: " + flaxpicked);
- log("Fires made P/H: " + getPerHour(flaxpicked));
- log("If any errors occured when you ran this script, please contact me on skype or on the osbot fourms");
- }
- public void AntiBan() throws InterruptedException {
- switch (random(1, 100)) {
- case 14:
- this.client.rotateCameraPitch(50);
- case 6:
- this.client.rotateCameraToAngle(350);
- case 3:
- this.client.rotateCameraPitch(50);
- }
- random(100, 500);
- }
- public void walkToSq() throws InterruptedException {
- switch (random(1, 3)) {
- case 1:
- walkExact(LEFT_AREA);
- case 2:
- walkExact(MIDDLE_AREA);
- case 3:
- walkExact(RIGHT_AREA);
- }
- sleep(random(100, 200));
- }
- @Override
- public int onLoop() throws InterruptedException {
- Inventory inven = client.getInventory();
- Player player = client.getMyPlayer();
- Bank bank = client.getBank();
- if(!Tab.INVENTORY.isOpen(null)) {
- openTab(Tab.INVENTORY);
- }
- if (client.getRunEnergy() > 50) {
- setRunning(true);
- }
- if (inven.contains(LOGS_ID)) {
- // firelight
- if (SQ_ERROR_AREA.contains(player)) {
- if (!player.isMoving()) {
- walkToSq();
- sleep(random(700, 800));
- }
- }
- if (TELEPORT_AREA.contains(player)) {
- if (!player.isMoving()) {
- walkToSq();
- sleep(random(700, 800));
- }
- }
- if (FIREMAKE_AREA.contains(player)) {
- if (!player.isAnimating() && !player.isMoving()) {
- inven.interactWithId(LOGS_ID, "Use", true);
- sleep(random(100));
- inven.interactWithId(TINDER_BOX_ID, "Use", true);
- sleep(random(100));
- inven.interactWithId(TINDER_BOX_ID, "Use", true);
- sleep(random(1000, 1100));
- }
- }
- if (BANK_AREA.contains(player)) {
- if (inven.getAmount(AIR_RUNE_ID) < 3) {
- if (!player.isMoving()) {
- walkToSq();
- }
- }
- if (inven.contains(MAGIC_RUNE_ID)
- && (inven.contains(FIRE_RUNE_ID))
- && (inven.getAmount(AIR_RUNE_ID) > 3)) {
- magicTab.open();
- magicTab.castSpell(Spell.VARROCK_TELEPORT);
- sleep(random(500, 600));
- openTab(Tab.INVENTORY);
- sleep(random(2200, 2200));
- }
- }
- if (!inven.contains(MAGIC_RUNE_ID)
- && (!inven.contains(FIRE_RUNE_ID))) {
- if (FIREMAKE_AREA.contains(player)) {
- if (!player.isAnimating() && !player.isMoving()) {
- inven.interactWithId(LOGS_ID, "Use", true);
- sleep(random(100));
- inven.interactWithId(TINDER_BOX_ID, "Use", true);
- sleep(random(100));
- inven.interactWithId(TINDER_BOX_ID, "Use", true);
- sleep(random(1000, 1100));
- }
- } else {
- if (!player.isMoving()) {
- walkToSq();
- sleep(random(700, 800));
- }
- }
- }
- } else {
- // bank
- Entity bankbooth = closestObjectForName(BANK_NAME);
- if (BANK_AREA.contains(player)) {
- if (bank.isOpen()) {
- if (!bank.contains(LOGS_ID)) {
- log("Ran out of logs!");
- log("Logging out...");
- bank.close();
- bank.close();
- bank.close();
- stop();
- }
- bank.depositAllExcept(TINDER_BOX_ID, MAGIC_RUNE_ID,
- FIRE_RUNE_ID, AIR_RUNE_ID);
- sleep(random(300, 400));
- bank.withdrawAll(LOGS_ID);
- sleep(random(300, 400));
- bank.close();
- sleep(random(300, 400));
- bank.close();
- sleep(random(300, 400));
- bank.close();
- sleep(random(300, 400));
- } else {
- if (bankbooth != null) {
- if (bankbooth.isVisible()) {
- bankbooth.interact("Bank");
- sleep(random(1200, 1300));
- } else {
- client.moveCameraToEntity(bankbooth);
- }
- }
- }
- } else {
- if (!player.isMoving()) {
- walk(BANK_AREA);
- sleep(random(700, 800));
- }
- }
- }
- AntiBan();
- return 50;
- }
- public void onMessage(String message) throws InterruptedException {
- Player player = client.getMyPlayer();
- Inventory inven = client.getInventory();
- if (message.contains("The fire catches and the logs begin to burn.")) {
- flaxpicked++;
- }
- if (message.contains("You can't light a fire here.")) {
- if (!player.isMoving()) {
- walk(SQ_AREA);
- sleep(random(100, 200));
- if (SQ_AREA.contains(player)) {
- if (FIREMAKE_AREA.contains(player)) {
- if (!player.isAnimating() && !player.isMoving()) {
- inven.interactWithId(LOGS_ID, "Use", true);
- sleep(random(100));
- inven.interactWithId(TINDER_BOX_ID, "Use", true);
- sleep(random(100));
- inven.interactWithId(TINDER_BOX_ID, "Use", true);
- sleep(random(1000, 1100));
- }
- }
- }
- }
- }
- }
- // paint
- public void onPaint(Graphics g) {
- Graphics2D gr = (Graphics2D) g;
- if (!hide) {
- // Paint
- g.drawImage(img, 2, 338, null);
- g.drawImage(img2, 2, 323, null);
- gr.setColor(Color.BLACK);
- gr.setFont(new Font("Arial", Font.PLAIN, 12));
- // fires made
- gr.drawString("" + flaxpicked, 320, 357);
- // fires per hour
- gr.drawString("" + getPerHour(flaxpicked), 338, 376);
- // runtime
- gr.drawString("" + runTime(startTime), 306, 395);
- // xp gained
- gr.drawString(
- ""
- + (client.getSkills().getExperience(
- Skill.FIREMAKING) - startExp), 321, 434);
- // xp per hour
- gr.drawString(
- ""
- + getPerHour(client.getSkills().getExperience(
- Skill.FIREMAKING)
- - startExp), 367, 453);
- // firemaking lvl
- gr.drawString(
- ""
- + (client.getSkills().getLevel(Skill.FIREMAKING)
- + " + ("
- + (client.getSkills().getLevel(
- Skill.FIREMAKING) - startLvl) + ")"),
- 347, 415);
- } else {
- // Show button
- g.drawImage(img3, 2, 318, null);
- }
- gr.setColor(Color.RED);
- gr.setFont(new Font("Arial", Font.BOLD, 13));
- gr.drawString("BETA 1.1", 455, 335);
- }
- 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;
- }
- }
- @Override
- public void mouseClicked(MouseEvent e) {
- p = e.getPoint();
- if (close.contains(p) && !hide) {
- hide = true;
- } else if (open.contains(p) && hide) {
- hide = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment