Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import groovy.swing.factory.ComboBoxFactory;
- import groovyjarjarantlr.Version;
- import groovyjarjarantlr.debug.MessageEvent;
- import java.awt.AWTException;
- import java.util.Timer;
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.EventQueue;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Paint;
- import java.awt.PaintContext;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.RenderingHints;
- import java.awt.Toolkit;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseEvent;
- import java.awt.geom.AffineTransform;
- import java.awt.geom.Rectangle2D;
- import java.awt.image.BufferedImage;
- import java.awt.image.ColorModel;
- import java.awt.peer.RobotPeer;
- import java.math.BigDecimal;
- import java.text.NumberFormat;
- import java.util.Arrays;
- import java.util.Collections;
- import java.util.List;
- import java.util.Timer;
- import java.util.concurrent.TimeUnit;
- import java.awt.BorderLayout;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.plaf.ComboBoxUI;
- import javax.swing.plaf.PanelUI;
- import javax.swing.ComboBoxModel;
- import javax.swing.JTabbedPane;
- import javax.swing.JLabel;
- import javax.swing.SwingConstants;
- import com.jgoodies.forms.factories.DefaultComponentFactory;
- import java.awt.GridBagLayout;
- import java.awt.GridBagConstraints;
- import javax.swing.JComboBox;
- import java.awt.Insets;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.JButton;
- import org.apache.log4j.helpers.QuietWriter;
- import org.omg.CORBA.Environment;
- import org.osbot.*;
- import org.osbot.engine.Bot;
- import org.osbot.script.mouse.*;
- import org.osbot.script.rs2.Client;
- import org.osbot.script.rs2.model.*;
- import org.osbot.script.rs2.ui.*;
- import org.osbot.script.MessageListener;
- import org.osbot.script.MethodProvider;
- import org.osbot.script.MouseListener;
- import org.osbot.script.Painter;
- import org.osbot.script.RandomEventSolver;
- import org.osbot.script.Script;
- import org.osbot.script.ScriptManifest;
- import org.osbot.script.rs2.utility.*;
- import org.osbot.script.rs2.map.Position;
- import org.osbot.script.rs2.model.Character;
- import org.osbot.script.rs2.model.GroundItem;
- import org.osbot.script.rs2.model.Item;
- import org.osbot.script.rs2.model.NPC;
- import org.osbot.script.rs2.model.Player;
- import org.osbot.script.rs2.randoms.RandomManager;
- import org.osbot.script.rs2.skill.*;
- import org.osbot.script.rs2.utility.Area;
- import org.osbot.script.rs2.ui.Tab;
- import org.osbot.script.rs2.map.*;
- import org.osbot.utility.PathFinder;
- import com.jgoodies.forms.factories.DefaultComponentFactory;
- @SuppressWarnings("unused")
- @ScriptManifest(name = "RFisher", author = "Reminiscence", version = 1.5, info = "Barbarian fly fishing and Shilo Village Fly Fishing!")
- public class RFisher extends Script{
- enum State {
- START, FISHING, DROPPING, IDLE,
- BANKINGEDGE, WALKTOBANKEDGE, WALKTOSPOTEDGE,
- BANKINGSHILO, WALKTOBANKSHILO, WALKTOSPOTSHILO
- }
- State state = State.START;
- private static String status = "Unknown";
- boolean banking;
- boolean bankingShilo;
- boolean bankingEdge;
- boolean hasBanked;
- boolean usingShilo;
- boolean usingEdge;
- private int[][] toBankEdge = new int[][] { { 3104, 3432 }, { 3097, 3440 }, {3091, 3444}, {3091, 3460}, { 3095, 3453 }, { 3099, 3470 }, { 3104, 3432 }};
- private int[][] toSpotEdge = new int[][] { { 3096, 3485 }, { 3099, 3470 }, { 3095, 3454 }, {3091, 3444}, { 3097, 3440 }, { 3104, 3432 }};
- private int[][] toBankShilo = new int[][] { {2857, 2970}, {2856, 2959}, { 2852, 2955 }};
- private int[][] toSpotShilo = new int[][] { {2856, 2959}, { 2849, 2966 }, { 2858, 2970 }};
- final Area FISHING_AREA = new Area(3098, 3438, 3113, 3420);
- final Area BANK_AREA_SHILO = new Area(2846, 2958, 2859, 2950);
- int lvlUp = 0;
- int rodID = 309;
- int barbID = 11323;
- int feathers = 314;
- int troutCaught = 0;
- int salmonCaught = 0;
- int coins = 995;
- int caught = 0;
- int spotID = 4106;
- int spotIDShilo = 636;
- int bankID = 2196;
- int bankerID = 1316;
- public long startTime;
- public int startLevel = 0;
- private long startXP;
- long runTime = System.currentTimeMillis() - startTime;
- public void idle() throws InterruptedException {
- int b = random(1, 250);
- if (state == State.IDLE) {
- switch(b) {
- default: break;
- case 1: {
- status = "Antiban";
- client.rotateCameraToAngle(random(60, 120));
- }
- break;
- case 12: {
- client.rotateCameraToAngle(random(5, 120));
- status = "Antiban";
- }
- break;
- case 46:
- if(random(1, 12) == 1) {
- status = "Antiban";
- client.rotateCameraToAngle(random(15, 34));
- }
- break;
- case 244:
- if(random(1, 7) == 3) {
- status = "Antiban";
- client.rotateCameraToAngle(random(100, 140));
- }
- break;
- case 32:
- if(random(1, 33) == 16) {
- status = "Antiban";
- client.rotateCameraToAngle(random(30, 70));
- }
- break;
- case 19:
- if(random(1, 15) == 2) {
- status = "Antiban";
- moveMouseOutsideScreen();
- }
- break;
- case 26:
- if(random(1, 2) == 1) {
- status = "Antiban";
- moveMouseOutsideScreen();
- }
- break;
- case 41:
- if(random(0, 23) == 4) {
- status = "Antiban";
- client.rotateCameraToAngle(random(random(90, 100)));
- }
- break;
- case 178:
- if(random(1, 3) == 1) {
- status = "Antiban";
- moveMouseOutsideScreen();
- }
- break;
- case 87:
- if(random(1, 3) == 3) {
- status = "Antiban";
- moveMouseOutsideScreen();
- }
- break;
- case 132:
- if(random(1, 40) == 5) {
- status = "Antiban";
- moveMouseOutsideScreen();
- } break;
- }
- }
- }
- GUI g = new GUI();
- private boolean guiWait = true;
- private JPanel contentPane;
- public void onStart() {
- g.setVisible(true);
- while(guiWait)
- try {
- sleep(500);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- status = "Starting...";
- startTime = System.currentTimeMillis();
- startXP = client.getSkills().getExperience(Skill.FISHING);
- startLevel = client.getSkills().getLevel(Skill.STRENGTH);
- Player player = client.getMyPlayer();
- if (client.getInventory().contains(rodID) && client.getInventory().contains(feathers) && !FISHING_AREA.contains(player.getPosition()) && usingEdge == true) {
- state = State.WALKTOSPOTEDGE;
- }
- if (client.getInventory().isFull() && banking == true && closestObject(bankID) != null && bankingEdge == true) {
- state = State.BANKINGEDGE;
- }
- if (client.getInventory().isFull() && banking == false && FISHING_AREA.contains(player.getPosition())) {
- state = State.DROPPING;
- }
- if (!client.getInventory().isFull() && FISHING_AREA.contains(player.getPosition()) || !BANK_AREA_SHILO.contains(player.getPosition())) {
- state = State.FISHING;
- }
- if (!client.getInventory().isFull() && !FISHING_AREA.contains(player.getPosition()) && usingEdge == true) {
- state = State.WALKTOSPOTEDGE;
- }
- if (!client.getInventory().isFull() && BANK_AREA_SHILO.contains(player.getPosition()) && usingShilo == true) {
- state = State.WALKTOSPOTSHILO;
- }
- if (client.getInventory().contains(rodID) && client.getInventory().contains(feathers) && BANK_AREA_SHILO.contains(player.getPosition()) && usingShilo == true) {
- state = State.WALKTOSPOTSHILO;
- }
- }
- public int onLoop() throws InterruptedException{
- if (client.getRunEnergy() >= 70) {
- if (isRunning() == false){
- setRunning(true);
- }
- }
- //start of shilo
- if (state == State.WALKTOSPOTSHILO) {
- WalkToSpotShilo();
- }
- if (state == State.BANKINGSHILO) {
- bankingShilo();
- }
- if (state == State.WALKTOBANKSHILO) {
- WalkToBankShilo();
- }
- if (client.getInventory().isFull() && bankingShilo == true) {
- state = State.WALKTOBANKSHILO;
- }
- if (!client.getInventory().isFull() && bankingShilo == true && BANK_AREA_SHILO.contains(client.getMyPlayer().getPosition())) {
- state = State.WALKTOSPOTSHILO;
- }
- if (state == State.WALKTOBANKSHILO && closestNPC(bankerID) == null) {
- status = "State = walktobank";
- WalkToBankShilo();
- }
- if (client.getInventory().isFull() && bankingShilo == true && closestObject(bankerID) != null && BANK_AREA_SHILO.contains(client.getMyPlayer().getPosition())){
- state = State.BANKINGSHILO;
- }
- if (!BANK_AREA_SHILO.contains(client.getMyPlayer().getPosition()) && state == State.FISHING && usingShilo == true) {
- fishingShilo();
- }
- if (BANK_AREA_SHILO.contains(client.getMyPlayer().getPosition()) && state == State.WALKTOSPOTSHILO && usingShilo == true) {
- WalkToSpotShilo();
- }
- if (client.getInventory().isFull() && bankingShilo == true && closestNPC(bankerID) != null){
- state = State.BANKINGSHILO;
- bankingShilo();
- }
- if (client.getInventory().isFull() && banking == true && bankingShilo && closestNPC(bankerID) != null) {
- state = State.BANKINGSHILO;
- bankingShilo();
- } else if (client.getInventory().isFull() && banking == true && bankingShilo && closestNPC(bankerID) == null) {
- state = State.WALKTOBANKSHILO;
- WalkToBankShilo();
- }
- //end of shilo
- //start of barbarian village
- if (state == State.WALKTOSPOTEDGE) {
- WalkToSpotEdge();
- }
- if (state == State.WALKTOSPOTEDGE && !FISHING_AREA.contains(client.getMyPlayer().getPosition())) {
- status = "State = walktospot";
- WalkToSpotEdge();
- }
- if (state == State.WALKTOBANKEDGE && !closestObject(bankID).isVisible()) {
- status = "State = walktobank";
- WalkToBankEdge();
- }
- if (state == State.BANKINGEDGE) {
- status = "State = bankingEdge";
- bankingEdge();
- }
- if (client.getInventory().isFull() && bankingEdge == true) {
- state = State.WALKTOBANKEDGE;
- }
- if (client.getInventory().isFull() && bankingEdge == true && closestObject(bankID) != null && !FISHING_AREA.contains(client.getMyPlayer().getPosition())){
- state = State.BANKINGEDGE;
- bankingEdge();
- }
- if (client.getInventory().isFull() && state == State.BANKINGEDGE) {
- state = State.WALKTOBANKEDGE;
- WalkToBankEdge();
- }
- if (FISHING_AREA.contains(client.getMyPlayer().getPosition()) && state == State.FISHING && usingEdge == true) {
- fishingEdge();
- }
- if (client.getInventory().isFull() && banking == true && usingEdge == true) {
- state = State.WALKTOBANKEDGE;
- WalkToBankEdge();
- }
- if (!client.getInventory().isFull() && !FISHING_AREA.contains(client.getMyPlayer().getPosition()) && usingEdge == true){
- WalkToSpotEdge();
- }
- if (client.getInventory().isFull() && banking == true && bankingEdge && closestObject(bankID) != null) {
- state = State.BANKINGEDGE;
- bankingEdge();
- } else if (client.getInventory().isFull() && banking == true && bankingEdge && closestObject(bankID) == null) {
- state = State.WALKTOBANKEDGE;
- WalkToBankEdge();
- }
- // end of barbarian village
- //start of misc
- if (state == State.DROPPING && banking == false) {
- status = "State = dropping";
- dropping();
- }
- if (!client.getInventory().isFull()) {
- state = State.FISHING;
- }
- if (client.getInventory().isFull() && banking == false) {
- state = State.DROPPING;
- }
- if (state == State.FISHING && client.getMyPlayer().isAnimating() && !client.getInventory().isFull()) {
- state = State.IDLE;
- }
- if (client.getInventory().contains(rodID) && client.getInventory().contains(feathers) && state == State.FISHING && usingEdge) {
- fishingEdge();
- } else if (!client.getInventory().contains(rodID) || !client.getInventory().contains(barbID) && !client.getInventory().contains(feathers)){
- log("Missing rod/barb and feathers.");
- stop();
- } else {
- fishingShilo();
- }
- if(!client.getInventory().contains(feathers)){
- log("No remaining feathers.");
- stop();
- }
- if (client.getInventory().isFull() && state == State.DROPPING) {
- dropping();
- }
- if (!client.getInventory().contains(rodID)){
- if (closestGroundItem(rodID)!= null){
- closestGroundItem(rodID).interact("Take");
- } else if (!client.getInventory().contains(rodID) && closestGroundItem(rodID) == null){
- log("Missing rod!");
- stop();
- }
- }
- return random(10, 20);
- }
- private void fishingShilo() throws InterruptedException {
- if (closestNPC(spotIDShilo) != null && !client.getMyPlayer().isAnimating() && !client.getInventory().isFull() && usingShilo == true) {
- if (closestNPC(spotIDShilo).isVisible()) {
- state = State.FISHING;
- status = "Luring...";
- closestNPC(spotIDShilo).interact("Lure");
- sleep(random(3000, 4500));
- }
- if (!closestNPC(spotIDShilo).isVisible() && closestNPC(spotIDShilo).exists() && !client.getMyPlayer().isAnimating()){
- status = "Walking...";
- closestNPC(spotIDShilo).getPosition().walkMinimap(bot);
- sleep(random(1500, 2000));
- }
- if (closestNPC(spotIDShilo) == null && state == State.FISHING) {
- status = "Sleeping...";
- sleep(random(50, 250));
- }
- if (closestNPC(spotIDShilo) != null && closestNPC(spotIDShilo).isVisible()){
- closestNPC(spotIDShilo).getPosition().walkHere(bot);
- }
- }
- }
- private void WalkToBankShilo() {
- if (client.getInventory().isFull() && state == State.WALKTOBANKSHILO){
- status = "Walking to Bank...";
- WalkAlongPath(toBankShilo, true);
- }
- }
- private void bankingShilo() throws InterruptedException {
- status = "Banking...";
- if (closestNPC(bankerID) != null && client.getClient().getInventory().isFull()) {
- closestNPC(bankerID).interact("Bank");
- sleep(random(1000, 1500));
- client.getBank().depositAllExcept(rodID, barbID, feathers);
- sleep(random(400, 600));
- client.getBank().close();
- sleep(random(500, 600));
- if (!client.getInventory().isFull()) {
- state = State.WALKTOSPOTSHILO;
- }
- }
- }
- public void WalkToSpotShilo() throws InterruptedException {
- if (!client.getInventory().isFull() && BANK_AREA_SHILO.contains(client.getMyPlayer().getPosition())) {
- status = "Walking to spot...";
- WalkAlongPath(toSpotShilo, true);
- }
- }
- public void WalkToBankEdge() throws InterruptedException {
- if (client.getInventory().isFull() && state == State.WALKTOBANKEDGE){
- status = "Walking to Bank...";
- WalkAlongPath(toBankEdge, true);
- }
- }
- public void WalkToSpotEdge() throws InterruptedException {
- if (!client.getInventory().isFull() && !FISHING_AREA.contains(client.getMyPlayer().getPosition())) {
- status = "Walking to spot...";
- WalkAlongPath(toSpotEdge, true);
- }
- }
- public void fishingEdge() throws InterruptedException {
- if (closestNPC(spotID) != null && !client.getMyPlayer().isAnimating() && !client.getInventory().isFull() && usingEdge == true) {
- if (closestNPC(spotID).isVisible()) {
- state = State.FISHING;
- status = "Luring...";
- closestNPC(spotID).interact("Lure");
- sleep(random(1500, 2200));
- }
- if (!closestNPC(spotID).isVisible() && closestNPC(spotID).exists()){
- status = "Walking...";
- closestNPC(spotID).getPosition().walkMinimap(bot);
- sleep(random(450, 700));
- }
- if (!closestNPC(spotID).isVisible() && closestNPC(spotID) == null && state == State.FISHING) {
- status = "Sleeping...";
- sleep(random(50, 250));
- }
- if (closestNPC(spotID) != null && closestNPC(spotID).isVisible()){
- closestNPC(spotID).getPosition().walkHere(bot);
- }
- }
- }
- public void dropping() throws InterruptedException {
- if (state == State.DROPPING) {
- status = "Dropping...";
- client.getInventory().dropAllExcept(rodID, feathers);
- }
- }
- public void bankingEdge() throws InterruptedException {
- status = "Banking...";
- if (closestObject(bankID) != null && client.getClient().getInventory().isFull()) {
- closestObject(bankID).interact("Bank");
- sleep(random(1000, 1500));
- client.getBank().depositAllExcept(rodID, barbID, feathers);
- sleep(random(400, 600));
- client.getBank().close();
- sleep(random(500, 600));
- if (!client.getInventory().isFull()) {
- state = State.WALKTOSPOTEDGE;
- }
- }
- }
- public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
- int destination = 0;
- for (int i = 0; i < path.length; i++)
- if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(
- path[destination][0], path[destination][1]))
- destination = i;
- if (client.getMyPlayer().isMoving()
- && distanceToPoint(path[destination][0], path[destination][1]) > (client
- .getMyPlayer().isMoving() ? 3 : 2))
- return;
- if (AscendThroughPath && destination != path.length - 1
- || !AscendThroughPath && destination != 0)
- destination += (AscendThroughPath ? 1 : -1);
- try {
- log("Walking to node:" + destination);
- walk(new Position(path[destination][0], path[destination][1], 0));
- Thread.sleep(700 + MethodProvider.random(600));
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- private int distanceToPoint(int pointX, int pointY) {
- return (int) Math.sqrt(Math
- .pow(client.getMyPlayer().getX() - pointX, 2)
- + Math.pow(client.getMyPlayer().getY() - pointY, 2));
- }
- public void onExit() throws InterruptedException{
- long currentEXP = this.client.getSkills().getExperience(Skill.FISHING);
- long expGain = client.getSkills().getExperience(Skill.FISHING) - startXP;
- log("Caught: " +caught);
- log("Exp Gained: " +NumberFormat.getIntegerInstance().format(expGain));
- log("Runtime: " + runTime);
- }
- //paint
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private final Color color1 = new Color(0, 0, 0, 189);
- private final Color color2 = new Color(0, 204, 255);
- private final Color color3 = new Color(255, 255, 255);
- private final Font font1 = new Font("Arial", 0, 10);
- private final Font font2 = new Font("Arial", 0, 14);
- private int getExpToLevel(Skill index) {
- int lvl = client.getSkills().getLevel(index);
- int xpTotal = xpTable[lvl + 1] - xpTable[lvl];
- int xpDone = client.getSkills().getExperience(index) - xpTable[lvl];
- if(lvl == 99) return 0;
- if(xpTotal == 0) return 0;
- else return xpTotal - xpDone;
- }
- private final int xpTable[] = { 0, 0, 83, 174, 276, 388, 512, 650, 801, 969,
- 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018,
- 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456,
- 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339,
- 55649, 61512, 0x1098f, 0x12577, 0x14446, 0x16649, 0x18bd5, 0x1b549, 0x1e30c,
- 0x21592, 0x24d58, 0x28aec, 0x2cee8, 0x319f6, 0x36cd2, 0x3c84e, 0x42d4e, 0x49cd0,
- 0x517ec, 0x59fd7, 0x635e7, 0x6db94, 0x7927e, 0x85c71, 0x93b68, 0xa3193, 0xb415b,
- 0xc6d6d, 0xdb8b9, 0xf267f, 0x10ba56, 0x127835, 0x14647b, 0x1683fd, 0x18dc10,
- 0x1b7298, 0x1e4e14, 0x2175b2, 0x24f15f, 0x28c9da, 0x2d08cd, 0x31b8e2, 0x36e5e0,
- 0x3c9cc6, 0x42ebf0, 0x49e337, 0x51941c, 0x5a11ef, 0x637205, 0x6dcbed, 0x7939a6,
- 0x85d7e6, 0x93c661, 0xa32815, 0xb423a6, 0xc6e3bf
- };
- public String format(long time) {
- StringBuilder string = new StringBuilder();
- long totalSeconds = time / 1000L;
- long totalMinutes = totalSeconds / 60L;
- long totalHours = totalMinutes / 60L;
- int seconds = (int)totalSeconds % 60;
- int minutes = (int)totalMinutes % 60;
- int hours = (int)totalHours % 24;
- if (hours > 0) {
- string.append(hours + "h ");
- }
- if (minutes > 0) {
- string.append(minutes + "m ");
- }
- string.append(seconds +"s");
- return string.toString();
- }
- private int getSeconds(long time) {
- return (int)((time/1000L)%60);
- }
- public void onPaint(Graphics g) {
- long currentEXP = this.client.getSkills().getExperience(Skill.FISHING);
- long expGain = client.getSkills().getExperience(Skill.FISHING) - startXP;
- g.setColor(color1);
- g.fillRect(558, 335, 167, 103);
- g.setColor(color2);
- g.drawRect(558, 335, 167, 103);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)) , 565, 369);
- g.drawString("Status: " + status, 565, 379);
- g.drawString("EXP Gained: " + NumberFormat.getIntegerInstance().format(expGain), 565, 388);
- g.drawString("EXP/Hour: " + NumberFormat.getIntegerInstance().format(expGain *3600000D / (System.currentTimeMillis() - startTime)) , 565, 397);
- g.drawString("Level: " + client.getSkills().getLevel(Skill.FISHING), 565, 405);
- g.drawString("Levels Gained: " + lvlUp, 565, 414);
- g.drawString("Total Caught: " + (caught), 565, 424);
- g.drawString("Caught/Hour: " +getHourlyRate(caught), 565, 433);
- g.setColor(color2);
- g.drawLine(566, 354, 717, 354);
- g.drawLine(683, 336, 683, 354);
- g.drawLine(597, 336, 597, 353);
- g.setFont(font2);
- g.drawString("RFisher", 615, 350);
- }
- public int getHourlyRate(int variable) {
- return (int)((variable - 0) * 3600000.0D / (System.currentTimeMillis() - this.startTime));
- }
- public void onMessage(String message) throws InterruptedException {
- if(message.contains("You catch a trout.") || message.contains("You catch a salmon.")) {
- caught++;
- }
- if(message.contains("You catch a trout.")) {
- troutCaught++;
- }
- if(message.contains("You catch a salmon.")) {
- salmonCaught++;
- }
- if(message.contains("advanced a")) {
- lvlUp++;
- }
- }
- public class GUI extends JFrame {
- private JPanel contentPane;
- private static final long serialVersionUID = 1L;
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public GUI() {
- setTitle("RFisher 1.6");
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- setBounds(100, 100, 221, 134);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- final JComboBox comboBox = new JComboBox();
- comboBox.setModel(new DefaultComboBoxModel(new String[] {"Barbarian Village", "Shilo Village"}));
- comboBox.setBounds(66, 11, 130, 20);
- contentPane.add(comboBox);
- JLabel lblArea = new JLabel("Area:");
- lblArea.setBounds(10, 14, 46, 14);
- contentPane.add(lblArea);
- JLabel lblMethod = new JLabel("Method: ");
- lblMethod.setBounds(10, 46, 55, 14);
- contentPane.add(lblMethod);
- final JComboBox comboBox_1 = new JComboBox();
- comboBox_1.setModel(new DefaultComboBoxModel(new String[] {"Banking", "Powerfishing"}));
- comboBox_1.setBounds(66, 43, 130, 20);
- contentPane.add(comboBox_1);
- JButton btnStart = new JButton("Start");
- btnStart.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- if (comboBox.getSelectedItem().equals("Shilo Village") && (comboBox_1.getSelectedItem().equals("Banking"))) {
- usingShilo = true;
- bankingShilo = true;
- banking = true;
- log("Banking in Shilo Village.");
- }
- if (comboBox.getSelectedItem().equals("Shilo Village") && (comboBox_1.getSelectedItem().equals("Powerfishing"))) {
- usingShilo = true;
- bankingShilo = false;
- banking = false;
- log("Powefishing in Shilo Village.");
- }
- if (comboBox.getSelectedItem().equals("Barbarian Village") && (comboBox_1.getSelectedItem().equals("Banking"))) {
- usingEdge = true;
- bankingEdge = true;
- banking = true;
- log("Banking in Edgeville.");
- }
- if (comboBox.getSelectedItem().equals("Barbarian Village") && (comboBox_1.getSelectedItem().equals("Powerfishing"))) {
- usingEdge = true;
- bankingEdge = false;
- banking = false;
- log("Powerfishing in Barbarian Village.");
- }
- guiWait = false;
- dispose();
- }
- });
- btnStart.setBounds(60, 74, 89, 23);
- contentPane.add(btnStart);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment