Advertisement
RandomKendal

[PkHonor] RDM Farmer

Aug 2nd, 2015
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 18.20 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Dimension;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6. import java.awt.Image;
  7. import java.awt.Toolkit;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10. import java.io.IOException;
  11. import java.net.URL;
  12. import java.text.DecimalFormat;
  13. import java.util.ArrayList;
  14.  
  15. import javax.imageio.ImageIO;
  16. import javax.swing.JButton;
  17. import javax.swing.JCheckBox;
  18. import javax.swing.JComboBox;
  19. import javax.swing.JFrame;
  20. import javax.swing.JLabel;
  21. import javax.swing.JPanel;
  22. import javax.swing.SwingConstants;
  23. import javax.swing.border.EmptyBorder;
  24.  
  25. import org.parabot.environment.api.interfaces.Paintable;
  26. import org.parabot.environment.api.utils.Time;
  27. import org.parabot.environment.api.utils.Timer;
  28. import org.parabot.environment.input.Mouse;
  29. import org.parabot.environment.scripts.Category;
  30. import org.parabot.environment.scripts.Script;
  31. import org.parabot.environment.scripts.ScriptManifest;
  32. import org.parabot.environment.scripts.framework.Strategy;
  33. import org.rev317.min.api.methods.Game;
  34. import org.rev317.min.api.methods.Inventory;
  35. import org.rev317.min.api.methods.Menu;
  36. import org.rev317.min.api.methods.Npcs;
  37. import org.rev317.min.api.methods.Players;
  38. import org.rev317.min.api.methods.SceneObjects;
  39. import org.rev317.min.api.methods.Skill;
  40. import org.rev317.min.api.wrappers.Area;
  41. import org.rev317.min.api.wrappers.Item;
  42. import org.rev317.min.api.wrappers.Npc;
  43. import org.rev317.min.api.wrappers.SceneObject;
  44. import org.rev317.min.api.wrappers.Tile;
  45.  
  46. @ScriptManifest(
  47.         author = "Random (Kendal)",
  48.         category = Category.FARMING,
  49.         description = "Farms ANY Herb in PkHonor. Start with a Seed Dipper, Spade, Rake and the usuable seeds in your inventory. If you don't have a Woad plant, you might want to bring some cash for Plant Cures aswell. Also supports Super Compost!",
  50.         name = "RDM Farmer",
  51.         servers = { "PkHonor" },
  52.         version = 0.12
  53.         )
  54.  
  55. public class RDMFarmer extends Script implements Paintable {
  56.  
  57.     private final ArrayList<Strategy> Strategies = new ArrayList<Strategy>();
  58.     private Timer scriptTimer;
  59.    
  60.     DecimalFormat formatter = new DecimalFormat("#,###,###,###");
  61.    
  62.     int startExperience = Skill.FARMING.getExperience();
  63.     int CollectedHerbs = 0;
  64.    
  65.     private static Image backgroundIMG;
  66.    
  67.     private static String[] HERB_NAMES = {"Guam", "Marrentill", "Tarromin", "Harralander", "Ranarr", "Toadflax", "Irit",
  68.                                             "Avantoe", "Kwuarm", "Snapdragon", "Cadantine", "Lantadyme", "Dwarf Weed", "Torstol"};
  69.     private static int[] HERB_IDS = {250, 252, 254, 256, 258, 2999, 260, 262, 264, 266, 3001, 2482, 268, 270};
  70.    
  71.     private static int RAKE = 5342;
  72.     private static int SEED_DIPPER = 5344;
  73.     private static int SPADE = 953;
  74.     private static int PLANT_CURE = 6037;
  75.     private static int EMPTY_VIAL = 230;
  76.     private static int EMPTY_BUCKET = 1926;
  77.     private static int MAGIC_SECATEURS = 7409;
  78.     private static int SUPERCOMPOST = 6035;
  79.     private static int COINS = 996;
  80.    
  81.     private static int[] DISEASED_PLANTS = {8144, 8145, 8146};
  82.     private static int[] GRASSY_PATCHES = {8150, 8151, 8152, 8153};
  83.     private static int EMPTY_PATCH = 8132;
  84.     private static int GROWN_HERB = 8143;
  85.     private static int DEPOSIT_BOX = 9398;
  86.    
  87.     private static int[] FARMING_SHOPS = {2323, 2324, 2325, 2326};
  88.    
  89.     private static int SHOP_INTERFACE = 3824;
  90.     private static int BANK_INTERFACE = 23350;
  91.     private static int DEPOSIT_ALL = 432;
  92.    
  93.     private Area FALADOR = new Area(new Tile(3047, 3299), new Tile(3062, 3315));
  94.     private Area PORT_PHASMATYS = new Area(new Tile(3594, 3518), new Tile(3609, 3533));
  95.     private Area CATHERBY = new Area(new Tile(2801, 3456), new Tile(2817, 3471));
  96.     private Area ARDOUGNE = new Area(new Tile(2659, 3367), new Tile(2675, 3381));
  97.    
  98.     int herbIndex = -1;
  99.     boolean useCompost;
  100.    
  101.     boolean notCompostedYet = true;
  102.    
  103.     @Override
  104.     public boolean onExecute() {
  105.         backgroundIMG = getImage("http://i.imgur.com/cciyTiy.png");
  106.        
  107.         GUI g = new GUI();
  108.         while(g.isVisible()){
  109.                 Time.sleep(100);}
  110.        
  111.         if(herbIndex == -1) {
  112.             System.out.println("Please select a Herb Type.");
  113.             return false;
  114.         }
  115.        
  116.         if(Inventory.getCount(SEED_DIPPER) == 0 || Inventory.getCount(SPADE) == 0 || Inventory.getCount(RAKE) == 0) {
  117.             System.out.println("Make sure you have a Seed Dipper, Spade and Rake in your inventory.");
  118.             return false;
  119.         }
  120.        
  121.         if(Inventory.getCount(COINS) == 0 && useCompost) {
  122.             System.out.println("Make sure you have some cash to buy Super Compost.");
  123.             return false;
  124.         }
  125.        
  126.         scriptTimer = new Timer();
  127.  
  128.         Strategies.add(new RakePatch());
  129.         Strategies.add(new CompostPatch());
  130.         Strategies.add(new PlantSeed());
  131.         Strategies.add(new BankHerbs());
  132.         Strategies.add(new PickHerbs());
  133.         Strategies.add(new CurePlants());
  134.         Strategies.add(new BuyCompost());
  135.         Strategies.add(new TeleportToPatch());
  136.        
  137.         provide(Strategies);
  138.  
  139.         System.out.println("==== RDM Farmer v0.12 ====");
  140.         System.out.println("Farming: " + HERB_NAMES[herbIndex]);
  141.         System.out.println((useCompost == true) ? "Using compost." : "Not using compost.");
  142.         System.out.println("==== Started Script! ====");
  143.         System.out.println("");
  144.         return true;
  145.     }
  146.    
  147.     @Override
  148.     public void onFinish() {
  149.         int endExperience = Skill.FARMING.getExperience();
  150.         System.out.println("==== RDM Farmer v0.12 ==== ");
  151.        
  152.         System.out.println("Ran for: " + scriptTimer.toString());        
  153.         System.out.println("Experience gained: " + formatter.format((endExperience - startExperience)) + " (" + formatter.format(scriptTimer.getPerHour((endExperience - startExperience))) + " XP/HR)");
  154.         System.out.println("Herbs gained: " + CollectedHerbs + " (" + formatter.format(scriptTimer.getPerHour(CollectedHerbs)) + " Herbs/HR)");
  155.         System.out.println("=== Thanks for using! === ");
  156.     }
  157.    
  158.     public class CurePlants implements Strategy {
  159.         @Override
  160.         public boolean activate() {
  161.             for(int diseasedID : DISEASED_PLANTS) {
  162.                 SceneObject[] DiseasedPatch = SceneObjects.getNearest(diseasedID);
  163.                 if(DiseasedPatch.length > 0) {
  164.                     return true;
  165.                 }
  166.             }
  167.             return false;
  168.         }
  169.  
  170.         @Override
  171.         public void execute() {
  172.             if(Inventory.getCount(PLANT_CURE) > 0) {
  173.                 Item[] PlantCure = Inventory.getItems(PLANT_CURE);
  174.  
  175.                 Time.sleep(300);
  176.                 Menu.sendAction(447, PLANT_CURE - 1, PlantCure[0].getSlot(), 3214);
  177.                 Time.sleep(500);
  178.                
  179.                 for(int diseasedID : DISEASED_PLANTS) {
  180.                     SceneObject[] DiseasedPatch = SceneObjects.getNearest(diseasedID);
  181.                    
  182.                     if(DiseasedPatch.length > 0) {
  183.                         SceneObject Patch = DiseasedPatch[0];
  184.                        
  185.                         if (Patch != null) {
  186.                             Menu.sendAction(62, Patch.getHash(), Patch.getLocalRegionX(), Patch.getLocalRegionY(), diseasedID, 1);
  187.                             Time.sleep(Patch.getLocation().distanceTo() * 400);
  188.                         }
  189.                     }
  190.                 }
  191.             } else {
  192.                 if(Game.getOpenInterfaceId() != SHOP_INTERFACE) {
  193.                     for(int NPC_IDs : FARMING_SHOPS) {
  194.                         Npc[] shopNPC = Npcs.getNearest(NPC_IDs);
  195.    
  196.                         if (shopNPC.length > 0) {
  197.                             try {
  198.                                 shopNPC[0].interact(2);
  199.                                 Time.sleep(shopNPC[0].getLocation().distanceTo() * 400);
  200.                             } catch(Exception _e) {
  201.                                 System.out.println("Prevented an error! - Nulled NPC");
  202.                             }
  203.                         }
  204.                     }
  205.                 } else {
  206.                     Menu.sendAction(867, PLANT_CURE - 1, 8, 3900);
  207.                     Time.sleep(500);
  208.                 }
  209.             }
  210.         }
  211.     }
  212.    
  213.     public class CompostPatch implements Strategy {
  214.         @Override
  215.         public boolean activate() {
  216.             if(useCompost && notCompostedYet) {
  217.                 SceneObject[] OpenHerbPatch = SceneObjects.getNearest(EMPTY_PATCH);
  218.                 if(OpenHerbPatch.length > 0) {
  219.                     return true;
  220.                 }
  221.             }
  222.             return false;
  223.         }
  224.  
  225.         @Override
  226.         public void execute() {
  227.             if(Inventory.getCount(SUPERCOMPOST) > 0) {
  228.                 Item[] SuperCompost = Inventory.getItems(SUPERCOMPOST);
  229.  
  230.                 Time.sleep(300);
  231.                 Menu.sendAction(447, SUPERCOMPOST - 1, SuperCompost[0].getSlot(), 3214);
  232.                 Time.sleep(500);
  233.                 SceneObject[] OpenHerbPatch = SceneObjects.getNearest(EMPTY_PATCH);
  234.                 if(OpenHerbPatch.length > 0) {
  235.                     SceneObject Patch = OpenHerbPatch[0];
  236.                     if (Patch != null) {
  237.                         Menu.sendAction(62, Patch.getHash(), Patch.getLocalRegionX(), Patch.getLocalRegionY(), EMPTY_PATCH, 1);
  238.                         Time.sleep(Patch.getLocation().distanceTo() * 400 + 500);
  239.                         notCompostedYet = false;
  240.                     }
  241.                 } else {
  242.                     System.out.println("Cannot find patch.");
  243.                     notCompostedYet = false;
  244.                 }
  245.             } else {
  246.                 if(Inventory.getCount() == 28) {
  247.                     System.out.println("Don't have enough inventory space to buy Super Compost, skipping it.");
  248.                     notCompostedYet = false;
  249.                 } else {
  250.                     if(Game.getOpenInterfaceId() != SHOP_INTERFACE) {
  251.                         for(int NPC_IDs : FARMING_SHOPS) {
  252.                             Npc[] shopNPC = Npcs.getNearest(NPC_IDs);
  253.        
  254.                             if (shopNPC.length > 0) {
  255.                                 try {
  256.                                     shopNPC[0].interact(2);
  257.                                     Time.sleep(shopNPC[0].getLocation().distanceTo() * 400);
  258.                                 } catch(Exception _e) {
  259.                                     System.out.println("Prevented an error! - Nulled NPC");
  260.                                 }
  261.                             }
  262.                         }
  263.                     } else {
  264.                         Menu.sendAction(867, SUPERCOMPOST - 1, 7, 3900);
  265.                         Time.sleep(500);
  266.                     }
  267.                 }
  268.             }
  269.         }
  270.     }
  271.    
  272.     public class BankHerbs implements Strategy {
  273.         @Override
  274.         public boolean activate() {
  275.             for(int HERB : HERB_IDS) {
  276.                 if(Inventory.getCount(HERB) > 0) {
  277.                     SceneObject[] DepositBox = SceneObjects.getNearest(DEPOSIT_BOX);
  278.                     if(DepositBox.length > 0) {
  279.                         return true;
  280.                     }
  281.                 }
  282.             }
  283.             return false;
  284.         }
  285.  
  286.         @Override
  287.         public void execute() {
  288.             if(Game.getOpenInterfaceId() != BANK_INTERFACE) {
  289.                 SceneObject[] DepositBox = SceneObjects.getNearest(DEPOSIT_BOX);
  290.                
  291.                 if(DepositBox.length > 0) {
  292.                     SceneObject Bank = DepositBox[0];
  293.                    
  294.                     if (Bank != null) {
  295.                         Bank.interact(0);
  296.                         Time.sleep(Bank.getLocation().distanceTo() * 400 + 400);
  297.                     }
  298.                 }
  299.             } else {
  300.                 for(int HERB : HERB_IDS) {
  301.                     if(Inventory.getCount(HERB) > 0) {
  302.                         Item[] DepositableHerb = Inventory.getItems(HERB);
  303.                         CollectedHerbs += DepositableHerb.length;
  304.                         Menu.sendAction(DEPOSIT_ALL, HERB - 1, DepositableHerb[0].getSlot(), 5064);
  305.                         sleep(200);
  306.                     }
  307.                 }
  308.                 if(Inventory.getCount(EMPTY_VIAL) > 0) {
  309.                     Item[] EmptyVials = Inventory.getItems(EMPTY_VIAL);
  310.                     for(Item Vial : EmptyVials) {
  311.                         Vial.drop();
  312.                         sleep(100);
  313.                     }
  314.                     sleep(200);
  315.                 }
  316.                 if(Inventory.getCount(EMPTY_BUCKET) > 0) {
  317.                     Item[] EmptyBucket = Inventory.getItems(EMPTY_BUCKET);
  318.                     for(Item Bucket : EmptyBucket) {
  319.                         Bucket.drop();
  320.                         sleep(100);
  321.                     }
  322.                     sleep(200);
  323.                 }
  324.                 sleep(500);
  325.                 Mouse.getInstance().click(486, 27, true);
  326.                 sleep(200);
  327.             }
  328.         }
  329.     }
  330.    
  331.     public class PlantSeed implements Strategy {
  332.         @Override
  333.         public boolean activate() {
  334.             SceneObject[] OpenHerbPatch = SceneObjects.getNearest(EMPTY_PATCH);
  335.             if(OpenHerbPatch.length > 0) {
  336.                 return true;
  337.             }
  338.             return false;
  339.         }
  340.  
  341.         @Override
  342.         public void execute() {
  343.             Item[] Seed = Inventory.getItems(5292 + herbIndex);
  344.             if(Seed.length > 0) {
  345.                 Time.sleep(300);
  346.                 Menu.sendAction(447, 5291 + herbIndex, Seed[0].getSlot(), 3214);
  347.                 Time.sleep(500);
  348.                 SceneObject[] OpenHerbPatch = SceneObjects.getNearest(EMPTY_PATCH);
  349.                 if(OpenHerbPatch.length > 0) {
  350.                     SceneObject Patch = OpenHerbPatch[0];
  351.                     if (Patch != null) {
  352.                         Menu.sendAction(62, Patch.getHash(), Patch.getLocalRegionX(), Patch.getLocalRegionY(), EMPTY_PATCH, 1);
  353.                         Time.sleep(1500);
  354.                         notCompostedYet = true;
  355.                     }
  356.                 }
  357.             }
  358.            
  359.         }
  360.     }
  361.    
  362.     public class RakePatch implements Strategy {
  363.         @Override
  364.         public boolean activate() {
  365.             for(int grassy_id : GRASSY_PATCHES) {
  366.                 SceneObject[] GrassyPatch = SceneObjects.getNearest(grassy_id);
  367.                 if(GrassyPatch.length > 0) {
  368.                     return true;
  369.                 }
  370.             }
  371.             return false;
  372.         }
  373.  
  374.         @Override
  375.         public void execute() {
  376.             Item[] Rake = Inventory.getItems(RAKE);
  377.             if(Rake.length > 0) {
  378.                 Time.sleep(300);
  379.                 Menu.sendAction(447, RAKE - 1, Rake[0].getSlot(), 3214);
  380.                 Time.sleep(500);
  381.                 for(int grassy_id : GRASSY_PATCHES) {
  382.                     SceneObject[] GrassyPatch = SceneObjects.getNearest(grassy_id);
  383.                     if(GrassyPatch.length > 0) {
  384.                         SceneObject Patch = GrassyPatch[0];
  385.                         if (Patch != null) {
  386.                             Menu.sendAction(62, Patch.getHash(), Patch.getLocalRegionX(), Patch.getLocalRegionY(), grassy_id, 1);
  387.                             Time.sleep(Patch.getLocation().distanceTo() * 400 + 1000);
  388.                         }
  389.                     }
  390.                 }
  391.             }
  392.            
  393.         }
  394.     }
  395.    
  396.     public class PickHerbs implements Strategy {
  397.         @Override
  398.         public boolean activate() {
  399.             SceneObject[] PickableHerbs = SceneObjects.getNearest(GROWN_HERB);
  400.             if(PickableHerbs.length > 0) {
  401.                 return true;
  402.             }
  403.             return false;
  404.         }
  405.  
  406.         @Override
  407.         public void execute() {
  408.             SceneObject[] PickableHerbs = SceneObjects.getNearest(GROWN_HERB);
  409.             if(PickableHerbs.length > 0) {
  410.                 PickableHerbs[0].interact(0);
  411.                 Time.sleep(PickableHerbs[0].getLocation().distanceTo() * 400 + 1000);
  412.             }
  413.         }
  414.     }
  415.    
  416.     public class TeleportToPatch implements Strategy {
  417.         @Override
  418.         public boolean activate() {
  419.             SceneObject[] AlmostDoneHerb = SceneObjects.getNearest(8142);
  420.             if(AlmostDoneHerb.length == 0) {
  421.                 if(Players.getMyPlayer().getAnimation() == -1) {
  422.                     return true;
  423.                 }
  424.             }
  425.             return false;
  426.         }
  427.  
  428.         @Override
  429.         public void execute() {
  430.             Area[] HERB_LOCATIONS = {FALADOR, PORT_PHASMATYS, CATHERBY, ARDOUGNE};
  431.             Tile MyPos = Players.getMyPlayer().getLocation();
  432.             int currentLocation = 0;
  433.             for(int location = 0; location < HERB_LOCATIONS.length; location++) {
  434.                 if(inArea(HERB_LOCATIONS[location], MyPos)) {
  435.                     currentLocation = location;
  436.                 }
  437.             }
  438.             sleep(200);
  439.             showTeleports();
  440.             sleep(200);
  441.             Menu.clickButton(2494);
  442.             sleep(200);
  443.             Menu.clickButton(2494 + (currentLocation + 1) % 4);
  444.             sleep(2500);
  445.         }
  446.     }
  447.    
  448.     public class BuyCompost implements Strategy {
  449.         @Override
  450.         public boolean activate() {
  451.             if(useCompost && Inventory.getCount() != 28 && Inventory.getCount(SUPERCOMPOST) == 0) {
  452.                 for(int NPC_IDs : FARMING_SHOPS) {
  453.                     Npc[] shopNPC = Npcs.getNearest(NPC_IDs);
  454.                     if (shopNPC.length > 0) {
  455.                         return true;
  456.                     }
  457.                 }
  458.             }
  459.             return false;
  460.         }
  461.  
  462.         @Override
  463.         public void execute() {
  464.             if(Game.getOpenInterfaceId() != SHOP_INTERFACE) {
  465.                 for(int NPC_IDs : FARMING_SHOPS) {
  466.                     Npc[] shopNPC = Npcs.getNearest(NPC_IDs);
  467.                     if (shopNPC.length > 0) {
  468.                         try {
  469.                             shopNPC[0].interact(2);
  470.                             Time.sleep(shopNPC[0].getLocation().distanceTo() * 400);
  471.                         } catch(Exception _e) {
  472.                             System.out.println("Prevented an error! - Nulled NPC");
  473.                         }
  474.                     }
  475.                 }
  476.             } else {
  477.                 Menu.sendAction(867, SUPERCOMPOST - 1, 7, 3900);
  478.                 Time.sleep(500);
  479.             }
  480.         }
  481.     }
  482.    
  483.     public void showTeleports() {
  484.         Menu.sendAction(867, MAGIC_SECATEURS, 3, 1688);
  485.     }
  486.    
  487.     public boolean inArea(Area givenArea, Tile givenTile) {
  488.         Tile leftUpper = givenArea.getPoints()[0];
  489.         Tile rightBottom = givenArea.getPoints()[1];
  490.         if(givenTile.getX() > leftUpper.getX() && givenTile.getX() < rightBottom.getX()
  491.                 && givenTile.getY() > leftUpper.getY() && givenTile.getY() < rightBottom.getY())
  492.             return true;
  493.         return false;
  494.     }
  495.    
  496.     public class GUI extends JFrame implements ActionListener {
  497.        
  498.         private static final long serialVersionUID = 7519153641069525353L;
  499.  
  500.         private JPanel contentPane;
  501.        
  502.         JCheckBox usingCompost;
  503.         JButton btnStart;
  504.         JComboBox<String> herbType;
  505.        
  506.         public GUI() {
  507.            
  508.             setResizable(false);
  509.             setTitle("RDM Farmer");
  510.             setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  511.             setBounds(100, 100, 242, 206);
  512.             contentPane = new JPanel();
  513.             contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  514.             setContentPane(contentPane);
  515.             contentPane.setLayout(null);
  516.            
  517.             JLabel lblRdmFarmer = new JLabel("RDM Farmer");
  518.             lblRdmFarmer.setHorizontalAlignment(SwingConstants.CENTER);
  519.             lblRdmFarmer.setFont(new Font("Verdana", Font.PLAIN, 17));
  520.             lblRdmFarmer.setBounds(45, 0, 143, 34);
  521.             contentPane.add(lblRdmFarmer);
  522.            
  523.             herbType = new JComboBox<>(HERB_NAMES);
  524.             herbType.setBounds(45, 59, 143, 20);
  525.             contentPane.add(herbType);
  526.            
  527.             JLabel lblChooseHerbtype = new JLabel("Choose Herb-Type:");
  528.             lblChooseHerbtype.setHorizontalAlignment(SwingConstants.CENTER);
  529.             lblChooseHerbtype.setBounds(65, 45, 101, 14);
  530.             contentPane.add(lblChooseHerbtype);
  531.            
  532.             usingCompost = new JCheckBox("Use Supercompost");
  533.             usingCompost.setHorizontalAlignment(SwingConstants.CENTER);
  534.             usingCompost.setBounds(45, 86, 133, 23);
  535.             contentPane.add(usingCompost);
  536.            
  537.             btnStart = new JButton("Start!");
  538.             btnStart.setBounds(59, 124, 110, 34);
  539.             contentPane.add(btnStart);
  540.             btnStart.addActionListener(this);
  541.  
  542.             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  543.             this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
  544.             setVisible(true);
  545.         }
  546.        
  547.         @Override
  548.         public void actionPerformed(ActionEvent e) {
  549.             if(e.getSource().equals(btnStart)){
  550.                 herbIndex = herbType.getSelectedIndex();
  551.                 useCompost = usingCompost.isSelected();
  552.                 setVisible(false);
  553.             }
  554.         }
  555.     }
  556.  
  557.  
  558.    
  559.     @Override
  560.     public void paint(Graphics Graphs) {
  561.         Graphs.drawImage(backgroundIMG, 400, 5, null);
  562.        
  563.         Graphics2D g = (Graphics2D) Graphs;
  564.         g.setColor(Color.WHITE);
  565.         g.drawString("RDM Farmer", 420, 20);
  566.         try {
  567.             g.drawString("Runtime: " + scriptTimer.toString(), 404, 36);
  568.             g.drawString("XP:", 405, 52);
  569.             g.drawString("Herbs:", 404, 64);
  570.    
  571.             g.drawString(formatter.format((Skill.FARMING.getExperience() - startExperience) / 1000) + "K (" + formatter.format(scriptTimer.getPerHour((Skill.FARMING.getExperience() - startExperience))).substring(0, 4) + "M)", 425, 52);
  572.             g.drawString(CollectedHerbs + " (" + scriptTimer.getPerHour(CollectedHerbs) + ")", 445, 64);
  573.         } catch (Exception _e) {}
  574.     }
  575.    
  576.     public static Image getImage(String url) {
  577.         try {
  578.             return ImageIO.read(new URL(url));
  579.         } catch (IOException e) {
  580.             return null;
  581.         }
  582.     }
  583.  
  584. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement