All pastes #2066062 Raw Edit

Mine

public text v1 · immutable
#2066062 ·published 2011-05-21 01:06 UTC
rendered paste body

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.DecimalFormat;
import java.util.LinkedList;
import javax.swing.*;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.*;
import org.rsbot.script.wrappers.*;
import org.rsbot.script.methods.*;
import org.rsbot.script.util.Filter;

/**
 *
 * @author Emeleo
 * @version 1.9
 */
@ScriptManifest(authors = {"Emeleo"}, name = "AutoCookerPro", keywords = {"cooker"}, description = "Any fish, ANY WHERE!", version = 1.90, website = "http://www.powerbot.org/vb/showthread.php?t=618926", requiresVersion = 242)
public class AutoCookerPro extends Script implements PaintListener, MessageListener, MouseListener {

    private static State cState;
    private static Fish fish;
    private static Location loc;
    private Methods m = new Methods();
    private AutoCookerProGUI gui;
    private timer timer;
    private Paint p = new Paint();
    private final static locationIDS con = new locationIDS();
    private static boolean logOutOnFinish = true;
    private static long activityTimer = 2000;
    private final LinkedList<MousePathPoint> mousePath = new LinkedList<MousePathPoint>(); //
    private final LinkedList<Click> clicks = new LinkedList<Click>(); //

    @Override
    public boolean onStart() {
        gui = new AutoCookerProGUI();
        while (gui.frame1.isVisible()) {
            sleep(100);
        }
        if (gui.cancel) {
            return false;
        } else if (gui.start) {
            fish = gui.getSelectedFish();
            loc = gui.getSelectedLocation();
            if (fish == null || loc == null) {
                return false;
            }
            logOutOnFinish = gui.checkBox1.isSelected();
            p.start_xp = skills.getCurrentExp(Skills.COOKING);
            p.startTime = System.currentTimeMillis();
            return true;
        }
        return false;
    }

    public void mouseClicked(MouseEvent e) {
    }

    public void mousePressed(MouseEvent e) {
        if (p.showPaint && p.getChatRect().contains(e.getPoint()) && !p.closeRect.contains(e.getPoint())) {
            p.changeAL = true;
            p.alph = 50;
            p.color1 = new Color(102, 0, 0, p.alph);
            p.color2 = new Color(0, 0, 0, p.alph);
            p.color3 = new Color(255, 153, 0, p.alph);
            p.color4 = new Color(51, 102, 0, p.alph);
        }
    }

    public void mouseReleased(MouseEvent e) {
        if (p.closeRect.contains(e.getPoint())) {
            p.showPaint = !p.showPaint;
        }
        if (p.changeAL) {
            p.alph = 255;
            p.color1 = new Color(102, 0, 0, p.alph);
            p.color2 = new Color(0, 0, 0, p.alph);
            p.color3 = new Color(255, 153, 0, p.alph);
            p.color4 = new Color(51, 102, 0, p.alph);
            p.changeAL = false;
        }
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }

    public static class locationIDS {

        private static final RSTile[] cooking_location_tiles = {
            new RSTile(3043, 4972), new RSTile(3043, 4974), new RSTile(3044, 4973),
            new RSTile(3042, 4973)};
        /**
         * RangeID
         */
        int RougeDenRangeID = 2732;
        int AlKharidRangeID = 25730;
        /**
         * RangeTile
         */
        RSTile RougeDenRangeTile = new RSTile(3043, 4973);
        RSTile AlkharidRangeTile = new RSTile(3273, 3180);
        /**
         * BankTile
         */
        RSTile RougeDenBankTile = null;
        RSTile AlkharidBankTile = new RSTile(3270, 3167);
        /**
         * BankArea
         */
        RSArea RougeDenBankArea = null;
        RSArea AlkharidBankArea = new RSArea(new RSTile[]{new RSTile(3265, 3161), new RSTile(3265, 3173), new RSTile(3272, 3173), new RSTile(3272, 3161)});
        /**
         * RangeArea
         */
        RSArea RougeDenRangeArea = null;
        RSArea AlkharidRangeArea = new RSArea(new RSTile(3275, 3179), new RSTile(3271, 3183));
    }

    private enum Location {

        RougeDen(con.RougeDenRangeID, con.RougeDenBankTile, con.RougeDenRangeTile, "Rouge Den"),
        ALKHARID(con.AlKharidRangeID, con.AlkharidBankTile, con.AlkharidRangeTile, "Al Kharid");
        RSTile[] toBank, toCook;
        int rangeID;
        RSTile bankTile, rangeTile;
        String name;

        Location(final int rangeID, RSTile bankTile, RSTile rangeTile, String name) {
            this.rangeID = rangeID;
            this.bankTile = bankTile;
            this.rangeTile = rangeTile;
            this.name = name;

        }

        boolean isRougeDen() {
            return loc.equals(RougeDen);
        }

        String getName() {
            return name;
        }

        int getRangeID() {
            return rangeID;
        }

        RSTile getBankTile() {
            return bankTile;
        }

        RSTile getRangeTile() {
            return rangeTile;
        }
    }

    private enum Fish {

        CRAYFISH("Raw crayfish", 13435, 1),
        SHRIMPS("Raw shrimp", 317, 1),
        SARDINE("Raw sardine", 327, 1),
        ACHOVIES("Raw anchovies", 321, 1),
        HERRING("Raw herring", 345, 5),
        MACHEREL("Raw mackerel", 353, 10),
        TROUT("Raw trout", 335, 15),
        COD("Raw cod", 341, 18),
        PIKE("Raw pike", 349, 20),
        SALMON("Raw salmon", 331, 25),
        TUNA("Raw tuna", 359, 30),
        KARAMBWN("Raw karambwan", 3142, 30),
        RAINBOW("Raw rainbow fish", 0, 35),
        CAVEELL("Raw cave eel", 5001, 38),
        LOBSTER("Raw lobster", 377, 40),
        BASS("Raw bass", 363, 43),
        SWORDFISH("Raw swordfish", 371, 45),
        MONKFISH("Raw monkfish", 7944, 62),
        SHARK("Raw shark", 383, 80),
        SEATURTLE("Raw sea turtle", 395, 82),
        CAVEFISH("Raw cavefish", 15264, 88),
        MONTARAY("Raw manta ray", 389, 91),
        ROCKTAIL("Raw rocktail", 15270, 93);
        String name;
        int ID;
        int lvl;

        private Fish(String name, int ID, int lvl) {
            this.name = name;
            this.ID = ID;
            this.lvl = lvl;
        }

        String getName() {
            return name;
        }

        int getID() {
            return ID;
        }

        int getLvl() {
            return lvl;
        }
    }

    private enum State {

        cook, bank, clickInterface, sleep, unkown, walkToBank, walkToRange
    }

    public class Methods {

        AntiBan AB = new AntiBan();
        int noFood = 0;
        volatile boolean stop = false;
        boolean started = false;
        Thread mouseSpeedChanger = new Thread(new Runnable() {

            public void run() {
                while (!stop) {
                    try {
                        Thread.sleep(10);
                        mouse.setSpeed(random(3, 8));
                    } catch (InterruptedException ex) {
                    }

                }
            }
        });

        private boolean isCookingInterface() {
            return interfaces.get(905).getComponent(14).isValid();
        }

        private boolean clickInterface() {
            return isCookingInterface() ? interfaces.get(905).getComponent(14).doClick() : false;
        }

        private boolean isFull() {
            return getCachedCount() == 28;
        }

        private int getCachedCount(int id) {
            int amount = 0;
            for (RSItem one : inventory.getCachedItems()) {
                if (one.getID() != -1 && one.getID() == id) {
                    amount++;
                }
            }
            return amount;
        }

        private int getCachedCount() {
            int amount = 0;
            for (RSItem one : inventory.getCachedItems()) {
                if (one.getID() != -1) {
                    amount++;
                }
            }
            return amount;
        }

        private boolean has(int i) {
            return getCachedCount(i) > 0;
        }

        boolean isCooking() {
            return has(fish.getID()) && System.currentTimeMillis() - activityTimer < 8500 || getMyPlayer().getAnimation() != -1;
        }

        private boolean useOnRange() {
            RSObject o = objects.getNearest(loc.getRangeID());
            if (o == null) {
                return false;
            }
            String action = fish.getName() + " -> " + o.getName();
            Point p = null;
            camera.setPitch(true);
            RSModel m = o.getModel();
            for (int i = 0; i < 10; i++) {
                if ((p = m == null ? calc.tileToScreen(o.getLocation(), random(0.3, 0.6), random(0.3, 0.6), 0) : m.getCentralPoint()).x == -1) {
                    continue;
                }
                if (isCookingInterface()) {
                    break;
                }
                mouse.move(p, 3, 3);
                String[] items = menu.getItems();
                if (!menu.contains(action)) {
                    continue;
                }
                if (items[0].contains(action)) {
                    mouse.click(true);
                    timer = new timer(3500);
                    while (getMyPlayer().isMoving() || !isCookingInterface() && timer.isRunning()) {
                        sleep(10);
                    }
                } else {
                    mouse.click(false);
                    if (menu.doAction(action)) {
                        timer = new timer(2000);
                        while (getMyPlayer().isMoving() || !isCookingInterface() && timer.isRunning()) {
                            sleep(10);
                        }
                    }
                }
                return isCookingInterface();
            }

            return false;
        }

        private State getState() {
            if (fish == null || loc == null) {
                return State.unkown;
            }
            if (loc.isRougeDen()) {
                if (isCooking()) {
                    return State.sleep;
                }
                if (!has(fish.getID())) {
                    return State.bank;
                }
                if (isCookingInterface()) {
                    return State.clickInterface;
                }
                if (!isCooking() && has(fish.getID())) {
                    return State.cook;
                }
                return State.unkown;
            }
            if (isCooking()) {
                return State.sleep;
            }
            if (!has(fish.getID())) {
                if (inBankArea()) {
                    return State.bank;
                } else {
                    return State.walkToBank;
                }
            } else if (isCookingInterface()) {
                return State.clickInterface;
            } else {
                if (inRangeArea()) {
                    return State.cook;
                } else {
                    return State.walkToRange;
                }
            }
        }

        private boolean openBank() {
            if (loc.isRougeDen()) {
                RSNPC banker = npcs.getNearest(Bank.BANKERS);
                if (bank != null) {
                    if (calc.distanceTo(banker) > 5) {
                        if (calc.distanceTo(banker) < 7) {
                            camera.setPitch(random(10, 25));
                            sleep(600, 1000);
                            walking.walkTileOnScreen(banker.getLocation());
                            timer = new timer(2000);
                            while (timer.isRunning() && calc.distanceTo(banker) > 5) {
                                sleep(10);
                            }
                            if (calc.distanceTo(banker) > 5) {
                                return false;
                            }
                        } else {
                            walking.walkTo(banker.getLocation());
                            timer = new timer(2000);
                            while (timer.isRunning() && calc.distanceTo(banker) > 5) {
                                sleep(10);
                            }
                            if (calc.distanceTo(banker) > 5) {
                                return false;
                            }
                        }
                        return false;
                    }
                    if (calc.distanceTo(banker) > 5) { // Another failsafe, we'll make sure it's onscreen.
                        return false;
                    }
                    Point p = null;
                    RSModel m = banker.getModel();
                    camera.setPitch(true);
                    for (int i = 0; i < 10; i++) {
                        p = m == null ? calc.tileToScreen(banker.getLocation(), random(0.4, 0.7), random(0.4, 0.6), random(0, 2)) : m.getCentralPoint();
                        mouse.move(p, 3, 3);
                        if (menu.contains("Bank")) {
                            mouse.click(false);
                            sleep(450, 950);
                            if (menu.doAction("Bank")) {
                                timer = new timer(1500);
                                while (getMyPlayer().isMoving() || timer.isRunning() && !bank.isOpen()) {
                                    sleep(100);
                                }
                                return bank.isOpen();
                            }
                        }
                    }
                }
                return false;
            } else {
                if (calc.distanceTo(loc.getBankTile()) < 5) {
                    bank.open();
                } else {
                    if (calc.distanceTo(loc.getBankTile()) < 7) {
                        walking.walkTileOnScreen(loc.bankTile);
                        timer = new timer(2000);
                        while (timer.isRunning() && calc.distanceTo(loc.getBankTile()) > 5) {
                            sleep(10);
                        }
                    } else {
                        web.getWeb(getMyPlayer().getLocation(), loc.getBankTile()).step();
                        sleep(100);
                    }
                }
            }
            return false;
        }

        private void stop(String message) {
            log(message);
            stopScript(logOutOnFinish);
        }

        private void bank() {
            if (!bank.isOpen()) {
                openBank();
                return;
            }
            if (inventory.contains(fish.getID())) {
                bank.depositAllExcept(fish.getID());
                return;
            } else if (inventory.getCount() > 0) {
                bank.depositAll();
                timer = new timer(2000);
                while (timer.isRunning() && inventory.getCount() > 0) {
                    sleep(100);
                }
                return;
            }
            if (bank.getCount(fish.getID()) > 0) {
                bank.withdraw(fish.getID(), 0);
                timer = new timer(2000);
                interfaces.get(Bank.INTERFACE_BANK).getComponent(Bank.INTERFACE_BANK_BUTTON_CLOSE).doHover();
                while (!inventory.contains(fish.getID()) && timer.isRunning()) {
                    sleep(100);
                }
                if (inventory.contains(fish.getID())) {
                    bank.close();
                }
                return;
            } else {
                log("There's no food in your bank, check #" + noFood);
                sleep(1000, 2000);
                if (bank.getCount(fish.getID()) > 0) {
                    log("Opps, we found food! SORRY!");
                    noFood = 0;
                    return;
                } else {
                    if (noFood == 2) {
                        bank.close();
                        sleep(100, 650);
                    }
                    if (noFood > 3) {
                        stop("No food. :/");
                    }
                    noFood++;
                }
            }
        }

        String[] getFishesModel() {

            Fish[] all = Fish.values();
            String[] models = new String[all.length];
            int a = 0;
            for (final Fish i : all) {
                models[a] = i.getName();
                a++;
            }
            return models;
        }

        String[] getLocationsModel() {
            Location[] all = Location.values();
            String[] models = new String[all.length];
            int a = 0;
            for (final Location i : all) {
                models[a] = i.getName();
                a++;
            }
            return models;
        }

        private boolean cook() {
            if (game.getCurrentTab() != Game.TAB_INVENTORY) {
                game.openTab(Game.TAB_INVENTORY, (random(0, 10) == 5 ? true : false));
                sleep(350, 850); // No CPU burning :D
                return false;
            }
            if (!has(fish.getID())) {
                return false;
            }
            RSObject range = objects.getNearest(loc.getRangeID());
            if (range == null || !range.isOnScreen() || calc.distanceTo(range) > 5) {
                return false;
            }
            if (!inventory.isItemSelected()) {
                inventory.getItem(fish.getID()).doAction("Use");
                sleep(320, 650);
                timer = new timer(2000);
                while (!inventory.isItemSelected() && timer.isRunning()) {
                    sleep(100);
                }
                if (!inventory.isItemSelected()) {
                    return false;
                }
            }
            if (inventory.getSelectedItemName().equals(fish.getName())) {
                return useOnRange();
            } else {
                inventory.clickSelectedItem();
                sleep(100, 450);
            }
            return false;
        }

        private boolean walkTo(RSTile tile) {
            RSWeb path = web.getWeb(getMyPlayer().getLocation(), tile);
            if (path != null) {
                while (isActive() && !path.finished()) {
                    path.step();
                    sleep(100);
                }
            }
            return false;
        }

        private boolean inRangeArea() {
            RSObject range = objects.getNearest(loc.getRangeID());
            return range != null && calc.distanceTo(range) < 5;
        }
        private final int[] ALLBANKS = {782, 2213, 4483, 6084, 11402, 11758, 12759, 14367, 19230, 24914, 25808, 26972,
            27663, 29085, 34752, 35647, 36786, 9398, 20228, 26969, 36788, 4483, 12308, 21301, 27663, 42192};

        private boolean inBankArea() {
            RSObject banks = objects.getNearest(ALLBANKS);
            return banks != null && calc.distanceTo(banks) < 5;
        }

        public class AntiBan {

            Thread clickafterInterface = new Thread(new Runnable() {

                public void run() {
                    while (!stop) {
                        do {
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException ex) {
                            }
                        } while (!clickAfterInterface);
                        int r = random(0, 100);
                        if (r < 10 || r > 13 && r < 20 || r > 50 && r < 55 || r > 90 && r < 99) {
                            switch (random(0, 10)) {
                                case 4:
                                    mouse.moveSlightly();
                                    break;
                                case 7:
                                    mouse.moveRandomly(random(300, 400));
                                    break;
                                case 10:
                                    mouse.moveOffScreen();
                                    break;
                            }
                        }
                    }
                }
            });
            Thread mouseAB = new Thread(new Runnable() {

                public void run() {
                    while (!stop) {
                        do {
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException ex) {
                            }
                        } while (!doAB);
                        if (cState.equals(State.sleep) || cState.equals(State.walkToBank) || cState.equals(State.walkToRange)) {
                            final int r = random(0, 100);
                            if (r == random(0, 5) || r == 32) {

                                switch (random(0, 35)) {
                                    case 5:
                                        RSObject o = getRandomObject();
                                        if (o != null && o.isOnScreen()) {
                                            o.doAction("Examine");
                                            try {
                                                Thread.sleep(random(1000, 3500));
                                            } catch (InterruptedException ex) {
                                            }
                                        }
                                        break;
                                    case 17:
                                        RSPlayer p = getRandomPlayer();
                                        if (p != null && p.isOnScreen()) {
                                            RSModel m = p.getModel();
                                            if (m != null) {
                                                mouse.click(m.getPoint(), 3, 3, false);
                                                try {
                                                    Thread.sleep(random(100, 1000));
                                                    mouse.moveSlightly();
                                                    while (menu.isOpen()) {
                                                        mouse.moveRandomly(300, 450);
                                                        sleep(100, 650);
                                                    }
                                                } catch (InterruptedException e) {
                                                }
                                            }
                                        }
                                        break;
                                    case 20:
                                        mouse.moveOffScreen();
                                        break;
                                    case 25:
                                        mouse.moveOffScreen();
                                        try {
                                            timer aTimer = new timer(random(2500, 10000));
                                            while (AB.doAB && timer.isRunning()) {
                                                Thread.sleep(100);
                                            }
                                            mouse.moveSlightly();
                                        } catch (InterruptedException e) {
                                        }
                                        break;
                                    case 16:
                                        mouse.move(rX(), rY(), 3, 3);
                                        try {
                                            Thread.sleep(random(150, 950));
                                            mouse.move(rX(), rY(), 3, 3);
                                            Thread.sleep(random(150, 950));
                                        } catch (InterruptedException e) {
                                        }
                                        break;
                                    case 9:
                                        mouse.click(false, random(10, 350));
                                        try {
                                            Thread.sleep(random(100, 650));
                                        } catch (InterruptedException e) {
                                        }
                                        break;
                                    case 4:
                                        mouse.moveOffScreen();
                                        mouse.move(rX(), rY());
                                        mouse.moveSlightly();
                                        break;
                                    case 6:
                                        mouse.move(rX(), rY());
                                        sleep(100, 200);
                                        if (random(0, 10) == 5) {
                                            mouse.move(rX(), rY());
                                        }
                                        sleep(100, 200);
                                        mouse.move(rX(), rY());
                                        sleep(100, 200);
                                        if (random(0, 10) == 5) {
                                            mouse.move(rX(), rY());
                                        }
                                        sleep(100, 200);
                                        mouse.move(rX(), rY());
                                        sleep(100, 200);
                                        mouse.moveSlightly();
                                        mouse.moveOffScreen();
                                        try {
                                            Thread.sleep(4000, 9600);
                                        } catch (InterruptedException ignored) {
                                        }
                                        mouse.move(rX(), rY());
                                        sleep(100, 200);
                                        if (random(0, 10) == 5) {
                                            mouse.move(rX(), rY());
                                        }
                                }
                            }
                        }
                    }
                }
            });
            Thread cameraAB = new Thread(new Runnable() {

                public void run() {
                    while (!stop) {
                        do {
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException e) {
                            }
                        } while (!doAB);
                        if (cState.equals(State.sleep) || cState.equals(State.walkToBank) || cState.equals(State.walkToRange)) {
                            final int r = random(0, 100);
                            if (r == random(0, 6) || r == 32) {
                                switch (random(0, 50)) {
                                    case 0:
                                        try {
                                            camera.turnTo(getRandomObject(), 20);
                                            mouse.moveRandomly(60, 160);
                                            break;
                                        } catch (NullPointerException ignored) {
                                            break;
                                        }
                                    case 11:
                                        try {
                                            camera.moveRandomly(random(1000, 2500));
                                            break;
                                        } catch (NullPointerException ignored) {
                                            break;
                                        }
                                    case 20:
                                        try {
                                            if (camera.getPitch() < 2090) {
                                                camera.setPitch(random(2600, 3000));
                                                break;
                                            } else {
                                                camera.setPitch(random(2088, 2500));
                                            }
                                        } catch (NullPointerException ignored) {
                                            break;
                                        }
                                    case 32:
                                        try {
                                            camera.setPitch(random(120, 1200));
                                            break;
                                        } catch (NullPointerException ignored) {
                                            break;
                                        }
                                    case 35:
                                        try {
                                            char[] chars = {'s', 'w', 'n', 'e'};
                                            camera.setCompass(chars[random(0, 4)]);
                                            break;
                                        } catch (Exception ignored) {
                                            break;
                                        }
                                    case 16:
                                        if (camera.getAngle() > random(20, 10) || camera.getAngle() < random(340, 350)) {
                                            camera.setNorth();
                                        }
                                        break;
                                    case 24:
                                        try {
                                            camera.turnTo(getRandomPlayer(), 20);
                                            break;
                                        } catch (NullPointerException ignored) {
                                            break;
                                        }
                                    case 2:
                                        int camAlt = camera.getZ();
                                        char LR = KeyEvent.VK_LEFT;
                                        char UD;
                                        if (camAlt > -1600) {
                                            UD = KeyEvent.VK_UP;
                                        } else if (camAlt < -2215 || random(0, 2) == 0) {
                                            UD = KeyEvent.VK_DOWN;
                                        } else {
                                            UD = KeyEvent.VK_UP;
                                        }
                                        if (random(0, 2) == 0) {
                                            LR = KeyEvent.VK_RIGHT;
                                        }

                                        keyboard.pressKey(LR);
                                        try {
                                            Thread.sleep(random(50, 400));
                                        } catch (Exception ignored) {
                                        }
                                        keyboard.pressKey(UD);
                                        try {
                                            Thread.sleep(random(300, 700));
                                        } catch (Exception ignored) {
                                        }
                                        keyboard.releaseKey(UD);
                                        try {
                                            Thread.sleep(random(100, 400));
                                        } catch (Exception ignored) {
                                        }
                                        keyboard.releaseKey(LR);
                                        break;
                                }
                            }
                        }

                    }
                }
            });
            volatile boolean doAB,
                    clickAfterInterface;

            RSObject getRandomObject() {


                try {
                    for (RSObject random : objects.getAll(new Filter<RSObject>() {

                        public boolean accept(RSObject t) {
                            return t != null && t.isOnScreen();
                        }
                    })) {
                        if (random != null && random.isOnScreen()) {
                            return random;
                        } else {
                            break;
                        }
                    }
                    return null;
                } catch (NullPointerException ignored) {
                    return null;
                }
            }

            RSPlayer getRandomPlayer() {
                for (RSPlayer random : players.getAll(new Filter<RSPlayer>() {

                    public boolean accept(RSPlayer t) {
                        return t.isOnScreen() && !t.getName().equals(getMyPlayer().getName());
                    }
                })) {
                    if (random != null && random.isOnScreen()) {
                        return random;
                    }
                }
                return null;
            }

            int rX() {
                return random(0, random(10, game.getWidth()));
            }

            int rY() {
                return random(0, random(10, game.getHeight()));
            }
        }
    }

    public class Paint {

        private int total_cooked = 0, succeeful_cooked = 0, burnt_food = 0;
        private int total_hour = 0;
        private int xp_gained = 0, xp_hour;
        private int start_xp;
        private long startTime;
        private String status = "";
        private double version = AutoCookerPro.class.getAnnotation(ScriptManifest.class).version();
        Rectangle closeRect = new Rectangle(472, 350, 15, 15);
        volatile boolean changeAL, showPaint = true;
        volatile int alph = 255;
        DecimalFormat dc = new DecimalFormat("###,###,###");
        private Color color1 = new Color(102, 0, 0, alph);
        private Color color2 = new Color(0, 0, 0, alph);
        private Color color3 = new Color(255, 153, 0, alph);
        private Color color4 = new Color(51, 102, 0, alph);

        Rectangle getChatRect() {
            Rectangle chatRect = interfaces.getComponent(137, 0).getArea();
            Rectangle scrollRect = interfaces.getComponent(137, 59).getArea();
            Rectangle nameRect = interfaces.getComponent(137, 55).getArea();
            int x1 = chatRect.x + 1;
            int y1 = chatRect.y;
            int wid = chatRect.width - scrollRect.width;
            int high = chatRect.height - nameRect.height - 1;
            return new Rectangle(x1, y1, wid, high);
        }

        private Polygon getTilePolygon(RSTile tile) {
            if (tile == null || tile.getX() < 0 || tile.getY() < 0 || !calc.tileOnScreen(tile)) {
                return null;
            }
            Polygon pol = new Polygon();
            Point nW = calc.tileToScreen(tile, 0, 1, 0);
            Point sW = calc.tileToScreen(tile, 0, 0, 0);
            Point nE = calc.tileToScreen(tile, 1, 1, 0);
            Point sE = calc.tileToScreen(tile, 1, 0, 0);
            pol = new Polygon(new int[]{nW.x, sW.x, sE.x, nE.x}, new int[]{nW.y, sW.y, sE.y, nE.y}, 4);
            return pol;
        }

        private void drawArea(Graphics2D g, RSArea area) {
            if (area != null) {
                RSTile[] tiles = area.getTileArray();
                for (RSTile i : tiles) {
                    Polygon p;
                    if (i != null && (p = getTilePolygon(i)) != null) {
                        g.fillPolygon(p);
                    }
                }
            }
        }

        private void drawMouse(Graphics2D g) {
            Point clientCursor = mouse.getLocation();
            while (!mousePath.isEmpty() && mousePath.peek().isUp()) {
                mousePath.remove();
            }
            MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y,
                    450);
            if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp)) {
                mousePath.add(mpp);
            }
            MousePathPoint lastPoint = null;
            for (MousePathPoint p : mousePath) {
                if (lastPoint != null) {
                    g.setColor(p.getColor());
                    g.drawLine(p.x, p.y, lastPoint.x, lastPoint.y);
                }
                lastPoint = p;
            }
            while (!clicks.isEmpty() && clicks.peek().isUp()) {
                clicks.remove();
            }
            long clickTime = mouse.getPressTime();
            Point lastClickPos = mouse.getPressLocation();
            if (clicks.isEmpty() || !clicks.getLast().equals(clickTime)) {
                clicks.add(new Click(lastClickPos.x, lastClickPos.y, clickTime));
            }
            for (Click c : clicks) {
                c.drawTo(g);
            }
            g.setColor(Color.ORANGE);
            double radians = (System.currentTimeMillis() - startTime)
                    / (2000 / (2 * Math.PI)) % Math.PI;
            g.drawLine((int) Math.round(clientCursor.x + 7 * Math.cos(radians)),
                    (int) Math.round(clientCursor.y + 7 * Math.sin(radians)),
                    (int) Math.round(clientCursor.x + 7
                    * Math.cos(radians + Math.PI)), (int) Math.round(clientCursor.y + 7
                    * Math.sin(radians + Math.PI)));
            g.drawLine((int) Math.round(clientCursor.x + 7
                    * Math.cos(radians + HALF_PI)), (int) Math.round(clientCursor.y
                    + 7 * Math.sin(radians + HALF_PI)),
                    (int) Math.round(clientCursor.x + 7
                    * Math.cos(radians + THREE_HALF_PI)), (int) Math.round(clientCursor.y + 7
                    * Math.sin(radians + THREE_HALF_PI)));
            g.setColor(Color.BLACK);
            g.drawOval(clientCursor.x - 8, clientCursor.y - 8, 16, 16);
            g.setColor(Color.BLACK);
            g.fillOval(clientCursor.x - 4, clientCursor.y - 4, 8, 8);
            g.setColor(new Color(0, 0, 0, 50));
            g.fillOval(clientCursor.x - 8, clientCursor.y - 8, 16, 16);
        }

        public String[] getFormattedTime(final long timeMillis) {
            long millis = timeMillis;
            final long days = millis / (24 * 1000 * 60 * 60);
            millis -= days * (24 * 1000 * 60 * 60);
            final long hours = millis / (1000 * 60 * 60);
            millis -= hours * 1000 * 60 * 60;
            final long minutes = millis / (1000 * 60);
            millis -= minutes * 1000 * 60;
            final long seconds = millis / 1000;
            String dayString = String.valueOf(days);
            String hoursString = String.valueOf(hours);
            String minutesString = String.valueOf(minutes);
            String secondsString = String.valueOf(seconds);
            if (hours < 10) {
                hoursString = 0 + hoursString;
            }
            if (minutes < 10) {
                minutesString = 0 + minutesString;
            }
            if (seconds < 10) {
                secondsString = 0 + secondsString;
            }
            return new String[]{dayString, hoursString, minutesString,
                        secondsString};
        }

        public String getTTL() {
            int TTL = (int) (((double) skills.getExpToNextLevel(Skills.RUNECRAFTING) / (double) p.xp_hour) * 3600000);
            String daysToLevel = getFormattedTime(TTL)[0];
            String hoursToLevel = getFormattedTime(TTL)[1];
            String minutesToLevel = getFormattedTime(TTL)[2];
            String secondsToLevel = getFormattedTime(TTL)[3];
            return daysToLevel + ":" + hoursToLevel + ":" + minutesToLevel
                    + ":" + secondsToLevel;
        }

        public void drawStringWithShadow(final String text, final int x,
                final int y, final Graphics g) {
            final Color col = g.getColor();
            g.setColor(new Color(0, 0, 0, 255));
            g.drawString(text, x + 1, y + 1);
            g.setColor(col);
            g.drawString(text, x, y);
        }
    }

    @Override
    public int loop() {
        try {
            if (!m.started) {
                m.mouseSpeedChanger.start();
                m.AB.clickafterInterface.start();
                m.AB.mouseAB.start();
                m.AB.cameraAB.start();
                m.started = true;
                return 100;
            }
            if (!game.isLoggedIn()) {
                game.login();
                return 100;
            }

            if (!game.isFixed()) {
                m.stop("Run script in fixed mode!");
                return -1;
            }
            if (loc == null || fish == null) {
                return -1;
            }
            if (getMyPlayer().getLocation().equals(con.RougeDenRangeTile)) {
                RSTile tile = locationIDS.cooking_location_tiles[random(0, 3)];
                walking.walkTileOnScreen(tile);
                timer = new timer(3000);
                while (timer.isRunning() && getMyPlayer().getLocation().equals(con.RougeDenRangeTile) || getMyPlayer().isMoving()) {
                    sleep(100);
                }
                if (getMyPlayer().getLocation().equals(con.RougeDenRangeTile)) {
                    return 100;
                }
            }
            cState = m.getState();
            p.status = cState.toString();
            switch (cState) {
                case clickInterface:
                    if (m.clickInterface()) {
                        m.AB.doAB = false;
                        m.AB.clickAfterInterface = true;
                        mouse.moveSlightly();
                        timer = new timer(1500);
                        while (timer.isRunning() && m.isCookingInterface()) {
                            sleep(100);
                        }
                    }
                    break;
                case bank:
                    m.AB.doAB = false;
                    m.AB.clickAfterInterface = false;
                    m.bank();
                    break;
                case cook:
                    if (loc.isRougeDen()) {
                        RSObject range = objects.getTopAt(loc.getRangeTile());
                        if (range == null) {
                            break;
                        }
                        int dist = calc.distanceTo(range);
                        if (!range.isOnScreen() || dist > 5) {
                            if (dist > 7) {
                                walking.walkTo(loc.getRangeTile());
                                sleep(100);
                            } else {
                                walking.walkTileOnScreen(loc.getRangeTile());
                                sleep(100);
                            }
                            break;
                        }
                    }
                    if (bank.isOpen()) {
                        bank.close();
                        sleep(100, 350);
                        return 100;
                    }
                    m.cook();
                    break;
                case sleep:
                    m.AB.clickAfterInterface = false;
                    m.AB.doAB = true;
                    break;
                case walkToBank:
                    m.AB.doAB = true;
                    m.walkTo(loc.getBankTile());
                    break;
                case walkToRange:
                    m.AB.doAB = true;
                    m.walkTo(loc.getRangeTile());
                    break;
            }
        } catch (Throwable e) {
        }
        return 100;
    }

    @Override
    public void onFinish() {
        m.stop = true;
    }
    private final BasicStroke stroke1 = new BasicStroke(1);
    private final Font font1 = new Font("Verdana", 1, 13);
    private final Font font2 = new Font("Verdana", 1, 11);

    public void onRepaint(Graphics g1) {

        p.xp_gained = skills.getCurrentExp(Skills.COOKING) - p.start_xp;
        p.xp_hour = (int) ((p.xp_gained) * 3600000D / (System.currentTimeMillis() - p.startTime));
        p.total_hour = (int) ((p.total_cooked) * 3600000D / (System.currentTimeMillis() - p.startTime));

        Graphics2D g = (Graphics2D) g1;
        Rectangle rect = p.getChatRect();
        Rectangle r = p.closeRect;
        g.setColor(Color.red);
        p.drawMouse((Graphics2D) g);
        if (p.showPaint) {
            g.setColor(p.color1);
            g.fill(p.getChatRect());
            g.setColor(p.color2);
            g.setStroke(stroke1);
            g.drawRect(rect.x, rect.y, rect.width, rect.height);
            g.drawLine(6, 367, 496, 367);
            g.setFont(font1);
            g.setColor(p.color3);
            p.drawStringWithShadow(".:. AutoCookerPro .:. V" + p.version + " By Emeleo", 134, 361, g);
            g.setFont(font2);
            int x = 15;
            int y = 380;
            int dif = 15;
            p.drawStringWithShadow("Time Running: " + org.rsbot.script.util.Timer.format(System.currentTimeMillis() - p.startTime), x, y, g);
            g.setColor(p.color3);
            p.drawStringWithShadow("Total Cooked: " + p.dc.format(p.total_cooked), x, y += dif, g);
            p.drawStringWithShadow("/hr: " + p.dc.format(p.total_hour), 30, y += dif, g);
            p.drawStringWithShadow("Burnt: " + p.dc.format(p.burnt_food), x, y += dif, g);
            p.drawStringWithShadow("Successful: " + p.dc.format(p.succeeful_cooked), x, y += dif, g);
            x = 200;
            y = 380;
            p.drawStringWithShadow("XP Gained: " + p.dc.format(p.xp_gained), x, y, g);
            p.drawStringWithShadow("/hr: " + p.dc.format(p.xp_hour), 215, y += dif, g);
            p.drawStringWithShadow("Level: " + skills.getCurrentLevel(Skills.COOKING) + "/" + Skills.getLevelAt(p.start_xp), x, y += dif, g);
            p.drawStringWithShadow("XP to Level: " + p.dc.format(skills.getExpToNextLevel(Skills.COOKING)), x, y += dif, g);
            p.drawStringWithShadow("Time till Level: " + (p.xp_gained > 0 ? p.getTTL() : ""), x, y += dif, g);
            if (fish != null && loc != null) {
                g.drawString("Fish: " + fish.getName(), 365, 380);
                g.drawString("Location: " + loc.getName(), 365, 395);
            }
            g.setColor(p.color4);
            g.fillRect(r.x, r.y, r.width, r.height);
            g.setColor(p.color2);
            g.drawRect(r.x, r.y, r.width, r.height);
            g.drawLine(r.x + 2, r.y + 2, r.x + r.height - 2, r.y + r.width - 2);
            g.drawLine(r.x + 2, r.y + r.height - 2, r.x + r.width - 2, r.y + 2);
        } else {
            g.setColor(p.color4);
            g.fill3DRect(r.x, r.y, r.width, r.height, true);
            g.setColor(p.color2);
            g.fillOval(r.x, r.y, r.width, r.height);
        }
    }

    public void messageReceived(MessageEvent e) {
        final String message = e.getMessage();
        if (message.contains("manage to") || message.contains("roast a")
                || message.contains("successfully") || message.contains("cook some")) {
            activityTimer = System.currentTimeMillis();
            p.total_cooked++;
            p.succeeful_cooked++;
        }
        if (message.contains("eat") || message.contains("interesting happens")) {
            activityTimer = 0;
        }
        if (message.contains("accidentally burn")
                || message.contains("accidentally burnt")) {
            activityTimer = System.currentTimeMillis();
            p.total_cooked++;
            p.burnt_food++;
        }
    }

    public static class timer {

        long start = 0;
        int timeOut = 0;

        public timer(int timeOut) {
            start = System.currentTimeMillis();
            this.timeOut = timeOut;
        }

        public boolean isRunning() {
            return System.currentTimeMillis() - start < timeOut;
        }
    }
    /**
     * From now on, all credits goes to Enfilde
     */
    private final double HALF_PI = Math.PI * 0.5,
            THREE_HALF_PI = Math.PI * 1.5;

    private int toColor(double d) {
        return Math.min(255, Math.max(0, (int) d));
    }

    private class Click {

        private long clickTime, finishTime;
        private double radians;
        private int x, y;

        public Click(int x, int y, long clickTime) {
            this.clickTime = clickTime;
            finishTime = clickTime + 5000;
            radians = (clickTime - p.startTime) / (2000 / (2 * Math.PI))
                    % Math.PI;
            this.x = x;
            this.y = y;
        }

        public boolean isUp() {
            return System.currentTimeMillis() > finishTime;
        }

        public void drawTo(Graphics2D g) {
            int alpha = (int) ((finishTime - System.currentTimeMillis()) / 5000.0 * 255);
            if (alpha < 0) {
                return;
            }
            g.setColor(new Color(0, 0, 0, alpha));
            g.drawLine((int) (x + 5 * Math.cos(radians)), (int) (y + 5 * Math.sin(radians)),
                    (int) (x + 5 * Math.cos(radians + Math.PI)),
                    (int) (y + 5 * Math.sin(radians + Math.PI)));
            g.drawLine((int) (x + 5 * Math.cos(radians + HALF_PI)),
                    (int) (y + 5 * Math.sin(radians + HALF_PI)),
                    (int) (x + 5 * Math.cos(radians + THREE_HALF_PI)),
                    (int) (y + 5 * Math.sin(radians + THREE_HALF_PI)));
        }

        public boolean equals(long time) {
            return clickTime == time;
        }
    }

    private class MousePathPoint extends Point {

        private static final long serialVersionUID = 1L;
        private long finishTime;
        private double lastingTime;

        public MousePathPoint(int x, int y, int lastingTime) {
            super(x, y);
            this.lastingTime = lastingTime;
            finishTime = System.currentTimeMillis() + lastingTime;
        }

        public boolean isUp() {
            return System.currentTimeMillis() > finishTime;
        }

        public Color getColor() {
            return new Color(0, 0, 0, toColor(256 * ((finishTime - System.currentTimeMillis()) / lastingTime)));
        }
    }

    public class AutoCookerProGUI extends JFrame {

        public boolean start, cancel;

        public AutoCookerProGUI() {
            initComponents();
        }

        private void startButtonActionPerformed(ActionEvent e) {
            start = true;
            frame1.setVisible(false);
        }

        private void cancelButtonActionPerformed(ActionEvent e) {
            cancel = true;
            frame1.setVisible(false);
        }

        private void visitThreadActionPerformed(ActionEvent e) throws IOException {
            try {
                Desktop.getDesktop().browse(new URI(AutoCookerPro.class.getAnnotation(ScriptManifest.class).website()));
            } catch (URISyntaxException ex) {
            }
            visitThread.setEnabled(false);
        }

        private void initComponents() {
            frame1 = new JFrame();
            tabbedPane1 = new JTabbedPane();
            panel1 = new JPanel();
            label2 = new JLabel();
            fishType = new JComboBox();
            locationType = new JComboBox();
            label3 = new JLabel();
            separator2 = new JSeparator();
            startButton = new JButton();
            cancelButton = new JButton();
            checkBox1 = new JCheckBox();
            panel2 = new JPanel();
            scrollPane1 = new JScrollPane();
            textPane1 = new JTextPane();
            label1 = new JLabel();
            visitThread = new JButton();
            panel3 = new JPanel();
            scrollPane2 = new JScrollPane();
            changeLog = new JTextPane();

            //======== frame1 ========
            {

                frame1.setResizable(false);
                Container frame1ContentPane = frame1.getContentPane();
                frame1ContentPane.setLayout(null);
                frame1.setTitle("AutoCooker GUI");
                frame1.setVisible(true);
                frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                this.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));

                //======== tabbedPane1 ========
                {

                    //======== panel1 ========
                    {

                        panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

                            public void propertyChange(java.beans.PropertyChangeEvent e) {
                                if ("border".equals(e.getPropertyName())) {
                                    throw new RuntimeException();
                                }
                            }
                        });

                        panel1.setLayout(null);

                        //---- label2 ----
                        label2.setText("Select fish type");
                        panel1.add(label2);
                        label2.setBounds(55, 25, 80, 20);
                        panel1.add(fishType);
                        fishType.setBounds(175, 25, 95, fishType.getPreferredSize().height);
                        fishType.setModel(new DefaultComboBoxModel(m.getFishesModel()));
                        panel1.add(locationType);
                        locationType.setBounds(175, 55, 95, locationType.getPreferredSize().height);
                        locationType.setModel(new DefaultComboBoxModel(m.getLocationsModel()));

                        //---- label3 ----
                        label3.setText("Location");
                        panel1.add(label3);
                        label3.setBounds(55, 60, 45, label3.getPreferredSize().height);
                        panel1.add(separator2);
                        separator2.setBounds(0, 110, 360, 7);

                        //---- startButton ----
                        startButton.setText("Start");
                        startButton.setFont(new Font("Times New Roman", Font.BOLD, 14));
                        startButton.addActionListener(new ActionListener() {

                            @Override
                            public void actionPerformed(ActionEvent e) {
                                startButtonActionPerformed(e);
                            }
                        });
                        panel1.add(startButton);
                        startButton.setBounds(20, 120, 155, startButton.getPreferredSize().height);

                        //---- cancelButton ----
                        cancelButton.setText("Cancel");
                        cancelButton.addActionListener(new ActionListener() {

                            @Override
                            public void actionPerformed(ActionEvent e) {
                                cancelButtonActionPerformed(e);
                            }
                        });
                        panel1.add(cancelButton);
                        cancelButton.setBounds(195, 120, 135, 25);

                        //---- checkBox1 ----
                        checkBox1.setText("Logout on finish?");
                        checkBox1.setSelected(true);
                        panel1.add(checkBox1);
                        checkBox1.setBounds(50, 85, checkBox1.getPreferredSize().width, 15);

                        { // compute preferred size
                            Dimension preferredSize = new Dimension();
                            for (int i = 0; i < panel1.getComponentCount(); i++) {
                                Rectangle bounds = panel1.getComponent(i).getBounds();
                                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                            }
                            Insets insets = panel1.getInsets();
                            preferredSize.width += insets.right;
                            preferredSize.height += insets.bottom;
                            panel1.setMinimumSize(preferredSize);
                            panel1.setPreferredSize(preferredSize);
                        }
                    }
                    tabbedPane1.addTab("Settings", panel1);


                    //======== panel2 ========
                    {
                        panel2.setLayout(null);

                        //======== scrollPane1 ========
                        {

                            //---- textPane1 ----
                            textPane1.setEditable(false);
                            textPane1.setText("To request a location, you need to send me some IDS, RSTiles.\n1) Click View -> Player postion then go to the middle of the desired bank, get me the X,Y.\n2) Go to the middle location of the range/fire, get me the X,Y\n3) Click View -> Objects then get me the ID of the range/fire.\n\nVisit my thread [Button below] and reply using the following format\n\nBank tile: [step 1]\nRange tile: [step 2]\nRange ID: [step 3]\n\nAnd I WILL add the location.\n\n-------------------------------\n\nTo request a fish, please visit my thread and post the ID of the fish, along with its name and I will add it.");
                            scrollPane1.setViewportView(textPane1);
                        }
                        panel2.add(scrollPane1);
                        scrollPane1.setBounds(15, 25, 325, 105);

                        //---- label1 ----
                        label1.setText("Read below to make a proper request for location addition.");
                        panel2.add(label1);
                        label1.setBounds(25, 5, 290, label1.getPreferredSize().height);

                        //---- visitThread ----
                        visitThread.setText("Visit Thread");
                        visitThread.addActionListener(new ActionListener() {

                            @Override
                            public void actionPerformed(ActionEvent e) {
                                try {
                                    visitThreadActionPerformed(e);
                                } catch (IOException ex) {
                                }
                            }
                        });
                        panel2.add(visitThread);
                        visitThread.setBounds(110, 135, 125, visitThread.getPreferredSize().height);

                        { // compute preferred size
                            Dimension preferredSize = new Dimension();
                            for (int i = 0; i < panel2.getComponentCount(); i++) {
                                Rectangle bounds = panel2.getComponent(i).getBounds();
                                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                            }
                            Insets insets = panel2.getInsets();
                            preferredSize.width += insets.right;
                            preferredSize.height += insets.bottom;
                            panel2.setMinimumSize(preferredSize);
                            panel2.setPreferredSize(preferredSize);
                        }
                    }
                    tabbedPane1.addTab("Suggest a location/food", panel2);


                    //======== panel3 ========
                    {
                        panel3.setLayout(null);

                        //======== scrollPane2 ========
                        {

                            //---- changeLog ----
                            changeLog.setText("");
                            changeLog.setEditable(false);
                            scrollPane2.setViewportView(changeLog);
                        }
                        panel3.add(scrollPane2);
                        scrollPane2.setBounds(15, 10, 320, 130);

                        { // compute preferred size
                            Dimension preferredSize = new Dimension();
                            for (int i = 0; i < panel3.getComponentCount(); i++) {
                                Rectangle bounds = panel3.getComponent(i).getBounds();
                                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                            }
                            Insets insets = panel3.getInsets();
                            preferredSize.width += insets.right;
                            preferredSize.height += insets.bottom;
                            panel3.setMinimumSize(preferredSize);
                            panel3.setPreferredSize(preferredSize);
                        }
                    }
                    tabbedPane1.addTab("Change log", panel3);

                }
                frame1ContentPane.add(tabbedPane1);
                tabbedPane1.setBounds(0, 0, 360, 190);

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < frame1ContentPane.getComponentCount(); i++) {
                        Rectangle bounds = frame1ContentPane.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = frame1ContentPane.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    frame1ContentPane.setMinimumSize(preferredSize);
                    frame1ContentPane.setPreferredSize(preferredSize);
                }
                frame1.pack();
                frame1.setLocationRelativeTo(frame1.getOwner());
            }
            // JFormDesigner - End of component initialization  //GEN-END:initComponents
        }

        private Fish getSelectedFish() {
            String food = gui.fishType.getSelectedItem().toString();
            for (Fish i : Fish.values()) {
                if (i.getName().equalsIgnoreCase(food)) {
                    return i;
                }
            }
            return null;
        }

        private Location getSelectedLocation() {
            String location = gui.locationType.getSelectedItem().toString();
            for (Location i : Location.values()) {
                if (i.getName().equalsIgnoreCase(location)) {
                    return i;
                }
            }
            return null;
        }
        private JFrame frame1;
        private JTabbedPane tabbedPane1;
        private JPanel panel1;
        private JLabel label2;
        private JComboBox fishType;
        private JComboBox locationType;
        private JLabel label3;
        private JSeparator separator2;
        private JButton startButton;
        private JButton cancelButton;
        private JCheckBox checkBox1;
        private JPanel panel2;
        private JScrollPane scrollPane1;
        private JTextPane textPane1;
        private JLabel label1;
        private JButton visitThread;
        private JPanel panel3;
        private JScrollPane scrollPane2;
        private JTextPane changeLog;
        // JFormDesigner - End of variables declaration  //GEN-END:variables
    }
}