Share Pastebin
Guest
Public paste!

PoodPowerMiner

By: a guest | Mar 20th, 2010 | Syntax: Java | Size: 5.60 KB | Hits: 54 | 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 miningAnimation = 624;      
  32.  
  33.        
  34.         //Paint Variables//
  35. private String status = "Online";
  36. public int startexp;
  37. public int exp;
  38. public int expGained;
  39. public float expsec;
  40. public float expmin;
  41. public float exphour;
  42. public long timeRunning = 0, secounds = 0 ,minutes = 0, hours = 0;
  43. public long startTime = System.currentTimeMillis();
  44.  
  45.  
  46.        
  47.        
  48.  
  49.         final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class); //stupid st00f
  50.  
  51.         //startup
  52.        
  53.         public boolean onStart( Map<String,String> args ) {
  54.         startTime = System.currentTimeMillis();
  55.                 return true;
  56.         }
  57.        
  58.  
  59.  
  60.  
  61.        
  62.         //antiban working on adding things such as random emotes
  63.         public void antiBan(){
  64.                 if (random(1, 12) == 1) {
  65.                         status = "Moving Screen";
  66.                         setCameraRotation(random(1,360));
  67.                 }
  68.                
  69.                 if (random(1, 11) == 1) {
  70.                         status = "Moving Mouse";
  71.                         int x = (int) getMouseLocation().getX();
  72.                         int y = (int) getMouseLocation().getY();
  73.                         moveMouse(x + random(-125, 125), y + random(-80, 80));
  74.                 }
  75.                
  76.                 if(random(1, 60) == 1) {
  77.                         status = "Checking Exp";
  78.                         openTab(TAB_STATS);
  79.                         moveMouse(random(661, 712), random(230, 261));
  80.                         wait(random(2000, 3000));
  81.                         openTab(TAB_INVENTORY);
  82.                 }
  83.         }
  84.        
  85.        
  86.         //loop
  87.  
  88.         public int loop() {
  89.                 antiBan();
  90.                
  91.         if(getMyPlayer().getAnimation() != -1) {
  92.                 status = "Mining";
  93.                                 return random(1000, 1250);
  94.         }
  95.        
  96.         if(getMyPlayer().isMoving()){
  97.                 return random(1000, 1250);
  98.         }
  99.         if(isInventoryFull()){
  100.                 status = "Dropping Ores";
  101.                 dropAllExcept(pickaxes);
  102.         }
  103.        
  104.         RSObject rock = findObject(iron);
  105.         status = "Searching For Rocks";
  106.         if(rock == null)
  107.                 return random(200, 500);
  108.        
  109.         atObject(rock, "Mine");
  110.        
  111.         return random(1000, 1500);
  112.                
  113.         }
  114.  
  115.         //paint start
  116.     public void onRepaint(Graphics g) {
  117.        
  118.         if (isLoggedIn()) {
  119.                
  120.                 if ( startexp == 0) {
  121.                      startexp = skills.getCurrentSkillExp(Constants.STAT_MINING);
  122.                 }
  123.                      
  124.                 expGained = skills.getCurrentSkillExp(Constants.STAT_MINING) - startexp;
  125.                
  126.                 timeRunning = System.currentTimeMillis() - startTime;
  127.             secounds = timeRunning / 1000;
  128.            
  129.                 if (secounds >= 60) {
  130.                 minutes = secounds / 60;
  131.                 secounds -= minutes * 60;
  132.             }
  133.             if (minutes >= 60) {
  134.                 hours = minutes / 60;
  135.                 minutes -= hours * 60;
  136.             }
  137.            
  138.             if ((minutes > 0 || hours > 0 || secounds > 0) && expGained > 0) {
  139.             expsec = ((float) expGained)/(float)(secounds + (minutes*60) + (hours*60*60));
  140.             }
  141.             exphour = expmin * 60;
  142.                         expmin = expsec * 60;
  143.            
  144.                 }
  145.                
  146.        //paint, font
  147.                 g.setColor(Color.red);
  148.            
  149.             g.setFont(new Font("Times", Font.PLAIN, 12));
  150.             g.drawString("Time Running: " + hours + ":" + minutes + ":" + secounds, 9, 285);
  151.             g.drawString("XP Gained: " + expGained, 9, 300);
  152.                         g.drawString("XP Per hour: " + (int)exphour, 9, 315);
  153.             g.drawString("Status: " + status , 9, 330);
  154.                        
  155.                        
  156.                         g.setColor(Color.green);
  157.                        
  158.                         g.setFont(new Font("Times", Font.PLAIN, 12));
  159.             g.drawString("Time Running: " + hours + ":" + minutes + ":" + secounds, 9 - 1, 285 - 1);
  160.             g.drawString("XP Gained: " + expGained, 9 - 1, 300 - 1);
  161.                         g.drawString("XP Per hour: " + (int)exphour, 9 - 1, 315 - 1);
  162.             g.drawString("Status: " + status , 9 - 1, 330 - 1);
  163.            
  164.             final int percent = skills.getPercentToNextLevel(Constants.STAT_MINING);
  165.             g.drawString("Percent till next level: ", 270, 355 + 5);
  166.             g.setColor(Color.red);
  167.             g.fillRoundRect(386, 350, 100, 10, 15, 15); //these must be on same cordinates
  168.             g.setColor(Color.green);
  169.             g.fillRoundRect(386, 350, percent, 10, 15, 15); //these must be on same cordinates
  170.             g.setColor(Color.black);
  171.             g.drawString("" + percent, 428, 360); //this must be in the center of the bar
  172.             g.drawRoundRect(386, 350, 100, 10, 15, 15); //these must be on same cordinates
  173.  
  174.                
  175.                        
  176.          
  177.         if (isLoggedIn()) {
  178.             long millis = System.currentTimeMillis() - startTime;
  179.             long hours = millis / (1000 * 60 * 60);
  180.             millis -= hours * (1000 * 60 * 60);
  181.             long minutes = millis / (1000 * 60);
  182.             millis -= minutes * (1000 * 60);
  183.             long seconds = millis / 1000;
  184.             long minutes2 = minutes + (hours * 60);
  185.             g.setColor(Color.green);
  186.             g.drawString("P00d's Power Miner" , 400, 330);
  187.            
  188.         }
  189.     }
  190.    
  191.    
  192. }