Advertisement
RuneScapePB

LearnerScript

May 22nd, 2024
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.84 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.Image;
  6. import java.awt.Point;
  7. import java.io.IOException;
  8. import java.net.URL;  
  9. import javax.imageio.ImageIO;
  10. import javax.swing.JOptionPane;
  11. import org.powerbot.core.event.listeners.PaintListener;
  12. import org.powerbot.core.randoms.AntiRandom;
  13. import org.powerbot.core.script.ActiveScript;
  14. import org.powerbot.core.script.job.Task;
  15. import org.powerbot.game.api.Manifest;
  16. import org.powerbot.game.api.methods.Game;
  17. import org.powerbot.game.api.methods.Walking;
  18. import org.powerbot.game.api.methods.input.Keyboard;
  19. import org.powerbot.game.api.methods.input.Mouse;
  20. import org.powerbot.game.api.methods.interactive.NPCs;
  21. import org.powerbot.game.api.methods.interactive.Players;
  22. import org.powerbot.game.api.methods.tab.Inventory;
  23. import org.powerbot.game.api.methods.tab.Skills;
  24. import org.powerbot.game.api.util.Timer;
  25. import org.powerbot.game.api.wrappers.interactive.NPC;
  26. import org.powerbot.game.api.wrappers.node.Item;
  27.      
  28.     @Manifest
  29.     (
  30.     authors = { "RuneScape" },
  31.     name = "MillaChickens",
  32.     description = "Basic Chicken Killer with EOC Support",
  33.     version = 1.0,
  34.     website = "Soon"
  35.     )
  36.     public class MillaChicken extends ActiveScript implements PaintListener{
  37.        
  38.  
  39.         private final Image img2 = getImage("http://fc07.deviantart.net/fs43/f/2009/067/1/d/DOMINATION_OF_THE_EVIL_CHICKEN_by_DaEliminator.png");
  40.         private final Image img1 = getImage("http://i50.tinypic.com/2z8ys9d.png");
  41.        
  42.         double currentexperience;
  43.         double experienceperhour;
  44.         int startinglevel;
  45.         double startingexperience;
  46.         int currentlevel;
  47.         int levelsgained;
  48.         double experiencegained;
  49.         double experiencetonextlevel;
  50.         int percenttonextlevel;
  51.         private double hours, minutes, seconds;
  52.        
  53.         public final static int FEATHER_ID = 314;
  54.        
  55.        
  56.         private static String status;
  57.    
  58.        
  59.  
  60.         private Image getImage(String url) {
  61.           try {
  62.               return ImageIO.read(new URL(url));
  63.           } catch(IOException e) {
  64.               return null;
  65.           }
  66.         }
  67.        
  68.             public static boolean start;
  69.             public static int FOOD_ID, startExp, gained;
  70.             public static int[]Chicken = {41,1017,2314,2315,2313};
  71.             public static Timer Time;
  72.             public void onStart(){
  73.                 status = "Input food ID!";
  74.                     Time = new Timer(0);
  75.                     startExp = Skills.getExperience(Skills.STRENGTH);
  76.                     Mouse.setSpeed(Mouse.Speed.VERY_FAST);
  77.             }
  78.             @Override
  79.             public int loop() {
  80.             if(FoodId.validate())
  81.                             FoodId.run();
  82.                     if(Attack.validate())
  83.                             Attack.run();
  84.                     Keyboard.sendText("1", false);
  85.                     Keyboard.sendText("2", false);
  86.                     Keyboard.sendText("3", false);
  87.                     Keyboard.sendText("4", false);
  88.                     if(Eat.validate())
  89.                             Eat.run();
  90.                     return 30;
  91.             }
  92.             public static class FoodId{
  93.                     public static void run(){
  94.                             try{
  95.                             FOOD_ID = Integer.parseInt(JOptionPane.showInputDialog("Eneter the ID of the Food below!"));
  96.                             start = true;
  97.                             }catch(Exception e){
  98.                                     FOOD_ID = -1;
  99.                                     start = true;
  100.                             }
  101.                     }
  102.                     public static boolean validate(){
  103.                             return start == false;
  104.                     }
  105.             }
  106.             public static class Attack{
  107.                     public static void run(){
  108.                         status = "Attacking Chicken!";
  109.                             NPC chicken = NPCs.getNearest(Chicken);
  110.                             if(Players.getLocal().isIdle()){
  111.                                     if(chicken != null){
  112.                                             if(chicken.isOnScreen()){
  113.                                                     if(!chicken.isInCombat()){
  114.                                                             chicken.interact("Attack");
  115.                                                             Keyboard.sendText("1", false);
  116.                                                             Keyboard.sendText("2", false);
  117.                                                             Keyboard.sendText("3", false);
  118.                                                             Keyboard.sendText("4", false);
  119.                                                             Task.sleep(500,950);
  120.                                                     }
  121.                                             }else{
  122.                                                 status = "Walking to Chicken!";
  123.                                                     Walking.walk(chicken);
  124.                                                     Task.sleep(500,550);
  125.                                             }
  126.                                     }
  127.                             }
  128.                     }
  129.                     public static boolean validate(){
  130.                             return start;
  131.                     }
  132.             }
  133.             public static class Eat{
  134.                     public static void run(){
  135.                         status = "Eating!";
  136.                             if(Players.getLocal().getHpPercent() < 30){
  137.                                     for(Item i : Inventory.getItems()){
  138.                                             if(i.getId() == FOOD_ID){
  139.                                                 status = "Eating!";
  140.                                                 Keyboard.sendText("=", false);
  141.                                                     i.getWidgetChild().click(true);
  142.                                                     Task.sleep(50,101);
  143.                                             }
  144.                                     }
  145.                             }
  146.                     }
  147.                     public static boolean validate(){
  148.                             return start && FOOD_ID != -1;
  149.                     }
  150.             }
  151.            
  152.            
  153.             @Override
  154.             public void onRepaint(Graphics g1) {
  155.                     Graphics2D g = (Graphics2D) g1;
  156.  
  157.                     Point p = new Point(Mouse.getX(), Mouse.getY());
  158.                     Mouse.setSpeed(Mouse.Speed.VERY_FAST);
  159.                     g.drawImage(img1, p .x, p .y, null);
  160.                     g.setColor(Color.WHITE);
  161.                     g.drawLine(0, Mouse.getY(), Game.getDimensions().width,
  162.                                     Mouse.getY());
  163.                     g.drawLine(Mouse.getX(), 0, Mouse.getX(),
  164.                                     Game.getDimensions().height);
  165.                    
  166.                     gained = Skills.getExperience(Skills.STRENGTH) - startExp;
  167.                     g.setColor(Color.green);
  168.                     g.setFont(new Font("Georgia", Font.PLAIN, 18));
  169.                    
  170.                     g.drawString("Time Ran: " + Time.toElapsedString(),555, 315);
  171.                    
  172.                     g.drawString("EXP Gained: " + gained,555,330);
  173.  
  174.                     g.drawString("Current Exp: " + currentexperience, 555,360);
  175.                    
  176.                     g.drawString("Exp / Hour: " + formatdouble(experienceperhour), 555,345);
  177.                    
  178.                     g.setColor(Color.WHITE);
  179.                     g.drawString("Made By : MillaJovovich", 5, 360);
  180.                    
  181.                     g.setColor(Color.RED);
  182.                     g.drawString("Status: " + status, 280, 360);
  183.                    
  184.                    
  185.  
  186.                     g.drawImage(img2, 555 , 370, null);
  187.  
  188.  
  189.                     currentexperience = Skills.getExperience(Skills.STRENGTH);
  190.                     experienceperhour = experiencegained / hours;
  191.                     experiencegained = currentexperience - startingexperience;
  192.                     currentlevel = Skills.getRealLevel(Skills.STRENGTH);
  193.                    
  194.                     levelsgained = currentlevel - startinglevel;
  195.                    
  196.                     currentexperience = Skills.getExperience(Skills.STRENGTH);
  197.                    
  198.                     experiencegained = currentexperience - startingexperience;
  199.                    
  200.                     experienceperhour = experiencegained / hours;
  201.                    
  202.                     experiencetonextlevel = Skills.getExperienceToLevel(Skills.STRENGTH, Skills.getLevel(Skills.STRENGTH) + 1);
  203.             }
  204.            
  205.             private String formatTime(double time) {
  206.                         final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
  207.                         return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":"
  208.                                         + (s < 10 ? "0" + s : s);
  209.                 }
  210.            
  211.                  
  212.    
  213.    
  214.     private String formatdouble(double input) {
  215.        
  216.        
  217.                 String formattedmoney;
  218.                 formattedmoney = String.format("%.0f", (input));
  219.  
  220.                 if (input >= 1000 & input < 1000000) {
  221.                         input = input / 1000;
  222.                         formattedmoney = String.format("%.1fk", (input));
  223.                 }
  224.  
  225.                 if (input >= 1000000) {
  226.                         input = input / 1000000;
  227.                         formattedmoney = String.format("%.1fm", (input));
  228.                 }
  229.                
  230.                 return formattedmoney;
  231.         }    
  232.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement