Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.util.Timer;
- import com.rarebot.script.wrappers.RSNPC;
- import com.rarebot.script.wrappers.RSObject;
- import com.rarebot.script.methods.Magic;
- import com.rarebot.script.methods.Skills;
- import com.rarebot.event.listeners.PaintListener;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- @ScriptManifest(authors = "DBoWZ", version = 1.01, description = "Superheating all ores. Start at any bank.", name = "DBoWZ Super Heater")
- public class DBoWZSuperHeater extends Script implements PaintListener {
- GUI g = new GUI();
- private String[] BANKER_ID = { "Banker", "Counter" };
- private String SELECTED;
- private String status = "Unknown";
- private static final int NATURE_RUNE = 561;
- private static int COPPER_ORE = 436;
- private static int TIN_ORE = 438;
- private static int IRON_ORE = 440;
- private static int SILVER_ORE = 442;
- private static int GOLD_ORE = 444;
- private static int COAL_ORE = 453;
- private static int MITHRIL_ORE = 447;
- private static int ADAMANT_ORE = 449;
- private static int RUNE_ORE = 451;
- private static int ORE_ID;
- private static int ORE_2_ID;
- private static int BRONZE_BAR = 2349;
- private static int IRON_BAR = 2351;
- private static int STEEL_BAR = 2353;
- private static int SILVER_BAR = 2355;
- private static int GOLD_BAR = 2357;
- private static int MITHRIL_BAR = 2359;
- private static int ADAMANT_BAR = 2361;
- private static int RUNE_BAR = 2363;
- private static int BAR_ID;
- private boolean BRONZE, IRON, STEEL, SILVER, GOLD, MITHRIL, ADAMANT, RUNE,
- BANK_CHEST, SAFE_MODE = false, USE_2_ORES,
- GUI_WAIT = true;
- private int START_EXP_MAGE, START_EXP_SMITHING, EXP_GAINED_MAGE, EXP_GAINED_SMITHING, EXP_GAINED;
- Timer RUN_TIME;
- public long START_TIME = System.currentTimeMillis();
- private enum State {
- SUPERHEAT, BANK, ERROR
- }
- public boolean onStart() {
- g.setVisible(true);
- while(GUI_WAIT) sleep(500);
- RUN_TIME = new Timer(0);
- START_EXP_MAGE = skills.getCurrentExp(Skills.MAGIC);
- START_EXP_SMITHING = skills.getCurrentExp(Skills.SMITHING);
- log(Color.RED, "NOTE: The exp counter is for both magic and smithing!");
- if(chestCheck()) {
- BANK_CHEST = true;
- } else {
- BANK_CHEST = false;
- }
- return game.isLoggedIn();
- }
- public void onFinish() {
- log("Ran for " + RUN_TIME.toElapsedString() + " and gained " + EXP_GAINED + " exp!");
- }
- private boolean chestCheck() {
- RSObject chest = objects.getNearest("Chest");
- if(chest != null) {
- if(calc.distanceTo(chest) < 6) {
- return true;
- }
- }
- return false;
- }
- public State getState() {
- try {
- if(USE_2_ORES == true) {
- if(!inventory.contains(ORE_ID) || !inventory.contains(ORE_2_ID)) {
- return State.BANK;
- } else {
- return State.SUPERHEAT;
- }
- } else {
- if(!inventory.contains(ORE_ID)) {
- return State.BANK;
- } else {
- return State.SUPERHEAT;
- }
- }
- } catch(Exception e) {
- return State.ERROR;
- }
- }
- private void antiban() {
- switch(random(1,8)) {
- case 3:
- mouse.moveSlightly();
- break;
- case 6:
- mouse.moveOffScreen();
- break;
- }
- }
- public int loop() {
- if(random(1,1000) < 100) {
- antiban();
- }
- try {
- switch(getState()) {
- case SUPERHEAT:
- heat();
- break;
- case BANK:
- bank();
- break;
- case ERROR:
- log(Color.RED, "ERROR!");
- break;
- }
- } catch(Exception e) { }
- return 100;
- }
- private void bank() {
- if(bank.isOpen()) {
- if(inventory.contains(BAR_ID)) {
- status = "Depositing";
- bank.depositAllExcept(NATURE_RUNE);
- sleep(500);
- }
- if(USE_2_ORES == false) {
- if(!inventory.contains(ORE_ID)) {
- if(bank.getCount(ORE_ID) > 0) {
- status = "Withdrawing ores";
- bank.withdraw(ORE_ID, 27);
- sleep(600, 700);
- }
- }
- } else {
- if(!inventory.contains(ORE_ID)) {
- if(BRONZE == true) {
- status = "Withdrawing tin";
- bank.withdraw(ORE_ID, 13); //Tin
- sleep(600, 700);
- } else if(STEEL == true) {
- status = "Withdrawing iron";
- bank.withdraw(ORE_ID, 8); //Iron
- sleep(600, 700);
- } else if(MITHRIL == true) {
- status = "Withdrawing mithril";
- bank.withdraw(ORE_ID, 8); //Mithril
- sleep(600, 700);
- } else if(ADAMANT == true) {
- status = "Withdrawing adamant";
- bank.withdraw(ORE_ID, 4); //Adamant
- sleep(600, 700);
- } else if(RUNE == true) {
- status = "Withdrawing rune";
- bank.withdraw(ORE_ID, 3); //Rune
- sleep(600, 700);
- }
- }
- if(!inventory.contains(ORE_2_ID)) {
- if(BRONZE == true) {
- status = "Withdrawing copper";
- bank.withdraw(ORE_2_ID, 13); //Copper
- sleep(600, 700);
- } else if(STEEL == true) {
- status = "Withdrawing coal";
- bank.withdraw(ORE_2_ID, 18); //Coal
- sleep(600, 700);
- } else if(MITHRIL == true) {
- status = "Withdrawing coal";
- bank.withdraw(ORE_2_ID, 16); //Coal
- sleep(600, 700);
- } else if(ADAMANT == true) {
- status = "Withdrawing coal";
- bank.withdraw(ORE_2_ID, 23); //Coal
- sleep(600, 700);
- } else if(RUNE == true) {
- status = "Withdrawing coal";
- bank.withdraw(ORE_2_ID, 24); //Coal
- sleep(600, 700);
- }
- }
- }
- if(!inventory.contains(NATURE_RUNE)) {
- if(bank.getCount(NATURE_RUNE) > 0) {
- status = "Looking for nature runes";
- bank.searchItem("Nature rune");
- sleep(200, 500);
- bank.withdraw(NATURE_RUNE, 10000);
- sleep(1000, 2000);
- }
- }
- if(inventory.contains(ORE_ID)
- && inventory.contains(NATURE_RUNE)) {
- if(USE_2_ORES == true) {
- if(inventory.contains(ORE_2_ID)) {
- status = "Closing bank";
- bank.close();
- }
- } else {
- status = "Closing bank";
- bank.close();
- }
- }
- } else {
- if(BANK_CHEST == true) {
- RSObject chest = objects.getNearest("Chest");
- if(chest != null) {
- if(chest.isOnScreen()) {
- status = "Opening bank";
- chest.doClick(true);
- sleep(1500);
- } else {
- camera.turnTo(chest);
- }
- }
- } else {
- RSNPC banker = npcs.getNearest(BANKER_ID);
- if(banker != null) {
- if(banker.isOnScreen()) {
- status = "Opening bank";
- if(banker.interact("Bank bank")) {
- sleep(1000, 2000);
- }
- } else {
- camera.turnTo(banker);
- }
- }
- }
- }
- }
- private void heat() {
- if(!bank.isOpen()) {
- if(SAFE_MODE == false) {
- status = "Superheating";
- magic.castSpell(Magic.SPELL_SUPERHEAT_ITEM);
- while(inventory.contains(ORE_ID)) {
- magic.castSpell(Magic.SPELL_SUPERHEAT_ITEM);
- sleep(50, 150);
- if(inventory.contains(ORE_ID)) {
- if(magic.isSpellSelected()) {
- Point p = inventory.getItem(ORE_ID).getPoint();
- mouse.hop(p);
- mouse.click(true);
- }
- } else {
- break;
- }
- sleep(500);
- }
- } else {
- status = "Superheating";
- magic.castSpell(Magic.SPELL_SUPERHEAT_ITEM);
- while(inventory.contains(ORE_ID)) {
- magic.castSpell(Magic.SPELL_SUPERHEAT_ITEM);
- sleep(50, 150);
- if(inventory.contains(ORE_ID)) {
- if(magic.isSpellSelected()) {
- inventory.getItem(ORE_ID).doClick(true);
- }
- } else {
- break;
- }
- sleep(500);
- }
- }
- } else {
- status = "Closing bank";
- bank.close();
- }
- }
- private final Color color1 = new Color(0, 0, 0, 190);
- private final Color color2 = new Color(0, 255, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 1, 16);
- private final Font font2 = new Font("Arial", 0, 13);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- EXP_GAINED_MAGE = skills.getCurrentExp(Skills.MAGIC) - START_EXP_MAGE;
- EXP_GAINED_SMITHING = skills.getCurrentExp(Skills.SMITHING) - START_EXP_SMITHING;
- EXP_GAINED = EXP_GAINED_MAGE + EXP_GAINED_SMITHING;
- g.setColor(color1);
- g.fillRect(3, 3, 514, 59);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(3, 3, 514, 59);
- g.setFont(font1);
- g.drawString("DBoWZ Super Heater", 19, 37);
- g.setFont(font2);
- g.drawString("Timer: " + RUN_TIME.toElapsedString(), 175, 50);
- g.drawString("Magic Exp: " + EXP_GAINED_MAGE + " (" + getHourly(EXP_GAINED_MAGE) + "/hr)", 325, 25);
- g.drawString("Smithing Exp: " + EXP_GAINED_SMITHING + " (" + getHourly(EXP_GAINED_SMITHING) + "/hr)", 325, 50);
- g.drawString("Status: " + status, 175, 25);
- }
- private int getHourly(final int input) {
- double millis = System.currentTimeMillis() - START_TIME;
- return (int) ((input / millis) * 3600000);
- }
- public class GUI extends JFrame {
- public GUI() {
- initComponents();
- }
- private void btnQuitActionPerformed(ActionEvent e) {
- this.setVisible(false);
- stopScript(true);
- }
- private void btnStartActionPerformed(ActionEvent e) {
- SELECTED = cbType.getSelectedItem().toString();
- if(SELECTED.equals("Bronze")) {
- BAR_ID = BRONZE_BAR;
- USE_2_ORES = true;
- BRONZE = true;
- ORE_ID = TIN_ORE;
- ORE_2_ID = COPPER_ORE;
- } else if(SELECTED.equals("Iron")) {
- BAR_ID = IRON_BAR;
- ORE_ID = IRON_ORE;
- } else if(SELECTED.equals("Steel")) {
- BAR_ID = STEEL_BAR;
- USE_2_ORES = true;
- STEEL = true;
- ORE_ID = IRON_ORE;
- ORE_2_ID = COAL_ORE;
- } else if(SELECTED.equals("Silver")) {
- BAR_ID = SILVER_BAR;
- ORE_ID = SILVER_ORE;
- } else if(SELECTED.equals("Gold")) {
- BAR_ID = GOLD_BAR;
- ORE_ID = GOLD_ORE;
- } else if(SELECTED.equals("Mithril")) {
- BAR_ID = MITHRIL_BAR;
- USE_2_ORES = true;
- MITHRIL = true;
- ORE_ID = MITHRIL_ORE;
- ORE_2_ID = COAL_ORE;
- } else if(SELECTED.equals("Adamantite")) {
- BAR_ID = ADAMANT_BAR;
- USE_2_ORES = true;
- ADAMANT = true;
- ORE_ID = ADAMANT_ORE;
- ORE_2_ID = COAL_ORE;
- } else if(SELECTED.equals("Runite")) {
- BAR_ID = RUNE_BAR;
- USE_2_ORES = true;
- RUNE = true;
- ORE_ID = RUNE_ORE;
- ORE_2_ID = COAL_ORE;
- }
- if(cbMode.getSelectedItem().toString().equals("Normal")) {
- SAFE_MODE = true;
- } if(cbMode.getSelectedItem().toString().equals("Fast")) {
- SAFE_MODE = false;
- }
- GUI_WAIT = false;
- dispose();
- }
- private void initComponents() {
- panel1 = new JPanel();
- btnStart = new JButton();
- tabbedPane1 = new JTabbedPane();
- pMain = new JPanel();
- lBar = new JLabel();
- cbType = new JComboBox();
- lMode = new JLabel();
- cbMode = new JComboBox();
- pUpdates = new JPanel();
- lVersion = new JLabel();
- tfVersion = new JTextField();
- lUpdate = new JLabel();
- tfLastUpdate = new JTextField();
- btnQuit = new JButton();
- lTitle = new JLabel();
- //======== this ========
- setResizable(false);
- setAlwaysOnTop(true);
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- setTitle("made by DBoWZ");
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //======== panel1 ========
- {
- panel1.setLayout(null);
- //---- btnStart ----
- btnStart.setText("Start");
- btnStart.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- btnStartActionPerformed(e);
- }
- });
- panel1.add(btnStart);
- btnStart.setBounds(140, 135, 75, 33);
- //======== tabbedPane1 ========
- {
- //======== pMain ========
- {
- pMain.setLayout(null);
- //---- lBar ----
- lBar.setText("Select Bar:");
- lBar.setFont(lBar.getFont().deriveFont(lBar.getFont().getStyle() | Font.BOLD));
- pMain.add(lBar);
- lBar.setBounds(new Rectangle(new Point(10, 5), lBar.getPreferredSize()));
- //---- cbType ----
- cbType.setModel(new DefaultComboBoxModel(new String[] {
- "Bronze",
- "Iron",
- "Steel",
- "Silver",
- "Gold",
- "Mithril",
- "Adamantite",
- "Runite"
- }));
- pMain.add(cbType);
- cbType.setBounds(new Rectangle(new Point(10, 25), cbType.getPreferredSize()));
- //---- lMode ----
- lMode.setText("Select Mode:");
- lMode.setFont(lMode.getFont().deriveFont(lMode.getFont().getStyle() | Font.BOLD));
- pMain.add(lMode);
- lMode.setBounds(new Rectangle(new Point(105, 5), lMode.getPreferredSize()));
- //---- cbMode ----
- cbMode.setModel(new DefaultComboBoxModel(new String[] {
- "Fast",
- "Normal"
- }));
- pMain.add(cbMode);
- cbMode.setBounds(105, 25, 80, cbMode.getPreferredSize().height);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < pMain.getComponentCount(); i++) {
- Rectangle bounds = pMain.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = pMain.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- pMain.setMinimumSize(preferredSize);
- pMain.setPreferredSize(preferredSize);
- }
- }
- tabbedPane1.addTab("Main", pMain);
- //======== pUpdates ========
- {
- pUpdates.setLayout(null);
- //---- lVersion ----
- lVersion.setText("Version:");
- lVersion.setFont(lVersion.getFont().deriveFont(lVersion.getFont().getStyle() | Font.BOLD));
- pUpdates.add(lVersion);
- lVersion.setBounds(new Rectangle(new Point(10, 10), lVersion.getPreferredSize()));
- //---- tfVersion ----
- tfVersion.setEditable(false);
- tfVersion.setText("1.01");
- tfVersion.setToolTipText("Current script version");
- pUpdates.add(tfVersion);
- tfVersion.setBounds(90, 5, 100, tfVersion.getPreferredSize().height);
- //---- lUpdate ----
- lUpdate.setText("Last update:");
- lUpdate.setFont(lUpdate.getFont().deriveFont(lUpdate.getFont().getStyle() | Font.BOLD));
- pUpdates.add(lUpdate);
- lUpdate.setBounds(new Rectangle(new Point(10, 35), lUpdate.getPreferredSize()));
- //---- tfLastUpdate ----
- tfLastUpdate.setEditable(false);
- tfLastUpdate.setText("Added GUI and support for all ores & banks.");
- tfLastUpdate.setToolTipText("Latest update information");
- pUpdates.add(tfLastUpdate);
- tfLastUpdate.setBounds(90, 30, 100, 20);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < pUpdates.getComponentCount(); i++) {
- Rectangle bounds = pUpdates.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = pUpdates.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- pUpdates.setMinimumSize(preferredSize);
- pUpdates.setPreferredSize(preferredSize);
- }
- }
- tabbedPane1.addTab("Updates", pUpdates);
- }
- panel1.add(tabbedPane1);
- tabbedPane1.setBounds(10, 35, 205, 95);
- //---- btnQuit ----
- btnQuit.setText("Quit");
- btnQuit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- btnQuitActionPerformed(e);
- }
- });
- panel1.add(btnQuit);
- btnQuit.setBounds(10, 135, 75, 33);
- //---- lTitle ----
- lTitle.setText("DBoWZ Super Heater");
- lTitle.setFont(new Font("Vrinda", Font.BOLD, 24));
- panel1.add(lTitle);
- lTitle.setBounds(new Rectangle(new Point(15, 0), lTitle.getPreferredSize()));
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < panel1.getComponentCount(); i++) {
- Rectangle bounds = panel1.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = panel1.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panel1.setMinimumSize(preferredSize);
- panel1.setPreferredSize(preferredSize);
- }
- }
- contentPane.add(panel1);
- panel1.setBounds(0, 0, 225, 175);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < contentPane.getComponentCount(); i++) {
- Rectangle bounds = contentPane.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- pack();
- setLocationRelativeTo(getOwner());
- }
- private JPanel panel1;
- private JButton btnStart;
- private JTabbedPane tabbedPane1;
- private JPanel pMain;
- private JLabel lBar;
- private JComboBox cbType;
- private JLabel lMode;
- private JComboBox cbMode;
- private JPanel pUpdates;
- private JLabel lVersion;
- private JTextField tfVersion;
- private JLabel lUpdate;
- private JTextField tfLastUpdate;
- private JButton btnQuit;
- private JLabel lTitle;
- }
- }
Add Comment
Please, Sign In to add comment