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

ConnectScripts

By: a guest on Aug 20th, 2012  |  syntax: None  |  size: 35.73 KB  |  hits: 14  |  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.*;
  2.  
  3. import javax.swing.*;
  4.  
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import java.awt.event.MouseEvent;
  8. import java.awt.event.MouseListener;
  9. import org.powerbot.concurrent.Task;
  10. import org.powerbot.concurrent.strategy.Strategy;
  11. import org.powerbot.game.api.ActiveScript;
  12. import org.powerbot.game.api.Manifest;
  13. import org.powerbot.game.api.methods.Calculations;
  14. import org.powerbot.game.api.methods.Tabs;
  15. import org.powerbot.game.api.methods.Walking;
  16. import org.powerbot.game.api.methods.Widgets;
  17. import org.powerbot.game.api.methods.input.Mouse;
  18. import org.powerbot.game.api.methods.interactive.NPCs;
  19. import org.powerbot.game.api.methods.interactive.Players;
  20. import org.powerbot.game.api.methods.node.GroundItems;
  21. import org.powerbot.game.api.methods.tab.Inventory;
  22. import org.powerbot.game.api.methods.tab.Skills;
  23. import org.powerbot.game.api.methods.widget.Camera;
  24. import org.powerbot.game.api.util.Random;
  25. import org.powerbot.game.api.util.Time;
  26. import org.powerbot.game.api.wrappers.interactive.NPC;
  27. import org.powerbot.game.api.wrappers.node.GroundItem;
  28. import org.powerbot.game.api.wrappers.node.Item;
  29. import org.powerbot.game.bot.event.listener.PaintListener;
  30.  
  31. @Manifest(authors = { "3G_Connection" }, name = "ConnectMonks", description = "Kills and heals, all at Monks. :)", version = 0.01)
  32. public class ConnectMonks extends ActiveScript implements PaintListener,
  33.                 MouseListener {
  34.  
  35.         private int MONK_ID = 7727;
  36.         private int HEAD_MONK_ID = 801;
  37.         private int TICKET_ID = 24154;
  38.         private int BONES_ID = 526;
  39.  
  40.         private boolean bury = false;
  41.  
  42.         public boolean GuiIsDone = false;
  43.         public JFrame Gui;
  44.  
  45.         private int kills;
  46.         private int heals;
  47.         private int healsHour;
  48.  
  49.         String Status = "Starting up";
  50.  
  51.         private int expGained;
  52.         private int expHour;
  53.         private int expTNL;
  54.         private String training;
  55.         private String SkillNames[] = { "Attack", "Strength", "Defense", "Ranged" };
  56.         private int SkillConstants[] = { Skills.ATTACK, Skills.STRENGTH,
  57.                         Skills.DEFENSE, Skills.RANGE };
  58.         private int startxp[] = { 0, 0, 0, 0 };
  59.         private int startlvl[] = { 0, 0, 0, 0 };
  60.         private int lvlGained;
  61.         private int killsHour;
  62.         private int hpExpGained;
  63.         private int hpLvlGained;
  64.         private int hpExpStart;
  65.         private int hpLvlStart;
  66.         private int hpExpHour;
  67.         private int hpExpTNL;
  68.         private int hpLvl;
  69.  
  70.         public long startTime = System.currentTimeMillis();
  71.  
  72.         @Override
  73.         protected void setup() {
  74.  
  75.                 startTime = System.currentTimeMillis();
  76.                 hpLvlStart = Skills.getRealLevel(Skills.CONSTITUTION);
  77.                 hpExpStart = Skills.getExperience(Skills.CONSTITUTION);
  78.                 Skills.getExperience(getTrainingSkill());
  79.  
  80.                 hpLevel = Skills.getLevel(Skills.CONSTITUTION);
  81.                 hpStartExp = Skills.getExperienceRequired(hpLevel);
  82.                 hpNextExp = Skills.getExperienceRequired(hpLevel + 1);
  83.                 hpRangeExp = hpNextExp - hpStartExp;
  84.                 hpExpToLevel = Skills.getExperienceToLevel(Skills.CONSTITUTION,
  85.                                 hpLevel + 1);
  86.                 hpExpInLevel = hpRangeExp - hpExpToLevel;
  87.                 hpPercent = (hpExpInLevel * 100) / hpRangeExp;
  88.  
  89.                 Level = Skills.getLevel(getTrainingSkill());
  90.                 StartExp = Skills.getExperienceRequired(Level);
  91.                 NextExp = Skills.getExperienceRequired(Level + 1);
  92.                 RangeExp = NextExp - StartExp;
  93.                 ExpToLevel = Skills.getExperienceToLevel(getTrainingSkill(), Level + 1);
  94.                 ExpInLevel = RangeExp - ExpToLevel;
  95.                 percent = (ExpInLevel * 100) / RangeExp;
  96.                
  97.                 try {
  98.                         SwingUtilities.invokeLater(new Runnable() {
  99.                                 public void run() {
  100.                                         GUI gui = new GUI();
  101.                                         gui.setVisible(true);
  102.                                 }
  103.                         });
  104.                 } catch (Exception e) {
  105.                         e.printStackTrace();
  106.                 }
  107.        
  108.                 provide(new Strategy(new Attack(), new Attack()));
  109.                 provide(new Strategy(new Heal(), new Heal()));
  110.                 provide(new Strategy(new Bury(), new Bury()));
  111.                 provide(new Strategy(new Loot(), new Loot()));
  112.                 provide(new Strategy(new Antiban(), new Antiban()));
  113.  
  114.                
  115.         }
  116.  
  117.         public class Attack extends Strategy implements Task {
  118.  
  119.                 @Override
  120.                 public void run() {
  121.                         if (Players.getLocal().getHpPercent() >= 85) {
  122.                                 NPC monk = NPCs.getNearest(MONK_ID);
  123.                                 if (monk != null) {
  124.                                         if (!monk.isOnScreen()) {
  125.                                                 Camera.turnTo(monk.getLocation());
  126.                                                 if (!monk.isOnScreen()) {
  127.                                                         Walking.walk(monk.getLocation());
  128.                                                         Time.sleep(Random.nextInt(3000, 3500));
  129.                                                 }
  130.                                         }
  131.                                 }
  132.                                 if (!monk.isInCombat()
  133.                                                 && Players.getLocal().getAnimation() != -1) {
  134.                                         monk.hover();
  135.                                 } else {
  136.                                         if (!monk.isInCombat()
  137.                                                         && Players.getLocal().getAnimation() == -1) {
  138.                                                 monk.interact("Attack");
  139.                                                 Status = "Attacking";
  140.                                                 Time.sleep(Random.nextInt(400, 500));
  141.  
  142.                                                 if (Players.getLocal().getInteracting().getHpPercent() == 0);
  143.                                                 kills++;
  144.                                         }
  145.                                 }
  146.                         }
  147.                 }
  148.  
  149.                 @Override
  150.                 public boolean validate() {
  151.                         return Players.getLocal().getAnimation() == -1 && GuiIsDone;
  152.                 }
  153.  
  154.         }
  155.  
  156.         public class Heal extends Strategy implements Task {
  157.  
  158.                 @Override
  159.                 public void run() {
  160.                         Status = "Healing";
  161.                         NPC headMonk = NPCs.getNearest(HEAD_MONK_ID);
  162.                         if (headMonk != null)   {
  163.                                 if (!headMonk.isOnScreen()) {
  164.                                         Walking.walk(headMonk.getLocation());
  165.                                         Time.sleep(Random.nextInt(4500, 5500));
  166.                                         Camera.turnTo(headMonk);
  167.                                         headMonk.click(true);
  168.                                         if (!headMonk.isOnScreen()) {
  169.                                                 Walking.walk(headMonk.getLocation());
  170.                                         } else {
  171.                                                 headMonk.interact("Talk-to");
  172.                                                 Time.sleep(Random.nextInt(2500, 3000));
  173.                                                 if (Widgets.canContinue()) {
  174.                                                         Widgets.clickContinue();
  175.                                                         Time.sleep(Random.nextInt(500, 1250));
  176.                                                         Widgets.get(1188, 3).click(true);
  177.                                                         Time.sleep(Random.nextInt(550, 1000));
  178.                                                         Widgets.clickContinue();
  179.                                                         Time.sleep(Random.nextInt(650, 950));
  180.                                                         Widgets.clickContinue();
  181.                                                         Time.sleep(Random.nextInt(600, 1100));
  182.                                                         if (Widgets.canContinue()) {
  183.                                                                 Widgets.clickContinue();
  184.                                                                 Time.sleep(Random.nextInt(1000, 2000));
  185.                                                                 heals++;
  186.                                                         }
  187.                                                 }
  188.                                         }
  189.                                 }
  190.                         }
  191.                 }
  192.  
  193.                 @Override
  194.                 public boolean validate() {
  195.                         return Players.getLocal().getHpPercent() <= 40 && GuiIsDone;
  196.                 }
  197.         }
  198.  
  199.         public class Bury extends Strategy implements Task {
  200.  
  201.                 @Override
  202.                 public void run() {
  203.                         for (final Item bones : Inventory.getItems()) {
  204.                                 if (bones.getId() == BONES_ID
  205.                                                 && bones.getWidgetChild().interact("Bury")) {
  206.                                         Time.sleep(Random.nextInt(750, 1000));
  207.                                 }
  208.                         }
  209.                 }
  210.  
  211.                 @Override
  212.                 public boolean validate() {
  213.                         return Inventory.getCount() == 28 && GuiIsDone
  214.                                         && bury == true;
  215.                 }
  216.         }
  217.  
  218.         private class Loot extends Strategy implements Task {
  219.  
  220.                 @Override
  221.                 public void run() {
  222.                         Status = "Getting Ticket";
  223.                         if (GroundItems.getNearest(TICKET_ID) != null) {
  224.                                 GroundItem ticket = GroundItems.getNearest(TICKET_ID);
  225.                                 if (ticket != null) {
  226.                                         ticket.interact("Take");
  227.                                         if (Tabs.getCurrent() != Tabs.INVENTORY) {
  228.                                                 Tabs.INVENTORY.open();
  229.                                         } else {
  230.                                                 if (Tabs.getCurrent() == Tabs.INVENTORY) {
  231.                                                         ticket.interact("Claim");
  232.                                                 }
  233.                                         }
  234.                                 }
  235.                         }
  236.  
  237.                         if (bury = true) {
  238.                                 GroundItem bones = GroundItems.getNearest(BONES_ID);
  239.                                 if (bones != null) {
  240.                                         if (Calculations.distanceTo(bones) < 5) {
  241.                                                 bones.interact("Take");
  242.                                                 Time.sleep(Random.nextInt(1500, 3000));
  243.                                         }
  244.                                 }
  245.                         }
  246.                 }
  247.  
  248.                 @Override
  249.                 public boolean validate() {
  250.                         return !Players.getLocal().isInCombat() && GuiIsDone
  251.                                         && Inventory.getCount() != 28;
  252.                 }
  253.         }
  254.  
  255.         private class Antiban extends Strategy implements Task {
  256.  
  257.                 @Override
  258.                 public void run() {
  259.                         Status = "Antiban";
  260.                         switch (Random.nextInt(1, 20)) {
  261.                         case 1:
  262.                                 Camera.setAngle(Random.nextInt(1, 360));
  263.                                 break;
  264.  
  265.                         case 2:
  266.                                 Camera.setPitch(Random.nextInt(1, 360));
  267.                                 break;
  268.  
  269.                         case 3:
  270.                                 Camera.setAngle(Random.nextInt(350, 500));
  271.                                 break;
  272.  
  273.                         case 4:
  274.                                 Camera.setPitch(Random.nextInt(350, 500));
  275.                                 break;
  276.  
  277.                         case 5:
  278.                                 Mouse.move(Random.nextInt(0, 250), Random.nextInt(0, 250));
  279.                                 break;
  280.                                
  281.                         case 6:
  282.                                 Mouse.move(Random.nextInt(250, 500), Random.nextInt(250, 500));
  283.                                 break;
  284.                                
  285.                         case 7:
  286.                                 Tabs.STATS.open();
  287.                                 break;
  288.                                
  289.                         case 8:
  290.                                 Tabs.INVENTORY.open();
  291.                                 break;
  292.                                
  293.                         case 9:
  294.                                 Widgets.get(548).getChild(14).click(true);
  295.                                 break;
  296.                                
  297.                         case 10:
  298.                         case 11:
  299.                                 if (Tabs.getCurrent() != Tabs.STATS)
  300.                                         Tabs.STATS.open();
  301.                                 Widgets.get(320).getChild(2).hover();
  302.                                 break;
  303.                                
  304.                         case 12:
  305.                         case 13:
  306.                                 if (Tabs.getCurrent() != Tabs.STATS)
  307.                                         Tabs.STATS.open();
  308.                                 Widgets.get(320).getChild(4).hover();
  309.                                 break;
  310.                         }
  311.                 }
  312.  
  313.                 @Override
  314.                 public boolean validate() {
  315.                         return Players.getLocal().getAnimation() != -1 && GuiIsDone;
  316.                 }
  317.  
  318.         }
  319.  
  320.         private int getTrainingSkill() {
  321.                 for (int i = 0; i < SkillConstants.length; i++) {
  322.                         if (Skills.getExperience(SkillConstants[i]) > startxp[i]) {
  323.                                 training = SkillNames[i];
  324.                                 return SkillConstants[i];
  325.                         }
  326.                 }
  327.                 return -1;
  328.         }
  329.  
  330.         private int getStartxp(int i) {
  331.                 for (int g = 0; g < SkillConstants.length; g++) {
  332.                         if (i == SkillConstants[g]) {
  333.                                 return startxp[g];
  334.                         }
  335.                 }
  336.                 return -1;
  337.         }
  338.  
  339.         private int getStartLvl(int i) {
  340.                 for (int g = 0; g < SkillConstants.length; g++) {
  341.                         if (i == SkillConstants[g]) {
  342.                                 return startlvl[g];
  343.                         }
  344.                 }
  345.                 return -1;
  346.         }
  347.  
  348.         int hpLevel;
  349.         int hpStartExp;
  350.         int hpNextExp;
  351.         int hpRangeExp;
  352.         int hpExpToLevel;
  353.         int hpExpInLevel;
  354.         int hpPercent;
  355.  
  356.         int Level;
  357.         int StartExp;
  358.         int NextExp;
  359.         int RangeExp;
  360.         int ExpToLevel;
  361.         int ExpInLevel;
  362.         int percent;
  363.  
  364.         private double getXpHour(double expGained) {
  365.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * expGained);
  366.         }
  367.  
  368.         private double getKillsHour(double kills) {
  369.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * kills);
  370.         }
  371.  
  372.         private double getHealsHour(double heals) {
  373.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * heals);
  374.         }
  375.  
  376.         private double getHpExpHour(double hpExpGained) {
  377.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * hpExpGained);
  378.         }
  379.  
  380.         /*
  381.          * ---------------------------------PAINT-----------------------------------
  382.          */
  383.  
  384.         private final Color color1 = new Color(0, 0, 0, 179);
  385.         private final Color color2 = new Color(255, 255, 255);
  386.         private final Color color3 = new Color(204, 0, 0);
  387.         private final Color color4 = new Color(0, 0, 0);
  388.         private final Color color5 = new Color(51, 153, 0);
  389.  
  390.         private final BasicStroke stroke1 = new BasicStroke(1);
  391.  
  392.         private final Font font1 = new Font("Arial", 1, 12);
  393.         private final Font font2 = new Font("Arial", 0, 9);
  394.  
  395.         @Override
  396.         public void onRepaint(Graphics g1) {
  397.  
  398.                 long millis = System.currentTimeMillis() - startTime;
  399.                 long hours = millis / (1000 * 60 * 60);
  400.                 millis -= hours * (1000 * 60 * 60);
  401.                 long minutes = millis / (1000 * 60);
  402.                 millis -= minutes * (1000 * 60);
  403.                 long seconds = millis / 1000;
  404.  
  405.                 expGained = (Skills.getExperience(getTrainingSkill()) - getStartxp(getTrainingSkill()));
  406.                 expHour = (int) getXpHour(expGained);
  407.                 lvlGained = (Skills.getLevel(getTrainingSkill()) - getStartLvl(getTrainingSkill()));
  408.                 killsHour = (int) getKillsHour(kills);
  409.                 hpExpGained = (Skills.getExperience(Skills.CONSTITUTION) - hpExpStart);
  410.                 hpLvlGained = (Skills.getLevel(Skills.CONSTITUTION) - hpLvlStart);
  411.                 hpExpHour = (int) getHpExpHour(hpExpGained);
  412.                 hpExpTNL = Skills.getExperienceToLevel(Skills.CONSTITUTION,
  413.                                 (Skills.getRealLevel(Skills.CONSTITUTION) + 1));
  414.                 expTNL = Skills.getExperienceToLevel(getTrainingSkill(),
  415.                                 (Skills.getRealLevel(getTrainingSkill()) + 1));
  416.                 hpPercent = (int) ((double) Skills.getExperienceToLevel(
  417.                                 Skills.CONSTITUTION,
  418.                                 (Skills.getRealLevel(Skills.CONSTITUTION) + 1))
  419.                                 / Skills.getExperience(Skills.CONSTITUTION) * 100);
  420.                 hpLvl = Skills.getLevel(Skills.CONSTITUTION);
  421.                 hpLvlGained = (Skills.getLevel(Skills.CONSTITUTION) - hpLvlStart);
  422.                 percent = (int) ((double) Skills.getExperienceToLevel(
  423.                                 getTrainingSkill(),
  424.                                 (Skills.getRealLevel(getTrainingSkill()) + 1))
  425.                                 / Skills.getExperience(getTrainingSkill()) * 100);
  426.                 healsHour = (int) getHealsHour(heals);
  427.  
  428.                 // START: Code generated using Enfilade's Easel
  429.                 Graphics2D g = (Graphics2D) g1;
  430.                 g.setColor(color1);
  431.                 g.fillRoundRect(363, 168, 153, 169, 16, 16);
  432.                 g.setFont(font1);
  433.                 g.setColor(color2);
  434.                 g.drawString("ConnectMonks", 401, 185);
  435.                 g.setFont(font2);
  436.                 g.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, 370,
  437.                                 210);
  438.                 g.drawString("Training: " + training, 370, 230);
  439.                 g.drawString("Kills: " + kills, 370, 250);
  440.                 g.drawString("Kills/Hr: " + killsHour, 370, 270);
  441.                 g.drawString("Heals: " + heals, 370, 290);
  442.                 g.drawString("Heals/Hr: " + healsHour, 370, 310);
  443.                 g.drawString("Status: " + Status, 370, 330);
  444.                 g.drawString("HP: " + hpExpGained + " Exp " + hpExpHour + "/Hr" + "|| "
  445.                                 + hpPercent + "% " + hpExpTNL + " TNL" + "|| Lvl: " + hpLvl
  446.                                 + " Gained: " + hpLvlGained, 13, 305);
  447.                 g.drawString("" + training + ": " + expGained + "Exp " + expHour
  448.                                 + "/Hr" + "|| " + percent + "% " + expTNL + " TNL" + "|| Lvl: "
  449.                                 + getTrainingSkill() + " Gained: " + lvlGained, 13, 330);
  450.                 g.setColor(color3);
  451.                 g.fillRoundRect(4, 315, 350, 22, 16, 16);
  452.                 g.setColor(color4);
  453.                 g.setStroke(stroke1);
  454.                 g.drawRoundRect(4, 315, 350, 22, 16, 16);
  455.                 g.setColor(color5);
  456.                 g.fillRoundRect(4, 315, (30 * (hpPercent / 10)), 22, 16, 16);
  457.                 g.setColor(color4);
  458.                 g.drawRoundRect(4, 315, 300, 22, 16, 16);
  459.                 g.setColor(color3);
  460.                 g.fillRoundRect(4, 290, 350, 22, 16, 16);
  461.                 g.setColor(color4);
  462.                 g.drawRoundRect(4, 290, 350, 22, 16, 16);
  463.                 g.setColor(color5);
  464.                 g.fillRoundRect(4, 290, (35 * (percent / 10)), 22, 16, 16);
  465.                 g.setColor(color4);
  466.                 g.drawRoundRect(4, 290, 295, 22, 16, 16);
  467.                 // END: Code generated using Enfilade's Easel
  468.         }
  469.  
  470.         @Override
  471.         public void mouseClicked(MouseEvent e) {
  472.         }
  473.  
  474.         @Override
  475.         public void mouseEntered(MouseEvent arg0) {
  476.  
  477.         }
  478.  
  479.         @Override
  480.         public void mouseExited(MouseEvent arg0) {
  481.  
  482.         }
  483.  
  484.         @Override
  485.         public void mousePressed(MouseEvent arg0) {
  486.  
  487.         }
  488.  
  489.         @Override
  490.         public void mouseReleased(MouseEvent arg0) {
  491.  
  492.         }
  493.  
  494.         public class GUI extends JFrame {
  495.  
  496.                 private static final long serialVersionUID = 1L;
  497.  
  498.                 public GUI() {
  499.                         this.setVisible(true);
  500.                         initComponents();
  501.                 }
  502.  
  503.                 private void initComponents() {
  504.                         // JFormDesigner - Component initialization - DO NOT MODIFY
  505.                         // //GEN-BEGIN:initComponents
  506.                         startButton = new JButton();
  507.                         optionSelect = new JComboBox();
  508.                         title = new JLabel();
  509.  
  510.                         // ======== this ========
  511.                         Container contentPane = getContentPane();
  512.  
  513.                         // ---- button1 ----
  514.                         startButton.setText("Start!");
  515.                         startButton.addActionListener(new ActionListener() {
  516.                                 public void actionPerformed(ActionEvent e) {
  517.                                         startButtonClick(e);
  518.                                 }
  519.  
  520.                         });
  521.  
  522.                         // ---- comboBox1 ----
  523.                         optionSelect.setModel(new DefaultComboBoxModel(new String[] {
  524.                                         "Leave Bones", "Burying Bones" }));
  525.  
  526.                         // ---- label1 ----
  527.                         title.setText("ConnectMonks");
  528.                         title.setHorizontalAlignment(SwingConstants.CENTER);
  529.                         title.setFont(new Font("Malayalam MN", Font.PLAIN, 28));
  530.  
  531.                         GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  532.                         contentPane.setLayout(contentPaneLayout);
  533.                         contentPaneLayout
  534.                                         .setHorizontalGroup(contentPaneLayout
  535.                                                         .createParallelGroup()
  536.                                                         .addGroup(
  537.                                                                         contentPaneLayout
  538.                                                                                         .createSequentialGroup()
  539.                                                                                         .addContainerGap()
  540.                                                                                         .addGroup(
  541.                                                                                                         contentPaneLayout
  542.                                                                                                                         .createParallelGroup()
  543.                                                                                                                         .addComponent(
  544.                                                                                                                                         optionSelect,
  545.                                                                                                                                         GroupLayout.DEFAULT_SIZE,
  546.                                                                                                                                         203,
  547.                                                                                                                                         Short.MAX_VALUE)
  548.                                                                                                                         .addComponent(
  549.                                                                                                                                         title,
  550.                                                                                                                                         GroupLayout.DEFAULT_SIZE,
  551.                                                                                                                                         GroupLayout.DEFAULT_SIZE,
  552.                                                                                                                                         Short.MAX_VALUE)
  553.                                                                                                                         .addComponent(
  554.                                                                                                                                         startButton,
  555.                                                                                                                                         GroupLayout.DEFAULT_SIZE,
  556.                                                                                                                                         203,
  557.                                                                                                                                         Short.MAX_VALUE))
  558.                                                                                         .addContainerGap()));
  559.                         contentPaneLayout.setVerticalGroup(contentPaneLayout
  560.                                         .createParallelGroup().addGroup(
  561.                                                         GroupLayout.Alignment.TRAILING,
  562.                                                         contentPaneLayout
  563.                                                                         .createSequentialGroup()
  564.                                                                         .addGap(10, 10, 10)
  565.                                                                         .addComponent(title,
  566.                                                                                         GroupLayout.PREFERRED_SIZE, 24,
  567.                                                                                         GroupLayout.PREFERRED_SIZE)
  568.                                                                         .addGap(18, 18, 18)
  569.                                                                         .addComponent(optionSelect,
  570.                                                                                         GroupLayout.PREFERRED_SIZE,
  571.                                                                                         GroupLayout.DEFAULT_SIZE,
  572.                                                                                         GroupLayout.PREFERRED_SIZE)
  573.                                                                         .addGap(18, 18, 18)
  574.                                                                         .addComponent(startButton,
  575.                                                                                         GroupLayout.PREFERRED_SIZE, 37,
  576.                                                                                         GroupLayout.PREFERRED_SIZE)
  577.                                                                         .addContainerGap(12, Short.MAX_VALUE)));
  578.                         pack();
  579.                         setLocationRelativeTo(getOwner());
  580.                         // JFormDesigner - End of component initialization
  581.                         // //GEN-END:initComponents
  582.                 }
  583.  
  584.                 // JFormDesigner - Variables declaration - DO NOT MODIFY
  585.                 // //GEN-BEGIN:variables
  586.                 private JButton startButton;
  587.                 private JComboBox optionSelect;
  588.                 private JLabel title;
  589.  
  590.                 // JFormDesigner - End of variables declaration //GEN-END:variables
  591.  
  592.                 private void startButtonClick(ActionEvent e) {
  593.                         if (e.getActionCommand() == "Start") {
  594.                                 Gui.setVisible(false);
  595.                                 GuiIsDone = true;
  596.                         }
  597.  
  598.                         String option = optionSelect.getSelectedItem().toString();      {
  599.                                 if (option.equals("Burying Bones")) {
  600.                                         bury = true;
  601.                                 } else {
  602.                                         bury = false;
  603.                                 }
  604.                         }
  605.                 }
  606.         }
  607. }
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617. ------------------------------------------------------------------------------------------------------------
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630. import java.awt.BasicStroke;
  631. import java.awt.Color;
  632. import java.awt.Font;
  633. import java.awt.Graphics;
  634. import java.awt.Graphics2D;
  635. import java.awt.event.MouseEvent;
  636. import java.awt.event.MouseListener;
  637. import java.io.BufferedReader;
  638. import java.io.InputStreamReader;
  639. import java.net.URL;
  640. import java.net.URLConnection;
  641.  
  642. import org.powerbot.concurrent.Task;
  643. import org.powerbot.concurrent.strategy.Strategy;
  644. import org.powerbot.game.api.ActiveScript;
  645. import org.powerbot.game.api.Manifest;
  646. import org.powerbot.game.api.methods.Calculations;
  647. import org.powerbot.game.api.methods.Tabs;
  648. import org.powerbot.game.api.methods.Walking;
  649. import org.powerbot.game.api.methods.Widgets;
  650. import org.powerbot.game.api.methods.input.Mouse;
  651. import org.powerbot.game.api.methods.interactive.NPCs;
  652. import org.powerbot.game.api.methods.interactive.Players;
  653. import org.powerbot.game.api.methods.node.GroundItems;
  654. import org.powerbot.game.api.methods.node.SceneEntities;
  655. import org.powerbot.game.api.methods.tab.Inventory;
  656. import org.powerbot.game.api.methods.tab.Skills;
  657. import org.powerbot.game.api.methods.widget.Camera;
  658. import org.powerbot.game.api.util.Random;
  659. import org.powerbot.game.api.util.Time;
  660. import org.powerbot.game.api.wrappers.Area;
  661. import org.powerbot.game.api.wrappers.Tile;
  662. import org.powerbot.game.api.wrappers.interactive.NPC;
  663. import org.powerbot.game.api.wrappers.node.GroundItem;
  664. import org.powerbot.game.api.wrappers.node.Item;
  665. import org.powerbot.game.api.wrappers.node.SceneObject;
  666. import org.powerbot.game.bot.event.MessageEvent;
  667. import org.powerbot.game.bot.event.listener.MessageListener;
  668. import org.powerbot.game.bot.event.listener.PaintListener;
  669.  
  670. @Manifest(authors = { "3G Connection" }, name = "SpeedHillies", description = "Kills Hillies at Edgeville Dungeon & banks")
  671. public class ConnectHillies extends ActiveScript implements PaintListener,
  672.                 MouseListener, MessageListener {
  673.  
  674.         String Status = "Starting up";
  675.  
  676.         private int[] GIANT_ID = { 0 };
  677.         private int[] LOOT_ID = { 225, 5321, 207, 209, 211, 213, 215, 217, 2485,
  678.                         554, 564, 563, 561, 560, 1119, 12163, 12160, 12159, 12158 };
  679.         private int BONES_ID = 532;
  680.         private int LADDER_ID = 0;
  681.         private int DOOR_ID = 0;
  682.         private int BANK_ID = 0;
  683.         private int TRAPDOOR_ID = 0;
  684.         private int KEY_ID = 983;
  685.         private int FOOD_ID = 0;
  686.         private int TICKET_ID = 24154;
  687.         private int MUSICIAN_ID = 0;
  688.  
  689.         private int LIMP_ID = 225;
  690.         private int FIRE_ID = 554;
  691.         private int COSMIC_ID = 564;
  692.         private int LAW_ID = 563;
  693.         private int DEATH_ID = 560;
  694.         private int NATURE_ID = 561;
  695.         private int STEEL_PLATE_ID = 1119;
  696.         private int WATER_SEED_ID = 5321;
  697.         private int LANTADYME_ID = 2485;
  698.         private int CADANTINE_ID = 215;
  699.         private int DWARF_WEED_ID = 217;
  700.         private int KWUARM_ID = 213;
  701.         private int AVANTOE_ID = 211;
  702.         private int IRIT_ID = 209;
  703.         private int RANARR_ID = 207;
  704.  
  705.         private int bonesPrice, limpPrice, firePrice, cosmicPrice, lawPrice,
  706.                         deathPrice, naturePrice, steelPlatePrice, watermelonSeedPrice,
  707.                         lantadymePrice, cadantinePrice, dwarfWeedPrice, kwuarmPrice,
  708.                         avantoePrice, iritPrice, ranarrPrice;
  709.  
  710.         private int money;
  711.         private int moneyHour;
  712.         private int expHour;
  713.         private int expGained;
  714.         private int expTNL;
  715.         private int hpExpHour;
  716.         private int hpExpGained;
  717.         private int hpExpTNL;
  718.         private int hpLvlStart;
  719.         private int hpExpStart;
  720.         private int hpLvlGained;
  721.         private int hpLvl;
  722.         private int lvlGained;
  723.         private String training;
  724.         private String SkillNames[] = { "Attack", "Strength", "Defense", "Ranged" };
  725.         private int SkillConstants[] = { Skills.ATTACK, Skills.STRENGTH,
  726.                         Skills.DEFENSE, Skills.RANGE };
  727.         private int startxp[] = { 0, 0, 0, 0 };
  728.         private int startlvl[] = { 0, 0, 0, 0 };
  729.         private int kills;
  730.         private int killsHour;
  731.  
  732.         public long startTime = System.currentTimeMillis();
  733.  
  734.         int before;
  735.         int count = Inventory.getCount(BONES_ID);
  736.  
  737.         Area BANK_AREA = new Area(new Tile[] { new Tile(3178, 3446, 0),
  738.                         new Tile(3178, 3431, 0), new Tile(3193, 3431, 0),
  739.                         new Tile(3193, 3446, 0) });
  740.  
  741.         Area ROOM_AREA = new Area(new Tile[] { new Tile(3112, 3453, 0),
  742.                         new Tile(3112, 3450, 0), new Tile(3117, 3450, 0),
  743.                         new Tile(3117, 3453, 0) });
  744.  
  745.         private final Area HILLY_AREA = new Area(new Tile[] { new Tile(1, 2, 0) });
  746.  
  747.         @Override
  748.         protected void setup() {
  749.  
  750.                 startTime = System.currentTimeMillis();
  751.                 hpLvlStart = Skills.getRealLevel(Skills.CONSTITUTION);
  752.                 hpExpStart = Skills.getExperience(Skills.CONSTITUTION);
  753.                 Skills.getExperience(getTrainingSkill());
  754.  
  755.                 bonesPrice = getPrice(BONES_ID);
  756.                 limpPrice = getPrice(LIMP_ID);
  757.                 firePrice = getPrice(FIRE_ID);
  758.                 cosmicPrice = getPrice(COSMIC_ID);
  759.                 lawPrice = getPrice(LAW_ID);
  760.                 deathPrice = getPrice(DEATH_ID);
  761.                 naturePrice = getPrice(NATURE_ID);
  762.                 steelPlatePrice = getPrice(STEEL_PLATE_ID);
  763.                 watermelonSeedPrice = getPrice(WATER_SEED_ID);
  764.                 lantadymePrice = getPrice(LANTADYME_ID);
  765.                 cadantinePrice = getPrice(CADANTINE_ID);
  766.                 dwarfWeedPrice = getPrice(DWARF_WEED_ID);
  767.                 kwuarmPrice = getPrice(KWUARM_ID);
  768.                 avantoePrice = getPrice(AVANTOE_ID);
  769.                 iritPrice = getPrice(IRIT_ID);
  770.                 ranarrPrice = getPrice(RANARR_ID);
  771.  
  772.                 hpLevel = Skills.getLevel(Skills.CONSTITUTION);
  773.                 hpStartExp = Skills.getExperienceRequired(hpLevel);
  774.                 hpNextExp = Skills.getExperienceRequired(hpLevel + 1);
  775.                 hpRangeExp = hpNextExp - hpStartExp;
  776.                 hpExpToLevel = Skills.getExperienceToLevel(Skills.CONSTITUTION,
  777.                                 hpLevel + 1);
  778.                 hpExpInLevel = hpRangeExp - hpExpToLevel;
  779.                 hpPercent = (hpExpInLevel * 100) / hpRangeExp;
  780.  
  781.                 Level = Skills.getLevel(getTrainingSkill());
  782.                 StartExp = Skills.getExperienceRequired(Level);
  783.                 NextExp = Skills.getExperienceRequired(Level + 1);
  784.                 RangeExp = NextExp - StartExp;
  785.                 ExpToLevel = Skills.getExperienceToLevel(getTrainingSkill(), Level + 1);
  786.                 ExpInLevel = RangeExp - ExpToLevel;
  787.                 percent = (ExpInLevel * 100) / RangeExp;
  788.  
  789.                 provide(new WalkingPath());
  790.                 provide(new Attack());
  791.                 provide(new Loot());
  792.                 provide(new Bank());
  793.                 provide(new Antiban());
  794.  
  795.         }
  796.  
  797.         public int getPrice(int id) {
  798.                 try {
  799.                         String price;
  800.                         URL url = new URL(
  801.                                         "http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj="
  802.                                                         + id);
  803.                         URLConnection con = url.openConnection();
  804.                         BufferedReader in = new BufferedReader(new InputStreamReader(
  805.                                         con.getInputStream()));
  806.                         String line;
  807.                         while ((line = in.readLine()) != null) {
  808.                                 if (line.contains("<td>")) {
  809.                                         price = line.substring(line.indexOf(">") + 1,
  810.                                                         line.indexOf("/") - 1);
  811.                                         try {
  812.                                                 return Integer.parseInt(price);
  813.                                         } catch (NumberFormatException e) {
  814.                                                 return 0;
  815.                                         }
  816.                                 }
  817.                         }
  818.                 } catch (Exception e) {
  819.                         e.printStackTrace();
  820.                 }
  821.                 return 0;
  822.         }
  823.  
  824.         public class WalkingPath extends Strategy implements Task {
  825.  
  826.                 @Override
  827.                 public void run() {
  828.                         Status = "Walking";
  829.                         if (Inventory.getCount() == 28
  830.                                         && HILLY_AREA.contains(Players.getLocal())) {
  831.                                 SceneObject ladder = SceneEntities.getNearest(LADDER_ID);
  832.                                 if (ladder != null) {
  833.                                         Walking.walk(ladder);
  834.                                         if (Inventory.getCount() == 28
  835.                                                         && ROOM_AREA.contains(Players.getLocal())) {
  836.                                                 SceneObject door = SceneEntities.getNearest(DOOR_ID);
  837.                                                 Walking.walk(door);
  838.                                                 if (door != null) {
  839.                                                         if (door.isOnScreen()) {
  840.                                                                 door.interact("Open");
  841.                                                                 if (!door.isOnScreen()
  842.                                                                                 && ROOM_AREA.contains(Players
  843.                                                                                                 .getLocal())) {
  844.                                                                         Camera.turnTo(door);
  845.                                                                 }
  846.                                                         }
  847.                                                 }
  848.                                         }
  849.  
  850.                                         if (Inventory.getCount() != 28
  851.                                                         && ROOM_AREA.contains(Players.getLocal())) {
  852.                                                 SceneObject trapdoor = SceneEntities
  853.                                                                 .getNearest(TRAPDOOR_ID);
  854.                                                 if (trapdoor != null) {
  855.                                                         trapdoor.interact("Go down");
  856.                                                 }
  857.                                         }
  858.                                         if (Inventory.getCount() != 28
  859.                                                         && BANK_AREA.contains(Players.getLocal())) {
  860.                                                 NPC musician = NPCs.getNearest(MUSICIAN_ID);
  861.                                                 if (Calculations.distanceTo(musician) >= 5) {
  862.                                                         Walking.findPath(musician).traverse();
  863.                                                         musician.interact("Rest");
  864.                                                 }
  865.                                         }
  866.                                         if (Inventory.getCount() != 28) {
  867.                                                 NPC musician = NPCs.getNearest(MUSICIAN_ID);
  868.                                                 SceneObject door = SceneEntities.getNearest(DOOR_ID);
  869.                                                 if (musician.isOnScreen() && Walking.getEnergy() == 100) {
  870.                                                         Walking.findPath(door).traverse();
  871.                                                         door.interact("Open");
  872.                                                 }
  873.                                         }
  874.                                 }
  875.                         }
  876.                 }
  877.         }
  878.  
  879.         public class Attack extends Strategy implements Task {
  880.  
  881.                 @Override
  882.                 public void run() {
  883.                         if (Inventory.getCount() != 28) {
  884.                                 NPC hilly = NPCs.getNearest(GIANT_ID);
  885.                                 if (hilly != null) {
  886.                                         if (hilly.isOnScreen() && !hilly.isInCombat()
  887.                                                         && Calculations.distanceTo(hilly) <= 8) {
  888.                                                 hilly.interact("Attack");
  889.                                                 Status = "Fighting";
  890.                                         } else {
  891.                                                 if (!hilly.isOnScreen()
  892.                                                                 && HILLY_AREA.contains(Players.getLocal())) {
  893.                                                         Camera.turnTo(hilly);
  894.                                                 }
  895.                                         }
  896.                                 } else {
  897.                                         if (Players.getLocal().isInCombat()) {
  898.                                                 Time.sleep(Random.nextInt(2000, 4000));
  899.                                                 if (Players.getLocal().getInteracting().getHpPercent() == 0) {
  900.                                                         kills++;
  901.                                                 }
  902.                                         }
  903.                                 }
  904.                         }
  905.                 }
  906.         }
  907.  
  908.         public class Loot extends Strategy implements Task {
  909.  
  910.                 @Override
  911.                 public void run() {
  912.                         Status = "Looting";
  913.                         GroundItem ticket = GroundItems.getNearest(TICKET_ID);
  914.                         if (ticket != null) {
  915.                                 if (ticket.isOnScreen()) {
  916.                                         ticket.interact("Take");
  917.                                         Time.sleep(Random.nextInt(500, 750));
  918.                                         if (!Tabs.INVENTORY.isOpen()) {
  919.                                                 Tabs.INVENTORY.open();
  920.                                                 ticket.interact("Claim");
  921.  
  922.                                         }
  923.                                 }
  924.                         }
  925.  
  926.                         if (Players.getLocal().isInCombat()) {
  927.                                 Time.sleep(Random.nextInt(1500, 2500));
  928.                                 if (!Players.getLocal().isInCombat()) {
  929.                                         GroundItem loot = GroundItems.getNearest(LOOT_ID);
  930.                                         GroundItem bone = GroundItems.getNearest(BONES_ID);
  931.                                         if (loot != null)
  932.                                                 ;
  933.                                         if (bone != null)
  934.                                                 ;
  935.                                         if (Calculations.distanceTo(bone.getLocation()) < 5) {
  936.                                                 if (Calculations.distanceTo(loot.getLocation()) < 5) {
  937.                                                         bone.interact("Take");
  938.                                                         loot.interact("Take");
  939.                                                         Time.sleep(Random.nextInt(2000, 2500));
  940.  
  941.                                                 }
  942.                                         }
  943.                                 }
  944.                         }
  945.                 }
  946.         }
  947.  
  948.         public class Bank extends Strategy implements Task {
  949.  
  950.                 @Override
  951.                 public void run() {
  952.                         SceneObject bank = SceneEntities.getNearest(BANK_ID);
  953.                         bank.interact("Bank");
  954.                         Status = "Banking";
  955.                         if (org.powerbot.game.api.methods.widget.Bank.isOpen()) {
  956.  
  957.                                 if (Inventory.getCount() == 28) {
  958.                                         org.powerbot.game.api.methods.widget.Bank
  959.                                                         .depositInventory();
  960.                                         org.powerbot.game.api.methods.widget.Bank.withdraw(KEY_ID,
  961.                                                         1);
  962.                                 }
  963.  
  964.                                 if (Players.getLocal().getHpPercent() <= 45) {
  965.                                         org.powerbot.game.api.methods.widget.Bank.withdraw(FOOD_ID,
  966.                                                         6);
  967.                                         org.powerbot.game.api.methods.widget.Bank.close();
  968.  
  969.                                         if (Tabs.getCurrent() != Tabs.INVENTORY) {
  970.                                                 if (Tabs.INVENTORY.open(true)) {
  971.                                                         Time.sleep(250, 500);
  972.                                                         for (Item i : Inventory.getItems()) {
  973.                                                                 if (i.getId() == 0) {
  974.                                                                         i.getWidgetChild().interact("Eat");
  975.  
  976.                                                                         if (Inventory.getCount(KEY_ID) == 0) {
  977.                                                                                 org.powerbot.game.api.methods.widget.Bank
  978.                                                                                                 .withdraw(KEY_ID, 1);
  979.                                                                         }
  980.                                                                 }
  981.                                                         }
  982.                                                 }
  983.                                         }
  984.                                 }
  985.                         }
  986.                 }
  987.         }
  988.  
  989.         public class Antiban extends Strategy implements Task {
  990.  
  991.                 @Override
  992.                 public void run() {
  993.                         int random = Random.nextInt(1, 20);
  994.                         switch (random) {
  995.  
  996.                         case 2:
  997.                                 if (!Tabs.STATS.isOpen()) {
  998.                                         Tabs.STATS.open();
  999.                                         Widgets.get(320).getChild(2).hover();
  1000.                                         Time.sleep(Random.nextInt(250, 500));
  1001.  
  1002.                                 }
  1003.  
  1004.                         case 5:
  1005.                                 if (Tabs.STATS.isOpen()) {
  1006.                                         Tabs.STATS.open();
  1007.                                         Widgets.get(320).getChild(getTrainingSkill()).hover();
  1008.                                         Time.sleep(Random.nextInt(250, 500));
  1009.                                 }
  1010.  
  1011.                         case 8:
  1012.                                 Camera.setAngle(Random.nextInt(50, 300));
  1013.                                 Time.sleep(Random.nextInt(250, 350));
  1014.  
  1015.                         case 11:
  1016.                                 Camera.setPitch(Random.nextInt(75, 225));
  1017.  
  1018.                         case 14:
  1019.                                 Mouse.move(Random.nextInt(150, 225), 0);
  1020.                                 Time.sleep(Random.nextInt(750, 1250));
  1021.  
  1022.                         case 16:
  1023.                                 Mouse.move(Random.nextInt(250, 350), 0);
  1024.                                 Time.sleep(Random.nextInt(500, 1000));
  1025.  
  1026.                         case 19:
  1027.                                 if (Tabs.INVENTORY.isOpen()) {
  1028.                                         Tabs.INVENTORY.open();
  1029.                                         Time.sleep(Random.nextInt(750, 1250));
  1030.  
  1031.                                 }
  1032.                         }
  1033.                 }
  1034.         }
  1035.  
  1036.         private int getTrainingSkill() {
  1037.                 for (int i = 0; i < SkillConstants.length; i++) {
  1038.                         if (Skills.getExperience(SkillConstants[i]) > startxp[i]) {
  1039.                                 training = SkillNames[i];
  1040.                                 return SkillConstants[i];
  1041.                         }
  1042.                 }
  1043.                 return -1;
  1044.         }
  1045.  
  1046.         private int getStartxp(int i) {
  1047.                 for (int g = 0; g < SkillConstants.length; g++) {
  1048.                         if (i == SkillConstants[g]) {
  1049.                                 return startxp[g];
  1050.                         }
  1051.                 }
  1052.                 return -1;
  1053.         }
  1054.  
  1055.         private int getStartLvl(int i) {
  1056.                 for (int g = 0; g < SkillConstants.length; g++) {
  1057.                         if (i == SkillConstants[g]) {
  1058.                                 return startlvl[g];
  1059.                         }
  1060.                 }
  1061.                 return -1;
  1062.         }
  1063.  
  1064.         int hpLevel;
  1065.         int hpStartExp;
  1066.         int hpNextExp;
  1067.         int hpRangeExp;
  1068.         int hpExpToLevel;
  1069.         int hpExpInLevel;
  1070.         int hpPercent;
  1071.  
  1072.         int Level;
  1073.         int StartExp;
  1074.         int NextExp;
  1075.         int RangeExp;
  1076.         int ExpToLevel;
  1077.         int ExpInLevel;
  1078.         int percent;
  1079.  
  1080.         private double getXpHour(double expGained) {
  1081.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * expGained);
  1082.         }
  1083.  
  1084.         private double getKillsHour(double kills) {
  1085.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * kills);
  1086.         }
  1087.  
  1088.         private double getHpExpHour(double hpExpGained) {
  1089.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * hpExpGained);
  1090.         }
  1091.  
  1092.         private double getMoneyHour(double money) {
  1093.                 return ((3600000.0 / (System.currentTimeMillis() - startTime)) * money);
  1094.         }
  1095.  
  1096.         // ----------------------------------- PAINT
  1097.         // ---------------------------------------- //
  1098.  
  1099.         private final Color color1 = new Color(0, 0, 0, 179);
  1100.         private final Color color2 = new Color(255, 255, 255);
  1101.         private final Color color3 = new Color(204, 0, 0);
  1102.         private final Color color4 = new Color(0, 0, 0);
  1103.         private final Color color5 = new Color(51, 153, 0);
  1104.  
  1105.         private final BasicStroke stroke1 = new BasicStroke(1);
  1106.  
  1107.         private final Font font1 = new Font("Arial", 1, 12);
  1108.         private final Font font2 = new Font("Arial", 0, 9);
  1109.  
  1110.         public void onRepaint(Graphics g1) {
  1111.  
  1112.                 money = bonesPrice + limpPrice + firePrice + cosmicPrice + lawPrice
  1113.                                 + deathPrice + naturePrice + steelPlatePrice
  1114.                                 + watermelonSeedPrice + lantadymePrice + cadantinePrice
  1115.                                 + dwarfWeedPrice + kwuarmPrice + avantoePrice + iritPrice
  1116.                                 + ranarrPrice;
  1117.                 moneyHour = (int) getMoneyHour(money);
  1118.                 expGained = (Skills.getExperience(getTrainingSkill()) - getStartxp(getTrainingSkill()));
  1119.                 expHour = (int) getXpHour(expGained);
  1120.                 lvlGained = (Skills.getLevel(getTrainingSkill()) - getStartLvl(getTrainingSkill()));
  1121.                 killsHour = (int) getKillsHour(kills);
  1122.                 hpExpGained = (Skills.getExperience(Skills.CONSTITUTION) - hpExpStart);
  1123.                 hpLvlGained = (Skills.getLevel(Skills.CONSTITUTION) - hpLvlStart);
  1124.                 hpExpHour = (int) getHpExpHour(hpExpGained);
  1125.                 hpExpTNL = Skills.getExperienceToLevel(Skills.CONSTITUTION,
  1126.                                 (Skills.getRealLevel(Skills.CONSTITUTION) + 1));
  1127.                 expTNL = Skills.getExperienceToLevel(getTrainingSkill(),
  1128.                                 (Skills.getRealLevel(getTrainingSkill()) + 1));
  1129.                 hpPercent = (int) ((double) Skills.getExperienceToLevel(
  1130.                                 Skills.CONSTITUTION,
  1131.                                 (Skills.getRealLevel(Skills.CONSTITUTION) + 1))
  1132.                                 / Skills.getExperience(Skills.CONSTITUTION) * 100);
  1133.                 hpLvl = Skills.getLevel(Skills.CONSTITUTION);
  1134.                 hpLvlGained = (Skills.getLevel(Skills.CONSTITUTION) - hpLvlStart);
  1135.                 percent = (int) ((double) Skills.getExperienceToLevel(
  1136.                                 getTrainingSkill(),
  1137.                                 (Skills.getRealLevel(getTrainingSkill()) + 1))
  1138.                                 / Skills.getExperience(getTrainingSkill()) * 100);
  1139.  
  1140.                 long millis = System.currentTimeMillis() - startTime;
  1141.                 long hours = millis / (1000 * 60 * 60);
  1142.                 millis -= hours * (1000 * 60 * 60);
  1143.                 long minutes = millis / (1000 * 60);
  1144.                 millis -= minutes * (1000 * 60);
  1145.                 long seconds = millis / 1000;
  1146.  
  1147.                 // START: Code generated using Enfilade's Easel
  1148.                 Graphics2D g = (Graphics2D) g1;
  1149.                 g.setColor(color1);
  1150.                 g.fillRoundRect(363, 168, 153, 169, 16, 16);
  1151.                 g.setFont(font1);
  1152.                 g.setColor(color2);
  1153.                 g.drawString("ConnectHillies", 401, 185);
  1154.                 g.setFont(font2);
  1155.                 g.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, 370,
  1156.                                 210);
  1157.                 g.drawString("Training: " + training, 370, 230);
  1158.                 g.drawString("Kills: " + kills, 370, 250);
  1159.                 g.drawString("Kills/Hr: " + killsHour, 370, 270);
  1160.                 g.drawString("Money: " + money, 370, 290);
  1161.                 g.drawString("Money/Hr: " + moneyHour, 370, 310);
  1162.                 g.drawString("Status: " + Status, 370, 330);
  1163.                 g.drawString("HP: " + hpExpGained + " Exp " + hpExpHour + "/Hr" + "|| "
  1164.                                 + hpPercent + "% " + hpExpTNL + " TNL" + "|| Lvl: " + hpLvl
  1165.                                 + " Gained: " + hpLvlGained, 13, 305);
  1166.                 g.drawString("" + training + ": " + expGained + "Exp " + expHour
  1167.                                 + "/Hr" + "|| " + percent + "% " + expTNL + " TNL" + "|| Lvl: "
  1168.                                 + getTrainingSkill() + " Gained: " + lvlGained, 13, 330);
  1169.                 g.setColor(color3);
  1170.                 g.fillRoundRect(4, 315, 350, 22, 16, 16);
  1171.                 g.setColor(color4);
  1172.                 g.setStroke(stroke1);
  1173.                 g.drawRoundRect(4, 315, 350, 22, 16, 16);
  1174.                 g.setColor(color5);
  1175.                 g.fillRoundRect(4, 315, (30 * (hpPercent / 10)), 22, 16, 16);
  1176.                 g.setColor(color4);
  1177.                 g.drawRoundRect(4, 315, 300, 22, 16, 16);
  1178.                 g.setColor(color3);
  1179.                 g.fillRoundRect(4, 290, 350, 22, 16, 16);
  1180.                 g.setColor(color4);
  1181.                 g.drawRoundRect(4, 290, 350, 22, 16, 16);
  1182.                 g.setColor(color5);
  1183.                 g.fillRoundRect(4, 290, (35 * (percent / 10)), 22, 16, 16);
  1184.                 g.setColor(color4);
  1185.                 g.drawRoundRect(4, 290, 295, 22, 16, 16);
  1186.                 // END: Code generated using Enfilade's Easel
  1187.  
  1188.                 /*
  1189.                  * Graphics2D g = (Graphics2D)g1;g.setColor(color);g.setFont(font);
  1190.                  * g.drawString("" + hours + ":" + minutes + ":" + seconds, 67, 408); //
  1191.                  * Timeg.drawString("" + expGained, 57, 430); // Expg.drawString("" +
  1192.                  * expHour, 77, 453); // Exp/Hrg.drawString("" + bones, 197, 408); //
  1193.                  * Bonesg.drawString("" + bonesHour, 215, 430); // Bones/Hr
  1194.                  * g.drawString("" + kills, 196, 453); // Killsg.drawString("" +
  1195.                  * killsHour, 315, 453); // Kills/Hrg.drawString("" + trips, 432, 408);
  1196.                  * // Tripsg.drawString("" + tripsHour, 450, 430); // Trips/Hr
  1197.                  * g.drawString("" + Status, 439, 453); // Statusg.drawString("" +
  1198.                  * training, 280, 378); // Training
  1199.                  */
  1200.         }
  1201.  
  1202.         @Override
  1203.         public void messageReceived(MessageEvent arg0) {
  1204.  
  1205.         }
  1206.  
  1207.         @Override
  1208.         public void mouseClicked(MouseEvent arg0) {
  1209.  
  1210.         }
  1211.  
  1212.         @Override
  1213.         public void mouseEntered(MouseEvent arg0) {
  1214.  
  1215.         }
  1216.  
  1217.         @Override
  1218.         public void mouseExited(MouseEvent arg0) {
  1219.  
  1220.         }
  1221.  
  1222.         @Override
  1223.         public void mousePressed(MouseEvent arg0) {
  1224.  
  1225.         }
  1226.  
  1227.         @Override
  1228.         public void mouseReleased(MouseEvent arg0) {
  1229.  
  1230.         }
  1231. }