Guest
Public paste!

patrick211194

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 47.22 KB | Hits: 11 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. import javax.swing.*;
  2. import javax.swing.event.*;
  3. import java.awt.*;
  4. import java.awt.event.*;
  5. import java.io.*;
  6. import java.net.*;
  7. import java.util.*;
  8. import java.util.List;
  9. import javax.swing.WindowConstants;
  10.  
  11. import org.rsbot.bot.Bot;
  12. import org.rsbot.bot.input.Mouse;
  13. import org.rsbot.event.events.ServerMessageEvent;
  14. import org.rsbot.event.listeners.PaintListener;
  15. import org.rsbot.event.listeners.ServerMessageListener;
  16. import org.rsbot.script.Calculations;
  17. import org.rsbot.script.Constants;
  18. import org.rsbot.script.Script;
  19. import org.rsbot.script.ScriptManifest;
  20. import org.rsbot.script.wrappers.RSInterface;
  21. import org.rsbot.script.wrappers.RSItemTile;
  22. import org.rsbot.script.wrappers.RSNPC;
  23. import org.rsbot.script.wrappers.RSObject;
  24. import org.rsbot.script.wrappers.RSTile;
  25. import org.rsbot.script.wrappers.RSItem;
  26. import org.rsbot.script.Bank;
  27.  
  28.  
  29. @ScriptManifest(authors = { "Lefou N' Gaston" }, category = "Combat", name = "AutoAKT", version = 1.5, description =
  30.                     "<html>" +
  31.  
  32.                     "<body bgcolor = 000000>" +
  33.  
  34.                     "<font color = 00FF00>"+
  35.  
  36.                     "<center><h1>Auto Al-Kharid Trainer</h1></center>" +
  37.  
  38.                     "<center>Developed By: Lefou N' Gaston</center>" +
  39.  
  40.                     "<br>" +
  41.  
  42.                     "<center>--------------------------</center>" +
  43.  
  44.                     "<h2 color = 00FF00 align = left>Setup</h2>" +
  45.  
  46.                     "<form name='form'>" +
  47.  
  48.                     "<font color = 00FF00>"+
  49.  
  50.                     "What attack style are you using?" +
  51.  
  52.                     "<br>" +
  53.  
  54.                     "<font color = 00FF00>"+
  55.  
  56.                     "<select name='style'>" +
  57.  
  58.                     "<OPTION value='Attack'>Attack</OPTION>" +
  59.  
  60.                     "<OPTION value='Strength'>Strength</OPTION>" +
  61.  
  62.                     "<OPTION value='Defence'>Defence</OPTION>" +
  63.  
  64.                     "</select>" +
  65.  
  66.                     "<br>" +
  67.  
  68.                     "Food type: <br>" +
  69.  
  70.                     "<font color = 00FF00>"+
  71.  
  72.                     "<select name='foodTypes'>" +
  73.  
  74.                     "<OPTION value='Trout'>Trout</OPTION>" +
  75.  
  76.                     "<OPTION value='Salmon'>Salmon</OPTION>" +
  77.  
  78.                     "<OPTION value='Tuna'>Tuna</OPTION>" +
  79.  
  80.                     "<OPTION value='Lobster'>Lobster</OPTION>" +
  81.  
  82.                     "<OPTION value='Don't Eat'>Don't Eat</OPTION>" +
  83.  
  84.                     "</select>" +
  85.  
  86.                     "<br>"+
  87.  
  88.                     "*Important* The Anti-Ban level must be at least 10.  The lower the number, the more often it occurs." +
  89.  
  90.                     "<br>" +
  91.  
  92.                     "Level of Anti-Ban:&nbsp<input type='text' name='antiLvl' value='20'><br>" +
  93.  
  94.                     "Loot Items:<br>" +
  95.  
  96.                     "<font color = 00FF00>"+
  97.  
  98.                     "<select name='lootItems'>" +
  99.  
  100.                     "<OPTION value='Yes'>Yes</OPTION>" +
  101.  
  102.                     "<OPTION value='No'>No</OPTION>" +
  103.                                        
  104.                                         "<OPTION value='herbs'>Only Herbs</OPTION>" +
  105.  
  106.                     "</select>" +
  107.  
  108.                     "<br>" +
  109.  
  110.                     "Bury Bones: <br>" +
  111.  
  112.                     "<font color = 00FF00>"+
  113.  
  114.                     "<select name='buryBones'>" +
  115.  
  116.                                         "<OPTION value='No'>No</OPTION>" +
  117.                                        
  118.                     "<OPTION value='Yes'>Yes</OPTION>" +
  119.  
  120.                     "</select>" +
  121.  
  122.                     "</form>" +
  123.  
  124.                     "</font>"+
  125.  
  126.                     "</body>" +
  127.  
  128.                     "</html>")
  129.  
  130. public class AutoAKT extends Script implements PaintListener, ServerMessageListener {
  131.  
  132.     boolean setAltitude = false;
  133.  
  134.     final int bankID[] = {35647, 497};
  135.     final int foodID[] = { 1895, 1893, 1891, 4293, 2142, 291, 2140, 3228, 9980,
  136.                            7223, 6297, 6293, 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343,
  137.                            1861, 13433, 315, 325, 319, 3144, 347, 355, 333, 339, 351, 329,
  138.                            3381, 361, 10136, 5003, 379, 365, 373, 7946, 385, 397, 391, 3369,
  139.                            3371, 3373, 2309, 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180,
  140.                            7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2003, 2011, 2289,
  141.                            2291, 2293, 2295, 2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897,
  142.                            1899, 1901, 7072, 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942,
  143.                            6701, 6703, 7054, 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978,
  144.                            5763, 5765, 1913, 5747, 1905, 5739, 1909, 5743, 1907, 1911, 5745,
  145.                            2955, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 2084, 2034, 2048,
  146.                            2036, 2217, 2213, 2205, 2209, 2054, 2040, 2080, 2277, 2225, 2255,
  147.                            2221, 2253, 2219, 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074,
  148.                            2030, 2281, 2235, 2064, 2028, 2187, 2185, 2229, 6883, 1971, 4608,
  149.                            1883, 1885, 1942
  150.                          };
  151.     final int bankArea[] = {3269, 3173, 3271, 3164};
  152.  
  153.  
  154.     final RSTile[] pathToWarriors = {new RSTile(3277, 3174), new RSTile(3284, 3182), new RSTile(3284, 3173)};
  155.     final RSTile[] pathToBank = {new RSTile(3292, 3179), new RSTile(3277, 3175), new RSTile(3269, 3168)};
  156.     final RSTile bankTile = new RSTile(3269, 3168);
  157.     final RSTile bankTile1 = new RSTile(3269, 3166);
  158.     final RSTile firstTile1 = new RSTile(3276, 3174);
  159.     final RSTile warriorTile = new RSTile(3290, 3169);
  160.     final RSTile warriorTile1 = new RSTile(3284, 3172);
  161.     final RSTile warriorTile2 = new RSTile(3290, 3173);
  162.     final RSTile[] toBank = {new RSTile(3285,3172),new RSTile(3291,3175),new RSTile(3287,3180),new RSTile(3281,3180),new RSTile(3279,3174),new RSTile(3275,3168),new RSTile(3269,3167),new RSTile(3269,3167)};
  163.  
  164.     final RSTile[] toMob = reversePath(toBank);
  165.     int tileX = 0;
  166.     int tileY = 0;
  167.     int xpGained = 0;
  168.     int rand = 0;
  169.     int k = 0;
  170.     int x = 0;
  171.     int lastAnti = 0;
  172.     int checkAnim = 0;
  173.     int rotCam = 0;
  174.     int randAnti = 0;
  175.     int randTab = 0;
  176.     float xpsec = 0;
  177.     float xpmin = 0;
  178.     float xphour = 0;
  179.     int y = 0;
  180.     int z = 0;
  181.     int kc = 0;
  182.     int useAntiBan = 5;
  183.     int lvlsGained = 0;
  184.         int hpLvlsGained = 0;
  185.     int startLvl;
  186.         int hpStartLvl;
  187.         int isInAntiBan = 0;
  188.     int antiLvl;
  189.     int maxHP = skills.getSkillMax(STAT_HITPOINTS);
  190.     int currentHP = skills.getCurrentSkillLevel(Constants.STAT_HITPOINTS);
  191.     int a = 0;
  192.     int i = 1;
  193.     int foodChosenID = 379;
  194.     int warriorID = 18;
  195.     int warriorDead = 836;
  196.     int foodNumber = 26;
  197.     int l = 0;
  198.     public String cbStyle = "Strength";
  199.     int startexp = 0;
  200.     public long startTime = System.currentTimeMillis();
  201.     private String status = "Idle";
  202.     private String foodChosen = "Idk";
  203.     int currentPosY = 0;
  204.     int oldPosY = 0;
  205.     int currentPosX = 0;
  206.     int oldPosX = 0;
  207.  
  208.     private final Rectangle ATTACK = new Rectangle(600, 273, 10, 15);
  209.     private final Rectangle STRENGTH = new Rectangle(685, 275, 10, 15);
  210.     private final Rectangle DEFENCE = new Rectangle(685, 326, 10, 15);
  211.         private int[] herbIDs = {211, 215, 217, 199, 205, 209, 213, 2485, 201, 207, 3051, 203, 3049, 219};
  212.     boolean loot = false;
  213.     boolean banking = true;
  214.     boolean needsToBank = false;
  215.     boolean buryBones = false;
  216.         boolean onlyHerbs = true;
  217.     boolean eating = true;
  218.  
  219.  
  220.     private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  221.  
  222.     public boolean onStart(Map<String, String> args) {
  223.         startTime = System.currentTimeMillis();
  224.         log("AutoAKT: We're about to deliver...");
  225.         if (args.get("lootItems").equals("Yes")) {
  226.             loot = true;
  227.             log("Loot enabled");
  228.         }
  229.         else if (args.get("lootItems").equals("No")){
  230.             loot = false;
  231.             log("Loot disabled");
  232.         }
  233.                 else if (args.get("lootItems").equals("herbs")){
  234.                         loot = false;
  235.                         onlyHerbs = true;
  236.             log("Loot disabled");
  237.         }
  238.  
  239.         if (args.get("buryBones").equals("Yes")) {
  240.             buryBones = true;
  241.             log("Bury bones enabled");
  242.         }
  243.         if (args.get("buryBones").equals("No")) {
  244.             buryBones = false;
  245.             log("Bury bones disabled");
  246.         }
  247.  
  248.         if (args.get("style").equals("Attack")) {
  249.             cbStyle = "Attack";
  250.         }
  251.         else if (args.get("style").equals("Strength")) {
  252.             cbStyle = "Strength";
  253.         }
  254.         else if (args.get("style").equals("Defence")) {
  255.             cbStyle = "Defence";
  256.         }
  257.         else {
  258.             cbStyle = "Strength";
  259.         }
  260.  
  261.         if (!args.get("foodTypes").equals("")) {
  262.             if (args.get("foodTypes").equals("Trout")) {
  263.                 foodChosenID = 333;
  264.                 eating = true;
  265.             }
  266.             else if (args.get("foodTypes").equals("Salmon")) {
  267.                 foodChosenID = 329;
  268.                 eating = true;
  269.             }
  270.             else if (args.get("foodTypes").equals("Tuna")) {
  271.                 foodChosenID = 361;
  272.                 eating = true;
  273.             }
  274.             else if (args.get("foodTypes").equals("Lobster")) {
  275.                 foodChosenID = 379;
  276.                 eating = true;
  277.             }
  278.                         else if (args.get("foodTypes").equals("Don't Eat")) {
  279.                 eating = false;
  280.             }
  281.         }
  282.         else {
  283.             eating = false;
  284.         }
  285.  
  286.         antiLvl = Integer.parseInt(args.get("antiLvl"));
  287.         return true;
  288.     }
  289.  
  290.     public void useBank() {
  291.        
  292.         if (eating = true) {
  293.                 if (lowFood() == true) {
  294.             needsToBank = true;
  295.             if (needsToBank == true) {
  296.                 if (!getMyPlayer().isMoving()) {
  297.  
  298.                     RSObject bankBooth = findObject(bankID);
  299.                     status = "Searching for Bank";
  300.  
  301.                     if (bankBooth != null) {
  302.  
  303.                         turnToObject(bankBooth, 40);
  304.                         status = "Using Bank";
  305.                         if (atObject(bankBooth, "Use-quickly")) {
  306.  
  307.                             while (!bank.isOpen()) {
  308.                                 wait(random(50, 150));
  309.  
  310.                             }
  311.                             wait(random(400, 650));
  312.                                                         if (getInventoryCount() > 0) {
  313.                                                                 bank.depositAll();
  314.                                                         }
  315.                             if (lowFood() == false) {   //If has food, closes bank
  316.                                 bank.close();
  317.                                 needsToBank = false;
  318.                                 wait(random(600, 900));
  319.  
  320.                             }
  321.                             else {              //If needs to withdraw
  322.                                 wait(random(300,500));
  323.                                 if (bank.getCount(foodChosenID) == 0) {
  324.                                     status = "Out of food, logging off.";
  325.                                     logout();
  326.                                     stopScript();
  327.                                 }
  328.                                 else {
  329.                                     status = "Withdrawing food";
  330.                                     bank.withdraw(foodChosenID, 27);
  331.                                 }
  332.                                 wait(random(1200,1500));
  333.  
  334.                                 if (lowFood() == false) {
  335.                                     wait(random(300,700));
  336.                                     bank.close();
  337.                                     needsToBank = false;
  338.                                 }
  339.                                 else {
  340.                                     wait(random(300,500));
  341.                                     if (bank.getCount(foodChosenID) == 0) {
  342.                                         status = "Out of food, logging off.";
  343.                                         logout();
  344.                                         stopScript();
  345.                                     }
  346.                                     else {
  347.                                         status = "Withdrawing food";
  348.                                         bank.withdraw(foodChosenID, 27);
  349.                                     }
  350.                                     wait(random(1200,1500));
  351.  
  352.                                 }
  353.                                 if (lowFood() == false) {
  354.                                     wait(random(300,700));
  355.                                     bank.close();
  356.                                     needsToBank = false;
  357.                                 }
  358.  
  359.                             }
  360.  
  361.  
  362.  
  363.                         } else {
  364.  
  365.                             setCameraRotation(getCameraAngle() + random(-90, 90));
  366.                             status = "Searching for Bank";
  367.  
  368.                             wait(random(500, 700));
  369.  
  370.                         }
  371.  
  372.                     }
  373.  
  374.                     else {
  375.  
  376.                         wait(random(500, 700));
  377.  
  378.                     }
  379.  
  380.                 }
  381.  
  382.                 else {
  383.  
  384.                     wait(random(300,400));
  385.  
  386.                 }
  387.  
  388.             }
  389.             else {      //If doesn't need to bank, walks to warriors
  390.                 if (needsToBank == false) {
  391.                     status = "Walking to Warriors";
  392.                     walkToWarriors();
  393.                 }
  394.             }
  395.         }
  396.                 }
  397.                 else if (eating == false) {
  398.                         walkToWarriors();
  399.                         }
  400.     }
  401.  
  402.     public boolean lowFood() {
  403.         if (getInventoryCount(foodChosenID) < 3) {
  404.             needsToBank = true;
  405.             status = "Low food";
  406.             return true;
  407.         }
  408.         return false;
  409.     }
  410.  
  411.     public void walkToWarriors() {
  412.         tileX = random(3275, 3279);
  413.         tileY = random(3169, 3177);
  414.         RSTile firstTile = new RSTile(tileX, tileY);
  415.         walkTileMM(firstTile);
  416.         status = "Walking to first tile.";
  417.         while (distanceTo(getDestination()) > random(1, 5)) {
  418.             wait(random(100, 150));
  419.         }
  420.         tileX = random(3284, 3289);
  421.         tileY = random(3170, 3174);
  422.         RSTile secondTile = new RSTile(tileX, tileY);
  423.         walkTileMM(secondTile);
  424.         status = "Walking to second tile.";
  425.         while (distanceTo(getDestination()) > random(1, 5)) {
  426.             wait(random(100, 150));
  427.         }
  428.         if (isAtWarriors() == true) {
  429.             fightWarriors();
  430.         }
  431.         else {
  432.             if (distanceTo(getDestination()) < random(1, 5)) {
  433.                 status = "Almost there, gimmie a min.";
  434.                 wait(random(300, 500));
  435.             }
  436.             else {
  437.             }
  438.         }
  439.     }
  440.  
  441.     public void currentPosition() {
  442.         currentPosX = getMyPlayer().getLocation().getX();
  443.         currentPosY = getMyPlayer().getLocation().getY();
  444.         if (currentPosX == oldPosX && currentPosY == oldPosY) {
  445.             setCameraRotation(getCameraAngle() + random(-90, 180));
  446.         }
  447.         else {
  448.             wait(random(50, 100));
  449.         }
  450.         oldPosX = currentPosX;
  451.         oldPosY = currentPosY;
  452.     }
  453.  
  454.     public void fightWarriors() {
  455.         try {
  456.             RSNPC warrior = getNearestFreeNPCByID(warriorID);
  457.             RSNPC warrior1 = getNearestNPCByID(warriorID);
  458.             needsToEat();
  459.             currentPosition();
  460.                         if (lowFood() == true) {
  461.                 walkToBank();
  462.             }
  463.             if (getMyPlayer().isInCombat() == false && getMyPlayer().isMoving() == false && needsToEat() == false) {
  464.                 if (warrior == null && warrior1 != null) {
  465.                     if (atNPC(warrior1,"Attack")) {
  466.                         status = "Fighting Warrior";
  467.                         wait(random(500,1300));
  468.                         moveMouseSlightly();
  469.                         wait(random(200,400));
  470.                         antiBan();
  471.                                                 if(checkWarriorDead() == true) {
  472.                                                 if (loot == true) {
  473.                                                         log("Should loot");
  474.                                                         loot();
  475.                                                         }
  476.                                                 }
  477.                     }
  478.                 }
  479.  
  480.                 else if (warrior != null && warrior1 != null) {
  481.                     needsToEat();
  482.                     if (lowFood() == true) {
  483.                         walkToBank();
  484.                     }
  485.                     if (atNPC(warrior,"Attack")) {
  486.                         status = "Fighting Warrior";
  487.                         wait(random(500,1300));
  488.                         moveMouseSlightly();
  489.                         wait(random(200,400));
  490.                         antiBan();
  491.                                                 if(checkWarriorDead() == true) {
  492.                                                 if (loot == true) {
  493.                                                         log("Should loot");
  494.                                                         loot();
  495.                                                         }
  496.                                                 else if (onlyHerbs == true){
  497.                                                         wait(random(1750, 2300));
  498.                                                         lootHerbs();
  499.                                                         }
  500.                                                 }
  501.                     }
  502.  
  503.                 }
  504.  
  505.                 else if (warrior1 == null && warrior != null) {
  506.                     needsToEat();
  507.                     if (lowFood() == true) {
  508.                         walkToBank();
  509.                     }
  510.                     if (atNPC(warrior,"Attack")) {
  511.                         status = "Fighting Warrior";
  512.                         wait(random(500,700));
  513.                         moveMouseSlightly();
  514.                         wait(random(200,400));
  515.                         antiBan();
  516.                                                 if(checkWarriorDead() == true) {
  517.                                                 if (loot == true) {
  518.                                                         log("Should loot");
  519.                                                         loot();
  520.                                                         }
  521.                                                 }
  522.                     }
  523.                 }
  524.  
  525.                 else if (warrior1 == null && warrior == null) {
  526.                     needsToEat();
  527.                     if (lowFood() == true) {
  528.                         walkToBank();
  529.                     }
  530.                     wait(random(200,400));
  531.                 }
  532.  
  533.                 else {
  534.                 }
  535.  
  536.                 while (isBusy() == true) {
  537.                     status = "I'm busy at the moment.";
  538.                     wait(random(200,400));
  539.                     needsToEat();
  540.                                         if(checkWarriorDead() == true) {
  541.                                                 if (loot == true ) {
  542.                                                         log("Should loot");
  543.                                                                 while (isInAntiBan == 1) {
  544.                                                                 wait(random(300, 500));
  545.                                                                 }
  546.                                                                 wait(random(200, 400));
  547.                                                         loot();
  548.                                                 }
  549.                                         }
  550.                                         while (getMyPlayer().getInteracting().getAnimation() == warriorDead & getMyPlayer().isInCombat()){
  551.                                                 wait(random(150, 200));
  552.                                         }
  553.                     useAntiBan = random(0, 5);
  554.                     if (useAntiBan == 2) {
  555.                         antiBan();
  556.                                                 }
  557.                                         if(checkWarriorDead() == true) {
  558.                                                 if (loot == true) {
  559.                                                         log("Should loot");
  560.                                                         loot();
  561.                                                         }
  562.                                                 }
  563.                     else {
  564.                         wait(random(100, 200));
  565.                     }
  566.                     if (lowFood() == true) {
  567.                         walkToBank();
  568.                         moveMouseSlightly();
  569.                         wait(random(200,400));
  570.                     }
  571.                     wait(random(100, 150));
  572.                                         if(checkWarriorDead() == true) {
  573.                                                 if (loot == true) {
  574.                                                         log("Should loot");
  575.                                                         loot();
  576.                                                         }
  577.                                                 }      
  578.                                         }      
  579.  
  580.                 status = "Idle";
  581.                 if (rotCam <= 3) {
  582.                     setCameraRotation(getCameraAngle() + random(-90, 90));
  583.                     wait(random(560, 795));
  584.                     moveMouseSlightly();
  585.                     rotCam++;
  586.                     fightWarriors();
  587.                 }
  588.                 else if (rotCam >= 4) {
  589.  
  590.                     if (distanceTo(warriorTile) > 5) {
  591.  
  592.                         warriorTile.randomizeTile(2, 2);
  593.                         walkTileMM(warriorTile);
  594.                         moveMouseSlightly();
  595.                         wait(random(500, 700));
  596.                         rotCam = 0;
  597.                         fightWarriors();
  598.                     }
  599.                     else {
  600.                         warriorTile2.randomizeTile(2, 2);
  601.                         walkTileMM(warriorTile2);
  602.                         moveMouseSlightly();
  603.                         wait(random(500, 700));
  604.                         rotCam = 0;
  605.                         fightWarriors();
  606.                     }
  607.                 }
  608.             }
  609.             else {
  610.  
  611.                 needsToEat();
  612.                 wait(random(100, 200));
  613.             }
  614.         } catch (NullPointerException e) {
  615.             wait(random(100, 200));
  616.             if (rotCam <= 3) {
  617.                 setCameraRotation(getCameraAngle() + random(-90, 90));
  618.                 wait(random(560, 795));
  619.                 rotCam++;
  620.                 fightWarriors();
  621.             }
  622.             else if (rotCam >= 4) {
  623.  
  624.                 if (distanceTo(warriorTile) > 3) {
  625.                     status = "Walking to random Tile";
  626.                     warriorTile.randomizeTile(2, 2);
  627.                     walkTileMM(warriorTile);
  628.                     moveMouseSlightly();
  629.                     wait(random(500, 700));
  630.                     rotCam = 0;
  631.                     fightWarriors();
  632.                 }
  633.                 else {
  634.                     status = "Walking to random Tile";
  635.                     warriorTile2.randomizeTile(2, 2);
  636.                     walkTileMM(warriorTile2);
  637.                     moveMouseSlightly();
  638.                     wait(random(500, 700));
  639.                     rotCam = 0;
  640.                     fightWarriors();
  641.                 }
  642.             }
  643.             wait(random(100, 200));
  644.             fightWarriors();
  645.         }
  646.     }
  647.  
  648.     public boolean checkWarriorDead() {
  649.         if (getMyPlayer().getInteracting().getAnimation() == warriorDead && getMyPlayer().isInCombat()) {        
  650.             kc = kc + 1;
  651.             wait(random(200,300));
  652.                         return true;
  653.         }
  654.         else {
  655.             return false;
  656.         }
  657.     }
  658.        
  659.     public boolean needsToEat() {
  660.         currentHP = skills.getCurrentSkillLevel(STAT_HITPOINTS);
  661.         if (eating = true) {
  662.             if (currentHP <= ((maxHP / 2) + random(+3, -3))) {
  663.                 status = "Eating food";
  664.                 wait(random(500, 1100));
  665.                 return atInventoryItem(foodChosenID, "Eat");
  666.             }
  667.         }
  668.         return false;
  669.     }
  670.  
  671.     public void walkToBank() {
  672.         status = "Walking to bank";
  673.         tileX = random(3275, 3279);
  674.         tileY = random(3169, 3177);
  675.         RSTile firstTile = new RSTile(tileX, tileY);
  676.         if (distanceTo(firstTile) < 15) {
  677.             walkTileMM(firstTile);
  678.             while (distanceTo(getDestination()) > random(1, 5)) {
  679.                 wait(random(100, 150));
  680.             }
  681.             tileX = random(3269, 3271);
  682.             tileY = random(3163, 3171);
  683.             RSTile secondTile = new RSTile(tileX, tileY);
  684.             walkTileMM(secondTile);
  685.             while (distanceTo(getDestination()) > random(1, 5)) {
  686.                 wait(random(100, 150));
  687.             }
  688.         }
  689.         else {
  690.             tileX = random(3287, 3297);
  691.             tileY = random(3174, 3178);
  692.             RSTile thirdTile = new RSTile(tileX, tileY);
  693.             walkTileMM(thirdTile);
  694.             while (distanceTo(getDestination()) > random(1, 5)) {
  695.                 wait(random(100, 150));
  696.             }
  697.             tileX = random(3278, 3294);
  698.             tileY = random(3180, 3182);
  699.             RSTile fourthTile = new RSTile(tileX, tileY);
  700.             walkTileMM(fourthTile);
  701.             while (distanceTo(getDestination()) > random(1, 5)) {
  702.                 wait(random(100, 150));
  703.             }
  704.             walkToBank();
  705.         }
  706.         if (isInBank() == true) {
  707.             useBank();
  708.         }
  709.         else {
  710.             walkToBank();
  711.         }
  712.     }
  713.  
  714.     public boolean isAtWarriors () {
  715.         if (getMyPlayer().getLocation().getX() <= 3299 && getMyPlayer().getLocation().getX() >= 3280 && getMyPlayer().getLocation().getY() <= 3179 && getMyPlayer().getLocation().getY() >= 3158 && getInventoryCount(foodChosenID) > 5) {
  716.             status = "Arrived at warriors";
  717.             return true;
  718.         }
  719.         return false;
  720.     }
  721.  
  722.     public boolean isInBank() {
  723.         if (getMyPlayer().getLocation().getX() <= 3274 && getMyPlayer().getLocation().getX() >= 3267 && getMyPlayer().getLocation().getY() <= 3173 && getMyPlayer().getLocation().getY() >= 3161) {
  724.             status = "Currently at bank.";
  725.             return true;
  726.         }
  727.         return false;
  728.     }
  729.  
  730.         public void lootBones() {
  731.         if (buryBones == true) {
  732.         wait(random(500, 800));
  733.                 try {
  734.                 RSTile tile = getNearestGroundItemByID(526);    //Loot bones
  735.                 if (getInventoryCount() < 28) {
  736.                     if (distanceTo(tile) <= 2) {
  737.                         atTile(tile, "Take Bones");
  738.                         wait(random(1000,1200));
  739.                         if (buryBones == true) {
  740.                                                 while (getInventoryCount(526) >= 1){
  741.                             atInventoryItem(526, "Bury");
  742.                                                         wait(random(700, 900));
  743.                         }
  744.                                                 }
  745.                         else {
  746.                             wait(random(100,150));
  747.                         }
  748.                     }
  749.                 }
  750.             } catch (NullPointerException e) {
  751.  
  752.             }
  753.                         }
  754.         if (buryBones == false) {
  755.         fightWarriors();
  756.         }
  757.         }
  758.        
  759.         public void lootCoins() {
  760.         wait(random(500, 800));
  761.                 try {
  762.                 RSTile tile = getNearestGroundItemByID(995);    //Loot coins
  763.                 if (getInventoryCount() <= 28) {
  764.                     if (distanceTo(tile) <= 2) {
  765.                         atTile(tile, "Take Coins");
  766.                         wait(random(700,900));
  767.                     }
  768.                 }
  769.             } catch (NullPointerException e) {
  770.             }
  771.         }
  772.        
  773.         public void lootEarthTali() {
  774.                 wait(random(500, 800));
  775.                 try {
  776.                                        
  777.                 RSTile tile = getNearestGroundItemByID(1440);   //Loot earth talisman
  778.                 if (getInventoryCount() < 28) {
  779.                     if (distanceTo(tile) <= 10) {
  780.                         atTile(tile, "Take Earth");
  781.                         wait(random(700,900));
  782.                     }
  783.                 }
  784.                 else {
  785.                     if (getNearestGroundItemByID(1440) != null) {
  786.                         atInventoryItem(foodChosenID, "Eat");
  787.                         if (distanceTo(tile) <= 10) {
  788.                             atTile(tile, "Take Earth");
  789.                             wait(random(700,900));
  790.                         }
  791.                     }
  792.                     else {
  793.                         wait(random(100,150));
  794.                     }
  795.                 }
  796.             } catch (NullPointerException e) {
  797.             }
  798.         }
  799.        
  800.         public void lootHerbs() {
  801.                 wait(random(500, 800));
  802.                 try {
  803.                 RSTile tile = getNearestGroundItemByID(herbIDs);        //Loot Herbs
  804.                 if (getInventoryCount() < 28) {
  805.                     if (distanceTo(tile) <= 15) {
  806.                         atTile(tile, "Grimy");
  807.                         wait(random(700,900));
  808.                     }
  809.                 }
  810.                                 else {
  811.                     if (getNearestGroundItemByID(herbIDs) != null) {
  812.                         atInventoryItem(foodChosenID, "Eat");
  813.                         if (distanceTo(tile) <= 15) {
  814.                             atTile(tile, "Grimy");
  815.                             wait(random(700,900));
  816.                         }
  817.                     }
  818.                     else {
  819.                         wait(random(100,150));
  820.                     }
  821.                 }
  822.             } catch (NullPointerException e) {
  823.             }
  824.        }
  825.        
  826.     public void loot() {
  827.         wait(random(1750, 2300));
  828.                 lootCoins();
  829.                 lootHerbs();
  830.                 lootEarthTali();
  831.                 if (buryBones == true){
  832.                 lootBones();
  833.                 }
  834.  
  835.     }
  836.  
  837.     public boolean isBusy() {
  838.         RSNPC warrior = getNearestFreeNPCByID(warriorID);
  839.         RSNPC warrior1 = getNearestNPCByID(warriorID);
  840.         while (getMyPlayer().isInCombat() || getMyPlayer().isMoving() || warrior.isInteractingWithLocalPlayer() || warrior1.isInteractingWithLocalPlayer() || getMyPlayer().getInteracting().getAnimation() != warriorDead) {
  841.             return true;
  842.         }
  843.         return false;
  844.     }
  845.  
  846.     public void antiBan() {
  847.         isInAntiBan = 1;
  848.                 k = random(0, antiLvl);
  849.         if (k == lastAnti) {
  850.             k = random(0, antiLvl);
  851.         }
  852.  
  853.         if (k == 0) {
  854.             setCameraRotation(getCameraAngle() + random(-90, 90));
  855.             wait(random(100, 258));
  856.         }
  857.         else if (k == 1) {
  858.             status = "Running Anti-Ban";
  859.             log("Anti-Ban: Option 1 selected: Moving mouse mouse randomly and rotating camera.");
  860.             moveMouse(381, 250, 300, 210);
  861.             wait(random(360, 682));
  862.             setCameraRotation(getCameraAngle() + random(-180, 0));
  863.             wait(random(256, 400));
  864.             setCameraRotation(getCameraAngle() + random(0, 120));
  865.             wait(random(100, 300));
  866.             moveMouse(381, 250, 340, 220);
  867.             log("Anti-Ban Complete.");
  868.         }
  869.         else if (k == 2) {
  870.             status = "Running Anti-Ban";
  871.             l = random (0, 10);
  872.             if (l == 3) {
  873.                 log("Anti-Ban: Option 2A selected: Checking HP Experience.");
  874.                 if (getCurrentTab() != TAB_STATS) {
  875.                     openTab(TAB_STATS);
  876.                     wait(random(350, 856));
  877.                     moveMouse(634, 246, 5, 5);
  878.                     wait(random(800, 1300));
  879.                     openTab(TAB_INVENTORY);
  880.                 }
  881.                 else {
  882.                     log("Anti-Ban: Option 2B selected: Rotating map.");
  883.                     setCameraRotation(getCameraAngle() + random(0, 120));
  884.                 }
  885.             }
  886.             else {
  887.                 wait(random(100, 300));
  888.             }
  889.             log("Anti-Ban Complete.");
  890.         }
  891.         else if (k == 3) {
  892.             status = "Running Anti-Ban";
  893.             l = random (0, 10);
  894.             if (l == 3) {
  895.                 log("Anti-Ban: Option 3A selected: Moving skills bar.");
  896.                 if (getCurrentTab() != TAB_STATS) {
  897.                     openTab(TAB_STATS);
  898.                     l = 0;
  899.                 }
  900.                 else {
  901.                     wait(random(100, 250));
  902.                 }
  903.                 wait(random(500, 759));
  904.                 moveMouse(729, 444, 4, 4);
  905.                 wait(random(360, 682));
  906.                 clickMouse(true);
  907.                 wait(random(100, 300));
  908.                 moveMouse(729, 444, 4, 4);
  909.                 wait(random(150, 350));
  910.                 clickMouse(true);
  911.                 wait(random(50, 150));
  912.                 clickMouse(true);
  913.                 wait(random(800, 1400));
  914.                 moveMouse(728, 236, 6, 6);
  915.                 clickMouse(true);
  916.                 moveMouse(728, 236, 3, 3);
  917.                 clickMouse(true);
  918.                 moveMouse(728, 236, 4, 4);
  919.                 clickMouse(true);
  920.                 openTab(TAB_INVENTORY);
  921.                 log("Anti-Ban Complete.");
  922.             }
  923.             else {
  924.                 log("Anti-Ban: Option 3B selected: Rotating Map.");
  925.                 setCameraRotation(getCameraAngle() + random(0, 120));
  926.                 log("Anti-Ban Complete.");
  927.             }
  928.         }
  929.         else if (k == 4) {
  930.             status = "Running Anti-Ban";
  931.             log("Anti-Ban: Option 4 selected: Moving mouse to random locations.");
  932.             moveMouse(381, 250, 340, 220);
  933.             wait(random(360, 682));
  934.             moveMouse(381, 250, 340, 220);
  935.             wait(random(200, 300));
  936.             moveMouse(381, 250, 340, 220);
  937.             wait(random(400, 680));
  938.             log("Anti-Ban Complete.");
  939.         }
  940.         else if (k == 5) {
  941.             status = "Running Anti-Ban";
  942.             log("Anti-Ban: Option 5 selected: Choosing a random tab to open.");
  943.             randTab = random(0, 13);
  944.             if (randTab == 0) {
  945.                 if (getCurrentTab() != TAB_ATTACK) {
  946.                     openTab(TAB_ATTACK);
  947.                 }
  948.                 moveMouse(random(508, 733), random(248, 462));
  949.                 wait(random(500, 1200));
  950.                 openTab(TAB_INVENTORY);
  951.             }
  952.             if (randTab == 1) {
  953.                 if (getCurrentTab() != TAB_STATS) {
  954.                     openTab(TAB_STATS);
  955.                 }
  956.                 moveMouse(random(508, 733), random(248, 462));
  957.                 wait(random(500, 1200));
  958.                 moveMouse(random(508, 733), random(248, 462));
  959.                 wait(random(300, 700));
  960.                 moveMouse(random(508, 733), random(248, 462));
  961.                 wait(random(100, 400));
  962.                 openTab(TAB_INVENTORY);
  963.             }
  964.             if (randTab == 2) {
  965.                 if (getCurrentTab() != TAB_QUESTS) {
  966.                     openTab(TAB_QUESTS);
  967.                 }
  968.                 moveMouse(random(508, 733), random(248, 462));
  969.                 wait(random(500, 1200));
  970.                 openTab(TAB_INVENTORY);
  971.             }
  972.             if (randTab == 3) {
  973.                 if (getCurrentTab() != TAB_ACHIEVEMENTDIARIES) {
  974.                     openTab(TAB_ACHIEVEMENTDIARIES);
  975.                 }
  976.                 moveMouse(random(508, 733), random(248, 462));
  977.                 wait(random(500, 1200));
  978.                 moveMouse(random(508, 733), random(248, 462));
  979.                 wait(random(300, 700));
  980.                 openTab(TAB_INVENTORY);
  981.             }
  982.             if (randTab == 4) {
  983.                 if (getCurrentTab() != TAB_EQUIPMENT) {
  984.                     openTab(TAB_EQUIPMENT);
  985.                 }
  986.                 moveMouse(random(508, 733), random(248, 462));
  987.                 wait(random(500, 1200));
  988.                 openTab(Constants.TAB_INVENTORY);
  989.             }
  990.             if (randTab == 5) {
  991.                 if (getCurrentTab() != TAB_PRAYER) {
  992.                     openTab(Constants.TAB_PRAYER);
  993.                 }
  994.                 moveMouse(random(508, 733), random(248, 462));
  995.                 wait(random(500, 1200));
  996.                 moveMouse(random(508, 733), random(248, 462));
  997.                 wait(random(300, 700));
  998.                 moveMouse(random(508, 733), random(248, 462));
  999.                 wait(random(200, 400));
  1000.                 openTab(Constants.TAB_INVENTORY);
  1001.             }
  1002.             if (randTab == 6) {
  1003.                 if (getCurrentTab() != TAB_MAGIC) {
  1004.                     openTab(TAB_MAGIC);
  1005.                 }
  1006.                 moveMouse(random(508, 733), random(248, 462));
  1007.                 wait(random(500, 1200));
  1008.                 openTab(Constants.TAB_INVENTORY);
  1009.             }
  1010.             if (randTab == 7) {
  1011.                 if (getCurrentTab() != TAB_FRIENDS) {
  1012.                     openTab(Constants.TAB_FRIENDS);
  1013.                 }
  1014.                 moveMouse(random(508, 733), random(248, 462));
  1015.                 wait(random(500, 1200));
  1016.                 moveMouse(random(508, 733), random(248, 462));
  1017.                 wait(random(500, 600));
  1018.                 openTab(TAB_INVENTORY);
  1019.             }
  1020.             if (randTab == 8) {
  1021.                 if (getCurrentTab() != TAB_IGNORE) {
  1022.                     openTab(TAB_IGNORE);
  1023.                 }
  1024.                 moveMouse(random(508, 733), random(248, 462));
  1025.                 wait(random(500, 1200));
  1026.                 openTab(TAB_INVENTORY);
  1027.             }
  1028.             if (randTab == 9) {
  1029.                 if (getCurrentTab() != TAB_CLAN) {
  1030.                     openTab(TAB_CLAN);
  1031.                 }
  1032.                 moveMouse(random(508, 733), random(248, 462));
  1033.                 wait(random(500, 1200));
  1034.                 openTab(TAB_INVENTORY);
  1035.             }
  1036.             if (randTab == 10) {
  1037.                 if (getCurrentTab() != TAB_OPTIONS) {
  1038.                     openTab(TAB_OPTIONS);
  1039.                 }
  1040.                 moveMouse(random(508, 733), random(248, 462));
  1041.                 wait(random(500, 1200));
  1042.                 moveMouse(random(508, 733), random(248, 462));
  1043.                 wait(random(300, 500));
  1044.                 moveMouse(random(508, 733), random(248, 462));
  1045.                 wait(random(100, 300));
  1046.                 openTab(TAB_INVENTORY);
  1047.             }
  1048.             if (randTab == 11) {
  1049.                 if (getCurrentTab() != TAB_MUSIC) {
  1050.                     openTab(TAB_MUSIC);
  1051.                 }
  1052.                 moveMouse(random(508, 733), random(248, 462));
  1053.                 wait(random(500, 1200));
  1054.                 openTab(TAB_INVENTORY);
  1055.             }
  1056.             if (randTab == 12) {
  1057.                 if (getCurrentTab() != TAB_NOTES) {
  1058.                     openTab(TAB_NOTES);
  1059.                 }
  1060.                 moveMouse(random(508, 733), random(248, 462));
  1061.                 wait(random(500, 1200));
  1062.                 openTab(TAB_INVENTORY);
  1063.             }
  1064.             log("Anti-Ban Complete.");
  1065.             isBusy();
  1066.         }
  1067.         else if (k == 6) {
  1068.             status = "Running Anti-Ban";
  1069.             log("Anti-Ban: Option 6 selected: Moving mouse mouse randomly and rotating camera.");
  1070.             moveMouse(381, 250, 340, 220);
  1071.             wait(random(360, 682));
  1072.             setCameraRotation(getCameraAngle() + random(-180, 0));
  1073.             wait(random(256, 400));
  1074.             setCameraRotation(getCameraAngle() + random(0, 120));
  1075.             wait(random(100, 300));
  1076.             moveMouse(381, 250, 340, 220);
  1077.             log("Anti-Ban Complete.");
  1078.         }
  1079.         else if (k == 7) {
  1080.             status = "Running Anti-Ban";
  1081.             log("Anti-Ban: Option 7 selected: Checking surrounding players levels.");
  1082.             org.rsbot.script.wrappers.RSPlayer nearPlayer = getNearestPlayerByLevel(10,136);
  1083.             if (nearPlayer.getCombatLevel() == getMyPlayer().getCombatLevel()) {
  1084.                 log("Self selected only, skipping...");
  1085.             }
  1086.             else {
  1087.                 if (nearPlayer != null)
  1088.                 {
  1089.                     clickCharacter(nearPlayer, "Cancel");
  1090.                     setCameraRotation(getCameraAngle() + random(0, 120));
  1091.                 }
  1092.                 else {
  1093.                     setCameraRotation(getCameraAngle() + random(0, 120));
  1094.                     moveMouse(381, 250, 340, 220);
  1095.                     wait(random(360, 682));
  1096.                 }
  1097.             }
  1098.             log("Anti-Ban Complete.");
  1099.         }
  1100.         else if (k == 8) {
  1101.             status = "Running Anti-Ban";
  1102.             log("Anti-Ban: Option 8 selected: Moving mouse mouse randomly and rotating camera.");
  1103.             moveMouse(381, 250, 340, 220);
  1104.             wait(random(360, 682));
  1105.             setCameraRotation(getCameraAngle() + random(-180, 0));
  1106.             wait(random(256, 400));
  1107.             moveMouse(381, 250, 340, 220);
  1108.             wait(random(256, 400));
  1109.             setCameraRotation(getCameraAngle() + random(0, 120));
  1110.             wait(random(100, 300));
  1111.             moveMouse(381, 250, 340, 220);
  1112.             log("Anti-Ban Complete.");
  1113.         }
  1114.         else if (k == 9) {
  1115.             status = "Running Anti-Ban";
  1116.             log("Anti-Ban: Option 9 selected: Doing nothing.");
  1117.             log("Anti-Ban Complete.");
  1118.         }
  1119.         else {
  1120.             wait(random(100, 200));
  1121.         }
  1122.         lastAnti = k;
  1123.         k = 0;
  1124.                 isInAntiBan = 0;
  1125.     }
  1126.  
  1127.     public int loop() {
  1128.         maxHP = skills.getSkillMax(STAT_HITPOINTS);
  1129.         rand = 0;
  1130.         if (!setAltitude) {
  1131.             setCameraAltitude(true);
  1132.             wait(random(250, 500));
  1133.             setCameraRotation(getCameraAngle() + random(-90, 180));
  1134.             wait(random(100, 300));
  1135.             setAltitude = true;
  1136.         }
  1137.  
  1138.  
  1139.         //------------------------------------------------\\
  1140.         if (z == 0) {
  1141.  
  1142.             if (cbStyle == "Attack") {
  1143.                 startLvl = skills.getSkillMax(STAT_ATTACK);
  1144.                 if (getCurrentTab() != TAB_ATTACK) {
  1145.                     openTab(TAB_ATTACK);
  1146.                     wait(random(400,800));
  1147.                     clickMouse(ATTACK.x, ATTACK.y, ATTACK.width, ATTACK.height, true);
  1148.                     wait(random(400,800));
  1149.                     openTab(TAB_INVENTORY);
  1150.                     wait(random(200,300));
  1151.                 }
  1152.  
  1153.             }
  1154.             else if (cbStyle == "Strength") {
  1155.                 startLvl = skills.getSkillMax(STAT_STRENGTH);
  1156.                 if (getCurrentTab() != TAB_ATTACK) {
  1157.                     openTab(TAB_ATTACK);
  1158.                     wait(random(400,800));
  1159.                     clickMouse(STRENGTH.x, STRENGTH.y, STRENGTH.width, STRENGTH.height, true);
  1160.                     clickMouse(true);
  1161.                     wait(random(400,800));
  1162.                     openTab(TAB_INVENTORY);
  1163.                     wait(random(200,300));
  1164.                 }
  1165.  
  1166.             }
  1167.             else if (cbStyle == "Defence") {
  1168.                 startLvl = skills.getSkillMax(STAT_DEFENSE);
  1169.                 if (getCurrentTab() != TAB_ATTACK) {
  1170.                     openTab(TAB_ATTACK);
  1171.                     wait(random(400,800));
  1172.                     clickMouse(DEFENCE.x, DEFENCE.y, DEFENCE.width, DEFENCE.height, true);
  1173.                     wait(random(400,800));
  1174.                     openTab(TAB_INVENTORY);
  1175.                     wait(random(200,300));
  1176.                 }
  1177.  
  1178.             }
  1179.             else {
  1180.                 if (getCurrentTab() != TAB_ATTACK) {
  1181.                     openTab(TAB_ATTACK);
  1182.                     wait(random(400,800));
  1183.                     clickMouse(STRENGTH.x, STRENGTH.y, STRENGTH.width, STRENGTH.height, true);
  1184.                     wait(random(400,800));
  1185.                     openTab(TAB_INVENTORY);
  1186.                     wait(random(200,300));
  1187.                 }
  1188.             }
  1189.                         hpStartLvl = skills.getSkillMax(STAT_HITPOINTS);
  1190.             z++;
  1191.         }
  1192.         //------------------------------------------------\\
  1193.  
  1194.  
  1195.  
  1196.         if (isInBank() == true) {
  1197.             if (lowFood() == true) {    //If has low/no food
  1198.                 status = "Needs to bank";
  1199.                 needsToBank = true;
  1200.                 useBank();                      //banks
  1201.             }
  1202.             else {
  1203.                 walkToWarriors();       //If has sufficient food, walks to warriors
  1204.             }
  1205.         }
  1206.         else {          //If not in bank
  1207.             if (lowFood() == true) {    //If has low/no food
  1208.                 walkToBank();
  1209.                 needsToBank = true;
  1210.                 useBank();
  1211.             }
  1212.             else {
  1213.                 if (!isRunning() && getEnergy() > 35) {
  1214.                     setRun(true);
  1215.                 }
  1216.                 moveMouseSlightly();
  1217.                 fightWarriors();
  1218.             }
  1219.         }
  1220.         moveMouseSlightly();
  1221.         return 100;
  1222.     }
  1223.  
  1224.     public void serverMessageRecieved(final ServerMessageEvent arg0) {
  1225.         final String serverString = arg0.getMessage();
  1226.     }
  1227.  
  1228.     public void onRepaint(Graphics g) {
  1229.         if (isLoggedIn()) {
  1230.             if (startexp == 0) {
  1231.                 if (cbStyle == "Attack") {
  1232.                     startexp = skills.getCurrentSkillExp(STAT_ATTACK);
  1233.                     xpGained = skills.getCurrentSkillExp(STAT_ATTACK) - startexp;
  1234.                 }
  1235.                 else if (cbStyle == "Strength") {
  1236.                     startexp = skills.getCurrentSkillExp(STAT_STRENGTH);
  1237.                     xpGained = skills.getCurrentSkillExp(STAT_STRENGTH) - startexp;
  1238.                 }
  1239.                 else if (cbStyle == "Defence") {
  1240.                     startexp = skills.getCurrentSkillExp(STAT_DEFENSE);
  1241.                     xpGained = skills.getCurrentSkillExp(STAT_DEFENSE) - startexp;
  1242.                 }
  1243.  
  1244.             }
  1245.  
  1246.  
  1247.             if (cbStyle == "Attack") {
  1248.                 xpGained = skills.getCurrentSkillExp(STAT_ATTACK) - startexp;
  1249.             }
  1250.             else if (cbStyle == "Strength") {
  1251.                 xpGained = skills.getCurrentSkillExp(STAT_STRENGTH) - startexp;
  1252.             }
  1253.             else if (cbStyle == "Defence") {
  1254.                 xpGained = skills.getCurrentSkillExp(STAT_DEFENSE) - startexp;
  1255.             }
  1256.  
  1257.             int paintInt = 352;
  1258.             long millis = System.currentTimeMillis() - startTime;
  1259.             long hours = millis / (1000 * 60 * 60);
  1260.             millis -= hours * (1000 * 60 * 60);
  1261.             long minutes = millis / (1000 * 60);
  1262.             millis -= minutes * (1000 * 60);
  1263.             long seconds = millis / 1000;
  1264.             long minutes2 = minutes + (hours * 60);
  1265.             g.setColor(new Color(0, 0, 0, 200));
  1266.             g.fillRoundRect(2, 339, 516, 120, 5, 5);
  1267.             g.setColor(Color.green);
  1268.             g.fillRoundRect(258, 339, 1, 120, 0, 0);
  1269.             g.drawString("Created by: Lefou n' Gaston - Version 1.5", 9, paintInt);
  1270.             g.drawString("Time running:" + hours + ":" + minutes + ":" + seconds + "." , 9, paintInt + 20);
  1271.             g.drawString("Status: " + status, 9, paintInt + 40);
  1272.             g.drawString("XP Gained: " + xpGained, 9, paintInt + 60);
  1273.             g.drawString("Approx: " + (int) xphour + " Gained An Hour.", 9, paintInt + 80);
  1274.             g.drawString("Kill Count: " + kc, 9, paintInt + 100);
  1275.             g.drawString("Percent Till Level:", 338, paintInt);
  1276.             g.drawString(cbStyle + " levels gained: " + lvlsGained, 284, 418);
  1277.                         g.drawString("Hitpoint levels gained: " + hpLvlsGained, 284, 438);
  1278.             g.setColor(Color.BLACK);
  1279.             g.fill3DRect(285, 359, 200, 18, true);
  1280.             g.fill3DRect(285, 384, 200, 18, true);
  1281.             g.setColor(Color.WHITE);
  1282.                        
  1283.                         if (cbStyle == "Attack") {
  1284.                 g.fill3DRect(285, 359, (skills.getPercentToNextLevel(Constants.STAT_ATTACK) * 2), 18,true);
  1285.                 g.setColor(Color.RED);
  1286.                 g.drawString(skills.getPercentToNextLevel(Constants.STAT_ATTACK) + "%  to " + (skills.getCurrentSkillLevel(Constants.STAT_ATTACK) + 1 + " Attack"), 330, 373);
  1287.                 lvlsGained = skills.getSkillMax(STAT_ATTACK) - startLvl;
  1288.             }
  1289.             else if (cbStyle == "Strength") {
  1290.                 g.fill3DRect(285, 359, (skills.getPercentToNextLevel(Constants.STAT_STRENGTH) * 2), 18, true);
  1291.                 g.setColor(Color.RED);
  1292.                 g.drawString(skills.getPercentToNextLevel(Constants.STAT_STRENGTH) + "%  to " + (skills.getCurrentSkillLevel(Constants.STAT_STRENGTH) + 1 + " Strength"), 330, 373);
  1293.                 lvlsGained = skills.getSkillMax(STAT_STRENGTH) - startLvl;
  1294.             }
  1295.             else if (cbStyle == "Defence") {
  1296.                 g.fill3DRect(285, 359, (skills.getPercentToNextLevel(Constants.STAT_DEFENSE) * 2), 18, true);
  1297.                 g.setColor(Color.RED);
  1298.                 g.drawString(skills.getPercentToNextLevel(Constants.STAT_DEFENSE) + "%  to " + (skills.getCurrentSkillLevel(Constants.STAT_DEFENSE) + 1 + " Defense"), 330, 373);
  1299.                 lvlsGained = skills.getSkillMax(STAT_DEFENSE) - startLvl;
  1300.             }
  1301.                        
  1302.                         hpLvlsGained = skills.getSkillMax(STAT_HITPOINTS) - hpStartLvl;
  1303.  
  1304.             g.setColor(Color.WHITE);
  1305.             g.fill3DRect(285, 384, (skills.getPercentToNextLevel(Constants.STAT_HITPOINTS) * 2), 18, true);
  1306.             g.setColor(Color.RED);
  1307.             g.drawString(skills.getPercentToNextLevel(Constants.STAT_HITPOINTS) + "%  to " + (skills.getCurrentSkillLevel(Constants.STAT_HITPOINTS) + 1 + " Hitpoints"), 330, 398);
  1308.  
  1309.             float xpsec = 0;
  1310.             if ((minutes > 0 || hours > 0 || seconds > 0) && xpGained > 0) {
  1311.                 xpsec = ((float) xpGained)
  1312.                         / (float) (seconds + (minutes * 60) + (hours * 60 * 60));
  1313.             }
  1314.             xpmin = xpsec * 60;
  1315.             xphour = xpmin * 60;
  1316.  
  1317.         }
  1318.     }
  1319.  
  1320.     public void onFinish() {
  1321.         log("Thanks for using AutoAKT.  All we ask in return is that you post your");
  1322.         log("progress report on the forums.  Thank you.");
  1323.     }
  1324.  
  1325.  
  1326. }