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

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 20.23 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 impsoft.bots.ColorBot;
  2. import impsoft.bots.input.KeyboardCommand;
  3. import impsoft.bots.input.MouseCommand;
  4. import impsoft.bots.reflection.NPC;
  5. import impsoft.bots.reflection.PhysicalObject;
  6. import impsoft.bots.reflection.WorldObject;
  7. import impsoft.scripting.ibot.builtin.itemrec.ItemSlot;
  8. import impsoft.scripting.ibot.builtin.ocr.NPCChat;
  9. import impsoft.scripting.ibot.builtin.tabs.InventoryTab;
  10. import impsoft.scripting.ibot.enums.Skill;
  11. import impsoft.scripting.ibot.interfaces.AutoPaint;
  12. import impsoft.scripting.ibot.itemrec.ItemNameExact;
  13. import impsoft.scripting.ibot.structs.AryanTile;
  14. import impsoft.scripting.types.ColorScript;
  15. import impsoft.scripting.types.ColorSkeltonScriptable;
  16. import impsoft.scripting.types.parallel.scriptjobs.RepeatableScriptJob;
  17. import impsoft.scripting.types.parallel.scriptjobs.ScriptJob;
  18. import impsoft.utils.general.Timer;
  19. import impsoft.utils.ibot.RandomGenerator;
  20. import impsoft.utils.uber.UberClickOptions;
  21. import impsoft.utils.uber.UberScriptUtils;
  22. import impsoft.values.constant.Areas;
  23. import impsoft.values.variable.SettingsManager;
  24.  
  25. import java.awt.*;
  26. import java.awt.event.KeyEvent;
  27. import java.text.DecimalFormat;
  28. import java.util.EnumSet;
  29. import java.util.regex.Pattern;
  30.  
  31. import javax.swing.*;
  32.  
  33. public class Cooker extends ColorScript implements AutoPaint {
  34.  
  35.         public Cooker(ColorBot c) {
  36.                 super(c);
  37.         }
  38.  
  39.         public static void setFood(final Cooking c) {
  40.                 selected = c;
  41.         }
  42.  
  43.         public static void setLocation(final CookingLocations c) {
  44.                 currentCookingLocation = c;
  45.         }
  46.  
  47.         private boolean hover = false;
  48.         private NPCChat chat;
  49.         private static Cooking selected;
  50.         private static CookingLocations currentCookingLocation = CookingLocations.ROGUE_DEN;
  51.         private final InventoryTab tab = new InventoryTab(this);
  52.         private final CookerMethods method = new CookerMethods(this);
  53.         private final CookerUIV2 GUI = new CookerUIV2();
  54.         private final Rectangle cookAll = new Rectangle(246, 398, 39, 36);
  55.         private State botState = State.GET_STATE;
  56.         private String status = "";
  57.  
  58.         private enum State {
  59.                 GET_STATE, COOK, BANK
  60.         }
  61.  
  62.         private final RenderingHints antialiasing = new RenderingHints(
  63.                         RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  64.  
  65.         private final Color color1 = new Color(0, 0, 0, 169);
  66.         private final Color color2 = new Color(0, 0, 0);
  67.         private final Color color3 = new Color(255, 255, 255);
  68.         private final Color color4 = new Color(204, 51, 0, 219);
  69.  
  70.         private final BasicStroke stroke1 = new BasicStroke(1);
  71.  
  72.         private final Font font1 = new Font("Arial", 0, 12);
  73.         private final Font font2 = new Font("Arial", 0, 11);
  74.  
  75.         private final DecimalFormat df = new DecimalFormat("0.00");
  76.         private double seconds;
  77.  
  78.         private final int getXTL() {
  79.                 return xpLevels[currentLv + 1] - currentXp;
  80.         }
  81.  
  82.         private final int getXTTL() {
  83.                 return xpLevels[currentLv + 1] - xpLevels[currentLv];
  84.         }
  85.  
  86.         private final int[] xpLevels = { 0, 0, 83, 174, 276, 388, 512, 650, 801,
  87.                         969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973,
  88.                         4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031,
  89.                         13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408,
  90.                         33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127,
  91.                         83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636,
  92.                         184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599,
  93.                         407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445,
  94.                         899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200,
  95.                         1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594,
  96.                         3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253,
  97.                         7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431,
  98.                         200000000 };
  99.  
  100.         private int cooked = 0;
  101.         private int currentLv = 0;
  102.         private int startLv = 0;
  103.         private int currentXp = 0;
  104.         private int startXp = 0;
  105.         private Timer timer = new Timer(0);
  106.  
  107.         @Override
  108.         public void paint(Graphics render) {
  109.                 seconds = timer.getTimeElapsed() / 1000.00D;
  110.                 Graphics2D g = (Graphics2D) render;
  111.                 g.setRenderingHints(antialiasing);
  112.                 if (fire != null && fire.getGameScreenLocation() != null) {
  113.                         g.setColor(new Color(255, 51, 0, 125));
  114.                         g.fillPolygon(fire.getGameScreenLocation(41, -48, 56, -45, 0, 0));
  115.                 }
  116.                 if (emerald != null && emerald.getGameScreenLocation() != null) {
  117.                         g.setColor(Color.black);
  118.                         g.drawPolygon(emerald.getGameScreenLocationSmaller());
  119.                 }
  120.                 g.setColor(color1);
  121.                 g.fillRoundRect(13, 349, 200, 100, 16, 16);
  122.                 g.setColor(color2);
  123.                 g.setStroke(stroke1);
  124.                 g.drawRoundRect(13, 349, 200, 100, 16, 16);
  125.                 g.setFont(font1);
  126.                 g.setColor(color3);
  127.                 g.drawString("CSCooker", 23, 367);
  128.                 g.setFont(font2);
  129.                 g.drawString("Timer: " + timer.toStringTimeElapsed(), 25, 380);
  130.                 g.drawString("Experience Gained: " + (currentXp - startXp), 25, 390);
  131.                 if (seconds != 0)
  132.                         g.drawString("Experience Gained/hr: "
  133.                                         + df.format(((currentXp - startXp) * 3600) / seconds), 25,
  134.                                         400);
  135.                 else
  136.                         g.drawString("Experience Gained/hr: 0.00", 25, 400);
  137.                 g.drawString("Fish Cooked: " + cooked, 25, 410);
  138.                 if (seconds != 0)
  139.                         g.drawString("Fish Cooked/hr: "
  140.                                         + df.format((cooked * 3600) / seconds), 25, 420);
  141.                 else
  142.                         g.drawString("Fish Cooked/hr: 0.00", 25, 420);
  143.                 g.drawString("Status: " + status, 25, 430);
  144.                 g.setColor(color4);
  145.                 g.fillRoundRect(25, 435, 186, 12, 16, 16);
  146.                 g.setColor(Color.green);
  147.                 g.fillRoundRect(25, 435,
  148.                                 (int) ((1.00f - ((float) getXTL() / (float) getXTTL())) * 186),
  149.                                 12, 16, 16);
  150.                 g.setFont(new Font("Bodoni MT", 2, 16));
  151.                 g.setColor(Color.white);
  152.                 g.drawString("V" + version, 160, 367);
  153.  
  154.                 g.setColor(new Color(0, 0, 0, 185));
  155.                 g.fillRect(399, 300, 106, 14);
  156.                 g.setColor(Color.black);
  157.                 g.drawRect(399, 300, 106, 14);
  158.                 g.setFont(new Font("Arial", 0, 10));
  159.                 g.setColor(Color.white);
  160.                 if (bankTimer != null)
  161.                         g.drawString("Bank timer: " + bankTimer.getTimeElapsed(), 402, 310);
  162.                 else
  163.                         g.drawString("Bank timer: 0", 402, 310);
  164.  
  165.         }
  166.  
  167.         private NPC emerald;
  168.         private PhysicalObject fire;
  169.         private ItemSlot fish;
  170.         private int fail = 0;
  171.  
  172.         @Override
  173.         public void script() {
  174.                 try {
  175.                         while (!isLoggedIn())
  176.                                 sleep(1000);
  177.                         addScriptJob(new RepeatableScriptJob(this) {
  178.                                 public long runL() throws InterruptedException {
  179.                                         SettingsManager.setMouseSpeedLong(RandomGenerator
  180.                                                         .randomNormalDouble(1.2, 1.7));
  181.                                         return random(70000, 200000);
  182.                                 }
  183.                         });
  184.                         startLv = theTabs.Statistics.getStatBottom(Skill.COOKING);
  185.                         startXp = theTabs.Statistics.getStatExperience(Skill.COOKING);
  186.                         currentLv = startLv;
  187.                         currentXp = startXp;
  188.                         GUI.setVisible(true);
  189.                         while (GUI.isVisible())
  190.                                 sleep(1000);
  191.                         log("GUI Finished, starting script");
  192.                         timer.reset();
  193.                         while (true) {
  194.                                 if (fire == null) {
  195.                                         log("Finding the fire.");
  196.                                         fire = method.getPOOnTile(new AryanTile(103043, 104973));
  197.                                 }
  198.                                 if (fail >= 10)
  199.                                         method.logOff("Too many fails.");
  200.                                 s: switch (botState) {
  201.                                 case GET_STATE:
  202.                                         botState = getState(selected);
  203.                                         break;
  204.                                 case COOK:
  205.                                         if (theBank.isInterfaceUp())
  206.                                                 theBank.exit();
  207.                                         cooking: while (method.tab()) {
  208.                                                 if (theTabs.Inventory.count("Raw") == 0) {
  209.                                                         botState = State.COOK;
  210.                                                         break s;
  211.                                                 }
  212.                                                 clickFire();
  213.                                                 while (isMoving())
  214.                                                         sleep(100, 200);
  215.                                                 if (!theNPCChatFinder.isNPCChatUp())
  216.                                                         continue cooking;
  217.                                                 if (theTopText.getTopText().contains("ook"))
  218.                                                         mouseClickRight(getCurrentMouseXY());
  219.                                                 else {
  220.                                                         mouseMove(cookAll);
  221.                                                         sleep(125, 250);
  222.                                                         if (theTopText.getTopText().contains("ook"))
  223.                                                                 mouseClickRight(getCurrentMouseXY());
  224.                                                         else
  225.                                                                 continue cooking;
  226.                                                 }
  227.                                                 status = "Waiting for NPC Chat";
  228.                                                 for (int i = 0; i < 10 && !theMenuFinder.isMenuUp(); i++)
  229.                                                         sleep(90, 130);
  230.                                                 boolean moved = hover && random(1, 7) == 5;
  231.                                                 if (theMenuFinder.doMenu("Cook All")) {
  232.                                                         sleep(3000);
  233.                                                         while (method.tab()) {
  234.                                                                 status = "Cooking";
  235.                                                                 forLoop: for (int i = 0; i < 10;) {
  236.                                                                         if (theNPCChatFinder.isNPCChatUp()
  237.                                                                                         && (chat = theNPCChatFinder
  238.                                                                                                         .getNPCChat())
  239.                                                                                                         .contains("Click here")) {
  240.                                                                                 if (chat.contains("ched level"))
  241.                                                                                         log("Level up");
  242.                                                                                 chat.selectContains("Click here");
  243.                                                                                 waitTillNPCChatChangesFrom(chat);
  244.                                                                                 continue forLoop;
  245.                                                                         }
  246.                                                                         method.tab();
  247.                                                                         sleep(400, 600);
  248.                                                                         if (theTabs.Inventory.count("Raw") == 0) {
  249.                                                                                 botState = State.BANK;
  250.                                                                                 break s;
  251.                                                                         }
  252.                                                                         sleep(190, 230);
  253.                                                                         cooked = (int) ((currentXp - startXp) / selected
  254.                                                                                         .getExperience());
  255.                                                                         currentLv = theTabs.Statistics
  256.                                                                                         .getStatBottom(Skill.COOKING);
  257.                                                                         currentXp = theTabs.Statistics
  258.                                                                                         .getStatExperience(Skill.COOKING);
  259.                                                                         if (getAnimation() == -1)
  260.                                                                                 i++;
  261.                                                                         if (!moved
  262.                                                                                         && tab.count(selected.getName()) <= random(
  263.                                                                                                         3, 5)) {
  264.                                                                                 if (emerald != null
  265.                                                                                                 && emerald
  266.                                                                                                                 .getGameScreenLocation() != null) {
  267.                                                                                         mouseClickRight(emerald
  268.                                                                                                         .getRecommendPointToClick());
  269.                                                                                         sleep(200, 800);
  270.                                                                                         enterCommand(MouseCommand.Move(
  271.                                                                                                         getPriority(), Thread
  272.                                                                                                                         .currentThread(),
  273.                                                                                                         getCurrentMouseX()
  274.                                                                                                                         + random(2, 7),
  275.                                                                                                         getCurrentMouseY()
  276.                                                                                                                         + random(20, 32)));
  277.                                                                                         moved = true;
  278.                                                                                 }
  279.                                                                         }
  280.                                                                 }
  281.                                                                 sleep(500, 800);
  282.                                                                 if (tab.count(selected.getName()) == 0)
  283.                                                                         break cooking;
  284.                                                                 method.antiban();
  285.                                                         }
  286.                                                 } else
  287.                                                         continue cooking;
  288.                                         }
  289.                                         botState = State.BANK;
  290.                                         break;
  291.                                 case BANK:
  292.                                         status = "Banking";
  293.                                         while (true) {
  294.                                                 openBank();
  295.                                                 bankTimer = new Timer(4000);
  296.                                                 while (bankTimer.isNotUp() && !theBank.isInterfaceUp())
  297.                                                         sleep(100, 250);
  298.                                                 if (bankTimer.isUp())
  299.                                                         continue;
  300.                                                 bankTimer = null;
  301.                                                 status = "Depositing items";
  302.                                                 if (theBank.isInterfaceUp())
  303.                                                         theBank.doDepositAll();
  304.                                                 else
  305.                                                         continue;
  306.                                                 status = "Withdrawing items";
  307.                                                 if (theBank.isInterfaceUp())
  308.                                                         theBank.doWithDrawAll(selected.getName(), true);
  309.                                                 else
  310.                                                         continue;
  311.                                                 break;
  312.                                         }
  313.                                         botState = State.COOK;
  314.                                         break;
  315.                                 }
  316.                         }
  317.                 } catch (final InterruptedException e) {
  318.  
  319.                 }
  320.         }
  321.  
  322.         private Timer bankTimer;
  323.  
  324.         private void clickFire() throws InterruptedException {
  325.                 cooking: while (true) {
  326.                         if (theNPCChatFinder.isNPCChatUp())
  327.                                 break cooking;
  328.                         fish = tab.findSlot(new ItemNameExact(selected.getName()));
  329.                         if (fish != null) {
  330.                                 if (!tab.isAItemSelected()) {
  331.                                         status = "Clicking the fish";
  332.                                         fish.mouseClickLeftOn();
  333.                                 }
  334.                                 sleep(180, 260);
  335.                                 if (!tab.isAItemSelected())
  336.                                         continue cooking;
  337.                                 status = "Clicking the fire";
  338.                                 UberScriptUtils.clickWorldObject(this, fire, null, Pattern
  339.                                                 .compile(".*Fire.*", Pattern.CASE_INSENSITIVE), //
  340.                                                 method.CHECK_TEXT);
  341.                                 status = "Moving the mouse";
  342.                                 mouseMove(cookAll);
  343.                                 for (int i = 0; i < 10 && !theNPCChatFinder.isNPCChatUp(); i++)
  344.                                         sleep(150, 200);
  345.                                 sleep(300, 600);
  346.                         }
  347.                 }
  348.         }
  349.  
  350.         private final void openBank() throws InterruptedException {
  351.                 if (theMenuFinder.doMenu("Bank Emerald Benedict"))
  352.                         return;
  353.                 emerald = theWorldObjectFinder.findNPC(currentCookingLocation
  354.                                 .getNPCName());
  355.                 if (emerald != null) {
  356.                         if (emerald.getGameScreenLocation() == null)
  357.                                 method.walkTo(emerald);
  358.                         UberScriptUtils.clickWorldObject(this, emerald, null, Pattern
  359.                                         .compile(".*ank.Eme.*", Pattern.CASE_INSENSITIVE),
  360.                                         method.STANDARD);
  361.                 } else
  362.                         method.logOff("Banker not found.");
  363.         }
  364.  
  365.         private State getState(final Cooking c) throws InterruptedException {
  366.                 method.tab();
  367.                 return tab.count(c.getName()) != 0 ? State.COOK : State.BANK;
  368.         }
  369.  
  370.         public enum CookingLocations {
  371.  
  372.                 ROGUE_DEN("Rogue's Den", "Emerald Benedict");
  373.  
  374.                 private String name;
  375.                 private String npcName;
  376.  
  377.                 /*
  378.                  * Temporary since this current enum set-up only support Rogue's den and
  379.                  * not any other location at the moment.
  380.                  */
  381.  
  382.                 CookingLocations(final String name, final String npcName) {
  383.                         this.name = name;
  384.                         this.npcName = npcName;
  385.                 }
  386.  
  387.                 public final String getNPCName() {
  388.                         return npcName;
  389.                 }
  390.  
  391.                 public final String getLocationName() {
  392.                         return name;
  393.                 }
  394.         }
  395.  
  396.         @SuppressWarnings("unchecked")
  397.         public class CookerMethods {
  398.  
  399.                 private ColorSkeltonScriptable css;
  400.  
  401.                 public CookerMethods(final ColorSkeltonScriptable css) {
  402.                         this.css = css;
  403.                 }
  404.  
  405.                 public final EnumSet STANDARD = EnumSet.of(UberClickOptions.WALK,
  406.                                 UberClickOptions.CLICK_USING_PRECISION,
  407.                                 UberClickOptions.CLICK_USING_PREDICTIONS,
  408.                                 UberClickOptions.USE_MENU);
  409.                 public final EnumSet NO_MENU = EnumSet.of(UberClickOptions.WALK,
  410.                                 UberClickOptions.CLICK_USING_PRECISION,
  411.                                 UberClickOptions.CLICK_USING_PREDICTIONS);
  412.                 public final EnumSet CHECK_TEXT = EnumSet.of(
  413.                                 UberClickOptions.CLICK_USING_PRECISION,
  414.                                 UberClickOptions.CLICK_USING_PREDICTIONS,
  415.                                 UberClickOptions.USE_MENU);
  416.                 public final EnumSet HOVER = EnumSet.of(
  417.                                 UberClickOptions.CLICK_USING_PRECISION,
  418.                                 UberClickOptions.CLICK_USING_PREDICTIONS,
  419.                                 UberClickOptions.USE_MENU_BUT_DONT_SELECT);
  420.  
  421.                 public final boolean tab() throws InterruptedException {
  422.                         if (!css.theTabs.Inventory.isSelected())
  423.                                 css.enterCommand(KeyboardCommand.downUp(css.getPriority(),
  424.                                                 Thread.currentThread(), KeyEvent.VK_F1, css.random(25,
  425.                                                                 85)));
  426.                         return true;
  427.                 }
  428.  
  429.                 public final void logOff(final Object o) throws InterruptedException {
  430.                         css.log(o);
  431.                         if (css.theBank.isInterfaceUp())
  432.                                 css.theBank.exit();
  433.                         css.theTabs.Logout.click();
  434.                         css.sleep(2000, 4000);
  435.                         css.stopRandom("Login");
  436.                         css.theTabs.Logout.clickLogOut();
  437.                         css.shutDown();
  438.                 }
  439.  
  440.                 public final void walkTo(final AryanTile tile)
  441.                                 throws InterruptedException {
  442.                         final ScriptJob sj = css.theParallelWalking
  443.                                         .walkToUsingWebKillPrevious(tile);
  444.                         while (tile.getCenterGameScreenLocation(css) == null)
  445.                                 css.sleep(200);
  446.                         sj.forceKill();
  447.                 }
  448.  
  449.                 public final void walkTo(final WorldObject wo)
  450.                                 throws InterruptedException {
  451.                         final AryanTile t = wo.getLocation();
  452.                         final ScriptJob sj = css.theParallelWalking
  453.                                         .walkToUsingWebKillPrevious(t);
  454.                         while (t.getCenterGameScreenLocation(css) == null)
  455.                                 css.sleep(200);
  456.                         sj.forceKill();
  457.                 }
  458.  
  459.                 public final PhysicalObject getPOOnTile(final AryanTile tile) {
  460.                         for (PhysicalObject po : css.getAllPhysicalObjects())
  461.                                 if (po.getLocation().equals(tile))
  462.                                         return po;
  463.  
  464.                         return null;
  465.                 }
  466.  
  467.                 public final void antiban() throws InterruptedException {
  468.                         if (css.random(1, 50) == 25) {
  469.                                 switch (css.random(1, 5)) {
  470.                                 case 1:
  471.                                         css.mouseMove(Areas.ENTIRE);
  472.                                         css.log("Mouse moved to " + css.getCurrentMouseXY());
  473.                                         break;
  474.                                 case 2:
  475.                                         final int i = css.random(1, 4);
  476.                                         for (int j = 0; i < i; j++) {
  477.                                                 css.mouseMove(Areas.ENTIRE);
  478.                                                 css.log("Mouse moved to " + css.getCurrentMouseXY());
  479.                                                 css.sleep(900, 1400);
  480.                                         }
  481.                                         break;
  482.                                 case 3:
  483.                                         css.theCamera.setYawRandom();
  484.                                         css.log("Camera moved.");
  485.                                         break;
  486.                                 case 4:
  487.                                         css.sleep(600, 1500);
  488.                                         css.log("Random sleep.");
  489.                                         break;
  490.                                 }
  491.                         }
  492.                 }
  493.  
  494.         }
  495.  
  496.         public enum Cooking {
  497.  
  498.                 SHRIMP("Raw shrimps", 30), SARDINE("Raw sardine", 40), ANCHOVIES(
  499.                                 "Raw anchovies", 30), HERRING("Raw herring", 50), MACKEREL(
  500.                                 "Raw mackerel", 60), TROUT("Raw trout", 70), COD("Raw cod", 70), PIKE(
  501.                                 "Raw pike", 80), SALMON("Raw salmon", 90), TUNA("Raw tuna", 100), LOBSTER(
  502.                                 "Raw lobster", 120), BASS("Raw bass", 130), SWORDFISH(
  503.                                 "Raw swordfish", 140), MONKFISH("Raw monkfish", 160), SHARK(
  504.                                 "Raw shark", 200), SEA_TURTLE("Raw sea turtle", 212), CAVEFISH(
  505.                                 "Raw cavefish", 214), MANTA_RAY("Raw manta ray", 216), ROCKTAIL(
  506.                                 "Raw rocktail", 225);
  507.  
  508.                 private String name;
  509.                 private double experience;
  510.  
  511.                 Cooking(final String name, final double experience) {
  512.                         this.name = name;
  513.                         this.experience = experience;
  514.                 }
  515.  
  516.                 public final String getName() {
  517.                         return name;
  518.                 }
  519.  
  520.                 public final double getExperience() {
  521.                         return experience;
  522.                 }
  523.  
  524.         }
  525.  
  526.         public class CookerUIV2 extends JFrame {
  527.  
  528.                 public CookerUIV2() {
  529.                         initComponents();
  530.                 }
  531.  
  532.                 private void initComponents() {
  533.  
  534.                         locationBox = new JComboBox();
  535.                         foodList = new JComboBox();
  536.                         startButton = new JButton();
  537.                         jCheckBox1 = new JCheckBox();
  538.  
  539.                         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  540.                         setTitle("CookerUIV2");
  541.  
  542.                         locationBox.setModel(new DefaultComboBoxModel(new String[] {
  543.                                         "Locations:", "Rogue's Den" }));
  544.  
  545.                         foodList.setModel(new DefaultComboBoxModel(new String[] { "Food:",
  546.                                         "Raw shrimp", "Raw sardine", "Raw achovies", "Raw herring",
  547.                                         "Raw mackerel", "Raw trout", "Raw cod", "Raw pike",
  548.                                         "Raw salmon", "Raw tuna", "Raw lobster", "Raw bass",
  549.                                         "Raw swordfish", "Raw monkfish", "Raw shark",
  550.                                         "Raw sea turtle", "Raw cavefish", "Raw manta ray",
  551.                                         "Raw rocktail" }));
  552.  
  553.                         startButton.setText("Start");
  554.                         startButton.addActionListener(new java.awt.event.ActionListener() {
  555.                                 public void actionPerformed(java.awt.event.ActionEvent evt) {
  556.                                         startButtonActionPerformed(evt);
  557.                                 }
  558.                         });
  559.  
  560.                         jCheckBox1.setText("Hover");
  561.  
  562.                         GroupLayout layout = new GroupLayout(getContentPane());
  563.                         getContentPane().setLayout(layout);
  564.                         layout
  565.                                         .setHorizontalGroup(layout
  566.                                                         .createParallelGroup(GroupLayout.Alignment.LEADING)
  567.                                                         .addGroup(
  568.                                                                         layout
  569.                                                                                         .createSequentialGroup()
  570.                                                                                         .addContainerGap()
  571.                                                                                         .addGroup(
  572.                                                                                                         layout
  573.                                                                                                                         .createParallelGroup(
  574.                                                                                                                                         GroupLayout.Alignment.TRAILING,
  575.                                                                                                                                         false)
  576.                                                                                                                         .addComponent(
  577.                                                                                                                                         foodList,
  578.                                                                                                                                         GroupLayout.Alignment.LEADING,
  579.                                                                                                                                         0,
  580.                                                                                                                                         GroupLayout.DEFAULT_SIZE,
  581.                                                                                                                                         Short.MAX_VALUE)
  582.                                                                                                                         .addComponent(
  583.                                                                                                                                         locationBox,
  584.                                                                                                                                         GroupLayout.Alignment.LEADING,
  585.                                                                                                                                         0,
  586.                                                                                                                                         122,
  587.                                                                                                                                         Short.MAX_VALUE))
  588.                                                                                         .addPreferredGap(
  589.                                                                                                         LayoutStyle.ComponentPlacement.RELATED)
  590.                                                                                         .addGroup(
  591.                                                                                                         layout
  592.                                                                                                                         .createParallelGroup(
  593.                                                                                                                                         GroupLayout.Alignment.LEADING)
  594.                                                                                                                         .addComponent(
  595.                                                                                                                                         jCheckBox1)
  596.                                                                                                                         .addComponent(
  597.                                                                                                                                         startButton,
  598.                                                                                                                                         GroupLayout.PREFERRED_SIZE,
  599.                                                                                                                                         76,
  600.                                                                                                                                         GroupLayout.PREFERRED_SIZE))
  601.                                                                                         .addContainerGap(
  602.                                                                                                         GroupLayout.DEFAULT_SIZE,
  603.                                                                                                         Short.MAX_VALUE)));
  604.                         layout.setVerticalGroup(layout.createParallelGroup(
  605.                                         GroupLayout.Alignment.LEADING).addGroup(
  606.                                         layout.createSequentialGroup().addContainerGap().addGroup(
  607.                                                         layout.createParallelGroup(
  608.                                                                         GroupLayout.Alignment.BASELINE)
  609.                                                                         .addComponent(locationBox,
  610.                                                                                         GroupLayout.PREFERRED_SIZE,
  611.                                                                                         GroupLayout.DEFAULT_SIZE,
  612.                                                                                         GroupLayout.PREFERRED_SIZE)
  613.                                                                         .addComponent(jCheckBox1)).addPreferredGap(
  614.                                                         LayoutStyle.ComponentPlacement.RELATED).addGroup(
  615.                                                         layout.createParallelGroup(
  616.                                                                         GroupLayout.Alignment.BASELINE)
  617.                                                                         .addComponent(foodList,
  618.                                                                                         GroupLayout.PREFERRED_SIZE,
  619.                                                                                         GroupLayout.DEFAULT_SIZE,
  620.                                                                                         GroupLayout.PREFERRED_SIZE)
  621.                                                                         .addComponent(startButton))
  622.                                                         .addContainerGap(GroupLayout.DEFAULT_SIZE,
  623.                                                                         Short.MAX_VALUE)));
  624.  
  625.                         pack();
  626.                 }
  627.  
  628.                 private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {
  629.                         hover = jCheckBox1.isSelected();
  630.                         final String b = foodList.getSelectedItem().toString();
  631.                         final String a = foodList.getSelectedItem().toString();
  632.                         for (CookingLocations c : CookingLocations.values())
  633.                                 if (c.getLocationName().equalsIgnoreCase(a))
  634.                                         Cooker.setLocation(c);
  635.                         for (Cooking c : Cooking.values())
  636.                                 if (c.getName().equalsIgnoreCase(b))
  637.                                         Cooker.setFood(c);
  638.                         dispose();
  639.                 }
  640.  
  641.                 private JComboBox foodList;
  642.                 private JCheckBox jCheckBox1;
  643.                 private JComboBox locationBox;
  644.                 private JButton startButton;
  645.  
  646.         }
  647.  
  648.         public static String name = "CSCooker";
  649.         public static String description = "Cooks anything at rogue's den";
  650.         public static double version = 1.30;
  651.  
  652. }