Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.border.EmptyBorder;
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- import java.util.LinkedList;
- import java.util.List;
- import org.powerbot.concurrent.Task;
- import org.powerbot.concurrent.strategy.Condition;
- import org.powerbot.concurrent.strategy.Strategy;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.Manifest;
- import org.powerbot.game.api.methods.Calculations;
- import org.powerbot.game.api.methods.Game;
- import org.powerbot.game.api.methods.Settings;
- import org.powerbot.game.api.methods.Tabs;
- import org.powerbot.game.api.methods.Walking;
- import org.powerbot.game.api.methods.Widgets;
- import org.powerbot.game.api.methods.input.Keyboard;
- import org.powerbot.game.api.methods.input.Mouse;
- import org.powerbot.game.api.methods.interactive.NPCs;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.node.GroundItems;
- import org.powerbot.game.api.methods.node.SceneEntities;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.widget.Camera;
- import org.powerbot.game.api.util.Filter;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.wrappers.Area;
- import org.powerbot.game.api.wrappers.Entity;
- import org.powerbot.game.api.wrappers.Tile;
- import org.powerbot.game.api.wrappers.interactive.NPC;
- import org.powerbot.game.api.wrappers.interactive.Player;
- import org.powerbot.game.api.wrappers.node.GroundItem;
- import org.powerbot.game.api.wrappers.node.Item;
- import org.powerbot.game.api.wrappers.node.SceneObject;
- import org.powerbot.game.api.wrappers.widget.WidgetChild;
- import org.powerbot.game.bot.event.MessageEvent;
- import org.powerbot.game.bot.event.listener.MessageListener;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(authors = { "beharon, revised by jadedtdt" }, name = "Beharon's Wine Grabber", description = "Makes about 200k-250k gold/hr!. Grabs Wine of Zamorak. WorldHopper||LodeStone||Teleport||Beeper. Version 2.4 ....", version = 2.4)
- public class WineGrabber extends ActiveScript implements PaintListener, MessageListener {
- // Tiles
- Area atBank = new Area(new Tile[] {
- new Tile(2942, 3373, 0), new Tile(2942, 3368, 0),
- new Tile(2948, 3368, 0), new Tile(2948, 3373, 0)
- });
- Area atZamorak = new Area(new Tile(2946, 3472, 0), new Tile(2955, 3476, 0));
- Area atLodestone = new Area(new Tile[] {
- new Tile(2966, 3406, 0), new Tile(2970, 3406, 0),
- new Tile(2966, 3402, 0), new Tile(2970, 3402, 0)
- });
- Area atCentralFalador = new Area(new Tile[] {
- new Tile(2960, 3385, 0), new Tile(2960, 3370, 0),
- new Tile(2969, 3370, 0), new Tile(2969, 3385, 0)
- });
- Tile bankTile = new Tile(2945, 3367, 0);
- Area zamorakPath = new Area(new Tile[] {
- new Tile(2942, 3468, 0), new Tile(2961, 3468, 0),
- new Tile(2961, 3392, 0), new Tile(2942, 3394, 0)
- });
- Tile[] tilesToZamorak = new Tile[] { new Tile(2944, 3370, 0),
- new Tile(2945, 3375, 0), new Tile(2950, 3376, 0),
- new Tile(2954, 3379, 0), new Tile(2955, 3381, 0),
- new Tile(2963, 3384, 0), new Tile(2965, 3389, 0),
- new Tile(2965, 3394, 0), new Tile(2963, 3399, 0),
- new Tile(2961, 3404, 0), new Tile(2961, 3409, 0),
- new Tile(2958, 3413, 0), new Tile(2955, 3417, 0),
- new Tile(2953, 3422, 0), new Tile(2951, 3427, 0),
- new Tile(2949, 3432, 0), new Tile(2948, 3437, 0),
- new Tile(2947, 3442, 0), new Tile(2945, 3449, 0),
- new Tile(2945, 3454, 0), new Tile(2948, 3458, 0),
- new Tile(2949, 3463, 0), new Tile(2952, 3467, 0),
- new Tile(2955, 3471, 0), new Tile(2950, 3474, 0)
- };
- Tile[] running = new Tile[] {
- new Tile(2948, 3462, 0), new Tile(2949, 3460, 0),
- new Tile(2948, 3458, 0), new Tile(2949, 3459, 0),
- new Tile(2950, 3456, 0), new Tile(2948, 3453, 0),
- new Tile(2948, 3450, 0), new Tile(2947, 3448, 0)
- };
- Tile[] tilesToBankLode = new Tile[] {
- new Tile(2966, 3394, 0), new Tile(2961, 3384, 0),
- new Tile(2956, 3380, 0), new Tile(2951, 3378, 0),
- new Tile(2947, 3375, 0), new Tile(2945, 3368, 0)
- };
- Tile[] tilesToBankTele = new Tile[] {
- new Tile(2957, 3381, 0), new Tile(2952, 3378, 0),
- new Tile(2947, 3375, 0), new Tile(2946, 3371, 0),
- new Tile(2945, 3368, 0)
- };
- Tile hover = new Tile(2946, 3473, 0);
- // CPU Settings
- boolean ForcedLow;
- int CPULevel;
- // Widgets
- private static WidgetChild TeleGrab;
- private static WidgetChild FalaSpell;
- private static WidgetChild FalaTele;
- private static WidgetChild Close;
- private static WidgetChild Lobby;
- private static WidgetChild skipEmail;
- private static WidgetChild worldSelect;
- private static WidgetChild Play;
- private static WidgetChild TeleOrder;
- //GE Prices
- private int WineP(int id) throws IOException {
- URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + 245);
- URLConnection con = url.openConnection();
- BufferedReader in = new BufferedReader(new InputStreamReader(
- con.getInputStream()));
- String line = "";
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- line += inputLine;
- }
- in.close();
- if (!line.contains("mark_price"))
- return -1;
- line = line.substring(line.indexOf("mark_price\":\"")
- + "mark_price\":\"".length());
- line = line.substring(0, line.indexOf("\""));
- return Integer.parseInt(line.replaceAll(",", ""));
- }
- private int LawP(int id) throws IOException {
- URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + 563);
- URLConnection con = url.openConnection();
- BufferedReader in = new BufferedReader(new InputStreamReader(
- con.getInputStream()));
- String line = "";
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- line += inputLine;
- }
- in.close();
- if (!line.contains("mark_price"))
- return -1;
- line = line.substring(line.indexOf("mark_price\":\"")
- + "mark_price\":\"".length());
- line = line.substring(0, line.indexOf("\""));
- return Integer.parseInt(line.replaceAll(",", ""));
- }
- //GE Prices Ints
- int winePrice;
- int lawPrice;
- //GUI Stats
- int wineshop = 3;
- int winesmax = 15;
- // Bot Stats
- int winesCollected;
- int timeRun;
- int winesTotalMissed;
- int winesMissed;
- int lawRunesLeft;
- int waterRunesLeft;
- int mageXpCounter;
- int mageXpGained;
- long mageXpHr;
- // Monitoring
- int inventoryTab;
- boolean Warning;
- // Wine of Zamorak Timing
- long firstWine;
- long secondWine;
- long lastWine;
- boolean found;
- // Time Calculations
- long startTime;
- long elapsedTime;
- String time;
- long hr, min, sec;
- int refreshTime;
- // GUI
- Gui g;
- private boolean guiWait = true;
- public boolean hop = false;
- public boolean beep = false;
- @Override
- protected void setup() {
- while (Camera.getPitch() < 80) {
- Camera.setPitch(true);
- Time.sleep(100);
- }
- //GE Prices
- try {
- winePrice = WineP(245);
- lawPrice = LawP(563);
- } catch (IOException e) {
- e.printStackTrace();
- }
- //GE Prices End
- if (!Tabs.getCurrent().equals(Tabs.MAGIC))
- Tabs.MAGIC.open();
- Time.sleep(100);
- TeleOrder = Widgets.get(192, 18);
- TeleOrder.click(true);
- Time.sleep(100);
- if (!Tabs.getCurrent().equals(Tabs.INVENTORY))
- Tabs.INVENTORY.open();
- Time.sleep(100);
- lawRunesLeft = Inventory.getCount(true, 563);
- waterRunesLeft = Inventory.getCount(true, 555);
- inventoryTab = Inventory.getCount(245);
- if (lawRunesLeft < 28)
- Warning = true;
- else
- Warning = false;
- startTime = System.currentTimeMillis();
- firstWine = 0;
- secondWine = 0;
- lastWine = 0;
- found = false;
- log.info("Script Started. Using Version 2.4");
- g = new Gui();
- g.setVisible(true);
- final WaitGui guiTask = new WaitGui();
- provide(new Strategy(guiTask, guiTask));
- provide(new Strategy(new WaitGui(), new WaitGui()));
- provide(new Strategy(new Run(), new Run()));
- provide(new Strategy(new GrabZammy(), new GrabZammy()));
- provide(new Strategy(new TeleFalador(), new TeleFalador()));
- provide(new Strategy(new BankIt(), new BankIt()));
- provide(new Strategy(new TraverseZammy(), new TraverseZammy()));
- provide(new Strategy(new ToBankLode(), new ToBankLode()));
- provide(new Strategy(new ToBankTele(), new ToBankTele()));
- }
- private class WaitGui implements Task, Condition {
- @Override
- public void run() {
- while (guiWait && isWorking()) {
- Time.sleep(500);
- }
- }
- public boolean validate() {
- return guiWait;
- }
- }
- public void messageReceived(MessageEvent e) {
- String txt = e.getMessage().toLowerCase();
- if(txt.contains("too late")) {
- log.info("A wine was missed.");
- if (beep = true) {
- System.out.println("\007\007\007");
- }
- winesTotalMissed++;
- winesMissed++;
- mageXpCounter++;
- }
- }
- private class TraverseZammy implements Task, Condition {
- public void run() {
- System.out.println("Started traverse zammy");
- while (!atZamorak.contains(Players.getLocal().getLocation())
- && isWorking()) {
- Walking.setRun(true);
- if (Calculations.distance(new Tile(2950, 3474, 0), Players
- .getLocal().getLocation()) < 10) {
- Walking.walk(new Tile(2950, 3474, 0));
- Time.sleep(2000, 3200);
- } else {
- walkPath(tilesToZamorak);
- Time.sleep(1000);
- }
- }
- }
- public boolean validate() {
- if (!Tabs.getCurrent().equals(Tabs.INVENTORY))
- Tabs.INVENTORY.open();
- return (atBank.contains(Players.getLocal().getLocation())
- && Inventory.getCount() < 28 && lawRunesLeft >= 27)
- || zamorakPath.contains(Players.getLocal().getLocation()) &&
- !Players.getLocal().isInCombat();
- }
- }
- private class BankIt implements Task, Condition {
- @Override
- public void run() {
- Walking.setRun(false);
- //Banking
- if (Bank.isOpen()) {
- Bank.depositAllExcept(563, 555);
- lawRunesLeft = Inventory.getCount(true, 563);
- inventoryTab = 0;
- Time.sleep(1000, 2000);
- if (lawRunesLeft < 30) {
- if (Bank.withdraw(563, 60)) {
- lawRunesLeft += 28;
- Warning = true;
- } else {
- System.out
- .println("ran out of bank supply, not enough law runes to complete. closing script");
- stop();
- }
- }
- Bank.close();
- } else {
- if (!Players.getLocal().equals(bankTile)) {
- Walking.walk(bankTile);
- Time.sleep(2000, 3000);
- }
- Bank.open();
- Time.sleep(1000, 1500);
- }
- }
- @Override
- public boolean validate() {
- if (!Tabs.getCurrent().equals(Tabs.INVENTORY))
- Tabs.INVENTORY.open();
- return atBank.contains(Players.getLocal().getLocation())
- || (Inventory.getCount() == 28 && lawRunesLeft == 0);
- }
- }
- public class ToBankLode implements Task, Condition {
- @Override
- public void run() {
- System.out.println("Starting banking");
- Time.sleep(1000);
- SceneObject LodeStone = SceneEntities.getNearest(new Filter<SceneObject>() {
- public boolean accept(SceneObject entity) {
- return entity.getId() == 69835;
- }
- });
- if (LodeStone.isOnScreen()) {
- atBank.contains(Players.getLocal().getLocation());
- while (!atBank.contains(Players.getLocal().getLocation())) {
- walkPath(tilesToBankLode);
- Time.sleep(1500, 1800);
- }
- }else{
- log.info("error");
- }
- }
- @Override
- public boolean validate() {
- return atLodestone.contains(Players.getLocal().getLocation())
- && (Inventory.getCount() == 28);
- }
- }
- private class ToBankTele implements Task, Condition {
- @Override
- public void run() {
- atBank.contains(Players.getLocal().getLocation());
- while (!atBank.contains(Players.getLocal().getLocation())) {
- walkPath(tilesToBankTele);
- Time.sleep(1500, 1800);
- }
- }
- @Override
- public boolean validate() {
- return atCentralFalador.contains(Players.getLocal().getLocation());
- }
- }
- private class TeleFalador implements Task, Condition {
- @Override
- public void run() {
- Tabs.MAGIC.open();
- Time.sleep(1000);
- if (waterRunesLeft != 0) {
- FalaSpell = Widgets.get(192, 46);
- FalaSpell.click(true);
- log.info("Teleporting to Falador");
- Time.sleep(Random.nextInt(3000, 4300));
- }else{
- FalaTele = Widgets.get(192, 24);
- FalaTele.click(true);
- Time.sleep(500);
- Mouse.move(275, 200);
- Mouse.click(true);
- Time.sleep(500);
- if (Players.getLocal().getAnimation() == -1) {
- log.info("Teleporting to LodeStone");
- Time.sleep(15000);
- }else{
- log.info("Didn't click the right LodeStone!");
- return;
- }
- }
- }
- @Override
- public boolean validate() {
- return atZamorak.contains(Players.getLocal().getLocation())
- && (Inventory.getCount() == 28);
- }
- }
- public class Run implements Task, Condition {
- @Override
- public void run() {
- Walking.setRun(true);
- log.info("ENGAGED IN COMBAT!");
- Time.sleep(200);
- while (Players.getLocal().isInCombat()) {
- walkPath(running);
- Time.sleep(200);
- }
- }
- @Override
- public boolean validate() {
- return Players.getLocal().isInCombat();
- }
- }
- private class GrabZammy implements Task, Condition {
- public void run() {
- while (!Players.getLocal().getLocation()
- .equals(new Tile(2947, 3473, 0))) {
- Walking.walk(new Tile(2947, 3472, -1));
- Time.sleep(4000, 5000);
- }
- if (lawRunesLeft == 0) {
- System.out.println("Ran out of Law Runes");
- Time.sleep(10000);
- }
- GrabWine();
- lawRunesLeft--;
- if (!Tabs.getCurrent().equals(Tabs.INVENTORY))
- Tabs.INVENTORY.open();
- if (inventoryTab == Inventory.getCount(245)) {
- } else {
- winesCollected++;
- inventoryTab++;
- mageXpCounter++;
- }
- if (hop = true) {
- WorldHopping();
- }
- }
- @Override
- public boolean validate() {
- if (!Tabs.getCurrent().equals(Tabs.INVENTORY))
- Tabs.INVENTORY.open();
- return Inventory.getCount() < 28
- && atZamorak.contains(Players.getLocal().getLocation())
- && lawRunesLeft > 1
- && !Players.getLocal().isInCombat();
- }
- }
- public void WorldHopping() {
- if (hop = true) {
- if (winesMissed == wineshop) {
- Close = Widgets.get(548, 150);
- Close.click(true);
- Time.sleep(Random.nextInt(500, 1500));
- log.info("Hopping World-Initiated");
- Lobby = Widgets.get(182, 2);
- Lobby.click(true);
- Time.sleep(Random.nextInt(3000, 5000));
- skipEmail = Widgets.get(906, 378);
- if (skipEmail.isOnScreen()) {
- skipEmail.click(true);
- }
- Time.sleep(Random.nextInt(3000, 5000));
- Mouse.move(190, 190);
- Mouse.click(true);
- Time.sleep(Random.nextInt(700, 1300));
- worldSelect = Widgets.get(906, 214);
- worldSelect.click(true);
- Time.sleep(Random.nextInt(100, 500));
- Mouse.move(372, 211);
- Mouse.click(true);
- Time.sleep(Random.nextInt(500, 1000));
- Play = Widgets.get(906, 196);
- Play.click(true);
- if (Game.isLoggedIn()) {
- log.info("Hopping World-Complete");
- Time.sleep(1000);
- }else{
- Time.sleep(1000);
- }
- winesMissed = 0;
- }
- if (winesTotalMissed >= winesmax) {
- log.info("TOO MANY WINES MISSED, LOGGING OUT");
- stop();
- }
- }
- }
- public void GrabWine() {
- Time.sleep(1000);
- Tabs.MAGIC.open();
- TeleGrab = Widgets.get(192, 44);
- Time.sleep(1000);
- TeleGrab.click(true);
- Time.sleep(500);
- MouseMoveToZammy();
- determineCompetition();
- setRefreshRate();
- GroundItem WineOfZamorak = newItem();
- Mouse.click(tileToScreen(WineOfZamorak.getLocation(), -500), true);
- Time.sleep(3000, 4000);
- }
- private GroundItem newItem() {
- GroundItem wine = GroundItems.getNearest(245);
- while (wine == null && isWorking()) {
- wine = GroundItems.getNearest(245);
- Time.sleep(refreshTime);
- }
- if (!found) {
- firstWine = System.currentTimeMillis();
- found = true;
- } else {
- secondWine = System.currentTimeMillis();
- found = false;
- }
- return wine;
- }
- public long findLastTime() {
- if (firstWine > secondWine) {
- return lastWine;
- } else {
- lastWine = (secondWine - firstWine) / 1000;
- return lastWine;
- }
- }
- public void MouseMoveToZammy() {
- Point a = new Point();
- a = tileToScreen(hover, -500);
- Mouse.move(a.x, a.y);
- }
- public boolean isWorking() {
- if (this.isRunning() && !this.isPaused())
- return true;
- return false;
- }
- int id = 245;
- int getPrice(int id) throws IOException {
- String price;
- URL url = new URL("http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj=" + id);
- java.net.URLConnection con = url.openConnection();
- BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
- String line;
- while ((line = in.readLine()) != null) {
- if (line.contains("<td>")) {
- price = line.substring(line.indexOf(">") + 1, line.indexOf("/") - 1);
- price = price.replace(",", "");
- try {
- return Integer.parseInt(price);
- } catch (Exception e) {
- return -1;
- }
- }
- }
- return -1;
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(255, 255, 255);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(255, 0, 51);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 20);
- private final Font font2 = new Font("Arial", 0, 10);
- public void onRepaint(Graphics g1) {
- int mageXpGained = (mageXpCounter*43);
- int lawsUsed = (winesTotalMissed+winesCollected);
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(2, 272, 514, 63);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(2, 272, 514, 63);
- g.setFont(font1);
- g.drawString("Beharon's Wine Grabber", 7, 292);
- g.setFont(font2);
- if (ForcedLow) {
- g.setColor(color3);
- g.drawString("CPU Usage Level: Forced Low Usage", 237, 286);
- } else {
- g.drawString("CPU Usage Level: Level " + CPULevel, 237, 286);
- }
- g.setColor(color2);
- g.drawString("Wines Grabbed: " + winesCollected, 8, 303);
- g.drawString("Wines Missed: " + winesTotalMissed, 11, 320);
- g.drawString(timeRun(), 468, 290);
- g.drawString("Law Runes Left: " + lawRunesLeft, 104, 303);
- g.drawString("Wine Timing: " + findLastTime(), 109, 320);
- g.drawString("Magic Exp Gained: " + mageXpGained, 233, 303);
- g.drawString("Magic Exp Gained / Hr: " + "soon", 227, 320);
- g.drawString("Profit Gained: " + ((winesCollected*winePrice) - (lawsUsed*lawPrice)), 383, 303);
- g.drawString("Profit Gained / Hr: " + "soon", 373, 320);
- if (Warning) {
- g.setColor(color3);
- g.drawString("Warning - Running on Bank Supply", 94, 332);
- }
- //END: Code generated using Enfilade's Easel
- }
- public String timeRun() {
- elapsedTime = System.currentTimeMillis() - startTime;
- time = "";
- hr = elapsedTime / (1000 * 60 * 60);
- min = (elapsedTime % (1000 * 60 * 60)) / (1000 * 60);
- sec = ((elapsedTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
- if (hr < 10)
- time += "0" + hr + ":";
- else
- time += hr + ":";
- if (min < 10)
- time += "0" + min + ":";
- else
- time += min + ":";
- if (sec < 10)
- time += "0" + sec;
- else
- time += sec;
- return time;
- }
- public void determineCompetition() {
- Filter<Player> a = new Filter<Player>() {
- public boolean accept(Player test) {
- if (test.getName().equals(Players.getLocal().getName()))
- return false;
- return true;
- }
- };
- if (Players.getNearest(a) == null) {
- // no competition
- ForcedLow = true;
- } else {
- if (!(Calculations.distance(Players.getNearest(a).getLocation(),
- Players.getLocal().getLocation()) < 5)) {
- ForcedLow = true;
- } else
- ForcedLow = false;
- }
- }
- public void setRefreshRate() {
- if (ForcedLow == true)
- refreshTime = 200;
- else
- switch (CPULevel) {
- case 1:
- refreshTime = 50;
- break;
- case 2:
- refreshTime = 40;
- break;
- case 3:
- refreshTime = 30;
- break;
- case 4:
- refreshTime = 20;
- break;
- case 5:
- refreshTime = 10;
- break;
- default:
- refreshTime = 25;
- }
- }
- public Point tileToScreen(Tile tile, double dX, double dY, int height) {
- return Calculations.groundToScreen(
- (int) ((tile.getX() - Game.getBaseX() + dX) * 512.0D),
- (int) ((tile.getY() - Game.getBaseY() + dY) * 512.0D), 1,
- height);
- }
- public Point tileToScreen(Tile tile, int height) {
- return tileToScreen(tile, 0.5D, 0.5D, height);
- }
- private boolean walkPath(final Tile[] path) {
- boolean a = false;
- final Tile next = getNext(path);
- final Tile dest = Walking.getDestination();
- final Tile myTile = Players.getLocal().getLocation();
- if (dest.getX() == -1 || Calculations.distance(myTile, dest) < 6
- || Calculations.distance(next, Walking.getDestination()) > 3) {
- if (!Walking.walk(next)) {
- if (Walking.walk(path[0])) {
- Time.sleep(500);
- a = true;
- } else {
- if (dividePath(path[0]))
- Time.sleep(500);
- }
- } else {
- Time.sleep(500);
- a = true;
- }
- }
- return a;
- }
- private Tile getNext(final Tile[] tiles) {
- for (int i = tiles.length - 1; i >= 0; --i) {
- if (Calculations.distance(Players.getLocal().getLocation(),
- tiles[i]) < 15 && tiles[i] != Walking.getDestination())
- return tiles[i];
- }
- return null;
- }
- private boolean dividePath(final Tile t) {
- final Tile mine = Players.getLocal().getLocation();
- final int x = t.getX(), y = t.getY(), z = t.getPlane(), myX = mine
- .getX(), myY = mine.getY();
- final Tile newT = new Tile((int) (x + myX) / 2, (int) (y + myY) / 2, z);
- if (Walking.walk(newT))
- return true;
- return dividePath(newT);
- }
- public static class Bank {
- private static final int[] BANKERS = { 44, 45, 494, 495, 496, 497, 498,
- 499, 553, 909, 958, 1036, 2271, 2354, 2355, 2718, 2759, 3198,
- 3293, 3416, 3418, 3824, 4456, 4457, 4458, 4459, 5488, 5901,
- 5912, 6362, 6532, 6533, 6534, 6535, 7605, 8948, 9710, 14367 };
- private static final int[] BANK_BOOTHS = { 782, 2213, 2995, 5276, 6084,
- 10517, 11402, 11758, 12759, 14367, 19230, 20325, 24914, 11338,
- 25808, 26972, 29085, 52589, 34752, 35647, 36786, 2012, 2015,
- 2019, 42217, 42377, 42378 };
- private static final int[] DEPOSIT_BOXES = { 2045, 9398, 20228, 24995,
- 25937, 26969, 32924, 32930, 32931, 34755, 36788, 39830, 45079 };
- private static final int[] BANK_CHESTS = { 2693, 4483, 8981, 12308,
- 21301, 20607, 21301, 27663, 42192 };
- private static final int[] WIDGET_BANK_TAB = { 65, 63, 61, 59, 57, 55,
- 53, 51, 49 };
- private static final int BANK_TOGGLE_REARRANGE_MODE_SETTING = 304;
- private static final int BANK_SEARCH_SETTING = 1248;
- private static final int BANK_TOGGLE_WITHDRAW_MODE_SETTING = 115;
- private static final int WIDGET_BANK = 762;
- private static final int WIDGET_BANK_BUTTON_CLOSE = 45;
- private static final int WIDGET_BANK_BUTTON_DEPOSIT_EQUIPPED_ITEMS = 38;
- private static final int WIDGET_BANK_BUTTON_DEPOSIT_FAMILIAR_INVENTORY = 40;
- private static final int WIDGET_BANK_BUTTON_DEPOSIT_INVENTORY_ITEMS = 34;
- private static final int WIDGET_BANK_BUTTON_DEPOSIT_MONEY_POUCH = 36;
- private static final int WIDGET_BANK_BUTTON_OPEN_EQUIP = 120;
- private static final int WIDGET_BANK_BUTTON_SEARCH = 18;
- private static final int WIDGET_BANK_BUTTON_SWAP = 16;
- private static final int WIDGET_BANK_BUTTON_WITHDRAW_TOGGLE = 19;
- private static final int WIDGET_BANK_INVENTORY = 95;
- private static final int WIDGET_BANK_SCROLLBAR = 116;
- private static final int WIDGET_DEPOSIT_BOX = 11;
- private static final int WIDGET_DEPOSIT_BOX_BUTTON_CLOSE = 15;
- private static final int WIDGET_DEPOSIT_BOX_INVENTORY = 17;
- private static final int WIDGET_DEPOSIT_BUTTON_DEPOSIT_EQUIPPED_ITEMS = 23;
- private static final int WIDGET_DEPOSIT_BUTTON_DEPOSIT_FAMILIAR_INVENTORY = 25;
- private static final int WIDGET_DEPOSIT_BUTTON_DEPOSIT_INVENTORY_ITEMS = 19;
- private static final int WIDGET_DEPOSIT_BUTTON_DEPOSIT_MONEY_POUCH = 21;
- public static boolean isOpen() {
- return Widgets.get(WIDGET_BANK).validate();
- }
- public static boolean isDepositOpen() {
- return Widgets.get(WIDGET_DEPOSIT_BOX).validate();
- }
- public static boolean open() {
- if (isOpen() || isDepositOpen()) {
- return true;
- }
- final Entity bankEntity = findBankEntity();
- if (bankEntity != null) {
- if (bankEntity.isOnScreen()) {
- if (bankEntity.interact("Bank", "")
- || bankEntity.interact("Use")
- || bankEntity.interact("Open")
- || bankEntity.interact("Deposit")) {
- for (int i = 0; i < 10
- && (!isOpen() && !isDepositOpen()); i++) {
- if (Players.getLocal().isMoving()) {
- i = 0;
- }
- Time.sleep(200);
- }
- }
- }
- }
- return isOpen() || isDepositOpen();
- }
- public static boolean close() {
- if (Widgets.get(WIDGET_BANK, WIDGET_BANK_BUTTON_CLOSE).interact(
- "Close")
- || Widgets.get(WIDGET_DEPOSIT_BOX,
- WIDGET_DEPOSIT_BOX_BUTTON_CLOSE).interact("Close")) {
- for (int i = 0; i < 10 && (isDepositOpen() || isOpen()); i++) {
- Time.sleep(150);
- }
- }
- return !isOpen() && !isDepositOpen();
- }
- public static boolean withdraw(final int itemID, final int amount) {
- if (isOpen()) {
- if (amount >= -1) {
- final Item item = getItem(itemID);
- if (item == null) {
- return false;
- }
- final WidgetChild itemWidget = item.getWidgetChild();
- final int count = Inventory.getCount();
- Widgets.scroll(itemWidget,
- Widgets.get(WIDGET_BANK, WIDGET_BANK_SCROLLBAR));
- switch (amount) {
- case -1:
- itemWidget.interact("Withdraw-All but one",
- item.getName());
- break;
- case 0:
- itemWidget.interact("Withdraw-All", item.getName());
- break;
- case 1:
- itemWidget.click(true);
- break;
- default:
- if (!itemWidget.interact("Withdraw-" + amount,
- item.getName())) {
- if (itemWidget.interact("Withdraw-X",
- item.getName())) {
- Time.sleep(Random.nextInt(1000, 1300));
- Keyboard.sendText(String.valueOf(amount), true);
- }
- } else
- break;
- }
- for (int i = 0; i < 150; i++) {
- final int newCount = Inventory.getCount(true);
- if (newCount > count || newCount == 28) {
- Time.sleep(Random.nextInt(100, 125));
- return true;
- }
- Time.sleep(20);
- }
- }
- }
- return false;
- }
- public static boolean withdraw(final String itemName, final int amount) {
- return withdraw(nameToID(itemName), amount);
- }
- public static boolean deposit(final int itemID, final int amount) {
- if (isOpen() || isDepositOpen()) {
- if (isOpen() ? Inventory.getCount() == 0 : getBoxCount() == 0) {
- return true;
- }
- if (amount >= 0) {
- final int count = isOpen() ? Inventory.getCount(true,
- itemID) : getBoxCount(true, itemID);
- final Item item = isOpen() ? getInventoryItem(itemID)
- : getBoxItem(itemID);
- if (item == null) {
- return true;
- }
- final WidgetChild itemWidget = item.getWidgetChild();
- switch (amount) {
- case 0:
- itemWidget.interact((count > 1 ? "Deposit-All"
- : "Deposit"), item.getName());
- break;
- case 1:
- itemWidget.interact("Deposit", item.getName());
- break;
- default:
- if (!itemWidget.interact("Deposit-" + amount,
- item.getName())) {
- if (itemWidget
- .interact("Deposit-X", item.getName())) {
- Time.sleep(Random.nextInt(1000, 1300));
- Keyboard.sendText(String.valueOf(amount), true);
- }
- }
- break;
- }
- for (int i = 0; i < 100; i++) {
- final int newCount = isOpen() ? Inventory.getCount(
- true, itemID) : getBoxCount(true, itemID);
- if (newCount < count || newCount == 0) {
- Time.sleep(Random.nextInt(100, 125));
- return true;
- }
- Time.sleep(Random.nextInt(10, 15));
- }
- }
- }
- return false;
- }
- public static boolean deposit(final String itemName, final int amount) {
- return deposit(nameToID(itemName), amount);
- }
- public static boolean depositAllExcept(final int... itemIDs) {
- if (isOpen() || isDepositOpen()) {
- if (isOpen() ? Inventory.getCount() == 0 : getBoxCount() == 0) {
- return true;
- }
- if (isOpen() ? getInventoryCount(false, itemIDs) == 0
- : getBoxCount(false, itemIDs) == 0) {
- return depositAll();
- }
- final Item[] items = isOpen() ? Inventory.getItems()
- : getBoxItems();
- outer: for (final Item item : items) {
- if (item != null && item.getId() != -1) {
- for (final int itemID : itemIDs) {
- if (item.getId() == itemID) {
- continue outer;
- }
- }
- for (int j = 0; j < 5
- && Inventory.getCount(item.getId()) != 0; j++) {
- if (deposit(item.getId(), 0)) {
- Time.sleep(Random.nextInt(75, 125));
- }
- }
- }
- }
- return isOpen() ? getInventoryCount(true)
- - getInventoryCount(true, itemIDs) == 0
- : getBoxCount(true) - getBoxCount(true, itemIDs) == 0;
- }
- return false;
- }
- public static int getBoxCount(final boolean includeStacks,
- final int... itemIDs) {
- int count = 0;
- if (Widgets.get(WIDGET_DEPOSIT_BOX, WIDGET_DEPOSIT_BOX_INVENTORY)
- .validate()) {
- for (final Item item : getBoxItems(itemIDs)) {
- if (item != null) {
- count += includeStacks ? item.getStackSize() : 1;
- }
- }
- }
- return count;
- }
- public static int getBoxCount(final int... itemIDs) {
- return getBoxCount(false, itemIDs);
- }
- public static int getBoxCount(final boolean includeStacks) {
- return getBoxCountExcept(includeStacks, -1);
- }
- public static int getBoxCount() {
- return getBoxCountExcept(false, -1);
- }
- public static int getBoxCountExcept(final boolean includeStacks,
- final int... itemIDs) {
- int count = 0;
- outer: for (final Item item : getBoxItems()) {
- if (item != null) {
- for (final int itemID : itemIDs) {
- if (item.getId() == itemID) {
- continue outer;
- }
- }
- count += includeStacks ? item.getStackSize() : 1;
- }
- }
- return count;
- }
- public static int getBoxCountExcept(final int... itemIDs) {
- return getBoxCountExcept(false, itemIDs);
- }
- public static int getCount(final boolean includeStacks,
- final int... itemIDs) {
- int count = 0;
- for (final Item item : getItems(itemIDs)) {
- if (item != null) {
- count += includeStacks ? item.getStackSize() : 1;
- }
- }
- return count;
- }
- public static int getCount(final int... itemIDs) {
- return getCount(false, itemIDs);
- }
- public static int getCount(final boolean includeStacks) {
- return getCountExcept(includeStacks, -1);
- }
- public static int getCount() {
- return getCountExcept(false, -1);
- }
- public static int getCountExcept(final boolean includeStacks,
- final int... itemIDs) {
- int count = 0;
- outer: for (final Item item : getItems()) {
- if (item != null) {
- for (int itemID : itemIDs) {
- if (item.getId() == itemID) {
- continue outer;
- }
- }
- count += includeStacks ? item.getStackSize() : 1;
- }
- }
- return count;
- }
- public static int getCountExcept(final int... itemIDs) {
- return getCountExcept(false, itemIDs);
- }
- public static Item[] getItems() {
- final List<Item> items = new LinkedList<Item>();
- if (Widgets.get(WIDGET_BANK, WIDGET_BANK_INVENTORY).validate()) {
- for (final WidgetChild item : Widgets.get(WIDGET_BANK,
- WIDGET_BANK_INVENTORY).getChildren()) {
- if (item != null && item.getChildId() != -1) {
- items.add(new Item(item));
- }
- }
- }
- return items.toArray(new Item[items.size()]);
- }
- public static Item[] getItems(final int... itemIDs) {
- final List<Item> items = new LinkedList<Item>();
- for (final Item item : getItems()) {
- for (final int itemID : itemIDs) {
- if (item.getId() == itemID) {
- items.add(item);
- }
- }
- }
- return items.toArray(new Item[items.size()]);
- }
- public static Item getItem(final int itemID) {
- for (final Item item : getItems()) {
- if (item.getId() == itemID) {
- return item;
- }
- }
- return null;
- }
- public static Item getItem(final String itemName) {
- return getItem(nameToID(itemName));
- }
- public static Item[] getBoxItems() {
- final List<Item> items = new LinkedList<Item>();
- if (Widgets.get(WIDGET_DEPOSIT_BOX, WIDGET_DEPOSIT_BOX_INVENTORY)
- .validate()) {
- for (final WidgetChild item : Widgets.get(WIDGET_DEPOSIT_BOX,
- WIDGET_DEPOSIT_BOX_INVENTORY).getChildren()) {
- if (item != null && item.getChildId() != -1) {
- items.add(new Item(item));
- }
- }
- }
- return items.toArray(new Item[items.size()]);
- }
- public static Item[] getBoxItems(final int... itemIDs) {
- final List<Item> items = new LinkedList<Item>();
- for (final Item item : getBoxItems()) {
- for (final int itemID : itemIDs) {
- if (item.getId() == itemID) {
- items.add(item);
- }
- }
- }
- return items.toArray(new Item[items.size()]);
- }
- public static Item getBoxItem(final int itemID) {
- for (final Item item : getBoxItems()) {
- if (item.getId() == itemID) {
- return item;
- }
- }
- return null;
- }
- public static Item getBoxItem(final String itemName) {
- return getBoxItem(nameToID(itemName));
- }
- public static boolean depositAll() {
- return Widgets.get(
- isOpen() ? WIDGET_BANK : WIDGET_DEPOSIT_BOX,
- isOpen() ? WIDGET_BANK_BUTTON_DEPOSIT_INVENTORY_ITEMS
- : WIDGET_DEPOSIT_BUTTON_DEPOSIT_INVENTORY_ITEMS)
- .interact("Deposit carried items");
- }
- public static boolean depositEquipped() {
- return Widgets.get(
- isOpen() ? WIDGET_BANK : WIDGET_DEPOSIT_BOX,
- isOpen() ? WIDGET_BANK_BUTTON_DEPOSIT_EQUIPPED_ITEMS
- : WIDGET_DEPOSIT_BUTTON_DEPOSIT_EQUIPPED_ITEMS)
- .interact("Deposit worn items");
- }
- public static boolean depositFamiliar() {
- return Widgets.get(
- isOpen() ? WIDGET_BANK : WIDGET_DEPOSIT_BOX,
- isOpen() ? WIDGET_BANK_BUTTON_DEPOSIT_FAMILIAR_INVENTORY
- : WIDGET_DEPOSIT_BUTTON_DEPOSIT_FAMILIAR_INVENTORY)
- .interact("Deposit beast of burden inventory");
- }
- public static boolean depositMoneyPouch() {
- return Widgets.get(
- isOpen() ? WIDGET_BANK : WIDGET_DEPOSIT_BOX,
- isOpen() ? WIDGET_BANK_BUTTON_DEPOSIT_MONEY_POUCH
- : WIDGET_DEPOSIT_BUTTON_DEPOSIT_MONEY_POUCH)
- .interact("Deposit money pouch contents");
- }
- public static boolean setWithdrawModeToItem() {
- return (Settings.get(BANK_TOGGLE_WITHDRAW_MODE_SETTING) == 0 || Settings
- .get(BANK_TOGGLE_WITHDRAW_MODE_SETTING) == 1
- && Widgets.get(WIDGET_BANK,
- WIDGET_BANK_BUTTON_WITHDRAW_TOGGLE).interact(
- "Switch to item"));
- }
- public static boolean setWithdrawModeToNote() {
- return (Settings.get(BANK_TOGGLE_WITHDRAW_MODE_SETTING) == 1 || Settings
- .get(BANK_TOGGLE_WITHDRAW_MODE_SETTING) == 0
- && Widgets.get(WIDGET_BANK,
- WIDGET_BANK_BUTTON_WITHDRAW_TOGGLE).interact(
- "Switch to note"));
- }
- public static boolean setRearrangeModeToInsert() {
- return (Settings.get(BANK_TOGGLE_REARRANGE_MODE_SETTING) == 1 || Settings
- .get(BANK_TOGGLE_REARRANGE_MODE_SETTING) != 1
- && Widgets.get(WIDGET_BANK, WIDGET_BANK_BUTTON_SWAP)
- .interact("Switch to insert"));
- }
- public static boolean setRearrangeModeToSwap() {
- return (Settings.get(BANK_TOGGLE_REARRANGE_MODE_SETTING) == 0 || Settings
- .get(BANK_TOGGLE_REARRANGE_MODE_SETTING) == 1
- && Widgets.get(WIDGET_BANK, WIDGET_BANK_BUTTON_SWAP)
- .interact("Switch to swap"));
- }
- public static boolean openEquipment() {
- return Widgets.get(WIDGET_BANK, WIDGET_BANK_BUTTON_OPEN_EQUIP)
- .interact("Show Equipment Stats");
- }
- public static int getCurrentTab() {
- return ((Settings.get(BANK_SEARCH_SETTING) >>> 24) - 136) / 8;
- }
- public static boolean openTab(final int tab) {
- try {
- return Widgets.get(WIDGET_BANK, WIDGET_BANK_TAB[tab - 1])
- .interact("View " + (tab == 1 ? "all" : "tab " + tab));
- } catch (ArrayIndexOutOfBoundsException ignored) {
- }
- return false;
- }
- public static boolean isSearchOpen() {
- return Settings.get(BANK_SEARCH_SETTING) == Integer.MIN_VALUE;
- }
- public static boolean searchItem(final String itemName) {
- if (isSearchOpen()) {
- if (!Widgets.get(WIDGET_BANK, WIDGET_BANK_BUTTON_SEARCH)
- .interact("Search")) {
- return false;
- }
- for (int i = 0; i < 30 && isSearchOpen(); i++) {
- Time.sleep(50);
- }
- Time.sleep(Random.nextInt(130, 285));
- }
- if (Widgets.get(WIDGET_BANK, WIDGET_BANK_BUTTON_SEARCH).interact(
- "Search")) {
- for (int i = 0; i < 30 && !isSearchOpen(); i++) {
- Time.sleep(50);
- }
- if (isSearchOpen()) {
- Time.sleep(Random.nextInt(130, 285));
- Keyboard.sendText(itemName, true);
- Time.sleep(Random.nextInt(500, 800));
- return true;
- }
- }
- return false;
- }
- private static Entity findBankEntity() {
- final SceneObject bankBooth = SceneEntities.getNearest(BANK_BOOTHS);
- final SceneObject bankChest = SceneEntities.getNearest(BANK_CHESTS);
- final SceneObject depositBox = SceneEntities
- .getNearest(DEPOSIT_BOXES);
- final NPC banker = NPCs.getNearest(BANKERS);
- Entity bankEntity = null;
- if (bankBooth != null) {
- if (banker != null) {
- if (Random.nextInt(1, 11) < 7) {
- bankEntity = bankBooth;
- } else {
- bankEntity = banker;
- }
- } else {
- bankEntity = bankBooth;
- }
- } else if (banker != null) {
- bankEntity = banker;
- } else if (bankChest != null) {
- bankEntity = bankChest;
- } else if (depositBox != null) {
- bankEntity = depositBox;
- }
- return bankEntity;
- }
- private static int nameToID(final String itemName) {
- final Item[] items = isOpen() ? getItems() : getBoxItems();
- for (final Item item : items) {
- if (item.getName().toLowerCase().equals(itemName.toLowerCase())) {
- return item.getId();
- }
- if (item.getName().toLowerCase()
- .contains(itemName.toLowerCase())) {
- return item.getId();
- }
- }
- return -1;
- }
- private static Item getInventoryItem(final int itemID) {
- for (final Item item : Inventory.getItems()) {
- if (item.getId() == itemID) {
- return new Item(item.getWidgetChild());
- }
- }
- return null;
- }
- private static int getInventoryCount(final boolean includeStacks) {
- int count = 0;
- for (final Item item : Inventory.getItems()) {
- count += includeStacks ? item.getStackSize() : 1;
- }
- return count;
- }
- private static int getInventoryCount(final boolean includeStacks,
- final int... itemIDs) {
- int count = 0;
- for (final int itemID : itemIDs) {
- count += Inventory.getCount(includeStacks, itemID);
- }
- return count;
- }
- }
- @SuppressWarnings("serial")
- public class Gui extends JFrame {
- private JPanel contentPane;
- /**
- * Create the frame.
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public Gui() {
- super("Beharon's Wine Grabber"); // name the window that it the GUI
- // pops in
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- }
- });
- final JCheckBox chckbxTomeOfFrost = new JCheckBox("Tome of Frost?");
- final JCheckBox chckbxRunicStaff = new JCheckBox("Runic Staff?");
- final JCheckBox chckbxBeep = new JCheckBox("Using Beeper?");
- final JCheckBox chckbxHopping = new JCheckBox("Hopping?");
- final JCheckBox chckbxStoppingAfterX = new JCheckBox("Stopping after X Misses?");
- final JComboBox comboBox = new JComboBox();
- final JComboBox comboBoxWinesMax = new JComboBox();
- final JComboBox comboBoxWinesHop = new JComboBox();
- final JLabel lblMissesforHop = new JLabel("Misses for Hop:");
- final JLabel lblMaximum = new JLabel("Max Misses:");
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- setBounds(100, 100, 450, 300);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- JButton btnStart = new JButton("Start");
- btnStart.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- if (chckbxTomeOfFrost.isSelected()) {
- waterRunesLeft = 1000000;
- log.info("Using Tome of Frost");
- }
- if (chckbxRunicStaff.isSelected()) {
- waterRunesLeft = 1000000;
- lawRunesLeft = 1000000;
- log.info("Using a Runic Staff");
- log.info("Beware: The bot will not know when the charges run out!");
- }
- if (chckbxBeep.isSelected()) {
- beep = false;
- }
- if (chckbxStoppingAfterX.isSelected()) {
- String t = comboBoxWinesMax.getSelectedItem().toString(); {
- if (t.equals("2")) {
- winesmax = 2;
- } else if (t.equals("3")) {
- winesmax = 3;
- } else if (t.equals("4")) {
- winesmax = 4;
- } else if (t.equals("5")) {
- winesmax = 5;
- } else if (t.equals("6")) {
- winesmax = 6;
- } else if (t.equals("7")) {
- winesmax = 7;
- } else if (t.equals("8")) {
- winesmax = 8;
- } else if (t.equals("9")) {
- winesmax = 9;
- } else if (t.equals("10")) {
- winesmax = 10;
- } else if (t.equals("11")) {
- winesmax = 11;
- } else if (t.equals("12")) {
- winesmax = 12;
- } else if (t.equals("13")) {
- winesmax = 13;
- } else if (t.equals("14")) {
- winesmax = 14;
- } else if (t.equals("15")) {
- winesmax = 15;
- } else if (t.equals("18")) {
- winesmax = 18;
- } else if (t.equals("21")) {
- winesmax = 21;
- } else if (t.equals("24")) {
- winesmax = 24;
- } else if (t.equals("27")) {
- winesmax = 27;
- } else if (t.equals("30")) {
- winesmax = 30;
- }
- }
- log.info("Stopping after: " + winesmax + " misses.");
- }else{
- winesmax = 1000000;
- }
- if (chckbxHopping.isSelected()) {
- hop = true;
- log.info("Using hopping method");
- String u = comboBoxWinesHop.getSelectedItem().toString(); {
- if (u.equals("1")) {
- wineshop = 1;
- log.info("Hopping after: " + wineshop + " miss.");
- } else if (u.equals("2")) {
- wineshop = 2;
- log.info("Hopping after: " + wineshop + " misses.");
- } else if (u.equals("3")) {
- wineshop = 3;
- log.info("Hopping after: " + wineshop + " misses.");
- } else if (u.equals("4")) {
- wineshop = 4;
- log.info("Hopping after: " + wineshop + " misses.");
- } else if (u.equals("5")) {
- wineshop = 5;
- log.info("Hopping after: " + wineshop + " misses.");
- }
- }
- }else{
- log.info("Not using hopping method");
- hop = false;
- wineshop = 1000000;
- }
- //THANK YOU GOOGLE386 FOR FIXING COMPILING ERROR! :D
- //Changed from 1.7.0 to 1.6.0 to fix a majority of issues.
- String s = comboBox.getSelectedItem().toString(); {
- if (s.equals("Lowest")) {
- CPULevel = 1;
- } else if (s.equals("Low")) {
- CPULevel = 2;
- } else if (s.equals("Moderate")) {
- CPULevel = 3;
- } else if (s.equals("High")) {
- CPULevel = 4;
- } else if (s.equals("Highest")) {
- CPULevel = 5;
- }
- }
- guiWait = false;
- dispose();
- }
- });
- btnStart.setBounds(177, 189, 89, 23);
- contentPane.add(btnStart);
- comboBox.setModel(new DefaultComboBoxModel(new String[] {"Lowest", "Low", "Moderate", "High", "Highest"}));
- comboBox.setSelectedIndex(2);
- comboBox.setBounds(177, 78, 89, 20);
- contentPane.add(comboBox);
- JLabel lblBeharonsWineGrabber = new JLabel("Beharon's Wine Grabber");
- lblBeharonsWineGrabber.setHorizontalAlignment(SwingConstants.CENTER);
- lblBeharonsWineGrabber.setFont(new Font("Book Antiqua", Font.PLAIN, 14));
- lblBeharonsWineGrabber.setBounds(82, 11, 271, 14);
- contentPane.add(lblBeharonsWineGrabber);
- JLabel lblCpuUsage = new JLabel("CPU Usage:");
- lblCpuUsage.setHorizontalAlignment(SwingConstants.CENTER);
- lblCpuUsage.setBounds(82, 81, 85, 14);
- contentPane.add(lblCpuUsage);
- lblMaximum.setFont(new Font("Stencil", Font.PLAIN, 11));
- lblMaximum.setBounds(57, 161, 97, 14);
- contentPane.add(lblMaximum);
- lblMissesforHop.setVisible(false);
- lblMissesforHop.setFont(new Font("Stencil", Font.PLAIN, 11));
- lblMissesforHop.setBounds(57, 131, 97, 14);
- contentPane.add(lblMissesforHop);
- comboBoxWinesMax.setMaximumRowCount(30);
- comboBoxWinesMax.setModel(new DefaultComboBoxModel(new String[] {"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "18", "21", "24", "27", "30"}));
- comboBoxWinesMax.setSelectedIndex(13);
- comboBoxWinesMax.setBounds(177, 157, 89, 20);
- contentPane.add(comboBoxWinesMax);
- comboBoxWinesHop.setVisible(false);
- comboBoxWinesHop.setMaximumRowCount(5);
- comboBoxWinesHop.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5"}));
- comboBoxWinesHop.setSelectedIndex(2);
- comboBoxWinesHop.setBounds(177, 127, 89, 20);
- contentPane.add(comboBoxWinesHop);
- chckbxTomeOfFrost.setBounds(82, 47, 97, 23);
- contentPane.add(chckbxTomeOfFrost);
- chckbxBeep.setSelected(true);
- chckbxBeep.setBounds(280, 47, 97, 23);
- contentPane.add(chckbxBeep);
- chckbxRunicStaff.setBounds(177, 47, 97, 23);
- contentPane.add(chckbxRunicStaff);
- chckbxHopping.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- if (chckbxHopping.isSelected()) {
- comboBoxWinesHop.setVisible(true);
- lblMissesforHop.setVisible(true);
- }else{
- comboBoxWinesHop.setVisible(false);
- lblMissesforHop.setVisible(false);
- }
- }
- });
- chckbxHopping.setForeground(Color.RED);
- chckbxHopping.setBounds(177, 105, 97, 23);
- contentPane.add(chckbxHopping);
- chckbxStoppingAfterX.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- if (chckbxStoppingAfterX.isSelected()) {
- comboBoxWinesMax.setVisible(true);
- lblMaximum.setVisible(true);
- }else{
- comboBoxWinesMax.setVisible(false);
- lblMaximum.setVisible(false);
- }
- }
- });
- chckbxStoppingAfterX.setSelected(true);
- chckbxStoppingAfterX.setBounds(280, 105, 148, 23);
- contentPane.add(chckbxStoppingAfterX);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment