Advertisement
phl0w

iTBarbFisher 1.6

May 19th, 2012
1,693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.99 KB | None | 0 0
  1. import java.awt.AlphaComposite;
  2. import java.awt.Color;
  3. import java.awt.Dimension;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.awt.Point;
  8. import java.awt.Polygon;
  9. import java.awt.Rectangle;
  10. import java.awt.Toolkit;
  11. import java.awt.event.ActionEvent;
  12. import java.awt.event.ActionListener;
  13. import java.io.BufferedReader;
  14. import java.io.InputStreamReader;
  15. import java.net.URL;
  16. import java.util.regex.Matcher;
  17. import java.util.regex.Pattern;
  18.  
  19. import javax.swing.DefaultComboBoxModel;
  20. import javax.swing.GroupLayout;
  21. import javax.swing.JButton;
  22. import javax.swing.JComboBox;
  23. import javax.swing.JFrame;
  24. import javax.swing.JLabel;
  25. import javax.swing.JRadioButton;
  26. import javax.swing.LayoutStyle;
  27. import javax.swing.SwingUtilities;
  28.  
  29. import org.powerbot.concurrent.Task;
  30. import org.powerbot.concurrent.strategy.Strategy;
  31. import org.powerbot.game.api.ActiveScript;
  32. import org.powerbot.game.api.Manifest;
  33. import org.powerbot.game.api.methods.Calculations;
  34. import org.powerbot.game.api.methods.Settings;
  35. import org.powerbot.game.api.methods.Tabs;
  36. import org.powerbot.game.api.methods.Walking;
  37. import org.powerbot.game.api.methods.Widgets;
  38. import org.powerbot.game.api.methods.input.Mouse;
  39. import org.powerbot.game.api.methods.interactive.NPCs;
  40. import org.powerbot.game.api.methods.interactive.Players;
  41. import org.powerbot.game.api.methods.tab.Inventory;
  42. import org.powerbot.game.api.methods.tab.Skills;
  43. import org.powerbot.game.api.methods.widget.Camera;
  44. import org.powerbot.game.api.util.Filter;
  45. import org.powerbot.game.api.util.Random;
  46. import org.powerbot.game.api.util.Time;
  47. import org.powerbot.game.api.util.Timer;
  48. import org.powerbot.game.api.wrappers.Tile;
  49. import org.powerbot.game.api.wrappers.interactive.NPC;
  50. import org.powerbot.game.api.wrappers.interactive.Player;
  51. import org.powerbot.game.api.wrappers.node.Item;
  52. import org.powerbot.game.bot.event.MessageEvent;
  53. import org.powerbot.game.bot.event.listener.MessageListener;
  54. import org.powerbot.game.bot.event.listener.PaintListener;
  55.  
  56. @Manifest(authors = { "_phl0w" }, name = "iTBarbFisher", version = 1.6, description = "Does the barbarian fishing training! - Have barbarian rod in your toolbelt & start near the fishing spots!", website = "http://www.powerbot.org/community/topic/697455-itbarbfisher-fastest-fishing-xp-in-the-game-fishingagility-xp-50k-xph/")
  57. public class iTBarbFisher extends ActiveScript implements PaintListener,
  58.         MessageListener {
  59.  
  60.     private int caughtSturgeons, caughtSalmons, caughtTrouts,
  61.             startFishingLevel, startFishingExp, startAgilityLevel,
  62.             startAgilityExp, pouch = -1, urnsCompleted;
  63.     private long startTime;
  64.     private boolean isDropping, quickDrop = true, debug = false, urns = false,
  65.             guiInitialized;
  66.     private String status = "waiting for gui";
  67.     private Timer inactivityTimer;
  68.     private Tile startTile = null;
  69.     private final Pattern UPDATER_VERSION_PATTERN = Pattern
  70.             .compile("version\\s*=\\s*([0-9.]+)");
  71.  
  72.     private Object[][] data = { { "None", -1 },
  73.             { "Granite crab (16 summoning)", 12009 },
  74.             { "Ibis (56 summoning)", 12531 },
  75.             { "Granite lobster (74 summoning)", 12069 } };
  76.  
  77.     private int getPouch(String str) {
  78.         for (int i = 0; i < data.length; i++) {
  79.             if (data[i][0].equals(str)) {
  80.                 return (Integer) data[i][1];
  81.             }
  82.         }
  83.         return -1;
  84.     }
  85.  
  86.     public double getVersion() {
  87.         return iTBarbFisher.class.getAnnotation(Manifest.class).version();
  88.     }
  89.  
  90.     @Override
  91.     protected void setup() {
  92.         SwingUtilities.invokeLater(new Runnable() {
  93.             @Override
  94.             public void run() {
  95.                 GUI g = new GUI();
  96.                 g.setVisible(true);
  97.             }
  98.         });
  99.         startTime = System.currentTimeMillis();
  100.         startFishingLevel = Skills.getLevel(Skills.FISHING);
  101.         startFishingExp = Skills.getExperience(Skills.FISHING);
  102.         startAgilityLevel = Skills.getLevel(Skills.AGILITY);
  103.         startAgilityExp = Skills.getExperience(Skills.AGILITY);
  104.         inactivityTimer = new Timer(0);
  105.         startTile = new Tile(2499, 3508, 0);
  106.         if (!debug) {
  107.             provide(new Fish());
  108.             provide(new Drop());
  109.             provide(new Walker());
  110.             provide(new Antiban());
  111.             provide(new SummonPouch());
  112.             provide(new ClickUrn());
  113.             provide(new TeleportUrn());
  114.         }
  115.         doUpdates("http://phl0w.site88.net/scripts/barb.php");
  116.     }
  117.  
  118.     private class Walker extends Strategy implements Task {
  119.         NPC spot = getNearestSpot();
  120.  
  121.         @Override
  122.         public void run() {
  123.             if (Calculations.distance(Players.getLocal().getLocation(),
  124.                     startTile) >= 16) {
  125.                 Walking.findPath(startTile).traverse();
  126.             }
  127.             Walking.findPath(spot.getLocation()).traverse();
  128.         }
  129.  
  130.         @Override
  131.         public boolean validate() {
  132.             return guiInitialized
  133.                     && spot != null
  134.                     && !spot.isOnScreen()
  135.                     && Calculations.distance(new Tile(2520, 3518, 0),
  136.                             spot.getLocation()) > 5;
  137.         }
  138.     }
  139.  
  140.     public class Fish extends Strategy implements Task {
  141.  
  142.         @Override
  143.         public void run() {
  144.             if (Tabs.getCurrent() != Tabs.INVENTORY) {
  145.                 Tabs.INVENTORY.open();
  146.                 Time.sleep(Random.nextInt(300, 600));
  147.             }
  148.             while (!getNearestSpot().interact("Use-rod")) {
  149.                 Time.sleep(Random.nextInt(80, 120));
  150.             }
  151.             status = "fishing";
  152.             Time.sleep(Random.nextInt(1200, 1800));
  153.         }
  154.  
  155.         @Override
  156.         public boolean validate() {
  157.             return guiInitialized
  158.                     && (!isDropping && !isFishing()
  159.                             && Inventory.getCount() < 28 && getBait() != null
  160.                             && getBait().getStackSize() > 0
  161.                             && !Players.getLocal().isMoving()
  162.                             && getNearestSpot() != null && getNearestSpot()
  163.                             .isOnScreen())
  164.                     || inactivityTimer.getElapsed() >= 30000;
  165.         }
  166.  
  167.         private boolean isFishing() {
  168.             return Players.getLocal().getAnimation() != -1
  169.                     && Players.getLocal().getInteracting() != null
  170.                     && Players.getLocal().getInteracting() instanceof NPC;
  171.         }
  172.     }
  173.  
  174.     private class Drop extends Strategy implements Task {
  175.  
  176.         @Override
  177.         public void run() {
  178.             status = "dropping";
  179.             isDropping = true;
  180.             if (quickDrop) {
  181.                 int[] path = { 0, 4, 8, 12, 16, 20, 24, 25, 21, 17, 13, 9, 5,
  182.                         1, 2, 6, 10, 14, 18, 22, 26, 27, 23, 19, 15, 11, 7, 3 };
  183.                 for (int slot = 0; slot < path.length; slot++) {
  184.                     Item x = Inventory.getItemAt(path[slot]);
  185.                     if (x.getId() == 11328 || x.getId() == 11330
  186.                             || x.getId() == 11332 || x.getId() == 229) {
  187.                         int xPos = x.getWidgetChild().getAbsoluteX()
  188.                                 + Random.nextInt(0, 5);
  189.                         int yPos = x.getWidgetChild().getAbsoluteY()
  190.                                 + Random.nextInt(0, 5);
  191.                         Mouse.hop(xPos, yPos);
  192.                         Mouse.click(false);
  193.                         Time.sleep(10, 25);
  194.                         Mouse.hop(xPos, yPos + (path[slot] >= 24 ? 28 : 60));
  195.                         Mouse.click(true);
  196.                     }
  197.                 }
  198.                 getNearestSpot().interact("Use-rod");
  199.                 Time.sleep(500, 1000);
  200.             } else {
  201.                 for (Item i : Inventory.getItems()) {
  202.                     if (i.getId() == 11328 || i.getId() == 11330
  203.                             || i.getId() == 11332 || i.getId() == 229) {
  204.                         while (!i.getWidgetChild().interact("Drop")) {
  205.                             Time.sleep(Random.nextInt(20, 50));
  206.                         }
  207.                     }
  208.                 }
  209.             }
  210.             isDropping = false;
  211.         }
  212.  
  213.         public boolean validate() {
  214.             return guiInitialized && Inventory.getCount() == 28;
  215.         }
  216.  
  217.     }
  218.  
  219.     private class Antiban extends Strategy implements Task {
  220.  
  221.         @Override
  222.         public boolean validate() {
  223.             return true;
  224.         }
  225.  
  226.         @Override
  227.         public void run() {
  228.             if (Random.nextInt(1, 250) < 14) {
  229.                 executeAntiban();
  230.             }
  231.             Time.sleep(Random.nextInt(1000, 2000));
  232.         }
  233.  
  234.         public void executeAntiban() {
  235.             int dx, dy;
  236.             int r = Random.nextInt(0, 4);
  237.             switch (r) {
  238.             case 0:
  239.             case 1:
  240.                 status = "moving camera";
  241.                 Camera.setAngle(Random.nextInt(20, 300));
  242.                 break;
  243.             case 2:
  244.             case 3:
  245.                 status = "moving mouse";
  246.                 dx = Random.nextInt(-30, 30);
  247.                 dy = Random.nextInt(-30, 30);
  248.                 Mouse.move(Mouse.getX() + dx, Mouse.getY() + dy);
  249.                 Time.sleep(Random.nextInt(20, 150));
  250.                 break;
  251.             case 4:
  252.                 status = "checking player";
  253.                 Player player = Players.getNearest(new Filter<Player>() {
  254.                     @Override
  255.                     public boolean accept(Player p) {
  256.                         return !p.equals(Players.getLocal());
  257.                     }
  258.                 });
  259.                 if (player != null) {
  260.                     player.click(false);
  261.                     Time.sleep(Random.nextInt(400, 1000));
  262.                     dx = Random.nextInt(-16, 16);
  263.                     dy = Random.nextInt(-60, -20);
  264.                     Mouse.move(Mouse.getX() + dx, Mouse.getY() + dy);
  265.                 }
  266.                 Time.sleep(Random.nextInt(20, 150));
  267.                 break;
  268.             }
  269.             status = "fishing";
  270.         }
  271.     }
  272.  
  273.     private class SummonPouch extends Strategy implements Task {
  274.  
  275.         @Override
  276.         public boolean validate() {
  277.             return guiInitialized && Settings.get(448) == -1
  278.                     || Widgets.get(662, 1).getModelId() == -1 && pouch != -1
  279.                     && Inventory.getCount(pouch) > 0;
  280.         }
  281.  
  282.         @Override
  283.         public void run() {
  284.             if (Skills.getLevel(Skills.SUMMONING) < 10) {
  285.                 if (canDrink()) {
  286.                     drink();
  287.                 }
  288.             } else {
  289.                 while (!Inventory.getItem(pouch).getWidgetChild()
  290.                         .interact("Summon")) {
  291.                     Time.sleep(Random.nextInt(80, 120));
  292.                 }
  293.                 Time.sleep(Random.nextInt(300, 400));
  294.             }
  295.         }
  296.  
  297.         private boolean canDrink() {
  298.             int potCount = 0;
  299.             int[] pots = { 12140, 12142, 12144, 12146, 3024, 3026, 3028, 3030 };
  300.             for (int pot : pots) {
  301.                 if (Inventory.getCount(pot) > 0) {
  302.                     potCount++;
  303.                 }
  304.             }
  305.             return potCount > 0;
  306.         }
  307.  
  308.         private void drink() {
  309.             int[] pots = { 12140, 12142, 12144, 12146, 3024, 3026, 3028, 3030 };
  310.             for (int pot : pots) {
  311.                 if (Inventory.getItem(pot) != null) {
  312.                     while (!Inventory.getItem(pot).getWidgetChild()
  313.                             .interact("Drink")) {
  314.                         Time.sleep(Random.nextInt(80, 120));
  315.                     }
  316.                     Time.sleep(Random.nextInt(300, 400));
  317.                 }
  318.             }
  319.         }
  320.     }
  321.  
  322.     private class ClickUrn extends Strategy implements Task {
  323.  
  324.         @Override
  325.         public boolean validate() {
  326.             return urns && Inventory.getCount(20348) > 0
  327.                     && !Widgets.get(905, 14).validate();
  328.         }
  329.  
  330.         @Override
  331.         public void run() {
  332.             Inventory.getItem(20348).getWidgetChild().interact("Teleport");
  333.             while (!Widgets.get(905, 14).validate()) {
  334.                 Time.sleep(50, 100);
  335.             }
  336.         }
  337.     }
  338.  
  339.     private class TeleportUrn extends Strategy implements Task {
  340.  
  341.         @Override
  342.         public boolean validate() {
  343.             return Widgets.get(905, 14).validate() && urns
  344.                     && Inventory.getCount(20348) > 0;
  345.         }
  346.  
  347.         @Override
  348.         public void run() {
  349.             Widgets.get(905, 14).interact("Teleport all");
  350.             Time.sleep(2000, 3000);
  351.         }
  352.     }
  353.  
  354.     private AlphaComposite makeComposite(float alpha) {
  355.         int type = AlphaComposite.SRC_OVER;
  356.         return (AlphaComposite.getInstance(type, alpha));
  357.     }
  358.  
  359.     @Override
  360.     public void onRepaint(Graphics g) {
  361.         Graphics2D g2d = (Graphics2D) g;
  362.         Font title = new Font("Monotype Corsiva", Font.PLAIN, 25);
  363.         Font author = new Font("Monotype Corsiva", Font.PLAIN, 16);
  364.         Font info = new Font("Book Antiqua", Font.PLAIN, 15);
  365.  
  366.         Rectangle bg = new Rectangle(10, 23, 245, 200);
  367.         Rectangle border = new Rectangle(8, 21, 245, 204);
  368.         g2d.setColor(Color.DARK_GRAY);
  369.         g2d.setComposite(makeComposite(0.5f));
  370.         g2d.fill(bg);
  371.         g2d.setColor(Color.BLACK);
  372.         g2d.fill(border);
  373.         g2d.setComposite(makeComposite(1.0f));
  374.  
  375.         g2d.setColor(Color.WHITE);
  376.  
  377.         g2d.fill(new Rectangle(Mouse.getX() + 1, Mouse.getY() - 4, 2, 15));
  378.         g2d.fill(new Rectangle(Mouse.getX() - 6, Mouse.getY() + 2, 16, 2));
  379.  
  380.         int fishExpGained = Skills.getExperiences()[Skills.FISHING]
  381.                 - startFishingExp;
  382.         int fishExpHour = (int) ((fishExpGained) * 3600000D / (System
  383.                 .currentTimeMillis() - startTime));
  384.  
  385.         int agilityExpGained = Skills.getExperiences()[Skills.AGILITY]
  386.                 - startAgilityExp;
  387.         int agilityExpHour = (int) ((agilityExpGained) * 3600000D / (System
  388.                 .currentTimeMillis() - startTime));
  389.  
  390.         int sturgeonsHour = (int) ((caughtSturgeons) * 3600000D / (System
  391.                 .currentTimeMillis() - startTime));
  392.         int salmonsHour = (int) ((caughtSalmons) * 3600000D / (System
  393.                 .currentTimeMillis() - startTime));
  394.         int troutsHour = (int) ((caughtTrouts) * 3600000D / (System
  395.                 .currentTimeMillis() - startTime));
  396.         int urnsHour = (int) ((urnsCompleted) * 3600000D / (System
  397.                 .currentTimeMillis() - startTime));
  398.  
  399.         g2d.setFont(title);
  400.         g2d.drawString("iTBarbFisher v" + getVersion(), 12, 43);
  401.         g2d.setFont(author);
  402.         g2d.drawString("By: _phl0w", 12, 58);
  403.  
  404.         g2d.setFont(info);
  405.         g2d.drawString(
  406.                 "Fishing: "
  407.                         + Skills.getLevels()[Skills.FISHING]
  408.                         + "(+"
  409.                         + (Skills.getLevels()[Skills.FISHING] - startFishingLevel)
  410.                         + "). TTL: "
  411.                         + getTimeTillLevel(Skills.FISHING, fishExpGained,
  412.                                 fishExpHour) + " ("
  413.                         + getPercentToNextLevel(Skills.FISHING) + "%).", 12, 78);
  414.         g2d.drawString(
  415.                 "Agility: "
  416.                         + Skills.getLevels()[Skills.AGILITY]
  417.                         + "(+"
  418.                         + (Skills.getLevels()[Skills.AGILITY] - startAgilityLevel)
  419.                         + "). TTL: "
  420.                         + getTimeTillLevel(Skills.AGILITY, agilityExpGained,
  421.                                 agilityExpHour) + " ("
  422.                         + getPercentToNextLevel(Skills.AGILITY) + "%).", 12, 93);
  423.         g2d.drawString("Fishing XP gained: " + fishExpGained + ". ("
  424.                 + fishExpHour + "/h)", 12, 108);
  425.         g2d.drawString("Agility XP gained: " + agilityExpGained + ". ("
  426.                 + agilityExpHour + "/h)", 12, 123);
  427.         g2d.drawString("Fished " + caughtSturgeons + " sturgeons. ("
  428.                 + sturgeonsHour + "/h)", 12, 138);
  429.         g2d.drawString("Fished " + caughtSalmons + " salmons. (" + salmonsHour
  430.                 + "/h)", 12, 153);
  431.         g2d.drawString("Fished " + caughtTrouts + " trouts. (" + troutsHour
  432.                 + "/h)", 12, 168);
  433.         g2d.drawString("Teleported " + urnsCompleted + " urns. (" + urnsHour
  434.                 + "/h)", 12, 183);
  435.         g2d.drawString("Status: " + status + ".", 12, 198);
  436.         g2d.drawString(
  437.                 "Time running: "
  438.                         + Time.format(System.currentTimeMillis() - startTime)
  439.                         + ".", 12, 213);
  440.         drawInfo(g2d, 2722);
  441.     }
  442.  
  443.     public void drawInfo(Graphics2D g, final int npcId) {
  444.         try {
  445.             for (NPC npc : NPCs.getLoaded(new Filter<NPC>() {
  446.                 @Override
  447.                 public boolean accept(NPC n) {
  448.                     return n.getId() == npcId
  449.                             && Calculations.distance(n.getLocation(), Players
  450.                                     .getLocal().getLocation()) <= 40;
  451.                 }
  452.             })) {
  453.                 if (npc != null) {
  454.                     /* Draw the points */
  455.                     g.setColor(Players.getLocal().getInteracting() != null ? Players
  456.                             .getLocal().getInteracting().equals(npc) ? Color.YELLOW
  457.                             : Color.GREEN
  458.                             : Color.GREEN);
  459.                     Point p = npc.getLocation().getMapPoint();
  460.                     g.fillOval(p.x - 2, p.y - 2, 4, 4);
  461.  
  462.                     /* Draw the tiles */
  463.                     Tile t = npc.getLocation();
  464.                     for (Polygon poly : t.getBounds()) {
  465.                         boolean drawThisOne = true;
  466.                         for (int i = 0; i < poly.npoints; i++) {
  467.                             Point po = new Point(poly.xpoints[i],
  468.                                     poly.ypoints[i]);
  469.                             if (!Calculations.isOnScreen(po)) {
  470.                                 drawThisOne = false;
  471.                             }
  472.                         }
  473.                         if (drawThisOne) {
  474.                             Color col1 = Players.getLocal().getInteracting() != null ? Players
  475.                                     .getLocal().getInteracting().equals(npc) ? Color.YELLOW
  476.                                     : Color.GREEN
  477.                                     : Color.GREEN;
  478.                             Color col2 = new Color(col1.getRed(),
  479.                                     col1.getGreen(), col1.getBlue(), 80);
  480.                             g.setColor(col2);
  481.                             g.fillPolygon(poly);
  482.                             g.setColor(col1);
  483.                             g.drawPolygon(poly);
  484.                         }
  485.                     }
  486.                 }
  487.             }
  488.         } catch (Exception ignored) {
  489.         }
  490.     }
  491.  
  492.     private NPC getNearestSpot() {
  493.         return NPCs.getNearest(new Filter<NPC>() {
  494.             @Override
  495.             public boolean accept(NPC n) {
  496.                 return n != null
  497.                         && n.getId() == 2722
  498.                         && Calculations.distance(startTile, n.getLocation()) <= 20;
  499.             }
  500.         });
  501.     }
  502.  
  503.     private Item getBait() {
  504.         return Inventory.getCount(313) > 0 ? Inventory.getItem(313)
  505.                 : (Inventory.getCount(314) > 0 ? Inventory.getItem(314) : null);
  506.     }
  507.  
  508.     private String getTimeTillLevel(int skill, int expGained, int expPerHour) {
  509.         int currentLevel = Skills.getLevel(skill);
  510.         int expTillNextLevel = Skills.getExperienceToLevel(skill,
  511.                 currentLevel + 1);
  512.         if (expGained > 0) {
  513.             return Time.format((long) ((double) expTillNextLevel
  514.                     / (double) expPerHour * 3600000));
  515.         }
  516.         return "0:0:0";
  517.     }
  518.  
  519.     private int getPercentToNextLevel(int index) {
  520.         int lvl = Skills.getRealLevel(index);
  521.         if (lvl == 99) {
  522.             return 100;
  523.         }
  524.         int xpTotal = Skills.XP_TABLE[lvl + 1] - Skills.XP_TABLE[lvl];
  525.         if (xpTotal == 0) {
  526.             return 0;
  527.         }
  528.         int xpDone = Skills.getExperience(index) - Skills.XP_TABLE[lvl];
  529.         return 100 * xpDone / xpTotal;
  530.     }
  531.  
  532.     private void doUpdates(String url) {
  533.         try {
  534.             double currentVersion = getVersion();
  535.             double newVersion = -1;
  536.             URL site = new URL(url);
  537.             BufferedReader in = new BufferedReader(new InputStreamReader(
  538.                     site.openStream()));
  539.             String line;
  540.             Matcher m;
  541.             while ((line = in.readLine()) != null) {
  542.                 if ((m = UPDATER_VERSION_PATTERN.matcher(line)).find()) {
  543.                     newVersion = Double.parseDouble(m.group(1));
  544.                     break;
  545.                 }
  546.             }
  547.             if (newVersion < 0) {
  548.                 log.info("Unable to find the new version number. Update failed");
  549.             } else if (currentVersion == newVersion) {
  550.                 log.info("You already have the latest version of the script.");
  551.             } else {
  552.                 log.info("You do not have the most recent version! Check the forums for version "
  553.                         + newVersion);
  554.             }
  555.             in.close();
  556.         } catch (Exception e) {
  557.             e.printStackTrace();
  558.         }
  559.     }
  560.  
  561.     @Override
  562.     public void messageReceived(MessageEvent arg0) {
  563.         String msg = arg0.getMessage();
  564.         if (msg.contains("leaping sturgeon")) {
  565.             caughtSturgeons++;
  566.             inactivityTimer = new Timer(0);
  567.         } else if (msg.contains("leaping salmon")) {
  568.             caughtSalmons++;
  569.             inactivityTimer = new Timer(0);
  570.         } else if (msg.contains("leaping trout")) {
  571.             caughtTrouts++;
  572.             inactivityTimer = new Timer(0);
  573.         } else if (msg.contains("it is teleported away")) {
  574.             urnsCompleted++;
  575.         }
  576.     }
  577.  
  578.     private class GUI extends JFrame {
  579.  
  580.         private static final long serialVersionUID = 1L;
  581.  
  582.         public GUI() {
  583.             initComponents();
  584.         }
  585.  
  586.         private void initComponents() {
  587.  
  588.             jLabel1 = new JLabel();
  589.             jRadioButton1 = new JRadioButton();
  590.             jRadioButton2 = new JRadioButton();
  591.             jLabel2 = new JLabel();
  592.             jComboBox1 = new JComboBox();
  593.             jLabel3 = new JLabel();
  594.             jLabel4 = new JLabel();
  595.             jButton1 = new JButton();
  596.             jLabel5 = new JLabel();
  597.             jLabel6 = new JLabel();
  598.             jRadioButton3 = new JRadioButton();
  599.             jRadioButton4 = new JRadioButton();
  600.  
  601.             setTitle("iTBarbFisher");
  602.  
  603.             jLabel1.setText("Dropping");
  604.  
  605.             jRadioButton1.setSelected(true);
  606.             jRadioButton1.setText("Fast dropping");
  607.             jRadioButton1.addActionListener(new ActionListener() {
  608.                 public void actionPerformed(ActionEvent evt) {
  609.                     jRadioButton1ActionPerformed(evt);
  610.                 }
  611.             });
  612.  
  613.             jRadioButton2.setText("Slow dropping");
  614.             jRadioButton2.addActionListener(new ActionListener() {
  615.                 public void actionPerformed(ActionEvent evt) {
  616.                     jRadioButton2ActionPerformed(evt);
  617.                 }
  618.             });
  619.  
  620.             jLabel2.setText("Summoning");
  621.  
  622.             jComboBox1.setModel(new DefaultComboBoxModel(new String[] { "None",
  623.                     "Granite crab (16 summoning)", "Ibis (56 summoning)",
  624.                     "Granite lobster (74 summoning)" }));
  625.  
  626.             jLabel3.setText("Have summong/super restore potions");
  627.  
  628.             jLabel4.setText("if summoning is enabled!");
  629.  
  630.             jButton1.setText("Start!");
  631.             jButton1.addActionListener(new ActionListener() {
  632.                 public void actionPerformed(ActionEvent evt) {
  633.                     jButton1ActionPerformed(evt);
  634.                 }
  635.             });
  636.  
  637.             jLabel5.setText("Script made by _phl0w on PB");
  638.  
  639.             jLabel6.setText("Decorated fishing urn");
  640.  
  641.             jRadioButton3.setText("Enabled");
  642.             jRadioButton3.addActionListener(new ActionListener() {
  643.                 public void actionPerformed(ActionEvent evt) {
  644.                     jRadioButton3ActionPerformed(evt);
  645.                 }
  646.             });
  647.  
  648.             jRadioButton4.setSelected(true);
  649.             jRadioButton4.setText("Disabled");
  650.             jRadioButton4.addActionListener(new ActionListener() {
  651.                 public void actionPerformed(ActionEvent evt) {
  652.                     jRadioButton4ActionPerformed(evt);
  653.                 }
  654.             });
  655.  
  656.             GroupLayout layout = new GroupLayout(getContentPane());
  657.             getContentPane().setLayout(layout);
  658.             layout.setHorizontalGroup(layout
  659.                     .createParallelGroup(GroupLayout.Alignment.LEADING)
  660.                     .addGroup(
  661.                             layout.createSequentialGroup()
  662.                                     .addContainerGap()
  663.                                     .addGroup(
  664.                                             layout.createParallelGroup(
  665.                                                     GroupLayout.Alignment.LEADING)
  666.                                                     .addGroup(
  667.                                                             layout.createSequentialGroup()
  668.                                                                     .addGroup(
  669.                                                                             layout.createParallelGroup(
  670.                                                                                     GroupLayout.Alignment.LEADING,
  671.                                                                                     false)
  672.                                                                                     .addComponent(
  673.                                                                                             jRadioButton2)
  674.                                                                                     .addComponent(
  675.                                                                                             jRadioButton1)
  676.                                                                                     .addComponent(
  677.                                                                                             jLabel1)
  678.                                                                                     .addComponent(
  679.                                                                                             jLabel2)
  680.                                                                                     .addComponent(
  681.                                                                                             jComboBox1,
  682.                                                                                             GroupLayout.PREFERRED_SIZE,
  683.                                                                                             GroupLayout.DEFAULT_SIZE,
  684.                                                                                             GroupLayout.PREFERRED_SIZE)
  685.                                                                                     .addComponent(
  686.                                                                                             jLabel3,
  687.                                                                                             GroupLayout.DEFAULT_SIZE,
  688.                                                                                             GroupLayout.DEFAULT_SIZE,
  689.                                                                                             Short.MAX_VALUE)
  690.                                                                                     .addComponent(
  691.                                                                                             jLabel4)
  692.                                                                                     .addComponent(
  693.                                                                                             jButton1,
  694.                                                                                             GroupLayout.DEFAULT_SIZE,
  695.                                                                                             GroupLayout.DEFAULT_SIZE,
  696.                                                                                             Short.MAX_VALUE))
  697.                                                                     .addContainerGap())
  698.                                                     .addGroup(
  699.                                                             GroupLayout.Alignment.TRAILING,
  700.                                                             layout.createSequentialGroup()
  701.                                                                     .addGap(0,
  702.                                                                             0,
  703.                                                                             Short.MAX_VALUE)
  704.                                                                     .addComponent(
  705.                                                                             jLabel5)
  706.                                                                     .addGap(29,
  707.                                                                             29,
  708.                                                                             29))
  709.                                                     .addGroup(
  710.                                                             layout.createSequentialGroup()
  711.                                                                     .addGroup(
  712.                                                                             layout.createParallelGroup(
  713.                                                                                     GroupLayout.Alignment.LEADING)
  714.                                                                                     .addComponent(
  715.                                                                                             jRadioButton4)
  716.                                                                                     .addComponent(
  717.                                                                                             jLabel6)
  718.                                                                                     .addComponent(
  719.                                                                                             jRadioButton3))
  720.                                                                     .addGap(0,
  721.                                                                             0,
  722.                                                                             Short.MAX_VALUE)))));
  723.             layout.setVerticalGroup(layout.createParallelGroup(
  724.                     GroupLayout.Alignment.LEADING).addGroup(
  725.                     layout.createSequentialGroup()
  726.                             .addContainerGap()
  727.                             .addComponent(jLabel1)
  728.                             .addPreferredGap(
  729.                                     LayoutStyle.ComponentPlacement.RELATED)
  730.                             .addComponent(jRadioButton1)
  731.                             .addPreferredGap(
  732.                                     LayoutStyle.ComponentPlacement.RELATED)
  733.                             .addComponent(jRadioButton2)
  734.                             .addPreferredGap(
  735.                                     LayoutStyle.ComponentPlacement.RELATED)
  736.                             .addComponent(jLabel6)
  737.                             .addPreferredGap(
  738.                                     LayoutStyle.ComponentPlacement.RELATED)
  739.                             .addComponent(jRadioButton3)
  740.                             .addPreferredGap(
  741.                                     LayoutStyle.ComponentPlacement.RELATED)
  742.                             .addComponent(jRadioButton4)
  743.                             .addPreferredGap(
  744.                                     LayoutStyle.ComponentPlacement.RELATED,
  745.                                     GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  746.                             .addComponent(jLabel2)
  747.                             .addPreferredGap(
  748.                                     LayoutStyle.ComponentPlacement.RELATED)
  749.                             .addComponent(jComboBox1,
  750.                                     GroupLayout.PREFERRED_SIZE,
  751.                                     GroupLayout.DEFAULT_SIZE,
  752.                                     GroupLayout.PREFERRED_SIZE)
  753.                             .addPreferredGap(
  754.                                     LayoutStyle.ComponentPlacement.RELATED)
  755.                             .addComponent(jLabel3)
  756.                             .addPreferredGap(
  757.                                     LayoutStyle.ComponentPlacement.RELATED)
  758.                             .addComponent(jLabel4)
  759.                             .addPreferredGap(
  760.                                     LayoutStyle.ComponentPlacement.RELATED)
  761.                             .addComponent(jButton1)
  762.                             .addPreferredGap(
  763.                                     LayoutStyle.ComponentPlacement.RELATED)
  764.                             .addComponent(jLabel5).addContainerGap()));
  765.             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  766.             int w = getSize().width;
  767.             int h = getSize().height;
  768.             int x = (dim.width - w) / 2;
  769.             int y = (dim.height - h) / 2;
  770.             setLocation(x, y);
  771.             pack();
  772.         }
  773.  
  774.         private void jButton1ActionPerformed(ActionEvent evt) {
  775.             urns = jRadioButton3.isSelected() ? true : false;
  776.             quickDrop = jRadioButton1.isSelected() ? true : false;
  777.             pouch = getPouch(jComboBox1.getSelectedItem().toString());
  778.             guiInitialized = true;
  779.             dispose();
  780.         }
  781.  
  782.         private void jRadioButton1ActionPerformed(ActionEvent evt) {
  783.             jRadioButton1.setSelected(true);
  784.             jRadioButton2.setSelected(false);
  785.         }
  786.  
  787.         private void jRadioButton2ActionPerformed(ActionEvent evt) {
  788.             jRadioButton1.setSelected(false);
  789.             jRadioButton2.setSelected(true);
  790.         }
  791.  
  792.         private void jRadioButton3ActionPerformed(ActionEvent evt) {
  793.             jRadioButton3.setSelected(true);
  794.             jRadioButton4.setSelected(false);
  795.         }
  796.  
  797.         private void jRadioButton4ActionPerformed(ActionEvent evt) {
  798.             jRadioButton3.setSelected(false);
  799.             jRadioButton4.setSelected(true);
  800.         }
  801.  
  802.         private JButton jButton1;
  803.         private JComboBox jComboBox1;
  804.         private JLabel jLabel1;
  805.         private JLabel jLabel2;
  806.         private JLabel jLabel3;
  807.         private JLabel jLabel4;
  808.         private JLabel jLabel5;
  809.         private JLabel jLabel6;
  810.         private JRadioButton jRadioButton1;
  811.         private JRadioButton jRadioButton2;
  812.         private JRadioButton jRadioButton3;
  813.         private JRadioButton jRadioButton4;
  814.     }
  815. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement