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

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 60.45 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.awt.Color;
  2. import java.awt.Container;
  3. import java.awt.Dimension;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Insets;
  7. import java.awt.Point;
  8. import java.awt.Rectangle;
  9. import java.awt.event.ActionEvent;
  10. import java.awt.event.ActionListener;
  11. import java.io.BufferedReader;
  12. import java.io.FileInputStream;
  13. import java.io.FileNotFoundException;
  14. import java.io.FileOutputStream;
  15. import java.io.IOException;
  16. import java.io.InputStreamReader;
  17. import java.io.PrintStream;
  18. import java.util.Map;
  19.  
  20. import javax.swing.DefaultComboBoxModel;
  21. import javax.swing.JButton;
  22. import javax.swing.JCheckBox;
  23. import javax.swing.JComboBox;
  24. import javax.swing.JFrame;
  25. import javax.swing.JLabel;
  26. import javax.swing.JScrollPane;
  27. import javax.swing.JTextArea;
  28. import javax.swing.JTextField;
  29. import javax.swing.event.ChangeEvent;
  30. import javax.swing.event.ChangeListener;
  31.  
  32. import org.rsbot.event.listeners.PaintListener;
  33. import org.rsbot.script.Calculations;
  34. import org.rsbot.script.Constants;
  35. import org.rsbot.script.Script;
  36. import org.rsbot.script.ScriptManifest;
  37. import org.rsbot.script.wrappers.RSItemTile;
  38. import org.rsbot.script.wrappers.RSObject;
  39. import org.rsbot.script.wrappers.RSTile;
  40.  
  41. @ScriptManifest(authors = { "Tad_" }, category = "Hunter", name = "FSHunt (AIO Hunter)", version = 1.12, description = "<html><font color = Red><center><h2> FSHunt by Tad_</h2></center>"
  42.                 + "<center>Settings in GUI.</center>"
  43.                 + "<center><font size=2>Credits to: RSHelper, Method, Jacmob, Tekk, and anyone else who's helped me out over irc</center></font>"
  44.                 + "\n"
  45.                 + "<center>Please note that this script will create .txt files in your RSBot folder to save settings if you choose to do so</center>")
  46. public class FSHunt extends Script implements PaintListener {
  47.         final ScriptManifest properties = getClass().getAnnotation(
  48.                         ScriptManifest.class);
  49.  
  50.         // GUI vars
  51.         String WhatToHunt;
  52.         boolean TakeBreaks, BuryBones;
  53.         int BEvery = 0, BFor = 0, RandomBE = 0, RandomBF = 0, AntibanLevel = 1;
  54.         public Point[] Spots = null;
  55.  
  56.         // Script Info Vars
  57.         RSTile[] IsTrap = new RSTile[5], Possible = new RSTile[81];
  58.         RSTile OriginalPosition;
  59.         int BreakEvery = 0, BreakFor = 0, loopcheck, TrapsSet = 0,
  60.                         TrapsSuccess = 0, TrapsFail = 0;
  61.         long StartEXP, StartLVL, TimeAtBreak, StartTime = System
  62.                         .currentTimeMillis();
  63.         String status = "", TimeTimer = "";
  64.         boolean KeepGUI = true, KeepOGUI = true, GUISuccess = false,
  65.                         UseTimer = false;
  66.         FSHuntGUI gui;
  67.  
  68.         FSHuntSelector ogui = null;
  69.  
  70.         // Hunting Vars
  71.         int TrapInvID, TrapReadyID, BonesID = 526, ProfitID, AmountProfit,
  72.                         TrapSuccessID, TrapFailID;
  73.  
  74.         long LastDropCheck = 0, LastBoneCheck = 0;
  75.         int[] TrapFinishingID = null, DropIDs = null, DropSpots = null,
  76.                         BoneSpots = null;
  77.  
  78.         public long[] millisToHMS(long millis) {
  79.                 long H = 0, M = 0, S = 0;
  80.                 H = millis / (1000 * 60 * 60);
  81.                 M = millis / (1000 * 60) - (60 * H);
  82.                 S = millis / 1000 - ((60 * M) + (3600 * H));
  83.                 long[] HMSArray = { H, M, S };
  84.                 return HMSArray;
  85.         }
  86.  
  87.         public void onRepaint(Graphics g) {
  88.                 int CurEXP = skills.getCurrentSkillExp(STAT_HUNTER);
  89.                 int CurLVL = skills.getCurrentSkillLevel(STAT_HUNTER);
  90.                 long EXPHour = 0, TimeToLVL, EXPToLVL;
  91.                 g.setColor(Color.red);
  92.                 g.setFont(new Font("Segoe UI", Font.BOLD, 15));
  93.                 g.drawString("" + status, 300, 335);
  94.                 if (isLoggedIn()) {
  95.                         long millis = System.currentTimeMillis() - StartTime;
  96.                         long HMS[] = millisToHMS(millis);
  97.                         long hours = HMS[0];
  98.                         long minutes = HMS[1];
  99.                         long seconds = HMS[2];
  100.                         g.setColor(new Color(20, 200, 20, 150));
  101.                         g.fillRoundRect(554, 211, 180, 247, 20, 20);
  102.                         g.fillRoundRect(295, 320, 215, 19, 10, 10);
  103.                         g.setColor(Color.red);
  104.  
  105.                         g.setFont(new Font("Segoe UI", Font.BOLD, 12));
  106.                         g.drawString("Time running: " + hours + ":" + minutes + ":"
  107.                                         + seconds + ".", 560, 225);
  108.  
  109.                         g.drawString("Traps set: " + TrapsSet, 560, 240);
  110.                         g.drawString("Traps successful: " + TrapsSuccess, 560, 255);
  111.                         g.drawString("Traps failed/fallen: " + TrapsFail, 560, 270);
  112.                         if ((TrapsSuccess + TrapsFail) != 0)
  113.                                 g.drawString("% Success: "
  114.                                                 + (TrapsSuccess * 100 / (TrapsSuccess + TrapsFail))
  115.                                                 + "%", 560, 285);
  116.  
  117.                         g.drawString("EXP gained: " + (CurEXP - StartEXP), 560, 305);
  118.                         EXPHour = (int) (3600000.0 / millis * (CurEXP - StartEXP));
  119.                         g.drawString("EXP/Hour: " + EXPHour, 560, 320);
  120.  
  121.                         g.drawString("Current Level: " + CurLVL, 560, 340);
  122.                         g.drawString("Levels Gained: " + (CurLVL - StartLVL), 560, 355);
  123.                         EXPToLVL = skills.getXPToNextLevel(STAT_HUNTER);
  124.                         g.drawString("EXP to next level: " + EXPToLVL, 560, 370);
  125.                         g.drawString("% to next level: "
  126.                                         + skills.getPercentToNextLevel(STAT_HUNTER), 560, 385);
  127.                         if (EXPHour != 0) {
  128.                                 TimeToLVL = EXPToLVL * 60 * 60 * 1000 / EXPHour;
  129.                                 long HMS2[] = millisToHMS(TimeToLVL);
  130.                                 g.drawString("Time to next level: " + HMS2[0] + ":" + HMS2[1]
  131.                                                 + ":" + HMS2[2] + ".", 560, 400);
  132.                         }
  133.                 }
  134.         }
  135.  
  136.         public void initTrapLocs() {
  137.                 int i, j = 0;
  138.  
  139.                 if (Spots == null || Spots.length <= 0 || Spots[0] == null) {
  140.                         log("ERROR. Make sure you set up your trap locations. If you did and this error still occurs, alert Tad_");
  141.                         stopScript();
  142.                 }
  143.                 Point[] XYs = Spots;
  144.  
  145.                 status = "Initializing Trap Locations";
  146.                 OriginalPosition = getMyPlayer().getLocation();
  147.                 for (i = 0; i < XYs.length; i++) {
  148.                         Possible[j] = new RSTile(OriginalPosition.getX() + XYs[i].x,
  149.                                         OriginalPosition.getY() + XYs[i].y);
  150.                         j = j + 1;
  151.                 }
  152.         }
  153.  
  154.         public boolean onStart(Map<String, String> args) {
  155.                 gui = new FSHuntGUI();
  156.                 gui.setVisible(true);
  157.                 gui.setAlwaysOnTop(true);
  158.                 while (KeepGUI)
  159.                         wait(50);
  160.                 if (!GUISuccess)
  161.                         return false;
  162.                 status = "Starting up";
  163.                 if (!isLoggedIn())
  164.                         login();
  165.                 StartEXP = skills.getCurrentSkillExp(STAT_HUNTER);
  166.                 StartLVL = skills.getCurrentSkillLevel(STAT_HUNTER); // Script by Tad_
  167.                 initTrapLocs();
  168.                 initHuntVars();
  169.                 initBreaks();
  170.                 return true;
  171.         }
  172.  
  173.         public void initHuntVars() {
  174.  
  175.                 status = "Initializing Hunt Vars";
  176.                 if (WhatToHunt.toLowerCase().equals("ferret")) {
  177.                         TrapInvID = 10008;
  178.                         TrapReadyID = 19187;
  179.                         ProfitID = -1;
  180.                         TrapFinishingID = new int[] { 19201, 19202, 19203, 19204, 19188 };
  181.                         TrapSuccessID = 19191;
  182.                         TrapFailID = 19192;
  183.                         if (BuryBones) {
  184.                                 DropIDs = new int[1];
  185.                                 DropIDs[0] = 10092;
  186.                         } else {
  187.                                 DropIDs = new int[2];
  188.                                 DropIDs[0] = 10092;
  189.                                 DropIDs[1] = BonesID;
  190.                         }
  191.                 } else if (WhatToHunt.toLowerCase().equals("grey_chinchompa")) {
  192.                         TrapInvID = 10008;
  193.                         TrapReadyID = 19187;
  194.                         ProfitID = 10033;
  195.                         TrapFinishingID = new int[] { 19188, 19196, 19193, 19194, 19192,
  196.                                         19195 };
  197.                         TrapSuccessID = 19189;
  198.                         TrapFailID = 19192;
  199.                 } else if (WhatToHunt.toLowerCase().equals("red_chinchompa")) {
  200.                         TrapInvID = 10008;
  201.                         TrapReadyID = 19187;
  202.                         ProfitID = 10034;
  203.                         TrapFinishingID = new int[] { 19188, 19199, 19197, 19198, 19200 };
  204.                         TrapSuccessID = 19190;
  205.                         TrapFailID = 19192;
  206.                 } else if (WhatToHunt.toLowerCase().equals("crimson_swift")) {
  207.                         TrapInvID = 10006;
  208.                         TrapReadyID = 19175;
  209.                         ProfitID = 10088;
  210.                         TrapFinishingID = new int[] { 19176, 19179 };
  211.                         TrapSuccessID = 19180;
  212.                         TrapFailID = 19174;
  213.                         if (BuryBones) {
  214.                                 DropIDs = new int[1];
  215.                                 DropIDs[0] = 9978;
  216.                         } else {
  217.                                 DropIDs = new int[2];
  218.                                 DropIDs[0] = 9978;
  219.                                 DropIDs[1] = BonesID;
  220.                         }
  221.                 } else if (WhatToHunt.toLowerCase().equals("tropical_wagtail")) {
  222.                         TrapInvID = 10006;
  223.                         TrapReadyID = 19175;
  224.                         ProfitID = 10087;
  225.                         TrapFinishingID = new int[] { 19177, 19176 };
  226.                         TrapSuccessID = 19178;
  227.                         TrapFailID = 19174;
  228.                         if (BuryBones) {
  229.                                 DropIDs = new int[1];
  230.                                 DropIDs[0] = 9978;
  231.                         } else {
  232.                                 DropIDs = new int[2];
  233.                                 DropIDs[0] = 9978;
  234.                                 DropIDs[1] = BonesID;
  235.                         }
  236.                 } else {
  237.                         log("Something went wrong (Error: initHuntVars fail). Alert Tad_. Terminating");
  238.                         stopScript();
  239.                 }
  240.         }
  241.  
  242.         public void initBreaks() {
  243.                 if (!TakeBreaks)
  244.                         return;
  245.                 status = "Initializing Breaks";
  246.                 BreakEvery = (BEvery * 60000) + random(0, (RandomBE * 60000));
  247.                 BreakFor = (BFor * 60000) + random(0, (RandomBF * 60000));
  248.                 TimeAtBreak = System.currentTimeMillis();
  249.  
  250.         }
  251.  
  252.         public boolean needDrop(boolean InventoryFull) {
  253.                 long t;
  254.                 if (getEnergy() > 80)
  255.                         setRun(true);
  256.                 if (!InventoryFull) {
  257.                         if ((isIdle() || (getMyPlayer().getLocation().getX() != OriginalPosition
  258.                                         .getX() || getMyPlayer().getLocation().getY() != OriginalPosition
  259.                                         .getY())))
  260.                                 if (getMyPlayer().getLocation().getX() == OriginalPosition
  261.                                                 .getX() + 1
  262.                                                 && getMyPlayer().getLocation().getY() != OriginalPosition
  263.                                                                 .getY())
  264.                                         wait(random(300, 500));
  265.                         if (getMyPlayer().getLocation().getX() != OriginalPosition.getX()
  266.                                         || getMyPlayer().getLocation().getY() != OriginalPosition
  267.                                                         .getY()) {
  268.                                 walkTileOnScreen(OriginalPosition);
  269.                                 t = System.currentTimeMillis();
  270.                                 while (!getMyPlayer().isMoving()
  271.                                                 && (getMyPlayer().getLocation().getX() != OriginalPosition
  272.                                                                 .getX() || getMyPlayer().getLocation().getY() != OriginalPosition
  273.                                                                 .getY())) {
  274.                                         if (System.currentTimeMillis() - t > 3000)
  275.                                                 break;
  276.                                         wait(random(300, 500));
  277.                                 }
  278.                                 t = System.currentTimeMillis();
  279.                                 while (getMyPlayer().isMoving()) {
  280.                                         if (System.currentTimeMillis() - t > 4000)
  281.                                                 break;
  282.                                         wait(random(300, 500));
  283.                                 }
  284.                                 wait(random(30, 90));
  285.                         }
  286.                 }
  287.                 if (DropIDs == null)
  288.                         return false;
  289.                 if (InventoryFull)
  290.                         return getInventoryCount() > 20;
  291.                 if (inventoryContainsOneOf(DropIDs) || inventoryContainsOneOf(BonesID))
  292.                         return true;
  293.                 return false;
  294.         }
  295.  
  296.         public boolean needBreak() {
  297.                 if (!TakeBreaks)
  298.                         return false;
  299.                 if (((System.currentTimeMillis() - TimeAtBreak)) > BreakEvery)
  300.                         return true;
  301.                 return false;
  302.         }
  303.  
  304.         public boolean isItemAt(int ID, RSTile Loc) {
  305.                 RSItemTile[] AllItems;
  306.                 int i;
  307.                 AllItems = getGroundItemsAt(Loc);
  308.                 if (AllItems != null)
  309.                         for (i = 0; i < AllItems.length; i++) {
  310.                                 if (AllItems[i].getItem().getID() == ID)
  311.                                         return true;
  312.                         }
  313.                 return false;
  314.         }
  315.  
  316.         public boolean pickTrap() {
  317.                 int i;
  318.                 long t;
  319.                 status = "Checking fallen traps";
  320.                 if (IsTrap == null)
  321.                         return false;
  322.                 for (i = 0; i < IsTrap.length; i++) {
  323.                         if (IsTrap[i] == null)
  324.                                 continue;
  325.                         if (isItemAt(TrapInvID, IsTrap[i])) {
  326.  
  327.                                 if (!tileOnScreen(IsTrap[i]))
  328.                                         walkTo(IsTrap[i], 3, 3);
  329.                                 if (WhatToHunt == "Crimson_Swift"
  330.                                                 || WhatToHunt == "Tropical_Wagtail") {
  331.                                         if (needPlaceTrap()) {
  332.                                                 if (!atTile(IsTrap[i], "Lay Bird snare"))
  333.                                                         return true;
  334.                                         } else {
  335.                                                 if (!atTile(IsTrap[i], "Take Bird snare"))
  336.                                                         return true;
  337.                                         }
  338.                                 } else {
  339.                                         if (needPlaceTrap()) {
  340.                                                 if (!atTile(IsTrap[i], "Lay Box trap"))
  341.                                                         return true;
  342.                                         } else {
  343.                                                 if (!atTile(IsTrap[i], "Take Box trap"))
  344.                                                         return true;
  345.                                         }
  346.                                 }
  347.                                 if (AntibanLevel != 0)
  348.                                         if (random(0, 15) == 0)
  349.                                                 if (random(0, 1) == 0)
  350.                                                         setCameraRotation(random(0, 359));
  351.                                                 else
  352.                                                         setCameraAltitude(random(0, 100));
  353.                                 t = System.currentTimeMillis();
  354.                                 while (getObjectAt(IsTrap[i]) == null || !isIdle()) {
  355.                                         if (System.currentTimeMillis() - t > 8000)
  356.                                                 break;
  357.                                         wait(random(150, 250));
  358.                                 }
  359.                                 return true;
  360.                         }
  361.                 }
  362.                 return false;
  363.         }
  364.  
  365.         public boolean needPlaceTrap() {
  366.                 int AvailTrapNum = 0, i, AmtTraps = 0;
  367.  
  368.                 AvailTrapNum = (skills.getCurrentSkillLevel(STAT_HUNTER) / 20) + 1;
  369.                 for (i = 0; i < IsTrap.length; i++) {
  370.                         if (IsTrap[i] == null)
  371.                                 continue;
  372.                         if (getObjectAt(IsTrap[i]) != null)
  373.                                 AmtTraps = AmtTraps + 1;
  374.                         else if (!isItemAt(TrapInvID, IsTrap[i]))
  375.                                 IsTrap[i] = null;
  376.                 }
  377.                 return (AvailTrapNum - AmtTraps) > 0;
  378.         }
  379.  
  380.         public int findDoneTrap() { // Returns Index in IsTrap of nearest Trap
  381.                 // that is ready to be harvested. Prioritizes finished traps
  382.                 int i, TheTrap = -1;
  383.                 RSObject Temp;
  384.  
  385.                 for (i = 0; i < IsTrap.length; i++) {
  386.                         if (IsTrap[i] == null)
  387.                                 continue;
  388.                         Temp = getObjectAt(IsTrap[i]);
  389.                         if (Temp == null) {
  390.                                 if (!isItemAt(TrapInvID, IsTrap[i]))
  391.                                         IsTrap[i] = null;
  392.                                 continue;
  393.                         }
  394.                         if (Temp.getID() == TrapSuccessID)
  395.                                 if (TheTrap == -1)
  396.                                         TheTrap = i;
  397.                                 else if (distanceTo(IsTrap[i]) < distanceTo(Temp))
  398.                                         TheTrap = i;
  399.                 }
  400.                 if (TheTrap != -1)
  401.                         return TheTrap;
  402.  
  403.                 for (i = 0; i < IsTrap.length; i++) {
  404.                         if (IsTrap[i] == null)
  405.                                 continue;
  406.                         Temp = getObjectAt(IsTrap[i]);
  407.                         if (Temp == null && !isItemAt(TrapInvID, IsTrap[i])) {
  408.                                 IsTrap[i] = null;
  409.                                 continue;
  410.                         } else if (Temp == null) {
  411.                                 pickTrap();
  412.                                 IsTrap[i] = null;
  413.                                 continue;
  414.                         }
  415.                         if (Temp.getID() == TrapFailID)
  416.                                 if (TheTrap == -1)
  417.                                         TheTrap = i;
  418.                                 else if (distanceTo(IsTrap[i]) < distanceTo(Temp))
  419.                                         TheTrap = i;
  420.                 }
  421.                 return TheTrap;
  422.         }
  423.  
  424.         public boolean checkTrap() {
  425.                 int Temp = -1;
  426.                 RSObject TheTrap = null;
  427.                 long t;
  428.                 boolean Success = false;
  429.  
  430.                 status = "Reviewing Traps";
  431.                 Temp = findDoneTrap();
  432.                 if (Temp == -1)
  433.                         return false;
  434.                 TheTrap = getObjectAt(IsTrap[Temp]);
  435.                 if (TheTrap.getID() == TrapSuccessID) {
  436.                         if (!atObject(TheTrap, "Check"))
  437.                                 return false;
  438.                         Success = true;
  439.                 } else {
  440.                         if (!atObject(TheTrap, "Dismantle"))
  441.                                 return false;
  442.                         Success = false;
  443.                 }
  444.                 t = System.currentTimeMillis();
  445.                 while (getObjectAt(TheTrap.getLocation()) != null) {
  446.                         if (isIdle()) {
  447.                                 wait(random(250, 450));
  448.                                 if (isIdle())
  449.                                         break;
  450.                         }
  451.                         if (System.currentTimeMillis() - t > 10000)
  452.                                 break;
  453.                         wait(random(100, 200));
  454.                 }
  455.                 t = System.currentTimeMillis();
  456.                 if (IsTrap[Temp] != null) {
  457.                         while (getObjectAt(IsTrap[Temp]) != null) {
  458.                                 if (isIdle()) {
  459.                                         wait(random(250, 450));
  460.                                         if (isIdle())
  461.                                                 break;
  462.                                 }
  463.                                 if (System.currentTimeMillis() - t > 10000)
  464.                                         break;
  465.                                 wait(random(150, 250));
  466.                         }
  467.                         if (getObjectAt(IsTrap[Temp]) == null && Success)
  468.                                 TrapsSuccess++;
  469.                         else if (getObjectAt(IsTrap[Temp]) == null && !Success)
  470.                                 TrapsFail++;
  471.                         if (getObjectAt(IsTrap[Temp]) == null)
  472.                                 IsTrap[Temp] = null;
  473.                         wait(random(200, 450));
  474.                 }
  475.                 return true;
  476.         }
  477.  
  478.         public boolean hoverTrap() {
  479.                 int i, ID, WhatTrap = -1, j;
  480.                 RSObject Temp;
  481.                 long t;
  482.                 boolean DidClick = false, IsFinishing = false;
  483.  
  484.                 status = "Predicting trap";
  485.                 for (i = 0; i < IsTrap.length; i++) {
  486.                         if (IsTrap[i] == null)
  487.                                 continue;
  488.                         Temp = getObjectAt(IsTrap[i]);
  489.                         if (Temp == null)
  490.                                 continue;
  491.                         ID = Temp.getID();
  492.                         for (j = 0; j < TrapFinishingID.length; j++) {
  493.                                 if (ID == TrapFinishingID[j]) {
  494.                                         IsFinishing = true;
  495.                                         break;
  496.                                 }
  497.                         }
  498.                         if (!IsFinishing)
  499.                                 return false;
  500.                         Point location = Calculations.tileToScreen(IsTrap[i]);
  501.                         if (location.x == -1 || location.y == -1)
  502.                                 return false;
  503.                         moveMouse(location.x, location.y, 5, 5);
  504.                         Temp = getObjectAt(IsTrap[i]);
  505.                         t = System.currentTimeMillis();
  506.                         if (Temp != null) {
  507.                                 while (Temp.getID() != TrapFailID
  508.                                                 && Temp.getID() != TrapSuccessID) {
  509.                                         Temp = getObjectAt(IsTrap[i]);
  510.                                         if (Temp == null)
  511.                                                 break;
  512.                                         if (System.currentTimeMillis() - t > 10000)
  513.                                                 break;
  514.                                         wait(random(50, 100));
  515.  
  516.                                 }
  517.                         }
  518.                         Temp = getObjectAt(IsTrap[i]);
  519.                         if (Temp == null)
  520.                                 return false;
  521.                         if (Temp.getID() == TrapFailID || Temp.getID() == TrapSuccessID) {
  522.                                 wait(random(250, 400));
  523.                                 clickMouse(true);
  524.                                 WhatTrap = i;
  525.                                 DidClick = true;
  526.                         }
  527.                         break;
  528.                 }
  529.                 if (DidClick) {
  530.                         t = System.currentTimeMillis();
  531.                         while (isIdle()) {
  532.                                 if (System.currentTimeMillis() - t > 10000)
  533.                                         break;
  534.                                 wait(random(500, 650));
  535.                         }
  536.                         t = System.currentTimeMillis();
  537.                         if (IsTrap[WhatTrap] != null) {
  538.                                 while (getObjectAt(IsTrap[WhatTrap]) != null && !isIdle()) {
  539.                                         if (System.currentTimeMillis() - t > 10000)
  540.                                                 break;
  541.                                         wait(random(150, 250));
  542.                                 }
  543.                                 if (getObjectAt(IsTrap[WhatTrap]) == null)
  544.                                         IsTrap[WhatTrap] = null;
  545.                                 wait(random(200, 450));
  546.                         }
  547.                         return true;
  548.                 }
  549.                 return false;
  550.         }
  551.  
  552.         public int[] findItems(int[] IDs) {
  553.                 int[] AllItems = getInventoryArray();
  554.                 int i, j, LCount = 0;
  555.  
  556.                 if (IDs == null)
  557.                         return null;
  558.                 for (j = 0; j < IDs.length; j++)
  559.                         if (AllItems != null)
  560.                                 for (i = 0; i < AllItems.length; i++)
  561.                                         if (AllItems[i] == IDs[j])
  562.                                                 LCount = LCount + 1;
  563.                 int[] Temp = new int[LCount];
  564.                 LCount = 0;
  565.                 if (AllItems != null) {
  566.                         for (j = 0; j < IDs.length; j++)
  567.                                 for (i = 0; i < AllItems.length; i++)
  568.                                         if (AllItems[i] == IDs[j]) {
  569.                                                 Temp[LCount] = i;
  570.                                                 LCount = LCount + 1;
  571.                                         }
  572.                 }
  573.                 return Temp;
  574.         }
  575.  
  576.         public void dropStuff(boolean CalcSpots) {
  577.                 Point ItemSpot = null;
  578.                 int i;
  579.                 long j;
  580.  
  581.                 status = "Dropping";
  582.                 if (System.currentTimeMillis() - LastDropCheck > 5000 && CalcSpots) {
  583.                         DropSpots = findItems(DropIDs);
  584.                         LastDropCheck = System.currentTimeMillis();
  585.                 }
  586.                 if (BuryBones)
  587.                         if (System.currentTimeMillis() - LastBoneCheck > 5000 && CalcSpots) {
  588.                                 BoneSpots = findItems(new int[] { BonesID });
  589.                                 LastBoneCheck = System.currentTimeMillis();
  590.                         }
  591.                 if (DropSpots.length <= 0 && BoneSpots.length <= 0)
  592.                         return;
  593.                 for (i = 0; i < DropSpots.length; i++) {
  594.                         if (DropSpots[i] != -1) {
  595.                                 ItemSpot = getInventoryItemPoint(DropSpots[i]);
  596.                                 clickMouse(ItemSpot.x, ItemSpot.y, 35, 31, false);
  597.                                 j = System.currentTimeMillis();
  598.                                 while (System.currentTimeMillis() - j < 5000) {
  599.                                         if (isMenuOpen())
  600.                                                 break;
  601.                                         wait(random(50, 100));
  602.                                 }
  603.                                 if (!isMenuOpen())
  604.                                         continue;
  605.                                 wait(random(25, 100));
  606.  
  607.                                 if (getMenuIndex("Release") != -1) {
  608.                                         if (!atMenu("Release"))
  609.                                                 continue;
  610.                                 } else {
  611.                                         if (!atMenu("Drop"))
  612.                                                 continue;
  613.                                 }
  614.                                 wait(random(50, 125));
  615.                                 DropSpots[i] = -1;
  616.                                 return;
  617.                         }
  618.                 }
  619.                 if (BuryBones)
  620.                         buryBone();
  621.         }
  622.  
  623.         public void buryBone() {
  624.                 status = "Burying bones";
  625.                 Point ItemSpot = null;
  626.                 int i;
  627.                 long j;
  628.                 pickTrap();
  629.                 if (BoneSpots == null)
  630.                         return;
  631.                 if (BoneSpots.length <= 0)
  632.                         return;
  633.                 for (i = 0; i < BoneSpots.length; i++) {
  634.                         if (BoneSpots[i] != -1) {
  635.                                 ItemSpot = getInventoryItemPoint(BoneSpots[i]);
  636.                                 clickMouse(ItemSpot.x, ItemSpot.y, 35, 31, true);
  637.                                 j = System.currentTimeMillis();
  638.                                 while (System.currentTimeMillis() - j < 5000) {
  639.                                         if (getMyPlayer().getAnimation() != -1)
  640.                                                 break;
  641.                                         wait(random(50, 100));
  642.                                 }
  643.                                 wait(random(200, 500));
  644.                                 BoneSpots[i] = -1;
  645.                                 return;
  646.                         }
  647.                 }
  648.         }
  649.  
  650.         public void dropAll() {
  651.                 DropSpots = findItems(DropIDs);
  652.                 while (findItems(DropIDs).length > 0)
  653.                         dropStuff(false);
  654.                 if (BuryBones) {
  655.                         BoneSpots = findItems(new int[] { BonesID });
  656.                         while (findItems(new int[] { BonesID }).length > 0)
  657.                                 buryBone();
  658.                 }
  659.         }
  660.  
  661.         public void pickAllTraps() {
  662.                 int i;
  663.                 long t;
  664.  
  665.                 for (i = 0; i < IsTrap.length; i++) {
  666.                         if (IsTrap[i] != null) {
  667.                                 if (getObjectAt(IsTrap[i]) == null) {
  668.                                         pickTrap();
  669.                                         IsTrap[i] = null;
  670.                                 }
  671.                                 if (getObjectAt(IsTrap[i]).getID() == TrapReadyID
  672.                                                 || getObjectAt(IsTrap[i]).getID() == TrapFailID)
  673.                                         if (!atObject(getObjectAt(IsTrap[i]), "Dismantle")) {
  674.                                                 i--;
  675.                                                 continue;
  676.                                         }
  677.                                 if (getObjectAt(IsTrap[i]).getID() == TrapSuccessID)
  678.                                         if (!atObject(getObjectAt(IsTrap[i]), "Check")) {
  679.                                                 i--;
  680.                                                 continue;
  681.                                         }
  682.                                 t = System.currentTimeMillis();
  683.                                 while (isIdle()) {
  684.                                         if (System.currentTimeMillis() - t > 10000)
  685.                                                 break;
  686.                                         wait(random(300, 500));
  687.                                 }
  688.                                 t = System.currentTimeMillis();
  689.                                 while (getObjectAt(IsTrap[i]) != null && !isIdle()) {
  690.                                         if (System.currentTimeMillis() - t > 10000)
  691.                                                 break;
  692.                                         wait(random(150, 250));
  693.                                 }
  694.                                 if (getObjectAt(IsTrap[i]) == null)
  695.                                         IsTrap[i] = null;
  696.                                 wait(random(200, 450));
  697.                                 IsTrap[i] = null;
  698.                         }
  699.                 }
  700.         }
  701.  
  702.         public void takeBreak() {
  703.  
  704.                 status = "Taking Break";
  705.                 log("Getting ready to take break");
  706.                 dropAll();
  707.                 pickAllTraps();
  708.                 logout();
  709.                 log("Currently taking break for " + BreakFor + "ms");
  710.                 wait(BreakFor);
  711.                 log("Done taking break!");
  712.                 login();
  713.                 TimeAtBreak = System.currentTimeMillis();
  714.         }
  715.  
  716.         public void antiBan() {
  717.                 status = "Performing Antiban";
  718.                 if (random(0, 50) == 0)
  719.                         moveMouse(380, 250, 300, 200);
  720.                 if (random(0, 250) == 0) {
  721.                         openTab(random(0, 15));
  722.                         wait(random(350, 1000));
  723.                         openTab(Constants.TAB_INVENTORY);
  724.                 }
  725.                 if (random(0, 75) == 0)
  726.                         setCameraRotation(random(0, 359));
  727.                 if (random(0, 75) == 0)
  728.                         setCameraAltitude(random(0, 100));
  729.  
  730.         }
  731.  
  732.         public RSTile findGoodTile() {
  733.                 int i;
  734.                 if (Possible.equals(null))
  735.                         return null;
  736.                 for (i = 0; i < Possible.length; i++)
  737.                         if (Possible[i] != null)
  738.                                 if (getObjectAt(Possible[i]) == null)
  739.                                         if (!isItemAt(TrapInvID, Possible[i]))
  740.                                                 return Possible[i];
  741.                                         else
  742.                                                 break;
  743.                                 else if (getObjectAt(Possible[i]).getType() != 0
  744.                                                 && getObjectAt(Possible[i]).getType() != 2)
  745.                                         if (!isItemAt(TrapInvID, Possible[i]))
  746.                                                 return Possible[i];
  747.                                         else
  748.                                                 break;
  749.                 return null;
  750.         }
  751.  
  752.         public boolean placeTrap() {
  753.                 RSTile TileToUse = findGoodTile();
  754.                 long t;
  755.                 int Index;
  756.  
  757.                 status = "Placing Trap";
  758.                 if (TileToUse == null)
  759.                         return false;
  760.                 if ((getMyPlayer().getLocation().getX() != TileToUse.getX() || getMyPlayer()
  761.                                 .getLocation().getY() != TileToUse.getY())) {
  762.                         if (!tileOnScreen(TileToUse))
  763.                                 walkTileMM(TileToUse, 3, 3);
  764.                         if (walkTileOnScreen(TileToUse)) {
  765.                                 t = System.currentTimeMillis();
  766.                                 while (!getMyPlayer().isMoving()) {
  767.                                         if (System.currentTimeMillis() - t > 3000)
  768.                                                 break;
  769.                                         wait(random(300, 500));
  770.                                 }
  771.                                 t = System.currentTimeMillis();
  772.                                 while (getMyPlayer().isMoving()) {
  773.                                         if (System.currentTimeMillis() - t > 4000)
  774.                                                 break;
  775.                                 }
  776.                                 if (getMyPlayer().getLocation().getX() != TileToUse.getX()
  777.                                                 || getMyPlayer().getLocation().getY() != TileToUse
  778.                                                                 .getY() || getMyPlayer().isMoving())
  779.                                         return true;
  780.                         }
  781.                 }
  782.                 if (!atInventoryItem(TrapInvID, "Lay"))
  783.                         return true;
  784.                 TileToUse = getMyPlayer().getLocation();
  785.                 wait(random(30, 90));
  786.                 moveMouse(260, 175, 120, 75);
  787.                 if (AntibanLevel != 0)
  788.                         if (random(0, 15) == 0)
  789.                                 if (random(0, 1) == 0)
  790.                                         setCameraRotation(random(0, 359));
  791.                                 else
  792.                                         setCameraAltitude(random(0, 100));
  793.  
  794.                 for (Index = 0; Index < IsTrap.length; Index++)
  795.                         if (IsTrap[Index] == null) {
  796.                                 IsTrap[Index] = TileToUse;
  797.                                 break;
  798.                         }
  799.                 t = System.currentTimeMillis();
  800.                 if (IsTrap[Index] == null) {
  801.                         while (!isIdle() && System.currentTimeMillis() - t < 10000)
  802.                                 wait(random(500, 650));
  803.                         return true;
  804.                 }
  805.                 while (getObjectAt(IsTrap[Index]) == null) {
  806.                         if (System.currentTimeMillis() - t > 15000)
  807.                                 break;
  808.                         wait(random(50, 100));
  809.                 }
  810.                 if (getObjectAt(TileToUse) == null)
  811.                         IsTrap[Index] = null;
  812.                 else
  813.                         TrapsSet++;
  814.  
  815.                 wait(random(800, 1200));
  816.                 return true;
  817.         }
  818.  
  819.         public void needQuit() {
  820.                 if (!UseTimer)
  821.                         return;
  822.                 String[] Temp = new String[3];
  823.                 int[] Units = new int[3];
  824.                 int i, MSTime;
  825.                 Temp = TimeTimer.split(":");
  826.                 for (i = 0; i < Temp.length; i++)
  827.                         Units[i] = Integer.parseInt(Temp[i]);
  828.                 MSTime = (Units[0] * 360000) + (Units[1] * 60000) + (Units[2] * 1000)
  829.                                 + random(2000, 5000);
  830.                 if (System.currentTimeMillis() - StartTime < MSTime)
  831.                         return;
  832.                 log("End time reached! Terminating script...");
  833.                 dropAll();
  834.                 pickAllTraps();
  835.                 logout();
  836.                 stopScript();
  837.         }
  838.  
  839.         @Override
  840.         protected int getMouseSpeed() {
  841.                 return random(7,9);
  842.         }
  843.  
  844.         @Override
  845.         public int loop() {
  846.                 if (needDrop(true))
  847.                         dropAll();
  848.                 if (pickTrap())
  849.                         if (inventoryContainsOneOf(TrapInvID))
  850.                                 if (needPlaceTrap())
  851.                                         if (placeTrap())
  852.                                                 return 0;
  853.                 needQuit();
  854.                 if (needBreak())
  855.                         takeBreak();
  856.                 if (inventoryContainsOneOf(TrapInvID))
  857.                         if (needPlaceTrap())
  858.                                 if (placeTrap())
  859.                                         return 0;
  860.                 if (checkTrap())
  861.                         return 0;
  862.                 if (needDrop(false)) {
  863.                         dropStuff(true);
  864.                         return 0;
  865.                 }
  866.                 if (hoverTrap())
  867.                         return 0;
  868.                 if (!inventoryContainsOneOf(TrapInvID)) {
  869.                         for (loopcheck = 0; loopcheck < IsTrap.length; loopcheck++)
  870.                                 if (IsTrap == null && loopcheck == IsTrap.length - 1) {
  871.                                         log("No more traps? Terminating.");
  872.                                         logout();
  873.                                         stopScript();
  874.                                 }
  875.                 }
  876.                 if (AntibanLevel != 0)
  877.                         antiBan();
  878.  
  879.                 return 0;
  880.         }
  881.  
  882.         @SuppressWarnings("serial")
  883.         public class FSHuntGUI extends JFrame {
  884.                 public FSHuntGUI() {
  885.                         initComponents();
  886.                         CBStateChanged();
  887.                         UTStateChanged();
  888.                 }
  889.  
  890.                 private void OpenTrapSetupActionPerformed()
  891.                                 throws IllegalMonitorStateException, InterruptedException {
  892.                         if (ogui != null)
  893.                                 return;
  894.                         ogui = new FSHuntSelector();
  895.                         ogui.setVisible(true);
  896.                         gui.setAlwaysOnTop(false);
  897.                         ogui.setAlwaysOnTop(true);
  898.                         KeepOGUI = true;
  899.                         log("IGNORE THIS ERROR ^ AND THE ONE BELOW v");
  900.                         while (KeepOGUI) {
  901.                                 wait(50);
  902.                         }
  903.                         KeepOGUI = true;
  904.                         ogui = null;
  905.                         gui.setAlwaysOnTop(true);
  906.                 }
  907.  
  908.                 private void StartButtonActionPerformed(ActionEvent e) {
  909.                         if (AB.getText() != null)
  910.                                 AntibanLevel = Integer.parseInt(AB.getText());
  911.                         BuryBones = BB.isSelected();
  912.                         TakeBreaks = CB.isSelected();
  913.                         WhatToHunt = WTH.getSelectedItem().toString();
  914.                         if (TakeBreaks) {
  915.                                 if (BE.getText() != null)
  916.                                         BEvery = Integer.parseInt(BE.getText());
  917.  
  918.                                 if (BF.getText() != null)
  919.                                         BFor = Integer.parseInt(BF.getText());
  920.                                 if (RBE.getText() != null)
  921.                                         RandomBE = Integer.parseInt(RBE.getText());
  922.                                 if (RBF.getText() != null)
  923.                                         RandomBF = Integer.parseInt(RBF.getText());
  924.                         }
  925.                         KeepGUI = false;
  926.                         GUISuccess = true;
  927.                         UseTimer = UT.isSelected();
  928.                         TimeTimer = TT.getText();
  929.                         dispose();
  930.                 }
  931.  
  932.                 /*
  933.                  * private String getNumbers(final String toSearch) { //By RSHelper
  934.                  * final char[] searchChars = toSearch.toCharArray(); String numbers =
  935.                  * ""; for(final char curChar : searchChars)
  936.                  * if(Character.isDigit(curChar)) numbers += curChar; return numbers; }
  937.                  */
  938.  
  939.                 private void SaveSettingsActionPerformed(ActionEvent e)
  940.                                 throws IOException {
  941.                         FileOutputStream MySettings;
  942.                         try {
  943.                                 MySettings = new FileOutputStream("FSHunt Settings.txt");
  944.                         } catch (FileNotFoundException e1) {
  945.                                 log("Failed saving Settings!");
  946.                                 return;
  947.                         }
  948.                         new PrintStream(MySettings).println(WTH.getSelectedIndex() + ","
  949.                                         + AB.getText() + "," + BB.isSelected() + ","
  950.                                         + CB.isSelected() + "," + BE.getText() + "," + BF.getText()
  951.                                         + "," + RBE.getText() + "," + RBF.getText() + ","
  952.                                         + UT.isSelected() + "," + TT.getText());
  953.                         /*
  954.                          * 1: WTH 2: AB 3: BB 4: CB 5: BE 6: BF 7: RBE 8: RBF 9: UT 10: TT
  955.                          */
  956.                         MySettings.close();
  957.                         log("Settings Saved");
  958.                 }
  959.  
  960.                 private void LoadSettingsActionPerformed(ActionEvent e)
  961.                                 throws IOException {
  962.                         FileInputStream MySettings;
  963.                         String[] Values = new String[10];
  964.                         try {
  965.                                 MySettings = new FileInputStream("FSHunt Settings.txt");
  966.                         } catch (FileNotFoundException e1) {
  967.                                 log("Failed loading Settings!");
  968.                                 return;
  969.                         }
  970.  
  971.                         BufferedReader d = new BufferedReader(new InputStreamReader(
  972.                                         MySettings));
  973.                         Values = d.readLine().split(",");
  974.                         WTH.setSelectedIndex(Integer.parseInt(Values[0]));
  975.                         AB.setText(Values[1]);
  976.                         BB.setSelected(Boolean.parseBoolean(Values[2]));
  977.                         CB.setSelected(Boolean.parseBoolean(Values[3]));
  978.                         BE.setText(Values[4]);
  979.                         BF.setText(Values[5]);
  980.                         RBE.setText(Values[6]);
  981.                         RBF.setText(Values[7]);
  982.                         UT.setSelected(Boolean.parseBoolean(Values[8]));
  983.                         TT.setText(Values[9]);
  984.                         MySettings.close();
  985.                         FileInputStream MyLocs;
  986.                         String myValue;
  987.                         int ArrayLength = 0;
  988.  
  989.                         try {
  990.                                 MyLocs = new FileInputStream("FSHunt Locations.txt");
  991.                         } catch (FileNotFoundException e1) {
  992.                                 log("Failed loading Locations!");
  993.                                 return;
  994.                         }
  995.  
  996.                         d = new BufferedReader(new InputStreamReader(MyLocs));
  997.                         while ((myValue = d.readLine()) != null)
  998.                                 ArrayLength++;
  999.                         Values = new String[ArrayLength];
  1000.                         d.close();
  1001.                         MyLocs.close();
  1002.  
  1003.                         try {
  1004.                                 MyLocs = new FileInputStream("FSHunt Locations.txt");
  1005.                         } catch (FileNotFoundException e1) {
  1006.                                 log("Failed loading Locations!");
  1007.                                 return;
  1008.                         }
  1009.                         d = new BufferedReader(new InputStreamReader(MyLocs));
  1010.                         ArrayLength = 0;
  1011.  
  1012.                         while ((myValue = d.readLine()) != null) {
  1013.  
  1014.                                 Values[ArrayLength] = myValue;
  1015.                                 ArrayLength++;
  1016.                         }
  1017.                         String[] XandY = new String[2];
  1018.                         int Temp = 0;
  1019.                         Spots = new Point[ArrayLength];
  1020.                         for (String item : Values) {
  1021.                                 XandY = item.split(",");
  1022.                                 Spots[Temp] = new Point(new Float(XandY[0]).intValue(),
  1023.                                                 new Float(XandY[1]).intValue());
  1024.                                 Temp++;
  1025.                                 if (Temp >= Spots.length)
  1026.                                         break;
  1027.                         }
  1028.                         MyLocs.close();
  1029.                         log("Successfully loaded locations");
  1030.                         log("Successfully loaded Settings");
  1031.                 }
  1032.  
  1033.                 private void CBStateChanged() {
  1034.                         boolean Enable = CB.isSelected();
  1035.                         label5.setVisible(Enable);
  1036.                         label6.setVisible(Enable);
  1037.                         label7.setVisible(Enable);
  1038.                         label8.setVisible(Enable);
  1039.                         label10.setVisible(Enable);
  1040.                         label11.setVisible(Enable);
  1041.                         BE.setVisible(Enable);
  1042.                         BF.setVisible(Enable);
  1043.                         RBE.setVisible(Enable);
  1044.                         RBF.setVisible(Enable);
  1045.                 }
  1046.  
  1047.                 private void UTStateChanged() {
  1048.                         boolean Enable = UT.isSelected();
  1049.                         label4.setVisible(Enable);
  1050.                         TT.setVisible(Enable);
  1051.                 }
  1052.  
  1053.                 private void initComponents() {
  1054.                         // JFormDesigner - Component initialization - DO NOT MODIFY
  1055.                         // //GEN-BEGIN:initComponents
  1056.                         label1 = new JLabel();
  1057.                         label2 = new JLabel();
  1058.                         WTH = new JComboBox();
  1059.                         BB = new JCheckBox();
  1060.                         CB = new JCheckBox();
  1061.                         label5 = new JLabel();
  1062.                         label6 = new JLabel();
  1063.                         label7 = new JLabel();
  1064.                         label8 = new JLabel();
  1065.                         label9 = new JLabel();
  1066.                         scrollPane1 = new JScrollPane();
  1067.                         textArea1 = new JTextArea();
  1068.                         label10 = new JLabel();
  1069.                         label11 = new JLabel();
  1070.                         BE = new JTextField();
  1071.                         RBE = new JTextField();
  1072.                         RBF = new JTextField();
  1073.                         LoadSettings = new JButton();
  1074.                         SaveSettings = new JButton();
  1075.                         StartButton = new JButton();
  1076.                         BF = new JTextField();
  1077.                         AB = new JTextField();
  1078.                         tetx = new JLabel();
  1079.                         label3 = new JLabel();
  1080.                         UT = new JCheckBox();
  1081.                         label4 = new JLabel();
  1082.                         TT = new JTextField();
  1083.                         OpenTrapSetup = new JButton();
  1084.                         label12 = new JLabel();
  1085.  
  1086.                         // ======== this ========
  1087.                         setTitle("FSHunt Settings");
  1088.                         setResizable(false);
  1089.                         setForeground(Color.black);
  1090.                         Container contentPane = getContentPane();
  1091.                         contentPane.setLayout(null);
  1092.  
  1093.                         // ---- label1 ----
  1094.                         label1.setText("FS Hunt by Tad_");
  1095.                         label1.setFont(new Font("Papyrus", Font.BOLD, 31));
  1096.                         contentPane.add(label1);
  1097.                         label1.setBounds(150, 10, 303, 45);
  1098.  
  1099.                         // ---- label2 ----
  1100.                         label2.setText("What to Hunt:");
  1101.                         contentPane.add(label2);
  1102.                         label2.setBounds(new Rectangle(new Point(25, 75), label2
  1103.                                         .getPreferredSize()));
  1104.  
  1105.                         // ---- WTH ----
  1106.                         WTH.setModel(new DefaultComboBoxModel(new String[] {
  1107.                                         "Crimson_Swift", "Tropical_Wagtail", "Ferret",
  1108.                                         "Grey_Chinchompa", "Red_Chinchompa" }));
  1109.                         contentPane.add(WTH);
  1110.                         WTH.setBounds(new Rectangle(new Point(105, 70), WTH
  1111.                                         .getPreferredSize()));
  1112.  
  1113.                         // ---- BB ----
  1114.                         BB.setText("Bury Bones?");
  1115.                         contentPane.add(BB);
  1116.                         BB.setBounds(new Rectangle(new Point(25, 100), BB
  1117.                                         .getPreferredSize()));
  1118.  
  1119.                         // ---- CB ----
  1120.                         CB.setText("Use Custom Break Handler?");
  1121.                         CB.setSelected(true);
  1122.                         CB.addChangeListener(new ChangeListener() {
  1123.                                 public void stateChanged(ChangeEvent e) {
  1124.                                         CBStateChanged();
  1125.                                 }
  1126.                         });
  1127.                         contentPane.add(CB);
  1128.                         CB.setBounds(new Rectangle(new Point(300, 70), CB
  1129.                                         .getPreferredSize()));
  1130.  
  1131.                         // ---- label5 ----
  1132.                         label5.setText("Break every");
  1133.                         contentPane.add(label5);
  1134.                         label5.setBounds(new Rectangle(new Point(305, 105), label5
  1135.                                         .getPreferredSize()));
  1136.  
  1137.                         // ---- label6 ----
  1138.                         label6.setText("minutes");
  1139.                         contentPane.add(label6);
  1140.                         label6.setBounds(new Rectangle(new Point(410, 105), label6
  1141.                                         .getPreferredSize()));
  1142.  
  1143.                         // ---- label7 ----
  1144.                         label7.setText("for");
  1145.                         contentPane.add(label7);
  1146.                         label7.setBounds(new Rectangle(new Point(305, 125), label7
  1147.                                         .getPreferredSize()));
  1148.  
  1149.                         // ---- label8 ----
  1150.                         label8.setText("minutes");
  1151.                         contentPane.add(label8);
  1152.                         label8.setBounds(355, 125, label8.getPreferredSize().width, 15);
  1153.  
  1154.                         // ---- label9 ----
  1155.                         label9.setText("Other info:");
  1156.                         label9.setFont(new Font("Papyrus", Font.ITALIC, 15));
  1157.                         contentPane.add(label9);
  1158.                         label9.setBounds(220, 355, 85, label9.getPreferredSize().height);
  1159.  
  1160.                         // ======== scrollPane1 ========
  1161.                         {
  1162.  
  1163.                                 // ---- textArea1 ----
  1164.                                 textArea1.setRows(10);
  1165.                                 textArea1.setWrapStyleWord(true);
  1166.                                 textArea1.setTabSize(2);
  1167.                                 textArea1
  1168.                                                 .setText("Information on various non self-explanatory components...\n\nCustom Break Handler: Self explanatory except for the\n'random'. BreakHandler will activate after the minutes\nyou set PLUS a random amount ranging from 0 to the\nnumber you put in RandomBE. It will stay logged out for\nthe minutes you set PLUS the amount in RandomBF. \n\nAntiban Level: Set to 0 to disable Antiban. After that,\nthe higher you set it, the less antiban it will perform.\nI personally recommend using 1, but some people claim\nthat that is unhumanlike. Expirement and find your\npreference.\n\nUse Timer & Time To Run: If Use Timer is enabled, the\nscript will run for the time specified in Time To Run\nthen stop, pick up traps, and logout. Time To Run should\nbe in this format: h:m:s (put a 0 if zero of that\nparticular unit).\n\nOpen Trap Setup: It is MANDATORY that you set this up. \nHowever, after you have saved the locations on the\nSetting up Locations dialog once, they will be loaded\nif you simply click Load Settings on the main GUI\n(FSHunt Settings dialog). ");
  1169.                                 scrollPane1.setViewportView(textArea1);
  1170.                         }
  1171.                         contentPane.add(scrollPane1);
  1172.                         scrollPane1.setBounds(30, 390, 475, 110);
  1173.  
  1174.                         // ---- label10 ----
  1175.                         label10.setText("RandomBE: ");
  1176.                         contentPane.add(label10);
  1177.                         label10.setBounds(new Rectangle(new Point(305, 155), label10
  1178.                                         .getPreferredSize()));
  1179.  
  1180.                         // ---- label11 ----
  1181.                         label11.setText("RandomBF:");
  1182.                         contentPane.add(label11);
  1183.                         label11.setBounds(new Rectangle(new Point(305, 175), label11
  1184.                                         .getPreferredSize()));
  1185.  
  1186.                         // ---- BE ----
  1187.                         BE.setText("20");
  1188.                         contentPane.add(BE);
  1189.                         BE.setBounds(370, 100, 30, BE.getPreferredSize().height);
  1190.  
  1191.                         // ---- RBE ----
  1192.                         RBE.setText("10");
  1193.                         contentPane.add(RBE);
  1194.                         RBE.setBounds(new Rectangle(new Point(365, 150), RBE
  1195.                                         .getPreferredSize()));
  1196.  
  1197.                         // ---- RBF ----
  1198.                         RBF.setText("10");
  1199.                         contentPane.add(RBF);
  1200.                         RBF.setBounds(new Rectangle(new Point(365, 170), RBF
  1201.                                         .getPreferredSize()));
  1202.  
  1203.                         // ---- LoadSettings ----
  1204.                         LoadSettings.setText("Load Settings");
  1205.                         LoadSettings.addActionListener(new ActionListener() {
  1206.                                 public void actionPerformed(ActionEvent e) {
  1207.                                         try {
  1208.                                                 LoadSettingsActionPerformed(e);
  1209.                                         } catch (IOException e1) {
  1210.                                                 e1.printStackTrace();
  1211.                                         }
  1212.                                 }
  1213.                         });
  1214.                         contentPane.add(LoadSettings);
  1215.                         LoadSettings.setBounds(30, 320, 105, LoadSettings
  1216.                                         .getPreferredSize().height);
  1217.  
  1218.                         // ---- SaveSettings ----
  1219.                         SaveSettings.setText("Save Settings");
  1220.                         SaveSettings.addActionListener(new ActionListener() {
  1221.                                 public void actionPerformed(ActionEvent e) {
  1222.                                         try {
  1223.                                                 SaveSettingsActionPerformed(e);
  1224.                                         } catch (IOException e1) {
  1225.                                                 e1.printStackTrace();
  1226.                                         }
  1227.                                 }
  1228.                         });
  1229.                         contentPane.add(SaveSettings);
  1230.                         SaveSettings.setBounds(30, 290, 105, SaveSettings
  1231.                                         .getPreferredSize().height);
  1232.  
  1233.                         // ---- StartButton ----
  1234.                         StartButton.setText("Start!");
  1235.                         StartButton.addActionListener(new ActionListener() {
  1236.                                 public void actionPerformed(ActionEvent e) {
  1237.                                         StartButtonActionPerformed(e);
  1238.                                 }
  1239.                         });
  1240.                         contentPane.add(StartButton);
  1241.                         StartButton.setBounds(365, 290, 130, 50);
  1242.  
  1243.                         // ---- BF ----
  1244.                         BF.setText("10");
  1245.                         contentPane.add(BF);
  1246.                         BF.setBounds(325, 125, 25, BF.getPreferredSize().height);
  1247.  
  1248.                         // ---- AB ----
  1249.                         AB.setText("1");
  1250.                         contentPane.add(AB);
  1251.                         AB.setBounds(105, 125, 35, AB.getPreferredSize().height);
  1252.  
  1253.                         // ---- tetx ----
  1254.                         tetx.setText("Antiban Level:");
  1255.                         contentPane.add(tetx);
  1256.                         tetx.setBounds(new Rectangle(new Point(30, 130), tetx
  1257.                                         .getPreferredSize()));
  1258.  
  1259.                         // ---- label3 ----
  1260.                         label3
  1261.                                         .setText("(See bottom for \ninstructions on \nhow to set up)");
  1262.                         contentPane.add(label3);
  1263.                         label3.setBounds(new Rectangle(new Point(180, 50), label3
  1264.                                         .getPreferredSize()));
  1265.  
  1266.                         // ---- UT ----
  1267.                         UT.setText("Use Timer?");
  1268.                         UT.setSelected(true);
  1269.                         UT.addChangeListener(new ChangeListener() {
  1270.                                 public void stateChanged(ChangeEvent e) {
  1271.                                         UTStateChanged();
  1272.                                 }
  1273.                         });
  1274.                         contentPane.add(UT);
  1275.                         UT.setBounds(new Rectangle(new Point(25, 150), UT
  1276.                                         .getPreferredSize()));
  1277.  
  1278.                         // ---- label4 ----
  1279.                         label4.setText("Time To Run: ");
  1280.                         contentPane.add(label4);
  1281.                         label4.setBounds(new Rectangle(new Point(30, 175), label4
  1282.                                         .getPreferredSize()));
  1283.  
  1284.                         // ---- TT ----
  1285.                         TT.setFont(TT.getFont().deriveFont(
  1286.                                         TT.getFont().getStyle() & ~Font.BOLD));
  1287.                         TT.setText("1:0:0");
  1288.                         contentPane.add(TT);
  1289.                         TT.setBounds(100, 170, 55, TT.getPreferredSize().height);
  1290.  
  1291.                         // ---- OpenTrapSetup ----
  1292.                         OpenTrapSetup.setText("Open Trap Setup");
  1293.                         OpenTrapSetup.addActionListener(new ActionListener() {
  1294.                                 public void actionPerformed(ActionEvent e) {
  1295.                                         try {
  1296.                                                 OpenTrapSetupActionPerformed();
  1297.                                         } catch (IllegalMonitorStateException e1) {
  1298.                                                 e1.printStackTrace();
  1299.                                         } catch (InterruptedException e1) {
  1300.                                                 e1.printStackTrace();
  1301.                                         }
  1302.                                 }
  1303.                         });
  1304.                         contentPane.add(OpenTrapSetup);
  1305.                         OpenTrapSetup.setBounds(new Rectangle(new Point(30, 205),
  1306.                                         OpenTrapSetup.getPreferredSize()));
  1307.  
  1308.                         // ---- label12 ----
  1309.                         label12.setText("(MANDATORY)");
  1310.                         label12.setFont(label12.getFont().deriveFont(
  1311.                                         label12.getFont().getStyle() | Font.BOLD));
  1312.                         contentPane.add(label12);
  1313.                         label12.setBounds(new Rectangle(new Point(45, 230), label12
  1314.                                         .getPreferredSize()));
  1315.  
  1316.                         { // compute preferred size
  1317.                                 Dimension preferredSize = new Dimension();
  1318.                                 for (int i = 0; i < contentPane.getComponentCount(); i++) {
  1319.                                         Rectangle bounds = contentPane.getComponent(i).getBounds();
  1320.                                         preferredSize.width = Math.max(bounds.x + bounds.width,
  1321.                                                         preferredSize.width);
  1322.                                         preferredSize.height = Math.max(bounds.y + bounds.height,
  1323.                                                         preferredSize.height);
  1324.                                 }
  1325.                                 Insets insets = contentPane.getInsets();
  1326.                                 preferredSize.width += insets.right;
  1327.                                 preferredSize.height += insets.bottom;
  1328.                                 contentPane.setMinimumSize(preferredSize);
  1329.                                 contentPane.setPreferredSize(preferredSize);
  1330.                         }
  1331.                         setSize(550, 555);
  1332.                         setLocationRelativeTo(getOwner());
  1333.                         // JFormDesigner - End of component initialization
  1334.                         // //GEN-END:initComponents
  1335.                 }
  1336.  
  1337.                 // JFormDesigner - Variables declaration - DO NOT MODIFY
  1338.                 // //GEN-BEGIN:variables
  1339.                 private JLabel label1;
  1340.                 private JLabel label2;
  1341.                 private JComboBox WTH;
  1342.                 private JCheckBox BB;
  1343.                 private JCheckBox CB;
  1344.                 private JLabel label5;
  1345.                 private JLabel label6;
  1346.                 private JLabel label7;
  1347.                 private JLabel label8;
  1348.                 private JLabel label9;
  1349.                 private JScrollPane scrollPane1;
  1350.                 private JTextArea textArea1;
  1351.                 private JLabel label10;
  1352.                 private JLabel label11;
  1353.                 private JTextField BE;
  1354.                 private JTextField RBE;
  1355.                 private JTextField RBF;
  1356.                 private JButton LoadSettings;
  1357.                 private JButton SaveSettings;
  1358.                 private JButton StartButton;
  1359.                 private JTextField BF;
  1360.                 private JTextField AB;
  1361.                 private JLabel tetx;
  1362.                 private JLabel label3;
  1363.                 private JCheckBox UT;
  1364.                 private JLabel label4;
  1365.                 private JTextField TT;
  1366.                 private JButton OpenTrapSetup;
  1367.                 private JLabel label12;
  1368.                 // JFormDesigner - End of variables declaration //GEN-END:variables
  1369.         }
  1370.  
  1371.         @SuppressWarnings("serial")
  1372.         public class FSHuntSelector extends JFrame {
  1373.  
  1374.                 public FSHuntSelector() {
  1375.                         initComponents();
  1376.                 }
  1377.  
  1378.                 private boolean[] getBoxes() {
  1379.                         boolean[] Boxes = { checkBox1.isSelected(), checkBox2.isSelected(),
  1380.                                         checkBox3.isSelected(), checkBox4.isSelected(),
  1381.                                         checkBox5.isSelected(), checkBox6.isSelected(),
  1382.                                         checkBox7.isSelected(), checkBox8.isSelected(),
  1383.                                         checkBox9.isSelected(), checkBox10.isSelected(),
  1384.                                         checkBox11.isSelected(), checkBox12.isSelected(),
  1385.                                         checkBox13.isSelected(), checkBox14.isSelected(),
  1386.                                         checkBox15.isSelected(), checkBox16.isSelected(),
  1387.                                         checkBox17.isSelected(), checkBox18.isSelected(),
  1388.                                         checkBox19.isSelected(), checkBox20.isSelected(),
  1389.                                         checkBox21.isSelected(), checkBox22.isSelected(),
  1390.                                         checkBox23.isSelected(), checkBox24.isSelected(),
  1391.                                         checkBox25.isSelected() };
  1392.                         return Boxes;
  1393.                 }
  1394.  
  1395.                 private int pointToBox(Point WhichPoint) {
  1396.                         switch (WhichPoint.y) {
  1397.                         case 0:
  1398.                                 switch (WhichPoint.x) {
  1399.                                 case 0:
  1400.                                         return 13;
  1401.                                 case 1:
  1402.                                         return 14;
  1403.                                 case 2:
  1404.                                         return 15;
  1405.                                 case -1:
  1406.                                         return 12;
  1407.                                 case -2:
  1408.                                         return 11;
  1409.                                 }
  1410.                         case 1:
  1411.                                 switch (WhichPoint.x) {
  1412.                                 case 0:
  1413.                                         return 8;
  1414.                                 case 1:
  1415.                                         return 9;
  1416.                                 case 2:
  1417.                                         return 10;
  1418.                                 case -1:
  1419.                                         return 7;
  1420.                                 case -2:
  1421.                                         return 5;
  1422.                                 }
  1423.                         case 2:
  1424.                                 switch (WhichPoint.x) {
  1425.                                 case 0:
  1426.                                         return 6;
  1427.                                 case 1:
  1428.                                         return 4;
  1429.                                 case 2:
  1430.                                         return 3;
  1431.                                 case -1:
  1432.                                         return 1;
  1433.                                 case -2:
  1434.                                         return 2;
  1435.                                 }
  1436.                         case -1:
  1437.                                 switch (WhichPoint.x) {
  1438.                                 case 0:
  1439.                                         return 18;
  1440.                                 case 1:
  1441.                                         return 19;
  1442.                                 case 2:
  1443.                                         return 10;
  1444.                                 case -1:
  1445.                                         return 17;
  1446.                                 case -2:
  1447.                                         return 16;
  1448.                                 }
  1449.                         case -2:
  1450.                                 switch (WhichPoint.x) {
  1451.                                 case 0:
  1452.                                         return 23;
  1453.                                 case 1:
  1454.                                         return 24;
  1455.                                 case 2:
  1456.                                         return 25;
  1457.                                 case -1:
  1458.                                         return 22;
  1459.                                 case -2:
  1460.                                         return 21;
  1461.                                 }
  1462.                         default:
  1463.                                 log("Error occured: Error PTBX. Report to Tad_");
  1464.                         }
  1465.                         return -1;
  1466.                 }
  1467.  
  1468.                 private Point boxToPoint(int WhichBox) {
  1469.                         switch (WhichBox) {
  1470.                         case 0:
  1471.                                 return new Point(-1, 2);
  1472.                         case 1:
  1473.                                 return new Point(-2, 2);
  1474.                         case 2:
  1475.                                 return new Point(2, 2);
  1476.                         case 3:
  1477.                                 return new Point(1, 2);
  1478.                         case 4:
  1479.                                 return new Point(-2, 1);
  1480.                         case 5:
  1481.                                 return new Point(0, 2);
  1482.                         case 6:
  1483.                                 return new Point(-1, 1);
  1484.                         case 7:
  1485.                                 return new Point(0, 1);
  1486.                         case 8:
  1487.                                 return new Point(1, 1);
  1488.                         case 9:
  1489.                                 return new Point(2, 1);
  1490.                         case 10:
  1491.                                 return new Point(-2, 0);
  1492.                         case 11:
  1493.                                 return new Point(-1, 0);
  1494.                         case 12:
  1495.                                 return new Point(0, 0);
  1496.                         case 13:
  1497.                                 return new Point(1, 0);
  1498.                         case 14:
  1499.                                 return new Point(2, 0);
  1500.                         case 15:
  1501.                                 return new Point(-2, -1);
  1502.                         case 16:
  1503.                                 return new Point(-1, -1);
  1504.                         case 17:
  1505.                                 return new Point(0, -1);
  1506.                         case 18:
  1507.                                 return new Point(1, -1);
  1508.                         case 19:
  1509.                                 return new Point(2, -1);
  1510.                         case 20:
  1511.                                 return new Point(-2, -2);
  1512.                         case 21:
  1513.                                 return new Point(-1, -2);
  1514.                         case 22:
  1515.                                 return new Point(0, -2);
  1516.                         case 23:
  1517.                                 return new Point(1, -2);
  1518.                         case 24:
  1519.                                 return new Point(2, -2);
  1520.                         default:
  1521.                                 return null;
  1522.                         }
  1523.                 }
  1524.  
  1525.                 public boolean arrayContains(Point[] MyArray, Point LookFor) {
  1526.                         int i;
  1527.                         for (i = 0; i < MyArray.length; i++)
  1528.                                 if (MyArray[i].getX() == LookFor.getX()
  1529.                                                 && MyArray[i].getY() == LookFor.getY())
  1530.                                         return true;
  1531.                         return false;
  1532.                 }
  1533.  
  1534.                 private Point[] addToSpotArray(boolean Boxes[]) {
  1535.                         int i, j = 0, k = 0, l, ArrLength = 0;
  1536.                         Point[] SpotsCopy = null;
  1537.                         if (Spots != null)
  1538.                                 if (Spots.length == 0)
  1539.                                         Spots = null;
  1540.                         if (Spots != null) {
  1541.                                 SpotsCopy = new Point[Spots.length];
  1542.                                 System.arraycopy(Spots, 0, SpotsCopy, 0, Spots.length);
  1543.                         } else
  1544.                                 SpotsCopy = null;
  1545.  
  1546.                         for (i = 0; i < Boxes.length; i++)
  1547.                                 if (Boxes[i])
  1548.                                         ArrLength++;
  1549.                         Spots = new Point[ArrLength];
  1550.                         if (SpotsCopy != null && ArrLength == SpotsCopy.length)
  1551.                                 return SpotsCopy;
  1552.                         for (l = 0; l < Boxes.length; l++) {
  1553.                                 for (i = 0; i < Boxes.length; i++) {
  1554.                                         if (Boxes[i]) {
  1555.                                                 if (SpotsCopy != null && SpotsCopy.length > 0) {
  1556.                                                         if (j >= Spots.length) {
  1557.                                                                 break;
  1558.                                                         }
  1559.                                                         if (k == SpotsCopy.length) {
  1560.                                                                 if (!arrayContains(SpotsCopy, boxToPoint(i))) {
  1561.                                                                         Spots[j] = boxToPoint(i);
  1562.                                                                         j++;
  1563.                                                                 }
  1564.                                                         } else if (SpotsCopy[k] != null) {
  1565.                                                                 if (SpotsCopy[k].getX() == boxToPoint(i).getX()
  1566.                                                                                 && SpotsCopy[k].getY() == boxToPoint(i)
  1567.                                                                                                 .getY()) {
  1568.                                                                         Spots[j] = SpotsCopy[k];
  1569.                                                                         j++;
  1570.                                                                         k++;
  1571.                                                                 }
  1572.                                                         }
  1573.                                                 }
  1574.                                                 if (SpotsCopy == null) {
  1575.                                                         Spots[j] = boxToPoint(i);
  1576.                                                         j++;
  1577.                                                         if (j >= Spots.length)
  1578.                                                                 break;
  1579.                                                 }
  1580.                                         }
  1581.                                 }
  1582.  
  1583.                                 if (SpotsCopy != null)
  1584.                                         if (k >= SpotsCopy.length && j >= Spots.length)
  1585.                                                 break;
  1586.                                 if (j >= Spots.length)
  1587.                                         break;
  1588.                         }
  1589.                         return Spots;
  1590.                 }
  1591.  
  1592.                 private Point[] boxesToPoints(boolean[] Boxes) {
  1593.                         int i, ArrLength = 0;
  1594.  
  1595.                         for (i = 0; i < Boxes.length; i++)
  1596.                                 if (Boxes[i])
  1597.                                         ArrLength++;
  1598.                         if (Spots == null || ArrLength != Spots.length)
  1599.                                 Spots = addToSpotArray(Boxes);
  1600.                         return Spots;
  1601.                 }
  1602.  
  1603.                 private void checkBoxesStateChanged() {
  1604.                         Spots = boxesToPoints(getBoxes());
  1605.                 }
  1606.  
  1607.                 private void resetSpots(boolean BoxesToo) {
  1608.                         Spots = null;
  1609.                         if (BoxesToo)
  1610.                                 for (int i = 0; i <= 24; i++)
  1611.                                         setCheckBox(boxToPoint(i), false);
  1612.                 }
  1613.  
  1614.                 private void LoadButtonActionPerformed() throws IOException {
  1615.                         FileInputStream MyLocs;
  1616.                         String myValue;
  1617.                         int ArrayLength = 0;
  1618.  
  1619.                         try {
  1620.                                 MyLocs = new FileInputStream("FSHunt Locations.txt");
  1621.                         } catch (FileNotFoundException e1) {
  1622.                                 log("Failed loading Locations!");
  1623.                                 return;
  1624.                         }
  1625.  
  1626.                         BufferedReader d = new BufferedReader(new InputStreamReader(MyLocs));
  1627.                         while ((myValue = d.readLine()) != null)
  1628.                                 ArrayLength++;
  1629.                         String[] Values = new String[ArrayLength];
  1630.                         d.close();
  1631.                         MyLocs.close();
  1632.  
  1633.                         try {
  1634.                                 MyLocs = new FileInputStream("FSHunt Locations.txt");
  1635.                         } catch (FileNotFoundException e1) {
  1636.                                 log("Failed loading Locations!");
  1637.                                 return;
  1638.                         }
  1639.                         d = new BufferedReader(new InputStreamReader(MyLocs));
  1640.                         ArrayLength = 0;
  1641.  
  1642.                         while ((myValue = d.readLine()) != null) {
  1643.                                 Values[ArrayLength] = myValue;
  1644.                                 ArrayLength++;
  1645.                         }
  1646.                         String[] XandY = new String[2];
  1647.                         int Temp = 0;
  1648.                         resetSpots(true);
  1649.                         for (String item : Values) {
  1650.                                 XandY = item.split(",");
  1651.                                 setCheckBox(new Point(new Float(XandY[0]).intValue(),
  1652.                                                 new Float(XandY[1]).intValue()), true);
  1653.                         }
  1654.                         resetSpots(false);
  1655.                         Spots = new Point[ArrayLength];
  1656.                         for (String item : Values) {
  1657.                                 XandY = item.split(",");
  1658.                                 Spots[Temp] = new Point(new Float(XandY[0]).intValue(),
  1659.                                                 new Float(XandY[1]).intValue());
  1660.                                 Temp++;
  1661.                                 if (Temp >= Spots.length)
  1662.                                         break;
  1663.                         }
  1664.                         MyLocs.close();
  1665.                         log("Successfully loaded locations");
  1666.                 }
  1667.  
  1668.                 private void setCheckBox(Point myPoint, boolean setTrue) {
  1669.                         int WhichBox = pointToBox(myPoint);
  1670.                         switch (WhichBox) {
  1671.                         case 1:
  1672.                                 checkBox1.setSelected(setTrue);
  1673.                                 break;
  1674.                         case 2:
  1675.                                 checkBox2.setSelected(setTrue);
  1676.                                 break;
  1677.                         case 3:
  1678.                                 checkBox3.setSelected(setTrue);
  1679.                                 break;
  1680.                         case 4:
  1681.                                 checkBox4.setSelected(setTrue);
  1682.                                 break;
  1683.                         case 5:
  1684.                                 checkBox5.setSelected(setTrue);
  1685.                                 break;
  1686.                         case 6:
  1687.                                 checkBox6.setSelected(setTrue);
  1688.                                 break;
  1689.                         case 7:
  1690.                                 checkBox7.setSelected(setTrue);
  1691.                                 break;
  1692.                         case 8:
  1693.                                 checkBox8.setSelected(setTrue);
  1694.                                 break;
  1695.                         case 9:
  1696.                                 checkBox9.setSelected(setTrue);
  1697.                                 break;
  1698.                         case 10:
  1699.                                 checkBox10.setSelected(setTrue);
  1700.                                 break;
  1701.                         case 11:
  1702.                                 checkBox11.setSelected(setTrue);
  1703.                                 break;
  1704.                         case 12:
  1705.                                 checkBox12.setSelected(setTrue);
  1706.                                 break;
  1707.                         case 13:
  1708.                                 checkBox13.setSelected(setTrue);
  1709.                                 break;
  1710.                         case 14:
  1711.                                 checkBox14.setSelected(setTrue);
  1712.                                 break;
  1713.                         case 15:
  1714.                                 checkBox15.setSelected(setTrue);
  1715.                                 break;
  1716.                         case 16:
  1717.                                 checkBox16.setSelected(setTrue);
  1718.                                 break;
  1719.                         case 17:
  1720.                                 checkBox17.setSelected(setTrue);
  1721.                                 break;
  1722.                         case 18:
  1723.                                 checkBox18.setSelected(setTrue);
  1724.                                 break;
  1725.                         case 19:
  1726.                                 checkBox19.setSelected(setTrue);
  1727.                                 break;
  1728.                         case 20:
  1729.                                 checkBox20.setSelected(setTrue);
  1730.                                 break;
  1731.                         case 21:
  1732.                                 checkBox21.setSelected(setTrue);
  1733.                                 break;
  1734.                         case 22:
  1735.                                 checkBox22.setSelected(setTrue);
  1736.                                 break;
  1737.                         case 23:
  1738.                                 checkBox23.setSelected(setTrue);
  1739.                                 break;
  1740.                         case 24:
  1741.                                 checkBox24.setSelected(setTrue);
  1742.                                 break;
  1743.                         case 25:
  1744.                                 checkBox25.setSelected(setTrue);
  1745.                                 break;
  1746.                         default:
  1747.                                 log("Something went wrong. Error CBSX. Alert Tad_");
  1748.                         }
  1749.  
  1750.                 }
  1751.  
  1752.                 private void SaveButtonActionPerformed() throws IOException {
  1753.                         FileOutputStream MyLocs;
  1754.                         int i;
  1755.                         try {
  1756.                                 MyLocs = new FileOutputStream("FSHunt Locations.txt");
  1757.                         } catch (FileNotFoundException e1) {
  1758.                                 log("Failed saving Locations!");
  1759.                                 return;
  1760.                         }
  1761.                         for (i = 0; i < Spots.length; i++)
  1762.                                 new PrintStream(MyLocs).println(Spots[i].getX() + ","
  1763.                                                 + Spots[i].getY());
  1764.                         MyLocs.close();
  1765.                         log("Locations Saved");
  1766.                 }
  1767.  
  1768.                 private void StartButtonActionPerformed() {
  1769.                         KeepOGUI = false;
  1770.                         dispose();
  1771.                 }
  1772.  
  1773.                 private void ResetActionPerformed() {
  1774.                         resetSpots(true);
  1775.                 }
  1776.  
  1777.                 private void initComponents() {
  1778.                         // JFormDesigner - Component initialization - DO NOT MODIFY
  1779.                         // //GEN-BEGIN:initComponents
  1780.                         checkBox1 = new JCheckBox();
  1781.                         checkBox2 = new JCheckBox();
  1782.                         checkBox3 = new JCheckBox();
  1783.                         checkBox4 = new JCheckBox();
  1784.                         checkBox5 = new JCheckBox();
  1785.                         checkBox6 = new JCheckBox();
  1786.                         checkBox7 = new JCheckBox();
  1787.                         checkBox8 = new JCheckBox();
  1788.                         checkBox9 = new JCheckBox();
  1789.                         checkBox10 = new JCheckBox();
  1790.                         checkBox11 = new JCheckBox();
  1791.                         checkBox12 = new JCheckBox();
  1792.                         checkBox13 = new JCheckBox();
  1793.                         checkBox14 = new JCheckBox();
  1794.                         checkBox15 = new JCheckBox();
  1795.                         checkBox16 = new JCheckBox();
  1796.                         checkBox17 = new JCheckBox();
  1797.                         checkBox18 = new JCheckBox();
  1798.                         checkBox19 = new JCheckBox();
  1799.                         checkBox20 = new JCheckBox();
  1800.                         checkBox21 = new JCheckBox();
  1801.                         checkBox22 = new JCheckBox();
  1802.                         checkBox23 = new JCheckBox();
  1803.                         checkBox24 = new JCheckBox();
  1804.                         checkBox25 = new JCheckBox();
  1805.                         label1 = new JLabel();
  1806.                         scrollPane1 = new JScrollPane();
  1807.                         textArea1 = new JTextArea();
  1808.                         LoadButton = new JButton();
  1809.                         SaveButton = new JButton();
  1810.                         StartButton = new JButton();
  1811.                         label2 = new JLabel();
  1812.                         Reset = new JButton();
  1813.  
  1814.                         // ======== this ========
  1815.                         setAlwaysOnTop(true);
  1816.                         setTitle("FSHunt Placement Selector");
  1817.                         Container contentPane = getContentPane();
  1818.                         contentPane.setLayout(null);
  1819.  
  1820.                         // ---- checkBox1 ----
  1821.                         checkBox1.addChangeListener(new ChangeListener() {
  1822.                                 public void stateChanged(ChangeEvent e) {
  1823.                                         checkBoxesStateChanged();
  1824.                                 }
  1825.                         });
  1826.                         contentPane.add(checkBox1);
  1827.                         checkBox1.setBounds(new Rectangle(new Point(65, 85), checkBox1
  1828.                                         .getPreferredSize()));
  1829.  
  1830.                         // ---- checkBox2 ----
  1831.                         checkBox2.addChangeListener(new ChangeListener() {
  1832.                                 public void stateChanged(ChangeEvent e) {
  1833.                                         checkBoxesStateChanged();
  1834.                                 }
  1835.                         });
  1836.                         contentPane.add(checkBox2);
  1837.                         checkBox2.setBounds(45, 85, 21, 21);
  1838.  
  1839.                         // ---- checkBox3 ----
  1840.                         checkBox3.addChangeListener(new ChangeListener() {
  1841.                                 public void stateChanged(ChangeEvent e) {
  1842.                                         checkBoxesStateChanged();
  1843.                                 }
  1844.                         });
  1845.                         contentPane.add(checkBox3);
  1846.                         checkBox3.setBounds(125, 85, 21, 21);
  1847.  
  1848.                         // ---- checkBox4 ----
  1849.                         checkBox4.addChangeListener(new ChangeListener() {
  1850.                                 public void stateChanged(ChangeEvent e) {
  1851.                                         checkBoxesStateChanged();
  1852.                                 }
  1853.                         });
  1854.                         contentPane.add(checkBox4);
  1855.                         checkBox4.setBounds(105, 85, 21, 21);
  1856.  
  1857.                         // ---- checkBox5 ----
  1858.                         checkBox5.addChangeListener(new ChangeListener() {
  1859.                                 public void stateChanged(ChangeEvent e) {
  1860.                                         checkBoxesStateChanged();
  1861.                                 }
  1862.                         });
  1863.                         contentPane.add(checkBox5);
  1864.                         checkBox5.setBounds(45, 105, 21, 21);
  1865.  
  1866.                         // ---- checkBox6 ----
  1867.                         checkBox6.addChangeListener(new ChangeListener() {
  1868.                                 public void stateChanged(ChangeEvent e) {
  1869.                                         checkBoxesStateChanged();
  1870.                                 }
  1871.                         });
  1872.                         contentPane.add(checkBox6);
  1873.                         checkBox6.setBounds(85, 85, 21, 21);
  1874.  
  1875.                         // ---- checkBox7 ----
  1876.                         checkBox7.addChangeListener(new ChangeListener() {
  1877.                                 public void stateChanged(ChangeEvent e) {
  1878.                                         checkBoxesStateChanged();
  1879.                                 }
  1880.                         });
  1881.                         contentPane.add(checkBox7);
  1882.                         checkBox7.setBounds(65, 105, 21, 21);
  1883.  
  1884.                         // ---- checkBox8 ----
  1885.                         checkBox8.addChangeListener(new ChangeListener() {
  1886.                                 public void stateChanged(ChangeEvent e) {
  1887.                                         checkBoxesStateChanged();
  1888.                                 }
  1889.                         });
  1890.                         contentPane.add(checkBox8);
  1891.                         checkBox8.setBounds(85, 105, 21, 21);
  1892.  
  1893.                         // ---- checkBox9 ----
  1894.                         checkBox9.addChangeListener(new ChangeListener() {
  1895.                                 public void stateChanged(ChangeEvent e) {
  1896.                                         checkBoxesStateChanged();
  1897.                                 }
  1898.                         });
  1899.                         contentPane.add(checkBox9);
  1900.                         checkBox9.setBounds(105, 105, 21, 21);
  1901.  
  1902.                         // ---- checkBox10 ----
  1903.                         checkBox10.addChangeListener(new ChangeListener() {
  1904.                                 public void stateChanged(ChangeEvent e) {
  1905.                                         checkBoxesStateChanged();
  1906.                                 }
  1907.                         });
  1908.                         contentPane.add(checkBox10);
  1909.                         checkBox10.setBounds(125, 105, 21, 21);
  1910.  
  1911.                         // ---- checkBox11 ----
  1912.                         checkBox11.addChangeListener(new ChangeListener() {
  1913.                                 public void stateChanged(ChangeEvent e) {
  1914.                                         checkBoxesStateChanged();
  1915.                                 }
  1916.                         });
  1917.                         contentPane.add(checkBox11);
  1918.                         checkBox11.setBounds(45, 125, 21, 21);
  1919.  
  1920.                         // ---- checkBox12 ----
  1921.                         checkBox12.addChangeListener(new ChangeListener() {
  1922.                                 public void stateChanged(ChangeEvent e) {
  1923.                                         checkBoxesStateChanged();
  1924.                                 }
  1925.                         });
  1926.                         contentPane.add(checkBox12);
  1927.                         checkBox12.setBounds(65, 125, 21, 21);
  1928.  
  1929.                         // ---- checkBox13 ----
  1930.                         checkBox13.addChangeListener(new ChangeListener() {
  1931.                                 public void stateChanged(ChangeEvent e) {
  1932.                                         checkBoxesStateChanged();
  1933.                                 }
  1934.                         });
  1935.                         contentPane.add(checkBox13);
  1936.                         checkBox13.setBounds(85, 125, 21, 21);
  1937.  
  1938.                         // ---- checkBox14 ----
  1939.                         checkBox14.addChangeListener(new ChangeListener() {
  1940.                                 public void stateChanged(ChangeEvent e) {
  1941.                                         checkBoxesStateChanged();
  1942.                                 }
  1943.                         });
  1944.                         contentPane.add(checkBox14);
  1945.                         checkBox14.setBounds(105, 125, 21, 21);
  1946.  
  1947.                         // ---- checkBox15 ----
  1948.                         checkBox15.addChangeListener(new ChangeListener() {
  1949.                                 public void stateChanged(ChangeEvent e) {
  1950.                                         checkBoxesStateChanged();
  1951.                                 }
  1952.                         });
  1953.                         contentPane.add(checkBox15);
  1954.                         checkBox15.setBounds(125, 125, 21, 21);
  1955.  
  1956.                         // ---- checkBox16 ----
  1957.                         checkBox16.addChangeListener(new ChangeListener() {
  1958.                                 public void stateChanged(ChangeEvent e) {
  1959.                                         checkBoxesStateChanged();
  1960.                                 }
  1961.                         });
  1962.                         contentPane.add(checkBox16);
  1963.                         checkBox16.setBounds(45, 145, 21, 21);
  1964.  
  1965.                         // ---- checkBox17 ----
  1966.                         checkBox17.addChangeListener(new ChangeListener() {
  1967.                                 public void stateChanged(ChangeEvent e) {
  1968.                                         checkBoxesStateChanged();
  1969.                                 }
  1970.                         });
  1971.                         contentPane.add(checkBox17);
  1972.                         checkBox17.setBounds(65, 145, 21, 21);
  1973.  
  1974.                         // ---- checkBox18 ----
  1975.                         checkBox18.addChangeListener(new ChangeListener() {
  1976.                                 public void stateChanged(ChangeEvent e) {
  1977.                                         checkBoxesStateChanged();
  1978.                                 }
  1979.                         });
  1980.                         contentPane.add(checkBox18);
  1981.                         checkBox18.setBounds(85, 145, 21, 21);
  1982.  
  1983.                         // ---- checkBox19 ----
  1984.                         checkBox19.addChangeListener(new ChangeListener() {
  1985.                                 public void stateChanged(ChangeEvent e) {
  1986.                                         checkBoxesStateChanged();
  1987.                                 }
  1988.                         });
  1989.                         contentPane.add(checkBox19);
  1990.                         checkBox19.setBounds(105, 145, 21, 21);
  1991.  
  1992.                         // ---- checkBox20 ----
  1993.                         checkBox20.addChangeListener(new ChangeListener() {
  1994.                                 public void stateChanged(ChangeEvent e) {
  1995.                                         checkBoxesStateChanged();
  1996.                                 }
  1997.                         });
  1998.                         contentPane.add(checkBox20);
  1999.                         checkBox20.setBounds(125, 145, 21, 21);
  2000.  
  2001.                         // ---- checkBox21 ----
  2002.                         checkBox21.addChangeListener(new ChangeListener() {
  2003.                                 public void stateChanged(ChangeEvent e) {
  2004.                                         checkBoxesStateChanged();
  2005.                                 }
  2006.                         });
  2007.                         contentPane.add(checkBox21);
  2008.                         checkBox21.setBounds(45, 165, 21, 21);
  2009.  
  2010.                         // ---- checkBox22 ----
  2011.                         checkBox22.addChangeListener(new ChangeListener() {
  2012.                                 public void stateChanged(ChangeEvent e) {
  2013.                                         checkBoxesStateChanged();
  2014.                                 }
  2015.                         });
  2016.                         contentPane.add(checkBox22);
  2017.                         checkBox22.setBounds(65, 165, 21, 21);
  2018.  
  2019.                         // ---- checkBox23 ----
  2020.                         checkBox23.addChangeListener(new ChangeListener() {
  2021.                                 public void stateChanged(ChangeEvent e) {
  2022.                                         checkBoxesStateChanged();
  2023.                                 }
  2024.                         });
  2025.                         contentPane.add(checkBox23);
  2026.                         checkBox23.setBounds(85, 165, 21, 21);
  2027.  
  2028.                         // ---- checkBox24 ----
  2029.                         checkBox24.addChangeListener(new ChangeListener() {
  2030.                                 public void stateChanged(ChangeEvent e) {
  2031.                                         checkBoxesStateChanged();
  2032.                                 }
  2033.                         });
  2034.                         contentPane.add(checkBox24);
  2035.                         checkBox24.setBounds(105, 165, 21, 21);
  2036.  
  2037.                         // ---- checkBox25 ----
  2038.                         checkBox25.addChangeListener(new ChangeListener() {
  2039.                                 public void stateChanged(ChangeEvent e) {
  2040.                                         checkBoxesStateChanged();
  2041.                                 }
  2042.                         });
  2043.                         contentPane.add(checkBox25);
  2044.                         checkBox25.setBounds(125, 165, 21, 21);
  2045.  
  2046.                         // ---- label1 ----
  2047.                         label1.setText("Placement Selector");
  2048.                         label1.setFont(new Font("Segoe Print", Font.BOLD, 18));
  2049.                         contentPane.add(label1);
  2050.                         label1.setBounds(new Rectangle(new Point(225, 15), label1
  2051.                                         .getPreferredSize()));
  2052.  
  2053.                         // ======== scrollPane1 ========
  2054.                         {
  2055.  
  2056.                                 // ---- textArea1 ----
  2057.                                 textArea1
  2058.                                                 .setText("Here you can select how you wish the bot to set the\ntraps.\n\nThe center check box is your original position (when you\nstart the script). Based on that, check, IN ORDER, how\nyou wish to prioritize your trap placing. For best\nresults, check all of the boxes (again, in the order you\nwish to prioritize)");
  2059.                                 scrollPane1.setViewportView(textArea1);
  2060.                         }
  2061.                         contentPane.add(scrollPane1);
  2062.                         scrollPane1.setBounds(new Rectangle(new Point(185, 70), scrollPane1
  2063.                                         .getPreferredSize()));
  2064.  
  2065.                         // ---- LoadButton ----
  2066.                         LoadButton.setText("Load Settings");
  2067.                         LoadButton.addActionListener(new ActionListener() {
  2068.                                 public void actionPerformed(ActionEvent e) {
  2069.                                         try {
  2070.                                                 LoadButtonActionPerformed();
  2071.                                         } catch (IOException e1) {
  2072.                                                 e1.printStackTrace();
  2073.                                         }
  2074.                                 }
  2075.                         });
  2076.                         contentPane.add(LoadButton);
  2077.                         LoadButton.setBounds(new Rectangle(new Point(45, 205), LoadButton
  2078.                                         .getPreferredSize()));
  2079.  
  2080.                         // ---- SaveButton ----
  2081.                         SaveButton.setText("Save Settings");
  2082.                         SaveButton.addActionListener(new ActionListener() {
  2083.                                 public void actionPerformed(ActionEvent e) {
  2084.                                         try {
  2085.                                                 SaveButtonActionPerformed();
  2086.                                         } catch (IOException e1) {
  2087.                                                 e1.printStackTrace();
  2088.                                         }
  2089.                                 }
  2090.                         });
  2091.                         contentPane.add(SaveButton);
  2092.                         SaveButton.setBounds(new Rectangle(new Point(45, 230), SaveButton
  2093.                                         .getPreferredSize()));
  2094.  
  2095.                         // ---- StartButton ----
  2096.                         StartButton.setText("Continue");
  2097.                         StartButton.addActionListener(new ActionListener() {
  2098.                                 public void actionPerformed(ActionEvent e) {
  2099.                                         StartButtonActionPerformed();
  2100.                                 }
  2101.                         });
  2102.                         contentPane.add(StartButton);
  2103.                         StartButton.setBounds(515, 230, 100, 40);
  2104.  
  2105.                         // ---- label2 ----
  2106.                         label2.setText("Don't close with the X ^. Use the button below.");
  2107.                         contentPane.add(label2);
  2108.                         label2.setBounds(new Rectangle(new Point(425, 5), label2
  2109.                                         .getPreferredSize()));
  2110.  
  2111.                         // ---- Reset ----
  2112.                         Reset.setText("Reset");
  2113.                         Reset.addActionListener(new ActionListener() {
  2114.                                 public void actionPerformed(ActionEvent e) {
  2115.                                         ResetActionPerformed();
  2116.                                 }
  2117.                         });
  2118.                         contentPane.add(Reset);
  2119.                         Reset.setBounds(new Rectangle(new Point(65, 60), Reset
  2120.                                         .getPreferredSize()));
  2121.  
  2122.                         { // compute preferred size
  2123.                                 Dimension preferredSize = new Dimension();
  2124.                                 for (int i = 0; i < contentPane.getComponentCount(); i++) {
  2125.                                         Rectangle bounds = contentPane.getComponent(i).getBounds();
  2126.                                         preferredSize.width = Math.max(bounds.x + bounds.width,
  2127.                                                         preferredSize.width);
  2128.                                         preferredSize.height = Math.max(bounds.y + bounds.height,
  2129.                                                         preferredSize.height);
  2130.                                 }
  2131.                                 Insets insets = contentPane.getInsets();
  2132.                                 preferredSize.width += insets.right;
  2133.                                 preferredSize.height += insets.bottom;
  2134.                                 contentPane.setMinimumSize(preferredSize);
  2135.                                 contentPane.setPreferredSize(preferredSize);
  2136.                         }
  2137.                         pack();
  2138.                         setLocationRelativeTo(getOwner());
  2139.                         // JFormDesigner - End of component initialization
  2140.                         // //GEN-END:initComponents
  2141.                 }
  2142.  
  2143.                 // JFormDesigner - Variables declaration - DO NOT MODIFY
  2144.                 // //GEN-BEGIN:variables
  2145.                 private JCheckBox checkBox1;
  2146.                 private JCheckBox checkBox2;
  2147.                 private JCheckBox checkBox3;
  2148.                 private JCheckBox checkBox4;
  2149.                 private JCheckBox checkBox5;
  2150.                 private JCheckBox checkBox6;
  2151.                 private JCheckBox checkBox7;
  2152.                 private JCheckBox checkBox8;
  2153.                 private JCheckBox checkBox9;
  2154.                 private JCheckBox checkBox10;
  2155.                 private JCheckBox checkBox11;
  2156.                 private JCheckBox checkBox12;
  2157.                 private JCheckBox checkBox13;
  2158.                 private JCheckBox checkBox14;
  2159.                 private JCheckBox checkBox15;
  2160.                 private JCheckBox checkBox16;
  2161.                 private JCheckBox checkBox17;
  2162.                 private JCheckBox checkBox18;
  2163.                 private JCheckBox checkBox19;
  2164.                 private JCheckBox checkBox20;
  2165.                 private JCheckBox checkBox21;
  2166.                 private JCheckBox checkBox22;
  2167.                 private JCheckBox checkBox23;
  2168.                 private JCheckBox checkBox24;
  2169.                 private JCheckBox checkBox25;
  2170.                 private JLabel label1;
  2171.                 private JScrollPane scrollPane1;
  2172.                 private JTextArea textArea1;
  2173.                 private JButton LoadButton;
  2174.                 private JButton SaveButton;
  2175.                 private JButton StartButton;
  2176.                 private JLabel label2;
  2177.                 private JButton Reset;
  2178.                 // JFormDesigner - End of variables declaration //GEN-END:variables
  2179.         }
  2180.  
  2181. }