Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import java.io.BufferedWriter;
- import java.io.*;
- import javax.swing.*;
- import javax.swing.border.TitledBorder;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Magic;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSModel;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.util.GlobalConfiguration;
- /**
- * @author jtryba
- * @version 2.0 (c)2010-2011 jtryba, No one except jtryba has the right to
- * modify and/or spread this script without the permission of jtryba.
- * I'm not held responsible for any damage that may occur to your
- * property.
- */
- @ScriptManifest(authors = { "jtryba" }, keywords = "combat", name = "monkR8per", version = 2.2, description = ("Kills monks at the monastery... Heals.. Enjoy."))
- public class monkR8per extends Script implements PaintListener,
- ServerMessageListener, MouseMotionListener {
- // USER OPTIONS
- public int healAtPercent = 0;
- public int mouseSpeed = 0;
- public int skillToTrain = 0;
- public int levelToStopAt = 0;
- public int rangeStyle = 0;
- public int autoCastSpellID = 0;
- public int ammoID = 0;
- public boolean showMonk = false;
- public boolean pickAmmo = false;
- public boolean stopScript = false;
- public boolean healAfterCombat = false;
- public boolean clickMiniMap = false;
- public boolean buryBones = false;
- public boolean bankBones = false;
- public boolean showPaint = false;
- public boolean showProfit = false;
- public boolean takeRandomBones = false;
- public boolean showMouse = false;
- public boolean antiBan = false;
- public boolean waitForDrop = false;
- public Color monkColor = null;
- public Color mouseColor = null;
- public Color paintColor = null;
- public Color textColor = null;
- // SCRIPT VARIABLES
- monkR8perGUI gui;
- public Point mousePoint = null;
- public RSNPC currentNPC = null;
- public RSTile fromBankPath[] = null;
- public RSTile dest = null;
- public RSTile bankBoothTile = null;
- public boolean guiExit = true;
- public boolean firstRun = true;
- public boolean clickContinue = false;
- public boolean justHealed = false;
- public boolean healing = false;
- public boolean doBury = false;
- public boolean doBank = false;
- public boolean npcBusy = false;
- public boolean noAmmo = false;
- public boolean wasInCombat = false;
- public boolean justBanked = false;
- public int bonesMarketPrice = 0;
- public int currentMouseSpeed = 0;
- public int totalHealed = 0;
- public int deaths = 0;
- public int lastBoneCount = 0;
- public int totalBones = 0;
- public int lastExp = 0;
- public long lastCheck;
- public long startTime;
- public long runTime;
- public String status = "";
- public String spellName = "";
- public String ammoName = "";
- /*-start exp-*/
- public int startDefExp = 0;
- public int startAttExp = 0;
- public int startStrExp = 0;
- public int startConExp = 0;
- public int startRanExp = 0;
- public int startPraExp = 0;
- public int startMagExp = 0;
- // GUI VARIABLES
- public int totalBuriedBones = 0;
- public int bonesPerHour = 0;
- public int bankTrips = 0;
- /*-gained exp-*/
- public int defExpGained = 0;
- public int strExpGained = 0;
- public int attExpGained = 0;
- public int conExpGained = 0;
- public int ranExpGained = 0;
- public int praExpGained = 0;
- public int magExpGained = 0;
- public int totalExpGained = 0;
- /*-gained lvl-*/
- public int defLvlGained = 0;
- public int strLvlGained = 0;
- public int attLvlGained = 0;
- public int conLvlGained = 0;
- public int ranLvlGained = 0;
- public int praLvlGained = 0;
- public int magLvlGained = 0;
- public int totalLvlGained = 0;
- public int combatLevelsGained = 0;
- // END GUI VARIABLES
- // SCRIPT CONSTANTS
- public final File settingsFile = new File(new File(
- GlobalConfiguration.Paths.getSettingsDirectory()),
- "monkR8per_Settings.txt");
- static final RSTile headMonkTile = new RSTile(3056, 3483);
- static final RSTile boothTile = new RSTile(3095, 3493);
- static final RSTile boothTile2 = new RSTile(3097, 3495);
- static final RSArea monkArea = new RSArea(new RSTile(3041, 3480),
- new RSTile(3062, 3501));
- static final RSArea edgeArea = new RSArea(new RSTile(3041, 3480),
- new RSTile(3099, 3520));
- static final RSArea bankArea = new RSArea(new RSTile(3090, 3487),
- new RSTile(3099, 3500));
- static final RSTile toBankPath[] = { new RSTile(3051, 3491),
- new RSTile(3052, 3502), new RSTile(3064, 3511),
- new RSTile(3075, 3504), new RSTile(3088, 3501),
- new RSTile(3094, 3496) };
- static final int monkID = 7727;
- static final int headMonkID = 801;
- static final int airID = 556;
- static final int waterID = 555;
- static final int earthID = 557;
- static final int fireID = 554;
- static final int mindID = 558;
- static final int chaosID = 562;
- static final int deathID = 560;
- static final int lawID = 563;
- static final int boneID = 526;
- static final int bronzeArrowID = 882;
- static final int ironArrowID = 884;
- static final int steelArrowID = 886;
- static final int mithrilArrowID = 888;
- static final int adamiteArrowID = 890;
- static final int runeArrowID = 892;
- final int notToDeposit[] = { ammoID, airID, waterID, earthID, fireID,
- mindID, chaosID, deathID, lawID };
- static final Color bgRed = new Color(255, 0, 0, 150);
- static final Color bgBlue = new Color(0, 0, 255, 150);
- static final Color bgGreen = new Color(0, 255, 0, 50);
- static final Color bgPurple = new Color(255, 0, 255, 150);
- static final Color bgOrange = new Color(255, 128, 0, 150);
- static final Color bgYellow = new Color(255, 255, 50, 150);
- static final Color bgWhite = new Color(255, 255, 255, 150);
- static final Color bgBlack = new Color(0, 0, 0, 150);
- static final Color cPurple = new Color(255, 0, 255);
- static final Color tRed = new Color(255, 0, 0, 50);
- static final Color tBlue = new Color(0, 0, 255, 50);
- static final Color tGreen = new Color(0, 255, 0, 50);
- static final Color tPurple = new Color(255, 0, 255, 50);
- static final Color tOrange = new Color(255, 128, 0, 50);
- static final Color tYellow = new Color(255, 255, 50, 50);
- static final Color tWhite = new Color(255, 255, 255, 50);
- static final Color tBlack = new Color(0, 0, 0, 150);
- public final Filter<RSNPC> filter = new Filter<RSNPC>() {
- public boolean accept(RSNPC npc) {
- return !npc.isInCombat() && npcPresent(npc)
- && npc.getID() == monkID;
- }
- private boolean npcPresent(RSNPC npc) {
- return npc != null && monkArea.contains(npc.getLocation());
- }
- };
- @Override
- public int loop() {
- if (game.isLoggedIn()
- && skills.getCurrentLevel(Skills.CONSTITUTION) > 1) {
- if (firstRun) {
- setup();
- }
- currentMouseSpeed = mouseSpeed + random(-2, 2);
- mouse.setSpeed(currentMouseSpeed);
- checkRun();
- safety();
- countHeals();
- if (!firstRun && bankBones) {
- countBones();
- }
- if (clickContinue && interfaces.canContinue()) {
- interfaces.clickContinue();
- clickContinue = false;
- mouse.moveSlightly();
- return random(500, 750);
- }
- if (stopScript) {
- stopAtLevel();
- }
- if (noAmmo) {
- if (inventory.contains(ammoID)) {
- status = "Equping ammo";
- RSItem ammo = inventory.getItem(ammoID);
- if (ammo != null) {
- ammo.doAction("Wield");
- mouse.moveSlightly();
- noAmmo = false;
- return random(750, 1000);
- }
- } else {
- status = "Stopping script";
- log("Out of ammo stopping script.");
- game.logout(true);
- sleep(random(1500, 2000));
- if (!game.isLoggedIn()) {
- stopScript();
- }
- return 5;
- }
- }
- if (npcBusy) {
- if (camera.getPitch() > 15) {
- camera.setPitch(5);
- }
- RSTile centerTile = monkArea.getCentralTile();
- if (calc.distanceTo(centerTile) < 5) {
- RSTile randomCorner = new RSTile(0000, 0000);
- int r = random(1, 3); // pick a random corner
- switch (r) {
- case 1:
- randomCorner = new RSTile(3045, 3497);
- break;
- case 2:
- randomCorner = new RSTile(3045, 3484);
- break;
- case 3:
- randomCorner = new RSTile(3058, 3484);
- break;
- }
- status = "[AB] - Run away";
- walking.walkTileOnScreen(walking.randomizeTile(
- randomCorner, 1, 1));
- npcBusy = false;
- return random(250, 500);
- } else {
- status = "[AB] - Run away";
- walking.walkTo(walking.randomizeTile(centerTile, 3, 3));
- npcBusy = false;
- return random(250, 500);
- }
- }
- if (needsToBank() && !atBank()) {
- doBank = true;
- status = "Walking to bank";
- if (dest == null
- || getMyPlayer().isIdle()
- || (calc.distanceTo(dest) < 5 && !bankArea
- .contains(dest))) {
- if (walkPath(toBankPath)) {
- dest = walking.getDestination();
- return random(500, 750);
- }
- }
- return random(5, 10);
- } else if (needsToBank() && atBank()) {
- dest = null;
- if (bank.isOpen()) {
- status = "Depositing";
- bank.depositAllExcept(notToDeposit);
- doBank = false;
- justBanked = true;
- return random(1000, 1500);
- } else {
- status = "Opening bank";
- if (camera.getPitch() > 15) {
- camera.setPitch(5);
- }
- RSObject bankBooth = objects.getTopAt(bankBoothTile);
- if (bankBooth != null) {
- camera.turnToTile(bankBoothTile);
- if (bankBooth.isOnScreen()) {
- bankBooth.doAction("Use-quickly");
- return random(1000, 1500);
- }
- }
- return random(5, 10);
- }
- } else if (atMonks()) {
- dest = null;
- if (needsToHeal() || healing) {
- healing = true;
- status = "Healing";
- RSComponent interface1 = interfaces.getComponent(241, 5);
- RSComponent interface2 = interfaces.getComponent(230, 2);
- RSComponent interface3 = interfaces.getComponent(228, 2);
- RSComponent interface4 = interfaces.getComponent(64, 5);
- RSComponent interface5 = interfaces.getComponent(210, 2);
- if (camera.getPitch() > 15) {
- camera.setPitch(5);
- }
- if (interface1.isValid()) {
- interface1.doClick();
- return random(750, 1000);
- } else if (interface2.isValid()) {
- interface2.doClick();
- return random(750, 1000);
- } else if (interface3.isValid()) {
- interface3.doClick();
- return random(750, 1000);
- } else if (interface4.isValid()) {
- interface4.doClick();
- return random(750, 1000);
- } else if (interface5.isValid()) {
- interface5.doClick();
- sleep(750, 1000);
- if (currentHP() >= (maxHP() - (maxHP() * .10))) {
- justHealed = true;
- healing = false;
- return 1;
- }
- return 1;
- } else {
- if (camera.getPitch() > 40) {
- camera.setPitch(25);
- }
- RSNPC headMonk = npcs.getNearest(headMonkID);
- if (headMonk != null) {
- if (calc.distanceTo(headMonkTile) < 5) {
- camera.turnToTile(headMonkTile);
- headMonk.doAction("Talk-to");
- return random(750, 1250);
- } else {
- if (!getMyPlayer().isMoving()) {
- RSTile path[] = walking
- .findPath(headMonkTile);
- walking.walkPathMM(path);
- return random(750, 1000);
- }
- return random(5, 10);
- }
- }
- }
- } else if (!inCombat()) {
- if (wasInCombat) {
- currentNPC = null;
- wasInCombat = false;
- if (waitForDrop && !needsToHeal()) {
- waitForDrop(5000);
- return random(250, 500);
- }
- }
- if (needsToBury()) {
- if (inventory.contains(boneID)) {
- status = "Burying bones";
- doBury = true;
- RSItem bones = inventory.getItem(boneID);
- if (bones != null) {
- bones.doAction("Bury");
- return random(350, 600);
- }
- return random(5, 10);
- } else {
- doBury = false;
- return random(5, 10);
- }
- }
- if (canTakeAmmo() && (!waitForDrop || takeRandomBones)) {
- status = "Picking up ammo";
- RSGroundItem ammo = groundItems.getNearest(ammoID);
- RSTile ammoTile = ammo.getLocation();
- if (ammo != null && ammoTile != null) {
- camera.turnToTile(ammoTile);
- if (calc.distanceTo(ammoTile) < 5) {
- camera.setPitch(100);
- if (ammo.doAction("Take " + ammoName)) {
- mouse.moveSlightly();
- return random(500, 750);
- }
- return random(50, 100);
- } else {
- if (!getMyPlayer().isMoving()) {
- walking.walkTileOnScreen(ammoTile);
- return random(250, 500);
- }
- return random(5, 10);
- }
- }
- }
- if (canTakeBones()) {
- status = "Picking up bones";
- RSGroundItem bones = groundItems.getNearest(boneID);
- RSTile boneTile = bones.getLocation();
- if (bones != null && boneTile != null) {
- if (calc.distanceTo(boneTile) < 5
- && calc.tileOnScreen(boneTile)) {
- camera.setPitch(100);
- if (bones.doAction("Take Bones")) {
- mouse.moveSlightly();
- return random(1500, 1750);
- }
- return random(50, 100);
- } else {
- if (!getMyPlayer().isMoving()) {
- walking.walkTileOnScreen(boneTile);
- return random(250, 500);
- }
- return random(5, 10);
- }
- }
- }
- RSNPC monk = npcs.getNearest(filter);
- if (monk != null) {
- RSTile monkTile = monk.getLocation();
- status = "Attacking monk";
- if (camera.getPitch() > 15) {
- camera.setPitch(5);
- }
- camera.turnToTile(monkTile);
- if (monk != null && monk.isOnScreen()) {
- monk.doAction("Attack " + monk.getName());
- return random(750, 1000);
- } else {
- if (clickMiniMap) {
- status = "Walking to monk";
- if (calc.distanceTo(monkTile) < 7) {
- if (!getMyPlayer().isMoving()) {
- walking.walkTileOnScreen(monkTile);
- return random(750, 1000);
- }
- return random(5, 10);
- } else {
- if (!getMyPlayer().isMoving()) {
- RSTile path[] = walking
- .findPath(monkTile);
- walking.walkPathMM(path);
- return random(750, 1000);
- }
- return random(5, 10);
- }
- } else {
- status = "Walking to monk";
- if (!getMyPlayer().isMoving()) {
- walking.walkTileOnScreen(monkTile);
- return random(750, 1000);
- }
- }
- }
- } else {
- status = "Waiting";
- if (antiBan) {
- antiBan();
- }
- return random(5, 10);
- }
- } else if (inCombat()) {
- status = "Fighting";
- if (currentNPC == null || currentNPC != interactingNPC()) {
- currentNPC = interactingNPC();
- }
- if (currentNPC != null) {
- if (currentNPC.isInCombat()) {
- wasInCombat = true;
- }
- }
- if (antiBan) {
- antiBan();
- }
- return random(5, 10);
- }
- } else {
- status = "Walking to monks";
- if (atEdge()) {
- if (justBanked) {
- bankTrips++;
- justBanked = false;
- }
- if (dest == null
- || getMyPlayer().isIdle()
- || (calc.distanceTo(dest) < 5 && !monkArea
- .contains(dest))) {
- if (walkPath(fromBankPath)) {
- dest = walking.getDestination();
- return random(750, 1000);
- }
- }
- return random(5, 10);
- } else {
- RSTile destination = monkArea.getCentralTile();
- RSTile[] genPath = walking.findPath(destination);
- if (dest == null
- || getMyPlayer().isIdle()
- || (calc.distanceTo(dest) < 5 && !monkArea
- .contains(dest))) {
- if (walkPath(genPath)) {
- dest = walking.getDestination();
- return random(750, 1000);
- }
- }
- return random(5, 10);
- }
- }
- }
- return random(5, 10);
- }
- private RSNPC interactingNPC() { // credits to: Foulwerp
- return npcs.getNearest(new Filter<RSNPC>() {
- public boolean accept(RSNPC n) {
- if (n.getInteracting() == null) {
- return false;
- }
- String[] acts = n.getActions();
- if (acts == null) {
- return false;
- }
- for (String a : acts) {
- if (a == null || !a.contains("Attack")) {
- continue;
- }
- return n.getInteracting().equals(players.getMyPlayer());
- }
- return false;
- }
- });
- }
- private boolean inCombat() {
- return getMyPlayer().getInteracting() != null
- && getMyPlayer().getInteracting().getHPPercent() > 0;
- }
- private void waitForDrop(final int timeout) {
- long start = System.currentTimeMillis();
- status = "Waiting 4 drop";
- while (System.currentTimeMillis() - start < timeout) {
- if (itemPresent(boneID, 3)) {
- return;
- }
- }
- }
- private boolean walkPath(RSTile[] path) {
- return walking.walkPathMM(walking.randomizePath(path, 2, 2));
- }
- private boolean canTakeAmmo() {
- if (pickAmmo) {
- return (inventory.getCount() < 28 || inventory.contains(ammoID))
- && itemPresent(ammoID) && !getMyPlayer().isMoving();
- }
- return false;
- }
- private boolean canTakeBones() {
- if (buryBones || bankBones) {
- return inventory.getCount() < 28 && itemPresent(boneID)
- && itemPresent(boneID, 3) && !getMyPlayer().isMoving();
- }
- return false;
- }
- public boolean itemPresent(int itemID) {
- RSGroundItem item = groundItems.getNearest(itemID);
- return item != null && monkArea.contains(item.getLocation());
- }
- public boolean itemPresent(int itemID, int dist) {
- RSGroundItem item = groundItems.getNearest(itemID);
- RSTile playerTile = getMyPlayer().getLocation();
- if (item != null) {
- RSTile itemTile = item.getLocation();
- RSArea itemArea = new RSArea(new RSTile(playerTile.getX()
- - (dist - 1), playerTile.getY() + dist), new RSTile(
- playerTile.getX() + (dist - 1), playerTile.getY() - dist));
- return itemArea.contains(itemTile);
- }
- return false;
- }
- private boolean needsToBank() {
- if (bankBones) {
- return (inventory.isFull() && inventory.contains(boneID)) || doBank;
- }
- return false;
- }
- private boolean needsToBury() {
- if (buryBones) {
- return (inventory.isFull() && inventory.contains(boneID)) || doBury;
- }
- return false;
- }
- private void safety() {
- if (getMyPlayer().getAnimation() == -1) {
- final long time = System.currentTimeMillis();
- if ((time - lastCheck) >= 420000) {
- if (lastExp == skills.getCurrentExp(Skills.CONSTITUTION)) {
- log("We've been idle for the past 7 minutes. Something's wrong.");
- stopScript(true);
- }
- lastCheck = System.currentTimeMillis();
- lastExp = skills.getCurrentExp(Skills.CONSTITUTION);
- }
- }
- }
- private int gamble() {
- final int r = random(1, 5000);
- if (r < 25) {
- return 1;
- } else if (r > 4975) {
- return 2;
- } else {
- return r;
- }
- }
- private void antiBan() {
- final String ab = "[AB] - ";
- switch (gamble()) {
- case 1:
- if (random(0, 1) == 1) {
- status = ab + "Move camera";
- camera.setAngle(random(1, 360));
- sleep(random(750, 1250));
- }
- break;
- case 2:
- switch (random(0, 5)) {
- case 1:
- status = ab + "Move mouse";
- mouse.moveSlightly();
- sleep(random(750, 1250));
- break;
- case 2:
- status = ab + "Move mouse";
- mouse.move(251, 395, 250, 394);
- sleep(random(750, 1250));
- break;
- case 3:
- status = ab + "Move mouse";
- mouse.moveOffScreen();
- sleep(random(750, 1250));
- break;
- case 4:
- status = ab + "Move mouse";
- mouse.move(200, 200, 50);
- sleep(random(750, 1250));
- break;
- }
- break;
- case 420:
- status = ab + "Check inventory";
- checkInventory();
- break;
- case 2000:
- status = ab + "Check stat";
- checkSkill();
- break;
- case 3000:
- status = ab + "Check random stat";
- checkRandomSkill();
- break;
- case 4000:
- status = ab + "Move mouse";
- mouse.move(280, 420, 50);
- break;
- case 5000:
- status = ab + "Check friends";
- checkFriendsList();
- break;
- case 6000:
- if (buryBones) {
- status = ab + "Check prayer stat";
- checkPrayer();
- }
- break;
- case 7000:
- if (clanChat.isInChannel()) {
- status = ab + "Check clan";
- checkClan();
- }
- break;
- }
- }
- private void checkInventory() {
- if (game.getCurrentTab() != Game.TAB_INVENTORY) {
- game.openTab(Game.TAB_INVENTORY);
- sleep(random(500, 570));
- }
- mouse.move(643, 438, 30);
- sleep(random(750, 1250));
- }
- private void checkClan() {
- if (game.getCurrentTab() != Game.TAB_CLAN) {
- game.openTab(Game.TAB_CLAN);
- sleep(random(500, 570));
- }
- mouse.move(643, 438, 30);
- sleep(random(750, 1250));
- }
- private void checkPrayer() {
- if (game.getCurrentTab() != Game.TAB_STATS) {
- game.openTab(Game.TAB_STATS);
- sleep(random(500, 570));
- }
- skills.doHover(Skills.PRAYER);
- sleep(random(750, 1250));
- }
- private void checkFriendsList() {
- if (game.getCurrentTab() != Game.TAB_FRIENDS) {
- game.openTab(Game.TAB_FRIENDS);
- sleep(random(500, 570));
- }
- mouse.move(643, 438, 30);
- sleep(random(750, 1250));
- }
- private void checkRandomSkill() {
- if (game.getCurrentTab() != Game.TAB_STATS) {
- game.openTab(Game.TAB_STATS);
- sleep(random(500, 570));
- }
- skills.doHover(random(0, 24));
- sleep(random(750, 1250));
- }
- private void checkSkill() {
- if (game.getCurrentTab() != Game.TAB_STATS) {
- game.openTab(Game.TAB_STATS);
- sleep(random(500, 570));
- }
- switch (skillToTrain) {
- case 0: // attack
- skills.doHover(Skills.ATTACK);
- sleep(random(750, 1250));
- break;
- case 1: // strength
- skills.doHover(Skills.STRENGTH);
- sleep(random(750, 1250));
- break;
- case 2: // defense
- skills.doHover(Skills.DEFENSE);
- sleep(random(750, 1250));
- break;
- case 3: // range
- skills.doHover(Skills.RANGE);
- sleep(random(750, 1250));
- break;
- case 4: // magic
- skills.doHover(Skills.MAGIC);
- sleep(random(750, 1250));
- break;
- }
- }
- private void countHeals() {
- if (justHealed && !needsToHeal()) {
- totalHealed++;
- justHealed = false;
- }
- }
- private boolean needsToHeal() {
- if (healAfterCombat) {
- if (inCombat()) {
- return currentHP() <= healAt2();
- } else {
- return currentHP() <= healAt();
- }
- }
- return currentHP() <= healAt();
- }
- private int healAt() {
- String HAP = "." + healAtPercent;
- return (int) (maxHP() * Double.parseDouble(HAP));
- }
- private int healAt2() {
- String HAP = "." + ((int) healAtPercent / 2);
- return (int) (maxHP() * Double.parseDouble(HAP));
- }
- private int maxHP() {
- return skills.getCurrentLevel(Skills.CONSTITUTION) * 10;
- }
- public int currentHP() {
- return Integer.parseInt(interfaces.getComponent(748, 8).getText());
- }
- private void checkRun() {
- if (!walking.isRunEnabled() && walking.getEnergy() > random(15, 30)) {
- walking.setRun(true);
- sleep(random(500, 750));
- }
- }
- private boolean atEdge() {
- return edgeArea.contains(getMyPlayer().getLocation());
- }
- private boolean atBank() {
- return bankArea.contains(getMyPlayer().getLocation());
- }
- private boolean atMonks() {
- return monkArea.contains(getMyPlayer().getLocation());
- }
- private int countKills() {
- if (conExpGained >= 20) {
- return (int) (conExpGained / 20);
- }
- return 0;
- }
- private int killsPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * countKills());
- }
- return 0;
- }
- private int hpPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * conExpGained);
- }
- return 0;
- }
- private void countBones() {
- final int currentBoneCount = inventory.getCount(boneID);
- if ((currentBoneCount == 0) && (lastBoneCount >= 25)) {
- lastBoneCount = 0;
- }
- if (currentBoneCount > lastBoneCount) {
- totalBones++;
- lastBoneCount = currentBoneCount;
- }
- }
- private int bonesPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * totalBones);
- }
- return 0;
- }
- private int buriedPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * totalBuriedBones);
- }
- return 0;
- }
- private int totalProfit() {
- return totalBones * bonesMarketPrice;
- }
- private int profitPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * totalProfit());
- }
- return 0;
- }
- public double getVersion() {
- return getClass().getAnnotation(ScriptManifest.class).version();
- }
- public String runTime() {
- runTime = System.currentTimeMillis() - startTime;
- return formatTime((int) runTime);
- }
- private String formatTime(int time) { // credits to Ahmedbasil1
- final StringBuilder stringAppend = new StringBuilder();
- final long TSec = time / 1000;
- final long TMin = TSec / 60;
- final long THour = TMin / 60;
- final int s = (int) TSec % 60;
- final int m = (int) TMin % 60;
- final int h = (int) THour;
- if (time <= 0) {
- return "00:00:00";
- }
- if (h < 10) {
- stringAppend.append("0");
- }
- stringAppend.append(h);
- stringAppend.append(":");
- if (m < 10) {
- stringAppend.append("0");
- }
- stringAppend.append(m);
- stringAppend.append(":");
- if (s < 10) {
- stringAppend.append("0");
- }
- stringAppend.append(s);
- return stringAppend.toString();
- }
- private int attPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * attExpGained);
- }
- return 0;
- }
- private int strPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * strExpGained);
- }
- return 0;
- }
- private int defPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * defExpGained);
- }
- return 0;
- }
- private int ranPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * ranExpGained);
- }
- return 0;
- }
- private int magPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * magExpGained);
- }
- return 0;
- }
- private int praPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * praExpGained);
- }
- return 0;
- }
- private int tripsPerHour() {
- if (runTime / 1000 > 0) {
- return (int) (3600000.0 / runTime * bankTrips);
- }
- return 0;
- }
- private void keepTrackOfSkills() {
- int currentDefExp = skills.getCurrentExp(Skills.DEFENSE);
- int currentAttExp = skills.getCurrentExp(Skills.ATTACK);
- int currentStrExp = skills.getCurrentExp(Skills.STRENGTH);
- int currentConExp = skills.getCurrentExp(Skills.CONSTITUTION);
- int currentRanExp = skills.getCurrentExp(Skills.RANGE);
- int currentPraExp = skills.getCurrentExp(Skills.PRAYER);
- int currentMagExp = skills.getCurrentExp(Skills.MAGIC);
- defExpGained = currentDefExp - startDefExp;
- strExpGained = currentStrExp - startStrExp;
- attExpGained = currentAttExp - startAttExp;
- conExpGained = currentConExp - startConExp;
- ranExpGained = currentRanExp - startRanExp;
- praExpGained = currentPraExp - startPraExp;
- magExpGained = currentMagExp - startMagExp;
- totalExpGained = defExpGained + strExpGained + attExpGained
- + conExpGained + ranExpGained + praExpGained + magExpGained;
- totalLvlGained = defLvlGained + strLvlGained + attLvlGained
- + conLvlGained + ranLvlGained + praLvlGained + magLvlGained;
- }
- public void stopAtLevel() {
- switch (skillToTrain) {
- case 0: // attack
- if (skills.getCurrentLevel(Skills.ATTACK) >= levelToStopAt)
- goalReached();
- break;
- case 1: // strength
- if (skills.getCurrentLevel(Skills.STRENGTH) >= levelToStopAt)
- goalReached();
- break;
- case 2: // defense
- if (skills.getCurrentLevel(Skills.DEFENSE) >= levelToStopAt)
- goalReached();
- break;
- case 3: // range
- if (skills.getCurrentLevel(Skills.RANGE) >= levelToStopAt)
- goalReached();
- break;
- case 4: // magic
- if (skills.getCurrentLevel(Skills.MAGIC) >= levelToStopAt)
- goalReached();
- break;
- }
- }
- private void goalReached() {
- log("Requested level reached !");
- game.logout(true);
- sleep(random(1500, 2000));
- if (!game.isLoggedIn()) {
- stopScript(true);
- }
- }
- @Override
- public void serverMessageRecieved(ServerMessageEvent e) {
- final String serverString = e.getMessage().toLowerCase();
- if (serverString.contains("you've just advanced")) {
- if (serverString.contains("strength level"))
- strLvlGained++;
- if (serverString.contains("attack level"))
- attLvlGained++;
- if (serverString.contains("defence level"))
- defLvlGained++;
- if (serverString.contains("constitution level"))
- conLvlGained++;
- if (serverString.contains("ranged level"))
- ranLvlGained++;
- if (serverString.contains("magic level"))
- magLvlGained++;
- if (serverString.contains("prayer level"))
- praLvlGained++;
- log("Gratz you just gained a level !");
- env.saveScreenshot(true);
- clickContinue = true;
- }
- if (serverString.contains("you bury the")) {
- totalBuriedBones++;
- }
- if (serverString.contains("oh dear")) {
- deaths++;
- }
- if (serverString.contains("combat level")) {
- combatLevelsGained++;
- }
- if (serverString.contains("someone else is fighting")) {
- npcBusy = true;
- }
- if (serverString.contains("no ammo")
- || serverString.contains("do not have enough")) {
- noAmmo = true;
- }
- if (serverString.contains("log out until 10 seconds")) {
- sleep(random(9000, 11000));
- }
- }
- @Override
- public void onRepaint(Graphics render) { // TODO finish this
- final BasicStroke mouseStroke = new BasicStroke(2);
- Graphics2D g = (Graphics2D) render;
- if (game.isLoggedIn()
- && skills.getCurrentLevel(Skills.CONSTITUTION) > 1) {
- keepTrackOfSkills();
- if (showMonk) {
- drawNextMonk(g);
- }
- if (showMouse) {
- g.setStroke(mouseStroke);
- drawMouse(g);
- }
- if (showPaint && !isHover(528, 203, 756, 466)) {
- g.setColor(paintColor);
- g.fillRoundRect(528, 203, 228, 263, 16, 16);
- g.setFont(new Font("Arial", 1, 16));
- g.setColor(textColor);
- g.drawString("monkR8per v" + getVersion(), 584, 221);
- g.setFont(new Font("Arial", 1, 12));
- g.drawString("Runtime: " + runTime(), 533, 240);
- g.drawString("Status: " + status, 533, 256);
- g.drawString("Kills: " + countKills() + " (" + killsPerHour()
- + " p/hr)", 533, 272);
- g.drawString("Healed: " + totalHealed, 533, 288);
- g.drawString("Deaths: " + deaths, 533, 304);
- switch (skillToTrain) {
- case 0: // attack
- g.drawString("Attack level: "
- + skills.getCurrentLevel(Skills.ATTACK) + " (+"
- + attLvlGained + ")", 533, 320);
- g.drawString("Attack Exp: " + attExpGained + " ("
- + attPerHour() + " p/hr)", 533, 336);
- break;
- case 1: // strength
- g.drawString("Strength level: "
- + skills.getCurrentLevel(Skills.STRENGTH) + " (+"
- + strLvlGained + ")", 533, 320);
- g.drawString("Strength Exp: " + strExpGained + " ("
- + strPerHour() + " p/hr)", 533, 336);
- break;
- case 2: // defense
- g.drawString("Defense level: "
- + skills.getCurrentLevel(Skills.DEFENSE) + " (+"
- + defLvlGained + ")", 533, 320);
- g.drawString("Defense Exp: " + defExpGained + " ("
- + defPerHour() + " p/hr)", 533, 336);
- break;
- case 3: // range
- g.drawString("Range level: "
- + skills.getCurrentLevel(Skills.RANGE) + " (+"
- + ranLvlGained + ")", 533, 320);
- g.drawString("Range Exp: " + ranExpGained + " ("
- + ranPerHour() + " p/hr)", 533, 336);
- break;
- case 4: // magic
- g.drawString("Magic level: "
- + skills.getCurrentLevel(Skills.MAGIC) + " (+"
- + magLvlGained + ")", 533, 320);
- g.drawString("Magic Exp: " + magExpGained + " ("
- + magPerHour() + " p/hr)", 533, 336);
- break;
- }
- g.drawString("Constitution level: "
- + skills.getCurrentLevel(Skills.CONSTITUTION) + " (+"
- + conLvlGained + ")", 533, 352);
- g.drawString("Constitution Exp: " + conExpGained + " ("
- + hpPerHour() + " p/hr)", 533, 368);
- g
- .drawString("Total levels gained: " + totalLvlGained,
- 533, 384);
- g.drawString("Combat level: " + getMyPlayer().getCombatLevel()
- + " (+" + combatLevelsGained + ")", 533, 400);
- g.drawString("Mouse speed: " + currentMouseSpeed, 650, 240);
- if (bankBones && showProfit) {
- g.drawString("Bones: " + totalBones + " (" + bonesPerHour()
- + " p/h)", 533, 416);
- g.drawString("Profit: " + totalProfit() + " ("
- + profitPerHour() + " p/h)", 533, 432);
- g.drawString("Bank trips: " + bankTrips + " ("
- + tripsPerHour() + " p/h)", 533, 448);
- }
- if (buryBones) {
- g.drawString("Prayer Level: "
- + skills.getCurrentLevel(Skills.PRAYER) + " (+"
- + praLvlGained + ")", 533, 416);
- g.drawString("Prayer Exp: " + praExpGained + " ("
- + praPerHour() + " p/h)", 533, 432);
- g.drawString("Bones buried: " + totalBuriedBones + " ("
- + buriedPerHour() + " p/h)", 533, 448);
- }
- }
- }
- }
- public void drawMouse(final Graphics g) {
- final Point loc = mouse.getLocation();
- g.setColor(mouseColor);
- g.drawLine(0, loc.y, 766, loc.y);
- g.drawLine(loc.x, 0, loc.x, 505);
- }
- public void drawNextMonk(Graphics g) {
- RSNPC npc = npcs.getNearest(filter);
- if (npc != null) {
- RSModel model = npc.getModel();
- if (model != null) {
- g.setColor(monkColor);
- for (Polygon p : model.getTriangles()) {
- g.fillPolygon(p);
- }
- }
- overlayText(g, npc.getLocation(), textColor, "Next Monk");
- }
- }
- public void overlayText(final Graphics g, final RSTile t, final Color c,
- final String text) {
- final Point p = calc.tileToScreen(t);
- final Point pn = calc.tileToScreen(new RSTile(t.getX(), t.getY()), 0);
- final Point px = calc.tileToScreen(new RSTile(t.getX() + 1, t.getY()),
- 0);
- final Point py = calc.tileToScreen(new RSTile(t.getX(), t.getY() + 1),
- 0);
- final Point pxy = calc.tileToScreen(new RSTile(t.getX() + 1,
- t.getY() + 1), 0);
- final Point[] points = { p, pn, px, py, pxy };
- for (final Point point : points) {
- if (!calc.pointOnScreen(point)) {
- return;
- }
- }
- g.setColor(c);
- g.setFont(new Font("sansserif", Font.BOLD, 12));
- g.drawString(text, p.x - 30, p.y - 40);
- }
- public boolean autoCastSpell(int spell, int desiredSpellSetting) {
- if (settings.getSetting(43) != 4
- || settings.getSetting(108) != desiredSpellSetting) {
- if (game.getCurrentTab() != Game.TAB_MAGIC) {
- game.openTab(Game.TAB_MAGIC);
- sleep(random(150, 250));
- }
- return interfaces.getComponent(spell).doAction("Autocast");
- }
- return false;
- }
- private void setup() {
- startTime = System.currentTimeMillis();
- startDefExp = skills.getCurrentExp(Skills.DEFENSE);
- startAttExp = skills.getCurrentExp(Skills.ATTACK);
- startStrExp = skills.getCurrentExp(Skills.STRENGTH);
- startConExp = skills.getCurrentExp(Skills.CONSTITUTION);
- startRanExp = skills.getCurrentExp(Skills.RANGE);
- startMagExp = skills.getCurrentExp(Skills.MAGIC);
- if (healAfterCombat) {
- log("We will heal at: " + healAt() + "/" + healAt2());
- } else {
- log("We will heal at: " + healAt());
- }
- switch (skillToTrain) {
- case 0: // attack
- log("Training: Attack");
- combat.setFightMode(0);
- break;
- case 1: // strength
- log("Training: Strength");
- combat.setFightMode(1);
- break;
- case 2: // defense
- log("Training: Defense");
- combat.setFightMode(3);
- break;
- case 3: // range
- switch (rangeStyle) {
- case 0: // accurate
- log("Training: Range: Accurate");
- break;
- case 1: // rapid
- log("Training: Range: Rapid");
- break;
- case 2: // long range
- log("Training: Range: Long range");
- break;
- }
- combat.setFightMode(rangeStyle);
- if (pickAmmo) {
- log("We will pick up " + ammoName + " ID: " + ammoID);
- }
- break;
- case 4:
- log("Training: Magic");
- log("Casting spell: " + spellName + " ID: " + autoCastSpellID);
- magic.autoCastSpell(autoCastSpellID);
- break;
- }
- if (stopScript) {
- log("We will stop training at level: " + levelToStopAt);
- }
- if (bankBones) {
- log("We will bank bones - Loading current market price...");
- bonesMarketPrice = grandExchange.getMarketPrice(boneID);
- lastBoneCount = inventory.getCount(boneID);
- log("Current market price of Bones: " + bonesMarketPrice);
- }
- if (buryBones) {
- log("We will bury bones");
- }
- if (!combat.isAutoRetaliateEnabled()) {
- combat.setAutoRetaliate(true);
- sleep(random(1000, 1500));
- }
- firstRun = false;
- }
- @Override
- public boolean onStart() {
- try {
- settingsFile.createNewFile();
- } catch (final IOException ignored) {
- }
- fromBankPath = walking.reversePath(toBankPath);
- if (random(1, 10) < 5) {
- bankBoothTile = boothTile;
- } else {
- bankBoothTile = boothTile2;
- }
- gui = new monkR8perGUI();
- while (gui.isVisible()) {
- sleep(100);
- }
- return !guiExit;
- }
- public class monkR8perGUI extends JFrame {
- private static final long serialVersionUID = -2580618572741828067L;
- public monkR8perGUI() {
- initComponents();
- }
- private void buttonStartActionPerformed(ActionEvent e) {
- mouseSpeed = sliderMouseSpeed.getValue();
- if (checkBoxShowMouse.isSelected()) {
- showMouse = true;
- switch (comboBoxMouseColor.getSelectedIndex()) {
- case 0:
- mouseColor = Color.RED;
- break;
- case 1:
- mouseColor = Color.BLUE;
- break;
- case 2:
- mouseColor = Color.GREEN;
- break;
- case 3:
- mouseColor = cPurple;
- break;
- case 4:
- mouseColor = Color.ORANGE;
- break;
- case 5:
- mouseColor = Color.YELLOW;
- break;
- case 6:
- mouseColor = Color.WHITE;
- break;
- case 7:
- mouseColor = Color.BLACK;
- break;
- }
- }
- if (checkBoxShowMonk.isSelected()) {
- showMonk = true;
- switch (comboBoxMonkColor.getSelectedIndex()) {
- case 0:
- monkColor = tRed;
- break;
- case 1:
- monkColor = tBlue;
- break;
- case 2:
- monkColor = tGreen;
- break;
- case 3:
- monkColor = tPurple;
- break;
- case 4:
- monkColor = tOrange;
- break;
- case 5:
- monkColor = tYellow;
- break;
- case 6:
- monkColor = tWhite;
- break;
- case 7:
- monkColor = tBlack;
- break;
- }
- }
- if (checkBoxBuryBones.isSelected()) {
- buryBones = true;
- }
- if (checkBoxBankBones.isSelected()) {
- bankBones = true;
- }
- if (bankBones || buryBones) {
- if (checkBoxWaitForDrop.isSelected()) {
- waitForDrop = true;
- }
- }
- if (checkBoxAntiBan.isSelected()) {
- antiBan = true;
- }
- if (checkBoxShowPaint.isSelected()) {
- showPaint = true;
- if (bankBones && checkBoxShowProfit.isSelected()) {
- showProfit = true;
- }
- switch (comboBoxPaintColor.getSelectedIndex()) {
- case 0:
- paintColor = bgRed;
- break;
- case 1:
- paintColor = bgBlue;
- break;
- case 2:
- paintColor = bgGreen;
- break;
- case 3:
- paintColor = bgPurple;
- break;
- case 4:
- paintColor = bgOrange;
- break;
- case 5:
- paintColor = bgYellow;
- break;
- case 6:
- paintColor = bgWhite;
- break;
- case 7:
- paintColor = tBlack;
- break;
- }
- switch (comboBoxPaintTextColor.getSelectedIndex()) {
- case 0:
- textColor = Color.RED;
- break;
- case 1:
- textColor = Color.BLUE;
- break;
- case 2:
- textColor = Color.GREEN;
- break;
- case 3:
- textColor = cPurple;
- break;
- case 4:
- textColor = Color.ORANGE;
- break;
- case 5:
- textColor = Color.YELLOW;
- break;
- case 6:
- textColor = Color.WHITE;
- break;
- case 7:
- textColor = Color.BLACK;
- break;
- }
- }
- healAtPercent = Integer.parseInt(textFieldHealAtPercent.getText());
- skillToTrain = comboBoxSkillToTrain.getSelectedIndex();
- if (skillToTrain == 3) {
- if (checkBoxPickAmmo.isSelected()) {
- pickAmmo = true;
- switch (comboBoxAmmoType.getSelectedIndex()) {
- case 0:
- ammoID = bronzeArrowID;
- ammoName = "Bronze arrow";
- break;
- case 1:
- ammoID = ironArrowID;
- ammoName = "Iron arrow";
- break;
- case 2:
- ammoID = steelArrowID;
- ammoName = "Steel arrow";
- break;
- case 3:
- ammoID = mithrilArrowID;
- ammoName = "Mithril arrow";
- break;
- case 4:
- ammoID = adamiteArrowID;
- ammoName = "Adamite arrow";
- break;
- case 5:
- ammoID = runeArrowID;
- ammoName = "Rune arrow";
- break;
- }
- rangeStyle = comboBoxRangedStyle.getSelectedIndex();
- }
- }
- if (skillToTrain == 4) {
- switch (comboBoxAutoCastSpell.getSelectedIndex()) {
- case 0:
- autoCastSpellID = 98;
- spellName = "Wind Rush";
- break;
- case 1:
- autoCastSpellID = Magic.SPELL_WIND_STRIKE;
- spellName = "Wind Strike";
- break;
- case 2:
- autoCastSpellID = Magic.SPELL_WATER_STRIKE;
- spellName = "Water Strike";
- break;
- case 3:
- autoCastSpellID = Magic.SPELL_EARTH_STRIKE;
- spellName = "Earth Strike";
- break;
- case 4:
- autoCastSpellID = Magic.SPELL_FIRE_STRIKE;
- spellName = "Fire Strike";
- break;
- case 5:
- autoCastSpellID = Magic.SPELL_WIND_BOLT;
- spellName = "Wind Bolt";
- break;
- case 6:
- autoCastSpellID = Magic.SPELL_WATER_BOLT;
- spellName = "Water Bolt";
- break;
- case 7:
- autoCastSpellID = Magic.SPELL_EARTH_BOLT;
- spellName = "Earth Bolt";
- break;
- case 8:
- autoCastSpellID = Magic.SPELL_FIRE_BOLT;
- spellName = "Fire Bolt";
- break;
- case 9:
- autoCastSpellID = Magic.SPELL_WIND_BLAST;
- spellName = "Wind Blast";
- break;
- case 10:
- autoCastSpellID = Magic.SPELL_WATER_BLAST;
- spellName = "Water Blast";
- break;
- case 11:
- autoCastSpellID = Magic.SPELL_EARTH_BLAST;
- spellName = "Earth Blast";
- break;
- case 12:
- autoCastSpellID = Magic.SPELL_FIRE_BLAST;
- spellName = "Fire Blast";
- break;
- }
- }
- if (checkBoxStopAtLevel.isSelected()) {
- stopScript = true;
- levelToStopAt = Integer
- .parseInt(textFieldStopAtLevel.getText());
- }
- if (checkBoxHealAfterCombat.isSelected()) {
- healAfterCombat = true;
- }
- if (checkBoxClickMiniMap.isSelected()) {
- clickMiniMap = true;
- }
- // Write settings
- try {
- final BufferedWriter out = new BufferedWriter(new FileWriter(
- settingsFile));
- out.write((bankBones ? "true" : "false") + ":" + healAtPercent
- + ":" + mouseSpeed + ":" + skillToTrain + ":"
- + levelToStopAt + ":" + rangeStyle + ":"
- + autoCastSpellID + ":" + ammoID + ":"
- + (showMonk ? "true" : "false") + ":"
- + (pickAmmo ? "true" : "false") + ":"
- + (stopScript ? "true" : "false") + ":"
- + (healAfterCombat ? "true" : "false") + ":"
- + (clickMiniMap ? "true" : "false") + ":"
- + (buryBones ? "true" : "false") + ":"
- + (showPaint ? "true" : "false") + ":"
- + (showProfit ? "true" : "false") + ":"
- + (takeRandomBones ? "true" : "false") + ":"
- + (showMouse ? "true" : "false") + ":"
- + (antiBan ? "true" : "false") + ":"
- + (waitForDrop ? "true" : "false") + ":"
- + comboBoxMonkColor.getSelectedIndex() + ":"
- + comboBoxMouseColor.getSelectedIndex() + ":"
- + comboBoxPaintColor.getSelectedIndex() + ":"
- + comboBoxPaintTextColor.getSelectedIndex() + ":"
- + comboBoxRangedStyle.getSelectedIndex() + ":");
- out.close();
- } catch (final Exception e1) {
- e1.printStackTrace();
- }
- guiExit = false;
- setVisible(false);
- }
- private void buttonExitActionPerformed(ActionEvent e) {
- setVisible(false);
- }
- private void comboBoxSkillToTrainActionPerformed(ActionEvent e) {
- if (comboBoxSkillToTrain.getSelectedIndex() == 3) {
- checkBoxPickAmmo.setEnabled(true);
- comboBoxRangedStyle.setEnabled(true);
- comboBoxAutoCastSpell.setEnabled(false);
- } else if (comboBoxSkillToTrain.getSelectedIndex() == 4) {
- comboBoxAutoCastSpell.setEnabled(true);
- checkBoxPickAmmo.setEnabled(false);
- comboBoxAmmoType.setEnabled(false);
- comboBoxRangedStyle.setEnabled(false);
- } else {
- checkBoxPickAmmo.setEnabled(false);
- comboBoxAmmoType.setEnabled(false);
- comboBoxRangedStyle.setEnabled(false);
- comboBoxAutoCastSpell.setEnabled(false);
- }
- }
- private void checkBoxPickAmmoActionPerformed(ActionEvent e) {
- if (checkBoxPickAmmo.isSelected()) {
- comboBoxAmmoType.setEnabled(true);
- } else {
- comboBoxAmmoType.setEnabled(false);
- }
- }
- private void checkBoxBuryBonesActionPerformed(ActionEvent e) {
- if (checkBoxBuryBones.isSelected()) {
- checkBoxBankBones.setSelected(false);
- checkBoxShowProfit.setEnabled(false);
- checkBoxWaitForDrop.setEnabled(true);
- } else {
- checkBoxWaitForDrop.setEnabled(false);
- }
- }
- private void checkBoxBankBonesActionPerformed(ActionEvent e) {
- if (checkBoxBankBones.isSelected()) {
- checkBoxBuryBones.setSelected(false);
- if (checkBoxShowPaint.isSelected()) {
- checkBoxShowProfit.setEnabled(true);
- }
- checkBoxWaitForDrop.setEnabled(true);
- } else {
- checkBoxShowProfit.setEnabled(false);
- checkBoxWaitForDrop.setEnabled(false);
- }
- }
- public void checkBoxStopAtLevelActionPerformed(ActionEvent e) {
- if (checkBoxStopAtLevel.isSelected()) {
- textFieldStopAtLevel.setEnabled(true);
- } else {
- textFieldStopAtLevel.setEnabled(false);
- }
- }
- private void checkBoxShowMouseActionPerformed(ActionEvent e) {
- if (checkBoxShowMouse.isSelected()) {
- comboBoxMouseColor.setEnabled(true);
- } else {
- comboBoxMouseColor.setEnabled(false);
- }
- }
- private void checkBoxShowPaintActionPerformed(ActionEvent e) {
- if (checkBoxShowPaint.isSelected()) {
- if (checkBoxBankBones.isSelected()) {
- checkBoxShowProfit.setEnabled(true);
- }
- comboBoxPaintColor.setEnabled(true);
- comboBoxPaintTextColor.setEnabled(true);
- } else {
- checkBoxShowProfit.setEnabled(false);
- comboBoxPaintColor.setEnabled(false);
- comboBoxPaintTextColor.setEnabled(false);
- }
- }
- private void checkBoxShowMonkActionPerformed(ActionEvent e) {
- if (checkBoxShowMonk.isSelected()) {
- comboBoxMonkColor.setEnabled(true);
- } else {
- comboBoxMonkColor.setEnabled(false);
- }
- }
- private void initComponents() {
- // GEN-BEGIN:initComponents
- panelMain = new JPanel();
- panel_Main = new JPanel();
- textFieldStopAtLevel = new JTextField();
- checkBoxStopAtLevel = new JCheckBox();
- comboBoxSkillToTrain = new JComboBox();
- label2 = new JLabel();
- checkBoxHealAfterCombat = new JCheckBox();
- checkBoxClickMiniMap = new JCheckBox();
- label1 = new JLabel();
- textFieldHealAtPercent = new JTextField();
- checkBoxBuryBones = new JCheckBox();
- label7 = new JLabel();
- checkBoxWaitForDrop = new JCheckBox();
- checkBoxAntiBan = new JCheckBox();
- buttonStart = new JButton();
- buttonExit = new JButton();
- panelRanged = new JPanel();
- checkBoxPickAmmo = new JCheckBox();
- comboBoxAmmoType = new JComboBox();
- label5 = new JLabel();
- label3 = new JLabel();
- comboBoxRangedStyle = new JComboBox();
- panelMagic = new JPanel();
- label6 = new JLabel();
- comboBoxAutoCastSpell = new JComboBox();
- panelBank = new JPanel();
- checkBoxBankBones = new JCheckBox();
- checkBoxShowProfit = new JCheckBox();
- panelMouse = new JPanel();
- label4 = new JLabel();
- sliderMouseSpeed = new JSlider();
- checkBoxShowMouse = new JCheckBox();
- comboBoxMouseColor = new JComboBox();
- panelPaint = new JPanel();
- checkBoxShowMonk = new JCheckBox();
- checkBoxShowPaint = new JCheckBox();
- label8 = new JLabel();
- comboBoxPaintColor = new JComboBox();
- label10 = new JLabel();
- comboBoxPaintTextColor = new JComboBox();
- label9 = new JLabel();
- comboBoxMonkColor = new JComboBox();
- // ======== this ========
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- setResizable(false);
- setTitle("monkR8per v" + getVersion() + " Settings");
- setVisible(true);
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- // ======== panelMain ========
- {
- panelMain.setLayout(null);
- // ======== panel_Main ========
- {
- panel_Main.setBorder(new TitledBorder("Main Settings:"));
- panel_Main.setLayout(null);
- // ---- textFieldStopAtLevel ----
- textFieldStopAtLevel.setText("0");
- textFieldStopAtLevel.setToolTipText("1-99");
- textFieldStopAtLevel.setEnabled(false);
- panel_Main.add(textFieldStopAtLevel);
- textFieldStopAtLevel.setBounds(100, 110, 40,
- textFieldStopAtLevel.getPreferredSize().height);
- // ---- checkBoxStopAtLevel ----
- checkBoxStopAtLevel.setText("Stop at level?");
- checkBoxStopAtLevel
- .setToolTipText("Check this box if you want the script to stop at a certain level");
- checkBoxStopAtLevel.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxStopAtLevelActionPerformed(e);
- }
- });
- panel_Main.add(checkBoxStopAtLevel);
- checkBoxStopAtLevel.setBounds(new Rectangle(new Point(5,
- 110), checkBoxStopAtLevel.getPreferredSize()));
- // ---- comboBoxSkillToTrain ----
- comboBoxSkillToTrain.setModel(new DefaultComboBoxModel(
- new String[] { "Attack", "Strength", "Defense",
- "Ranged", "Magic" }));
- comboBoxSkillToTrain
- .setToolTipText("Please choose a skill to train");
- comboBoxSkillToTrain
- .addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- comboBoxSkillToTrainActionPerformed(e);
- }
- });
- panel_Main.add(comboBoxSkillToTrain);
- comboBoxSkillToTrain.setBounds(75, 80, 105, 22);
- // ---- label2 ----
- label2.setText("Skill to train:");
- panel_Main.add(label2);
- label2.setBounds(10, 85, 59, 14);
- // ---- checkBoxHealAfterCombat ----
- checkBoxHealAfterCombat.setText("Heal after combat?");
- checkBoxHealAfterCombat
- .setToolTipText("<html><head><body></head>\nChecking this box makes you wait to heal<br />\nuntil you hp is half of your heal at setting,<br />\nor until you are no longer in combat. <br /><br />\nEX: If heal at is 50% when in combat<br /> \nyou'll wait until 25% hp.<br /><br />\nNOT recomended for low hp accounts!<br />\n</body></html>");
- panel_Main.add(checkBoxHealAfterCombat);
- checkBoxHealAfterCombat
- .setBounds(new Rectangle(new Point(5, 35),
- checkBoxHealAfterCombat.getPreferredSize()));
- // ---- checkBoxClickMiniMap ----
- checkBoxClickMiniMap.setText("Click mini-map?");
- checkBoxClickMiniMap.setSelected(true);
- panel_Main.add(checkBoxClickMiniMap);
- checkBoxClickMiniMap.setBounds(new Rectangle(new Point(5,
- 55), checkBoxClickMiniMap.getPreferredSize()));
- // ---- label1 ----
- label1.setText("Percent to heal at:");
- panel_Main.add(label1);
- label1.setBounds(10, 20, 90, 14);
- // ---- textFieldHealAtPercent ----
- textFieldHealAtPercent.setText("50");
- textFieldHealAtPercent.setToolTipText("10-100");
- panel_Main.add(textFieldHealAtPercent);
- textFieldHealAtPercent.setBounds(105, 15, 35, 20);
- // ---- checkBoxBuryBones ----
- checkBoxBuryBones.setText("Bury bones?");
- checkBoxBuryBones
- .setToolTipText("Check this box if you want to bury bones");
- checkBoxBuryBones.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxBuryBonesActionPerformed(e);
- }
- });
- panel_Main.add(checkBoxBuryBones);
- checkBoxBuryBones.setBounds(5, 130, 85, 23);
- // ---- label7 ----
- label7.setText("*10-100");
- label7.setForeground(Color.red);
- panel_Main.add(label7);
- label7.setBounds(new Rectangle(new Point(145, 20), label7
- .getPreferredSize()));
- // ---- checkBoxWaitForDrop ----
- checkBoxWaitForDrop.setText("Wait for drop?");
- checkBoxWaitForDrop.setEnabled(false);
- panel_Main.add(checkBoxWaitForDrop);
- checkBoxWaitForDrop.setBounds(new Rectangle(new Point(105,
- 130), checkBoxWaitForDrop.getPreferredSize()));
- // ---- checkBox1 ----
- checkBoxAntiBan.setText("Anti-ban?");
- checkBoxAntiBan.setSelected(true);
- panel_Main.add(checkBoxAntiBan);
- checkBoxAntiBan.setBounds(new Rectangle(new Point(105, 55),
- checkBoxAntiBan.getPreferredSize()));
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panel_Main.getComponentCount(); i++) {
- Rectangle bounds = panel_Main.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 = panel_Main.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panel_Main.setMinimumSize(preferredSize);
- panel_Main.setPreferredSize(preferredSize);
- }
- }
- panelMain.add(panel_Main);
- panel_Main.setBounds(10, 5, 205, 160);
- // ---- buttonStart ----
- buttonStart.setText("Start");
- buttonStart.setFont(new Font("Tahoma", Font.BOLD, 14));
- buttonStart.setToolTipText("Press here to start the script");
- buttonStart.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- buttonStartActionPerformed(e);
- }
- });
- panelMain.add(buttonStart);
- buttonStart.setBounds(15, 325, 195, 35);
- // ---- buttonExit ----
- buttonExit.setText("Exit");
- buttonExit.setFont(new Font("Tahoma", Font.BOLD, 14));
- buttonExit.setToolTipText("Press here to exit the script");
- buttonExit.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- buttonExitActionPerformed(e);
- }
- });
- panelMain.add(buttonExit);
- buttonExit.setBounds(225, 325, 195, 35);
- // ======== panelRanged ========
- {
- panelRanged.setBorder(new TitledBorder("Ranged Settings:"));
- panelRanged.setLayout(null);
- // ---- checkBoxPickAmmo ----
- checkBoxPickAmmo.setText("Pick up ammo?");
- checkBoxPickAmmo.setEnabled(false);
- checkBoxPickAmmo
- .setToolTipText("Check this box if you wish to pick up your ammo");
- checkBoxPickAmmo.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxPickAmmoActionPerformed(e);
- }
- });
- panelRanged.add(checkBoxPickAmmo);
- checkBoxPickAmmo.setBounds(new Rectangle(new Point(10, 45),
- checkBoxPickAmmo.getPreferredSize()));
- // ---- comboBoxAmmoType ----
- comboBoxAmmoType.setModel(new DefaultComboBoxModel(
- new String[] { "Bronze arrows", "Iron arrows",
- "Steel arrows", "Mithril arrows",
- "Adamite arrows", "Rune arrows" }));
- comboBoxAmmoType.setEnabled(false);
- comboBoxAmmoType
- .setToolTipText("Choose what ammo you wish to pick up and re-equip");
- panelRanged.add(comboBoxAmmoType);
- comboBoxAmmoType.setBounds(80, 70, 115, comboBoxAmmoType
- .getPreferredSize().height);
- // ---- label5 ----
- label5.setText("Ammo type:");
- panelRanged.add(label5);
- label5.setBounds(new Rectangle(new Point(15, 70), label5
- .getPreferredSize()));
- // ---- label3 ----
- label3.setText("Style:");
- panelRanged.add(label3);
- label3.setBounds(new Rectangle(new Point(15, 20), label3
- .getPreferredSize()));
- // ---- comboBoxRangedStyle ----
- comboBoxRangedStyle
- .setModel(new DefaultComboBoxModel(new String[] {
- "Accurate", "Rapid", "Long range" }));
- comboBoxRangedStyle.setEnabled(false);
- comboBoxRangedStyle
- .setToolTipText("Choose your ranged style");
- panelRanged.add(comboBoxRangedStyle);
- comboBoxRangedStyle.setBounds(50, 20, 100,
- comboBoxRangedStyle.getPreferredSize().height);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panelRanged.getComponentCount(); i++) {
- Rectangle bounds = panelRanged.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 = panelRanged.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panelRanged.setMinimumSize(preferredSize);
- panelRanged.setPreferredSize(preferredSize);
- }
- }
- panelMain.add(panelRanged);
- panelRanged.setBounds(220, 5, 205, 105);
- // ======== panelMagic ========
- {
- panelMagic.setBorder(new TitledBorder("Magic Settings:"));
- panelMagic.setLayout(null);
- // ---- label6 ----
- label6.setText("Spell:");
- panelMagic.add(label6);
- label6.setBounds(new Rectangle(new Point(15, 20), label6
- .getPreferredSize()));
- // ---- comboBoxAutoCastSpell ----
- comboBoxAutoCastSpell.setEnabled(false);
- comboBoxAutoCastSpell.setModel(new DefaultComboBoxModel(
- new String[] { "Wind Rush", "Wind Strike",
- "Water Strike", "Earth Strike",
- "Fire Strike", "Wind Bolt", "Water Bolt",
- "Earth Bolt", "Fire Bolt" }));
- comboBoxAutoCastSpell
- .setToolTipText("Choose what magic spell you wish to cast");
- panelMagic.add(comboBoxAutoCastSpell);
- comboBoxAutoCastSpell.setBounds(50, 20, 135,
- comboBoxAutoCastSpell.getPreferredSize().height);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panelMagic.getComponentCount(); i++) {
- Rectangle bounds = panelMagic.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 = panelMagic.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panelMagic.setMinimumSize(preferredSize);
- panelMagic.setPreferredSize(preferredSize);
- }
- }
- panelMain.add(panelMagic);
- panelMagic.setBounds(220, 110, 205, 55);
- // ======== panelBank ========
- {
- panelBank.setBorder(new TitledBorder("Bank Settings:"));
- panelBank.setLayout(null);
- // ---- checkBoxBankBones ----
- checkBoxBankBones.setText("Bank Bones?");
- checkBoxBankBones
- .setToolTipText("Check this box if you wish to pick up and bank bones");
- checkBoxBankBones.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxBankBonesActionPerformed(e);
- }
- });
- panelBank.add(checkBoxBankBones);
- checkBoxBankBones.setBounds(new Rectangle(
- new Point(10, 15), checkBoxBankBones
- .getPreferredSize()));
- // ---- checkBoxShowProfit ----
- checkBoxShowProfit.setText("Show Profit?");
- checkBoxShowProfit.setEnabled(false);
- checkBoxShowProfit
- .setToolTipText("Check this box if you would like to show how much profit the script has made");
- panelBank.add(checkBoxShowProfit);
- checkBoxShowProfit.setBounds(new Rectangle(
- new Point(95, 15), checkBoxShowProfit
- .getPreferredSize()));
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panelBank.getComponentCount(); i++) {
- Rectangle bounds = panelBank.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 = panelBank.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panelBank.setMinimumSize(preferredSize);
- panelBank.setPreferredSize(preferredSize);
- }
- }
- panelMain.add(panelBank);
- panelBank.setBounds(10, 165, 205, 45);
- // ======== panelMouse ========
- {
- panelMouse.setBorder(new TitledBorder("Mouse Settings:"));
- panelMouse.setLayout(null);
- // ---- label4 ----
- label4.setText("Mouse speed:");
- panelMouse.add(label4);
- label4.setBounds(10, 40, 67, 14);
- // ---- sliderMouseSpeed ----
- sliderMouseSpeed.setMaximum(10);
- sliderMouseSpeed.setPaintLabels(true);
- sliderMouseSpeed.setPaintTicks(true);
- sliderMouseSpeed.setSnapToTicks(true);
- sliderMouseSpeed.setValue(7);
- sliderMouseSpeed.setMajorTickSpacing(1);
- sliderMouseSpeed.setToolTipText("0 = fastest 5 = human 10 = slowest");
- panelMouse.add(sliderMouseSpeed);
- sliderMouseSpeed.setBounds(5, 55, 195, 51);
- // ---- checkBoxShowMouse ----
- checkBoxShowMouse.setText("Show mouse?");
- checkBoxShowMouse.setSelected(true);
- checkBoxShowMouse
- .setToolTipText("Check this box if you wish to show the mouse");
- checkBoxShowMouse.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxShowMouseActionPerformed(e);
- }
- });
- panelMouse.add(checkBoxShowMouse);
- checkBoxShowMouse.setBounds(new Rectangle(new Point(5, 15),
- checkBoxShowMouse.getPreferredSize()));
- // ---- comboBoxMouseColor ----
- comboBoxMouseColor.setModel(new DefaultComboBoxModel(
- new String[] { "Red", "Blue", "Green", "Purple",
- "Orange", "Yellow", "White", "Black" }));
- comboBoxMouseColor.setSelectedIndex(0);
- comboBoxMouseColor
- .setToolTipText("Choose a color for the mouse");
- panelMouse.add(comboBoxMouseColor);
- comboBoxMouseColor.setBounds(100, 15, 95,
- comboBoxMouseColor.getPreferredSize().height);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panelMouse.getComponentCount(); i++) {
- Rectangle bounds = panelMouse.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 = panelMouse.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panelMouse.setMinimumSize(preferredSize);
- panelMouse.setPreferredSize(preferredSize);
- }
- }
- panelMain.add(panelMouse);
- panelMouse.setBounds(10, 210, 205, 110);
- // ======== panelPaint ========
- {
- panelPaint.setBorder(new TitledBorder("Paint Settings:"));
- panelPaint.setLayout(null);
- // ---- checkBoxShowMonk ----
- checkBoxShowMonk.setText("Paint monk?");
- checkBoxShowMonk.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxShowMonkActionPerformed(e);
- }
- });
- panelPaint.add(checkBoxShowMonk);
- checkBoxShowMonk.setBounds(new Rectangle(new Point(10, 35),
- checkBoxShowMonk.getPreferredSize()));
- // ---- checkBoxShowPaint ----
- checkBoxShowPaint.setText("Show paint?");
- checkBoxShowPaint
- .setToolTipText("Check this box if you want to show the paint");
- checkBoxShowPaint.setSelected(true);
- checkBoxShowPaint.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- checkBoxShowPaintActionPerformed(e);
- }
- });
- panelPaint.add(checkBoxShowPaint);
- checkBoxShowPaint.setBounds(new Rectangle(
- new Point(10, 15), checkBoxShowPaint
- .getPreferredSize()));
- // ---- label8 ----
- label8.setText("Back Color:");
- panelPaint.add(label8);
- label8.setBounds(15, 65, 55, 14);
- // ---- comboBoxPaintColor ----
- comboBoxPaintColor.setModel(new DefaultComboBoxModel(
- new String[] { "Red", "Blue", "Green", "Purple",
- "Orange", "Yellow", "White", "Black" }));
- comboBoxPaintColor.setSelectedIndex(7);
- panelPaint.add(comboBoxPaintColor);
- comboBoxPaintColor.setBounds(75, 60, 85, 22);
- // ---- label10 ----
- label10.setText("Text color:");
- panelPaint.add(label10);
- label10.setBounds(15, 95, 52, 14);
- // ---- comboBoxPaintTextColor ----
- comboBoxPaintTextColor.setModel(new DefaultComboBoxModel(
- new String[] { "Red", "Blue", "Green", "Purple",
- "Orange", "Yellow", "White", "Black" }));
- comboBoxPaintTextColor.setSelectedIndex(2);
- panelPaint.add(comboBoxPaintTextColor);
- comboBoxPaintTextColor.setBounds(75, 90, 85, 22);
- // ---- label9 ----
- label9.setText("Monk color:");
- panelPaint.add(label9);
- label9.setBounds(new Rectangle(new Point(15, 125), label9
- .getPreferredSize()));
- // ---- comboBoxMonkColor ----
- comboBoxMonkColor.setModel(new DefaultComboBoxModel(
- new String[] { "Red", "Blue", "Green", "Purple",
- "Orange", "Yellow", "White", "Black" }));
- comboBoxMonkColor.setSelectedIndex(2);
- comboBoxMonkColor.setEnabled(false);
- panelPaint.add(comboBoxMonkColor);
- comboBoxMonkColor.setBounds(75, 120, 85, 22);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panelPaint.getComponentCount(); i++) {
- Rectangle bounds = panelPaint.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 = panelPaint.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panelPaint.setMinimumSize(preferredSize);
- panelPaint.setPreferredSize(preferredSize);
- }
- }
- panelMain.add(panelPaint);
- panelPaint.setBounds(220, 165, 205, 155);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < panelMain.getComponentCount(); i++) {
- Rectangle bounds = panelMain.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 = panelMain.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- panelMain.setMinimumSize(preferredSize);
- panelMain.setPreferredSize(preferredSize);
- }
- }
- contentPane.add(panelMain);
- panelMain.setBounds(0, 0, 435, 370);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for (int i = 0; i < contentPane.getComponentCount(); i++) {
- Rectangle bounds = contentPane.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 = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- setSize(440, 395);
- setLocationRelativeTo(getOwner());
- // GEN-END:initComponents
- // LOAD SAVED SELECTION INFO
- try {
- final BufferedReader in = new BufferedReader(new FileReader(
- settingsFile));
- String line;
- String[] opts = {};
- while ((line = in.readLine()) != null) {
- if (line.contains(":")) {
- opts = line.split(":");
- }
- }
- in.close();
- if (opts.length > 5) {
- // bankBones
- if (opts[0].equals("true")) {
- checkBoxBankBones.setSelected(true);
- checkBoxShowProfit.setEnabled(true);
- checkBoxWaitForDrop.setEnabled(true);
- }
- // healAtPercent
- textFieldHealAtPercent.setText(opts[1]);
- // mouseSpeed
- sliderMouseSpeed.setValue(Integer.parseInt(opts[2]));
- // skillToTrain
- comboBoxSkillToTrain.setSelectedIndex(Integer
- .parseInt(opts[3]));
- // levelToStopAt
- textFieldStopAtLevel.setText(opts[4]);
- // rangeStyle
- comboBoxRangedStyle.setSelectedIndex(Integer
- .parseInt(opts[5]));
- // autoCastSpellID
- comboBoxAutoCastSpell.setSelectedIndex(Integer
- .parseInt(opts[6]));
- // ammoID
- switch (Integer.parseInt(opts[7])) {
- case bronzeArrowID:
- comboBoxAmmoType.setSelectedIndex(0);
- break;
- case ironArrowID:
- comboBoxAmmoType.setSelectedIndex(1);
- break;
- case steelArrowID:
- comboBoxAmmoType.setSelectedIndex(2);
- break;
- case mithrilArrowID:
- comboBoxAmmoType.setSelectedIndex(3);
- break;
- case adamiteArrowID:
- comboBoxAmmoType.setSelectedIndex(4);
- break;
- case runeArrowID:
- comboBoxAmmoType.setSelectedIndex(5);
- break;
- }
- // showMonk
- if (opts[8].equals("true")) {
- checkBoxShowMonk.setSelected(true);
- comboBoxMonkColor.setEnabled(true);
- comboBoxMonkColor.setSelectedIndex(Integer
- .parseInt(opts[20]));
- }
- // pickAmmo
- if (opts[9].equals("true")) {
- checkBoxPickAmmo.setSelected(true);
- checkBoxPickAmmo.setEnabled(true);
- comboBoxAmmoType.setEnabled(true);
- }
- // stopScript
- if (opts[10].equals("true")) {
- checkBoxStopAtLevel.setSelected(true);
- textFieldStopAtLevel.setEnabled(true);
- }
- // healAfterCombat
- if (opts[11].equals("true")) {
- checkBoxHealAfterCombat.setSelected(true);
- }
- // clickMiniMap
- if (opts[12].equals("true")) {
- checkBoxClickMiniMap.setSelected(true);
- }
- // buryBones
- if (opts[13].equals("true")) {
- checkBoxBuryBones.setSelected(true);
- checkBoxShowProfit.setEnabled(true);
- checkBoxWaitForDrop.setEnabled(true);
- }
- // showPaint
- if (opts[14].equals("true")) {
- checkBoxShowPaint.setSelected(true);
- comboBoxPaintColor.setEnabled(true);
- comboBoxPaintColor.setSelectedIndex(Integer
- .parseInt(opts[22]));
- comboBoxPaintTextColor.setEnabled(true);
- comboBoxPaintTextColor.setSelectedIndex(Integer
- .parseInt(opts[23]));
- }
- // showProfit
- if (opts[15].equals("true")) {
- checkBoxShowProfit.setSelected(true);
- }
- // takeRandomBones
- if (opts[16].equals("true")) {
- // TODO add this checkBox to the GUI
- // checkBoxTakeRandomBones.setSelected(true);
- }
- // showMouse
- if (opts[17].equals("true")) {
- checkBoxShowMouse.setSelected(true);
- comboBoxMouseColor.setEnabled(true);
- comboBoxMouseColor.setSelectedIndex(Integer
- .parseInt(opts[21]));
- }
- // antiBan
- if (opts[18].equals("true")) {
- checkBoxAntiBan.setSelected(true);
- }
- // waitForDrop
- if (opts[19].equals("true")) {
- checkBoxWaitForDrop.setSelected(true);
- }
- // rangeStyle
- comboBoxRangedStyle.setSelectedIndex(Integer.parseInt(opts[24]));
- }
- } catch (final Exception e2) {
- e2.printStackTrace();
- }
- }
- // GEN-BEGIN:variables
- private JPanel panelMain;
- private JPanel panel_Main;
- private JTextField textFieldStopAtLevel;
- private JCheckBox checkBoxStopAtLevel;
- private JComboBox comboBoxSkillToTrain;
- private JLabel label2;
- private JCheckBox checkBoxHealAfterCombat;
- private JCheckBox checkBoxClickMiniMap;
- private JLabel label1;
- private JTextField textFieldHealAtPercent;
- private JCheckBox checkBoxBuryBones;
- private JLabel label7;
- private JCheckBox checkBoxWaitForDrop;
- private JCheckBox checkBoxAntiBan;
- private JButton buttonStart;
- private JButton buttonExit;
- private JPanel panelRanged;
- private JCheckBox checkBoxPickAmmo;
- private JComboBox comboBoxAmmoType;
- private JLabel label5;
- private JLabel label3;
- private JComboBox comboBoxRangedStyle;
- private JPanel panelMagic;
- private JLabel label6;
- private JComboBox comboBoxAutoCastSpell;
- private JPanel panelBank;
- private JCheckBox checkBoxBankBones;
- private JCheckBox checkBoxShowProfit;
- private JPanel panelMouse;
- private JLabel label4;
- private JSlider sliderMouseSpeed;
- private JCheckBox checkBoxShowMouse;
- private JComboBox comboBoxMouseColor;
- private JPanel panelPaint;
- private JCheckBox checkBoxShowMonk;
- private JCheckBox checkBoxShowPaint;
- private JLabel label8;
- private JComboBox comboBoxPaintColor;
- private JLabel label10;
- private JComboBox comboBoxPaintTextColor;
- private JLabel label9;
- private JComboBox comboBoxMonkColor;
- // GEN-END:variables
- }
- @Override
- public void mouseDragged(MouseEvent e) {
- }
- @Override
- public void mouseMoved(MouseEvent e) {
- mousePoint = e.getPoint();
- }
- public boolean isHover(int x1, int y1, int x2, int y2) { // credits to
- // Ahmedbasil1
- if (mousePoint != null) {
- if (mousePoint.getX() >= x1 && mousePoint.getY() >= y1
- && mousePoint.getX() <= x2 && mousePoint.getY() <= y2) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement