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

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 66.33 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.Color;
  2. import java.awt.Container;
  3. import java.awt.Dimension;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.awt.Insets;
  8. import java.awt.Point;
  9. import java.awt.Rectangle;
  10. import java.awt.RenderingHints;
  11. import java.awt.event.ActionEvent;
  12. import java.awt.event.ActionListener;
  13. import java.awt.event.KeyEvent;
  14. import java.awt.image.BufferedImage;
  15. import java.io.IOException;
  16. import java.net.MalformedURLException;
  17. import java.net.URI;
  18. import java.net.URL;
  19. import java.text.DecimalFormat;
  20. import java.util.ArrayList;
  21. import java.util.List;
  22. import java.util.Map;
  23.  
  24. import javax.imageio.ImageIO;
  25. import javax.swing.JButton;
  26. import javax.swing.JCheckBox;
  27. import javax.swing.JFrame;
  28. import javax.swing.JLabel;
  29. import javax.swing.JPanel;
  30. import javax.swing.JRadioButton;
  31. import javax.swing.JTabbedPane;
  32. import javax.swing.JTextField;
  33. import javax.swing.border.MatteBorder;
  34. import javax.swing.border.SoftBevelBorder;
  35.  
  36. import org.rsbot.bot.Bot;
  37. import org.rsbot.bot.input.Mouse;
  38. import org.rsbot.event.events.ServerMessageEvent;
  39. import org.rsbot.event.listeners.PaintListener;
  40. import org.rsbot.event.listeners.ServerMessageListener;
  41. import org.rsbot.script.Calculations;
  42. import org.rsbot.script.Constants;
  43. import org.rsbot.script.GEItemInfo;
  44. import org.rsbot.script.Script;
  45. import org.rsbot.script.ScriptManifest;
  46. import org.rsbot.script.Timer;
  47. import org.rsbot.script.wrappers.RSCharacter;
  48. import org.rsbot.script.wrappers.RSInterface;
  49. import org.rsbot.script.wrappers.RSInterfaceChild;
  50. import org.rsbot.script.wrappers.RSInterfaceComponent;
  51. import org.rsbot.script.wrappers.RSNPC;
  52. import org.rsbot.script.wrappers.RSObject;
  53. import org.rsbot.script.wrappers.RSPlayer;
  54. import org.rsbot.script.wrappers.RSTile;
  55.  
  56. //© Scaper From http//:www.rsbot.org/vb
  57.  
  58. @ScriptManifest(authors = { "Scaper" }, category = "AAll-Scapers-Scripts", name = "graahk crafter", version = 1.4, description = "Select All Settings In GUI")
  59. public class graahkCraft extends Script implements PaintListener, ServerMessageListener {
  60.  
  61.         private graahkGUI frame;
  62.         BufferedImage normal = null;
  63.     BufferedImage clicked = null;
  64.        
  65.         public boolean startScript = false, logoutnatcraft = false, removeRing1 = false, checkspouch = false,
  66.         checkmpouch = false, checklpouch = false, checkgpouch = false, duelring = false, autoTalk = false, bankwalk = false,
  67.         altarwalk = false, decayed = false, lunar = true;
  68.         public boolean timerUsed, usedPouch, summon, summongraahk, pouchfilled, pouch,
  69.         rest, invenFull, graahktele;
  70.  
  71.         public int graahk = 7363, SHOWPAINT = 1;
  72.         public final int natID = 561, pessID = 7936, smallpouch = 5509, mediumpouch = 5510,
  73.         mediumpouchdecay = 5511, largepouch = 5512, largepouchdecay = 5513,
  74.         giantpouch = 5514, giantpouchdecay = 5515;
  75.  
  76.         final int astralRune = 9075;
  77.         final int lawRune = 563;
  78.         int natcount = 0, airRune = 556, cosmicRune = 564, failCount = 0, fatalCount = 0, lastExp = 0, ExtraTimout = 0,
  79.         lastCrafted  = 0 , natRune = 561, runesInInv = 0;
  80.         int Rune, crafted;
  81.         final int[] DEGRADED_POUCH = {-1, 5511, 5513, 5515};
  82.        
  83.  
  84.         long startTime, time, timer, estimatedHourly, scriptStartTime, tryAmount,
  85.         timeToNext, lastUpdateMillis = 0;
  86.        
  87.  
  88.         public String textread;
  89.         public String user = "TOTAL";
  90.  
  91.         public int startXP,backupbank, runs, pouchCount, ringCount, essCount,
  92.         mouseSpeedint, failcount, pouchEmpty, logoutnatcount, logoutlvl,
  93.         logouttimeh, logouttimem, naturerunecount = 0, natPrice, pessPrice,
  94.         ACTION;
  95.  
  96.         Timer bankTimer, graahkClicked, ring, wait, runTimer;
  97.  
  98.         public double updatedVersion;
  99.         public final double currentVersion = getClass().getAnnotation(
  100.                         ScriptManifest.class).version();
  101.  
  102.  
  103.         private boolean timePassed(long time) {
  104.                 return System.currentTimeMillis() > time;
  105.         }
  106.  
  107.         static int timeout = 2000;
  108.         private static final int BANK = 1;
  109.         private static final int GRAAHK = 2;
  110.         private static final int WALKTOALTAR = 3;
  111.         private static final int ENTERRUINS = 4;
  112.         private static final int CRAFT = 5;
  113.         private static final int TELEPORT = 6;
  114.         private static final int CONTACT = 7;
  115.  
  116.         RSTile[] mapPath = new RSTile[200];
  117.          RSTile natPath[] = { new RSTile(2797, 3009), new RSTile(2805, 3009), new RSTile(2814, 3009),
  118.                         new RSTile(2821, 3011), new RSTile(2829, 3015), new RSTile(2836, 3022),
  119.                         new RSTile(2843, 3027), new RSTile(2854, 3028), new RSTile(2861, 3025),
  120.                         new RSTile(2867, 3020)};
  121.         RSTile[] bankPath = { new RSTile(2444, 3083) };
  122.         RSTile[] sumPath = { new RSTile(2451, 3089), new RSTile(2462, 3087) };
  123.         RSTile[] sumToBankPath = { new RSTile(2451, 3089), new RSTile(2457, 3088),
  124.                         new RSTile(2443, 3083) };
  125.         RSTile[] altarPath = { new RSTile(2400, 4838) };
  126.         RSTile[] obeliskPath = { new RSTile(2457, 3087), new RSTile(2463, 3087) };
  127.         RSTile[] obeliskPathBack = { new RSTile(2463, 3087),
  128.                         new RSTile(2452, 3089), new RSTile(2444, 3083) };
  129.  
  130.         private final RSTile ruinTile = new RSTile(2869, 3019);
  131.         private final RSTile altarTile = new RSTile(2400, 4841);
  132.         @SuppressWarnings("unused")
  133.         private final RSTile nereAltarTile = new RSTile(2400,4839);
  134.         @SuppressWarnings("unused")
  135.         private final RSTile chestTile = new RSTile(2445,3083);
  136.  
  137.        
  138.          public int fixPouches() {
  139.                 if(canContinue()) {
  140.                     clickContinue();
  141.                 }
  142.                 if(getInterface(230).isValid()) {
  143.                         atInterface(230, 3);
  144.                         }
  145.                 if(getInterface(88) != null) {
  146.                
  147.                     Rectangle visible = getInterface(88,21).getArea();
  148.                     RSInterfaceChild mage = getInterface(88).getChild(22).getComponents()[14];
  149.                     Rectangle it = mage.getArea();
  150.                     if(visible.contains(it) && visible.contains(it)) {
  151.                         if(mage.containsAction("Speak-to")) {
  152.                             wait = new Timer(10000);
  153.                             return random(50,100);
  154.                         }
  155.  
  156.                         return random(50,100);
  157.                     }
  158.            
  159.                     RSInterfaceChild scrollBar = getInterface(88).getChild(20);
  160.                         if (scrollBar == null)
  161.                             return random(50, 100);
  162.                         Point scroll = new Point((int) scrollBar.getAbsoluteX() + random(2, 10), (int) scrollBar.getAbsoluteY() + scrollBar.getHeight() - random(40, 20));
  163.                         moveMouse(scroll);
  164.                        
  165.                             wait(random(50,100));
  166.                         clickMouse(true);
  167.                     return random(50,100);
  168.                 }
  169.                
  170.                  if (!inventoryContains(556) || !inventoryContains(564) || !inventoryContains(9075))
  171.                     return withdrawCast();
  172.  
  173.                         if(bank.isOpen())
  174.                     bank.close();
  175.                 openTab(TAB_MAGIC);
  176.                 RSInterfaceChild cast = getChildInterface(430, 26);
  177.                 atInterface(cast);
  178.                 return random(50,100);
  179.  
  180.             }
  181.          
  182.          public int withdrawCast() {
  183.  
  184.                 if(bank.isOpen())
  185.                 bank.depositAllExcept(lawRune, pessID, smallpouch, mediumpouch,
  186.                         largepouch, giantpouch);
  187.                 if (!bank.atItem(airRune, "Withdraw-1")) {
  188.                         bank.withdraw(airRune, 1);
  189.                 }
  190.                     if (!bank.atItem(cosmicRune, "Withdraw-1")) {
  191.                     bank.withdraw(9075, 1);
  192.                 }
  193.                     if (!bank.atItem(airRune, "Withdraw-1")) {
  194.                             bank.withdraw(airRune, 1);
  195.                         }
  196.                 bank.close();
  197.                 return random(50,100);
  198.             }
  199.  
  200.         public boolean backup() {
  201.                 RSTile tile = new RSTile(2441, 3087);
  202.                 return walkTileMM(tile);
  203.         }
  204.  
  205.         public boolean walkToRuins() {
  206.                 if (distanceTo(getDestination()) <= random(4, 7) || getMyPlayer().isMoving()) {
  207.                         return  walkPathMM(randomizePath(natPath, 2, 2), 16);
  208.                 } else {
  209.                         return false;
  210.                 }
  211.         }
  212.  
  213.         public boolean walkToObelisk() {
  214.                 if (distanceTo(getDestination()) <= random(4, 7)
  215.                                 || !getMyPlayer().isMoving()) {
  216.                         return walkPathMM(randomizePath(obeliskPath, 2, 2), 12);
  217.                 } else {
  218.                         return false;
  219.                 }
  220.         }
  221.  
  222.         public boolean walkToObeliskBack() {
  223.                 if (distanceTo(getDestination()) <= random(4, 7)
  224.                                 || !getMyPlayer().isMoving()) {
  225.                         return walkPathMM(randomizePath(obeliskPathBack, 2, 2), 16);
  226.                 } else {
  227.                         return false;
  228.                 }
  229.         }
  230.  
  231.         public boolean walkToBank() {
  232.                 RSTile[] toBankPath = randomizePath(bankPath, 1, 1);
  233.                 if (toBankPath != null) {
  234.                         return walkPathMM(toBankPath);
  235.                 } else if (toBankPath == null) {
  236.                         antiBan();
  237.                 }
  238.                 return false;
  239.         }
  240.  
  241.  
  242.         public boolean needToWithdrawRing() {
  243.                 if (duelring) {
  244.                         return true;
  245.                 } else {
  246.                         return false;
  247.                 }
  248.  
  249.         }
  250.  
  251.         public boolean needToBank() {
  252.                 if (inventoryContains(natID)) {
  253.                         return true;
  254.                 } else {
  255.                         return false;
  256.                 }
  257.         }
  258.  
  259.         public void obelisk() {
  260.                 RSObject obelisk = getObjectAt(2463, 3087);
  261.                 atObject(obelisk, "Renew-points");
  262.                 antiBan();
  263.         }
  264.  
  265.         public void pouchfill() {
  266.                 openTab(TAB_INVENTORY);
  267.                 if (checkspouch) {
  268.                         pouchFill(smallpouch);
  269.                 }
  270.                 if (checkmpouch) {
  271.                         if (inventoryContains(mediumpouch)) {
  272.                                 pouchFill(mediumpouch);
  273.                         } else {
  274.                                 pouchFill(mediumpouchdecay);
  275.                         }
  276.                 }
  277.                 if (checklpouch) {
  278.                         if (inventoryContains(largepouch)) {
  279.                                 pouchFill(largepouch);
  280.                         } else {
  281.                                 pouchFill(largepouchdecay);
  282.                         }
  283.                 }
  284.                 if (checkgpouch) {
  285.                         if (inventoryContains(giantpouch)) {
  286.                                 pouchFill(giantpouch);
  287.                         } else {
  288.                                 pouchFill(giantpouchdecay);
  289.                         }
  290.                 }
  291.  
  292.                 if (!inventoryContains(pessID) & !isInventoryFull()) {
  293.                         WithdrawEss();
  294.                 }
  295.         }
  296.  
  297.         public void WithdrawEss() {
  298.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  299.                         RSObject chest = getNearestObjectByID(4483);
  300.                         if(chest != null)
  301.                                 atObject(chest, "Use Bank");
  302.                         wait(random(2000, 2500));
  303.                 }
  304.                         waitForIface(RSInterface.getInterface(Constants.INTERFACE_BANK),
  305.                                         3000);
  306.                         while (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
  307.                                 bankTimer = new Timer(random(3000,5000));
  308.                                 if(!atBankInventoryItem(pessID, "Withdraw-All")) {
  309.                                         //withdrawEssence();
  310.                                         atBankInventoryItem(pessID, "Withdraw-All but one");
  311.                                 }
  312.                                 //withdrawEssence();
  313.                                 if(waitForItemGrab(2500, pessID, 23)) {
  314.                                 //if(getInventoryCount(pessID) >= 25) {
  315.                                         bank.close();
  316.                                 }
  317.                         }
  318.         }
  319.  
  320.         public boolean atBankInventoryItem(int itemID, String txt) {
  321.                 return bank.atItem(itemID, txt);
  322.         }
  323.  
  324.         public void WithdrawRing() {
  325.                 RSObject chest = getNearestObjectByID(4483);
  326.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  327.                         if(chest != null && !getMyPlayer().isMoving()) {
  328.                                 atObject(chest, "Use Bank");
  329.                         }
  330.                         wait(random(2500, 5500));
  331.                 }
  332.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  333.                         if (bank.isOpen() && bank.getCount(2552) < 1) {
  334.                                 bank.close();
  335.                                 log("Out of Ring of Duelling. Logging out.");
  336.                                 logout();
  337.                                 stopScript();
  338.                         }
  339.                         waitForIface(RSInterface.getInterface(Constants.INTERFACE_BANK),
  340.                                         3000);
  341.                         while (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
  342.                                 wait(random(1500, 2250));
  343.                                 if(!atBankInventoryItem(2552, "Withdraw-1")) {
  344.                                         //withdrawRing8();
  345.                                         atBankInventoryItem(2552, "Withdraw-1");
  346.  
  347.                                 }
  348.                                 if(waitForItemGrab(2500, 2552, 1)) {
  349.                                         bank.close();
  350.                                 }
  351.                         }
  352.                 }
  353.         }
  354.        
  355.        
  356.  
  357.         public void WithdrawPouch() {
  358.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  359.                         RSObject chest = getNearestObjectByID(4483);
  360.                         RSTile bankTile = chest.getLocation();
  361.                         if(chest != null && !getMyPlayer().isMoving()) {
  362.                                 atObject(chest, "Use Bank");
  363.                         } else
  364.                                 if(distanceTo(bankTile) >= 5) {
  365.                                 walkTileMM(bankTile);
  366.                         }
  367.                         wait(random(2500, 5500));
  368.                 }
  369.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  370.                         if (bank.isOpen() && bank.getCount(12810) < 1) {
  371.                                 bank.close();
  372.                                 log("Out of Spirit graahk pouches. Logging out.");
  373.                                 logout();
  374.                                 stopScript();
  375.                         }
  376.                         waitForIface(RSInterface.getInterface(Constants.INTERFACE_BANK),
  377.                                         3000);
  378.                         while (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
  379.                                 wait(random(1750, 2500));
  380.                                 if(!atBankInventoryItem(12810, "Withdraw-1")) {
  381.                                         withdrawGraahkPouch();
  382.  
  383.                                 }
  384.                                 if(waitForItemGrab(2000, 12810, 1)) {
  385.                                         bank.close();
  386.                                 }
  387.                         }
  388.                 }
  389.         }
  390.        
  391.         public void WithdrawAstralRune() {
  392.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  393.                         RSObject chest = getNearestObjectByID(4483);
  394.                         if(chest != null && !getMyPlayer().isMoving()) {
  395.                                 atObject(chest, "Use Bank");
  396.                         }
  397.                         wait(random(2500, 5500));
  398.                 }
  399.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  400.                         if (bank.isOpen() && bank.getCount(12810) < 1) {
  401.                                 bank.close();
  402.                                 log("Out of Astrals. Logging out.");
  403.                                 logout();
  404.                                 stopScript();
  405.                         }
  406.                         waitForIface(RSInterface.getInterface(Constants.INTERFACE_BANK),
  407.                                         3000);
  408.                         while (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
  409.                                 wait(random(3000, 4500));
  410.                                 if(!atBankInventoryItem(astralRune, "Withdraw-1")) {
  411.                                         withdrawAstral();
  412.  
  413.                                 }
  414.                                 if(waitForItemGrab(2000, astralRune, 1)) {
  415.                                         bank.close();
  416.                                 }
  417.                         }
  418.                 }
  419.         }
  420.        
  421.         public void WithdrawAirRune() {
  422.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  423.                         RSObject chest = getNearestObjectByID(4483);
  424.                         if(chest != null && !getMyPlayer().isMoving()) {
  425.                                 atObject(chest, "Use Bank");
  426.                         }
  427.                         wait(random(2500, 5500));
  428.                 }
  429.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  430.                         if (bank.isOpen() && bank.getCount(12810) < 1) {
  431.                                 bank.close();
  432.                                 log("Out of Airs. Logging out.");
  433.                                 logout();
  434.                                 stopScript();
  435.                         }
  436.                         waitForIface(RSInterface.getInterface(Constants.INTERFACE_BANK),
  437.                                         3000);
  438.                         while (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
  439.                                 wait(random(3000, 4500));
  440.                                 if(!atBankInventoryItem(airRune, "Withdraw-1")) {
  441.                                         withdrawAir();
  442.  
  443.                                 }
  444.                                 if(waitForItemGrab(2000, airRune, 1)) {
  445.                                         bank.close();
  446.                                 }
  447.                         }
  448.                 }
  449.         }
  450.        
  451.         public void WithdrawCosmicRune() {
  452.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  453.                         RSObject chest = getNearestObjectByID(4483);
  454.                         if(chest != null && !getMyPlayer().isMoving()) {
  455.                                 atObject(chest, "Use Bank");
  456.                         }
  457.                         wait(random(2500, 5500));
  458.                 }
  459.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  460.                         if (bank.isOpen() && bank.getCount(12810) < 1) {
  461.                                 bank.close();
  462.                                 log("Out of Cosmics. Logging out.");
  463.                                 logout();
  464.                                 stopScript();
  465.                         }
  466.                         waitForIface(RSInterface.getInterface(Constants.INTERFACE_BANK),
  467.                                         3000);
  468.                         while (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
  469.                                 wait(random(3000, 4500));
  470.                                 if(!atBankInventoryItem(cosmicRune, "Withdraw-2")) {
  471.                                         withdrawCosmic();
  472.  
  473.                                 }
  474.                                 if(waitForItemGrab(2000, cosmicRune, 2)) {
  475.                                         bank.close();
  476.                                 }
  477.                         }
  478.                 }
  479.         }
  480.  
  481.         public void withdrawGraahkPouch() {
  482.                 if (bank.isOpen()) {
  483.                         wait(random(200, 300));
  484.                         if(invCount(12810) == 0) {
  485.                                 //withdraw(12810, "Spirit graahk pouch", false);
  486.                                 waitForBankOpen(4500);
  487.                                 bank.withdraw(12810, 1);
  488.                                 tryAmount += 1;
  489.                                 wait(random(1050, 1200));
  490.                         }
  491.                         wait(random(2000, 3500));
  492.                 }
  493.                 if (tryAmount > 15) {
  494.                         log("Failed " + tryAmount + " times to get Spirit graahk pouch. Logging out.");
  495.                         stopScript();
  496.                 }
  497.         }
  498.  
  499.  
  500.         public void withdrawEssence() {
  501.                 if (bank.isOpen()) {
  502.                         wait(random(200, 300));
  503.                         if (essCount < 25) {
  504.                                 withdraw(pessID, "Pure Essence", true);
  505.                                 wait(random(1050, 1200));
  506.                         }
  507.                 }
  508.         }
  509.  
  510.         public void withdrawRing8() {
  511.                 if (bank.isOpen()) {
  512.                         wait(random(200, 300));
  513.  
  514.                         if(invCount(2552) == 0) {//withdraw(2552, "Ring of duelling (8)", false);
  515.                                 waitForBankOpen(2250);
  516.                                 bank.withdraw(2552, 1);
  517.                                 tryAmount += 1;
  518.                                 wait(random(1050, 1200));
  519.                         }
  520.                 }
  521.                 if (tryAmount > 15) {
  522.                         log("Failed " + tryAmount + " times to get Ring of Duelling. Logging out.");
  523.                         stopScript();
  524.                 }
  525.         }
  526.        
  527.         public void withdrawAstral() {
  528.                 if (bank.isOpen()) {
  529.                         wait(random(200, 300));
  530.  
  531.                         if(invCount(astralRune) == 0) {
  532.                                 waitForBankOpen(2250);
  533.                                 bank.withdraw(astralRune, 1);
  534.                                 tryAmount += 1;
  535.                                 wait(random(1050, 1200));
  536.                         }
  537.                 }
  538.                 if (tryAmount > 15) {
  539.                         log("Failed " + tryAmount + " times to get Astral Rune. Logging out.");
  540.                         stopScript();
  541.                 }
  542.         }
  543.        
  544.         public void withdrawAir() {
  545.                 if (bank.isOpen()) {
  546.                         wait(random(200, 300));
  547.  
  548.                         if(invCount(airRune) == 0) {
  549.                                 waitForBankOpen(2250);
  550.                                 bank.withdraw(airRune, 1);
  551.                                 tryAmount += 1;
  552.                                 wait(random(1050, 1200));
  553.                         }
  554.                 }
  555.                 if (tryAmount > 15) {
  556.                         log("Failed " + tryAmount + " times to get Astral Rune. Logging out.");
  557.                         stopScript();
  558.                 }
  559.         }
  560.        
  561.         public void withdrawCosmic() {
  562.                 if (bank.isOpen()) {
  563.                         wait(random(200, 300));
  564.  
  565.                         if(invCount(cosmicRune) < 2) {
  566.                                 waitForBankOpen(2250);
  567.                                 bank.withdraw(cosmicRune, 2);
  568.                                 tryAmount += 1;
  569.                                 wait(random(1050, 1200));
  570.                         }
  571.                 }
  572.                 if (tryAmount > 15) {
  573.                         log("Failed " + tryAmount + " times to get Astral Rune. Logging out.");
  574.                         stopScript();
  575.                 }
  576.         }
  577.  
  578.         public int invCount(final int InvItem) {
  579.                 return getInventoryCount(InvItem);
  580.         }
  581.  
  582.  
  583.         public boolean waitForItemGrab(final int timeout, final int itemID,
  584.                         final int minAmount) {
  585.                 final long start = System.currentTimeMillis();
  586.                 while (System.currentTimeMillis() - start < timeout) {
  587.                         if (invCount(itemID) >= minAmount)
  588.                                 return true;
  589.  
  590.                         wait(15);
  591.                 }
  592.                 return false;
  593.         }
  594.  
  595.         public boolean waitForBankOpen(int timeout) {
  596.                 final long start = System.currentTimeMillis();
  597.                 if (ExtraTimout != 0)
  598.                         timeout += ExtraTimout;
  599.  
  600.                 while (System.currentTimeMillis() - start < timeout) {
  601.                         if (!getMyPlayer().isMoving()
  602.                                         && (System.currentTimeMillis() - start) > 1200)
  603.                                 return false;
  604.  
  605.                         if (bank.isOpen())
  606.                                 return true;
  607.  
  608.                         wait(15);
  609.                 }
  610.                 return false;
  611.         }
  612.  
  613.         public boolean waitForEmptyInv(final int timeout) {
  614.                 final long start = System.currentTimeMillis();
  615.                 while (System.currentTimeMillis() - start < timeout) {
  616.                         if (getInventoryCount() == 0)
  617.                                 return true;
  618.  
  619.                         wait(15);
  620.                 }
  621.                 return false;
  622.         }
  623.  
  624.  
  625.  
  626.         private void withdraw(final int ID, final String name, final boolean all) {
  627.                 if (!bank.isOpen())
  628.                         return;
  629.                 RSInterfaceComponent[] scrollbox = getChildInterface(INTERFACE_BANK, INTERFACE_BANK_SCROLLBAR).getComponents();
  630.                 if (scrollbox.length > 1) {
  631.                         int scrollTop = scrollbox[0].getAbsoluteY();
  632.                         if (scrollbox[1].getAbsoluteY() > scrollTop + 1) {
  633.                                 clickMouse(scrollbox[0].getAbsoluteX() + random(2, 4), scrollTop + random(2, 4), true);
  634.                         }
  635.                 }
  636.                 RSInterfaceChild bankItem = bank.getItemByID(ID);
  637.                 if (bankItem == null) {
  638.                         log.severe("Unable to withraw " + name + ". You will be logged out in ten seconds.");
  639.                         wait(random(9000, 11000));
  640.                         while (bank.isOpen()) {
  641.                                 bank.close();
  642.                         }
  643.                         stopScript();
  644.                 } else if (bankItem.getAbsoluteY() > 270
  645.                                 && atInterface(getChildInterface(INTERFACE_BANK, INTERFACE_BANK_BUTTON_SEARCH), "Search")) {
  646.                         wait(random(1200, 1500));
  647.                         final int rand = random(0, Math.min(4, name.length() - 2));
  648.                         sendText(name.toLowerCase().substring(0, name.length() - rand), false);
  649.                         wait(random(900, 1200));
  650.                         bankItem = bank.getItemByID(ID);
  651.                         if (bankItem == null
  652.                                         || bankItem.getAbsoluteY() > 270
  653.                                         || !bank.withdraw(ID, all ? 0 : 1)
  654.                                         && !bank.withdraw(ID, all ? 0 : 1)) {
  655.                                 log.severe("Unable to withraw " + name + ". You will be logged out in ten seconds.");
  656.                                 wait(random(9000, 11000));
  657.                                 while (bank.isOpen()) {
  658.                                         bank.close();
  659.                                 }
  660.                                 stopScript();
  661.                         } else {
  662.                                 atInterface(getChildInterface(INTERFACE_BANK, 50));
  663.                         }
  664.                 } else {
  665.                         bank.withdraw(ID, all ? 0 : 1);
  666.                 }
  667.         }
  668.  
  669.         public boolean atBank() {
  670.                 if (playerInArea(2445, 3086, 2440, 3082)) {
  671.                         return true;
  672.                 } else {
  673.                         return false;
  674.                 }
  675.         }
  676.  
  677.         public boolean atObelisk() {
  678.                 RSObject obelisk = getNearestObjectByID(29954);
  679.                 if (obelisk == null)
  680.                         return false;
  681.                 return tileOnScreen(obelisk.getLocation());
  682.         }
  683.  
  684.         public boolean atAltar() {
  685.                 RSObject aground = getNearestObjectByID(38354);
  686.                 if (aground == null)
  687.                         return false;
  688.                 return tileOnScreen(aground.getLocation());
  689.         }
  690.  
  691.         public void setCompass(final char direction) {
  692.                 switch (direction) {
  693.                 case 'n':
  694.                         setCameraRotation(359);
  695.                         break;
  696.                 case 'e':
  697.                         setCameraRotation(89);
  698.                         break;
  699.                 case 's':
  700.                         setCameraRotation(179);
  701.                         break;
  702.                 case 'w':
  703.                         setCameraRotation(269);
  704.                         break;
  705.                 default:
  706.                         setCameraRotation(359);
  707.                         break;
  708.                 }
  709.         }
  710.  
  711.         private void bank() {
  712.                 while (!RSInterface.getInterface(INTERFACE_BANK).isValid()
  713.                                 & !pouchfilled) {
  714.                         RSObject chest = getNearestObjectByID(4483);
  715.                         if(chest != null && !getMyPlayer().isMoving())
  716.                                 atObject(chest, "Use Bank");
  717.                         if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  718.                                 antiBan();
  719.                                 wait(random(1234, 1780));
  720.                         }
  721.                 }
  722.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  723.                         if (!pouchfilled) {
  724.                                 while (inventoryContains(natID) || inventoryContains(2556)) {
  725.                                         bank.depositAllExcept(smallpouch, mediumpouch, largepouch, giantpouch,
  726.                                                         mediumpouchdecay, largepouchdecay, giantpouchdecay);
  727.                                 }
  728.                                 if (lunar && !inventoryContains(pessID) & !pouchfilled) {
  729.                                   while (inventoryContains(mediumpouchdecay)) {
  730.                                     contactNPC();
  731.                                   }
  732.                                   while (inventoryContains(largepouchdecay)) {
  733.                                     contactNPC();
  734.                                   }
  735.                                   while (inventoryContains(giantpouchdecay)) {
  736.                                     contactNPC();
  737.                                   }
  738.                                 }
  739.                                 bank.depositAllExcept(smallpouch, mediumpouch, largepouch, giantpouch,
  740.                                                 mediumpouchdecay, largepouchdecay, giantpouchdecay);
  741.                                 wait = new Timer(random (2000, 3200));
  742.                                 WithdrawEss();
  743.                                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  744.                                         bank.close();
  745.                                 }
  746.                         }
  747.                         if (inventoryContains(pessID) & !pouchfilled) {
  748.                                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  749.                                         bank.close();
  750.                                 }
  751.                         //      if (lunar || !pouchfilled){
  752.                         //              while (inventoryContains(mediumpouchdecay)) {
  753.                         //                      fixPouches();
  754.                         //              }
  755.                         //              while (inventoryContains(largepouchdecay)) {
  756.                         //                      fixPouches();
  757.                         //              }
  758.                         //              while (inventoryContains(giantpouchdecay)) {
  759.                         //                      fixPouches();
  760.                         //              }
  761.                         //      }
  762.                                 //WithdrawEss();
  763.                                 if (usedPouch) {
  764.                                         if(getCurrentTab() != Constants.TAB_INVENTORY) {
  765.  
  766.                                         } else {
  767.                                                 openTab(TAB_INVENTORY);
  768.                                         }
  769.                                         if (checkspouch) {
  770.                                                 pouchFill(smallpouch);
  771.                                         }
  772.                                         if (checkmpouch) {
  773.                                                 if (inventoryContains(mediumpouch)) {
  774.                                                         pouchFill(mediumpouch);
  775.                                                 } else {
  776.                                                         pouchFill(mediumpouchdecay);
  777.                                                 }
  778.                                         }
  779.                                         if (checklpouch) {
  780.                                                 if (inventoryContains(largepouch)) {
  781.                                                         pouchFill(largepouch);
  782.                                                 } else {
  783.                                                         pouchFill(largepouchdecay);
  784.                                                 }
  785.                                         }
  786.                                         if (checkgpouch) {
  787.                                                 if (inventoryContains(giantpouch)) {
  788.                                                         pouchFill(giantpouch);
  789.                                                 } else {
  790.                                                         pouchFill(giantpouchdecay);
  791.                                                 }
  792.                                         }
  793.                                         while (!isInventoryFull())
  794.                                                 WithdrawEss();
  795.                                 }
  796.                                 pouchfilled = true;
  797.                         } else {
  798.                                 pouchfilled = false;
  799.                         }
  800.  
  801.                 }
  802.         }
  803.  
  804.         public void enterRuins() {
  805.                         clickTile(ruinTile, "Enter");
  806.         }
  807.  
  808.         public void craft() {
  809.                 wait = new Timer (random(1000, 2000));
  810.                 while (inventoryContains(pessID)) {
  811.                         craft(altarTile, "Craft-rune");
  812.                         wait(random(200, 300));
  813.                         if (inventoryContains(smallpouch)) {
  814.                                 hoverPouch(smallpouch);
  815.                         } else if (inventoryContains(mediumpouch)) {
  816.                                 hoverPouch(mediumpouch);
  817.                         } else if (inventoryContains(mediumpouchdecay)) {
  818.                                 hoverPouch(mediumpouchdecay);
  819.                         }
  820.                         waitToStop();
  821.                         waitForAnimation(791);
  822.                 }
  823.                 if (inventoryContains(natID)) {
  824.                         pouchEmpty++;
  825.                 }
  826.  
  827.                 if (usedPouch & pouchEmpty > 0) {
  828.                         openTab(TAB_INVENTORY);
  829.                         if (checkspouch) {
  830.                                 pouchEmpty(smallpouch);
  831.                         }
  832.                         if (checkmpouch) {
  833.                                 if (inventoryContains(mediumpouch)) {
  834.                                         pouchEmpty(mediumpouch);
  835.                                 } else {
  836.                                         pouchEmpty(mediumpouchdecay);
  837.                                 }
  838.                         }
  839.                         if (checklpouch) {
  840.                                 if (inventoryContains(largepouch)) {
  841.                                         pouchEmpty(largepouch);
  842.                                 } else {
  843.                                         pouchEmpty(largepouchdecay);
  844.                                 }
  845.                         }
  846.                         if (checkgpouch) {
  847.                                 if (inventoryContains(giantpouch)) {
  848.                                         pouchEmpty(giantpouch);
  849.                                 } else {
  850.                                         pouchEmpty(giantpouchdecay);
  851.                                 }
  852.                         }
  853.                         if (inventoryContains(pessID)) {
  854.                                 craft(altarTile, "Craft-rune");
  855.                                 wait(random(600, 800));
  856.                         }
  857.                         if (inventoryContains(natID)) {
  858.                                 wait(random(400, 800));
  859.                                 pouchEmpty = 0;
  860.                         }
  861.                 } else {
  862.                         pouchEmpty = 0;
  863.                 }
  864.         }
  865.        
  866.  
  867.         public int ring() {
  868.                 if (getCurrentTab() != Constants.TAB_EQUIPMENT) {
  869.                         openTab(Constants.TAB_EQUIPMENT);
  870.                 } else {
  871.                         Bot.getInputManager().pressKey((char) KeyEvent.VK_F2);
  872.                         wait(800);
  873.                         Bot.getInputManager().pressKey((char) KeyEvent.VK_F2);
  874.                 }
  875.                 clickMouse(random(683, 714), random(369, 400), false);
  876.                 wait(random(200, 500));
  877.                 atMenu("Castle Wars");
  878.                 wait(500);
  879.                 if (getCurrentTab() != Constants.TAB_INVENTORY) {
  880.                         Bot.getInputManager().pressKey((char) KeyEvent.VK_F1);
  881.                         wait(800);
  882.                         Bot.getInputManager().pressKey((char) KeyEvent.VK_F1);
  883.                 } else if (getCurrentTab() != Constants.TAB_INVENTORY) {
  884.                         openTab(Constants.TAB_INVENTORY);
  885.                 }
  886.                 return 100;
  887.         }
  888.  
  889.  
  890.  
  891.         public void graahk() {
  892.                 RSNPC graahk1 = getNPCInteracting(7363);
  893.                 while (!getMyPlayer().isMoving() && graahk1 == null || stackedGraahk(graahk1.getLocation())
  894.                                 || !atNPC(graahk1, "Interact Spirit graahk")) {
  895.                         clickNPC(graahk1, "Interact Spirit graahk");
  896.                         wait(random(800, 1000));
  897.                 }
  898.                 if (getInterface(228).isValid()) {
  899.                         // clickMouse(random(140, 370), random(424, 440), true);
  900.                         atInterface(228, 3);
  901.                         wait = new Timer(2000);
  902.                         setCompass('w');
  903.                 }
  904.         }
  905.  
  906.         private RSNPC getNPCInteracting(final int... ids) {
  907.                 for(final RSNPC npc : getNPCArray(false)) {
  908.                         // skip ID check if npc is null or it's not interacting with the player
  909.                         if(npc == null || !getMyPlayer().equals(npc.getInteracting())) continue;
  910.                         for(final int id : ids) {
  911.                                 if(npc.getID() == id) {
  912.                                         // NPC is interacting with the player and id matches...
  913.                                         return npc;
  914.                                 }
  915.                         }
  916.                 }
  917.                 // No wanted npcs found...
  918.                 return null;
  919.         }
  920.  
  921.         public void waitForAnimation(int j) {
  922.                 while (animationIs(j)) {
  923.                         wait(1);
  924.                 }
  925.         }
  926.  
  927.  
  928.         public void waitToStop() {
  929.                 while (getMyPlayer().isMoving()) {
  930.                         wait(1);
  931.                 }
  932.         }
  933.  
  934.  
  935.         private boolean clickNPC(final RSNPC npc, final String action) {
  936.                 final RSTile tile = npc.getLocation();
  937.                 tile.randomizeTile(1, 1);
  938.                 try {
  939.                         final int hoverRand = random(8, 13);
  940.                         for (int i = 0; i < hoverRand; i++) {
  941.                                 final Point screenLoc = npc.getScreenLocation();
  942.                                 if (!pointOnScreen(screenLoc)) {
  943.                                         setCameraRotation(getCameraAngle() + random(-35, 150));
  944.                                         return true;
  945.                                 }
  946.  
  947.                                 moveMouse(screenLoc, 15, 15);
  948.  
  949.                                 final List<String> menuItems = getMenuItems();
  950.                                 if (menuItems.isEmpty() || menuItems.size() <= 1) {
  951.                                         continue;
  952.                                 }
  953.                                 if (menuItems.get(0).toLowerCase().contains(
  954.                                                 npc.getName().toLowerCase())
  955.                                                 && getMyPlayer().getInteracting() == null) {
  956.                                         clickMouse(true);
  957.                                         return true;
  958.                                 } else {
  959.                                         for (int a = 1; a < menuItems.size(); a++) {
  960.                                                 if (menuItems.get(a).toLowerCase().contains(
  961.                                                                 npc.getName().toLowerCase())
  962.                                                                 && getMyPlayer().getInteracting() == null) {
  963.                                                         clickMouse(false);
  964.                                                         return atMenu(action);
  965.                                                 }
  966.                                         }
  967.                                 }
  968.                         }
  969.  
  970.                 } catch (final Exception e) {
  971.                         log.warning("ClickNPC error: " + e);
  972.                         return false;
  973.                 }
  974.                 return false;
  975.         }
  976.  
  977.         public boolean EquipRing() {
  978.                 int ringcount = getInventoryCount(2552);
  979.                 if(getCurrentTab() != Constants.TAB_INVENTORY) {
  980.                         Bot.getInputManager().pressKey((char) KeyEvent.VK_F1);
  981.                         wait(800);
  982.                         Bot.getInputManager().pressKey((char) KeyEvent.VK_F1);
  983.                 } else {
  984.                         openTab(Constants.TAB_INVENTORY);
  985.                 }
  986.                 wait(random(500, 800));
  987.                 atInventoryItem(2552, "Wear");
  988.                 wait(random(500, 800));
  989.                 int ringcountfinal = getInventoryCount(2552);
  990.                 if (ringcount > ringcountfinal) {
  991.                         return true;
  992.                 } else {
  993.                         EquipRing();
  994.                 }
  995.                 return false;
  996.         }
  997.  
  998.         private void equipduelring() {
  999.                 if (!inventoryContains(2552)) {
  1000.                         WithdrawRing();
  1001.                 }
  1002.                 if (inventoryContains(2552)) {
  1003.                         wait(random(1250, 2750));
  1004.                         EquipRing();
  1005.                         duelring = false;
  1006.                 }
  1007.  
  1008.         }
  1009.  
  1010.         public void SummonGraahk() {
  1011.                 while (inventoryContains(12810)) {
  1012.                         atInventoryItem(12810, "Summon");
  1013.                         wait(random(800, 1400));
  1014.                 }
  1015.  
  1016.         }
  1017.  
  1018.         private void reNewSummonPoints() {
  1019.                 setCameraAltitude(true);
  1020.                 int currentlvl = skills.getCurrentSkillLevel(STAT_SUMMONING);
  1021.                 int reallvl = skills.getRealSkillLevel(STAT_SUMMONING);
  1022.                 if (!inventoryContains(12810)) {
  1023.                         WithdrawPouch();
  1024.                 }
  1025.                 if (currentlvl != reallvl) {
  1026.                         walkToObelisk();
  1027.                 } else if(!inventoryContains(12810)) {
  1028.                                
  1029.                         }
  1030.  
  1031.                 if (atObelisk()) {
  1032.                         antiBan();
  1033.                         wait(6000);
  1034.                         if (!(currentlvl == reallvl)) {
  1035.                                 obelisk();
  1036.                                 currentlvl = skills.getCurrentSkillLevel(STAT_SUMMONING);
  1037.                                 wait(random(1000, 2000));
  1038.                         } else {
  1039.                                 if(inventoryContains(12810)) {
  1040.                                         walkToObeliskBack();
  1041.                                 }
  1042.                         }
  1043.                 }
  1044.                 if (playerInArea(2445, 3086, 2440, 3082) & currentlvl == reallvl) {
  1045.                         SummonGraahk();
  1046.                         summon = false;
  1047.                         summongraahk = false;
  1048.                         ACTION = BANK;
  1049.                 }
  1050.  
  1051.         }
  1052.        
  1053.         private int waitForIdle(int timeout) {
  1054.                 long start = System.currentTimeMillis();
  1055.                 RSPlayer myPlayer = getMyPlayer();
  1056.                 int anim = 1;
  1057.                 while (System.currentTimeMillis() - start < timeout) {
  1058.                         if ((anim = myPlayer.getAnimation()) == -1) {
  1059.                                 break;
  1060.  
  1061.                         }
  1062.                         wait(15);
  1063.                 }
  1064.                 return anim;
  1065.         }
  1066.  
  1067.         private int waitForInterface(int id, int timeout) {
  1068.                 long start = System.currentTimeMillis();
  1069.                 int anim = 1;
  1070.                 while (System.currentTimeMillis() - start < timeout) {
  1071.                         if (RSInterface.getInterface(id).isValid()) {
  1072.                                 break;
  1073.                         }
  1074.                         wait(15);
  1075.                 }
  1076.                 return anim;
  1077.         }
  1078.        
  1079.         private boolean talk() {
  1080.             if (getInterface(64).isValid()
  1081.                 | getInterface(65).isValid()
  1082.                 | getInterface(230).isValid()
  1083.                 | getInterface(242).isValid()
  1084.                 | getInterface(243).isValid()
  1085.                 | getInterface(228, 2).containsText(
  1086.                     "Can you repair my pouches?")) {
  1087.               return true;
  1088.  
  1089.             } else
  1090.               return false;
  1091.  
  1092.           }
  1093.  
  1094.         public int contactNPC() {
  1095.                 RSObject chest = getNearestObjectByID(4483);
  1096.                 RSTile bankTile = (chest.getLocation());
  1097.                 if (bank.isOpen() && inventoryContains(airRune)
  1098.                                 && inventoryContains(cosmicRune)
  1099.                                 && inventoryContains(astralRune)) {
  1100.                         if (bank.close()) {
  1101.                                 wait(random(100, 200));
  1102.                                 failCount = 0;
  1103.                                 while (bank.isOpen() && failCount < 20) {
  1104.                                         wait(random(50, 100));
  1105.                                         failCount++;
  1106.                                 }
  1107.                                 return 1;
  1108.                         }
  1109.                 }
  1110.                 if (inventoryContains(airRune) && inventoryContains(cosmicRune)
  1111.                                 && inventoryContains(astralRune)) {
  1112.                         if (getCurrentTab() != TAB_MAGIC) {
  1113.                                 openTab(TAB_MAGIC);
  1114.                                 failCount = 0;
  1115.                         }
  1116.                         if (!getInterface(88).isValid()) {
  1117.                                 bank.close();
  1118.                                 atInterface(548, 130); // Magic Spellbook
  1119.                                 atInterface(430, 26); // Cast
  1120.                                 openTab(Constants.TAB_INVENTORY);
  1121.                                 wait(random(400, 600));
  1122.  
  1123.                         }
  1124.  
  1125.                         if (getInterface(88).isValid()) {
  1126.                                 if (getMouseLocation().getX() <= 454
  1127.                                                 | getMouseLocation().getX() >= 466
  1128.                                                 | getMouseLocation().getY() <= 279
  1129.                                                 | getMouseLocation().getY() >= 296) {
  1130.                                         moveMouse(random(455, 465), random(280, 295));
  1131.  
  1132.                                 }
  1133.  
  1134.                                 if (getMouseLocation().getX() >= 454
  1135.                                                 && getMouseLocation().getX() <= 466
  1136.                                                 && getMouseLocation().getY() >= 279
  1137.                                                 && getMouseLocation().getY() <= 296) {
  1138.                                         clickMouse(true);
  1139.                                         wait(random(300, 600));
  1140.                                         clickRSComponent(getInterface(88).getChild(22), 4, true); // Speak-to
  1141.                                         // (Dark
  1142.                                         // mage)
  1143.                                         wait(random(800, 1000));
  1144.                                         if (getMyPlayer().getAnimation() == 4413) {
  1145.                                                 waitForIdle(random(5000, 6000));
  1146.  
  1147.                                         }
  1148.  
  1149.                                 }
  1150.  
  1151.                         }
  1152.  
  1153.                 }
  1154.  
  1155.                 talk();
  1156.                 if (talk() == true && getInventoryCount(mediumpouchdecay) != 0
  1157.                                 | getInventoryCount(largepouchdecay) != 0
  1158.                                 | getInventoryCount(giantpouchdecay) != 0) {
  1159.  
  1160.                         if (getInterface(64).getChild(5).isValid()) {
  1161.                                 atInterface(64, 5);
  1162.                                 waitForInterface(242, 2000);
  1163.  
  1164.                         }
  1165.  
  1166.                         if (getInterface(242).getChild(6).isValid()) {
  1167.                                 atInterface(242, 6);
  1168.                                 waitForInterface(65, 2000);
  1169.  
  1170.                         }
  1171.  
  1172.                         if (getInterface(65).getChild(6).isValid()
  1173.                                         && getInterface(65, 5).containsText("with you.")) {
  1174.                                 atInterface(65, 6);
  1175.                                 wait(random(400, 600));
  1176.  
  1177.                         }
  1178.  
  1179.                         if (getInterface(65).getChild(6).isValid()
  1180.                                         && getInterface(65, 5).containsText("you.")) {
  1181.                                 atInterface(65, 6);
  1182.                                 wait(random(400, 600));
  1183.  
  1184.                         }
  1185.  
  1186.                         if (getInterface(65).getChild(6).isValid()
  1187.                                         && getInterface(65, 5).containsText("something quickly.")) {
  1188.                                 atInterface(65, 6);
  1189.                                 wait(random(400, 600));
  1190.  
  1191.                         }
  1192.  
  1193.                         if (getInterface(243).getChild(7).isValid()) {
  1194.                                 atInterface(243, 7);
  1195.                                 wait(random(400, 600));
  1196.  
  1197.                         }
  1198.  
  1199.                         if (getInterface(230).getChild(3).isValid()) {
  1200.                                 atInterface(230, 3);
  1201.                                 wait(random(400, 600));
  1202.  
  1203.                         }
  1204.  
  1205.                         if (getInterface(228).getChild(2).isValid()
  1206.                                         && getInterface(228, 2).containsText(
  1207.                                                         "Can you repair my pouches?")) {
  1208.                                 atInterface(228, 2);
  1209.                                 wait(random(400, 600));
  1210.  
  1211.                         }
  1212.                         if (getInterface(65).getChild(6).isValid()
  1213.                                         && getInterface(65, 5).containsText(
  1214.                                                         "I think they might be degrading.")) {
  1215.                                 atInterface(65, 6);
  1216.                                 wait(random(400, 600));
  1217.                         }
  1218.                 }
  1219.                 if (!inventoryContains(airRune) || !inventoryContains(cosmicRune)
  1220.                                 || !inventoryContains(astralRune)) {
  1221.                         if (getMyPlayer().isMoving())
  1222.                                 return 1;
  1223.                         if (distanceTo(bankTile) > 10)
  1224.                                 walkTileMM(bankTile);
  1225.                         if (!bank.isOpen()) {
  1226.                                 if (onTile(bankTile, "Use", 0.5, 0.5, 0)) {
  1227.                                         wait(random(1500, 2000));
  1228.                                         failCount = 0;
  1229.                                         while (!bank.isOpen() && failCount < 30) {
  1230.                                                 wait(random(600, 800));
  1231.                                                 if (getMyPlayer().isMoving())
  1232.                                                         failCount = 0;
  1233.                                                 failCount++;
  1234.                                         }
  1235.                                 }
  1236.                         }
  1237.                         if (atInventoryItem(pessID, "Deposit-All")) {
  1238.                                 wait(random(600, 800));
  1239.                                 failCount = 0;
  1240.                                 while (inventoryContains(pessID) && failCount < 30) {
  1241.                                         wait(random(600, 800));
  1242.                                         failCount++;
  1243.                                 }
  1244.                         } else
  1245.                                 fatalCount++;
  1246.                         if (bank.atItem(airRune, "Withdraw-1"))
  1247.                                 if (bank.atItem(airRune, "Withdraw-1")) {
  1248.                                         wait(random(600, 800));
  1249.                                         failCount = 0;
  1250.                                         while (!inventoryContains(airRune) && failCount < 30) {
  1251.                                                 wait(random(600, 800));
  1252.                                                 failCount++;
  1253.                                         }
  1254.                                 } else
  1255.                                         fatalCount++;
  1256.                         if (bank.atItem(cosmicRune, "Withdraw-1")) {
  1257.                                 wait(random(600, 800));
  1258.                                 failCount = 0;
  1259.                                 while (!inventoryContains(cosmicRune) && failCount < 30) {
  1260.                                         wait(random(600, 800));
  1261.                                         failCount++;
  1262.                                 }
  1263.                         } else
  1264.                                 fatalCount++;
  1265.                         if (bank.atItem(astralRune, "Withdraw-1")) {
  1266.                                 wait(random(600, 800));
  1267.                                 failCount = 0;
  1268.                                 while (!inventoryContains(astralRune) && failCount < 30) {
  1269.                                         wait(random(600, 800));
  1270.                                         failCount++;
  1271.                                 }
  1272.                         } else
  1273.                                 fatalCount++;
  1274.                         return 1;
  1275.                 }
  1276.                 if (!inventoryContains(mediumpouchdecay)
  1277.                                 && !inventoryContains(largepouchdecay)
  1278.                                 && !inventoryContains(giantpouchdecay)) {
  1279.                         if (getMyPlayer().isMoving())
  1280.                                 return 1;
  1281.                         if (distanceTo(bankTile) > 10)
  1282.                                 walkTileMM(bankTile);
  1283.                         if (!bank.isOpen()) {
  1284.                                 if (onTile(bankTile, "Use", 0.5, 0.5, 0)) {
  1285.                                         wait(random(100, 200));
  1286.                                         failCount = 0;
  1287.                                         while (!bank.isOpen() && failCount < 30) {
  1288.                                                 wait(random(50, 100));
  1289.                                                 if (getMyPlayer().isMoving())
  1290.                                                         failCount = 0;
  1291.                                                 failCount++;
  1292.                                         }
  1293.                                 }
  1294.                         }
  1295.                         bank.depositAllExcept(lawRune, pessID, smallpouch, mediumpouch,
  1296.                                         largepouch, giantpouch);
  1297.                 }
  1298.                 return 100;
  1299.  
  1300.         }
  1301.        
  1302.         private boolean onTile(final RSTile tile, final String action,
  1303.                         final double dx, final double dy, final int height) {
  1304.                 if (!tile.isValid())
  1305.                         return false;
  1306.  
  1307.                 Point checkScreen = null;
  1308.  
  1309.                 try {
  1310.                         checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
  1311.                         if (!pointOnScreen(checkScreen)) {
  1312.                                 if (getMyPlayer().isMoving())
  1313.                                         return false;
  1314.                                 if (walkTileMM(tile))
  1315.                                         wait(random(750, 1000));
  1316.                                 return false;
  1317.                         }
  1318.                 } catch (Exception e) {
  1319.                 }
  1320.  
  1321.                 try {
  1322.                         boolean stop = false;
  1323.                         for (int i = 0; i <= 50; i++) {
  1324.                                 checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
  1325.                                 if (!pointOnScreen(checkScreen))
  1326.                                         return false;
  1327.                                 moveMouse(checkScreen);
  1328.                                 final Object[] menuItems = getMenuItems().toArray();
  1329.                                 for (int a = 0; a < menuItems.length; a++) {
  1330.                                         if (menuItems[a].toString().toLowerCase().contains(
  1331.                                                         action.toLowerCase())) {
  1332.                                                 stop = true;
  1333.                                                 break;
  1334.                                         }
  1335.                                 }
  1336.                                 if (stop)
  1337.                                         break;
  1338.                         }
  1339.                 } catch (Exception e) {
  1340.                 }
  1341.  
  1342.                 try {
  1343.                         return atMenu(action);
  1344.                 } catch (Exception e) {
  1345.                 }
  1346.                 return false;
  1347.         }
  1348.        
  1349.         /*public int contactNPC() {
  1350.                 RSObject chest = getNearestObjectByID(4483);
  1351.                 RSTile bankTile = (chest.getLocation());
  1352.                 if (bank.isOpen() && inventoryContains(airRune)
  1353.                                 && inventoryContains(cosmicRune)
  1354.                                 && inventoryContains(astralRune)) {
  1355.                         if (bank.close()) {
  1356.                                 wait(random(100, 200));
  1357.                                 failCount = 0;
  1358.                                 while (bank.isOpen() && failCount < 20) {
  1359.                                         wait(random(50, 100));
  1360.                                         failCount++;
  1361.                                 }
  1362.                                 return 100;
  1363.                         }
  1364.                 }
  1365.                 if (inventoryContains(airRune) && inventoryContains(cosmicRune)
  1366.                                 && inventoryContains(astralRune)) {
  1367.                         if (getCurrentTab() != TAB_MAGIC) {
  1368.                                 openTab(TAB_MAGIC);
  1369.                                 failCount = 0;
  1370.                         }
  1371.                         if (RSInterface.getInterface(430).isValid()) {
  1372.                                 atInterface(430, 26);
  1373.                         }
  1374.                         atInterface(430, 26);
  1375.                         wait(random(1500, 1750));
  1376.  
  1377.                         final RSInterfaceChild scrollBar = RSInterface.getChildInterface(
  1378.                                         88, 20);
  1379.                         if (!scrollBar.isValid())
  1380.                                 return 1;
  1381.  
  1382.                         Rectangle pos = scrollBar.getArea();
  1383.                         if (pos.x == -1 || pos.y == -1 || pos.width == -1
  1384.                                         || pos.height == -1) {
  1385.                                 return 100;
  1386.                         }
  1387.                         moveMouse((int) random(458, 465), (int) random(257, 296));
  1388.                         clickMouse(true);
  1389.                         wait(random(500, 750));
  1390.                         clickMouse(true);
  1391.  
  1392.                         final RSInterfaceChild darkMage = RSInterface.getChildInterface(88,
  1393.                                         22);
  1394.                         if (!darkMage.isValid())
  1395.                                 return 100;
  1396.                         atComponent(darkMage, 4, "Speak-to");
  1397.                         // I know this looks a bit overkill but it seems to work out
  1398.                         // right... dont fix it if it ain't broke right?!?
  1399.                         wait(random(500, 1000));
  1400.                         clickContinue();
  1401.                         wait(random(500, 1000));
  1402.                         clickContinue();
  1403.                         wait(random(500, 1000));
  1404.                         clickContinue();
  1405.                         wait(random(500, 1000));
  1406.                         clickContinue();
  1407.                         wait(random(500, 1000));
  1408.                         clickContinue();
  1409.                         wait(random(500, 1000));
  1410.                         clickContinue();
  1411.                         wait(random(500, 1000));
  1412.                         clickContinue();
  1413.                         clickContinue();
  1414.                         wait(random(500, 1000));
  1415.                         clickContinue();
  1416.                         wait(random(500, 1000));
  1417.                         clickContinue();
  1418.                         wait(random(500, 1000));
  1419.                         clickContinue();
  1420.                         wait(random(500, 1000));
  1421.                         clickContinue();
  1422.                         wait(random(500, 1000));
  1423.                         clickContinue();
  1424.                         wait(random(500, 1000));
  1425.                         clickContinue();
  1426.                         wait(random(500, 1000));
  1427.                         clickContinue();
  1428.                         wait(random(500, 1000));
  1429.                         clickContinue();
  1430.                         wait(random(500, 1000));
  1431.                         clickContinue();
  1432.                         wait(random(500, 1000));
  1433.                         clickContinue();
  1434.                         wait(random(500, 1000));
  1435.                         clickContinue();
  1436.                         wait(random(500, 1000));
  1437.                         moveMouse((int) random(162, 352), (int) random(416, 423));
  1438.                         clickMouse(true);
  1439.                         moveMouse((int) random(162, 352), (int) random(416, 423));
  1440.                         wait(random(500, 750));
  1441.                         moveMouse((int) random(162, 352), (int) random(416, 423));
  1442.                         clickMouse(true);
  1443.                         wait(random(500, 1000));
  1444.                         clickContinue();
  1445.                         wait(random(500, 1000));
  1446.                         clickContinue();
  1447.                         wait(random(500, 1000));
  1448.                         clickContinue();
  1449.                         wait(random(500, 1000));
  1450.                         clickContinue();
  1451.                         wait(random(500, 1000));
  1452.                         clickContinue();
  1453.                         wait(random(500, 1000));
  1454.                         clickContinue();
  1455.                         wait(random(500, 1000));
  1456.                         clickContinue();
  1457.                         wait(random(500, 1000));
  1458.                 }
  1459.                 if (!inventoryContains(airRune) || !inventoryContains(cosmicRune)
  1460.                                 || !inventoryContains(astralRune)) {
  1461.                         if (getMyPlayer().isMoving())
  1462.                                 return 1;
  1463.                         if (distanceTo(bankTile) > 10)
  1464.                                 walkTileMM(bankTile);
  1465.                         if (!bank.isOpen()) {
  1466.                                 if (atObject(chest, "Use Bank")) {
  1467.                                         wait(random(1500, 2000));
  1468.                                         failCount = 0;
  1469.                                         while (!bank.isOpen() && failCount < 30) {
  1470.                                                 wait(random(600, 800));
  1471.                                                 if (getMyPlayer().isMoving())
  1472.                                                         failCount = 0;
  1473.                                                 failCount++;
  1474.                                         }
  1475.                                 }
  1476.                         }
  1477.                         if (atInventoryItem(pessID, "Deposit-All")) {
  1478.                                 wait(random(600, 800));
  1479.                                 failCount = 0;
  1480.                                 while (inventoryContains(pessID) && failCount < 30) {
  1481.                                         wait(random(600, 800));
  1482.                                         failCount++;
  1483.                                 }
  1484.                         } else
  1485.                                 fatalCount++;
  1486.                         if (bank.atItem(airRune, "Withdraw-1"))
  1487.                                 if (bank.atItem(airRune, "Withdraw-1")) {
  1488.                                         wait(random(600, 800));
  1489.                                         failCount = 0;
  1490.                                         while (!inventoryContains(airRune) && failCount < 30) {
  1491.                                                 wait(random(600, 800));
  1492.                                                 failCount++;
  1493.                                         }
  1494.                                 } else
  1495.                                         fatalCount++;
  1496.                         if (bank.atItem(cosmicRune, "Withdraw-1")) {
  1497.                                 wait(random(600, 800));
  1498.                                 failCount = 0;
  1499.                                 while (!inventoryContains(cosmicRune) && failCount < 30) {
  1500.                                         wait(random(600, 800));
  1501.                                         failCount++;
  1502.                                 }
  1503.                         } else
  1504.                                 fatalCount++;
  1505.                         if (bank.atItem(astralRune, "Withdraw-1")) {
  1506.                                 wait(random(600, 800));
  1507.                                 failCount = 0;
  1508.                                 while (!inventoryContains(astralRune) && failCount < 30) {
  1509.                                         wait(random(600, 800));
  1510.                                         failCount++;
  1511.                                 }
  1512.                         } else
  1513.                                 fatalCount++;
  1514.                         return 100;
  1515.                 }
  1516.                 if (!inventoryContains(mediumpouchdecay)
  1517.                                 && !inventoryContains(largepouchdecay)
  1518.                                 && !inventoryContains(giantpouchdecay)) {
  1519.                         if (getMyPlayer().isMoving())
  1520.                                 return 1;
  1521.                         if (distanceTo(bankTile) > 10)
  1522.                                 walkTileMM(bankTile);
  1523.                         if (!bank.isOpen()) {
  1524.                                 if (atObject(chest, "Use Bank")) {
  1525.                                         wait(random(100, 200));
  1526.                                         failCount = 0;
  1527.                                         while (!bank.isOpen() && failCount < 30) {
  1528.                                                 wait(random(50, 100));
  1529.                                                 if (getMyPlayer().isMoving())
  1530.                                                         failCount = 0;
  1531.                                                 failCount++;
  1532.                                         }
  1533.                                 }
  1534.                         }
  1535.                         bank.depositAllExcept(lawRune, pessID, smallpouch, mediumpouch,
  1536.                                         largepouch, giantpouch);
  1537.                 }
  1538.                 return 100;
  1539.  
  1540.         }*/
  1541.  
  1542.  
  1543.  
  1544.         public boolean rightClickInventoryItem(int id, String Option) {
  1545.                 if (super.getCurrentTab() != Constants.TAB_INVENTORY) {
  1546.                         super.openTab(Constants.TAB_INVENTORY);
  1547.                 }
  1548.  
  1549.                 int[] items = super.getInventoryArray();
  1550.  
  1551.                 int index = 0;
  1552.                 while(index < items.length && items[index] != id) {
  1553.                         ++index;
  1554.                 }
  1555.  
  1556.                 if(index != items.length) {
  1557.                         Point location = super.getInventoryItemPoint(index);
  1558.  
  1559.                         super.moveMouse(location.x + 17, location.y + 17, 6, 6);
  1560.                         super.clickMouse(true);
  1561.  
  1562.                         return atMenu(Option);
  1563.                 }
  1564.                 else {
  1565.                         return false;
  1566.                 }
  1567.         }
  1568.  
  1569.         /*
  1570.          * Checks if your inventory contains all of the specific items.
  1571.          * Credits: Unknown500
  1572.          * @param id of the item you want to click
  1573.          * @return true if the item was clickd otherwise false
  1574.          */
  1575.         public boolean leftClickInventoryItem(int id) {
  1576.                 if (super.getCurrentTab() != Constants.TAB_INVENTORY) {
  1577.                         super.openTab(Constants.TAB_INVENTORY);
  1578.                 }
  1579.  
  1580.                 int[] items = super.getInventoryArray();
  1581.  
  1582.                 int index = 0;
  1583.                 while(index < items.length && items[index] != id) {
  1584.                         ++index;
  1585.                 }
  1586.  
  1587.                 if(index != items.length) {
  1588.                         Point location = super.getInventoryItemPoint(index);
  1589.  
  1590.                         super.moveMouse(location.x + 12, location.y + 12, 4, 4);
  1591.                         super.clickMouse(true);
  1592.  
  1593.                         return true;
  1594.                 }
  1595.                 else {
  1596.                         return false;
  1597.                 }
  1598.         }
  1599.  
  1600.         public boolean clickTile(RSTile tile, String action) {
  1601.                 try {
  1602.                         Point location = Calculations.tileToScreen(tile);
  1603.                         if (location.x == -1 || location.y == -1) {
  1604.                                 return false;
  1605.                         }
  1606.                         moveMouse(location, 10, 10);
  1607.  
  1608.                         clickMouse(true);
  1609.                         wait(random(500, 1000));
  1610.                         while (true) {
  1611.                                 if (!getMyPlayer().isMoving()) {
  1612.                                         break;
  1613.                                 }
  1614.                                 wait(random(500, 1000));
  1615.                         }
  1616.                         return true;
  1617.                 } catch (Exception e) {
  1618.                         return false;
  1619.                 }
  1620.         }
  1621.  
  1622.         /**
  1623.          * Performs the provided action on a random inventory item with the given
  1624.          * ID.
  1625.          *
  1626.          * @param itemID The ID of the item to look for.
  1627.          * @param option The menu action to click.
  1628.          * @return <tt>true</tt> if the action was clicked; otherwise false.
  1629.          */
  1630.         public boolean atInventoryItem(int itemID, String option) {
  1631.                 try {
  1632.                         if (getCurrentTab() != TAB_INVENTORY && !RSInterface.getInterface(INTERFACE_BANK).isValid() && !RSInterface.getInterface(INTERFACE_STORE).isValid()) {
  1633.                                 openTab(TAB_INVENTORY);
  1634.                         }
  1635.  
  1636.                         RSInterfaceChild inventory = getInventoryInterface();
  1637.                         if (inventory == null || inventory.getComponents() == null)
  1638.                                 return false;
  1639.  
  1640.                         java.util.List<RSInterfaceComponent> possible = new ArrayList<RSInterfaceComponent>();
  1641.                         for (RSInterfaceComponent item : inventory.getComponents()) {
  1642.                                 if (item != null && item.getComponentID() == itemID) {
  1643.                                         possible.add(item);
  1644.                                 }
  1645.                         }
  1646.  
  1647.                         if (possible.size() == 0)
  1648.                                 return false;
  1649.  
  1650.                         RSInterfaceComponent item = possible.get(random(0, Math.min(2, possible.size())));
  1651.                         Rectangle pos = item.getArea();
  1652.                         int dx = (int) (pos.getWidth() - 6) / 4;
  1653.                         int dy = (int) (pos.getHeight() - 6) / 4;
  1654.                         int midx = (int) (pos.getMinX() + item.getWidth() / 2);
  1655.                         int midy = (int) (pos.getMinY() + item.getHeight() / 2);
  1656.                         moveMouse(midx + random(-10, 10), midy + random(-10, 10));
  1657.                         wait(random(50, 60));
  1658.                         return atMenu(option);
  1659.                 } catch (Exception e) {
  1660.                         log("atInventoryItem(int itemID, String option) Error: " + e);
  1661.                         return false;
  1662.                 }
  1663.         }
  1664.  
  1665.         public boolean pouchFill(final int i) {
  1666.         //      final int startCount = getInventoryCount(pessID);
  1667.                 leftClickInventoryItem(i);
  1668.                 if (i == smallpouch) {
  1669.                         if (inventoryContains(mediumpouch)) {
  1670.                                 hoverPouch(mediumpouch);
  1671.                         } else {
  1672.                                 hoverPouch(mediumpouchdecay);
  1673.                         }
  1674.                 } else if (i == mediumpouch
  1675.                                 || i == mediumpouchdecay) {
  1676.                         if (inventoryContains(largepouch)) {
  1677.                                 hoverPouch(largepouch);
  1678.                         } else {
  1679.                                 hoverPouch(largepouchdecay);
  1680.                         }
  1681.                 } else if (i == largepouch
  1682.                                 || i == largepouchdecay) {
  1683.                         if (inventoryContains(giantpouch)) {
  1684.                                 hoverPouch(giantpouch);
  1685.                         } else {
  1686.                                 hoverPouch(giantpouchdecay);
  1687.                         }
  1688.                 }
  1689.                 wait(random(500, 600));
  1690.         //      final int endCount = getInventoryCount(pessID);
  1691.         //      if (endCount < startCount || failcount >= 5) {
  1692.                         failcount = 0;
  1693.                         return true;
  1694.                 //} else {
  1695.                 //      failcount++;
  1696.                 //      pouchFill(i);
  1697.                 //}
  1698.                 //return false;
  1699.         }
  1700.        
  1701.        
  1702.  
  1703.         public boolean pouchEmpty(final int i) {
  1704.                 final int startCount = getInventoryCount(pessID);
  1705.                 //rightClickInventoryItem(i, "mpty");
  1706.                 atInventoryItem(i, "mpty");
  1707.                 if (i == smallpouch) {
  1708.                         if (inventoryContains(mediumpouch)) {
  1709.                                 hoverPouch(mediumpouch);
  1710.                         } else {
  1711.                                 hoverPouch(mediumpouchdecay);
  1712.                         }
  1713.                 } else if (i == mediumpouch
  1714.                                 || i == mediumpouchdecay) {
  1715.                         if (inventoryContains(largepouch)) {
  1716.                                 hoverPouch(largepouch);
  1717.                         } else {
  1718.                                 hoverPouch(largepouchdecay);
  1719.                         }
  1720.                 } else if (i == largepouch
  1721.                                 || i == largepouchdecay) {
  1722.                         if (inventoryContains(giantpouch)) {
  1723.                                 hoverPouch(giantpouch);
  1724.                         } else {
  1725.                                 hoverPouch(giantpouchdecay);
  1726.                         }
  1727.                 }
  1728.                 wait(random(500, 800));
  1729.                 final int endCount = getInventoryCount(pessID);
  1730.                 if (endCount > startCount || failcount >= 5) {
  1731.                         failcount = 0;
  1732.                         return true;
  1733.                 } else {
  1734.                         failcount++;
  1735.                         pouchEmpty(i);
  1736.                 }
  1737.                 return false;
  1738.         }
  1739.  
  1740.         public double betweenPoints(Point x, Point y) {
  1741.                 return (Math.hypot((x.x - y.x), (x.y - y.y)));
  1742.         }
  1743.  
  1744.         public boolean hoverPouch(final int itemID) {
  1745.                 final int[] pouch = getInventoryArray();
  1746.                 final java.util.List<Integer> possible = new ArrayList<Integer>();
  1747.                 for (int i = 0; i < pouch.length; i++) {
  1748.                         if (pouch[i] == itemID) {
  1749.                                 possible.add(i);
  1750.                         }
  1751.                 }
  1752.                 if (possible.size() == 0) {
  1753.                         return false;
  1754.                 }
  1755.                 final int idx = possible.get(0);
  1756.                 final Point t = getInventoryItemPoint(idx);
  1757.                 if (betweenPoints(getMouseLocation(), t) > 7) {
  1758.                         moveMouse(t, 5, 5);
  1759.                         return true;
  1760.                 } else {
  1761.                         return true;
  1762.                 }
  1763.         }
  1764.        
  1765.        
  1766.         public boolean isLagging() {
  1767.                 return Bot.getClient().getLoginIndex() == 10;
  1768.         }
  1769.        
  1770.        
  1771.         public boolean isConnectionLost() {
  1772.                 return Bot.getClient().getLoginIndex() == 12;
  1773.         }
  1774.  
  1775.         public void autoTalk() {
  1776.                 final int myLevel = skills.getCurrentSkillLevel(Constants.STAT_RUNECRAFTING);
  1777.                 int delay = random(500, 3000);
  1778.  
  1779.                 if (getLastMessage().toLowerCase().contains("rc lvl")) {
  1780.                         sendText("" + myLevel, true);
  1781.                         wait(delay);
  1782.                 }
  1783.                 if (getLastMessage().toLowerCase().contains("rc lvls")) {
  1784.                         sendText("" + myLevel, true);
  1785.                         wait(delay);
  1786.                 }
  1787.                 if (getLastMessage().toLowerCase().contains("runecrafting lvl?")) {
  1788.                         sendText("" + myLevel, true);
  1789.                         wait(delay);
  1790.                 }
  1791.                 if (getLastMessage().toLowerCase().contains("Whats your level in runecrafting?")) {
  1792.                         sendText("" + myLevel, true);
  1793.                         wait(delay);
  1794.                 }
  1795.                 if (getLastMessage().toLowerCase().contains("What is your level in runecrafting")) {
  1796.                         sendText("" + myLevel, true);
  1797.                         wait(delay);
  1798.                 }
  1799.                 if (getLastMessage().toLowerCase().contains("runecrafting levels")) {
  1800.                         sendText("" + myLevel, true);
  1801.                         wait(delay);
  1802.                 }
  1803.                 if (getLastMessage().toLowerCase().contains("runecrafting level")) {
  1804.                         sendText("" + myLevel, true);
  1805.                         wait(delay);
  1806.                 }
  1807.                 if (getLastMessage().toLowerCase().contains("bot?")) {
  1808.                         sendText("sure :/", true);
  1809.                         wait(delay);
  1810.                 }
  1811.                 if (getLastMessage().toLowerCase().contains("u bot?")) {
  1812.                         sendText("pffft go away idiot", true);
  1813.                         wait(delay);
  1814.                 }
  1815.                 if (getLastMessage().toLowerCase().contains("botter?")) {
  1816.                         sendText("not at all", true);
  1817.                         wait(delay);
  1818.                 }
  1819.                 if (getLastMessage().toLowerCase().contains("auto?")) {
  1820.                         sendText("autowhat?", true);
  1821.                         wait(delay);
  1822.                 }
  1823.                 if (getLastMessage().toLowerCase().contains("u auto?")) {
  1824.                         sendText("no way dude!!!", true);
  1825.                         wait(delay);
  1826.                 }
  1827.                 if (getLastMessage().toLowerCase().contains("how r u?")) {
  1828.                         sendText("great thanks, u?", true);
  1829.                         wait(delay);
  1830.                 }
  1831.                 if (getLastMessage().toLowerCase().contains("how are you?")) {
  1832.                         sendText("cool ty", true);
  1833.                         wait(delay);
  1834.                 }
  1835.                 if (getLastMessage().toLowerCase().contains("how are you doing?")) {
  1836.                         sendText("fiine.", true);
  1837.                         wait(delay);
  1838.                 }
  1839.                 if (getLastMessage().toLowerCase().contains("whats up?")) {
  1840.                         sendText("NM, you?", true);
  1841.                         wait(delay);
  1842.                 }
  1843.                 if (getLastMessage().toLowerCase().contains("sup?")) {
  1844.                         sendText("nothing you?", true);
  1845.                         wait(delay);
  1846.                 }
  1847.                 if (getLastMessage().toLowerCase().contains("hi")) {
  1848.                         sendText("hey.", true);
  1849.                         wait(delay);
  1850.                 }
  1851.                 if (getLastMessage().toLowerCase().contains("hello")) {
  1852.                         sendText("hi :)", true);
  1853.                         wait(delay);
  1854.                 }
  1855.                 if (getLastMessage().toLowerCase().contains("howdy")) {
  1856.                         sendText("howdy partner =P", true);
  1857.                         wait(delay);
  1858.                 }
  1859.                 if (getLastMessage().toLowerCase().contains("jo")) {
  1860.                         sendText("k", true);
  1861.                         wait(delay);
  1862.                 }
  1863.                 if (getLastMessage().toLowerCase().contains("joo")) {
  1864.                         sendText("jah", true);
  1865.                         wait(delay);
  1866.                 }
  1867.                 if (getLastMessage().toLowerCase().contains("hey")) {
  1868.                         sendText("hmmm hiya", true);
  1869.                         wait(delay);
  1870.                 }
  1871.                 if (getLastMessage().toLowerCase().contains("ello")) {
  1872.                         sendText("howdie", true);
  1873.                         wait(delay);
  1874.                 }
  1875.                 if (getLastMessage().toLowerCase().contains("hii")) {
  1876.                         sendText("bonjour", true);
  1877.                         wait(delay);
  1878.                 }
  1879.                 if (getLastMessage().toLowerCase().contains("helo")) {
  1880.                         sendText("hi, bye", true);
  1881.                         wait(delay);
  1882.                 }
  1883.                 if (getLastMessage().toLowerCase().contains("How long you been rcin?")) {
  1884.                         sendText("couple of hours or so.", true);
  1885.                         wait(delay);
  1886.                 }
  1887.                 if (getLastMessage().toLowerCase().contains("How long u been runecrafting?")) {
  1888.                         sendText("quite a while", true);
  1889.                         wait(delay);
  1890.                 }
  1891.                 if (getLastMessage().toLowerCase().contains("How long u been runecraftin?")) {
  1892.                         sendText("not long m8", true);
  1893.                         wait(delay);
  1894.                 }
  1895.                 if (getLastMessage().toLowerCase().contains("(stake)")) {
  1896.                         sendText("No thanks, I'm busy.", true);
  1897.                         wait(delay);
  1898.                 }
  1899.                 if (getLastMessage().toLowerCase().contains("(friendly)")) {
  1900.                         sendText("sorry, busy.", true);
  1901.                         wait(delay);
  1902.                 }
  1903.                 if (getLastMessage().toLowerCase().contains("cmon")) {
  1904.                         sendText("no sorry", true);
  1905.                         wait(delay);
  1906.                 }
  1907.                 if (getLastMessage().toLowerCase().contains("c'mon")) {
  1908.                         sendText("busy.", true);
  1909.                         wait(delay);
  1910.                 }
  1911.                 if (getLastMessage().toLowerCase().contains("please?")) {
  1912.                         sendText("go away!", true);
  1913.                         wait(delay);
  1914.                 }
  1915.                 if (getLastMessage().toLowerCase().contains("pleasee")) {
  1916.                         sendText("go away now!", true);
  1917.                         wait(delay);
  1918.                 }
  1919.                 if (getLastMessage().toLowerCase().contains("My runecrafting level is")) {
  1920.                         sendText("Nice", true);
  1921.                         wait(delay);
  1922.                 }
  1923.                 if (getLastMessage().toLowerCase().contains("My rc level is")) {
  1924.                         sendText("i'm jealous", true);
  1925.                         wait(delay);
  1926.                 }
  1927.                 if (getLastMessage().toLowerCase().contains("My rcin level is")) {
  1928.                         sendText("nj", true);
  1929.                         wait(delay);
  1930.                 }
  1931.                 if (getLastMessage().toLowerCase().contains("wishes to trade")) {
  1932.                         sendText("can't you see i'm busy?", true);
  1933.                         wait(delay);
  1934.                 }
  1935.         }
  1936.        
  1937.         protected int getMouseSpeed() {
  1938.                 if(naturerunecount <= 2000){
  1939.                         return 5;
  1940.                 }else if(naturerunecount > 2000 & naturerunecount < 3000){
  1941.                         return 6;
  1942.                 }else {
  1943.                         return 8;
  1944.                 }
  1945.         }
  1946.        
  1947. //      public int fixPouches() {
  1948. //        debug="Talking to mage";
  1949. //        if(clickContinue()) {
  1950. //            return random(700,800);
  1951. //        }
  1952. //
  1953. //        debug="Telling mage to fix pouch.";
  1954. //        RSInterfaceChild o = getInterface(230);
  1955. //        if (o.length > 0) {
  1956. //
  1957. //              RSInterfaceChild  repair = o[0];
  1958. //            if(repair.containsAction("Continue")) {
  1959. //                Talk = new KTimer(5000);
  1960. //            busy=true;
  1961. //            }
  1962. //            return random(50,100);
  1963. //        }
  1964. //        if(RSInterface.getInterface(88).isValid()) {
  1965. //            debug = "Selecting mage";
  1966. //            Rectangle visible = RSInterface.getChildInterface(88,21).getArea();
  1967. //            RSInterfaceComponent mage = RSInterface.getChildInterface(88, 22).getComponents()[14];
  1968. //            Rectangle it = mage.getArea();
  1969. //            if(visible.contains(it) && visible.contains(it)) {
  1970. //                if(mage.containsText("Speak-to")) {
  1971. //                    busy=true;
  1972. //                    dialogueTimer = new KTimer(10000);
  1973. //                    return random(50,100);
  1974. //                }
  1975. //
  1976. //                return random(50,100);
  1977. //            }
  1978. //            debug = "Scrolling to mage";
  1979. //            RSInterfaceChild  scrollBar = RSInterface.getInterface(88).getChild(20);
  1980. //                if (scrollBar == null)
  1981. //                    return random(50, 100);
  1982. //                Point scroll = new Point((int) scrollBar.getAbsoluteX() + random(2, 10), (int) scrollBar.getAbsoluteY() + scrollBar.getHeight() - random(40, 20));
  1983. //                moveMouse(scroll);
  1984. //                if(menuItems.get(a).("Walk"))
  1985. //                    return random(50,100);
  1986. //                clickMouse(true);
  1987. //            return random(50,100);
  1988. //        }
  1989. //        debug="Banking";
  1990. //         if (!inventoryContains(556) || !inventoryContains(564) || !inventoryContains(9075))
  1991. //            return withdrawCast();
  1992. //            if(bank.isOpen())
  1993. //           bank.close();
  1994. //        openTab(Constants.TAB_MAGIC);
  1995. //        atInterface(430,26);
  1996. //        busy=true;
  1997. //        InterfaceTimer = new Timer(5000);
  1998. //        return random(50,100);
  1999. //
  2000. //    }
  2001.  
  2002.         public boolean craft(RSTile tile, String action) {
  2003.                 try {
  2004.                         if (tileOnScreen(altarTile)) {
  2005.                                 Point location = Calculations.tileToScreen(tile.getX(), tile
  2006.                                                 .getY(), 0, 0, 0);
  2007.  
  2008.                                 if (location.x == -1 || location.y == -1) {
  2009.                                         return false;
  2010.                                 }
  2011.                                 moveMouse(location, 3, 3);
  2012.                                 clickMouse(true);
  2013.                         }
  2014.                 } catch (Exception e) {
  2015.                         return false;
  2016.                 }
  2017.                 return false;
  2018.         }
  2019.  
  2020.         private boolean playerInArea(int maxX, int maxY, int minX, int minY) {
  2021.                 int x = getMyPlayer().getLocation().getX();
  2022.                 int y = getMyPlayer().getLocation().getY();
  2023.                 if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
  2024.                         return true;
  2025.                 }
  2026.                 return false;
  2027.         }
  2028.  
  2029.  
  2030.         public boolean Run(final boolean running) {
  2031.                 try {
  2032.                         final long startTime = System.currentTimeMillis();
  2033.                         while (System.currentTimeMillis() - startTime < graahkCraft.timeout) {
  2034.                                 if (running) {
  2035.                                         while (!isRunning())
  2036.                                                 wait(random(200, 230));
  2037.                                         return true;
  2038.                                 } else {
  2039.                                         while (isRunning())
  2040.                                                 wait(random(200, 230));
  2041.                                         return true;
  2042.                                 }
  2043.                         }
  2044.                         return false;
  2045.                 } catch (final Exception e) {
  2046.                         return false;
  2047.                 }
  2048.         }
  2049.  
  2050.         public void Rest(final int stopEnergy) {
  2051.                 rest(stopEnergy);
  2052.         }
  2053.  
  2054.         public class antiban extends Thread {
  2055.  
  2056.                 public void checkFriendsList() {
  2057.                         openTab(Constants.TAB_FRIENDS);
  2058.                         moveMouse(random(554, 709), random(227, 444));
  2059.                 }
  2060.  
  2061.                 public void checkSkills() {
  2062.                         openTab(Constants.TAB_STATS);
  2063.                         moveMouse(random(552, 603), random(420, 449));
  2064.                 }
  2065.  
  2066.                 public int getRandomMouseX(final int maxDistance) {
  2067.                         final Point p = getMouseLocation();
  2068.                         if (random(0, 2) == 0) {
  2069.                                 return p.x - random(0, p.x < maxDistance ? p.x : maxDistance);
  2070.                         } else {
  2071.                                 return p.x
  2072.                                 + random(1, 762 - p.x < maxDistance ? 762 - p.x
  2073.                                                 : maxDistance);
  2074.                         }
  2075.                 }
  2076.  
  2077.                 public int getRandomMouseY(final int maxDistance) {
  2078.                         final Point p = getMouseLocation();
  2079.                         if (random(0, 2) == 0) {
  2080.                                 return p.y - random(0, p.y < maxDistance ? p.y : maxDistance);
  2081.                         } else {
  2082.                                 return p.y
  2083.                                 + random(1, 500 - p.y < maxDistance ? 500 - p.y
  2084.                                                 : maxDistance);
  2085.                         }
  2086.                 }
  2087.  
  2088.                 public boolean moveMouseRandomly(int maxDistance) {
  2089.                         if (maxDistance == 0) {
  2090.                                 return false;
  2091.                         }
  2092.                         maxDistance = random(1, maxDistance);
  2093.                         final Point p = new Point(getRandomMouseX(maxDistance),
  2094.                                         getRandomMouseY(maxDistance));
  2095.                         if (p.x < 1 || p.y < 1) {
  2096.                                 p.x = p.y = 1;
  2097.                         }
  2098.                         moveMouse(p);
  2099.                         if (random(0, 2) == 0) {
  2100.                                 return false;
  2101.                         }
  2102.                         return moveMouseRandomly(maxDistance / 2);
  2103.                 }
  2104.  
  2105.                 public long nextTime(final int waitTime) {
  2106.                         return time() + waitTime;
  2107.                 }
  2108.  
  2109.                 public long nextTime(final int min, final int max) {
  2110.                         return nextTime(random(min, max));
  2111.                 }
  2112.  
  2113.                 @Override
  2114.                 public void run() {
  2115.                         try {
  2116.                                 final int roll = (int) (Math.random() * 1000);
  2117.                                 if (timeToNext < time()) {
  2118.                                         if (roll > 995) {
  2119.                                         } else if (roll > 990 && getInventoryCount() < 23) {
  2120.                                                 checkSkills();
  2121.                                                 timeToNext = System.currentTimeMillis()
  2122.                                                 + random(2000, 25000);
  2123.                                         } else if (roll > 985
  2124.                                                         && getInventoryCount() < 23
  2125.                                                         && !RSInterface.getInterface(751).getChild(15)
  2126.                                                         .getText().contains("Off")) {
  2127.                                                 checkFriendsList();
  2128.                                                 timeToNext = System.currentTimeMillis()
  2129.                                                 + random(2000, 25000);
  2130.                                         } else if (roll > 980 && getInventoryCount() < 23) {
  2131.                                                 checkSkills();
  2132.                                                 timeToNext = System.currentTimeMillis()
  2133.                                                 + random(2000, 25000);
  2134.                                         } else if (roll > 960) {
  2135.                                                 if (random(0, 2) == 0) {
  2136.                                                         setCameraRotation((int) (getCameraAngle() + (Math
  2137.                                                                         .random() * 50 > 25 ? 1 : -1)
  2138.                                                                         * (30 + Math.random() * 90)));
  2139.                                                 } else {
  2140.                                                         final int key = random(0, 3) < 0 ? KeyEvent.VK_UP
  2141.                                                                         : KeyEvent.VK_DOWN;
  2142.                                                         Bot.getInputManager().pressKey((char) key);
  2143.                                                         Thread.sleep(random(1000, 1500));
  2144.                                                         Bot.getInputManager().releaseKey((char) key);
  2145.                                                 }
  2146.                                         } else if (roll > 940) {
  2147.                                                 timeToNext = System.currentTimeMillis()
  2148.                                                 + random(2000, 25000);
  2149.                                                 openTab(Constants.TAB_INVENTORY);
  2150.                                         } else if (roll > 890 && !isRunning()
  2151.                                                         && getMyPlayer().isMoving()) {
  2152.                                                 if (getEnergy() > 50) {
  2153.                                                         clickMouse(random(707, 762), random(90, 121), true);
  2154.                                                         timeToNext = nextTime(500, 1200);
  2155.                                                 } else if (rest) {
  2156.                                                         Rest(100);
  2157.                                                         Run(true);
  2158.                                                         timeToNext = nextTime(500, 1200);
  2159.                                                 }
  2160.                                                 Thread.sleep(random(300, 1000));
  2161.                                         } else if (roll > 780) {
  2162.                                                 moveMouseRandomly(500);
  2163.                                                 timeToNext = nextTime(500, 7500);
  2164.                                         }
  2165.                                 } else {
  2166.                                         Thread.yield();
  2167.                                 }
  2168.                         } catch (final InterruptedException e) {
  2169.                                 log("Interrupted");
  2170.                         }
  2171.                 }
  2172.  
  2173.                 public long time() {
  2174.                         return System.currentTimeMillis();
  2175.                 }
  2176.  
  2177.                 public boolean timePassed(final long time) {
  2178.                         return time() > time;
  2179.                 }
  2180.  
  2181.                 public void turnCameraRandom() {
  2182.                         setCameraRotation((int) (getCameraAngle() + (Math.random() * 50 > 25 ? 1
  2183.                                         : -1)
  2184.                                         * (30 + Math.random() * 90)));
  2185.                 }
  2186.         }
  2187.  
  2188.         private int antiBan() {
  2189.                 int random = random(1, 24);
  2190.  
  2191.                 switch (random) {
  2192.                 case 1:
  2193.                         int x = random(0, 750);
  2194.                         int y = random(0, 500);
  2195.                         if (random(1, 10) == 5)
  2196.                                 moveMouse(0, 0, x, y);
  2197.                         return random(1000, 1500);
  2198.  
  2199.                 case 2:
  2200.                         if (getCurrentTab() != TAB_INVENTORY) {
  2201.                                 openTab(TAB_INVENTORY);
  2202.                                 return random(500, 750);
  2203.                         } else {
  2204.                                 return random(500, 750);
  2205.                         }
  2206.  
  2207.                 case 3:
  2208.                         if (random(1, 40) == 30) {
  2209.                                 if (getMyPlayer().isMoving()) {
  2210.                                         return random(750, 1000);
  2211.                                 }
  2212.                                 if (getCurrentTab() != TAB_STATS) {
  2213.                                         openTab(TAB_STATS);
  2214.                                 }
  2215.                                 moveMouse(560, 420, 40, 20);
  2216.                                 wait(random(3000, 6000));
  2217.                                 return random(100, 200);
  2218.                         }
  2219.                 }
  2220.                 return 500;
  2221.         }
  2222.  
  2223.         public boolean onStart(Map<String, String> args) {
  2224.                 if (!isLoggedIn()) {
  2225.                         log("Please log in before starting.");
  2226.                         return false;
  2227.                 }
  2228.                 try {
  2229.             final URL cursorURL = new URL(
  2230.                     "http://i47.tinypic.com/wkh6py.png");
  2231.             final URL cursor80URL = new URL(
  2232.                     "http://i50.tinypic.com/2ltn7eu.png");
  2233.             normal = ImageIO.read(cursorURL);
  2234.             clicked = ImageIO.read(cursor80URL);
  2235.         } catch (MalformedURLException e) {
  2236.             log("Unable to buffer cursor.");
  2237.         } catch (IOException e) {
  2238.             log("Unable to open cursor image.");
  2239.         }
  2240.                 ACTION = BANK;
  2241.                 crafted = 0;
  2242.                 log.severe("Please make sure you have a Spirit Graahk summoned before starting.");
  2243.                 startXP = skills.getCurrentSkillExp(STAT_RUNECRAFTING);
  2244.                 startTime = System.currentTimeMillis() - 1000;
  2245.                 GEItemInfo natMarketPrice = grandExchange.loadItemInfo(natID);
  2246.                 GEItemInfo pessMarketPrice = grandExchange.loadItemInfo(pessID);
  2247.                 natPrice = natMarketPrice.getMarketPrice();
  2248.                 pessPrice = pessMarketPrice.getMarketPrice();
  2249.                 frame = new graahkGUI();
  2250.                 frame.setVisible(true);
  2251.                 while (!startScript) {
  2252.                         wait(10);
  2253.                 }
  2254.                 return true;
  2255.         }
  2256.  
  2257.         public void onFinish() {
  2258.                 updateStats(true);
  2259.                 log("Updating Stats For " + user + " " + crafted + " natures this run");
  2260.                
  2261.         }
  2262.        
  2263.         @SuppressWarnings("unused")
  2264.         private String getFormattedTime(final long timeMillis) {
  2265.                 long millis = timeMillis;
  2266.                 final long seconds2 = millis / 1000;
  2267.                 final long hours = millis / (1000 * 60 * 60);
  2268.                 millis -= hours * 1000 * 60 * 60;
  2269.                 final long minutes = millis / (1000 * 60);
  2270.                 millis -= minutes * 1000 * 60;
  2271.                 final long seconds = millis / 1000;
  2272.                 String hoursString = "";
  2273.                 String minutesString = "";
  2274.                 String secondsString = seconds + "";
  2275.                 String type = "seconds";
  2276.  
  2277.                 if (minutes > 0) {
  2278.                         minutesString = minutes + ":";
  2279.                         type = "minutes";
  2280.                 } else if (hours > 0 && seconds2 > 0) {
  2281.                         minutesString = "0:";
  2282.                 }
  2283.                 if (hours > 0) {
  2284.                         hoursString = hours + ":";
  2285.                         type = "hours";
  2286.                 }
  2287.                 if (minutes < 10 && !type.equals("seconds")) {
  2288.                         minutesString = "0" + minutesString;
  2289.                 }
  2290.                 if (hours < 10 && type.equals("hours")) {
  2291.                         hoursString = "0" + hoursString;
  2292.                 }
  2293.                 if (seconds < 10 && !type.equals("seconds")) {
  2294.                         secondsString = "0" + secondsString;
  2295.                 }
  2296.                 return hoursString + minutesString + secondsString + " " + type;
  2297.         }
  2298.        
  2299.         public void onRepaint(Graphics render) {
  2300.                 ((Graphics2D)render).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  2301.                 ((Graphics2D)render).setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
  2302.                 ((Graphics2D)render).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
  2303.                 ((Graphics2D)render).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  2304.                 Mouse m = Bot.getClient().getMouse();
  2305.        
  2306.         long runTime = System.currentTimeMillis() - startTime;
  2307.                 int secs = ((int) ((runTime / 1000) % 60));
  2308.                 int mins = ((int) (((runTime / 1000) / 60) % 60));
  2309.                 int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
  2310.                
  2311.                 int XPgain = skills.getCurrentSkillExp(STAT_RUNECRAFTING) - startXP;
  2312.                 time = (System.currentTimeMillis() - startTime) / 1000;
  2313.                
  2314.                 DecimalFormat d = new DecimalFormat("#,#00");
  2315.                 d.setMaximumFractionDigits(0);
  2316.                        
  2317.                         if (normal != null) {
  2318.                                 final Mouse mouse = Bot.getClient().getMouse();
  2319.                                 final int mouse_x = mouse.getMouseX();
  2320.                                 final int mouse_y = mouse.getMouseY();
  2321.                                 final int mouse_x2 = mouse.getMousePressX();
  2322.                                 final int mouse_y2 = mouse.getMousePressY();
  2323.                                 final long mpt = System.currentTimeMillis()
  2324.                                 - mouse.getMousePressTime();
  2325.                                 if (mouse.getMousePressTime() == -1 || mpt >= 1000) {
  2326.                                         render.drawImage(normal, mouse_x - 8, mouse_y - 8, null);
  2327.                                 }
  2328.                                 if (mpt < 1000) {
  2329.                                         render.drawImage(clicked, mouse_x2 - 8, mouse_y2 - 8, null);
  2330.                                         render.drawImage(normal, mouse_x - 8, mouse_y - 8, null);
  2331.                                 }
  2332.                         }
  2333.                
  2334.                        
  2335.                         if (isLoggedIn()) {
  2336.                        
  2337.                         //Background
  2338.                         render.setColor(new Color(0, 0, 0, 194));
  2339.                         render.fillRoundRect(354, 115, 150, 216, 6, 6);
  2340.                         render.setColor(new Color(10, 176, 250));
  2341.                         render.drawRoundRect(354, 115, 150, 216, 6, 6);
  2342.                         //Top Bar
  2343.                         render.setColor(new Color(0, 0, 0, 145));
  2344.                         render.fillRoundRect(367, 124, 129, 30, 5,5);   //Backdrop
  2345.                         render.setColor(new Color(255, 255, 255, 71));
  2346.                         render.fillRect(367, 125, 128, 14);     //gloss
  2347.                         render.setColor(new Color(10, 176, 250));
  2348.                         render.drawRoundRect(367, 124, 129, 30, 5, 5);
  2349.                         //Top Dividing Line
  2350.                         render.setColor(new Color(54, 189, 255));
  2351.                         render.drawLine(389, 166, 471, 166);
  2352.                         render.setColor(new Color(20, 130, 184));
  2353.                         render.drawLine(389, 167, 471, 167);
  2354.                         //Bottom Dividing Line
  2355.                         render.setColor(new Color(54, 189, 255));
  2356.                         render.drawLine(389, 280, 471, 280);
  2357.                         render.setColor(new Color(20, 130, 184));
  2358.                         render.drawLine(389, 281, 471, 281);
  2359.                         //Bottom Bar
  2360.                         render.setColor(new Color(0, 128, 209));
  2361.                         render.fillRect(366, 293, 123, 30);     //Background
  2362.                         render.setColor(new Color(255, 255, 255, 40));
  2363.                         render.fillRect(366, 293, 123, 16);     //gloss
  2364.                         render.setColor(new Color(0, 0, 0, 255));
  2365.                         render.drawRect(366, 293, 123, 30);
  2366.  
  2367.                         //Text
  2368.                                 render.setFont(new Font("SansSerif", 0, 10));
  2369.                                 render.setColor(new Color(255, 255, 255));
  2370.                         render.drawString("Time Running: ", 371, 182);
  2371.                         render.drawString("Nats Crafted: ", 371, 203);
  2372.                         render.drawString("Nats per Hour: " , 371, 224);
  2373.                         render.drawString("Exp Gained: ", 371, 245);
  2374.                         render.drawString("Exp per Hour: ", 371, 265);
  2375.                                 render.setFont(new Font("SansSerif", 0, 10));
  2376.                                 render.setColor(new Color(10, 176, 250));
  2377.                         render.drawString(d.format(hours) + ":" + d.format(mins)
  2378.                                 + ":" + d.format(secs), 445, 182);      //Time
  2379.                         render.drawString("" + crafted, 444, 203);      //Runes Crafted
  2380.                         render.drawString("" + (crafted * 60 * 60) / time, 442, 224);   //Craft per Hour
  2381.                         render.drawString("" + XPgain, 434, 245);       //Exp Gain
  2382.                         render.drawString("" + (XPgain * 60 * 60) / time, 438, 266);    //Exp Hour
  2383.                                 render.setFont(new Font("Arial", 0, 12));
  2384.                                 render.setColor(new Color(255, 255, 255));
  2385.                         render.drawString("GraahkNatureCrafter", 372, 143);
  2386.                         //Bar Text
  2387.                         render.setFont(new Font("SansSerif", 0, 10));
  2388.                         render.setColor(new Color(0, 0, 0, 255));
  2389.                         render.drawString("Profit Made: ", 382, 303);
  2390.                         render.setColor(new Color(255, 255, 255, 255));
  2391.                         int profit = (natPrice - pessPrice) * crafted;
  2392.                         render.drawString("" + p