Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.73 KB | None | 0 0
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6. import java.awt.event.MouseEvent;
  7. import java.awt.event.MouseListener;
  8. import java.util.Map;
  9.  
  10. import org.rsbot.event.events.MessageEvent;
  11. import org.rsbot.script.Script;
  12. import org.rsbot.script.ScriptManifest;
  13. import org.rsbot.script.wrappers.RSArea;
  14. import org.rsbot.script.wrappers.RSObject;
  15. import org.rsbot.script.wrappers.RSTile;
  16. import org.rsbot.script.*;
  17. import org.rsbot.event.listeners.PaintListener;
  18. import org.rsbot.event.listeners.MessageListener;
  19.  
  20. @ScriptManifest(name = "WonderIronPowerMine", authors = "ARandomEwokk", version = 1.0, description = "Meow")
  21. public class WonderIronPowerMine extends Script implements PaintListener, MessageListener {
  22.  
  23.     public long startTime1 = 0;
  24.     public long millis1 = 0;
  25.     public long hours1 = 0;
  26.     public long minutes1 = 0;
  27.     public long seconds1 = 0;
  28.      private int percentTNL;
  29.      public int currLevel;
  30.      private int expGained;
  31.      private int expHour;
  32.      private int startExp;
  33.      private int oresHour;
  34.      private int oresMined;
  35.      private int startLevel;
  36.      public int expForOre = 150;
  37.      public int oresTNL;
  38.      private int itemPrice;
  39.      private int profit;
  40.      
  41.       public void messageReceived1(MessageEvent e) {
  42.       String x = e.getMessage().toLowerCase();
  43.       if(x.contains("some ores")) {
  44.        oresMined ++;
  45.       }
  46.      }
  47.          public void onRepaint1(Graphics g1) {
  48.              Graphics2D g = (Graphics2D)g1; }
  49.              //START: Code generated using Enfilade's Easel
  50.              private final Color color1 = new Color(0, 0, 0);
  51.              private final Color color2 = new Color(255, 255, 0);
  52.              private final Color color3 = new Color(255, 0, 0);
  53.              private final Color color4 = new Color(0, 204, 204);
  54.              private final Color color5 = new Color(0, 255, 0);
  55.              private final Color color6 = new Color(102, 0, 102);
  56.              private final Color color7 = new Color(51, 255, 0);
  57.  
  58.              private final BasicStroke stroke1 = new BasicStroke(1);
  59.  
  60.              private final Font font1 = new Font("Arial", 1, 14);
  61.              private final Font font2 = new Font("Arial", 1, 9);
  62.              private final Font font3 = new Font("Arial", 0, 9);
  63.              private final Font font4 = new Font("Arial", 0, 14);
  64.              private final Font font5 = new Font("Arial", 0, 11);
  65.  
  66.              public void onRepaint(Graphics g1) {
  67.                  Graphics2D g = (Graphics2D)g1;
  68.                  g.setColor(color1);
  69.                  g.fillRoundRect(7, 7, 504, 18, 16, 16);
  70.                  g.setColor(color2);
  71.                  g.fillOval(556, 15, 140, 139);
  72.                  g.setColor(color1);
  73.                  g.fillRect(7, 346, 489, 111);
  74.                  g.fillOval(588, 51, 25, 26);
  75.                  g.fillOval(634, 53, 26, 27);
  76.                  g.fillOval(599, 105, 50, 23);
  77.                  g.setFont(font1);
  78.                  g.setColor(color3);
  79.                  g.drawString("ARandomEwokk's WonderCook", 142, 21);
  80.                  g.setColor(color4);
  81.                  g.drawString("Have Fun!", 689, 153);
  82.                  g.setFont(font2);
  83.                  g.setColor(color5);
  84.                  g.drawString("Contact me at ARandomEwokk on powerbot.org for proggies and critiscism! ", 61, 451);
  85.                  g.setFont(font3);
  86.                  g.setColor(color4);
  87.                  g.drawString("version 1.0", 456, 20);
  88.                  g.setFont(font4);
  89.                  g.setColor(color3);
  90.                  g.drawString("Info:", 11, 362);
  91.                  g.setFont(font5);
  92.                  g.drawString("Levelz:", 11, 375);
  93.                  g.drawString("Experiencez:", 147, 376);
  94.                  g.drawString("Status:", 301, 382);
  95.                  g.drawString("Runtimez:", 410, 383);
  96.                  g.setFont(font2);
  97.                  g.setColor(color6);
  98.                  g.drawString("Start LVL:", 11, 390);
  99.                  g.drawString("Current LVL:", 11, 405);
  100.                  g.drawString("Objects TNL:", 11, 420);
  101.                  g.drawString("% TNL:", 12, 435);
  102.                  g.drawString("Starting EXP:", 139, 391);
  103.                  g.drawString("EXP per Object:", 139, 405);
  104.                  g.drawString("EXP Gained:", 139, 420);
  105.                  g.drawString("EXP per Hour:", 139, 433);
  106.                  g.drawString("Objects Gotten:", 285, 394);
  107.                  g.drawString("Object per Hour:", 285, 409);
  108.                  g.drawString("Time ran:", 410, 396);
  109.                  g.setColor(color3);
  110.                  g.fillRoundRect(65, 349, 427, 15, 16, 16);
  111.                  g.setColor(color1);
  112.                  g.setStroke(stroke1);
  113.                  g.drawRoundRect(65, 349, 427, 15, 16, 16);
  114.                  g.setColor(color7);
  115.                  g.fillRoundRect(65, 349, 157, 14, 16, 16);
  116.                  g.setColor(color1);
  117.                  g.drawRoundRect(65, 349, 157, 14, 16, 16);
  118.                  g.setColor(color6);
  119.                  g.drawString("Profit:", 286, 422);
  120.              profit = itemPrice * oresMined;
  121.              {
  122.      
  123.           millis = System.currentTimeMillis() - startTime;
  124.           hours = millis / (1000 * 60 * 60);
  125.           millis -= hours * (1000 * 60 * 60);
  126.           minutes = millis / (1000 * 60);
  127.           millis -= minutes * (1000 * 60);
  128.           seconds = millis / 1000;
  129.       long secondsTNL = (skills.getExpToNextLevel(skills.MINING)) / (expHour / 3600);
  130.       long hoursTNL = secondsTNL / (60 * 60);
  131.       secondsTNL -= hoursTNL * (60 * 60);
  132.       long minutesTNL = secondsTNL / 60;
  133.       secondsTNL -= minutesTNL * 60;
  134.       final int percentBar = (int) (skills.getPercentToNextLevel(skills.MINING)*4.2);
  135.       expGained = skills.getCurrentExp(skills.MINING) - startExp;
  136.       oresHour = (int) ((oresMined) * 3600000D / (System.currentTimeMillis() - startTime));
  137.       expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
  138.       oresTNL = expToGetNextLevel(skills.MINING)/expForOre;
  139.       currLevel = skills.getCurrentLevel(skills.MINING);
  140.       int lvlsGained = currLevel - startLevel;
  141.       percentTNL = skills.getPercentToNextLevel(skills.MINING);
  142.     ///////////////////////////////////////////////////////////////////////////////////////////////////////
  143.     ///////////////////////////////// PAINT ///////////////////////////////////////////////////////////////
  144.     ///////////////////////////////////////////////////////////////////////////////////////////////////////
  145.      }
  146.     }
  147.    
  148.     private int expToGetNextLevel(int mining) {
  149.                 // TODO Auto-generated method stub
  150.                 return 0;
  151.             }
  152.     int[] ironRockID = {9717, 9718};
  153.     int[] pickID = {1265, 1267, 1269, 1271, 1273,
  154.             1275};
  155.     int bankBoothID = 11758;
  156.     int ironOreID = 440;
  157.    
  158. RSTile[] rimmingtonMineToBank = { new RSTile(2981, 3234), new RSTile(2983, 3242),
  159.             new RSTile(2980, 3254), new RSTile(2986, 3265),
  160.             new RSTile(2997, 3275), new RSTile(3002, 3289),
  161.             new RSTile(3001, 3301), new RSTile(3005, 3312),
  162.             new RSTile(3006, 3322), new RSTile(3007, 3336),
  163.             new RSTile(3006, 3352), new RSTile(3012, 3355) };
  164.    
  165.     @SuppressWarnings({ "deprecation", "static-access" })
  166.     public boolean onStart(){
  167.            log("Hello");
  168.            startLevel = skills.getCurrentLevel(skills.MINING);
  169.           startExp = skills.getCurrentExp(skills.MINING);
  170.           startTime1 = System.currentTimeMillis();
  171.          itemPrice = grandExchange.loadItemInfo(654).getMarketPrice();
  172.          return true;
  173.     }
  174.    
  175.     public long startTime = 0;
  176.     public long millis = 0;
  177.     public long hours = 0;
  178.     public long minutes = 0;
  179.     public long seconds = 0;
  180.     public long last = 0;
  181.  
  182.     private void mine(){
  183.            RSObject iron = objects.getNearest(ironRockID);
  184.            if (iron != null && (getMyPlayer().getAnimation() == -1))
  185.            iron.doAction("Mine"); }
  186.    
  187.  
  188.     //private void dropOre(){
  189.            //inventory.dropAllExcept(pickID);
  190.     //}
  191.            
  192.     @SuppressWarnings("deprecation")
  193.     private boolean walkToBankFromRimmington() {
  194.            @SuppressWarnings("deprecation")
  195.         RSTile[] randomizedPath = walking.randomizePath(rimmingtonMineToBank, 2, 2);
  196.            return walking.walkPathMM(randomizedPath, 15);
  197.            }
  198.  
  199.     private boolean atMine(){
  200.         RSArea area = new RSArea(new RSTile(2979, 3232), new RSTile(2984, 3235));
  201.         return (area.contains(getMyPlayer().getLocation()));
  202.     }
  203.    
  204.     private boolean atBank(){
  205.         RSArea area = new RSArea(new RSTile(3009, 3355), new RSTile(3016, 3358));
  206.         return area.contains(getMyPlayer().getLocation());
  207.     }
  208.    
  209.     @SuppressWarnings("deprecation")
  210.     private boolean walkToRimmingtonFromBank() {
  211.         @SuppressWarnings("deprecation")
  212.         RSTile[] reversedPath = walking.reversePath(rimmingtonMineToBank);
  213.         @SuppressWarnings("deprecation")
  214.         RSTile[] randomizedPath = walking.randomizePath(reversedPath,
  215.         2, 2);
  216.         return walking.walkPathMM(randomizedPath);
  217.     }
  218.    
  219.     private void openBank() {
  220.         RSObject bankBooth = objects.getNearest(bankBoothID);
  221.         if (bankBooth != null && !bank.isOpen()) {
  222.         bankBooth.doAction("uickly"); }
  223.     }
  224.  
  225.     private void depositIron() {
  226.         if(bank.isOpen()){
  227.         bank.deposit(ironOreID, 0);
  228.         sleep(200, 500);
  229.         mouse.click(true); }
  230.     }
  231.  
  232.     private void closeBank() {
  233.         if(bank.isOpen()){
  234.         mouse.move(490, 36, 3, 3);
  235.         mouse.click(true);  }
  236.     }
  237.  
  238.     private void bank() {
  239.         openBank();
  240.         depositIron();
  241.         closeBank();
  242.     }
  243.    
  244.     public void onFinish(){
  245.            log("Cyaz");
  246.     }
  247.  
  248.     @Override
  249.     public int loop() {
  250.         if (atMine() && inventory.isFull()) {
  251.             walkToBankFromRimmington();
  252.         } else if (atBank() && inventory.isFull()) {
  253.             bank();
  254.                 } else if(atBank() && !inventory.isFull()) {
  255.                          walkToRimmingtonFromBank();
  256.         } else if (atMine() && !inventory.isFull()) {
  257.             mineOre();
  258.         }
  259.         return (random(650, 950));
  260.  
  261.     }
  262.     private void mineOre() {
  263.         // TODO Auto-generated method stub
  264.        
  265.     }
  266.     @Override
  267.     public void messageReceived(MessageEvent arg0) {
  268.         // TODO Auto-generated method stub
  269.        
  270.     }
  271. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement