Share Pastebin
Guest
Public paste!

PoodPowerMiner

By: a guest | Mar 20th, 2010 | Syntax: Java | Size: 5.64 KB | Hits: 38 | Expires: Never
Copy text to clipboard
  1. //created my p00d
  2. //use at own risk
  3. //there are still a few bugs to be solved.
  4.  
  5. import java.awt.Color;
  6. import java.awt.Font;
  7. import java.awt.Graphics;
  8. import java.util.Map;
  9.  
  10. import org.rsbot.event.listeners.PaintListener;
  11. import org.rsbot.script.Constants;
  12. import org.rsbot.script.Script;
  13. import org.rsbot.script.ScriptManifest;
  14. import org.rsbot.script.wrappers.RSObject; //imports
  15. import org.rsbot.script.wrappers.RSTile;
  16. import org.rsbot.script.Constants;
  17.  
  18.  
  19.  
  20. @ScriptManifest(authors = { "p00d" }, category = "Mining", name = "p00d's power miner", version = 1.0, description =
  21.         "<html>Start in rimmington at iron ores, this is my first script<head>" +
  22.         "</head><br>    Bot at your own risk </br> <br>Script Made by p00d</br><body>" +
  23.         "</head></body>")
  24.  
  25. public class PoodPowerMiner extends Script implements PaintListener{
  26.  
  27.         //**Variables**//
  28.  
  29. public int pickaxes[] = { 1275, 1265, 1273, 1267, 1271 };  
  30. public int iron[] = { 9718, 9717};        
  31. public int gold[] = { 9720, 9722};
  32. public int miningAnimation = 624;      
  33.  
  34.        
  35.         //Paint Variables//
  36. private String status = "Online";
  37. public int startexp;
  38. public int exp;
  39. public int expGained;
  40. public float expsec;
  41. public float expmin;
  42. public float exphour;
  43. public long timeRunning = 0, secounds = 0 ,minutes = 0, hours = 0;
  44. public long startTime = System.currentTimeMillis();
  45.  
  46.  
  47.        
  48.        
  49.  
  50.         final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class); //stupid st00f
  51.  
  52.         //startup
  53.        
  54.         public boolean onStart( Map<String,String> args ) {
  55.         startTime = System.currentTimeMillis();
  56.                 return true;
  57.         }
  58.        
  59.  
  60.  
  61.  
  62.        
  63.         //antiban working on adding things such as random emotes
  64.         public void antiBan(){
  65.                 if (random(1, 12) == 1) {
  66.                         status = "Moving Screen";
  67.                         setCameraRotation(random(1,360));
  68.                 }
  69.                
  70.                 if (random(1, 11) == 1) {
  71.                         status = "Moving Mouse";
  72.                         int x = (int) getMouseLocation().getX();
  73.                         int y = (int) getMouseLocation().getY();
  74.                         moveMouse(x + random(-125, 125), y + random(-80, 80));
  75.                 }
  76.                
  77.                 if(random(1, 60) == 1) {
  78.                         status = "Checking Exp";
  79.                         openTab(TAB_STATS);
  80.                         moveMouse(random(661, 712), random(230, 261));
  81.                         wait(random(2000, 3000));
  82.                         openTab(TAB_INVENTORY);
  83.                 }
  84.         }
  85.        
  86.        
  87.         //loop
  88.  
  89.         public int loop() {
  90.                 antiBan();
  91.                
  92.         if(getMyPlayer().getAnimation() != -1) {
  93.                 status = "Mining";
  94.                                 return random(1000, 1250);
  95.         }
  96.        
  97.         if(getMyPlayer().isMoving()){
  98.                 return random(1000, 1250);
  99.         }
  100.         if(isInventoryFull()){
  101.                 status = "Dropping Ores";
  102.                 dropAllExcept(pickaxes);
  103.         }
  104.        
  105.         RSObject rock = findObject(iron);
  106.         status = "Searching For Rocks";
  107.         if(rock == null)
  108.                 return random(200, 500);
  109.        
  110.         atObject(rock, "Mine");
  111.        
  112.         return random(1000, 1500);
  113.                
  114.         }
  115.  
  116.         //paint start
  117.     public void onRepaint(Graphics g) {
  118.        
  119.         if (isLoggedIn()) {
  120.                
  121.                 if ( startexp == 0) {
  122.                      startexp = skills.getCurrentSkillExp(Constants.STAT_MINING);
  123.                 }
  124.                      
  125.                 expGained = skills.getCurrentSkillExp(Constants.STAT_MINING) - startexp;
  126.                
  127.                 timeRunning = System.currentTimeMillis() - startTime;
  128.             secounds = timeRunning / 1000;
  129.            
  130.                 if (secounds >= 60) {
  131.                 minutes = secounds / 60;
  132.                 secounds -= minutes * 60;
  133.             }
  134.             if (minutes >= 60) {
  135.                 hours = minutes / 60;
  136.                 minutes -= hours * 60;
  137.             }
  138.            
  139.             if ((minutes > 0 || hours > 0 || secounds > 0) && expGained > 0) {
  140.             expsec = ((float) expGained)/(float)(secounds + (minutes*60) + (hours*60*60));
  141.             }
  142.             exphour = expmin * 60;
  143.                         expmin = expsec * 60;
  144.            
  145.                 }
  146.                
  147.        //paint, font
  148.                 g.setColor(Color.red);
  149.            
  150.             g.setFont(new Font("Times", Font.PLAIN, 12));
  151.             g.drawString("Time Running: " + hours + ":" + minutes + ":" + secounds, 9, 285);
  152.             g.drawString("XP Gained: " + expGained, 9, 300);
  153.                         g.drawString("XP Per hour: " + (int)exphour, 9, 315);
  154.             g.drawString("Status: " + status , 9, 330);
  155.                        
  156.                        
  157.                         g.setColor(Color.green);
  158.                        
  159.                         g.setFont(new Font("Times", Font.PLAIN, 12));
  160.             g.drawString("Time Running: " + hours + ":" + minutes + ":" + secounds, 9 - 1, 285 - 1);
  161.             g.drawString("XP Gained: " + expGained, 9 - 1, 300 - 1);
  162.                         g.drawString("XP Per hour: " + (int)exphour, 9 - 1, 315 - 1);
  163.             g.drawString("Status: " + status , 9 - 1, 330 - 1);
  164.            
  165.             final int percent = skills.getPercentToNextLevel(Constants.STAT_MINING);
  166.             g.drawString("Percent till next level: ", 270, 355 + 5);
  167.             g.setColor(Color.red);
  168.             g.fillRoundRect(386, 350, 100, 10, 15, 15); //these must be on same cordinates
  169.             g.setColor(Color.green);
  170.             g.fillRoundRect(386, 350, percent, 10, 15, 15); //these must be on same cordinates
  171.             g.setColor(Color.black);
  172.             g.drawString("" + percent, 428, 360); //this must be in the center of the bar
  173.             g.drawRoundRect(386, 350, 100, 10, 15, 15); //these must be on same cordinates
  174.  
  175.                
  176.                        
  177.          
  178.         if (isLoggedIn()) {
  179.             long millis = System.currentTimeMillis() - startTime;
  180.             long hours = millis / (1000 * 60 * 60);
  181.             millis -= hours * (1000 * 60 * 60);
  182.             long minutes = millis / (1000 * 60);
  183.             millis -= minutes * (1000 * 60);
  184.             long seconds = millis / 1000;
  185.             long minutes2 = minutes + (hours * 60);
  186.             g.setColor(Color.green);
  187.             g.drawString("P00d's Power Miner" , 400, 330);
  188.            
  189.         }
  190.     }
  191.    
  192.    
  193. }