Don't like ads? PRO users don't see any ads ;-)
Guest

倒萨

By: bb7851391 on May 7th, 2012  |  syntax: None  |  size: 18.14 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.io.BufferedReader;
  7. import java.io.IOException;
  8. import java.io.InputStreamReader;
  9. import java.net.MalformedURLException;
  10. import java.net.URL;
  11.  
  12. import javax.imageio.ImageIO;
  13.  
  14. import com.rarebot.script.methods.Game.Tab;
  15. import com.rarebot.script.methods.Skills;
  16. import com.rarebot.script.wrappers.RSItem;
  17. import com.rarebot.event.events.MessageEvent;
  18. import com.rarebot.event.listeners.MessageListener;
  19. import com.rarebot.event.listeners.PaintListener;
  20. import com.rarebot.script.Script;
  21. import com.rarebot.script.ScriptManifest;
  22. import com.rarebot.script.wrappers.RSArea;
  23. import com.rarebot.script.wrappers.RSComponent;
  24. import com.rarebot.script.wrappers.RSInterface;
  25. import com.rarebot.script.wrappers.RSObject;
  26. import com.rarebot.script.wrappers.RSPath;
  27. import com.rarebot.script.wrappers.RSTile;
  28.  
  29. @ScriptManifest(authors = { "NathanSTG", "Ben KingOfMoria" },
  30.                                 name = "CannonBallNiggas",
  31.                                 version = 1.1,
  32.                                 description = "Makes cannonballs at Al-Kharid, Edgeville, Falador, and Ardougne East. Auto"
  33.                 )
  34. public class CannonBallNiggas extends Script implements PaintListener, MessageListener{
  35.        
  36.         /************ Variables ************/
  37.        
  38.         /**
  39.          * ==============
  40.          * Al-Kharid ID's
  41.          * ==============
  42.          */
  43.         //Areas
  44.         private static final RSArea alKharidBankArea = new RSArea(
  45.                         new RSTile(3269, 3164), new RSTile(3276, 3170));
  46.         private static final RSArea alKharidFurnaceArea = new RSArea(
  47.                         new RSTile(3274, 3184), new RSTile(3279, 3188));
  48.         //IDS
  49.         private static final int alKharidBoothID = 35647;
  50.         private static final int alKharidFurnaceID = 11666;
  51.         //Tiles
  52.         private static final RSTile alKharidBankTile = new RSTile(3270, 3167);
  53.         private static final RSTile alKharidFurnaceTile = new RSTile(3275, 3186);
  54.        
  55.        
  56.         /**
  57.          * ==============
  58.          * Edgeville ID's
  59.          * ==============
  60.          */
  61.         //Areas
  62.         private static final RSArea edgevilleBankArea = new RSArea(
  63.                         new RSTile(3091, 3494), new RSTile(3098, 3499));
  64.         private static final RSArea edgevilleFurnaceArea = new RSArea(
  65.                         new RSTile(3106, 3497), new RSTile(3112, 3504));
  66.         //ID's
  67.         private static final int edgevilleBoothID = 42377;
  68.         private static final int edgevilleFurnaceID = 26814;
  69.         //Tiles
  70.         private static final RSTile edgevilleBankTile = new RSTile(3096, 3497);
  71.         private static final RSTile edgevilleFurnaceTile = new RSTile(3109, 3501);
  72.        
  73.         /**
  74.          * ============
  75.          * Falador ID's
  76.          * ============
  77.          */
  78.         //Areas
  79.         private static final RSArea fallyBankArea = new RSArea(
  80.                         new RSTile(2943, 3368), new RSTile(2949, 3373));
  81.         private static final RSArea fallyFurnaceArea = new RSArea(
  82.                         new RSTile(2970, 3367), new RSTile(2977, 3374));
  83.         //ID's
  84.         private static final int fallyBoothID = 1158;
  85.         private static final int fallyFurnaceID = 11666;
  86.         //Tiles
  87.         private static final RSTile fallyBankTile = new RSTile(2946, 3370);
  88.         private static final RSTile fallyFurnaceTile = new RSTile(2974, 3370);
  89.        
  90.         /**
  91.          * =============
  92.          * Ardougne ID's
  93.          * =============
  94.          */
  95.         //Areas
  96.         private static final RSArea ardougneBankArea = new RSArea(
  97.                         new RSTile(2616, 3332), new RSTile(2621, 3336));
  98.         private static final RSArea ardougneFurnaceArea = new RSArea(
  99.                         new RSTile(2602, 3307), new RSTile(2605, 3313));
  100.         //ID's
  101.         private static final int ardougneBoothID = 34752;
  102.         private static final int ardougneFurnaceID = 11666;
  103.         //Tiles
  104.         private static final RSTile ardougneBankTile = new RSTile(2617, 3333);
  105.         private static final RSTile ardougneFurnaceTile = new RSTile(2604, 3310);
  106.        
  107.        
  108.        
  109.         /** Universal Variables **/
  110.        
  111.         //Areas to decide location
  112.         private static final RSArea alKharidArea = new RSArea(new RSTile(3264, 3160), new RSTile(3285, 3195));
  113.         private static final RSArea edgevilleArea = new RSArea(new RSTile(3080, 3484), new RSTile(3116, 3509));
  114.         private static final RSArea fallyArea = new RSArea(new RSTile(2942, 3364), new RSTile(2980, 3382));
  115.         private static final RSArea ardougneArea = new RSArea(new RSTile(2600, 3306), new RSTile(2623, 3340));
  116.        
  117.         //Vars to be assigned based on location
  118.         private RSArea bankArea;
  119.         private RSArea furnaceArea;
  120.        
  121.         private int boothID;
  122.         private int furnaceID;
  123.        
  124.         private RSTile bankTile;
  125.         private RSTile furnaceTile;
  126.        
  127.         //ID's
  128.         private static final int moldID = 4;
  129.         private static final int ballID = 2;
  130.         private static final int steelID = 2353;
  131.         private static final int interfaceID = 905;
  132.         private static final int[] smeltingAnimation = { 899, 827 };
  133.        
  134.         //Paths
  135.         private RSPath pathToBank;
  136.         private RSPath pathToFurnace;
  137.        
  138.         //Control Variables
  139.         private boolean atBank;
  140.         private boolean atFurnace;
  141.         private boolean isSmelting;
  142.        
  143.         /**
  144.          * Integer to store the location of the player for the script
  145.          *
  146.          * 1 = Al Kharid,
  147.          * 2 = Edgeville,
  148.          * 3 = Falador,
  149.          * 4 = Ardougne,
  150.          * -1 = error
  151.          */
  152.         private int loc;
  153.        
  154.         //Interface
  155.         private RSInterface smeltInterface = null;
  156.        
  157.         //Paint Vars
  158.         private long timeStart;
  159.        
  160.         private String status;
  161.         private String location;
  162.        
  163.         private int ballPrice;
  164.         private int steelPrice;
  165.         private int profit;
  166.         private int ballsMade;
  167.         private int startingExp;
  168.         private int levelsGained;
  169.         private int totalAntibans;
  170.         private int startLevel;
  171.        
  172.         private URL url;
  173.         Image bgPaint = null;
  174.  
  175.         private static final long startTime = System.currentTimeMillis();
  176.     private final Font font1 = new Font("Old English Text MT", 0, 12);
  177.    
  178.     ScriptManifest info = getClass().getAnnotation(ScriptManifest.class);
  179.        
  180.     /************ Script Methods ************/
  181.         public boolean onStart(){
  182.                 status = "Loading...";
  183.                 log("Loading...");
  184.                 sleep(500);
  185.                
  186.                 profit = 0;
  187.                 ballPrice = loadPrice(ballID);
  188.                 steelPrice = loadPrice(steelID);
  189.                 isSmelting = false;
  190.                 ballsMade = 0;
  191.                 startingExp = skills.getCurrentExp(Skills.SMITHING);
  192.                 levelsGained = 0;
  193.                 timeStart = System.currentTimeMillis();
  194.                 totalAntibans = 0;
  195.                 startLevel = skills.getCurrentLevel(Skills.SMITHING);
  196.                
  197.                 log("Balls Price: " + ballPrice);
  198.                 log("Steel Price: " + steelPrice);
  199.                 log("Finding User Location...");
  200.                
  201.                 sleep(3000);
  202.                 getSmithingLocation();
  203.                 setLocationVars();
  204.                 createPaths();
  205.                 try {
  206.                         url = new URL("http://isdweather.comlu.com/images/paint_background_new.png");
  207.                 } catch (MalformedURLException e) {
  208.                        
  209.                         e.printStackTrace();
  210.                 }
  211.  
  212.                 refreshBools();
  213.                 return true;
  214.         }
  215.        
  216.         @Override
  217.         public int loop() {
  218.                 createPaths();
  219.                 refreshBools();
  220.                         if(!inventory.contains(steelID)){
  221.                                 if(inventory.contains(ballID)){
  222.                                         if(atBank){
  223.                                                 status = "Depositing";
  224.                                                 depositBalls();
  225.                                         }else{
  226.                                                 status = "Walking to bank";
  227.                                                 walkToBank();
  228.                                         }
  229.                                 }else{
  230.                                         if(atBank){
  231.                                                 status = "Withdrawing";
  232.                                                 withdrawSteel();
  233.                                         }else{
  234.                                                 status = "Walking to bank";
  235.                                                 walkToBank();
  236.                                         }
  237.                                 }
  238.                         }else{
  239.                                 if(atFurnace){
  240.                                         status = "Smelting";
  241.                                         smeltBalls();
  242.                                 }else{
  243.                                         status = "Walking to furnace";
  244.                                         walkToFurnace();
  245.                                 }
  246.                         }
  247.                 return random(500, 750);
  248.         }
  249.        
  250.         public void onFinish(){
  251.                 log("Thank you for using CannonBallNiggas by NathanSTG and Ben KingOfMoria!");
  252.                 env.saveScreenshot(false);
  253.         }
  254.        
  255.         /************ Custom methods ************/
  256.        
  257.         /**
  258.          * Sets the integer 'loc' based on where the player is.
  259.          */
  260.         private void getSmithingLocation(){
  261.                 RSTile currPos = getMyPlayer().getLocation();
  262.                
  263.                 if(alKharidArea.contains(currPos)){
  264.                         loc = 1;
  265.                 }else if(edgevilleArea.contains(currPos)){
  266.                         loc = 2;
  267.                 }else if(fallyArea.contains(currPos)){
  268.                         loc = 3;
  269.                 }else if(ardougneArea.contains(currPos)){
  270.                         loc = 4;
  271.                 }else{
  272.                         loc = -1;
  273.                 }
  274.         }
  275.        
  276.         /**
  277.          * Sets the variables for the bank and furnace and paths to use based on
  278.          * what area the user was found in.
  279.          */
  280.         private void setLocationVars(){
  281.                 switch(loc){
  282.                 case 1: //Al-Kharid
  283.                         bankArea = alKharidBankArea;
  284.                         furnaceArea = alKharidFurnaceArea;
  285.                         boothID = alKharidBoothID;
  286.                         furnaceID = alKharidFurnaceID;
  287.                         bankTile = alKharidBankTile;
  288.                         furnaceTile = alKharidFurnaceTile;
  289.                         location = "Al Kharid";
  290.                         break;
  291.                 case 2: //Edgeville
  292.                         bankArea = edgevilleBankArea;
  293.                         furnaceArea = edgevilleFurnaceArea;
  294.                         boothID = edgevilleBoothID;
  295.                         furnaceID = edgevilleFurnaceID;
  296.                         bankTile = edgevilleBankTile;
  297.                         furnaceTile = edgevilleFurnaceTile;
  298.                         location = "Edgeville";
  299.                         break;
  300.                 case 3: //Falador
  301.                         bankArea = fallyBankArea;
  302.                         furnaceArea = fallyFurnaceArea;
  303.                         boothID = fallyBoothID;
  304.                         furnaceID = fallyFurnaceID;
  305.                         bankTile = fallyBankTile;
  306.                         furnaceTile = fallyFurnaceTile;
  307.                         location = "Falador";
  308.                         break;
  309.                 case 4: //Ardougne
  310.                         bankArea = ardougneBankArea;
  311.                         furnaceArea = ardougneFurnaceArea;
  312.                         boothID = ardougneBoothID;
  313.                         furnaceID = ardougneFurnaceID;
  314.                         bankTile = ardougneBankTile;
  315.                         furnaceTile = ardougneFurnaceTile;
  316.                         location = "Ardougne";
  317.                         break;
  318.                        
  319.                 case -1:
  320.                         log(Color.RED, "Error: Location not recognized!");
  321.                         log(Color.RED, "Please move closer to a bank or furnace in a supported area and try again.");
  322.                         stopScript();
  323.                         break;
  324.                 }
  325.         }
  326.        
  327.         /**
  328.          * Refreshes the values of 'atBank' and 'atFurnace'
  329.          */
  330.         private void refreshBools(){
  331.                 if(bankArea.contains(getMyPlayer().getLocation())){
  332.                         atBank = true;
  333.                 }else{
  334.                         atBank = false;
  335.                 }
  336.                 if(furnaceArea.contains(getMyPlayer().getLocation())){
  337.                         atFurnace = true;
  338.                 }else{
  339.                         atFurnace = false;
  340.                 }
  341.                 try {
  342.                         bgPaint = ImageIO.read(url);
  343.                 } catch (IOException e) {
  344.                         e.printStackTrace();
  345.                 }
  346.         }
  347.        
  348.         /**
  349.          * Sets up the paths from the player to the given points
  350.          */
  351.         private void createPaths(){
  352.                 pathToBank = walking.getPath(bankTile);
  353.                 pathToFurnace = walking.getPath(furnaceTile);
  354.         }
  355.        
  356.         /**
  357.          * Deposits all items in the bank except for the cannon ball mold
  358.          */
  359.         private void depositBalls(){
  360.                 RSObject bankObj = objects.getNearest(boothID);
  361.                 if(bank.isOpen()){
  362.                         bank.depositAllExcept(moldID);
  363.                 }else{
  364.                         if(bankObj.isOnScreen()){
  365.                                 bank.open();
  366.                         }else{
  367.                                 camera.turnTo(bankObj);
  368.                         }
  369.                 }
  370.                 sleep(500);
  371.         }
  372.        
  373.         /**
  374.          * Walks to the bank
  375.          */
  376.         private void walkToBank(){
  377.                 isSmelting = false;
  378.                 pathToBank.traverse();
  379.                 sleep(1200, 1400);
  380.         }
  381.        
  382.         /**
  383.          * Walks to the furnace
  384.          */
  385.         private void walkToFurnace(){
  386.                 antiban();
  387.                 pathToFurnace.traverse();
  388.                 sleep(50, 150);
  389.         }
  390.        
  391.         /**
  392.          * Withdraws 27 steel bars from the bank
  393.          */
  394.         private void withdrawSteel(){
  395.                 RSObject bankObj = objects.getNearest(boothID);
  396.                 if(bank.isOpen()){
  397.                         bank.withdraw(steelID, 28);
  398.                 }else{
  399.                         if(bankObj.isOnScreen()){
  400.                                 bank.open();
  401.                         }else{
  402.                                 camera.turnTo(bankObj);
  403.                         }
  404.                 }
  405.                
  406.         }
  407.        
  408.         public void smeltBalls(){
  409.                 if(isSmelting){
  410.                         antiban();
  411.                         sleep(500, 800);
  412.                 }else{
  413.                         RSItem steelBar = inventory.getItem(steelID);
  414.                         RSObject furnace  = objects.getNearest(furnaceID);
  415.                         int animation = getMyPlayer().getAnimation();
  416.                        
  417.                         if(!inventory.contains(steelID)){
  418.                                 isSmelting = false;
  419.                                 return;
  420.                         }
  421.                        
  422.                         if(animation == -1){
  423.                                 if(steelBar == null){
  424.                                         isSmelting = false;
  425.                                         log(Color.RED, "Error: Tried to smelt cannonballs when no steel exists in inventory!");
  426.                                         return;
  427.                                 }//end if steelBar == null)
  428.                                
  429.                                 if(furnace == null){
  430.                                         isSmelting = false;
  431.                                         log(Color.RED, "Error: Could not find the furnace!");
  432.                                         return;
  433.                                 }//end if(furnace == null)
  434.                                 if(smeltInterface == null){
  435.                                         //sleep(500);
  436.                                         steelBar.interact("Use");
  437.                                         sleep(500);
  438.                                         furnace.doClick();
  439.                                         sleep(1000);
  440.                                         smeltInterface = interfaces.get(interfaceID);
  441.                                 }else{
  442.                                         if(smeltInterface.isValid()){
  443.                                                 RSComponent[] components = smeltInterface.getComponents();
  444.                                                
  445.                                                 for(RSComponent c : components){
  446.                                                         String tooltip = c.getTooltip();
  447.                                                         if(tooltip == null){
  448.                                                                
  449.                                                         }else{
  450.                                                                 if(tooltip.equals("Make All")){
  451.                                                                         c.doClick();
  452.                                                                         smeltInterface = null;
  453.                                                                         isSmelting = true;
  454.                                                                         return;
  455.                                                                 }//end if(tooltip.equals("Make All")
  456.                                                         }
  457.                                                        
  458.                                                        
  459.                                                 }//end for(RSComponent c : components)
  460.                                                
  461.                                         }else{
  462.                                                 smeltInterface = null;
  463.                                                 //log(Color.RED, "Error: Invalid Interface!");
  464.                                         }//end if(smeltInterface.isValid())
  465.                                        
  466.                                 }//end if(smeltInterface == null)
  467.                                
  468.                         }else{
  469.                                 isSmelting = true;
  470.                                 sleep(1500, 2500);
  471.                         }//end if(animation == -1)
  472.                        
  473.                 }//end if(isSmelting)
  474.         }
  475.        
  476.         public void withdrawMold(){
  477.                 RSObject bankObj = objects.getNearest(boothID);
  478.                 if(bankObj != null){
  479.                         if(bank.isOpen()){
  480.                                 if(bank.getItem(moldID) != null){
  481.                                         bank.withdraw(moldID, 1);
  482.                                 }else{
  483.                                         log(Color.RED, "Error: No molds found in the inventory or bank! Please obtain a mold and try again");
  484.                                         stopScript();
  485.                                 }
  486.                         }else{
  487.                                 if(bankObj.isOnScreen()){
  488.                                         bank.open();
  489.                                 }else{
  490.                                         camera.turnTo(bankObj);
  491.                                 }
  492.                         }
  493.                 }else{
  494.                         log(Color.RED, "Error: Bank does not exist.");
  495.                 }
  496.                
  497.                 sleep(500, 100);
  498.         }
  499.  
  500.         public void antiban(){
  501.                 int rand = random(0, 50);
  502.                 switch(rand){
  503.                 case 1:
  504.                         totalAntibans++;
  505.                         mouse.moveRandomly(1500);
  506.                         break;
  507.                 case 6:
  508.                         totalAntibans++;
  509.                         camera.turnTo(getMyPlayer());
  510.                         sleep(50, 200);
  511.                         break;
  512.                 case 9:
  513.                         totalAntibans++;
  514.                         camera.moveRandomly(random(50, 200));
  515.                         break;
  516.                 case 15:
  517.                         totalAntibans++;
  518.                         mouse.moveOffScreen();
  519.                         break;
  520.                 case 16:
  521.                         totalAntibans++;
  522.                         game.openTab(Tab.STATS);
  523.                         skills.doHover(Skills.SMITHING);
  524.                         sleep(50, 200);
  525.                         mouse.move(random(100, 400), random(0, 500));
  526.                         break;
  527.                 case 19:
  528.                         totalAntibans++;
  529.                         mouse.setSpeed(8);
  530.                         sleep(10);
  531.                         mouse.moveRandomly(65);
  532.                         sleep(20, 40);
  533.                         mouse.hop(200, 178);
  534.                         sleep(5000);
  535.                         break;
  536.                 case 24:
  537.                         totalAntibans++;
  538.                         game.openTab(Tab.STATS);
  539.                         sleep(50, 100);
  540.                         skills.doHover(Skills.SMITHING);
  541.                         sleep(100, 1000);
  542.                         mouse.move(random(25, 150), 385);
  543.                         break;
  544.                 case 35:
  545.                         totalAntibans++;
  546.                         camera.setPitch(85);
  547.                         sleep(1, 20);
  548.                         camera.setPitch(60);
  549.                         break;
  550.                 case 41:
  551.                         totalAntibans++;
  552.                         mouse.moveRandomly(random(10, 500));
  553.                         break;
  554.                 case 48:
  555.                         totalAntibans++;
  556.                         camera.setPitch(100);
  557.                         break;
  558.                 }
  559.         }
  560.        
  561.         /*
  562.         * @Author Spring
  563.         *
  564.         * Thank you Spring for this method :P
  565.         */
  566.                 private int loadPrice(final int itemID) {
  567.                         int price = 0;
  568.                         boolean nextLine = false;
  569.                         boolean kill = false;
  570.                         try {
  571.                                 final URL url = new URL(
  572.                                                 "http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj="
  573.                                                                 + itemID);
  574.                                 final BufferedReader reader = new BufferedReader(
  575.                                                 new InputStreamReader(url.openStream()));
  576.                                 String line;
  577.                                 while ((line = reader.readLine()) != null && !kill) {
  578.                                         if (nextLine) {
  579.                                                 line = line.replace("<td>", "");
  580.                                                 line = line.replace("</td>", "");
  581.                                                 line = line.replace(".", "");
  582.                                                 line = line.replace(",", "");
  583.                                                 if (line.contains("k")) {
  584.                                                         line = line.replace(".", "");
  585.                                                         line = line.replace("k", "");
  586.                                                         price = Integer.parseInt(line) * 100;
  587.                                                 } else if (line.contains("m")) {
  588.                                                         line = line.replace(".", "");
  589.                                                         line = line.replace("m", "");
  590.                                                         price = Integer.parseInt(line) * 100000;
  591.                                                 } else {
  592.                                                         price = Integer.parseInt(line);
  593.                                                 }
  594.                                                 kill = true;
  595.                                         }
  596.                                         if (line.contains("Current guide price:"))
  597.                                                 nextLine = true;
  598.                                 }
  599.                         } catch (final Exception ignored) {
  600.                         }
  601.                         return price;
  602.                 }
  603.        
  604.         @Override
  605.         public void messageReceived(MessageEvent m) {
  606.                 String message = m.getMessage();
  607.                 if(message.contains("You remove the cannonballs")){
  608.                         ballsMade += 4;
  609.                 }
  610.         }
  611.  
  612.         @Override
  613.         public void onRepaint(Graphics arg0) {
  614.                 Graphics2D g = (Graphics2D) arg0;
  615.                 long runTime = System.currentTimeMillis() - startTime;
  616.                 long expGain = skills.getCurrentExp(Skills.SMITHING) - startingExp;
  617.                 long millis = System.currentTimeMillis() - timeStart;
  618.                 levelsGained = skills.getCurrentLevel(Skills.SMITHING) - startLevel;
  619.                 profit = ((ballPrice * 4) - steelPrice) * (ballsMade / 4);
  620.  
  621.                 long temp = millis;
  622.  
  623.                 long hours = temp / 3600000;
  624.                 temp = temp - (hours * 3600000);
  625.                 long minutes = temp / 60000;
  626.                 temp = temp - (minutes * 60000);
  627.                 long seconds = temp / 1000;
  628.  
  629.                 int ballPH = (int) ((ballsMade) * 3600000.0 / runTime);
  630.                 int expPH = (int) ((expGain) * 3600000.0 / runTime);
  631.                 int profitPH =  (int) ((profit) * 3600000.0 / runTime);
  632.                                
  633.  
  634.                 g.drawImage(bgPaint, 0, 0, null);
  635.                
  636.                 g.setFont(font1);
  637.                 g.setColor(Color.WHITE);
  638.                 int x = 200;
  639.                 int y = 400;
  640.                 g.drawString("Version: " + info.version(), 5, 15);
  641.                 g.drawString("Authors: " + info.authors()[0] + " and " + info.authors()[1], 5, 30);
  642.                 g.drawString("Location: " + location, x, y);
  643.                 y += 15;
  644.                 g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, x, y);
  645.                 y += 15;
  646.                 g.drawString("Cannonballs Made: " + ballsMade, x, y);
  647.                 y += 15;
  648.                 g.drawString("Cannonballs/Hour: " + ballPH, x, y);
  649.                 y = 370;
  650.                 x += 150;
  651.                 g.drawString("Profit: " + profit, x, y);
  652.                 y += 15;
  653.                 g.drawString("Profit/Hour: " + profitPH, x, y);
  654.                 y += 15;
  655.                 g.drawString("XP Gained: " + expGain, x, y);
  656.                 y += 15;
  657.                 g.drawString("XP/Hour: " + expPH, x, y);
  658.                 y += 15;
  659.                 g.drawString("Levels Gained: " + levelsGained, x, y);
  660.                 y += 15;
  661.                 g.drawString("Current Level: " + skills.getCurrentLevel(Skills.SMITHING), x, y);
  662.                 y += 15;
  663.                 g.drawString("Total Antibans: " + totalAntibans, x, y);
  664.                 g.setFont(font1);
  665.                 g.drawString("Status: " + status, 10, 435);
  666.                 ProgressBar(10,445,183,20,2,skills.getPercentToNextLevel(Skills.SMITHING),Color.black,Color.RED,Color.GREEN,Color.BLACK,new Font("Arial",Font.PLAIN,12),arg0);
  667.         }
  668.        
  669.         private void ProgressBar(int x, int y, int width, int height, int borderThickness,int progressPercent, Color border, Color background, Color fill,Color font,Font f, Graphics g){
  670.                 g.setColor(border);
  671.                 g.fillRect(x, y, width, height);
  672.                 int nx = x+borderThickness; int ny = y+borderThickness;
  673.                 int nWidth = width-(borderThickness*2); int nHeight = height-(borderThickness*2);
  674.                 g.setColor(background);
  675.                 g.fillRect(nx, ny, nWidth, nHeight);
  676.                 int percentFill = (nWidth*progressPercent)/100;
  677.                 g.setColor(fill);
  678.                 g.fillRect(nx, ny, percentFill, nHeight);
  679.                 g.setColor(font);
  680.                 g.setFont(f);
  681.                 g.drawString(progressPercent+"% to lvl " + (skills.getCurrentLevel(Skills.SMITHING) + 1),nx+ (nWidth/2)-40, ny+(nHeight/2)+(f.getSize()/2)-1);
  682.         }
  683. }