Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 74.03 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import java.awt.event.MouseEvent;
  5. import java.awt.event.MouseMotionListener;
  6. import java.io.BufferedWriter;
  7. import java.io.*;
  8.  
  9. import javax.swing.*;
  10. import javax.swing.border.TitledBorder;
  11.  
  12. import org.rsbot.event.events.ServerMessageEvent;
  13. import org.rsbot.event.listeners.PaintListener;
  14. import org.rsbot.event.listeners.ServerMessageListener;
  15. import org.rsbot.script.Script;
  16. import org.rsbot.script.ScriptManifest;
  17. import org.rsbot.script.methods.Game;
  18. import org.rsbot.script.methods.Magic;
  19. import org.rsbot.script.methods.Skills;
  20. import org.rsbot.script.util.Filter;
  21. import org.rsbot.script.wrappers.RSArea;
  22. import org.rsbot.script.wrappers.RSComponent;
  23. import org.rsbot.script.wrappers.RSGroundItem;
  24. import org.rsbot.script.wrappers.RSItem;
  25. import org.rsbot.script.wrappers.RSModel;
  26. import org.rsbot.script.wrappers.RSNPC;
  27. import org.rsbot.script.wrappers.RSObject;
  28. import org.rsbot.script.wrappers.RSTile;
  29. import org.rsbot.util.GlobalConfiguration;
  30.  
  31. /**
  32.  * @author jtryba
  33.  * @version 2.0 (c)2010-2011 jtryba, No one except jtryba has the right to
  34.  *          modify and/or spread this script without the permission of jtryba.
  35.  *          I'm not held responsible for any damage that may occur to your
  36.  *          property.
  37.  */
  38.  
  39. @ScriptManifest(authors = { "jtryba" }, keywords = "combat", name = "monkR8per", version = 2.2, description = ("Kills monks at the monastery... Heals.. Enjoy."))
  40. public class monkR8per extends Script implements PaintListener,
  41.         ServerMessageListener, MouseMotionListener {
  42.  
  43.     // USER OPTIONS
  44.     public int healAtPercent = 0;
  45.     public int mouseSpeed = 0;
  46.     public int skillToTrain = 0;
  47.     public int levelToStopAt = 0;
  48.     public int rangeStyle = 0;
  49.     public int autoCastSpellID = 0;
  50.     public int ammoID = 0;
  51.     public boolean showMonk = false;
  52.     public boolean pickAmmo = false;
  53.     public boolean stopScript = false;
  54.     public boolean healAfterCombat = false;
  55.     public boolean clickMiniMap = false;
  56.     public boolean buryBones = false;
  57.     public boolean bankBones = false;
  58.     public boolean showPaint = false;
  59.     public boolean showProfit = false;
  60.     public boolean takeRandomBones = false;
  61.     public boolean showMouse = false;
  62.     public boolean antiBan = false;
  63.     public boolean waitForDrop = false;
  64.     public Color monkColor = null;
  65.     public Color mouseColor = null;
  66.     public Color paintColor = null;
  67.     public Color textColor = null;
  68.  
  69.     // SCRIPT VARIABLES
  70.     monkR8perGUI gui;
  71.     public Point mousePoint = null;
  72.     public RSNPC currentNPC = null;
  73.     public RSTile fromBankPath[] = null;
  74.     public RSTile dest = null;
  75.     public RSTile bankBoothTile = null;
  76.     public boolean guiExit = true;
  77.     public boolean firstRun = true;
  78.     public boolean clickContinue = false;
  79.     public boolean justHealed = false;
  80.     public boolean healing = false;
  81.     public boolean doBury = false;
  82.     public boolean doBank = false;
  83.     public boolean npcBusy = false;
  84.     public boolean noAmmo = false;
  85.     public boolean wasInCombat = false;
  86.     public boolean justBanked = false;
  87.     public int bonesMarketPrice = 0;
  88.     public int currentMouseSpeed = 0;
  89.     public int totalHealed = 0;
  90.     public int deaths = 0;
  91.     public int lastBoneCount = 0;
  92.     public int totalBones = 0;
  93.     public int lastExp = 0;
  94.     public long lastCheck;
  95.     public long startTime;
  96.     public long runTime;
  97.     public String status = "";
  98.     public String spellName = "";
  99.     public String ammoName = "";
  100.     /*-start exp-*/
  101.     public int startDefExp = 0;
  102.     public int startAttExp = 0;
  103.     public int startStrExp = 0;
  104.     public int startConExp = 0;
  105.     public int startRanExp = 0;
  106.     public int startPraExp = 0;
  107.     public int startMagExp = 0;
  108.  
  109.     // GUI VARIABLES
  110.     public int totalBuriedBones = 0;
  111.     public int bonesPerHour = 0;
  112.     public int bankTrips = 0;
  113.     /*-gained exp-*/
  114.     public int defExpGained = 0;
  115.     public int strExpGained = 0;
  116.     public int attExpGained = 0;
  117.     public int conExpGained = 0;
  118.     public int ranExpGained = 0;
  119.     public int praExpGained = 0;
  120.     public int magExpGained = 0;
  121.     public int totalExpGained = 0;
  122.     /*-gained lvl-*/
  123.     public int defLvlGained = 0;
  124.     public int strLvlGained = 0;
  125.     public int attLvlGained = 0;
  126.     public int conLvlGained = 0;
  127.     public int ranLvlGained = 0;
  128.     public int praLvlGained = 0;
  129.     public int magLvlGained = 0;
  130.     public int totalLvlGained = 0;
  131.     public int combatLevelsGained = 0;
  132.     // END GUI VARIABLES
  133.  
  134.     // SCRIPT CONSTANTS
  135.     public final File settingsFile = new File(new File(
  136.             GlobalConfiguration.Paths.getSettingsDirectory()),
  137.             "monkR8per_Settings.txt");
  138.     static final RSTile headMonkTile = new RSTile(3056, 3483);
  139.     static final RSTile boothTile = new RSTile(3095, 3493);
  140.     static final RSTile boothTile2 = new RSTile(3097, 3495);
  141.     static final RSArea monkArea = new RSArea(new RSTile(3041, 3480),
  142.             new RSTile(3062, 3501));
  143.     static final RSArea edgeArea = new RSArea(new RSTile(3041, 3480),
  144.             new RSTile(3099, 3520));
  145.     static final RSArea bankArea = new RSArea(new RSTile(3090, 3487),
  146.             new RSTile(3099, 3500));
  147.     static final RSTile toBankPath[] = { new RSTile(3051, 3491),
  148.             new RSTile(3052, 3502), new RSTile(3064, 3511),
  149.             new RSTile(3075, 3504), new RSTile(3088, 3501),
  150.             new RSTile(3094, 3496) };
  151.     static final int monkID = 7727;
  152.     static final int headMonkID = 801;
  153.     static final int airID = 556;
  154.     static final int waterID = 555;
  155.     static final int earthID = 557;
  156.     static final int fireID = 554;
  157.     static final int mindID = 558;
  158.     static final int chaosID = 562;
  159.     static final int deathID = 560;
  160.     static final int lawID = 563;
  161.     static final int boneID = 526;
  162.     static final int bronzeArrowID = 882;
  163.     static final int ironArrowID = 884;
  164.     static final int steelArrowID = 886;
  165.     static final int mithrilArrowID = 888;
  166.     static final int adamiteArrowID = 890;
  167.     static final int runeArrowID = 892;
  168.     final int notToDeposit[] = { ammoID, airID, waterID, earthID, fireID,
  169.             mindID, chaosID, deathID, lawID };
  170.  
  171.     static final Color bgRed = new Color(255, 0, 0, 150);
  172.     static final Color bgBlue = new Color(0, 0, 255, 150);
  173.     static final Color bgGreen = new Color(0, 255, 0, 50);
  174.     static final Color bgPurple = new Color(255, 0, 255, 150);
  175.     static final Color bgOrange = new Color(255, 128, 0, 150);
  176.     static final Color bgYellow = new Color(255, 255, 50, 150);
  177.     static final Color bgWhite = new Color(255, 255, 255, 150);
  178.     static final Color bgBlack = new Color(0, 0, 0, 150);
  179.     static final Color cPurple = new Color(255, 0, 255);
  180.     static final Color tRed = new Color(255, 0, 0, 50);
  181.     static final Color tBlue = new Color(0, 0, 255, 50);
  182.     static final Color tGreen = new Color(0, 255, 0, 50);
  183.     static final Color tPurple = new Color(255, 0, 255, 50);
  184.     static final Color tOrange = new Color(255, 128, 0, 50);
  185.     static final Color tYellow = new Color(255, 255, 50, 50);
  186.     static final Color tWhite = new Color(255, 255, 255, 50);
  187.     static final Color tBlack = new Color(0, 0, 0, 150);
  188.  
  189.     public final Filter<RSNPC> filter = new Filter<RSNPC>() {
  190.         public boolean accept(RSNPC npc) {
  191.             return !npc.isInCombat() && npcPresent(npc)
  192.                     && npc.getID() == monkID;
  193.         }
  194.         private boolean npcPresent(RSNPC npc) {
  195.             return npc != null && monkArea.contains(npc.getLocation());
  196.         }
  197.     };
  198.  
  199.     @Override
  200.     public int loop() {
  201.         if (game.isLoggedIn()
  202.                 && skills.getCurrentLevel(Skills.CONSTITUTION) > 1) {
  203.             if (firstRun) {
  204.                 setup();
  205.             }
  206.  
  207.             currentMouseSpeed = mouseSpeed + random(-2, 2);
  208.             mouse.setSpeed(currentMouseSpeed);
  209.             checkRun();
  210.             safety();
  211.             countHeals();
  212.             if (!firstRun && bankBones) {
  213.                 countBones();
  214.             }
  215.  
  216.             if (clickContinue && interfaces.canContinue()) {
  217.                 interfaces.clickContinue();
  218.                 clickContinue = false;
  219.                 mouse.moveSlightly();
  220.                 return random(500, 750);
  221.             }
  222.  
  223.             if (stopScript) {
  224.                 stopAtLevel();
  225.             }
  226.  
  227.             if (noAmmo) {
  228.                 if (inventory.contains(ammoID)) {
  229.                     status = "Equping ammo";
  230.                     RSItem ammo = inventory.getItem(ammoID);
  231.                     if (ammo != null) {
  232.                         ammo.doAction("Wield");
  233.                         mouse.moveSlightly();
  234.                         noAmmo = false;
  235.                         return random(750, 1000);
  236.                     }
  237.                 } else {
  238.                     status = "Stopping script";
  239.                     log("Out of ammo stopping script.");
  240.                     game.logout(true);
  241.                     sleep(random(1500, 2000));
  242.                     if (!game.isLoggedIn()) {
  243.                         stopScript();
  244.                     }
  245.                     return 5;
  246.                 }
  247.             }
  248.  
  249.             if (npcBusy) {
  250.                 if (camera.getPitch() > 15) {
  251.                     camera.setPitch(5);
  252.                 }
  253.                 RSTile centerTile = monkArea.getCentralTile();
  254.                 if (calc.distanceTo(centerTile) < 5) {
  255.                     RSTile randomCorner = new RSTile(0000, 0000);
  256.                     int r = random(1, 3); // pick a random corner
  257.                     switch (r) {
  258.                     case 1:
  259.                         randomCorner = new RSTile(3045, 3497);
  260.                         break;
  261.                     case 2:
  262.                         randomCorner = new RSTile(3045, 3484);
  263.                         break;
  264.                     case 3:
  265.                         randomCorner = new RSTile(3058, 3484);
  266.                         break;
  267.                     }
  268.                     status = "[AB] - Run away";
  269.                     walking.walkTileOnScreen(walking.randomizeTile(
  270.                             randomCorner, 1, 1));
  271.                     npcBusy = false;
  272.                     return random(250, 500);
  273.                 } else {
  274.                     status = "[AB] - Run away";
  275.                     walking.walkTo(walking.randomizeTile(centerTile, 3, 3));
  276.                     npcBusy = false;
  277.                     return random(250, 500);
  278.                 }
  279.             }
  280.  
  281.             if (needsToBank() && !atBank()) {
  282.                 doBank = true;
  283.                 status = "Walking to bank";
  284.                 if (dest == null
  285.                         || getMyPlayer().isIdle()
  286.                         || (calc.distanceTo(dest) < 5 && !bankArea
  287.                                 .contains(dest))) {
  288.                     if (walkPath(toBankPath)) {
  289.                         dest = walking.getDestination();
  290.                         return random(500, 750);
  291.                     }
  292.                 }
  293.                 return random(5, 10);
  294.             } else if (needsToBank() && atBank()) {
  295.                 dest = null;
  296.                 if (bank.isOpen()) {
  297.                     status = "Depositing";
  298.                     bank.depositAllExcept(notToDeposit);
  299.                     doBank = false;
  300.                     justBanked = true;
  301.                     return random(1000, 1500);
  302.                 } else {
  303.                     status = "Opening bank";
  304.                     if (camera.getPitch() > 15) {
  305.                         camera.setPitch(5);
  306.                     }
  307.                     RSObject bankBooth = objects.getTopAt(bankBoothTile);
  308.                     if (bankBooth != null) {
  309.                         camera.turnToTile(bankBoothTile);
  310.                         if (bankBooth.isOnScreen()) {
  311.                             bankBooth.doAction("Use-quickly");
  312.                             return random(1000, 1500);
  313.                         }
  314.                     }
  315.                     return random(5, 10);
  316.                 }
  317.             } else if (atMonks()) {
  318.                 dest = null;
  319.                 if (needsToHeal() || healing) {
  320.                     healing = true;
  321.                     status = "Healing";
  322.                     RSComponent interface1 = interfaces.getComponent(241, 5);
  323.                     RSComponent interface2 = interfaces.getComponent(230, 2);
  324.                     RSComponent interface3 = interfaces.getComponent(228, 2);
  325.                     RSComponent interface4 = interfaces.getComponent(64, 5);
  326.                     RSComponent interface5 = interfaces.getComponent(210, 2);
  327.  
  328.                     if (camera.getPitch() > 15) {
  329.                         camera.setPitch(5);
  330.                     }
  331.                     if (interface1.isValid()) {
  332.                         interface1.doClick();
  333.                         return random(750, 1000);
  334.                     } else if (interface2.isValid()) {
  335.                         interface2.doClick();
  336.                         return random(750, 1000);
  337.                     } else if (interface3.isValid()) {
  338.                         interface3.doClick();
  339.                         return random(750, 1000);
  340.                     } else if (interface4.isValid()) {
  341.                         interface4.doClick();
  342.                         return random(750, 1000);
  343.                     } else if (interface5.isValid()) {
  344.                         interface5.doClick();
  345.                         sleep(750, 1000);
  346.                         if (currentHP() >= (maxHP() - (maxHP() * .10))) {
  347.                             justHealed = true;
  348.                             healing = false;
  349.                             return 1;
  350.                         }
  351.                         return 1;
  352.                     } else {
  353.                         if (camera.getPitch() > 40) {
  354.                             camera.setPitch(25);
  355.                         }
  356.                         RSNPC headMonk = npcs.getNearest(headMonkID);
  357.                         if (headMonk != null) {
  358.                             if (calc.distanceTo(headMonkTile) < 5) {
  359.                                 camera.turnToTile(headMonkTile);
  360.                                 headMonk.doAction("Talk-to");
  361.                                 return random(750, 1250);
  362.                             } else {
  363.                                 if (!getMyPlayer().isMoving()) {
  364.                                     RSTile path[] = walking
  365.                                             .findPath(headMonkTile);
  366.                                     walking.walkPathMM(path);
  367.                                     return random(750, 1000);
  368.                                 }
  369.                                 return random(5, 10);
  370.                             }
  371.                         }
  372.                     }
  373.                 } else if (!inCombat()) {
  374.                     if (wasInCombat) {
  375.                         currentNPC = null;
  376.                         wasInCombat = false;
  377.                         if (waitForDrop && !needsToHeal()) {
  378.                             waitForDrop(5000);
  379.                             return random(250, 500);
  380.                         }
  381.                     }
  382.                     if (needsToBury()) {
  383.                         if (inventory.contains(boneID)) {
  384.                             status = "Burying bones";
  385.                             doBury = true;
  386.                             RSItem bones = inventory.getItem(boneID);
  387.                             if (bones != null) {
  388.                                 bones.doAction("Bury");
  389.                                 return random(350, 600);
  390.                             }
  391.                             return random(5, 10);
  392.                         } else {
  393.                             doBury = false;
  394.                             return random(5, 10);
  395.                         }
  396.                     }
  397.                     if (canTakeAmmo() && (!waitForDrop || takeRandomBones)) {
  398.                         status = "Picking up ammo";
  399.                         RSGroundItem ammo = groundItems.getNearest(ammoID);
  400.                         RSTile ammoTile = ammo.getLocation();
  401.                         if (ammo != null && ammoTile != null) {
  402.                             camera.turnToTile(ammoTile);
  403.                             if (calc.distanceTo(ammoTile) < 5) {
  404.                                 camera.setPitch(100);
  405.                                 if (ammo.doAction("Take " + ammoName)) {
  406.                                     mouse.moveSlightly();
  407.                                     return random(500, 750);
  408.                                 }
  409.                                 return random(50, 100);
  410.                             } else {
  411.                                 if (!getMyPlayer().isMoving()) {
  412.                                     walking.walkTileOnScreen(ammoTile);
  413.                                     return random(250, 500);
  414.                                 }
  415.                                 return random(5, 10);
  416.                             }
  417.                         }
  418.                     }
  419.                     if (canTakeBones()) {
  420.                         status = "Picking up bones";
  421.                         RSGroundItem bones = groundItems.getNearest(boneID);
  422.                         RSTile boneTile = bones.getLocation();
  423.                         if (bones != null && boneTile != null) {
  424.                             if (calc.distanceTo(boneTile) < 5
  425.                                     && calc.tileOnScreen(boneTile)) {
  426.                                 camera.setPitch(100);
  427.                                 if (bones.doAction("Take Bones")) {
  428.                                     mouse.moveSlightly();
  429.                                     return random(1500, 1750);
  430.                                 }
  431.                                 return random(50, 100);
  432.                             } else {
  433.                                 if (!getMyPlayer().isMoving()) {
  434.                                     walking.walkTileOnScreen(boneTile);
  435.                                     return random(250, 500);
  436.                                 }
  437.                                 return random(5, 10);
  438.                             }
  439.                         }
  440.                     }
  441.                     RSNPC monk = npcs.getNearest(filter);
  442.                     if (monk != null) {
  443.                         RSTile monkTile = monk.getLocation();
  444.                         status = "Attacking monk";
  445.                         if (camera.getPitch() > 15) {
  446.                             camera.setPitch(5);
  447.                         }
  448.                         camera.turnToTile(monkTile);
  449.                         if (monk != null && monk.isOnScreen()) {
  450.                             monk.doAction("Attack " + monk.getName());
  451.                             return random(750, 1000);
  452.                         } else {
  453.                             if (clickMiniMap) {
  454.                                 status = "Walking to monk";
  455.                                 if (calc.distanceTo(monkTile) < 7) {
  456.                                     if (!getMyPlayer().isMoving()) {
  457.                                         walking.walkTileOnScreen(monkTile);
  458.                                         return random(750, 1000);
  459.                                     }
  460.                                     return random(5, 10);
  461.                                 } else {
  462.                                     if (!getMyPlayer().isMoving()) {
  463.                                         RSTile path[] = walking
  464.                                                 .findPath(monkTile);
  465.                                         walking.walkPathMM(path);
  466.                                         return random(750, 1000);
  467.                                     }
  468.                                     return random(5, 10);
  469.                                 }
  470.                             } else {
  471.                                 status = "Walking to monk";
  472.                                 if (!getMyPlayer().isMoving()) {
  473.                                     walking.walkTileOnScreen(monkTile);
  474.                                     return random(750, 1000);
  475.                                 }
  476.                             }
  477.                         }
  478.                     } else {
  479.                         status = "Waiting";
  480.                         if (antiBan) {
  481.                             antiBan();
  482.                         }
  483.                         return random(5, 10);
  484.                     }
  485.                 } else if (inCombat()) {
  486.                     status = "Fighting";
  487.                     if (currentNPC == null || currentNPC != interactingNPC()) {
  488.                         currentNPC = interactingNPC();
  489.                     }
  490.                     if (currentNPC != null) {
  491.                         if (currentNPC.isInCombat()) {
  492.                             wasInCombat = true;
  493.                         }
  494.                     }
  495.                     if (antiBan) {
  496.                         antiBan();
  497.                     }
  498.                     return random(5, 10);
  499.                 }
  500.             } else {
  501.                 status = "Walking to monks";
  502.                 if (atEdge()) {
  503.                     if (justBanked) {
  504.                         bankTrips++;
  505.                         justBanked = false;
  506.                     }
  507.                     if (dest == null
  508.                             || getMyPlayer().isIdle()
  509.                             || (calc.distanceTo(dest) < 5 && !monkArea
  510.                                     .contains(dest))) {
  511.                         if (walkPath(fromBankPath)) {
  512.                             dest = walking.getDestination();
  513.                             return random(750, 1000);
  514.                         }
  515.                     }
  516.                     return random(5, 10);
  517.                 } else {
  518.                     RSTile destination = monkArea.getCentralTile();
  519.                     RSTile[] genPath = walking.findPath(destination);
  520.                     if (dest == null
  521.                             || getMyPlayer().isIdle()
  522.                             || (calc.distanceTo(dest) < 5 && !monkArea
  523.                                     .contains(dest))) {
  524.                         if (walkPath(genPath)) {
  525.                             dest = walking.getDestination();
  526.                             return random(750, 1000);
  527.                         }
  528.                     }
  529.                     return random(5, 10);
  530.                 }
  531.             }
  532.         }
  533.         return random(5, 10);
  534.     }
  535.  
  536.     private RSNPC interactingNPC() { // credits to: Foulwerp
  537.         return npcs.getNearest(new Filter<RSNPC>() {
  538.             public boolean accept(RSNPC n) {
  539.                 if (n.getInteracting() == null) {
  540.                     return false;
  541.                 }
  542.                 String[] acts = n.getActions();
  543.                 if (acts == null) {
  544.                     return false;
  545.                 }
  546.                 for (String a : acts) {
  547.                     if (a == null || !a.contains("Attack")) {
  548.                         continue;
  549.                     }
  550.                     return n.getInteracting().equals(players.getMyPlayer());
  551.                 }
  552.                 return false;
  553.             }
  554.         });
  555.     }
  556.  
  557.     private boolean inCombat() {
  558.         return getMyPlayer().getInteracting() != null
  559.                 && getMyPlayer().getInteracting().getHPPercent() > 0;
  560.     }
  561.  
  562.     private void waitForDrop(final int timeout) {
  563.         long start = System.currentTimeMillis();
  564.         status = "Waiting 4 drop";
  565.         while (System.currentTimeMillis() - start < timeout) {
  566.             if (itemPresent(boneID, 3)) {
  567.                 return;
  568.             }
  569.         }
  570.     }
  571.  
  572.     private boolean walkPath(RSTile[] path) {
  573.         return walking.walkPathMM(walking.randomizePath(path, 2, 2));
  574.     }
  575.  
  576.     private boolean canTakeAmmo() {
  577.         if (pickAmmo) {
  578.             return (inventory.getCount() < 28 || inventory.contains(ammoID))
  579.                     && itemPresent(ammoID) && !getMyPlayer().isMoving();
  580.         }
  581.         return false;
  582.     }
  583.  
  584.     private boolean canTakeBones() {
  585.         if (buryBones || bankBones) {
  586.             return inventory.getCount() < 28 && itemPresent(boneID)
  587.                     && itemPresent(boneID, 3) && !getMyPlayer().isMoving();
  588.         }
  589.         return false;
  590.     }
  591.  
  592.     public boolean itemPresent(int itemID) {
  593.         RSGroundItem item = groundItems.getNearest(itemID);
  594.         return item != null && monkArea.contains(item.getLocation());
  595.     }
  596.  
  597.     public boolean itemPresent(int itemID, int dist) {
  598.         RSGroundItem item = groundItems.getNearest(itemID);
  599.         RSTile playerTile = getMyPlayer().getLocation();
  600.         if (item != null) {
  601.             RSTile itemTile = item.getLocation();
  602.             RSArea itemArea = new RSArea(new RSTile(playerTile.getX()
  603.                     - (dist - 1), playerTile.getY() + dist), new RSTile(
  604.                     playerTile.getX() + (dist - 1), playerTile.getY() - dist));
  605.             return itemArea.contains(itemTile);
  606.         }
  607.         return false;
  608.     }
  609.  
  610.     private boolean needsToBank() {
  611.         if (bankBones) {
  612.             return (inventory.isFull() && inventory.contains(boneID)) || doBank;
  613.         }
  614.         return false;
  615.     }
  616.  
  617.     private boolean needsToBury() {
  618.         if (buryBones) {
  619.             return (inventory.isFull() && inventory.contains(boneID)) || doBury;
  620.         }
  621.         return false;
  622.     }
  623.  
  624.     private void safety() {
  625.         if (getMyPlayer().getAnimation() == -1) {
  626.             final long time = System.currentTimeMillis();
  627.             if ((time - lastCheck) >= 420000) {
  628.                 if (lastExp == skills.getCurrentExp(Skills.CONSTITUTION)) {
  629.                     log("We've been idle for the past 7 minutes. Something's wrong.");
  630.                     stopScript(true);
  631.                 }
  632.                 lastCheck = System.currentTimeMillis();
  633.                 lastExp = skills.getCurrentExp(Skills.CONSTITUTION);
  634.             }
  635.         }
  636.     }
  637.  
  638.     private int gamble() {
  639.         final int r = random(1, 5000);
  640.         if (r < 25) {
  641.             return 1;
  642.         } else if (r > 4975) {
  643.             return 2;
  644.         } else {
  645.             return r;
  646.         }
  647.     }
  648.  
  649.     private void antiBan() {
  650.         final String ab = "[AB] - ";
  651.         switch (gamble()) {
  652.         case 1:
  653.             if (random(0, 1) == 1) {
  654.                 status = ab + "Move camera";
  655.                 camera.setAngle(random(1, 360));
  656.                 sleep(random(750, 1250));
  657.             }
  658.             break;
  659.         case 2:
  660.             switch (random(0, 5)) {
  661.             case 1:
  662.                 status = ab + "Move mouse";
  663.                 mouse.moveSlightly();
  664.                 sleep(random(750, 1250));
  665.                 break;
  666.             case 2:
  667.                 status = ab + "Move mouse";
  668.                 mouse.move(251, 395, 250, 394);
  669.                 sleep(random(750, 1250));
  670.                 break;
  671.             case 3:
  672.                 status = ab + "Move mouse";
  673.                 mouse.moveOffScreen();
  674.                 sleep(random(750, 1250));
  675.                 break;
  676.             case 4:
  677.                 status = ab + "Move mouse";
  678.                 mouse.move(200, 200, 50);
  679.                 sleep(random(750, 1250));
  680.                 break;
  681.             }
  682.             break;
  683.         case 420:
  684.             status = ab + "Check inventory";
  685.             checkInventory();
  686.             break;
  687.         case 2000:
  688.             status = ab + "Check stat";
  689.             checkSkill();
  690.             break;
  691.         case 3000:
  692.             status = ab + "Check random stat";
  693.             checkRandomSkill();
  694.             break;
  695.         case 4000:
  696.             status = ab + "Move mouse";
  697.             mouse.move(280, 420, 50);
  698.             break;
  699.         case 5000:
  700.             status = ab + "Check friends";
  701.             checkFriendsList();
  702.             break;
  703.         case 6000:
  704.             if (buryBones) {
  705.                 status = ab + "Check prayer stat";
  706.                 checkPrayer();
  707.             }
  708.             break;
  709.         case 7000:
  710.             if (clanChat.isInChannel()) {
  711.                 status = ab + "Check clan";
  712.                 checkClan();
  713.             }
  714.             break;
  715.         }
  716.     }
  717.  
  718.     private void checkInventory() {
  719.         if (game.getCurrentTab() != Game.TAB_INVENTORY) {
  720.             game.openTab(Game.TAB_INVENTORY);
  721.             sleep(random(500, 570));
  722.         }
  723.         mouse.move(643, 438, 30);
  724.         sleep(random(750, 1250));
  725.     }
  726.  
  727.     private void checkClan() {
  728.         if (game.getCurrentTab() != Game.TAB_CLAN) {
  729.             game.openTab(Game.TAB_CLAN);
  730.             sleep(random(500, 570));
  731.         }
  732.         mouse.move(643, 438, 30);
  733.         sleep(random(750, 1250));
  734.     }
  735.  
  736.     private void checkPrayer() {
  737.         if (game.getCurrentTab() != Game.TAB_STATS) {
  738.             game.openTab(Game.TAB_STATS);
  739.             sleep(random(500, 570));
  740.         }
  741.         skills.doHover(Skills.PRAYER);
  742.         sleep(random(750, 1250));
  743.     }
  744.  
  745.     private void checkFriendsList() {
  746.         if (game.getCurrentTab() != Game.TAB_FRIENDS) {
  747.             game.openTab(Game.TAB_FRIENDS);
  748.             sleep(random(500, 570));
  749.         }
  750.         mouse.move(643, 438, 30);
  751.         sleep(random(750, 1250));
  752.     }
  753.  
  754.     private void checkRandomSkill() {
  755.         if (game.getCurrentTab() != Game.TAB_STATS) {
  756.             game.openTab(Game.TAB_STATS);
  757.             sleep(random(500, 570));
  758.         }
  759.         skills.doHover(random(0, 24));
  760.         sleep(random(750, 1250));
  761.     }
  762.  
  763.     private void checkSkill() {
  764.         if (game.getCurrentTab() != Game.TAB_STATS) {
  765.             game.openTab(Game.TAB_STATS);
  766.             sleep(random(500, 570));
  767.         }
  768.         switch (skillToTrain) {
  769.         case 0: // attack
  770.             skills.doHover(Skills.ATTACK);
  771.             sleep(random(750, 1250));
  772.             break;
  773.         case 1: // strength
  774.             skills.doHover(Skills.STRENGTH);
  775.             sleep(random(750, 1250));
  776.             break;
  777.         case 2: // defense
  778.             skills.doHover(Skills.DEFENSE);
  779.             sleep(random(750, 1250));
  780.             break;
  781.         case 3: // range
  782.             skills.doHover(Skills.RANGE);
  783.             sleep(random(750, 1250));
  784.             break;
  785.         case 4: // magic
  786.             skills.doHover(Skills.MAGIC);
  787.             sleep(random(750, 1250));
  788.             break;
  789.         }
  790.     }
  791.  
  792.     private void countHeals() {
  793.         if (justHealed && !needsToHeal()) {
  794.             totalHealed++;
  795.             justHealed = false;
  796.         }
  797.     }
  798.  
  799.     private boolean needsToHeal() {
  800.         if (healAfterCombat) {
  801.             if (inCombat()) {
  802.                 return currentHP() <= healAt2();
  803.             } else {
  804.                 return currentHP() <= healAt();
  805.             }
  806.         }
  807.         return currentHP() <= healAt();
  808.     }
  809.  
  810.     private int healAt() {
  811.         String HAP = "." + healAtPercent;
  812.         return (int) (maxHP() * Double.parseDouble(HAP));
  813.     }
  814.  
  815.     private int healAt2() {
  816.         String HAP = "." + ((int) healAtPercent / 2);
  817.         return (int) (maxHP() * Double.parseDouble(HAP));
  818.     }
  819.  
  820.     private int maxHP() {
  821.         return skills.getCurrentLevel(Skills.CONSTITUTION) * 10;
  822.     }
  823.  
  824.     public int currentHP() {
  825.         return Integer.parseInt(interfaces.getComponent(748, 8).getText());
  826.     }
  827.  
  828.     private void checkRun() {
  829.         if (!walking.isRunEnabled() && walking.getEnergy() > random(15, 30)) {
  830.             walking.setRun(true);
  831.             sleep(random(500, 750));
  832.         }
  833.     }
  834.  
  835.     private boolean atEdge() {
  836.         return edgeArea.contains(getMyPlayer().getLocation());
  837.     }
  838.  
  839.     private boolean atBank() {
  840.         return bankArea.contains(getMyPlayer().getLocation());
  841.     }
  842.  
  843.     private boolean atMonks() {
  844.         return monkArea.contains(getMyPlayer().getLocation());
  845.     }
  846.  
  847.     private int countKills() {
  848.         if (conExpGained >= 20) {
  849.             return (int) (conExpGained / 20);
  850.         }
  851.         return 0;
  852.     }
  853.  
  854.     private int killsPerHour() {
  855.         if (runTime / 1000 > 0) {
  856.             return (int) (3600000.0 / runTime * countKills());
  857.         }
  858.         return 0;
  859.     }
  860.  
  861.     private int hpPerHour() {
  862.         if (runTime / 1000 > 0) {
  863.             return (int) (3600000.0 / runTime * conExpGained);
  864.         }
  865.         return 0;
  866.     }
  867.  
  868.     private void countBones() {
  869.         final int currentBoneCount = inventory.getCount(boneID);
  870.         if ((currentBoneCount == 0) && (lastBoneCount >= 25)) {
  871.             lastBoneCount = 0;
  872.         }
  873.         if (currentBoneCount > lastBoneCount) {
  874.             totalBones++;
  875.             lastBoneCount = currentBoneCount;
  876.         }
  877.     }
  878.  
  879.     private int bonesPerHour() {
  880.         if (runTime / 1000 > 0) {
  881.             return (int) (3600000.0 / runTime * totalBones);
  882.         }
  883.         return 0;
  884.     }
  885.  
  886.     private int buriedPerHour() {
  887.         if (runTime / 1000 > 0) {
  888.             return (int) (3600000.0 / runTime * totalBuriedBones);
  889.         }
  890.         return 0;
  891.     }
  892.  
  893.     private int totalProfit() {
  894.         return totalBones * bonesMarketPrice;
  895.     }
  896.  
  897.     private int profitPerHour() {
  898.         if (runTime / 1000 > 0) {
  899.             return (int) (3600000.0 / runTime * totalProfit());
  900.         }
  901.         return 0;
  902.     }
  903.  
  904.     public double getVersion() {
  905.         return getClass().getAnnotation(ScriptManifest.class).version();
  906.     }
  907.  
  908.     public String runTime() {
  909.         runTime = System.currentTimeMillis() - startTime;
  910.         return formatTime((int) runTime);
  911.     }
  912.  
  913.     private String formatTime(int time) { // credits to Ahmedbasil1
  914.         final StringBuilder stringAppend = new StringBuilder();
  915.         final long TSec = time / 1000;
  916.         final long TMin = TSec / 60;
  917.         final long THour = TMin / 60;
  918.         final int s = (int) TSec % 60;
  919.         final int m = (int) TMin % 60;
  920.         final int h = (int) THour;
  921.         if (time <= 0) {
  922.             return "00:00:00";
  923.         }
  924.         if (h < 10) {
  925.             stringAppend.append("0");
  926.         }
  927.         stringAppend.append(h);
  928.         stringAppend.append(":");
  929.         if (m < 10) {
  930.             stringAppend.append("0");
  931.         }
  932.         stringAppend.append(m);
  933.         stringAppend.append(":");
  934.         if (s < 10) {
  935.             stringAppend.append("0");
  936.         }
  937.         stringAppend.append(s);
  938.         return stringAppend.toString();
  939.     }
  940.  
  941.     private int attPerHour() {
  942.         if (runTime / 1000 > 0) {
  943.             return (int) (3600000.0 / runTime * attExpGained);
  944.         }
  945.         return 0;
  946.     }
  947.  
  948.     private int strPerHour() {
  949.         if (runTime / 1000 > 0) {
  950.             return (int) (3600000.0 / runTime * strExpGained);
  951.         }
  952.         return 0;
  953.     }
  954.  
  955.     private int defPerHour() {
  956.         if (runTime / 1000 > 0) {
  957.             return (int) (3600000.0 / runTime * defExpGained);
  958.         }
  959.         return 0;
  960.     }
  961.  
  962.     private int ranPerHour() {
  963.         if (runTime / 1000 > 0) {
  964.             return (int) (3600000.0 / runTime * ranExpGained);
  965.         }
  966.         return 0;
  967.     }
  968.  
  969.     private int magPerHour() {
  970.         if (runTime / 1000 > 0) {
  971.             return (int) (3600000.0 / runTime * magExpGained);
  972.         }
  973.         return 0;
  974.     }
  975.  
  976.     private int praPerHour() {
  977.         if (runTime / 1000 > 0) {
  978.             return (int) (3600000.0 / runTime * praExpGained);
  979.         }
  980.         return 0;
  981.     }
  982.  
  983.     private int tripsPerHour() {
  984.         if (runTime / 1000 > 0) {
  985.             return (int) (3600000.0 / runTime * bankTrips);
  986.         }
  987.         return 0;
  988.     }
  989.  
  990.     private void keepTrackOfSkills() {
  991.         int currentDefExp = skills.getCurrentExp(Skills.DEFENSE);
  992.         int currentAttExp = skills.getCurrentExp(Skills.ATTACK);
  993.         int currentStrExp = skills.getCurrentExp(Skills.STRENGTH);
  994.         int currentConExp = skills.getCurrentExp(Skills.CONSTITUTION);
  995.         int currentRanExp = skills.getCurrentExp(Skills.RANGE);
  996.         int currentPraExp = skills.getCurrentExp(Skills.PRAYER);
  997.         int currentMagExp = skills.getCurrentExp(Skills.MAGIC);
  998.  
  999.         defExpGained = currentDefExp - startDefExp;
  1000.         strExpGained = currentStrExp - startStrExp;
  1001.         attExpGained = currentAttExp - startAttExp;
  1002.         conExpGained = currentConExp - startConExp;
  1003.         ranExpGained = currentRanExp - startRanExp;
  1004.         praExpGained = currentPraExp - startPraExp;
  1005.         magExpGained = currentMagExp - startMagExp;
  1006.  
  1007.         totalExpGained = defExpGained + strExpGained + attExpGained
  1008.                 + conExpGained + ranExpGained + praExpGained + magExpGained;
  1009.  
  1010.         totalLvlGained = defLvlGained + strLvlGained + attLvlGained
  1011.                 + conLvlGained + ranLvlGained + praLvlGained + magLvlGained;
  1012.     }
  1013.  
  1014.     public void stopAtLevel() {
  1015.         switch (skillToTrain) {
  1016.         case 0: // attack
  1017.             if (skills.getCurrentLevel(Skills.ATTACK) >= levelToStopAt)
  1018.                 goalReached();
  1019.             break;
  1020.         case 1: // strength
  1021.             if (skills.getCurrentLevel(Skills.STRENGTH) >= levelToStopAt)
  1022.                 goalReached();
  1023.             break;
  1024.         case 2: // defense
  1025.             if (skills.getCurrentLevel(Skills.DEFENSE) >= levelToStopAt)
  1026.                 goalReached();
  1027.             break;
  1028.         case 3: // range
  1029.             if (skills.getCurrentLevel(Skills.RANGE) >= levelToStopAt)
  1030.                 goalReached();
  1031.             break;
  1032.         case 4: // magic
  1033.             if (skills.getCurrentLevel(Skills.MAGIC) >= levelToStopAt)
  1034.                 goalReached();
  1035.             break;
  1036.         }
  1037.     }
  1038.  
  1039.     private void goalReached() {
  1040.         log("Requested level reached !");
  1041.         game.logout(true);
  1042.         sleep(random(1500, 2000));
  1043.         if (!game.isLoggedIn()) {
  1044.             stopScript(true);
  1045.         }
  1046.     }
  1047.  
  1048.     @Override
  1049.     public void serverMessageRecieved(ServerMessageEvent e) {
  1050.  
  1051.         final String serverString = e.getMessage().toLowerCase();
  1052.  
  1053.         if (serverString.contains("you've just advanced")) {
  1054.             if (serverString.contains("strength level"))
  1055.                 strLvlGained++;
  1056.             if (serverString.contains("attack level"))
  1057.                 attLvlGained++;
  1058.             if (serverString.contains("defence level"))
  1059.                 defLvlGained++;
  1060.             if (serverString.contains("constitution level"))
  1061.                 conLvlGained++;
  1062.             if (serverString.contains("ranged level"))
  1063.                 ranLvlGained++;
  1064.             if (serverString.contains("magic level"))
  1065.                 magLvlGained++;
  1066.             if (serverString.contains("prayer level"))
  1067.                 praLvlGained++;
  1068.             log("Gratz you just gained a level !");
  1069.             env.saveScreenshot(true);
  1070.             clickContinue = true;
  1071.         }
  1072.  
  1073.         if (serverString.contains("you bury the")) {
  1074.             totalBuriedBones++;
  1075.         }
  1076.         if (serverString.contains("oh dear")) {
  1077.             deaths++;
  1078.         }
  1079.         if (serverString.contains("combat level")) {
  1080.             combatLevelsGained++;
  1081.         }
  1082.         if (serverString.contains("someone else is fighting")) {
  1083.             npcBusy = true;
  1084.         }
  1085.         if (serverString.contains("no ammo")
  1086.                 || serverString.contains("do not have enough")) {
  1087.             noAmmo = true;
  1088.         }
  1089.         if (serverString.contains("log out until 10 seconds")) {
  1090.             sleep(random(9000, 11000));
  1091.         }
  1092.     }
  1093.  
  1094.     @Override
  1095.     public void onRepaint(Graphics render) { // TODO finish this
  1096.         final BasicStroke mouseStroke = new BasicStroke(2);
  1097.         Graphics2D g = (Graphics2D) render;
  1098.         if (game.isLoggedIn()
  1099.                 && skills.getCurrentLevel(Skills.CONSTITUTION) > 1) {
  1100.             keepTrackOfSkills();
  1101.             if (showMonk) {
  1102.                 drawNextMonk(g);
  1103.             }
  1104.             if (showMouse) {
  1105.                 g.setStroke(mouseStroke);
  1106.                 drawMouse(g);
  1107.             }
  1108.             if (showPaint && !isHover(528, 203, 756, 466)) {
  1109.                 g.setColor(paintColor);
  1110.                 g.fillRoundRect(528, 203, 228, 263, 16, 16);
  1111.                 g.setFont(new Font("Arial", 1, 16));
  1112.                 g.setColor(textColor);
  1113.                 g.drawString("monkR8per v" + getVersion(), 584, 221);
  1114.                 g.setFont(new Font("Arial", 1, 12));
  1115.                 g.drawString("Runtime: " + runTime(), 533, 240);
  1116.                 g.drawString("Status: " + status, 533, 256);
  1117.                 g.drawString("Kills: " + countKills() + " (" + killsPerHour()
  1118.                         + " p/hr)", 533, 272);
  1119.                 g.drawString("Healed: " + totalHealed, 533, 288);
  1120.                 g.drawString("Deaths: " + deaths, 533, 304);
  1121.                 switch (skillToTrain) {
  1122.                 case 0: // attack
  1123.                     g.drawString("Attack level: "
  1124.                             + skills.getCurrentLevel(Skills.ATTACK) + " (+"
  1125.                             + attLvlGained + ")", 533, 320);
  1126.                     g.drawString("Attack Exp: " + attExpGained + " ("
  1127.                             + attPerHour() + " p/hr)", 533, 336);
  1128.                     break;
  1129.                 case 1: // strength
  1130.                     g.drawString("Strength level: "
  1131.                             + skills.getCurrentLevel(Skills.STRENGTH) + " (+"
  1132.                             + strLvlGained + ")", 533, 320);
  1133.                     g.drawString("Strength Exp: " + strExpGained + " ("
  1134.                             + strPerHour() + " p/hr)", 533, 336);
  1135.                     break;
  1136.                 case 2: // defense
  1137.                     g.drawString("Defense level: "
  1138.                             + skills.getCurrentLevel(Skills.DEFENSE) + " (+"
  1139.                             + defLvlGained + ")", 533, 320);
  1140.                     g.drawString("Defense Exp: " + defExpGained + " ("
  1141.                             + defPerHour() + " p/hr)", 533, 336);
  1142.                     break;
  1143.                 case 3: // range
  1144.                     g.drawString("Range level: "
  1145.                             + skills.getCurrentLevel(Skills.RANGE) + " (+"
  1146.                             + ranLvlGained + ")", 533, 320);
  1147.                     g.drawString("Range Exp: " + ranExpGained + " ("
  1148.                             + ranPerHour() + " p/hr)", 533, 336);
  1149.                     break;
  1150.                 case 4: // magic
  1151.                     g.drawString("Magic level: "
  1152.                             + skills.getCurrentLevel(Skills.MAGIC) + " (+"
  1153.                             + magLvlGained + ")", 533, 320);
  1154.                     g.drawString("Magic Exp: " + magExpGained + " ("
  1155.                             + magPerHour() + " p/hr)", 533, 336);
  1156.                     break;
  1157.                 }
  1158.                 g.drawString("Constitution level: "
  1159.                         + skills.getCurrentLevel(Skills.CONSTITUTION) + " (+"
  1160.                         + conLvlGained + ")", 533, 352);
  1161.                 g.drawString("Constitution Exp: " + conExpGained + " ("
  1162.                         + hpPerHour() + " p/hr)", 533, 368);
  1163.                 g
  1164.                         .drawString("Total levels gained: " + totalLvlGained,
  1165.                                 533, 384);
  1166.                 g.drawString("Combat level: " + getMyPlayer().getCombatLevel()
  1167.                         + " (+" + combatLevelsGained + ")", 533, 400);
  1168.                 g.drawString("Mouse speed: " + currentMouseSpeed, 650, 240);
  1169.                 if (bankBones && showProfit) {
  1170.                     g.drawString("Bones: " + totalBones + " (" + bonesPerHour()
  1171.                             + " p/h)", 533, 416);
  1172.                     g.drawString("Profit: " + totalProfit() + " ("
  1173.                             + profitPerHour() + " p/h)", 533, 432);
  1174.                     g.drawString("Bank trips: " + bankTrips + " ("
  1175.                             + tripsPerHour() + " p/h)", 533, 448);
  1176.                 }
  1177.                 if (buryBones) {
  1178.                     g.drawString("Prayer Level: "
  1179.                             + skills.getCurrentLevel(Skills.PRAYER) + " (+"
  1180.                             + praLvlGained + ")", 533, 416);
  1181.                     g.drawString("Prayer Exp: " + praExpGained + " ("
  1182.                             + praPerHour() + " p/h)", 533, 432);
  1183.                     g.drawString("Bones buried: " + totalBuriedBones + " ("
  1184.                             + buriedPerHour() + " p/h)", 533, 448);
  1185.                 }
  1186.             }
  1187.         }
  1188.     }
  1189.  
  1190.     public void drawMouse(final Graphics g) {
  1191.         final Point loc = mouse.getLocation();
  1192.         g.setColor(mouseColor);
  1193.         g.drawLine(0, loc.y, 766, loc.y);
  1194.         g.drawLine(loc.x, 0, loc.x, 505);
  1195.     }
  1196.  
  1197.     public void drawNextMonk(Graphics g) {
  1198.         RSNPC npc = npcs.getNearest(filter);
  1199.         if (npc != null) {
  1200.             RSModel model = npc.getModel();
  1201.             if (model != null) {
  1202.                 g.setColor(monkColor);
  1203.                 for (Polygon p : model.getTriangles()) {
  1204.                     g.fillPolygon(p);
  1205.                 }
  1206.             }
  1207.             overlayText(g, npc.getLocation(), textColor, "Next Monk");
  1208.         }
  1209.     }
  1210.  
  1211.     public void overlayText(final Graphics g, final RSTile t, final Color c,
  1212.             final String text) {
  1213.         final Point p = calc.tileToScreen(t);
  1214.         final Point pn = calc.tileToScreen(new RSTile(t.getX(), t.getY()), 0);
  1215.         final Point px = calc.tileToScreen(new RSTile(t.getX() + 1, t.getY()),
  1216.                 0);
  1217.         final Point py = calc.tileToScreen(new RSTile(t.getX(), t.getY() + 1),
  1218.                 0);
  1219.         final Point pxy = calc.tileToScreen(new RSTile(t.getX() + 1,
  1220.                 t.getY() + 1), 0);
  1221.         final Point[] points = { p, pn, px, py, pxy };
  1222.         for (final Point point : points) {
  1223.             if (!calc.pointOnScreen(point)) {
  1224.                 return;
  1225.             }
  1226.         }
  1227.         g.setColor(c);
  1228.         g.setFont(new Font("sansserif", Font.BOLD, 12));
  1229.         g.drawString(text, p.x - 30, p.y - 40);
  1230.     }
  1231.  
  1232.     public boolean autoCastSpell(int spell, int desiredSpellSetting) {
  1233.         if (settings.getSetting(43) != 4
  1234.                 || settings.getSetting(108) != desiredSpellSetting) {
  1235.             if (game.getCurrentTab() != Game.TAB_MAGIC) {
  1236.                 game.openTab(Game.TAB_MAGIC);
  1237.                 sleep(random(150, 250));
  1238.             }
  1239.             return interfaces.getComponent(spell).doAction("Autocast");
  1240.         }
  1241.         return false;
  1242.     }
  1243.    
  1244.     private void setup() {
  1245.         startTime = System.currentTimeMillis();
  1246.         startDefExp = skills.getCurrentExp(Skills.DEFENSE);
  1247.         startAttExp = skills.getCurrentExp(Skills.ATTACK);
  1248.         startStrExp = skills.getCurrentExp(Skills.STRENGTH);
  1249.         startConExp = skills.getCurrentExp(Skills.CONSTITUTION);
  1250.         startRanExp = skills.getCurrentExp(Skills.RANGE);
  1251.         startMagExp = skills.getCurrentExp(Skills.MAGIC);
  1252.         if (healAfterCombat) {
  1253.             log("We will heal at: " + healAt() + "/" + healAt2());
  1254.         } else {
  1255.             log("We will heal at: " + healAt());
  1256.         }
  1257.         switch (skillToTrain) {
  1258.         case 0: // attack
  1259.             log("Training: Attack");
  1260.             combat.setFightMode(0);
  1261.             break;
  1262.         case 1: // strength
  1263.             log("Training: Strength");
  1264.             combat.setFightMode(1);
  1265.             break;
  1266.         case 2: // defense
  1267.             log("Training: Defense");
  1268.             combat.setFightMode(3);
  1269.             break;
  1270.         case 3: // range
  1271.             switch (rangeStyle) {
  1272.             case 0: // accurate
  1273.                 log("Training: Range: Accurate");
  1274.                 break;
  1275.             case 1: // rapid
  1276.                 log("Training: Range: Rapid");
  1277.                 break;
  1278.             case 2: // long range
  1279.                 log("Training: Range: Long range");
  1280.                 break;
  1281.             }
  1282.             combat.setFightMode(rangeStyle);
  1283.             if (pickAmmo) {
  1284.                 log("We will pick up " + ammoName + " ID: " + ammoID);
  1285.             }
  1286.             break;
  1287.         case 4:
  1288.             log("Training: Magic");
  1289.             log("Casting spell: " + spellName + " ID: " + autoCastSpellID);
  1290.             magic.autoCastSpell(autoCastSpellID);
  1291.             break;
  1292.         }
  1293.         if (stopScript) {
  1294.             log("We will stop training at level: " + levelToStopAt);
  1295.         }
  1296.         if (bankBones) {
  1297.             log("We will bank bones - Loading current market price...");
  1298.             bonesMarketPrice = grandExchange.getMarketPrice(boneID);
  1299.             lastBoneCount = inventory.getCount(boneID);
  1300.             log("Current market price of Bones: " + bonesMarketPrice);
  1301.         }
  1302.         if (buryBones) {
  1303.             log("We will bury bones");
  1304.         }
  1305.         if (!combat.isAutoRetaliateEnabled()) {
  1306.             combat.setAutoRetaliate(true);
  1307.             sleep(random(1000, 1500));
  1308.         }
  1309.         firstRun = false;
  1310.     }
  1311.  
  1312.     @Override
  1313.     public boolean onStart() {
  1314.         try {
  1315.             settingsFile.createNewFile();
  1316.         } catch (final IOException ignored) {
  1317.  
  1318.         }
  1319.         fromBankPath = walking.reversePath(toBankPath);
  1320.         if (random(1, 10) < 5) {
  1321.             bankBoothTile = boothTile;
  1322.         } else {
  1323.             bankBoothTile = boothTile2;
  1324.         }
  1325.         gui = new monkR8perGUI();
  1326.         while (gui.isVisible()) {
  1327.             sleep(100);
  1328.         }
  1329.         return !guiExit;
  1330.     }
  1331.  
  1332.     public class monkR8perGUI extends JFrame {
  1333.         private static final long serialVersionUID = -2580618572741828067L;
  1334.         public monkR8perGUI() {
  1335.             initComponents();
  1336.         }
  1337.  
  1338.         private void buttonStartActionPerformed(ActionEvent e) {
  1339.             mouseSpeed = sliderMouseSpeed.getValue();
  1340.             if (checkBoxShowMouse.isSelected()) {
  1341.                 showMouse = true;
  1342.                 switch (comboBoxMouseColor.getSelectedIndex()) {
  1343.                 case 0:
  1344.                     mouseColor = Color.RED;
  1345.                     break;
  1346.                 case 1:
  1347.                     mouseColor = Color.BLUE;
  1348.                     break;
  1349.                 case 2:
  1350.                     mouseColor = Color.GREEN;
  1351.                     break;
  1352.                 case 3:
  1353.                     mouseColor = cPurple;
  1354.                     break;
  1355.                 case 4:
  1356.                     mouseColor = Color.ORANGE;
  1357.                     break;
  1358.                 case 5:
  1359.                     mouseColor = Color.YELLOW;
  1360.                     break;
  1361.                 case 6:
  1362.                     mouseColor = Color.WHITE;
  1363.                     break;
  1364.                 case 7:
  1365.                     mouseColor = Color.BLACK;
  1366.                     break;
  1367.                 }
  1368.             }
  1369.             if (checkBoxShowMonk.isSelected()) {
  1370.                 showMonk = true;
  1371.                 switch (comboBoxMonkColor.getSelectedIndex()) {
  1372.                 case 0:
  1373.                     monkColor = tRed;
  1374.                     break;
  1375.                 case 1:
  1376.                     monkColor = tBlue;
  1377.                     break;
  1378.                 case 2:
  1379.                     monkColor = tGreen;
  1380.                     break;
  1381.                 case 3:
  1382.                     monkColor = tPurple;
  1383.                     break;
  1384.                 case 4:
  1385.                     monkColor = tOrange;
  1386.                     break;
  1387.                 case 5:
  1388.                     monkColor = tYellow;
  1389.                     break;
  1390.                 case 6:
  1391.                     monkColor = tWhite;
  1392.                     break;
  1393.                 case 7:
  1394.                     monkColor = tBlack;
  1395.                     break;
  1396.                 }
  1397.             }
  1398.             if (checkBoxBuryBones.isSelected()) {
  1399.                 buryBones = true;
  1400.             }
  1401.             if (checkBoxBankBones.isSelected()) {
  1402.                 bankBones = true;
  1403.             }
  1404.             if (bankBones || buryBones) {
  1405.                 if (checkBoxWaitForDrop.isSelected()) {
  1406.                     waitForDrop = true;
  1407.                 }
  1408.             }
  1409.             if (checkBoxAntiBan.isSelected()) {
  1410.                 antiBan = true;
  1411.             }
  1412.             if (checkBoxShowPaint.isSelected()) {
  1413.                 showPaint = true;
  1414.                 if (bankBones && checkBoxShowProfit.isSelected()) {
  1415.                     showProfit = true;
  1416.                 }
  1417.                 switch (comboBoxPaintColor.getSelectedIndex()) {
  1418.                 case 0:
  1419.                     paintColor = bgRed;
  1420.                     break;
  1421.                 case 1:
  1422.                     paintColor = bgBlue;
  1423.                     break;
  1424.                 case 2:
  1425.                     paintColor = bgGreen;
  1426.                     break;
  1427.                 case 3:
  1428.                     paintColor = bgPurple;
  1429.                     break;
  1430.                 case 4:
  1431.                     paintColor = bgOrange;
  1432.                     break;
  1433.                 case 5:
  1434.                     paintColor = bgYellow;
  1435.                     break;
  1436.                 case 6:
  1437.                     paintColor = bgWhite;
  1438.                     break;
  1439.                 case 7:
  1440.                     paintColor = tBlack;
  1441.                     break;
  1442.                 }
  1443.                 switch (comboBoxPaintTextColor.getSelectedIndex()) {
  1444.                 case 0:
  1445.                     textColor = Color.RED;
  1446.                     break;
  1447.                 case 1:
  1448.                     textColor = Color.BLUE;
  1449.                     break;
  1450.                 case 2:
  1451.                     textColor = Color.GREEN;
  1452.                     break;
  1453.                 case 3:
  1454.                     textColor = cPurple;
  1455.                     break;
  1456.                 case 4:
  1457.                     textColor = Color.ORANGE;
  1458.                     break;
  1459.                 case 5:
  1460.                     textColor = Color.YELLOW;
  1461.                     break;
  1462.                 case 6:
  1463.                     textColor = Color.WHITE;
  1464.                     break;
  1465.                 case 7:
  1466.                     textColor = Color.BLACK;
  1467.                     break;
  1468.                 }
  1469.             }
  1470.             healAtPercent = Integer.parseInt(textFieldHealAtPercent.getText());
  1471.             skillToTrain = comboBoxSkillToTrain.getSelectedIndex();
  1472.             if (skillToTrain == 3) {
  1473.                 if (checkBoxPickAmmo.isSelected()) {
  1474.                     pickAmmo = true;
  1475.                     switch (comboBoxAmmoType.getSelectedIndex()) {
  1476.                     case 0:
  1477.                         ammoID = bronzeArrowID;
  1478.                         ammoName = "Bronze arrow";
  1479.                         break;
  1480.                     case 1:
  1481.                         ammoID = ironArrowID;
  1482.                         ammoName = "Iron arrow";
  1483.                         break;
  1484.                     case 2:
  1485.                         ammoID = steelArrowID;
  1486.                         ammoName = "Steel arrow";
  1487.                         break;
  1488.                     case 3:
  1489.                         ammoID = mithrilArrowID;
  1490.                         ammoName = "Mithril arrow";
  1491.                         break;
  1492.                     case 4:
  1493.                         ammoID = adamiteArrowID;
  1494.                         ammoName = "Adamite arrow";
  1495.                         break;
  1496.                     case 5:
  1497.                         ammoID = runeArrowID;
  1498.                         ammoName = "Rune arrow";
  1499.                         break;
  1500.                     }
  1501.                     rangeStyle = comboBoxRangedStyle.getSelectedIndex();
  1502.                 }
  1503.             }
  1504.             if (skillToTrain == 4) {
  1505.                 switch (comboBoxAutoCastSpell.getSelectedIndex()) {
  1506.                 case 0:
  1507.                     autoCastSpellID = 98;
  1508.                     spellName = "Wind Rush";
  1509.                     break;
  1510.                 case 1:
  1511.                     autoCastSpellID = Magic.SPELL_WIND_STRIKE;
  1512.                     spellName = "Wind Strike";
  1513.                     break;
  1514.                 case 2:
  1515.                     autoCastSpellID = Magic.SPELL_WATER_STRIKE;
  1516.                     spellName = "Water Strike";
  1517.                     break;
  1518.                 case 3:
  1519.                     autoCastSpellID = Magic.SPELL_EARTH_STRIKE;
  1520.                     spellName = "Earth Strike";
  1521.                     break;
  1522.                 case 4:
  1523.                     autoCastSpellID = Magic.SPELL_FIRE_STRIKE;
  1524.                     spellName = "Fire Strike";
  1525.                     break;
  1526.                 case 5:
  1527.                     autoCastSpellID = Magic.SPELL_WIND_BOLT;
  1528.                     spellName = "Wind Bolt";
  1529.                     break;
  1530.                 case 6:
  1531.                     autoCastSpellID = Magic.SPELL_WATER_BOLT;
  1532.                     spellName = "Water Bolt";
  1533.                     break;
  1534.                 case 7:
  1535.                     autoCastSpellID = Magic.SPELL_EARTH_BOLT;
  1536.                     spellName = "Earth Bolt";
  1537.                     break;
  1538.                 case 8:
  1539.                     autoCastSpellID = Magic.SPELL_FIRE_BOLT;
  1540.                     spellName = "Fire Bolt";
  1541.                     break;
  1542.                 case 9:
  1543.                     autoCastSpellID = Magic.SPELL_WIND_BLAST;
  1544.                     spellName = "Wind Blast";
  1545.                     break;
  1546.                 case 10:
  1547.                     autoCastSpellID = Magic.SPELL_WATER_BLAST;
  1548.                     spellName = "Water Blast";
  1549.                     break;
  1550.                 case 11:
  1551.                     autoCastSpellID = Magic.SPELL_EARTH_BLAST;
  1552.                     spellName = "Earth Blast";
  1553.                     break;
  1554.                 case 12:
  1555.                     autoCastSpellID = Magic.SPELL_FIRE_BLAST;
  1556.                     spellName = "Fire Blast";
  1557.                     break;
  1558.                 }
  1559.  
  1560.             }
  1561.             if (checkBoxStopAtLevel.isSelected()) {
  1562.                 stopScript = true;
  1563.                 levelToStopAt = Integer
  1564.                         .parseInt(textFieldStopAtLevel.getText());
  1565.             }
  1566.             if (checkBoxHealAfterCombat.isSelected()) {
  1567.                 healAfterCombat = true;
  1568.             }
  1569.             if (checkBoxClickMiniMap.isSelected()) {
  1570.                 clickMiniMap = true;
  1571.             }
  1572.             // Write settings
  1573.             try {
  1574.                 final BufferedWriter out = new BufferedWriter(new FileWriter(
  1575.                         settingsFile));
  1576.                 out.write((bankBones ? "true" : "false") + ":" + healAtPercent
  1577.                         + ":" + mouseSpeed + ":" + skillToTrain + ":"
  1578.                         + levelToStopAt + ":" + rangeStyle + ":"
  1579.                         + autoCastSpellID + ":" + ammoID + ":"
  1580.                         + (showMonk ? "true" : "false") + ":"
  1581.                         + (pickAmmo ? "true" : "false") + ":"
  1582.                         + (stopScript ? "true" : "false") + ":"
  1583.                         + (healAfterCombat ? "true" : "false") + ":"
  1584.                         + (clickMiniMap ? "true" : "false") + ":"
  1585.                         + (buryBones ? "true" : "false") + ":"
  1586.                         + (showPaint ? "true" : "false") + ":"
  1587.                         + (showProfit ? "true" : "false") + ":"
  1588.                         + (takeRandomBones ? "true" : "false") + ":"
  1589.                         + (showMouse ? "true" : "false") + ":"
  1590.                         + (antiBan ? "true" : "false") + ":"
  1591.                         + (waitForDrop ? "true" : "false") + ":"
  1592.                         + comboBoxMonkColor.getSelectedIndex() + ":"
  1593.                         + comboBoxMouseColor.getSelectedIndex() + ":"
  1594.                         + comboBoxPaintColor.getSelectedIndex() + ":"
  1595.                         + comboBoxPaintTextColor.getSelectedIndex() + ":"
  1596.                         + comboBoxRangedStyle.getSelectedIndex() + ":");
  1597.                 out.close();
  1598.             } catch (final Exception e1) {
  1599.                 e1.printStackTrace();
  1600.             }
  1601.             guiExit = false;
  1602.             setVisible(false);
  1603.         }
  1604.  
  1605.         private void buttonExitActionPerformed(ActionEvent e) {
  1606.             setVisible(false);
  1607.         }
  1608.  
  1609.         private void comboBoxSkillToTrainActionPerformed(ActionEvent e) {
  1610.             if (comboBoxSkillToTrain.getSelectedIndex() == 3) {
  1611.                 checkBoxPickAmmo.setEnabled(true);
  1612.                 comboBoxRangedStyle.setEnabled(true);
  1613.                 comboBoxAutoCastSpell.setEnabled(false);
  1614.             } else if (comboBoxSkillToTrain.getSelectedIndex() == 4) {
  1615.                 comboBoxAutoCastSpell.setEnabled(true);
  1616.                 checkBoxPickAmmo.setEnabled(false);
  1617.                 comboBoxAmmoType.setEnabled(false);
  1618.                 comboBoxRangedStyle.setEnabled(false);
  1619.             } else {
  1620.                 checkBoxPickAmmo.setEnabled(false);
  1621.                 comboBoxAmmoType.setEnabled(false);
  1622.                 comboBoxRangedStyle.setEnabled(false);
  1623.                 comboBoxAutoCastSpell.setEnabled(false);
  1624.             }
  1625.         }
  1626.  
  1627.         private void checkBoxPickAmmoActionPerformed(ActionEvent e) {
  1628.             if (checkBoxPickAmmo.isSelected()) {
  1629.                 comboBoxAmmoType.setEnabled(true);
  1630.             } else {
  1631.                 comboBoxAmmoType.setEnabled(false);
  1632.             }
  1633.         }
  1634.  
  1635.         private void checkBoxBuryBonesActionPerformed(ActionEvent e) {
  1636.             if (checkBoxBuryBones.isSelected()) {
  1637.                 checkBoxBankBones.setSelected(false);
  1638.                 checkBoxShowProfit.setEnabled(false);
  1639.                 checkBoxWaitForDrop.setEnabled(true);
  1640.             } else {
  1641.                 checkBoxWaitForDrop.setEnabled(false);
  1642.             }
  1643.         }
  1644.  
  1645.         private void checkBoxBankBonesActionPerformed(ActionEvent e) {
  1646.             if (checkBoxBankBones.isSelected()) {
  1647.                 checkBoxBuryBones.setSelected(false);
  1648.                 if (checkBoxShowPaint.isSelected()) {
  1649.                     checkBoxShowProfit.setEnabled(true);
  1650.                 }
  1651.                 checkBoxWaitForDrop.setEnabled(true);
  1652.             } else {
  1653.                 checkBoxShowProfit.setEnabled(false);
  1654.                 checkBoxWaitForDrop.setEnabled(false);
  1655.             }
  1656.         }
  1657.  
  1658.         public void checkBoxStopAtLevelActionPerformed(ActionEvent e) {
  1659.             if (checkBoxStopAtLevel.isSelected()) {
  1660.                 textFieldStopAtLevel.setEnabled(true);
  1661.             } else {
  1662.                 textFieldStopAtLevel.setEnabled(false);
  1663.             }
  1664.         }
  1665.  
  1666.         private void checkBoxShowMouseActionPerformed(ActionEvent e) {
  1667.             if (checkBoxShowMouse.isSelected()) {
  1668.                 comboBoxMouseColor.setEnabled(true);
  1669.             } else {
  1670.                 comboBoxMouseColor.setEnabled(false);
  1671.             }
  1672.         }
  1673.  
  1674.         private void checkBoxShowPaintActionPerformed(ActionEvent e) {
  1675.             if (checkBoxShowPaint.isSelected()) {
  1676.                 if (checkBoxBankBones.isSelected()) {
  1677.                     checkBoxShowProfit.setEnabled(true);
  1678.                 }
  1679.                 comboBoxPaintColor.setEnabled(true);
  1680.                 comboBoxPaintTextColor.setEnabled(true);
  1681.             } else {
  1682.                 checkBoxShowProfit.setEnabled(false);
  1683.                 comboBoxPaintColor.setEnabled(false);
  1684.                 comboBoxPaintTextColor.setEnabled(false);
  1685.             }
  1686.         }
  1687.  
  1688.         private void checkBoxShowMonkActionPerformed(ActionEvent e) {
  1689.             if (checkBoxShowMonk.isSelected()) {
  1690.                 comboBoxMonkColor.setEnabled(true);
  1691.             } else {
  1692.                 comboBoxMonkColor.setEnabled(false);
  1693.             }
  1694.         }
  1695.  
  1696.         private void initComponents() {
  1697.             // GEN-BEGIN:initComponents
  1698.             panelMain = new JPanel();
  1699.             panel_Main = new JPanel();
  1700.             textFieldStopAtLevel = new JTextField();
  1701.             checkBoxStopAtLevel = new JCheckBox();
  1702.             comboBoxSkillToTrain = new JComboBox();
  1703.             label2 = new JLabel();
  1704.             checkBoxHealAfterCombat = new JCheckBox();
  1705.             checkBoxClickMiniMap = new JCheckBox();
  1706.             label1 = new JLabel();
  1707.             textFieldHealAtPercent = new JTextField();
  1708.             checkBoxBuryBones = new JCheckBox();
  1709.             label7 = new JLabel();
  1710.             checkBoxWaitForDrop = new JCheckBox();
  1711.             checkBoxAntiBan = new JCheckBox();
  1712.             buttonStart = new JButton();
  1713.             buttonExit = new JButton();
  1714.             panelRanged = new JPanel();
  1715.             checkBoxPickAmmo = new JCheckBox();
  1716.             comboBoxAmmoType = new JComboBox();
  1717.             label5 = new JLabel();
  1718.             label3 = new JLabel();
  1719.             comboBoxRangedStyle = new JComboBox();
  1720.             panelMagic = new JPanel();
  1721.             label6 = new JLabel();
  1722.             comboBoxAutoCastSpell = new JComboBox();
  1723.             panelBank = new JPanel();
  1724.             checkBoxBankBones = new JCheckBox();
  1725.             checkBoxShowProfit = new JCheckBox();
  1726.             panelMouse = new JPanel();
  1727.             label4 = new JLabel();
  1728.             sliderMouseSpeed = new JSlider();
  1729.             checkBoxShowMouse = new JCheckBox();
  1730.             comboBoxMouseColor = new JComboBox();
  1731.             panelPaint = new JPanel();
  1732.             checkBoxShowMonk = new JCheckBox();
  1733.             checkBoxShowPaint = new JCheckBox();
  1734.             label8 = new JLabel();
  1735.             comboBoxPaintColor = new JComboBox();
  1736.             label10 = new JLabel();
  1737.             comboBoxPaintTextColor = new JComboBox();
  1738.             label9 = new JLabel();
  1739.             comboBoxMonkColor = new JComboBox();
  1740.  
  1741.             // ======== this ========
  1742.             setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  1743.             setResizable(false);
  1744.             setTitle("monkR8per v" + getVersion() + " Settings");
  1745.             setVisible(true);
  1746.             Container contentPane = getContentPane();
  1747.             contentPane.setLayout(null);
  1748.  
  1749.             // ======== panelMain ========
  1750.             {
  1751.                 panelMain.setLayout(null);
  1752.  
  1753.                 // ======== panel_Main ========
  1754.                 {
  1755.                     panel_Main.setBorder(new TitledBorder("Main Settings:"));
  1756.                     panel_Main.setLayout(null);
  1757.  
  1758.                     // ---- textFieldStopAtLevel ----
  1759.                     textFieldStopAtLevel.setText("0");
  1760.                     textFieldStopAtLevel.setToolTipText("1-99");
  1761.                     textFieldStopAtLevel.setEnabled(false);
  1762.                     panel_Main.add(textFieldStopAtLevel);
  1763.                     textFieldStopAtLevel.setBounds(100, 110, 40,
  1764.                             textFieldStopAtLevel.getPreferredSize().height);
  1765.  
  1766.                     // ---- checkBoxStopAtLevel ----
  1767.                     checkBoxStopAtLevel.setText("Stop at level?");
  1768.                     checkBoxStopAtLevel
  1769.                             .setToolTipText("Check this box if you want the script to stop at a certain level");
  1770.                     checkBoxStopAtLevel.addActionListener(new ActionListener() {
  1771.                         @Override
  1772.                         public void actionPerformed(ActionEvent e) {
  1773.                             checkBoxStopAtLevelActionPerformed(e);
  1774.                         }
  1775.                     });
  1776.                     panel_Main.add(checkBoxStopAtLevel);
  1777.                     checkBoxStopAtLevel.setBounds(new Rectangle(new Point(5,
  1778.                             110), checkBoxStopAtLevel.getPreferredSize()));
  1779.  
  1780.                     // ---- comboBoxSkillToTrain ----
  1781.                     comboBoxSkillToTrain.setModel(new DefaultComboBoxModel(
  1782.                             new String[] { "Attack", "Strength", "Defense",
  1783.                                     "Ranged", "Magic" }));
  1784.                     comboBoxSkillToTrain
  1785.                             .setToolTipText("Please choose a skill to train");
  1786.                     comboBoxSkillToTrain
  1787.                             .addActionListener(new ActionListener() {
  1788.                                 @Override
  1789.                                 public void actionPerformed(ActionEvent e) {
  1790.                                     comboBoxSkillToTrainActionPerformed(e);
  1791.                                 }
  1792.                             });
  1793.                     panel_Main.add(comboBoxSkillToTrain);
  1794.                     comboBoxSkillToTrain.setBounds(75, 80, 105, 22);
  1795.  
  1796.                     // ---- label2 ----
  1797.                     label2.setText("Skill to train:");
  1798.                     panel_Main.add(label2);
  1799.                     label2.setBounds(10, 85, 59, 14);
  1800.  
  1801.                     // ---- checkBoxHealAfterCombat ----
  1802.                     checkBoxHealAfterCombat.setText("Heal after combat?");
  1803.                     checkBoxHealAfterCombat
  1804.                             .setToolTipText("<html><head><body></head>\nChecking this box makes you wait to heal<br />\nuntil you hp is half of your heal at setting,<br />\nor until you are no longer in combat. <br /><br />\nEX: If heal at is 50% when in combat<br /> \nyou'll wait until 25% hp.<br /><br />\nNOT recomended for low hp accounts!<br />\n</body></html>");
  1805.                     panel_Main.add(checkBoxHealAfterCombat);
  1806.                     checkBoxHealAfterCombat
  1807.                             .setBounds(new Rectangle(new Point(5, 35),
  1808.                                     checkBoxHealAfterCombat.getPreferredSize()));
  1809.  
  1810.                     // ---- checkBoxClickMiniMap ----
  1811.                     checkBoxClickMiniMap.setText("Click mini-map?");
  1812.                     checkBoxClickMiniMap.setSelected(true);
  1813.                     panel_Main.add(checkBoxClickMiniMap);
  1814.                     checkBoxClickMiniMap.setBounds(new Rectangle(new Point(5,
  1815.                             55), checkBoxClickMiniMap.getPreferredSize()));
  1816.  
  1817.                     // ---- label1 ----
  1818.                     label1.setText("Percent to heal at:");
  1819.                     panel_Main.add(label1);
  1820.                     label1.setBounds(10, 20, 90, 14);
  1821.  
  1822.                     // ---- textFieldHealAtPercent ----
  1823.                     textFieldHealAtPercent.setText("50");
  1824.                     textFieldHealAtPercent.setToolTipText("10-100");
  1825.                     panel_Main.add(textFieldHealAtPercent);
  1826.                     textFieldHealAtPercent.setBounds(105, 15, 35, 20);
  1827.  
  1828.                     // ---- checkBoxBuryBones ----
  1829.                     checkBoxBuryBones.setText("Bury bones?");
  1830.                     checkBoxBuryBones
  1831.                             .setToolTipText("Check this box if you want to bury bones");
  1832.                     checkBoxBuryBones.addActionListener(new ActionListener() {
  1833.                         @Override
  1834.                         public void actionPerformed(ActionEvent e) {
  1835.                             checkBoxBuryBonesActionPerformed(e);
  1836.                         }
  1837.                     });
  1838.                     panel_Main.add(checkBoxBuryBones);
  1839.                     checkBoxBuryBones.setBounds(5, 130, 85, 23);
  1840.  
  1841.                     // ---- label7 ----
  1842.                     label7.setText("*10-100");
  1843.                     label7.setForeground(Color.red);
  1844.                     panel_Main.add(label7);
  1845.                     label7.setBounds(new Rectangle(new Point(145, 20), label7
  1846.                             .getPreferredSize()));
  1847.  
  1848.                     // ---- checkBoxWaitForDrop ----
  1849.                     checkBoxWaitForDrop.setText("Wait for drop?");
  1850.                     checkBoxWaitForDrop.setEnabled(false);
  1851.                     panel_Main.add(checkBoxWaitForDrop);
  1852.                     checkBoxWaitForDrop.setBounds(new Rectangle(new Point(105,
  1853.                             130), checkBoxWaitForDrop.getPreferredSize()));
  1854.  
  1855.                     // ---- checkBox1 ----
  1856.                     checkBoxAntiBan.setText("Anti-ban?");
  1857.                     checkBoxAntiBan.setSelected(true);
  1858.                     panel_Main.add(checkBoxAntiBan);
  1859.                     checkBoxAntiBan.setBounds(new Rectangle(new Point(105, 55),
  1860.                             checkBoxAntiBan.getPreferredSize()));
  1861.  
  1862.                     { // compute preferred size
  1863.                         Dimension preferredSize = new Dimension();
  1864.                         for (int i = 0; i < panel_Main.getComponentCount(); i++) {
  1865.                             Rectangle bounds = panel_Main.getComponent(i)
  1866.                                     .getBounds();
  1867.                             preferredSize.width = Math.max(bounds.x
  1868.                                     + bounds.width, preferredSize.width);
  1869.                             preferredSize.height = Math.max(bounds.y
  1870.                                     + bounds.height, preferredSize.height);
  1871.                         }
  1872.                         Insets insets = panel_Main.getInsets();
  1873.                         preferredSize.width += insets.right;
  1874.                         preferredSize.height += insets.bottom;
  1875.                         panel_Main.setMinimumSize(preferredSize);
  1876.                         panel_Main.setPreferredSize(preferredSize);
  1877.                     }
  1878.                 }
  1879.                 panelMain.add(panel_Main);
  1880.                 panel_Main.setBounds(10, 5, 205, 160);
  1881.  
  1882.                 // ---- buttonStart ----
  1883.                 buttonStart.setText("Start");
  1884.                 buttonStart.setFont(new Font("Tahoma", Font.BOLD, 14));
  1885.                 buttonStart.setToolTipText("Press here to start the script");
  1886.                 buttonStart.addActionListener(new ActionListener() {
  1887.                     @Override
  1888.                     public void actionPerformed(ActionEvent e) {
  1889.                         buttonStartActionPerformed(e);
  1890.                     }
  1891.                 });
  1892.                 panelMain.add(buttonStart);
  1893.                 buttonStart.setBounds(15, 325, 195, 35);
  1894.  
  1895.                 // ---- buttonExit ----
  1896.                 buttonExit.setText("Exit");
  1897.                 buttonExit.setFont(new Font("Tahoma", Font.BOLD, 14));
  1898.                 buttonExit.setToolTipText("Press here to exit the script");
  1899.                 buttonExit.addActionListener(new ActionListener() {
  1900.                     @Override
  1901.                     public void actionPerformed(ActionEvent e) {
  1902.                         buttonExitActionPerformed(e);
  1903.                     }
  1904.                 });
  1905.                 panelMain.add(buttonExit);
  1906.                 buttonExit.setBounds(225, 325, 195, 35);
  1907.  
  1908.                 // ======== panelRanged ========
  1909.                 {
  1910.                     panelRanged.setBorder(new TitledBorder("Ranged Settings:"));
  1911.                     panelRanged.setLayout(null);
  1912.  
  1913.                     // ---- checkBoxPickAmmo ----
  1914.                     checkBoxPickAmmo.setText("Pick up ammo?");
  1915.                     checkBoxPickAmmo.setEnabled(false);
  1916.                     checkBoxPickAmmo
  1917.                             .setToolTipText("Check this box if you wish to pick up your ammo");
  1918.                     checkBoxPickAmmo.addActionListener(new ActionListener() {
  1919.                         @Override
  1920.                         public void actionPerformed(ActionEvent e) {
  1921.                             checkBoxPickAmmoActionPerformed(e);
  1922.                         }
  1923.                     });
  1924.                     panelRanged.add(checkBoxPickAmmo);
  1925.                     checkBoxPickAmmo.setBounds(new Rectangle(new Point(10, 45),
  1926.                             checkBoxPickAmmo.getPreferredSize()));
  1927.  
  1928.                     // ---- comboBoxAmmoType ----
  1929.                     comboBoxAmmoType.setModel(new DefaultComboBoxModel(
  1930.                             new String[] { "Bronze arrows", "Iron arrows",
  1931.                                     "Steel arrows", "Mithril arrows",
  1932.                                     "Adamite arrows", "Rune arrows" }));
  1933.                     comboBoxAmmoType.setEnabled(false);
  1934.                     comboBoxAmmoType
  1935.                             .setToolTipText("Choose what ammo you wish to pick up and re-equip");
  1936.                     panelRanged.add(comboBoxAmmoType);
  1937.                     comboBoxAmmoType.setBounds(80, 70, 115, comboBoxAmmoType
  1938.                             .getPreferredSize().height);
  1939.  
  1940.                     // ---- label5 ----
  1941.                     label5.setText("Ammo type:");
  1942.                     panelRanged.add(label5);
  1943.                     label5.setBounds(new Rectangle(new Point(15, 70), label5
  1944.                             .getPreferredSize()));
  1945.  
  1946.                     // ---- label3 ----
  1947.                     label3.setText("Style:");
  1948.                     panelRanged.add(label3);
  1949.                     label3.setBounds(new Rectangle(new Point(15, 20), label3
  1950.                             .getPreferredSize()));
  1951.  
  1952.                     // ---- comboBoxRangedStyle ----
  1953.                     comboBoxRangedStyle
  1954.                             .setModel(new DefaultComboBoxModel(new String[] {
  1955.                                     "Accurate", "Rapid", "Long range" }));
  1956.                     comboBoxRangedStyle.setEnabled(false);
  1957.                     comboBoxRangedStyle
  1958.                             .setToolTipText("Choose your ranged style");
  1959.                     panelRanged.add(comboBoxRangedStyle);
  1960.                     comboBoxRangedStyle.setBounds(50, 20, 100,
  1961.                             comboBoxRangedStyle.getPreferredSize().height);
  1962.  
  1963.                     { // compute preferred size
  1964.                         Dimension preferredSize = new Dimension();
  1965.                         for (int i = 0; i < panelRanged.getComponentCount(); i++) {
  1966.                             Rectangle bounds = panelRanged.getComponent(i)
  1967.                                     .getBounds();
  1968.                             preferredSize.width = Math.max(bounds.x
  1969.                                     + bounds.width, preferredSize.width);
  1970.                             preferredSize.height = Math.max(bounds.y
  1971.                                     + bounds.height, preferredSize.height);
  1972.                         }
  1973.                         Insets insets = panelRanged.getInsets();
  1974.                         preferredSize.width += insets.right;
  1975.                         preferredSize.height += insets.bottom;
  1976.                         panelRanged.setMinimumSize(preferredSize);
  1977.                         panelRanged.setPreferredSize(preferredSize);
  1978.                     }
  1979.                 }
  1980.                 panelMain.add(panelRanged);
  1981.                 panelRanged.setBounds(220, 5, 205, 105);
  1982.  
  1983.                 // ======== panelMagic ========
  1984.                 {
  1985.                     panelMagic.setBorder(new TitledBorder("Magic Settings:"));
  1986.                     panelMagic.setLayout(null);
  1987.  
  1988.                     // ---- label6 ----
  1989.                     label6.setText("Spell:");
  1990.                     panelMagic.add(label6);
  1991.                     label6.setBounds(new Rectangle(new Point(15, 20), label6
  1992.                             .getPreferredSize()));
  1993.  
  1994.                     // ---- comboBoxAutoCastSpell ----
  1995.                     comboBoxAutoCastSpell.setEnabled(false);
  1996.                     comboBoxAutoCastSpell.setModel(new DefaultComboBoxModel(
  1997.                             new String[] { "Wind Rush", "Wind Strike",
  1998.                                     "Water Strike", "Earth Strike",
  1999.                                     "Fire Strike", "Wind Bolt", "Water Bolt",
  2000.                                     "Earth Bolt", "Fire Bolt" }));
  2001.                     comboBoxAutoCastSpell
  2002.                             .setToolTipText("Choose what magic spell you wish to cast");
  2003.                     panelMagic.add(comboBoxAutoCastSpell);
  2004.                     comboBoxAutoCastSpell.setBounds(50, 20, 135,
  2005.                             comboBoxAutoCastSpell.getPreferredSize().height);
  2006.  
  2007.                     { // compute preferred size
  2008.                         Dimension preferredSize = new Dimension();
  2009.                         for (int i = 0; i < panelMagic.getComponentCount(); i++) {
  2010.                             Rectangle bounds = panelMagic.getComponent(i)
  2011.                                     .getBounds();
  2012.                             preferredSize.width = Math.max(bounds.x
  2013.                                     + bounds.width, preferredSize.width);
  2014.                             preferredSize.height = Math.max(bounds.y
  2015.                                     + bounds.height, preferredSize.height);
  2016.                         }
  2017.                         Insets insets = panelMagic.getInsets();
  2018.                         preferredSize.width += insets.right;
  2019.                         preferredSize.height += insets.bottom;
  2020.                         panelMagic.setMinimumSize(preferredSize);
  2021.                         panelMagic.setPreferredSize(preferredSize);
  2022.                     }
  2023.                 }
  2024.                 panelMain.add(panelMagic);
  2025.                 panelMagic.setBounds(220, 110, 205, 55);
  2026.  
  2027.                 // ======== panelBank ========
  2028.                 {
  2029.                     panelBank.setBorder(new TitledBorder("Bank Settings:"));
  2030.                     panelBank.setLayout(null);
  2031.  
  2032.                     // ---- checkBoxBankBones ----
  2033.                     checkBoxBankBones.setText("Bank Bones?");
  2034.                     checkBoxBankBones
  2035.                             .setToolTipText("Check this box if you wish to pick up and bank bones");
  2036.                     checkBoxBankBones.addActionListener(new ActionListener() {
  2037.                         @Override
  2038.                         public void actionPerformed(ActionEvent e) {
  2039.                             checkBoxBankBonesActionPerformed(e);
  2040.                         }
  2041.                     });
  2042.                     panelBank.add(checkBoxBankBones);
  2043.                     checkBoxBankBones.setBounds(new Rectangle(
  2044.                             new Point(10, 15), checkBoxBankBones
  2045.                                     .getPreferredSize()));
  2046.  
  2047.                     // ---- checkBoxShowProfit ----
  2048.                     checkBoxShowProfit.setText("Show Profit?");
  2049.                     checkBoxShowProfit.setEnabled(false);
  2050.                     checkBoxShowProfit
  2051.                             .setToolTipText("Check this box if you would like to show how much profit the script has made");
  2052.                     panelBank.add(checkBoxShowProfit);
  2053.                     checkBoxShowProfit.setBounds(new Rectangle(
  2054.                             new Point(95, 15), checkBoxShowProfit
  2055.                                     .getPreferredSize()));
  2056.  
  2057.                     { // compute preferred size
  2058.                         Dimension preferredSize = new Dimension();
  2059.                         for (int i = 0; i < panelBank.getComponentCount(); i++) {
  2060.                             Rectangle bounds = panelBank.getComponent(i)
  2061.                                     .getBounds();
  2062.                             preferredSize.width = Math.max(bounds.x
  2063.                                     + bounds.width, preferredSize.width);
  2064.                             preferredSize.height = Math.max(bounds.y
  2065.                                     + bounds.height, preferredSize.height);
  2066.                         }
  2067.                         Insets insets = panelBank.getInsets();
  2068.                         preferredSize.width += insets.right;
  2069.                         preferredSize.height += insets.bottom;
  2070.                         panelBank.setMinimumSize(preferredSize);
  2071.                         panelBank.setPreferredSize(preferredSize);
  2072.                     }
  2073.                 }
  2074.                 panelMain.add(panelBank);
  2075.                 panelBank.setBounds(10, 165, 205, 45);
  2076.  
  2077.                 // ======== panelMouse ========
  2078.                 {
  2079.                     panelMouse.setBorder(new TitledBorder("Mouse Settings:"));
  2080.                     panelMouse.setLayout(null);
  2081.  
  2082.                     // ---- label4 ----
  2083.                     label4.setText("Mouse speed:");
  2084.                     panelMouse.add(label4);
  2085.                     label4.setBounds(10, 40, 67, 14);
  2086.  
  2087.                     // ---- sliderMouseSpeed ----
  2088.                     sliderMouseSpeed.setMaximum(10);
  2089.                     sliderMouseSpeed.setPaintLabels(true);
  2090.                     sliderMouseSpeed.setPaintTicks(true);
  2091.                     sliderMouseSpeed.setSnapToTicks(true);
  2092.                     sliderMouseSpeed.setValue(7);
  2093.                     sliderMouseSpeed.setMajorTickSpacing(1);
  2094.                     sliderMouseSpeed.setToolTipText("0 = fastest 5 = human 10 = slowest");
  2095.                     panelMouse.add(sliderMouseSpeed);
  2096.                     sliderMouseSpeed.setBounds(5, 55, 195, 51);
  2097.  
  2098.                     // ---- checkBoxShowMouse ----
  2099.                     checkBoxShowMouse.setText("Show mouse?");
  2100.                     checkBoxShowMouse.setSelected(true);
  2101.                     checkBoxShowMouse
  2102.                             .setToolTipText("Check this box if you wish to show the mouse");
  2103.                     checkBoxShowMouse.addActionListener(new ActionListener() {
  2104.                         @Override
  2105.                         public void actionPerformed(ActionEvent e) {
  2106.                             checkBoxShowMouseActionPerformed(e);
  2107.                         }
  2108.                     });
  2109.                     panelMouse.add(checkBoxShowMouse);
  2110.                     checkBoxShowMouse.setBounds(new Rectangle(new Point(5, 15),
  2111.                             checkBoxShowMouse.getPreferredSize()));
  2112.  
  2113.                     // ---- comboBoxMouseColor ----
  2114.                     comboBoxMouseColor.setModel(new DefaultComboBoxModel(
  2115.                             new String[] { "Red", "Blue", "Green", "Purple",
  2116.                                     "Orange", "Yellow", "White", "Black" }));
  2117.                     comboBoxMouseColor.setSelectedIndex(0);
  2118.                     comboBoxMouseColor
  2119.                             .setToolTipText("Choose a color for the mouse");
  2120.                     panelMouse.add(comboBoxMouseColor);
  2121.                     comboBoxMouseColor.setBounds(100, 15, 95,
  2122.                             comboBoxMouseColor.getPreferredSize().height);
  2123.  
  2124.                     { // compute preferred size
  2125.                         Dimension preferredSize = new Dimension();
  2126.                         for (int i = 0; i < panelMouse.getComponentCount(); i++) {
  2127.                             Rectangle bounds = panelMouse.getComponent(i)
  2128.                                     .getBounds();
  2129.                             preferredSize.width = Math.max(bounds.x
  2130.                                     + bounds.width, preferredSize.width);
  2131.                             preferredSize.height = Math.max(bounds.y
  2132.                                     + bounds.height, preferredSize.height);
  2133.                         }
  2134.                         Insets insets = panelMouse.getInsets();
  2135.                         preferredSize.width += insets.right;
  2136.                         preferredSize.height += insets.bottom;
  2137.                         panelMouse.setMinimumSize(preferredSize);
  2138.                         panelMouse.setPreferredSize(preferredSize);
  2139.                     }
  2140.                 }
  2141.                 panelMain.add(panelMouse);
  2142.                 panelMouse.setBounds(10, 210, 205, 110);
  2143.  
  2144.                 // ======== panelPaint ========
  2145.                 {
  2146.                     panelPaint.setBorder(new TitledBorder("Paint Settings:"));
  2147.                     panelPaint.setLayout(null);
  2148.  
  2149.                     // ---- checkBoxShowMonk ----
  2150.                     checkBoxShowMonk.setText("Paint monk?");
  2151.                     checkBoxShowMonk.addActionListener(new ActionListener() {
  2152.                         @Override
  2153.                         public void actionPerformed(ActionEvent e) {
  2154.                             checkBoxShowMonkActionPerformed(e);
  2155.                         }
  2156.                     });
  2157.                     panelPaint.add(checkBoxShowMonk);
  2158.                     checkBoxShowMonk.setBounds(new Rectangle(new Point(10, 35),
  2159.                             checkBoxShowMonk.getPreferredSize()));
  2160.  
  2161.                     // ---- checkBoxShowPaint ----
  2162.                     checkBoxShowPaint.setText("Show paint?");
  2163.                     checkBoxShowPaint
  2164.                             .setToolTipText("Check this box if you want to show the paint");
  2165.                     checkBoxShowPaint.setSelected(true);
  2166.                     checkBoxShowPaint.addActionListener(new ActionListener() {
  2167.                         @Override
  2168.                         public void actionPerformed(ActionEvent e) {
  2169.                             checkBoxShowPaintActionPerformed(e);
  2170.                         }
  2171.                     });
  2172.                     panelPaint.add(checkBoxShowPaint);
  2173.                     checkBoxShowPaint.setBounds(new Rectangle(
  2174.                             new Point(10, 15), checkBoxShowPaint
  2175.                                     .getPreferredSize()));
  2176.  
  2177.                     // ---- label8 ----
  2178.                     label8.setText("Back Color:");
  2179.                     panelPaint.add(label8);
  2180.                     label8.setBounds(15, 65, 55, 14);
  2181.  
  2182.                     // ---- comboBoxPaintColor ----
  2183.                     comboBoxPaintColor.setModel(new DefaultComboBoxModel(
  2184.                             new String[] { "Red", "Blue", "Green", "Purple",
  2185.                                     "Orange", "Yellow", "White", "Black" }));
  2186.                     comboBoxPaintColor.setSelectedIndex(7);
  2187.                     panelPaint.add(comboBoxPaintColor);
  2188.                     comboBoxPaintColor.setBounds(75, 60, 85, 22);
  2189.  
  2190.                     // ---- label10 ----
  2191.                     label10.setText("Text color:");
  2192.                     panelPaint.add(label10);
  2193.                     label10.setBounds(15, 95, 52, 14);
  2194.  
  2195.                     // ---- comboBoxPaintTextColor ----
  2196.                     comboBoxPaintTextColor.setModel(new DefaultComboBoxModel(
  2197.                             new String[] { "Red", "Blue", "Green", "Purple",
  2198.                                     "Orange", "Yellow", "White", "Black" }));
  2199.                     comboBoxPaintTextColor.setSelectedIndex(2);
  2200.                     panelPaint.add(comboBoxPaintTextColor);
  2201.                     comboBoxPaintTextColor.setBounds(75, 90, 85, 22);
  2202.  
  2203.                     // ---- label9 ----
  2204.                     label9.setText("Monk color:");
  2205.                     panelPaint.add(label9);
  2206.                     label9.setBounds(new Rectangle(new Point(15, 125), label9
  2207.                             .getPreferredSize()));
  2208.  
  2209.                     // ---- comboBoxMonkColor ----
  2210.                     comboBoxMonkColor.setModel(new DefaultComboBoxModel(
  2211.                             new String[] { "Red", "Blue", "Green", "Purple",
  2212.                                     "Orange", "Yellow", "White", "Black" }));
  2213.                     comboBoxMonkColor.setSelectedIndex(2);
  2214.                     comboBoxMonkColor.setEnabled(false);
  2215.                     panelPaint.add(comboBoxMonkColor);
  2216.                     comboBoxMonkColor.setBounds(75, 120, 85, 22);
  2217.  
  2218.                     { // compute preferred size
  2219.                         Dimension preferredSize = new Dimension();
  2220.                         for (int i = 0; i < panelPaint.getComponentCount(); i++) {
  2221.                             Rectangle bounds = panelPaint.getComponent(i)
  2222.                                     .getBounds();
  2223.                             preferredSize.width = Math.max(bounds.x
  2224.                                     + bounds.width, preferredSize.width);
  2225.                             preferredSize.height = Math.max(bounds.y
  2226.                                     + bounds.height, preferredSize.height);
  2227.                         }
  2228.                         Insets insets = panelPaint.getInsets();
  2229.                         preferredSize.width += insets.right;
  2230.                         preferredSize.height += insets.bottom;
  2231.                         panelPaint.setMinimumSize(preferredSize);
  2232.                         panelPaint.setPreferredSize(preferredSize);
  2233.                     }
  2234.                 }
  2235.                 panelMain.add(panelPaint);
  2236.                 panelPaint.setBounds(220, 165, 205, 155);
  2237.  
  2238.                 { // compute preferred size
  2239.                     Dimension preferredSize = new Dimension();
  2240.                     for (int i = 0; i < panelMain.getComponentCount(); i++) {
  2241.                         Rectangle bounds = panelMain.getComponent(i)
  2242.                                 .getBounds();
  2243.                         preferredSize.width = Math.max(bounds.x + bounds.width,
  2244.                                 preferredSize.width);
  2245.                         preferredSize.height = Math.max(bounds.y
  2246.                                 + bounds.height, preferredSize.height);
  2247.                     }
  2248.                     Insets insets = panelMain.getInsets();
  2249.                     preferredSize.width += insets.right;
  2250.                     preferredSize.height += insets.bottom;
  2251.                     panelMain.setMinimumSize(preferredSize);
  2252.                     panelMain.setPreferredSize(preferredSize);
  2253.                 }
  2254.             }
  2255.             contentPane.add(panelMain);
  2256.             panelMain.setBounds(0, 0, 435, 370);
  2257.  
  2258.             { // compute preferred size
  2259.                 Dimension preferredSize = new Dimension();
  2260.                 for (int i = 0; i < contentPane.getComponentCount(); i++) {
  2261.                     Rectangle bounds = contentPane.getComponent(i).getBounds();
  2262.                     preferredSize.width = Math.max(bounds.x + bounds.width,
  2263.                             preferredSize.width);
  2264.                     preferredSize.height = Math.max(bounds.y + bounds.height,
  2265.                             preferredSize.height);
  2266.                 }
  2267.                 Insets insets = contentPane.getInsets();
  2268.                 preferredSize.width += insets.right;
  2269.                 preferredSize.height += insets.bottom;
  2270.                 contentPane.setMinimumSize(preferredSize);
  2271.                 contentPane.setPreferredSize(preferredSize);
  2272.             }
  2273.             setSize(440, 395);
  2274.             setLocationRelativeTo(getOwner());
  2275.             // GEN-END:initComponents
  2276.  
  2277.             // LOAD SAVED SELECTION INFO
  2278.             try {
  2279.                 final BufferedReader in = new BufferedReader(new FileReader(
  2280.                         settingsFile));
  2281.                 String line;
  2282.                 String[] opts = {};
  2283.                 while ((line = in.readLine()) != null) {
  2284.                     if (line.contains(":")) {
  2285.                         opts = line.split(":");
  2286.                     }
  2287.                 }
  2288.                 in.close();
  2289.                 if (opts.length > 5) {
  2290.  
  2291.                     // bankBones
  2292.                     if (opts[0].equals("true")) {
  2293.                         checkBoxBankBones.setSelected(true);
  2294.                         checkBoxShowProfit.setEnabled(true);
  2295.                         checkBoxWaitForDrop.setEnabled(true);
  2296.                     }
  2297.  
  2298.                     // healAtPercent
  2299.                     textFieldHealAtPercent.setText(opts[1]);
  2300.  
  2301.                     // mouseSpeed
  2302.                     sliderMouseSpeed.setValue(Integer.parseInt(opts[2]));
  2303.  
  2304.                     // skillToTrain
  2305.                     comboBoxSkillToTrain.setSelectedIndex(Integer
  2306.                             .parseInt(opts[3]));
  2307.  
  2308.                     // levelToStopAt
  2309.                     textFieldStopAtLevel.setText(opts[4]);
  2310.  
  2311.                     // rangeStyle
  2312.                     comboBoxRangedStyle.setSelectedIndex(Integer
  2313.                             .parseInt(opts[5]));
  2314.  
  2315.                     // autoCastSpellID
  2316.                     comboBoxAutoCastSpell.setSelectedIndex(Integer
  2317.                             .parseInt(opts[6]));
  2318.  
  2319.                     // ammoID
  2320.                     switch (Integer.parseInt(opts[7])) {
  2321.                     case bronzeArrowID:
  2322.                         comboBoxAmmoType.setSelectedIndex(0);
  2323.                         break;
  2324.                     case ironArrowID:
  2325.                         comboBoxAmmoType.setSelectedIndex(1);
  2326.                         break;
  2327.                     case steelArrowID:
  2328.                         comboBoxAmmoType.setSelectedIndex(2);
  2329.                         break;
  2330.                     case mithrilArrowID:
  2331.                         comboBoxAmmoType.setSelectedIndex(3);
  2332.                         break;
  2333.                     case adamiteArrowID:
  2334.                         comboBoxAmmoType.setSelectedIndex(4);
  2335.                         break;
  2336.                     case runeArrowID:
  2337.                         comboBoxAmmoType.setSelectedIndex(5);
  2338.                         break;
  2339.                     }
  2340.  
  2341.                     // showMonk
  2342.                     if (opts[8].equals("true")) {
  2343.                         checkBoxShowMonk.setSelected(true);
  2344.                         comboBoxMonkColor.setEnabled(true);
  2345.                         comboBoxMonkColor.setSelectedIndex(Integer
  2346.                                 .parseInt(opts[20]));
  2347.                     }
  2348.  
  2349.                     // pickAmmo
  2350.                     if (opts[9].equals("true")) {
  2351.                         checkBoxPickAmmo.setSelected(true);
  2352.                         checkBoxPickAmmo.setEnabled(true);
  2353.                         comboBoxAmmoType.setEnabled(true);
  2354.                     }
  2355.  
  2356.                     // stopScript
  2357.                     if (opts[10].equals("true")) {
  2358.                         checkBoxStopAtLevel.setSelected(true);
  2359.                         textFieldStopAtLevel.setEnabled(true);
  2360.                     }
  2361.  
  2362.                     // healAfterCombat
  2363.                     if (opts[11].equals("true")) {
  2364.                         checkBoxHealAfterCombat.setSelected(true);
  2365.                     }
  2366.  
  2367.                     // clickMiniMap
  2368.                     if (opts[12].equals("true")) {
  2369.                         checkBoxClickMiniMap.setSelected(true);
  2370.                     }
  2371.  
  2372.                     // buryBones
  2373.                     if (opts[13].equals("true")) {
  2374.                         checkBoxBuryBones.setSelected(true);
  2375.                         checkBoxShowProfit.setEnabled(true);
  2376.                         checkBoxWaitForDrop.setEnabled(true);
  2377.                     }
  2378.  
  2379.                     // showPaint
  2380.                     if (opts[14].equals("true")) {
  2381.                         checkBoxShowPaint.setSelected(true);
  2382.                         comboBoxPaintColor.setEnabled(true);
  2383.                         comboBoxPaintColor.setSelectedIndex(Integer
  2384.                                 .parseInt(opts[22]));
  2385.                         comboBoxPaintTextColor.setEnabled(true);
  2386.                         comboBoxPaintTextColor.setSelectedIndex(Integer
  2387.                                 .parseInt(opts[23]));
  2388.                     }
  2389.  
  2390.                     // showProfit
  2391.                     if (opts[15].equals("true")) {
  2392.                         checkBoxShowProfit.setSelected(true);
  2393.                     }
  2394.  
  2395.                     // takeRandomBones
  2396.                     if (opts[16].equals("true")) {
  2397.                         // TODO add this checkBox to the GUI
  2398.                         // checkBoxTakeRandomBones.setSelected(true);
  2399.                     }
  2400.  
  2401.                     // showMouse
  2402.                     if (opts[17].equals("true")) {
  2403.                         checkBoxShowMouse.setSelected(true);
  2404.                         comboBoxMouseColor.setEnabled(true);
  2405.                         comboBoxMouseColor.setSelectedIndex(Integer
  2406.                                 .parseInt(opts[21]));
  2407.                     }
  2408.  
  2409.                     // antiBan
  2410.                     if (opts[18].equals("true")) {
  2411.                         checkBoxAntiBan.setSelected(true);
  2412.                     }
  2413.  
  2414.                     // waitForDrop
  2415.                     if (opts[19].equals("true")) {
  2416.                         checkBoxWaitForDrop.setSelected(true);
  2417.                     }
  2418.                    
  2419.                     // rangeStyle
  2420.                     comboBoxRangedStyle.setSelectedIndex(Integer.parseInt(opts[24]));
  2421.                 }
  2422.             } catch (final Exception e2) {
  2423.                 e2.printStackTrace();
  2424.             }
  2425.         }
  2426.  
  2427.         // GEN-BEGIN:variables
  2428.         private JPanel panelMain;
  2429.         private JPanel panel_Main;
  2430.         private JTextField textFieldStopAtLevel;
  2431.         private JCheckBox checkBoxStopAtLevel;
  2432.         private JComboBox comboBoxSkillToTrain;
  2433.         private JLabel label2;
  2434.         private JCheckBox checkBoxHealAfterCombat;
  2435.         private JCheckBox checkBoxClickMiniMap;
  2436.         private JLabel label1;
  2437.         private JTextField textFieldHealAtPercent;
  2438.         private JCheckBox checkBoxBuryBones;
  2439.         private JLabel label7;
  2440.         private JCheckBox checkBoxWaitForDrop;
  2441.         private JCheckBox checkBoxAntiBan;
  2442.         private JButton buttonStart;
  2443.         private JButton buttonExit;
  2444.         private JPanel panelRanged;
  2445.         private JCheckBox checkBoxPickAmmo;
  2446.         private JComboBox comboBoxAmmoType;
  2447.         private JLabel label5;
  2448.         private JLabel label3;
  2449.         private JComboBox comboBoxRangedStyle;
  2450.         private JPanel panelMagic;
  2451.         private JLabel label6;
  2452.         private JComboBox comboBoxAutoCastSpell;
  2453.         private JPanel panelBank;
  2454.         private JCheckBox checkBoxBankBones;
  2455.         private JCheckBox checkBoxShowProfit;
  2456.         private JPanel panelMouse;
  2457.         private JLabel label4;
  2458.         private JSlider sliderMouseSpeed;
  2459.         private JCheckBox checkBoxShowMouse;
  2460.         private JComboBox comboBoxMouseColor;
  2461.         private JPanel panelPaint;
  2462.         private JCheckBox checkBoxShowMonk;
  2463.         private JCheckBox checkBoxShowPaint;
  2464.         private JLabel label8;
  2465.         private JComboBox comboBoxPaintColor;
  2466.         private JLabel label10;
  2467.         private JComboBox comboBoxPaintTextColor;
  2468.         private JLabel label9;
  2469.         private JComboBox comboBoxMonkColor;
  2470.         // GEN-END:variables
  2471.     }
  2472.  
  2473.     @Override
  2474.     public void mouseDragged(MouseEvent e) {
  2475.     }
  2476.  
  2477.     @Override
  2478.     public void mouseMoved(MouseEvent e) {
  2479.         mousePoint = e.getPoint();
  2480.     }
  2481.  
  2482.     public boolean isHover(int x1, int y1, int x2, int y2) { // credits to
  2483.         // Ahmedbasil1
  2484.         if (mousePoint != null) {
  2485.             if (mousePoint.getX() >= x1 && mousePoint.getY() >= y1
  2486.                     && mousePoint.getX() <= x2 && mousePoint.getY() <= y2) {
  2487.                 return true;
  2488.             } else {
  2489.                 return false;
  2490.             }
  2491.         } else {
  2492.             return false;
  2493.         }
  2494.     }
  2495.  
  2496. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement