Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Cursor;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import java.awt.RenderingHints;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.util.HashSet;
- import java.util.Set;
- import javax.swing.ButtonGroup;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.GroupLayout;
- import javax.swing.JButton;
- import javax.swing.JCheckBox;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JMenu;
- import javax.swing.JMenuBar;
- import javax.swing.JMenuItem;
- import javax.swing.JPanel;
- import javax.swing.JRadioButton;
- import javax.swing.JSeparator;
- import javax.swing.JTabbedPane;
- import javax.swing.JTextField;
- import javax.swing.KeyStroke;
- import javax.swing.LayoutStyle;
- import javax.swing.SwingConstants;
- import javax.swing.UIManager;
- import javax.swing.WindowConstants;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.util.Timer;
- import org.rsbot.script.wrappers.*;
- @SuppressWarnings("unused")
- @ScriptManifest(name = "Rock Crabs", authors = { "Vastico" }, version = 1.6, description = "Rock Crab Killer")
- public class RockCrabs extends Script implements PaintListener {
- public static interface Constants {
- RSArea CAMELOT_AREA = new RSArea(2721, 3475, 2760, 3493);
- RSArea BANK_AREA = new RSArea(2721, 3489, 2730, 3493);
- RSArea CRABS_AREA = new RSArea(2662, 3712, 2688, 3722);
- RSArea RESET_CRABS_AREA = new RSArea(2677, 3688, 2667, 3682);
- int TELETAB = 8010;
- int[] FOOD = new int[] { 1161, 1965, 1969, 1967, 1895, 1893, 1891,
- 1971, 4293, 2142, 4291, 2140, 3228, 9980, 7223, 6297, 6293,
- 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343, 1861, 13433,
- 315, 325, 319, 3144, 347, 355, 333, 339, 351, 329, 3381, 361,
- 10136, 5003, 379, 365, 373, 7946, 385, 397, 391, 3369, 3371,
- 3373, 2309, 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180,
- 7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2003, 2011,
- 2289, 2291, 2293, 2295, 2297, 2299, 2301, 2303, 1891, 1893,
- 1895, 1897, 1899, 1901, 7072, 7062, 7078, 7064, 7084, 7082,
- 7066, 7068, 1942, 6701, 6703, 7054, 6705, 7056, 7060, 2130,
- 1985, 1993, 1989, 1978, 5763, 5765, 1913, 5747, 1905, 5739,
- 1909, 5743, 1907, 1911, 5745, 2955, 5749, 5751, 5753, 5755,
- 5757, 5759, 5761, 2084, 2034, 2048, 2036, 2217, 2213, 2205,
- 2209, 2054, 2040, 2080, 2277, 2225, 2255, 2221, 2253, 2219,
- 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074, 2030, 2281,
- 2235, 2064, 2028, 2187, 2185, 2229 };
- Color PLAYER_FILL_COLOR = new Color(0, 255, 0, 50);
- Color AREA_FILL_COLOR = new Color(0, 48, 128, 20);
- Color TEXT_COLOR = new Color(255, 255, 255, 255);
- Color CRAB_MODEL_COLOR = new Color(0, 0, 255, 50);
- Color BACKGROUND_COLOR = new Color(0, 0, 0, 50);
- RenderingHints ANTI_ALIASING = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- }
- public static abstract class Action {
- public abstract void process();
- public abstract boolean isValid();
- public abstract String getDescription();
- public void complete() {
- }
- public void paint(Graphics render) {
- }
- }
- public class Bank extends Action {
- private RSArea area;
- public Bank(RSArea area) {
- this.area = area;
- }
- public void process() {
- if (bank.isOpen()) {
- if (inventory.getCount() > 0) {
- if (inventory.getCount(Constants.TELETAB) == 0) {
- bank.depositAll();
- } else {
- bank.depositAllExcept(Constants.TELETAB);
- }
- sleep(400);
- }
- if (inventory.getCount(Constants.TELETAB) == 0) {
- if (bank.getCount(Constants.TELETAB) > 0) {
- bank.withdraw(Constants.TELETAB, 1);
- sleep(400);
- }
- }
- if (bank.getCount(Constants.FOOD) > 0) {
- for (int id : Constants.FOOD) {
- bank.withdraw(id, 0);
- }
- } else {
- log("No food found when required. Stopping script.");
- stopScript();
- return;
- }
- if (inventory.getCount(Constants.FOOD) == 0) {
- sleep(400);
- }
- } else {
- bank.open();
- }
- }
- public boolean isValid() {
- return !hasFood() && area.contains(getMyPlayer().getLocation())
- && banking;
- }
- public String getDescription() {
- return "Banking";
- }
- }
- public abstract class EatFood extends Action {
- public abstract boolean isTargetValid();
- public void process() {
- for (int id : Constants.FOOD) {
- if (!eatingFood) {
- log("We aren't eating but we require food!");
- log("Stopping script.");
- stopScript();
- return;
- }
- if (bank.isOpen()) {
- bank.close();
- } else {
- if (inventory.getCount(id) == 0) {
- continue;
- }
- inventory.getItem(id).interact("Eat");
- sleep(500);
- break;
- }
- }
- }
- public boolean isValid() {
- return hasFood() && isTargetValid();
- }
- public String getDescription() {
- return "Eating";
- }
- }
- public abstract class WalkToArea extends Action {
- private RSArea dest;
- private String name;
- private RSTile last;
- public WalkToArea(RSArea dest, String name) {
- this.dest = dest;
- this.name = name;
- }
- protected abstract boolean isTargetValid();
- public void process() {
- if (!walking.isRunEnabled() && walking.getEnergy() > 30) {
- walking.setRun(true);
- sleep(200);
- }
- RSTile tile = dest.getCentralTile();
- if (last == null || getMyPlayer().isIdle()
- || (calc.distanceTo(last) < 10 && !dest.contains(last))) {
- if (!walking.walkTo(tile)) {
- walking.walkTileOnScreen(calc.getTileOnScreen(tile));
- }
- last = walking.getDestination();
- sleep(random(1000, 1800));
- } else {
- idle();
- }
- }
- public boolean isValid() {
- return isTargetValid()
- && !dest.contains(getMyPlayer().getLocation());
- }
- public void complete() {
- last = null;
- }
- public void paint(Graphics render) {
- render.setColor(Constants.AREA_FILL_COLOR);
- for (RSTile t : dest.getTileArray()) {
- Point pn = calc.tileToScreen(t, 0, 0, 0);
- Point px = calc.tileToScreen(t, 1, 0, 0);
- Point py = calc.tileToScreen(t, 0, 1, 0);
- Point pxy = calc.tileToScreen(t, 1, 1, 0);
- if (pn.x > -1 && px.x > -1 && py.x > -1 && pxy.x > -1) {
- render.fillPolygon(new int[] { py.x, pxy.x, px.x, pn.x },
- new int[] { py.y, pxy.y, px.y, pn.y }, 4);
- }
- }
- }
- public String getDescription() {
- return "Walking to " + name + ".";
- }
- }
- private Set<Action> actions;
- private Action action;
- private long scriptStartTime = 0;
- private int kills = 0;
- private int attempts = 0;
- private final int[] startXp = new int[6];
- private final int[] startLevel = new int[6];
- private RSNPC last = null;
- private AdminGUI gui;
- private Action eatAction;
- private boolean usingTabs;
- private boolean eatingFood;
- private boolean banking;
- private boolean pickinguparrows = false;
- private int INTERFACE_BANK_TAB = 1;
- private int[] pickupArrowID = { 864, 882, 884, 886, 888, 890, 892, 2866,
- 877, 9140, 9141, 9142, 13083, 9143, 9144 };
- /*
- * Bronze arrow, Iron arrow, Steel arrow, Mithril arrow, Adamant arrow, Rune
- * arrow, Ogre arrow, Bronze bolts, Iron Bolts, Steel Bolts, Black Bolts,
- * Mithril Bolts, Adamant Bolts, Rune Bolts
- */
- /**
- * RSTile[] BankToCrabs = new RSTile[]{ new RSTile(2727, 3484), new
- * RSTile(2727, 3484), new RSTile(2735, 3492), new RSTile(2741, 3502), new
- * RSTile(2741, 3511), new RSTile(2741, 3525), new RSTile(2738, 3537), new
- * RSTile(2728, 3543), new RSTile(2720, 3544), new RSTile(2711, 3544), new
- * RSTile(2702, 3543), new RSTile(2694, 3545), new RSTile(2685, 3546), new
- * RSTile(2674, 3551), new RSTile(2668, 3558), new RSTile(2660, 3562), new
- * RSTile(2657, 3572), new RSTile(2654, 3581), new RSTile(2654, 3589), new
- * RSTile(2654, 3602), new RSTile(2663, 3615), new RSTile(2665, 3624), new
- * RSTile(2667, 3640), new RSTile(2659, 3655), new RSTile(2668, 3668), new
- * RSTile(2671, 3681), new RSTile(2674, 3693), new RSTile(2673, 3706), new
- * RSTile(2670, 3715) };
- */
- private RSTile CrabsTile = new RSTile(2670, 3715);
- private RSTile BankTile = new RSTile(2727, 3484);
- public boolean onStart() {
- mouse.setSpeed(8);
- gui = new AdminGUI();
- gui.setVisible(true);
- while (!gui.start) {
- sleep(200, 300);
- }
- startL = skills.getCurrentLevel(Skills.STRENGTH);
- if (!isAutoRetaliationOn()) {
- toggleAutoRetaliation();
- }
- usingTabs = gui.chk_teletabs.isSelected();
- banking = gui.chk_banking.isSelected();
- eatingFood = gui.chk_food_eat.isSelected();
- // pickinguparrows = gui.chk_pickinguparrows.isSelected();
- actions = new HashSet<Action>();
- eatAction = new EatFood() {
- public boolean isTargetValid() {
- return requiresFood() && eatingFood;
- }
- };
- actions.add(eatAction);
- actions.add(new EatFood() {
- public boolean isTargetValid() {
- return inBank() && requiresFullHealth() && eatingFood;
- }
- });
- actions.add(new WalkToArea(Constants.BANK_AREA, "bank") {
- protected boolean isTargetValid() {
- return (!hasFood() && eatingFood) && !inBank() && banking;
- }
- public void process() {
- if (usingTabs && inventory.getCount(Constants.TELETAB) > 0
- && !inCamelot()) {
- inventory.getItem(Constants.TELETAB).doAction("Break");
- sleep(3500);
- } else {
- super.process();
- }
- }
- });
- actions.add(new WalkToArea(Constants.CRABS_AREA, "crabs") {
- protected boolean isTargetValid() {
- return ((hasFood() && eatingFood) && !inCrabs() && attempts <= 3)
- || inResetCrabs();
- }
- public void process() {
- attempts = 0;
- super.process();
- }
- });
- actions.add(new WalkToArea(Constants.CRABS_AREA, "crabs again") {
- protected boolean isTargetValid() {
- return (inventory.contains(Constants.TELETAB) && !inBank()
- && !inCrabs() && !inResetCrabs());
- }
- });
- actions.add(new WalkToArea(Constants.RESET_CRABS_AREA, "reset area") {
- @Override
- protected boolean isTargetValid() {
- return attempts > 3 && !inBank();
- }
- });
- actions.add(new Bank(Constants.BANK_AREA));
- return true;
- }
- public int loop() {
- if (!game.isLoggedIn() && skills.getRealLevel(Skills.CONSTITUTION) < 10) {
- return random(100, 200);
- }
- mouse.setSpeed(random(6, 8));
- if (getMyPlayer().getInteracting() != null) {
- idle();
- attempts = 0;
- }
- for (int id : Constants.FOOD) {
- if (inBank() && inventory.contains(id)) {
- walkToCrabs();
- }
- }
- if (eatAction.isValid()) {
- eatAction.process();
- }
- if (action != null) {
- if (action.isValid()) {
- action.process();
- } else {
- action.complete();
- action = null;
- }
- } else {
- for (Action a : actions) {
- if (a.isValid()) {
- action = a;
- break;
- }
- }
- }
- if (needToPickUpArrows()) {
- pickinguparrows = true;
- pickUpArrows();
- return random(50, 70);
- }
- if (last != null) {
- if (last == getMyPlayer().getInteracting()) {
- return random(200, 300);
- }
- if (last.getHPPercent() <= 0) {
- kills++;
- last = null;
- }
- }
- if (action == null) {
- action = getNewCrab();
- }
- antiBan();
- return random(300, 500);
- }
- public void onFinish() {
- log(kills + " crabs killed and gained " + generateTotalXpGained()
- + " xp in "
- + Timer.format(System.currentTimeMillis() - scriptStartTime)
- + ".");
- env.saveScreenshot(game.isLoggedIn());
- }
- private boolean needToPickUpArrows() {
- if (pickinguparrows) {
- for (int ar : pickupArrowID) {
- RSGroundItem arrowToPickUp = groundItems.getNearest(3, ar);
- if (getMyPlayer().getLocation().getY() >= 3710) {
- if (arrowToPickUp != null && !inventory.isFull()) {
- return true;
- } else {
- if (inventory.isFull() && inventory.contains(ar)) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- private void pickUpArrows() {
- if (pickinguparrows) {
- for (int ar2 : pickupArrowID) {
- if (last != null) {
- if (last.getHPPercent() <= 0) {
- if (inventory.isFull() && inventory.contains(ar2)) {
- RSGroundItem arrowToPickUp = groundItems
- .getNearest(pickupArrowID);
- arrowToPickUp.interact("Take");
- sleep(500);
- }
- if (!inventory.isFull()) {
- RSGroundItem arrowToPickUp = groundItems
- .getNearest(pickupArrowID);
- arrowToPickUp.interact("Take");
- sleep(500);
- }
- sleep(random(200, 400));
- if (inventory.contains(ar2)) {
- RSItem arrow = inventory.getItem(pickupArrowID);
- arrow.interact("Wield");
- }
- }
- }
- }
- }
- }
- public boolean isAutoRetaliationOn() {
- return settings.getSetting(172) == 0;
- }
- @SuppressWarnings("deprecation")
- public void toggleAutoRetaliation() {
- if (game.getCurrentTab() != Game.TAB_ATTACK) {
- game.openTab(Game.TAB_ATTACK);
- }
- mouse.click(random(579, 706), random(363, 395), true);
- sleep(random(600, 800));
- }
- private void walkToCrabs() {
- RSWeb walkWeb = web.getWeb(getMyPlayer().getLocation(), CrabsTile);
- if (walkWeb != null) {
- if (!getMyPlayer().isMoving()
- || calc.distanceTo(walking.getDestination()) < 4) {
- try {
- walkWeb.step();
- } catch (Exception e) {
- }
- }
- }
- }
- private Action getNewCrab() {
- final RSNPC n = npcs.getNearest(new Filter<RSNPC>() {
- public boolean accept(RSNPC t) {
- if (!t.isOnScreen() && t.getInteracting() != null
- && !t.getInteracting().equals(getMyPlayer()))
- return false;
- if (t.getHPPercent() == 0)
- if (t.getHPPercent() == 0)
- return false;
- if (t.getLocation().getY() >= 3722
- || t.getLocation().getX() >= 2688)
- return false;
- if (t.getName().equals("Rocks")
- || t.getName().equals("Rock Crab"))
- return true;
- return false;
- }
- });
- if (n != null && n.getModel() != null) {
- last = n;
- if (n.getName().equals("Rocks") || !n.isOnScreen()) {
- if (isInArea(getNpcArea(n.getLocation()))) {
- attempts++;
- }
- if (attempts > 3) {
- log("Rocks not popping?");
- return null;
- }
- return new WalkToArea(getNpcArea(n.getLocation()), "crab") {
- public void complete() {
- super.complete();
- sleep(300);
- }
- protected boolean isTargetValid() {
- return inCrabs() && !inCombat();
- }
- };
- } else {
- }
- }
- return null;
- }
- public void onRepaint(Graphics render) {
- if (game.isLoggedIn() && skills.getRealLevel(Skills.CONSTITUTION) > 1) {
- gainedL = currentL - startL;
- currentL = skills.getCurrentLevel(Skills.STRENGTH);
- if (scriptStartTime == 0) {
- scriptStartTime = System.currentTimeMillis();
- for (int index = 0; index < 6; index++) {
- if (index == 5) {
- startXp[index] = skills.getCurrentExp(6);
- } else {
- startXp[index] = skills.getCurrentExp(index);
- }
- }
- for (int index = 0; index < 6; index++) {
- if (index == 5) {
- startLevel[index] = skills.getCurrentLevel(6);
- } else {
- startLevel[index] = skills.getCurrentLevel(index);
- }
- }
- }
- Graphics2D g = (Graphics2D) render;
- g.setRenderingHints(Constants.ANTI_ALIASING);
- g.setColor(Constants.BACKGROUND_COLOR);
- g.fillRect(10, 25, 175, 205);
- g.setColor(Constants.TEXT_COLOR);
- g.drawString("Rock Crab Killer by Vastico", 20, 55);
- if (action != null) {
- action.paint(g);
- g.setColor(Constants.TEXT_COLOR);
- g.drawString(action.getDescription(), 20, 75);
- } else {
- g.setColor(Constants.TEXT_COLOR);
- g.drawString(getMyPlayer().getInteracting() == null ? "Idle"
- : "Attacking", 20, 75);
- }
- g.setColor(Constants.TEXT_COLOR);
- g.drawString("Kills: " + kills, 20, 95);
- g.drawString(
- "Runtime: "
- + Timer.format(System.currentTimeMillis()
- - scriptStartTime), 20, 115);
- g.drawString("Total XP Gained: " + generateTotalXpGained(), 20, 135);
- g.drawString("XP Per Hour: " + generateXpPerHour(), 20, 155);
- g.drawString("Kills Per Hour: " + generateKillsPerHour(), 20, 175);
- // g.drawString("Current Level: " + currentL + " (" + gainedL + ")",
- // 20, 195);
- g.drawString(
- "Current Version: "
- + getClass().getAnnotation(ScriptManifest.class)
- .version(), 20, 215);
- }
- }
- int currentL;
- int startL;
- int gainedL;
- private int generateTotalXpGained() {
- int gained = 0;
- for (int index = 0; index < 6; index++) {
- if (index == 5) {
- gained += this.skills.getCurrentExp(6);
- } else {
- gained += this.skills.getCurrentExp(index);
- }
- }
- for (int xp : this.startXp) {
- gained -= xp;
- }
- return gained;
- }
- private int generateXpPerHour() {
- return (int) (generateTotalXpGained() * 3600000D / (System
- .currentTimeMillis() - scriptStartTime));
- }
- private int generateKillsPerHour() {
- return (int) (kills * 3600000D / (System.currentTimeMillis() - scriptStartTime));
- }
- private RSArea getNpcArea(RSTile t) {
- int x = t.getX();
- int y = t.getY();
- return new RSArea(x - 1, y - 1, x + 1, y + 1);
- }
- private void idle() {
- if (random(0, 50) == 0) {
- int rand2 = random(1, 3);
- for (int i = 0; i < rand2; i++) {
- mouse.move(random(100, 700), random(100, 500));
- sleep(random(200, 700));
- }
- mouse.move(random(0, 800), 647, 50, 100);
- sleep(random(100, 1500));
- mouse.move(random(75, 400), random(75, 400), 30);
- }
- if (random(0, 50) == 0) {
- Point curPos = mouse.getLocation();
- mouse.move(random(0, 750), random(0, 500), 20);
- sleep(random(100, 300));
- mouse.move(curPos, 20, 20);
- }
- if (random(0, 50) == 0) {
- int angle = camera.getAngle() + random(-40, 40);
- if (angle < 0) {
- angle += 359;
- }
- if (angle > 359) {
- angle -= 359;
- }
- camera.setAngle(angle);
- }
- if (random(0, 50) == 0) {
- if (random(0, 4) == 0) {
- camera.setPitch(random(50, 80));
- } else {
- camera.setPitch(true);
- }
- }
- }
- public void antiBan() {
- int b = random(0, 10);
- switch (b) {
- case 1: // Checking HP XP
- if (random(0, 4) == 4) {
- game.openTab(1);
- skills.doHover(Skills.INTERFACE_CONSTITUTION);
- sleep(random(3000, 4000));
- }
- break;
- case 2: // Mouse off Screen
- if (random(0, 4) == 3) {
- mouse.moveOffScreen();
- sleep(random(2000, 5500));
- }
- break;
- case 3: // Move Mouse
- if (random(0, 4) == 2) {
- mouse.moveSlightly();
- sleep(300, 700);
- mouse.moveRandomly(40, 860);
- }
- break;
- case 4: // Turn Screen
- if (random(0, 4) == 1) {
- camera.setAngle(random(100, 359));
- sleep(500, 1500);
- }
- break;
- default:
- break;
- }
- }
- private boolean hasFood() {
- return inventory.getCount(Constants.FOOD) > 0;
- }
- private boolean requiresFood() {
- return combat.getLifePoints() < (skills
- .getRealLevel(Skills.CONSTITUTION) * 10) / 2;
- }
- private boolean requiresFullHealth() {
- return combat.getLifePoints() < (skills
- .getRealLevel(Skills.CONSTITUTION) * 10);
- }
- private boolean inBank() {
- return Constants.BANK_AREA.contains(getMyPlayer().getLocation());
- }
- private boolean inCamelot() {
- return Constants.CAMELOT_AREA.contains(getMyPlayer().getLocation());
- }
- private boolean inCombat() {
- return getMyPlayer().isInCombat()
- && getMyPlayer().getInteracting() != null;
- }
- private boolean inCrabs() {
- return Constants.CRABS_AREA.contains(getMyPlayer().getLocation());
- }
- private boolean inResetCrabs() {
- return Constants.RESET_CRABS_AREA.contains(getMyPlayer().getLocation());
- }
- private boolean isInArea(RSArea area) {
- return area.contains(getMyPlayer().getLocation());
- }
- public class AdminGUI extends JFrame {
- public boolean start = false;
- private static final long serialVersionUID = 1L;
- public AdminGUI() {
- try {
- UIManager.setLookAndFeel(UIManager
- .getSystemLookAndFeelClassName());
- } catch (Exception e) {
- }
- initComponents();
- }
- private void initComponents() {
- btn_Start = new JButton();
- tbp_main = new JTabbedPane();
- lbl_created = new JLabel();
- pnl_preferences = new JPanel();
- lbl_preferences = new JLabel();
- lbl_food_eat = new JLabel();
- txt_food_eat = new JTextField();
- btn_food_eat_browse = new JButton();
- chk_food_eat = new JCheckBox();
- chk_banking = new JCheckBox();
- chk_teletabs = new JCheckBox();
- chk_arrows = new JCheckBox();
- mnu_bar = new JMenuBar();
- mnu_file = new JMenu();
- mit_exit = new JMenuItem();
- setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- setTitle("Rock Crab Killer");
- setAlwaysOnTop(true);
- setFont(new Font("Georgia", 0, 12));
- setName("frm_main");
- setResizable(false);
- btn_Start.setFont(new Font("Verdana", 0, 12));
- btn_Start.setText("Start");
- btn_Start.setToolTipText("Start the Script!");
- btn_Start.setCursor(new Cursor(Cursor.HAND_CURSOR));
- btn_Start.setFocusable(false);
- btn_Start.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- btn_StartActionPerformed(evt);
- }
- });
- lbl_preferences.setFont(new Font("Verdana", 0, 18));
- lbl_preferences.setHorizontalAlignment(SwingConstants.CENTER);
- lbl_preferences.setText("Preferences");
- lbl_food_eat.setFont(new Font("Verdana", 0, 12));
- lbl_food_eat.setText("Food to Eat:");
- txt_food_eat.setFont(new Font("Verdana", 0, 11));
- txt_food_eat.setToolTipText("Seperate each item with a comma (,)");
- txt_food_eat.setEnabled(false);
- btn_food_eat_browse.setFont(new Font("Verdana", 0, 11));
- btn_food_eat_browse.setText("...");
- btn_food_eat_browse
- .setToolTipText("Click here to search your inventory for food item id's");
- btn_food_eat_browse.setEnabled(false);
- chk_food_eat.setFont(new Font("Verdana", 0, 11));
- chk_food_eat.setText("Eat Food?");
- chk_food_eat.setToolTipText("Will we be eating food?");
- chk_banking.setFont(new Font("Verdana", 0, 11));
- chk_banking.setText("Banking?");
- chk_banking
- .setToolTipText("Will we be banking if we run out of food?");
- chk_teletabs.setFont(new Font("Verdana", 0, 11));
- chk_teletabs.setText("Using Teletabs?");
- chk_teletabs.setToolTipText("Are we using Teletabs?");
- chk_arrows.setFont(new Font("Verdana", 0, 11));
- chk_arrows.setText("Pickup arrows?");
- chk_arrows.setEnabled(false);
- GroupLayout pnl_preferencesLayout = new GroupLayout(pnl_preferences);
- pnl_preferences.setLayout(pnl_preferencesLayout);
- pnl_preferencesLayout
- .setHorizontalGroup(pnl_preferencesLayout
- .createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(
- pnl_preferencesLayout
- .createSequentialGroup()
- .addContainerGap()
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addComponent(
- lbl_preferences,
- GroupLayout.DEFAULT_SIZE,
- 425,
- Short.MAX_VALUE)
- .addComponent(
- lbl_food_eat)
- .addGroup(
- GroupLayout.Alignment.TRAILING,
- pnl_preferencesLayout
- .createSequentialGroup()
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.TRAILING)
- .addComponent(
- txt_food_eat,
- GroupLayout.Alignment.LEADING,
- GroupLayout.DEFAULT_SIZE,
- 374,
- Short.MAX_VALUE))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addComponent(
- btn_food_eat_browse)))
- .addGroup(
- pnl_preferencesLayout
- .createSequentialGroup()
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addComponent(
- chk_banking)
- .addComponent(
- chk_food_eat))
- .addGap(14,
- 14,
- 14)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(GroupLayout.Alignment.LEADING))
- .addGap(18,
- 18,
- 18)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addComponent(
- chk_teletabs))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED,
- 90,
- Short.MAX_VALUE)))
- .addContainerGap())
- .addGroup(
- pnl_preferencesLayout
- .createSequentialGroup()
- .addGap(10, 10, 10)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addGroup(
- pnl_preferencesLayout
- .createSequentialGroup()
- .addGap(249,
- 249,
- 249)
- .addComponent(
- chk_arrows)))
- .addContainerGap()));
- pnl_preferencesLayout
- .setVerticalGroup(pnl_preferencesLayout
- .createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(
- pnl_preferencesLayout
- .createSequentialGroup()
- .addContainerGap()
- .addComponent(lbl_preferences,
- GroupLayout.PREFERRED_SIZE,
- 19,
- GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.UNRELATED)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(GroupLayout.Alignment.BASELINE))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(lbl_food_eat)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.BASELINE)
- .addComponent(
- txt_food_eat,
- GroupLayout.PREFERRED_SIZE,
- GroupLayout.DEFAULT_SIZE,
- GroupLayout.PREFERRED_SIZE)
- .addComponent(
- btn_food_eat_browse))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.BASELINE)
- .addComponent(
- chk_food_eat)
- .addComponent(
- chk_teletabs))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.BASELINE)
- .addComponent(
- chk_banking))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED,
- GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(
- pnl_preferencesLayout
- .createParallelGroup(
- GroupLayout.Alignment.BASELINE)
- .addComponent(
- chk_arrows))
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addGap(16, 16, 16)));
- tbp_main.addTab("Preferences", pnl_preferences);
- mnu_file.setText("File");
- mit_exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4,
- InputEvent.ALT_MASK));
- mit_exit.setText("Exit");
- mit_exit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- mit_exitActionPerformed(evt);
- }
- });
- mnu_file.add(mit_exit);
- mnu_bar.add(mnu_file);
- setJMenuBar(mnu_bar);
- GroupLayout layout = new GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(layout
- .createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(tbp_main)
- .addGroup(
- GroupLayout.Alignment.TRAILING,
- layout.createSequentialGroup()
- .addContainerGap(341, Short.MAX_VALUE)
- .addComponent(btn_Start,
- GroupLayout.PREFERRED_SIZE, 89,
- GroupLayout.PREFERRED_SIZE)
- .addContainerGap()));
- layout.setVerticalGroup(layout.createParallelGroup(
- GroupLayout.Alignment.LEADING).addGroup(
- layout.createSequentialGroup()
- .addComponent(tbp_main, GroupLayout.PREFERRED_SIZE,
- 330, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btn_Start,
- GroupLayout.PREFERRED_SIZE, 41,
- GroupLayout.PREFERRED_SIZE)
- .addContainerGap(GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE)));
- pack();
- }
- private void mit_exitActionPerformed(ActionEvent evt) {
- stopScript();
- setVisible(false);
- }
- private void btn_StartActionPerformed(ActionEvent evt) {
- start = true;
- setVisible(false);
- }
- private JButton btn_Start;
- private JButton btn_food_eat_browse;
- private JCheckBox chk_arrows;
- private JCheckBox chk_banking;
- private JCheckBox chk_food_eat;
- private JCheckBox chk_teletabs;
- private JLabel lbl_created;
- private JLabel lbl_food_eat;
- private JLabel lbl_preferences;
- private JMenuItem mit_exit;
- private JMenuBar mnu_bar;
- private JMenu mnu_file;
- private JPanel pnl_preferences;
- private JTabbedPane tbp_main;
- private JTextField txt_food_eat;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement