Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 11th, 2012  |  syntax: None  |  size: 12.20 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4. import javax.swing.GroupLayout;
  5. import javax.swing.LayoutStyle;
  6.  
  7. import org.rsbot.event.listeners.PaintListener;
  8. import org.rsbot.script.Script;
  9. import org.rsbot.script.ScriptManifest;
  10. import org.rsbot.script.wrappers.RSObject;
  11. import org.rsbot.script.methods.Skills;
  12.  
  13. @ScriptManifest(authors = "<HTML><b><font color='red'>FootJam/Inevitable</font></HTML>", name = "iMinerPro", version = 2.1, description = "AIO Power Mines/Setting in Gui")
  14. public class iMinerPro extends Script implements PaintListener {
  15.  
  16.     String status = "Starting up";
  17.     int[] PickaxeID = {1265, 1267, 1269, 1273, 1271, 1275, 15259};
  18.     // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  19.     // Generated using JFormDesigner Evaluation license - collin dawg
  20.     private JLabel label1;
  21.     private JLabel label2;
  22.     private JLabel label3;
  23.     private JComboBox oresSelected;
  24.     private JButton button1;
  25.     // JFormDesigner - End of variables declaration  //GEN-END:variables
  26.     private final static int[] Coal_ID = {2096, 2097};
  27.     private final static int[] Iron_ID = {2093, 2092};
  28.     private final static int[] Copper_ID = {11937, 11938, 9710, 9708, 9709};
  29.     private final static int[] Tin_ID = {11933, 11934, 11935, 11957, 11958, 11959, 9714, 9716};
  30.     private final static int[] Silver_ID = {37306, 37304, 37305, 11950, 11949, 11948};
  31.     private final static int[] Gold_ID = {37312, 37310, 9720, 9722};
  32.     private final static int[] Mithral_ID = {5784, 5786, 5785};
  33.     private final static int[] Adamantite_ID = {32435, 32436, 32437};
  34.     private final static int[] Runite_ID = {33079, 33078};
  35.     private static final int Coal = 453;
  36.     private static final int Iron = 440;
  37.     private static final int Copper = 436;
  38.     private static final int Tin = 438;
  39.     private static final int Silver = 442;
  40.     private static final int Gold = 444;
  41.     private static final int Mithral = 447;
  42.     private static final int Adamantite = 449;
  43.     private static final int Runite = 451;
  44.     private int[] oresToMine;
  45.     private int oreID = 0;
  46.     private int startExp;
  47.     public int expGained = 0;
  48.     public int startLevel;
  49.     public int lvlGain;
  50.     long secondsTNL = 0;
  51.     long hoursTNL = 0;
  52.     long minutesTNL = 0;
  53.     public long startTime = 0;
  54.     public int currLevel;
  55.     public int expHour = 0;
  56.     private final Color color1 = new Color(0, 0, 0, 218);
  57.     private final Color color2 = new Color(0, 0, 0);
  58.     private final Color color3 = new Color(255, 255, 255);
  59.     private final BasicStroke stroke1 = new BasicStroke(1);
  60.     private final Font font1 = new Font("Arial", 1, 10);
  61.     private final Font font2 = new Font("Arial", 1, 20);
  62.  
  63.     public void onRepaint(Graphics g1) {
  64.         //Time TNL
  65.         long secondsTNL = (skills.getExpToNextLevel(skills.MINING));
  66.         long hoursTNL = secondsTNL / (60 * 60);
  67.         secondsTNL -= hoursTNL * (60 * 60);
  68.         long minutesTNL = secondsTNL / 60;
  69.         secondsTNL -= minutesTNL * 60;
  70.  
  71.         expGained = skills.getCurrentExp(skills.MINING) - startExp;
  72.         lvlGain = skills.getCurrentLevel(Skills.MINING) - startLevel;
  73.         int toNextLvl = skills.getExpToNextLevel(Skills.MINING);
  74.         currLevel = skills.getCurrentLevel(Skills.MINING);
  75.         long millis = System.currentTimeMillis() - startTime;
  76.  
  77.         Graphics2D g = (Graphics2D) g1;
  78.         g.setColor(color1);
  79.         g.fillRect(3, 3, 169, 186);
  80.         g.setColor(color2);
  81.         g.setStroke(stroke1);
  82.         g.drawRect(3, 3, 169, 186);
  83.         g.setFont(font1);
  84.         g.setColor(color3);
  85.         g.drawString("Run Time: " + org.rsbot.script.util.Timer.format(millis) + ".", 7, 66);
  86.         g.drawString("Time TNL: " + hoursTNL + ":" + minutesTNL + ":" + secondsTNL, 8, 90);
  87.         g.drawString("Exp Gained: " + expGained, 8, 110);
  88.         g.drawString("Exp TNL: " + skills.getExpToNextLevel(skills.MINING), 8, 133);
  89.         g.drawString("Level(s) Gained: " + currLevel + " (" + lvlGain + ")", 8, 154);
  90.         g.drawString("Status: " + status, 8, 173);
  91.         g.setFont(font2);
  92.         g.drawString("iMinerPro", 39, 29);
  93.         g.setFont(font1);
  94.         g.drawString("V: 2.1", 67, 42);
  95.         // Mouse
  96.         g.setColor(Color.green);
  97.         g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
  98.         g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
  99.         g.setColor(Color.green);
  100.         g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
  101.         g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
  102.     }
  103.  
  104.     // AntiBan
  105.     public void antiban() {
  106.  
  107.         int b = random(0, 10);
  108.         switch (b) {
  109.             case 1:
  110.                 if (random(0, 10) == 5) {
  111.                     log("[Antiban] move mouse");
  112.                     status = "Move mouse...";
  113.                     mouse.moveSlightly();
  114.                     sleep(200, 600);
  115.                     mouse.moveRandomly(150, 350);
  116.                 }
  117.                 break;
  118.             case 2:
  119.                 if (random(0, 13) == 2) {
  120.                     log("[Antiban] Turn screen");
  121.                     status = "Turn screen...";
  122.                     camera.setAngle(random(30, 70));
  123.                     sleep(400, 1200);
  124.                 }
  125.                 break;
  126.             case 3:
  127.                 if (random(0, 24) == 6) {
  128.                     log("[Antiban] mouse off screen");
  129.                     status = "Mouse off screen...";
  130.                     mouse.moveOffScreen();
  131.                     sleep(random(600, random(1200, 2000)));
  132.                 }
  133.                 break;
  134.             case 4:
  135.                 if (random(0, 18) == 3) {
  136.                     log("[Antiban] Checking Xp.");
  137.                     status = "Checking Xp...";
  138.                     game.openTab(1);
  139.                     skills.doHover(skills.INTERFACE_MINING);
  140.                     sleep(random(2100, 3400));
  141.                 }
  142.                 break;
  143.             default:
  144.                 break;
  145.         }
  146.     }
  147.     private boolean guiWait = true;
  148.     gui g = new gui();
  149.  
  150.     public boolean onStart() {
  151.         log("Welcome to iMinerPro.");
  152.         startExp = skills.getCurrentExp(Skills.MINING);
  153.         startLevel = skills.getCurrentLevel(Skills.MINING);
  154.         startTime = System.currentTimeMillis();
  155.         g.setVisible(true);
  156.         while (guiWait) {
  157.             sleep(500);
  158.         }
  159.  
  160.         return true;
  161.     }
  162.  
  163.     private void mineOre() {
  164.         RSObject Rock = objects.getNearest(oresToMine);
  165.         if (Rock != null) {
  166.             if (Rock.isOnScreen()) {
  167.                 if (getMyPlayer().getAnimation() < 0) {
  168.                     Rock.doAction("Mine");
  169.                 }
  170.                 sleep(250, 750);
  171.             }
  172.         }
  173.     }
  174.  
  175.     private void dropOre() {
  176.         inventory.dropAllExcept(PickaxeID);
  177.         mouse.setSpeed(random(3, 4));
  178.     }
  179.  
  180.     public void onFinish() {
  181.         log("Thank you for useing iMinerPro, Hope you liked it.");
  182.     }
  183.  
  184.     public int loop() {
  185.         if (inventory.isFull()) {
  186.             dropOre();
  187.             status = "Dropping Ore...";
  188.             antiban();
  189.         } else if (!inventory.isFull()) {
  190.             mineOre();
  191.             status = "Mining Ore...";
  192.             antiban();
  193.         }
  194.         return 1000;
  195.     }
  196.  
  197.     class gui extends JFrame {
  198.  
  199.         public gui() {
  200.             initComponents();
  201.         }
  202.  
  203.         private void button1ActionPerformed(ActionEvent e) {
  204.             String chosen = oresSelected.getSelectedItem().toString();
  205.             if (chosen.equals("Coal")) {
  206.                 oreID = Coal;
  207.                 oresToMine = Coal_ID;
  208.             } else if (chosen.equals("Iron")) {
  209.                 oreID = Iron;
  210.                 oresToMine = Iron_ID;
  211.             } else if (chosen.equals("Copper")) {
  212.                 oreID = Copper;
  213.                 oresToMine = Copper_ID;
  214.             } else if (chosen.equals("Tin")) {
  215.                 oreID = Tin;
  216.                 oresToMine = Tin_ID;
  217.             } else if (chosen.equals("Silver")) {
  218.                 oreID = Silver;
  219.                 oresToMine = Silver_ID;
  220.             } else if (chosen.equals("Gold")) {
  221.                 oreID = Gold;
  222.                 oresToMine = Gold_ID;
  223.             } else if (chosen.equals("Mithral")) {
  224.                 oreID = Mithral;
  225.                 oresToMine = Mithral_ID;
  226.             } else if (chosen.equals("Adamantite")) {
  227.                 oreID = Adamantite;
  228.                 oresToMine = Adamantite_ID;
  229.             } else if (chosen.equals("Runite")) {
  230.                 oreID = Runite;
  231.                 oresToMine = Runite_ID;
  232.  
  233.             }
  234.             guiWait = false;
  235.             dispose();
  236.         }
  237.  
  238.         private void initComponents() {
  239.             // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  240.             // Generated using JFormDesigner Evaluation license - collin dawg
  241.             label1 = new JLabel();
  242.             label2 = new JLabel();
  243.             label3 = new JLabel();
  244.             oresSelected = new JComboBox();
  245.             button1 = new JButton();
  246.  
  247.             //======== this ========
  248.             Container contentPane = getContentPane();
  249.  
  250.             //---- label1 ----
  251.             label1.setText("iMinerPro");
  252.             label1.setFont(new Font("Trebuchet MS", Font.BOLD, 25));
  253.  
  254.             //---- label2 ----
  255.             label2.setText("Ores to Mine:");
  256.             label2.setFont(new Font("Trebuchet MS", Font.BOLD, 14));
  257.  
  258.             //---- label3 ----
  259.             label3.setText("Credit to - Inevitable");
  260.             label3.setFont(new Font("Trebuchet MS", Font.PLAIN, 12));
  261.  
  262.             //---- oresSelected ----
  263.             oresSelected.setModel(new DefaultComboBoxModel(new String[]{
  264.                         "Copper",
  265.                         "Tin",
  266.                         "Iron",
  267.                         "Silver",
  268.                         "Coal",
  269.                         "Gold",
  270.                         "Mithral",
  271.                         "Adamantite",
  272.                         "Runite"}));
  273.  
  274.             //---- button1 ----
  275.             button1.setText("Start Script");
  276.             button1.addActionListener(new ActionListener() {
  277.  
  278.                 @Override
  279.                 public void actionPerformed(ActionEvent e) {
  280.                     button1ActionPerformed(e);
  281.                 }
  282.             });
  283.  
  284.             GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  285.             contentPane.setLayout(contentPaneLayout);
  286.             contentPaneLayout.setHorizontalGroup(
  287.                     contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup().addGap(10, 10, 10).addComponent(label2).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(oresSelected, 0, 74, Short.MAX_VALUE).addContainerGap(38, Short.MAX_VALUE)).addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addContainerGap(45, Short.MAX_VALUE).addComponent(button1, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE).addGap(43, 43, 43)).addGroup(contentPaneLayout.createSequentialGroup().addGap(51, 51, 51).addGroup(contentPaneLayout.createParallelGroup().addComponent(label3, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE).addComponent(label1)).addContainerGap(44, Short.MAX_VALUE)));
  288.             contentPaneLayout.setVerticalGroup(
  289.                     contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup().addContainerGap().addComponent(label1).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(label3).addGap(18, 18, 18).addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(label2).addComponent(oresSelected, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE).addComponent(button1)));
  290.             pack();
  291.             setLocationRelativeTo(getOwner());
  292.             // JFormDesigner - End of component initialization  //GEN-END:initComponents
  293.         }
  294.     }
  295. }