Squashed commit of the following:

commit fd4615a57f
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 16:06:48 2021 +1300

    Disable banking/walking atm

commit 9ee2538de3
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 16:05:40 2021 +1300

    Add WIP strats

commit 193d6f7ba1
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 16:02:06 2021 +1300

    Update PickupClues.java

commit 36a42333cb
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 15:59:54 2021 +1300

    Update LoadCannon.java

commit f7dd9f43d7
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 15:56:23 2021 +1300

    tidy up

commit 4dd586ccd5
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 15:55:57 2021 +1300

    Fixup dropping again

commit 3eedd24f50
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:58:39 2021 +1300

    Fixup dropping items

commit ab7be16b6b
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:35:42 2021 +1300

    Update dropping items

commit e85177ebf9
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:14:10 2021 +1300

    Update Fletch.java

commit 813ab7be30
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:12:30 2021 +1300

    Include drop strat

commit 720b679df5
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:12:21 2021 +1300

    fletching

commit 1517e1b6e4
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:04:01 2021 +1300

    Hide smithing and crafting

commit 42590ccf03
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 13:02:04 2021 +1300

    Update Main.java

commit 6825d5843a
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:59:55 2021 +1300

    Update Mine.java

commit e8a3ea42f3
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:59:52 2021 +1300

    Update WoodcutTree.java

commit 1a20d915e8
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:57:13 2021 +1300

    Update Fish.java

commit 272b963b15
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:56:30 2021 +1300

    Update WoodcutTree.java

commit 1ab6b0790f
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:56:15 2021 +1300

    Update WoodcutTree.java

commit 5ce89bdef6
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:55:35 2021 +1300

    Update WoodcutTree.java

commit 4f1aa178eb
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:55:18 2021 +1300

    Update WoodcutTree.java

commit 53235ef523
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:54:16 2021 +1300

    Update WoodcutTree.java

commit 3b3c082ca9
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:54:08 2021 +1300

    Update ScriptState.java

commit 6731fcae6d
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:53:37 2021 +1300

    Update PickupItems.java

commit 03582f6187
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:51:38 2021 +1300

    Update Eat.java

commit 7464f87e3a
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:51:03 2021 +1300

    Update Trees.java

commit c8f2521e64
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:50:18 2021 +1300

    Update Bank.java

commit 419f7212db
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:37:55 2021 +1300

    Update Bank.java

commit 86a7808958
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:37:46 2021 +1300

    Update HandleLogin.java

commit b1ade815ca
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:27:32 2021 +1300

    Update UpdateExperience.java

commit e3cdcfbb97
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:26:54 2021 +1300

    Update BuryBones.java

commit 570c1c9b70
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:26:03 2021 +1300

    Update fishing

commit 41a3d37290
Author: Danial <admin@redsparr0w.com>
Date:   Thu Oct 7 12:16:38 2021 +1300

    initial working stuff
This commit is contained in:
Danial
2021-10-07 16:07:25 +13:00
parent ac4af37090
commit aa5d206274
29 changed files with 1232 additions and 232 deletions
+41
View File
@@ -0,0 +1,41 @@
package ParaScript;
import ParaScript.data.Variables;
import java.awt.*;
import java.awt.TrayIcon.MessageType;
public class DesktopTray {
private TrayIcon trayIcon = null;
private SystemTray tray = null;
public DesktopTray() {
if (SystemTray.isSupported()) {
//Obtain only one instance of the SystemTray object
tray = SystemTray.getSystemTray();
Image image = Toolkit.getDefaultToolkit().createImage("icon.png");
String name = "2006 AIO | " + Variables.getAccountUsername();
trayIcon = new TrayIcon(image, name);
//Let the system resize the image if needed
trayIcon.setImageAutoSize(true);
//Set tooltip text for the tray icon
trayIcon.setToolTip(name);
try {
tray.add(trayIcon);
} catch (AWTException e) {
e.printStackTrace();
}
} else {
System.err.println("System tray not supported!");
}
}
public void displayNotification(String title, String message){
trayIcon.displayMessage(title, message, MessageType.NONE);
}
public void removeTray(){
tray.remove(trayIcon);
}
}
+36 -17
View File
@@ -3,16 +3,13 @@ package ParaScript;
import ParaScript.data.Variables;
import ParaScript.strategies.*;
import ParaScript.ui.UI;
import org.parabot.core.ui.Logger;
import org.parabot.environment.api.interfaces.Paintable;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.api.utils.Timer;
import org.parabot.environment.input.Keyboard;
import org.parabot.environment.scripts.Script;
import org.parabot.environment.scripts.framework.Strategy;
import org.parabot.environment.scripts.Category;
import org.parabot.environment.scripts.ScriptManifest;
import org.rev317.min.accessors.Client;
import org.rev317.min.api.events.MessageEvent;
import org.rev317.min.api.events.listeners.MessageListener;
import org.rev317.min.api.methods.Skill;
@@ -20,7 +17,7 @@ import org.rev317.min.api.methods.Skill;
import java.awt.*;
import java.util.ArrayList;
@ScriptManifest(author = "RedSparr0w & Dark98", category = Category.OTHER, description = "2006 AIO Script", name = "2006 AIO", servers = { "2006rebotted" }, version = 1.2)
@ScriptManifest(author = "RedSparr0w & Dark98", category = Category.OTHER, description = "2006 AIO Script", name = "2006 AIO", servers = { "2006rebotted" }, version = 1.3)
public class Main extends Script implements MessageListener, Paintable {
private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
@@ -38,26 +35,42 @@ public class Main extends Script implements MessageListener, Paintable {
Variables.setBaseExp();
// These strategies should always be running
strategies.add(new UpdateBank());
strategies.add(new UpdateExperience());
strategies.add(new ScriptState());
// if(Variables.skill_to_train == Skill.CRAFTING) {
// strategies.add(new Crafting());
// }
if(Variables.skill_to_train == Skill.WOODCUTTING) {
strategies.add(new MakeArrowShafts());
strategies.add(new Fletch());
strategies.add(new WoodcutTree());
}
if(Variables.skill_to_train == Skill.MINING) {
strategies.add(new Mine());
strategies.add(new Bank());
strategies.add(new Walk());
// strategies.add(new Bank());
// strategies.add(new Walk());
}
// if(Variables.skill_to_train == Skill.SMITHING) {
// strategies.add(new Smelt());
// strategies.add(new BankSmithing());
// }
if(Variables.skill_to_train == Skill.THIEVING) {
strategies.add(new Thieving());
}
if(Variables.skill_to_train == Skill.ATTACK) {
// Activate auto retaliate
org.rev317.min.api.methods.Menu.clickButton(150);
strategies.add(new Eat());
strategies.add(new PickupClues());
strategies.add(new PickupItems());
strategies.add(new BuryBones());
strategies.add(new FightingReturnToCoords());
strategies.add(new LoadCannon());
strategies.add(new Fighting());
// strategies.add(new Bank());
// strategies.add(new Walk());
}
if(Variables.skill_to_train == Skill.FISHING) {
strategies.add(new Fish());
@@ -67,18 +80,19 @@ public class Main extends Script implements MessageListener, Paintable {
strategies.add(new Walk());
strategies.add(new PickupItems());
}
// These strategies should always be running
strategies.add(new Drop());
strategies.add(new HandleLogin());
provide(strategies);
Keyboard.getInstance().sendKeys("Training " + Variables.skill_to_train.getName() + ". Drop items? " + !Variables.shouldBankItems());
return true;
}
@Override
public void onFinish() {
Variables.desktopTray.removeTray();
ui.dispose();
System.out.println("Script Stopped");
System.out.println("2006 AIO Script Stopped");
}
@Override
@@ -104,25 +118,30 @@ public class Main extends Script implements MessageListener, Paintable {
g.drawString("Items(P/H): " + Methods.formatNumber(Variables.items_gained) + "(" + Methods.formatNumber(SCRIPT_TIMER.getPerHour(Variables.items_gained)) + ")", 360, 290);
g.drawString("EXP(P/H): " + Methods.formatNumber((int) Variables.exp_gained) + "(" + Methods.formatNumber(SCRIPT_TIMER.getPerHour((int) Variables.exp_gained)) + ")", 360, 310);
g.drawString("Runtime: " + SCRIPT_TIMER.toString(), 360, 330);
}
public void messageReceived(MessageEvent message) {
switch (message.getType()) {
case 0:
if (message.getMessage().startsWith("You manage to") || // woodcutting, mining
message.getMessage().startsWith("You catch some") || // fishing
message.getMessage().startsWith("You pick the")) { // pickpockets
if (message.getMessage().startsWith("You manage to ") // Woodcutting, Mining
|| message.getMessage().startsWith("You catch ") // Fishing
|| message.getMessage().startsWith("You receive a") // Smelting
|| message.getMessage().startsWith("You pick the ") // Pickpocketing
) {
Variables.addItemGained(1);
Variables.updateExpGained();
}
if (message.getMessage().startsWith("Congratulations, you advanced a")) {
if (message.getMessage().startsWith("Congratulations, you've advanced a level")) {
Variables.desktopTray.displayNotification(Variables.getAccountUsername() + " | Level up!", message.getMessage());
// add in level up to paint
}
if (message.getMessage().startsWith("You completed your slayer task")) {
Variables.desktopTray.displayNotification(Variables.getAccountUsername() + " | Slayer task complete!", message.getMessage());
}
break;
case 4:
if(Variables.skill_to_train == null) {
if (message.getMessage().startsWith(Variables.slaveMaster.toLowerCase() + " wishes to trade with you")) {
if (message.getMessage().startsWith(Variables.slave_master.toLowerCase() + " wishes to trade with you")) {
// accept trade
// take items, give items if smithing or similar
// goto bank, deposit/withdraw items
+37 -12
View File
@@ -1,49 +1,64 @@
package ParaScript.data;
import ParaScript.DesktopTray;
import ParaScript.Methods;
import ParaScript.data.variables.*;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Skill;
import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath;
public class Variables {
public static boolean running = false;
private static String current_status = "none";
private static String current_status = "-----";
public static int items_gained = 0;
public static double base_experience = 0;
public static double exp_gained = 0;
public static int update_experience_tick = 0;
public static DesktopTray desktopTray = new DesktopTray();
// Login Panel
private static String username = "";
private static String password = "";
// Settings Panel
public static Skill skill_to_train = Skill.WOODCUTTING;
public static Skill skill_to_train = Skill.ATTACK;
// Woodcutting
public static Trees woodcutting_tree_selected = Trees.NORMAL;
public static String woodcutting_method = "Fletch";
// Mining
public static Ores mining_ore_selected = Ores.ESSENCE;
public static String mining_method = "Bank";
public static Rocks mining_rock_selected = Rocks.ESSENCE;
public static String mining_method = "Drop";
// Smithing
public static Bars smithing_bar_selected = Bars.BRONZE;
public static String smithing_method = "Drop";
// Fighting
public static FightingNpcs fighting_npc_selected = FightingNpcs.CHICKEN;
public static boolean fighting_bury_bones = true;
public static boolean load_cannon = false;
public static int[] return_to_coords = new int[]{};
public static int[] fighting_item_ids = new int[]{};
public static int fighting_minimum_hitpoints = 0;
public static int fighting_minimum_hitpoints = -1;
public static int fighting_food_to_eat = -1;
public static int fighting_food_heals_amount = 20;
// Thieving
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
//public static String thieving_method = "None";
public static String thieving_method = "Drop";
// Fishing
public static Npcs.Option fishing_type_selected = Npcs.Option.NET;
public static FishingSpots fishing_spot_selected = FishingSpots.NET;
public static String fishing_method = "Drop";
// Banking
public static int[] bank_items = new int[]{};
// Used for slave accounts
public static String slaveMaster = "";
public static String slave_master = "";
// Used to walk places
public static TilePath pathToWalk;
@@ -59,7 +74,6 @@ public class Variables {
public final static Zone LUMBRIDGE_NORMAL_TREE_ZONE = new Zone(new Tile(3140, 3260), new Tile(3206, 3206));
// Mining Varrock
public final static Zone VARROCK_EAST_BANK_ZONE = new Zone(new Tile(3250, 3424), new Tile(3257, 3416));
public final static Zone VARROCK_EAST_MINE_ZONE = new Zone(new Tile(3276, 3375), new Tile(3298, 3354));
@@ -162,9 +176,14 @@ public class Variables {
if (skill_to_train == null) return new int[]{-1};
switch (skill_to_train.getName()){
case "Woodcutting":
return woodcutting_tree_selected.getIDs();
return new int[]{woodcutting_tree_selected.getItemID()};
case "Mining":
return mining_ore_selected.getIDs();
// Include the gems array as mining will sometimes drop gems
return Methods.combineIntArrays(mining_rock_selected.getItemID(), Rocks.GEM.getItemID());
case "Fishing":
return fishing_spot_selected.getItemIDs();
case "Attack":
return fighting_item_ids;
default:
return new int[]{-1};
}
@@ -177,6 +196,8 @@ public class Variables {
return woodcutting_method.equalsIgnoreCase("Bank");
case "Mining":
return mining_method.equalsIgnoreCase("Bank");
case "Smithing":
return smithing_method.equalsIgnoreCase("Bank");
default:
return true;
}
@@ -189,6 +210,10 @@ public class Variables {
return woodcutting_method.equalsIgnoreCase("Drop");
case "Mining":
return mining_method.equalsIgnoreCase("Drop");
case "Fishing":
return fishing_method.equalsIgnoreCase("Drop");
case "Thieving":
return thieving_method.equalsIgnoreCase("Drop");
default:
return false;
}
@@ -0,0 +1,47 @@
package ParaScript.data.variables;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public enum Bars {
BRONZE("Bronze", 2350, new int[]{437, 439}, 2414),
IRON ("Iron", 2352, new int[]{441}, 3988),
STEEL("Steel", 2354, new int[]{441, 454, 454}, 3996),
SILVER("Silver", 2356, new int[]{443}, 3992),
GOLD("Gold", 2358, new int[]{445}, 4000),
MITHRIL("Mithril", 2360, new int[]{448, 454, 454, 454, 454}, 4158),
ADAMANT("Adamant", 2362, new int[]{450, 454, 454, 454, 454, 454, 454}, 7442),
RUNITE("Runite", 2364, new int[]{452, 454, 454, 454, 454, 454, 454, 454, 454}, 7447);
private String name;
private int id;
private int[] ores;
private int button_id;
Bars(String name, int id, int[] ores, int button_id) {
this.name = name;
this.id = id;
this.ores = ores;
this.button_id = button_id;
}
public static String[] toStringArray() {
List<Bars> enumList = Arrays.asList(Bars.values());
List<String> locationsArray = new ArrayList<>();
for (Bars obj : enumList) {
locationsArray.add(obj.name);
}
String[] simpleArray = new String[ locationsArray.size() ];
locationsArray.toArray( simpleArray );
return(simpleArray);
}
public String getName() { return this.name; }
public int getID() { return this.id; }
public int getButtonID() { return this.button_id; }
public int[] getOres() { return this.ores; }
}
@@ -0,0 +1,58 @@
package ParaScript.data.variables;
import org.rev317.min.api.methods.Npcs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public enum FishingSpots {
NET("Net", new int[] { 319, 329, 323, 325, 326, 327, 330, 332, 404, 316, 334, 313, 322, 1191 }, 1, 5, 3, Npcs.Option.NET, new int[] { 317, 321, 327, 345, 353, 335, 331, 341, 363, 349, 359, 371, 377, 7944, 383 }),
BAIT("Bait", new int[] { 319, 329, 323, 325, 326, 327, 330, 332, 404, 316 }, 1, 5, 1, Npcs.Option.BAIT, new int[] { 317, 321, 327, 345, 353, 335, 331, 341, 363, 349, 359, 371, 377, 7944, 383 }),
HARPOON("Harpoon", new int[] { 334, 313, 322, 312, 321, 405, 324 }, 1, 18, 1, Npcs.Option.HARPOON, new int[] { 317, 321, 327, 345, 353, 335, 331, 341, 363, 349, 359, 371, 377, 7944, 383 }),
LURE("Lure", new int[] { 309, 310, 403, 311, 314, 315, 317, 318, 328, 331 }, 1, 18, 1, Npcs.Option.BAIT, new int[] { 317, 321, 327, 345, 353, 335, 331, 341, 363, 349, 359, 371, 377, 7944, 383 }),
CAGE("Cage", new int[] { 312, 321, 405, 324 }, 1, 18, 1, Npcs.Option.CAGE, new int[] { 317, 321, 327, 345, 353, 335, 331, 341, 363, 349, 359, 371, 377, 7944, 383 });
private final String name;
private final int levelReq, mineTimer, xp;
public Npcs.Option actionType;
private final int[] fishIDs;
private final int[] objectIDs;
public int hash = 0;
public int x = 0;
public int y = 0;
FishingSpots(final String name, final int[] objectIDs, final int levelReq, final int xp, final int mineTimer, final Npcs.Option actionType, final int[] fishIDs) {
this.name = name;
this.objectIDs = objectIDs;
this.levelReq = levelReq;
this.xp = xp;
this.mineTimer = mineTimer;
this.actionType = actionType;
this.fishIDs = fishIDs;
}
public static String[] toStringArray() {
List<FishingSpots> enumList = Arrays.asList(FishingSpots.values());
List<String> locationsArray = new ArrayList<>();
for (FishingSpots obj : enumList) {
locationsArray.add(obj.name);
}
String[] simpleArray = new String[ locationsArray.size() ];
locationsArray.toArray( simpleArray );
return(simpleArray);
}
public String getName() { return this.name; }
public int[] getIDs() { return this.objectIDs; }
public int[] getItemIDs() { return this.fishIDs; }
public void reset(){
this.hash = 0;
this.x = 0;
this.y = 0;
}
}
@@ -0,0 +1,65 @@
package ParaScript.data.variables;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public enum Rocks {
ESSENCE("Essence", new int[] { 2491 }, 1, 5, 3, 1, new int[] { 1436, 7936 }),
CLAY("Clay", new int[] { 2108, 2109, 11189, 11190, 11191, 9713, 9711, 14905, 14904 }, 1, 5, 1, 5, new int[] { 434 }),
COPPER("Copper", new int[] { 3042, 2091, 2090, 9708, 9709, 9710, 11960, 14906, 14907 }, 1, 18, 1, 8, new int[] { 436 }),
TIN("Tin", new int[] { 2094, 2095, 3043, 9716, 9714, 11958, 11957, 11959, 11933, 11934, 11935, 14903, 14902 }, 1, 18, 1, 8, new int[] { 438 }),
BLURITE("Blurite", new int[] { 10574, 10583, 2110 }, 10, 20, 1, 8, new int[] { 668 }),
IRON("Iron", new int[] { 2093, 2092, 9717, 9718, 9719, 11962, 11956, 11954, 14856, 14857, 14858, 14914, 14913 }, 15, 35, 2, 5, new int[] { 440 }),
SILVER("Silver", new int[] { 2101, 11186, 11187, 11188, 2100 }, 20, 40, 3, 20, new int[] { 442 }),
COAL("Coal", new int[] { 2096, 2097, 11963, 11964, 14850, 14851, 14852, 11930, 11931 }, 30, 50, 4, 25, new int[] { 453 }),
GOLD("Gold", new int[] { 2099, 2098, 11183, 11184, 11185, 9720, 9722 }, 40, 65, 6, 33, new int[] { 444 }),
MITHRIL("Mithril", new int[] { 2103, 2102, 14853, 14854, 14855 }, 55, 80, 8, 50, new int[] { 447 }),
ADAMANT("Adamant", new int[] { 2104, 2105, 14862, 14863, 14864 }, 70, 95, 10, 83, new int[] { 449 }),
RUNE("Rune", new int[] { 14859, 14860, 2106, 2107 }, 85, 125, 20, 166, new int[] { 451 }),
GRANITE("Granite", new int[] { 10947 }, 45, 75, 10, 10, new int[] { 6979, 6981, 6983 }),
SANDSTONE("Sandstone", new int[] { 10946 }, 35, 60, 5, 5, new int[] { 6971, 6973, 6975, 6977 }),
GEM("Gem", new int[] {2111}, 40, 65, 6, 120, new int[] {1625, 1627, 1629, 1623, 1621, 1619, 1617});
private final String name;
private final int levelReq, mineTimer, respawnTimer, xp;
private final int[] oreIds;
private final int[] objectId;
public int hash = 0;
public int x = 0;
public int y = 0;
Rocks(final String name, final int[] objectId, final int levelReq, final int xp, final int mineTimer, final int respawnTimer, final int[] oreIds) {
this.name = name;
this.objectId = objectId;
this.levelReq = levelReq;
this.xp = xp;
this.mineTimer = mineTimer;
this.respawnTimer = respawnTimer;
this.oreIds = oreIds;
}
public static String[] toStringArray() {
List<Rocks> enumList = Arrays.asList(Rocks.values());
List<String> locationsArray = new ArrayList<>();
for (Rocks obj : enumList) {
locationsArray.add(obj.name);
}
String[] simpleArray = new String[ locationsArray.size() ];
locationsArray.toArray( simpleArray );
return(simpleArray);
}
public String getName() { return this.name; }
public int[] getIDs() { return this.objectId; }
public int[] getItemID() { return this.oreIds; }
public void reset(){
this.hash = 0;
this.x = 0;
this.y = 0;
}
}
@@ -5,19 +5,25 @@ import java.util.Arrays;
import java.util.List;
public enum Trees {
NORMAL("Normal", new int[]{1276, 1278, 1279, 1286, 1315, 1316}, 25),
OAK("Oak", new int[]{1281}, 37.5),
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}, 47.5),
MAPLE("Maple", new int[]{1307}, 100);
NORMAL("Normal", new int[]{1276, 1277, 1278, 1279, 1280}, 1511),
OAK("Oak", new int[]{1281}, 1521),
WILLOW ("Willow", new int[]{1308, 5551, 5552, 5553}, 1519),
MAPLE("Maple", new int[]{1307}, 1517),
YEW("Yew", new int[]{1309}, 1515),
MAGIC("Magic", new int[]{1306}, 1513);
private String name;
private int[] ids;
private double xp;
private int item_id;
public int hash = 0;
public int x = 0;
public int y = 0;
Trees(String name, int[] ids, double xp) {
Trees(String name, int[] ids, int item_id) {
this.name = name;
this.ids = ids;
this.xp = xp;
this.item_id = item_id;
}
public static String[] toStringArray() {
@@ -36,5 +42,11 @@ public enum Trees {
public int[] getIDs() { return this.ids; }
public double getXP() { return this.xp; }
public int getItemID() { return this.item_id; }
public void reset(){
this.hash = 0;
this.x = 0;
this.y = 0;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+99 -30
View File
@@ -2,11 +2,10 @@ package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.input.Keyboard;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.TilePath;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.wrappers.Item;
public class Bank implements Strategy {
@@ -15,41 +14,111 @@ public class Bank implements Strategy {
return Variables.running
&& Game.isLoggedIn()
&& Variables.shouldBankItems()
&& (Variables.getStatus().equals("none") || Variables.getStatus().equals("banking items"))
&& Inventory.isFull();
&& (Variables.getStatus() == "none" || Variables.getStatus() == "banking items")
&& Inventory.isFull()
&& openBank();
}
@Override
public void execute() {
Variables.pathToWalk = new TilePath(Variables.VARROCK_EAST_MINE_PATH_TO_BANK);
Variables.setStatus("banking items");
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
if (!Game.isLoggedIn()) new HandleLogin().execute();
Variables.pathToWalk.traverse();
Time.sleep(2500);
}
depositItems();
bankAll();
}
public void depositItems() {
Npc banker = Npcs.getClosest(494);
if (banker != null)
{
banker.interact(Npcs.Option.BANK);
} else {
Keyboard.getInstance().sendKeys("I can't find the banker!");
public static boolean isBankOpen() {
return Game.getOpenInterfaceId() == 5292;
}
public static boolean openBank() {
if (isBankOpen()) {
return true;
}
Time.sleep(3000);
if (Game.getOpenInterfaceId() == 5292) {
if (Variables.skill_to_train == Skill.MINING)
org.rev317.min.api.methods.Bank.depositAllExcept(1266, 1268, 1270, 1272, 1274, 1276);
else if (Variables.skill_to_train == Skill.WOODCUTTING)
org.rev317.min.api.methods.Bank.depositAllExcept(1350, 1352, 1354, 1356, 1358, 1360, 6740);
else {
org.rev317.min.api.methods.Bank.depositAllExcept(1);
Variables.addItemGained(28);
Npc banker = Npcs.getClosest(494);
if (banker != null) {
banker.interact(Npcs.Option.BANK);
Time.sleep(() -> isBankOpen(), 10000);
return true;
} else {
System.out.println("Unable to find a banker");
return false;
}
}
public static int getInventorySlot(int item_id){
Item item = Inventory.getItem(item_id + 1);
if (item == null) return -1;
return item.getSlot();
}
public static int getBankSlot(int item_id){
item_id++;
int slot = 0;
for (int bank_item_id : Variables.bank_items){
if (bank_item_id == item_id) return slot;
slot++;
}
return -1;
}
public static void bankAll(){
if (!openBank()) return;
Variables.setStatus("Banking items");
try {
for (int item_id : Variables.getItemIDs()) {
int inventory_slot = getInventorySlot(item_id);
if (inventory_slot >= 0) {
Menu.sendAction(431, item_id, inventory_slot, 5064, 3);
Time.sleep(50);
}
Time.sleep(200);
}
Variables.setStatus("none");
} catch (Exception err){
System.out.println("Banking error: ¯\\_(ツ)_/¯");
}
}
public static void withdrawItem(int item_id, int amount){
if (!openBank()) return;
int slot = getBankSlot(item_id);
if (slot < 0) return;
switch(amount){
case 1:
Menu.sendAction(632, item_id, slot, 5382, 6);
return;
case 5:
Menu.sendAction(78, item_id, slot, 5382, 5);
return;
case 10:
Menu.sendAction(867, item_id, slot, 5382, 4);
return;
case -1: // all
Menu.sendAction(431, item_id, slot, 5382, 3);
return;
default: // x
Menu.sendAction(53, item_id, slot, 5382, 2);
return;
}
}
public static void depositItem(int item_id, int amount){
if (!openBank()) return;
int slot = Bank.getInventorySlot(item_id);
if (slot < 0) return;
switch(amount){
case 1:
Menu.sendAction(632, item_id, slot, 5064, 6);
return;
case 5:
Menu.sendAction(78, item_id, slot, 5064, 5);
return;
case 10:
Menu.sendAction(867, item_id, slot, 5064, 4);
return;
case -1: // all
Menu.sendAction(431, item_id, slot, 5064, 3);
return;
default: // x
Menu.sendAction(53, item_id, slot, 5064, 2);
return;
}
}
}
@@ -0,0 +1,109 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.input.Keyboard;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.*;
// TODO: this needs fixing up, not currently working AFAIK
public class BankSmithing implements Strategy {
@Override
public boolean activate() {
return Variables.running
&& Game.isLoggedIn()
&& (Variables.getStatus() == "none" || Variables.getStatus() == "banking items")
&& hasBars() || !hasOres();
}
@Override
public void execute() {
depositItems();
}
public void depositItems() {
if (Variables.skill_to_train == Skill.SMITHING) {
// Bank all items from first slot
Variables.setStatus("banking items");
// 431, item_id, inventory_position?, 5064, 3
int bar_id = Variables.smithing_bar_selected.getID();
if (hasBars())
Menu.sendAction(431, bar_id - 1, Inventory.getItem(bar_id).getSlot(), 5064, 3);
Time.sleep(1000);
Variables.setStatus("withdrawing items");
// Withdraw items
// 1 Item:
// 632, item_id, bank_slot, 5382, 6
// 10 Items:
// 867, item_id, bank_slot, 5382, 4
// All items:
// 431, item_id, bank_slot, 5382, 3
int[] ores = Variables.smithing_bar_selected.getOres();
for (int i = 0; i < Math.floor((28 - Inventory.getCount()) / ores.length); i++)
for (int ore : ores)
Menu.sendAction(632, (ore - 1), getBankSlot(ore), 5382, 6);
/*
if (Variables.smithing_bar_selected == Bars.BRONZE) {
Menu.sendAction(867, (Bars.BRONZE.getOres()[0] - 1), 0, 5382, 4); // 10
Menu.sendAction(867, (Bars.BRONZE.getOres()[1] - 1), 1, 5382, 4); // 10
}
if (Variables.smithing_bar_selected == Bars.IRON)
Menu.sendAction(867, 440, 2, 5382, 4);
if (Variables.smithing_bar_selected == Bars.STEEL) {
for (int i = 0; i < 8; i++) Menu.sendAction(867, 440, 2, 5382, 4);
for (int i = 0; i < 8; i++) Menu.sendAction(867, 440, 2, 5382, 4); // 8 iron
}
*/
//org.rev317.min.api.methods.Bank.withdraw(441, 0, 100);
Variables.setStatus("smelting");
Time.sleep(1000);
return;
}
Menu.clickButton(6224);
Keyboard.getInstance().sendKeys("::bank", true);
Time.sleep(3000);
if (Game.getOpenInterfaceId() == 5292) {
if (Variables.skill_to_train == Skill.MINING)
org.rev317.min.api.methods.Bank.depositAllExcept(1266, 1268, 1270, 1272, 1274, 1276);
else if (Variables.skill_to_train == Skill.WOODCUTTING)
org.rev317.min.api.methods.Bank.depositAllExcept(1350, 1352, 1354, 1356, 1358, 1360, 6740);
else {
org.rev317.min.api.methods.Bank.depositAllExcept(1);
Variables.addItemGained(28);
}
Variables.setStatus("smelting");
}
}
private boolean hasBars(){
boolean hasBars = Inventory.getItem(Variables.smithing_bar_selected.getID()) != null;
//int inv_spot = Inventory.getItem(123).getSlot();
//int bank_spot = Bank.getItem(123).getSlot();
return hasBars;
}
private boolean hasOres(){
int[] ores = Variables.smithing_bar_selected.getOres();
for (int ore : ores)
if (Inventory.getItem(ore) == null)
return false;
return true;
}
private int getBankSlot(int ore){
switch(ore){
case 437: return 0;
case 439: return 1;
case 443: return 2;
case 445: return 3;
case 441: return 4;
case 454: return 5;
case 448: return 6;
case 450: return 7;
case 452: return 8;
default: return -1;
}
}
}
@@ -4,6 +4,7 @@ import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.wrappers.Item;
public class BuryBones implements Strategy {
@@ -12,9 +13,9 @@ public class BuryBones implements Strategy {
if (Variables.running
&& Variables.fighting_bury_bones
&& hasBones()
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& Inventory.isFull()) {
// && !Players.getMyPlayer().isInCombat()
// && Inventory.isFull()
) {
Variables.setStatus("burying bones");
return true;
}
@@ -29,7 +30,7 @@ public class BuryBones implements Strategy {
private void buryBones(){
try {
Inventory.getItem(527).interact(Items.Option.SECOND);
getBones().interact(Items.Option.SECOND);
Time.sleep(500);
if (Game.isLoggedIn() && hasBones()) buryBones();
} catch (Exception ಠ_ಠ) {
@@ -39,6 +40,21 @@ public class BuryBones implements Strategy {
private boolean hasBones(){
// Make sure we have bones
return Inventory.getItem(527) != null; // TODO: need to add the other bones too
return getBones() != null;
}
private Item getBones(){
// Make sure we have bones
for (int bone_id : getBoneIds()) {
if (Inventory.getItem(bone_id + 1) != null) {
return Inventory.getItem(bone_id + 1);
}
}
return null;
}
public static int[] getBoneIds(){
// TODO: need to check if all are buryable bones
return new int[]{526, 528, 530, 532, 534, 536, 2859, 3125, 3127, 3179, 3180, 3181, 3182, 3183, 3185, 3186, 3187, 4812, 6729, 6812};
}
}
@@ -0,0 +1,59 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Menu;
import org.rev317.min.api.methods.Players;
// TODO: this needs fixing up, not currently working AFAIK
public class Crafting implements Strategy {
@Override
public boolean activate() {
if (Variables.running
&& (Variables.getStatus() == "none" || Variables.getStatus() == "crafting")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1) {
Variables.setStatus("crafting");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
try {
int flax = 1779;
int flax_slot = Bank.getBankSlot(flax);
if (flax_slot >= 0)
Menu.sendAction(431, flax, flax_slot, 5382, 3);
Time.sleep(100);
Menu.clickButton(8890);
Time.sleep(100);
Menu.clickButton(8890);
Time.sleep(100);
// Sleep until animation == -1
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 300);
Time.sleep(100);
int string = 1777;
int string_slot = Bank.getInventorySlot(string);
if (string_slot >= 0)
Menu.sendAction(431, string, string_slot, 5064, 3);
} catch (Exception err){
System.out.println("Crafting error: ¯\\_(ツ)_/¯");
}
}
private boolean hasItems(){
int[] ores = {};
for (int ore : ores)
if (Inventory.getItem(ore) == null)
return false;
return true;
}
}
+10 -1
View File
@@ -12,7 +12,7 @@ public class Drop implements Strategy {
@Override
public boolean activate() {
items = Inventory.getItems(Variables.getItemIDs());
items = Inventory.getItems(inventoryItemIDs(Variables.getItemIDs()));
return Variables.running
&& Game.isLoggedIn()
&& Variables.shouldDropItems()
@@ -29,4 +29,13 @@ public class Drop implements Strategy {
}
}
}
// Return the item id + 1 (odd way inventory items are handled)
public int[] inventoryItemIDs(int[] itemIDs) {
int[] items = new int[itemIDs.length];
for(int i = 0; i < itemIDs.length; i++) {
items[i] = itemIDs[i] + 1;
}
return items;
}
}
@@ -0,0 +1,40 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.*;
public class Eat implements Strategy {
private int currentHealth = 0;
@Override
public boolean activate() {
currentHealth = Players.getMyPlayer().getHealth();
if (Variables.running
&& hasRequiredItems()
&& currentHealth > 0
&& currentHealth <= (Skill.HITPOINTS.getRealLevel() - Variables.fighting_food_heals_amount)
) {
Variables.setStatus("eating food");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
try {
Inventory.getItem(Variables.fighting_food_to_eat + 1).interact(Items.Option.CONSUME);
Time.sleep(() -> Players.getMyPlayer().getHealth() != currentHealth, 5000);
Variables.setStatus("none");
} catch (Exception ಠ_ಠ) {
System.out.println("Eating error: ¯\\_(ツ)_/¯");
}
}
private boolean hasRequiredItems(){
return Inventory.getItem(Variables.fighting_food_to_eat + 1) != null;
}
}
@@ -6,24 +6,27 @@ import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.wrappers.Character;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.Player;
public class Fighting implements Strategy {
private Npc victim;
private Player myPlayer;
@Override
public boolean activate() {
victim = victim(); // set the local Variable
Player myPlayer = Players.getMyPlayer();
myPlayer = Players.getMyPlayer();
if (Variables.running
&& victim != null
&& !myPlayer.isInCombat()
&& myPlayer.getAnimation() == -1
//&& (myPlayer.getInteractingCharacter() == null || myPlayer.getInteractingCharacter().getIndex() <= 0)
&& !Inventory.isFull()
&& myPlayer.getHealth() > Variables.fighting_minimum_hitpoints) {
Variables.setStatus("fighting");
return true;
&& (myPlayer.getHealth() <= 0 || myPlayer.getHealth() > Variables.fighting_minimum_hitpoints)) {
victim = victim(); // set the local Variable
if (victim != null) {
Variables.setStatus("fighting");
return true;
}
}
Variables.setStatus("none");
return false;
@@ -33,8 +36,8 @@ public class Fighting implements Strategy {
public void execute() {
victim.interact(Npcs.Option.ATTACK);
Time.sleep(2000);
// Wait for the Player to finish attacking (max 30 seconds)
Time.sleep(() -> !Players.getMyPlayer().isInCombat(), 30000);
// Wait for the Player to finish attacking (max 3 seconds)
Time.sleep(() -> !Players.getMyPlayer().isInCombat(), 3000);
Variables.updateExpGained();
}
@@ -42,8 +45,10 @@ public class Fighting implements Strategy {
try {
int[] npc_to_thieve = Variables.fighting_npc_selected.getIDs();
for (Npc victim : Npcs.getNearest(npc_to_thieve)) {
if (victim != null) {
return victim;
Character interactingPlayer = victim.getInteractingCharacter();
if (victim != null && (interactingPlayer == null || interactingPlayer.getIndex() <= 0 || interactingPlayer.getIndex() == myPlayer.getIndex())) {
if (!Variables.load_cannon || victim.distanceTo() <= 1)
return victim;
}
}
} catch (Exception ಠ_ಠ){}
@@ -0,0 +1,35 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.wrappers.Tile;
public class FightingReturnToCoords implements Strategy {
@Override
public boolean activate() {
return Variables.running
&& Game.isLoggedIn()
&& Variables.return_to_coords.length == 2
&& getTile().distanceTo() > 0
&& getTile().distanceTo() <= 20;
}
@Override
public void execute() {
Variables.setStatus("Walking to spot");
Tile tile = getTile();
tile.walkTo();
Time.sleep(1000);
int timeout = (int) Math.min(1e4, tile.distanceTo() * 500);
Time.sleep(() -> tile.distanceTo() < 1, timeout);
Time.sleep(500);
tile.walkTo();
Variables.setStatus("none");
}
public Tile getTile(){
return new Tile(Variables.return_to_coords[0], Variables.return_to_coords[1]);
}
}
@@ -8,7 +8,6 @@ import org.rev317.min.api.wrappers.Npc;
public class Fish implements Strategy {
private Npc fishingSpot;
private int[] items = new int[]{317, 321};
@Override
public boolean activate() {
@@ -17,7 +16,8 @@ public class Fish implements Strategy {
&& fishingSpot != null
&& (Variables.getStatus() == "none" || Variables.getStatus() == "fishing")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1) {
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
Variables.setStatus("fishing");
return true;
}
@@ -28,11 +28,7 @@ public class Fish implements Strategy {
@Override
public void execute() {
try {
if (Variables.shouldDropItems()) {
if (Inventory.getCount(441) >= 1) Inventory.getItem(441).interact(Items.Option.DROP);
}
fishingSpot.interact(Variables.fishing_type_selected);
fishingSpot.interact(Variables.fishing_spot_selected.actionType);
Time.sleep(1000);
// Wait for the Player to finish fishing (max 60 seconds)
@@ -44,7 +40,7 @@ public class Fish implements Strategy {
private Npc fishingSpot(){
try {
for (Npc spot : Npcs.getNearest(316)) {
for(Npc spot : Npcs.getNearest(Variables.fishing_spot_selected.getIDs())){
if (spot != null)
return spot;
}
@@ -8,11 +8,12 @@ import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Items;
import org.rev317.min.api.methods.Players;
public class MakeArrowShafts implements Strategy {
public class Fletch implements Strategy {
// TODO: Handle fletching other items such as shortbows, longbows etc
@Override
public boolean activate() {
if (Variables.running
&& Variables.shouldFletchItems()
&& hasRequiredItems()
&& (Variables.getStatus() == "none" || Variables.getStatus() == "making arrow shafts")
&& !Players.getMyPlayer().isInCombat()
@@ -31,37 +31,38 @@ public class HandleLogin implements Strategy {
}
if (!Game.isLoggedIn()) {
if(Variables.getAccountPassword() != null && Variables.getAccountUsername() != null) {
if(!typed) {
Mouse.getInstance().click(point);
Time.sleep(1000);
clearInput();
Keyboard.getInstance().sendKeys(Variables.getAccountUsername());
Time.sleep(2000);
Game.login(Variables.getAccountUsername(), Variables.getAccountPassword());
// if(!typed) {
// Mouse.getInstance().click(point);
// Time.sleep(1000);
// clearInput();
// Keyboard.getInstance().sendKeys(Variables.getAccountUsername());
// Time.sleep(2000);
clearInput();
// Checking again so people don't type their passwords ingame.
if(!Game.isLoggedIn()) {
Keyboard.getInstance().sendKeys(Variables.getAccountPassword());
}
// clearInput();
// // Checking again so people don't type their passwords ingame.
// if(!Game.isLoggedIn()) {
// Keyboard.getInstance().sendKeys(Variables.getAccountPassword());
// }
typed = true;
}
// typed = true;
// }
}
if(typed) {
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return Game.isLoggedIn();
}
}, 5000);
Mouse.getInstance().click(point);
Time.sleep(1000);
Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
Time.sleep(1000);
Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
Variables.setStatus("none");
}
// if(typed) {
// Time.sleep(new SleepCondition() {
// @Override
// public boolean isValid() {
// return Game.isLoggedIn();
// }
// }, 5000);
// Mouse.getInstance().click(point);
// Time.sleep(1000);
// Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
// Time.sleep(1000);
// Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
// Variables.setStatus("none");
// }
}
}
@@ -0,0 +1,54 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Items;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
public class LoadCannon implements Strategy {
private SceneObject cannon;
private long nextFill = System.currentTimeMillis() + 20000;
private long lastFilled = System.currentTimeMillis();
@Override
public boolean activate() {
cannon = getCannon();
if (Variables.running
&& Variables.load_cannon
&& cannon != null
&& hasCannonBalls()
&& nextFill <= System.currentTimeMillis()
) {
Variables.setStatus("filling cannon");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
cannon.interact(SceneObjects.Option.SECOND);
int Timeout = (int) Math.max(500, Math.min(5e3, cannon.distanceTo() * 500));
Time.sleep(Timeout);
cannon.interact(SceneObjects.Option.FIRST);
nextFill = System.currentTimeMillis() + 20000;
}
private SceneObject getCannon(){
for(SceneObject _cannon : SceneObjects.getNearest(6)){
if (_cannon.distanceTo() <= 10)
return _cannon;
}
return null;
}
private boolean hasCannonBalls(){
// Make sure we have cannon balls
return Inventory.getItem(2 + 1) != null;
}
}
+24 -22
View File
@@ -1,27 +1,24 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import ParaScript.data.variables.Rocks;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Items;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.wrappers.SceneObject;
public class Mine implements Strategy {
private SceneObject ore;
private SceneObject rock;
@Override
public boolean activate() {
ore = ore(); // set the local Variable
rock = rock(); // set the local Variable
if (Variables.running
&& ore != null
&& (Variables.getStatus().equals("none") || Variables.getStatus().equals("mining"))
&& Variables.VARROCK_EAST_MINE_ZONE.inTheZone()
&& rock != null
&& (Variables.getStatus() == "none" || Variables.getStatus() == "mining")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
&& !Inventory.isFull()
) {
Variables.setStatus("mining");
return true;
}
@@ -32,24 +29,29 @@ public class Mine implements Strategy {
@Override
public void execute() {
try {
if (Variables.shouldDropItems()) {
if (Inventory.getCount(441) >= 1) Inventory.getItem(441).interact(Items.Option.DROP);
if (Variables.mining_rock_selected.hash == 0) {
Variables.mining_rock_selected.hash = rock.getHash();
Variables.mining_rock_selected.x = rock.getLocalRegionX();
Variables.mining_rock_selected.y = rock.getLocalRegionY();
}
ore.interact(SceneObjects.Option.MINE);
Rocks myOre = Variables.mining_rock_selected;
// 502, rock_hash, local_x, local_y, 4
Menu.sendAction(502, myOre.hash, myOre.x, myOre.y, 4);
// Wait 1 seconds for the player to reach the rock
Time.sleep(1000);
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
// Sleep until player is mining the rock for a maximum of 2 seconds
Time.sleep(() -> Players.getMyPlayer().getAnimation() != -1, 2000);
// Sleep until not mining for a maximum of 10 seconds
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 10000);
} catch (Exception ಠ_ಠ){
System.out.println("Mining error: ¯\\_(ツ)_/¯");
}
Time.sleep(1000);
}
private SceneObject ore(){
int[] ore_to_mine = Variables.mining_ore_selected.getIDs();
for(SceneObject ore : SceneObjects.getNearest(ore_to_mine)){
if(Variables.VARROCK_EAST_MINE_ZONE.inTheZoneObject(ore)) {
return ore;
}
private SceneObject rock(){
int[] rock_to_mine = Variables.mining_rock_selected.getIDs();
for(SceneObject rock : SceneObjects.getNearest(rock_to_mine)){
return rock;
}
return null;
}
@@ -0,0 +1,57 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.GroundItems;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.wrappers.GroundItem;
import java.util.ArrayList;
public class PickupClues implements Strategy {
ArrayList<GroundItem> items;
@Override
public boolean activate() {
items = getItems();
if (Variables.running
&& items.size() > 0
&& !Inventory.isFull()
) {
Variables.setStatus("picking up cluescrolls");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
int currentItemAmount = Inventory.getCount(true);
try {
for (GroundItem item : items) {
item.take();
Time.sleep(500);
// 10 seconds or distance * 1 seconds
int timeout = Math.min(10000, item.distanceTo() * 1000);
Time.sleep(() -> item.distanceTo() < 1, timeout);
if (Inventory.isFull()){
break;
}
}
} catch (Exception ಠ_ಠ){
System.out.println("Pickup clue scrolls error: ¯\\_(ツ)_/¯");
}
Variables.addItemGained(Inventory.getCount(true) - currentItemAmount);
}
private ArrayList<GroundItem> getItems(){
ArrayList<GroundItem> groundItems = new ArrayList<GroundItem>();
for (GroundItem item : GroundItems.getNearest(2677, 2678, 2679)){
if (item.distanceTo() < 12)
groundItems.add(item);
}
return groundItems;
}
}
@@ -6,17 +6,20 @@ import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.wrappers.GroundItem;
import org.rev317.min.api.wrappers.Player;
import java.util.ArrayList;
public class PickupItems implements Strategy {
GroundItem[] items;
ArrayList<GroundItem> items;
@Override
public boolean activate() {
items = getItems();
Player myPlayer = Players.getMyPlayer();
if (Variables.running
&& items.length > 0
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& items.size() > 0
&& (myPlayer.getInteractingCharacter() == null || myPlayer.getInteractingCharacter().getIndex() <= 0)
&& !Inventory.isFull()) {
Variables.setStatus("picking up items");
return true;
@@ -27,12 +30,13 @@ public class PickupItems implements Strategy {
@Override
public void execute() {
int currentItemAmount = Inventory.getCount(true);
try {
for (GroundItem item : items) {
int currentItemAmount = Inventory.getCount(true);
item.take();
Time.sleep(500);
Time.sleep(() -> item.distanceTo() < 1, 2000);
Variables.addItemGained(Inventory.getCount(true) - currentItemAmount);
if (Inventory.isFull()){
break;
}
@@ -40,18 +44,22 @@ public class PickupItems implements Strategy {
} catch (Exception ಠ_ಠ){
System.out.println("Pickup items error: ¯\\_(ツ)_/¯");
}
Variables.addItemGained(Inventory.getCount(true) - currentItemAmount);
}
private GroundItem[] getItems(){
return GroundItems.getNearest(getItemIDs());
private ArrayList<GroundItem> getItems(){
ArrayList<GroundItem> groundItems = new ArrayList<GroundItem>();
for (GroundItem item : GroundItems.getNearest(getItemIDs())){
if (item.distanceTo() < 16)
groundItems.add(item);
}
return groundItems;
}
private int[] getItemIDs(){
int[] itemIDs = new int[]{};
if (Variables.skill_to_train == Skill.ATTACK){
if (Variables.fighting_bury_bones)
itemIDs = new int[]{526}; // TODO: need to add all the other bones
itemIDs = BuryBones.getBoneIds();
}
itemIDs = Methods.combineIntArrays(Variables.fighting_item_ids, itemIDs);
return itemIDs;
@@ -0,0 +1,45 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.*;
// TODO: this needs fixing up, not currently working AFAIK
public class Smelt implements Strategy {
@Override
public boolean activate() {
if (Variables.running
&& hasOres()
&& (Variables.getStatus() == "none" || Variables.getStatus() == "smelting")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1) {
Variables.setStatus("smelting");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
try {
Menu.clickButton(Variables.smithing_bar_selected.getButtonID());
Time.sleep(2000);
// Sleep until animation == -1
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
} catch (Exception err){
System.out.println("Smelting error: ¯\\_(ツ)_/¯");
}
}
private boolean hasOres(){
int[] ores = Variables.smithing_bar_selected.getOres();
for (int ore : ores)
if (Inventory.getItem(ore) == null)
return false;
return true;
}
}
@@ -6,7 +6,9 @@ import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.SceneObject;
public class Thieving implements Strategy {
private Npc victim;
@@ -0,0 +1,77 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Bank;
import java.io.*;
public class UpdateBank implements Strategy {
private static String seperator = System.getProperty("file.separator");
@Override
public boolean activate() {
if (Bank.isOpen()) {
Variables.setStatus("Saving Bank");
return true;
}
return false;
}
@Override
public void execute() {
Variables.bank_items = Bank.getBankItemIDs();
Time.sleep(500);
saveBankFile();
}
private static String getfileName(){
return "." + seperator + "bank" + seperator + Variables.getAccountUsername() + ".bank";
}
public void saveBankFile(){
String filePath = getfileName();
checkOrCreateFile(filePath);
try {
ObjectOutputStream out = new ObjectOutputStream(
new FileOutputStream(filePath)
);
out.writeObject(Variables.bank_items);
out.flush();
out.close();
} catch(Exception O_o){
System.out.println("Save file error");
}
}
public static int[] loadBankFile(){
if (Variables.getAccountUsername().length() <= 0)
return new int[]{};
String filePath = getfileName();
checkOrCreateFile(filePath);
try {
ObjectInputStream in = new ObjectInputStream(
new FileInputStream(filePath)
);
int[] array = (int[]) in.readObject();
in.close();
return array;
} catch(Exception O_o){
System.out.println("Load file error");
}
return new int[]{};
}
private static void checkOrCreateFile(String filename){
try {
File file = new File(filename);
File directory = new File(file.getParentFile().getPath());
directory.mkdirs();
file.createNewFile();
} catch(Exception O_o){
System.out.println("Create file error");
}
}
}
@@ -8,7 +8,7 @@ public class UpdateExperience implements Strategy {
@Override
public boolean activate() {
if (++Variables.update_experience_tick >= 1000) {
if (++Variables.update_experience_tick >= 2000) {
return true;
}
return false;
@@ -1,11 +1,10 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import ParaScript.data.variables.Trees;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.wrappers.SceneObject;
public class WoodcutTree implements Strategy {
@@ -19,7 +18,8 @@ public class WoodcutTree implements Strategy {
&& (Variables.getStatus() == "none" || Variables.getStatus() == "woodcutting")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
&& !Inventory.isFull()
) {
Variables.setStatus("woodcutting");
return true;
}
@@ -29,19 +29,31 @@ public class WoodcutTree implements Strategy {
@Override
public void execute() {
tree.interact(SceneObjects.Option.CHOP_DOWN);
Time.sleep(1000);
//Wait for the Player to chop the Tree
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
try {
Trees myTree = Variables.woodcutting_tree_selected;
if (myTree.hash == 0) {
myTree.hash = tree.getHash();
myTree.x = tree.getLocalRegionX();
myTree.y = tree.getLocalRegionY();
}
// 502, rock_hash, local_x, local_y, 4
Menu.sendAction(502, myTree.hash, myTree.x, myTree.y, 3);
// Wait 1 seconds for the player to reach the tree
Time.sleep(1000);
// Sleep until player is cutting the tree for a maximum of 2 seconds
Time.sleep(() -> Players.getMyPlayer().getAnimation() != -1, 2000);
// Sleep until not woodcutting for a maximum of 10 seconds
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 10000);
} catch (Exception err){
System.out.println("Woodcutting error: ¯\\_(ツ)_/¯");
}
}
private SceneObject tree(){
int[] tree_to_cut = Variables.woodcutting_tree_selected.getIDs();
for(SceneObject tree : SceneObjects.getNearest(tree_to_cut)){
if(tree != null){
if(Variables.LUMBRIDGE_NORMAL_TREE_ZONE.inTheZoneObject(tree)) {
return tree;
}
return tree;
}
}
return null;
+204 -68
View File
@@ -2,10 +2,9 @@ package ParaScript.ui;
import ParaScript.data.variables.*;
import ParaScript.data.Variables;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.Skill;
import ParaScript.strategies.UpdateBank;
import org.rev317.min.api.methods.*;
import org.rev317.min.api.methods.Menu;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@@ -31,24 +30,33 @@ public class UI extends JFrame {
private JCheckBox birdsNest = new JCheckBox();
// Mining
private JComboBox oreSelect = new JComboBox();
private JComboBox rockSelect = new JComboBox();
private JComboBox miningMethod = new JComboBox();
// Smithing
private JComboBox barSelect = new JComboBox();
// Fighting
private JComboBox fightingNpcSelect = new JComboBox();
private JLabel lblFightingNpcCustomID = new JLabel("Custom NPC IDs");
private JTextField fightingNpcCustomID = new JTextField();
private JCheckBox fightingBuryBones = new JCheckBox();
private JCheckBox fightingLoadCannon = new JCheckBox();
private JTextField returnPositionCoords = new JTextField();
private JTextField fightingItemCustomID = new JTextField();
private JTextField fightingMinimumHitpoints = new JTextField();
private JTextField fightingFoodToEat = new JTextField();
private JTextField fightingFoodHealsAmount = new JTextField();
// Thieving
private JComboBox thievingNpcSelect = new JComboBox();
private JLabel lblThievingNpcCustomID = new JLabel("Custom NPC IDs");
private JTextField thievingNpcCustomID = new JTextField();
private JComboBox thievingMethod = new JComboBox();
// Fishing
private JComboBox fishingTypeSelect = new JComboBox();
private JComboBox fishingMethod = new JComboBox();
// Our colors
private Color Color_MidnightBlue = new Color(44, 62, 80);
@@ -56,6 +64,7 @@ public class UI extends JFrame {
private Color Color_WhiteSmoke = new Color(245, 245, 245);
private Color Color_Emerald = new Color(46, 204, 113);
private Color Color_Alizarin = new Color(231, 76, 60);
private Color Color_BelizeHole = new Color(41, 128, 185);
public UI() {
setTitle("2006 AIO");
@@ -125,11 +134,13 @@ public class UI extends JFrame {
lblSkillToTrain.setBounds(20, 20, 73, 20);
settingsPanel.add(lblSkillToTrain);
skillSelect.setModel(new DefaultComboBoxModel(new String[]{
Skill.ATTACK.getName(),
Skill.WOODCUTTING.getName(),
Skill.MINING.getName(),
Skill.ATTACK.getName(),
// Skill.SMITHING.getName(),
Skill.THIEVING.getName(),
Skill.FISHING.getName(),
// Skill.CRAFTING.getName(),
"Bank Runner",
}));
skillSelect.setBounds(20, 40, 150, 20);
@@ -168,6 +179,7 @@ public class UI extends JFrame {
for (Trees tree : Trees.values()) {
if (tree.getName().equalsIgnoreCase(treeSelect.getSelectedItem().toString())) {
Variables.woodcutting_tree_selected = tree;
Variables.woodcutting_tree_selected.reset();
}
}
}
@@ -181,7 +193,7 @@ public class UI extends JFrame {
woodcuttingPanel.add(lblWoodcuttingMethod);
woodcuttingMethod.setModel(new DefaultComboBoxModel(new String[]{
"Fletch",
"Bank",
// "Bank",
"Drop",
}));
woodcuttingMethod.setBounds(20, 80, 150, 20);
@@ -238,22 +250,23 @@ public class UI extends JFrame {
miningPanel.setLayout(null);
// Select which ore to mine
JLabel lblOre = new JLabel("Ore");
lblOre.setForeground(Color_WhiteSmoke);
lblOre.setBounds(20, 20, 73, 20);
miningPanel.add(lblOre);
oreSelect.setModel(new DefaultComboBoxModel(Ores.toStringArray()));
oreSelect.setBounds(20, 40, 150, 20);
oreSelect.addActionListener (new ActionListener () {
JLabel lblRock = new JLabel("Rock");
lblRock.setForeground(Color_WhiteSmoke);
lblRock.setBounds(20, 20, 73, 20);
miningPanel.add(lblRock);
rockSelect.setModel(new DefaultComboBoxModel(Rocks.toStringArray()));
rockSelect.setBounds(20, 40, 150, 20);
rockSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Ores ore : Ores.values()) {
if (ore.getName().equalsIgnoreCase(oreSelect.getSelectedItem().toString())) {
Variables.mining_ore_selected = ore;
for (Rocks rock : Rocks.values()) {
if (rock.getName().equalsIgnoreCase(rockSelect.getSelectedItem().toString())) {
Variables.mining_rock_selected = rock;
Variables.mining_rock_selected.reset();
}
}
}
});
miningPanel.add(oreSelect);
miningPanel.add(rockSelect);
// What should we do with our ores
JLabel lblMiningMethod = new JLabel("Method");
@@ -261,7 +274,7 @@ public class UI extends JFrame {
lblMiningMethod.setBounds(20, 60, 150, 20);
miningPanel.add(lblMiningMethod);
miningMethod.setModel(new DefaultComboBoxModel(new String[]{
"Bank",
// "Bank",
"Drop",
}));
miningMethod.setBounds(20, 80, 150, 20);
@@ -272,6 +285,34 @@ public class UI extends JFrame {
});
miningPanel.add(miningMethod);
// /*
// * Smithing Panel
// */
// JPanel smithingPanel = new JPanel();
// smithingPanel.setForeground(Color_WhiteSmoke);
// smithingPanel.setBackground(Color_WetAsphalt);
// tabbedPane.addTab("Smithing", null, smithingPanel, null);
// smithingPanel.setLayout(null);
// // Select which ore to smelt
// JLabel lblBar = new JLabel("Bar");
// lblBar.setForeground(Color_WhiteSmoke);
// lblBar.setBounds(20, 20, 73, 20);
// smithingPanel.add(lblBar);
// barSelect.setModel(new DefaultComboBoxModel(Bars.toStringArray()));
// barSelect.setBounds(20, 40, 150, 20);
// barSelect.addActionListener (new ActionListener () {
// public void actionPerformed(ActionEvent e) {
// for (Bars bar : Bars.values()) {
// if (bar.getName().equalsIgnoreCase(barSelect.getSelectedItem().toString())) {
// Variables.smithing_bar_selected = bar;
// }
// }
// }
// });
// smithingPanel.add(barSelect);
/*
* Fighting Panel
*/
@@ -285,10 +326,10 @@ public class UI extends JFrame {
// Select which npc should be our victim
JLabel lblFightingNpc = new JLabel("NPC");
lblFightingNpc.setForeground(Color_WhiteSmoke);
lblFightingNpc.setBounds(20, 20, 73, 20);
lblFightingNpc.setBounds(20, 0, 73, 20);
fightingPanel.add(lblFightingNpc);
fightingNpcSelect.setModel(new DefaultComboBoxModel(FightingNpcs.toStringArray()));
fightingNpcSelect.setBounds(20, 40, 150, 20);
fightingNpcSelect.setBounds(20, 20, 150, 20);
fightingNpcSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (FightingNpcs npc : FightingNpcs.values()) {
@@ -311,9 +352,9 @@ public class UI extends JFrame {
// Custom npc id to attack
lblFightingNpcCustomID.setForeground(Color_WhiteSmoke);
lblFightingNpcCustomID.setBounds(200, 20, 150, 20);
lblFightingNpcCustomID.setBounds(200, 0, 150, 20);
fightingPanel.add(lblFightingNpcCustomID);
fightingNpcCustomID.setBounds(200, 40, 150, 20);
fightingNpcCustomID.setBounds(200, 20, 150, 20);
fightingNpcCustomID.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
@@ -328,9 +369,9 @@ public class UI extends JFrame {
for (int i = 0; i < sample.length; i++)
customIDs[i] = Integer.parseInt(sample[i]);
Variables.fighting_npc_selected.setIDs(customIDs);
FightingNpcs.CUSTOM.setIDs(customIDs);
} catch (Exception ಠ_ಠ) {
FightingNpcs.CUSTOM.setIDs(new int[]{0});
FightingNpcs.CUSTOM.setIDs(new int[]{});
}
}
});
@@ -338,13 +379,30 @@ public class UI extends JFrame {
lblFightingNpcCustomID.setVisible(false);
fightingNpcCustomID.setVisible(false);
// Should we collect and bury our bones
JLabel lblFightingLoadCannon = new JLabel("Load cannon");
lblFightingLoadCannon.setForeground(Color_WhiteSmoke);
lblFightingLoadCannon.setBounds(40, 40, 130, 20);
fightingPanel.add(lblFightingLoadCannon);
fightingLoadCannon.setBackground(Color_WetAsphalt);
fightingLoadCannon.setForeground(Color_WhiteSmoke);
fightingLoadCannon.setBounds(15, 40, 20, 20);
fightingLoadCannon.setSelected(false);
fightingLoadCannon.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Variables.load_cannon = fightingLoadCannon.isSelected();
}
});
fightingPanel.add(fightingLoadCannon);
// Should we collect and bury our bones
JLabel lblFightingBuryBones = new JLabel("Collect and bury bones");
lblFightingBuryBones.setForeground(Color_WhiteSmoke);
lblFightingBuryBones.setBounds(40, 80, 130, 20);
lblFightingBuryBones.setBounds(40, 60, 130, 20);
fightingPanel.add(lblFightingBuryBones);
fightingBuryBones.setBackground(Color_WetAsphalt);
fightingBuryBones.setForeground(Color_WhiteSmoke);
fightingBuryBones.setBounds(15, 80, 20, 20);
fightingBuryBones.setBounds(15, 60, 20, 20);
fightingBuryBones.setSelected(true);
fightingBuryBones.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -353,12 +411,40 @@ public class UI extends JFrame {
});
fightingPanel.add(fightingBuryBones);
// Should we hold a position (aggressive npcs, ranging) return after collecting items
JLabel lblReturnPosition = new JLabel("Return Position");
lblReturnPosition.setForeground(Color_WhiteSmoke);
lblReturnPosition.setBounds(200, 40, 150, 20);
fightingPanel.add(lblReturnPosition);
returnPositionCoords.setBounds(200, 60, 150, 20);
returnPositionCoords.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// we don't need to do anything here
}
@Override
public void focusLost(FocusEvent e) {
try {
String[] sample = returnPositionCoords.getText().split("(,|;)\\s*");
int[] coords = new int[sample.length];
for (int i = 0; i < sample.length; i++)
coords[i] = Integer.parseInt(sample[i]);
Variables.return_to_coords = coords;
} catch (Exception ಠ_ಠ) {
Variables.return_to_coords = new int[]{};
}
}
});
fightingPanel.add(returnPositionCoords);
// Custom items to pickup
JLabel lblFightingItemCustomID = new JLabel("Pickup Item IDs");
lblFightingItemCustomID.setForeground(Color_WhiteSmoke);
lblFightingItemCustomID.setBounds(20, 120, 150, 20);
lblFightingItemCustomID.setBounds(20, 80, 150, 20);
fightingPanel.add(lblFightingItemCustomID);
fightingItemCustomID.setBounds(20, 140, 150, 20);
fightingItemCustomID.setBounds(20, 100, 150, 20);
fightingItemCustomID.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
@@ -382,11 +468,11 @@ public class UI extends JFrame {
fightingPanel.add(fightingItemCustomID);
// Minimum hitpoints to start fighting
JLabel lblFightingMinimumHitpoints = new JLabel("Minimum hitpoints");
JLabel lblFightingMinimumHitpoints = new JLabel("Minimum hitpoints to fight");
lblFightingMinimumHitpoints.setForeground(Color_WhiteSmoke);
lblFightingMinimumHitpoints.setBounds(200, 120, 150, 20);
lblFightingMinimumHitpoints.setBounds(200, 80, 150, 20);
fightingPanel.add(lblFightingMinimumHitpoints);
fightingMinimumHitpoints.setBounds(200, 140, 150, 20);
fightingMinimumHitpoints.setBounds(200, 100, 150, 20);
fightingMinimumHitpoints.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
@@ -398,12 +484,58 @@ public class UI extends JFrame {
try {
Variables.fighting_minimum_hitpoints = Integer.parseInt(fightingMinimumHitpoints.getText());
} catch (Exception ಠ_ಠ) {
Variables.fighting_minimum_hitpoints = 0;
Variables.fighting_minimum_hitpoints = -1;
}
}
});
fightingPanel.add(fightingMinimumHitpoints);
// Food to eat when health is low
JLabel lblFightingFoodToEat = new JLabel("Food ID to eat");
lblFightingFoodToEat.setForeground(Color_WhiteSmoke);
lblFightingFoodToEat.setBounds(20, 120, 150, 20);
fightingPanel.add(lblFightingFoodToEat);
fightingFoodToEat.setBounds(20, 140, 150, 20);
fightingFoodToEat.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// we don't need to do anything here
}
@Override
public void focusLost(FocusEvent e) {
try {
Variables.fighting_food_to_eat = Integer.parseInt(fightingFoodToEat.getText());
} catch (Exception ಠ_ಠ) {
Variables.fighting_food_to_eat = -1;
}
}
});
fightingPanel.add(fightingFoodToEat);
// How much the food heals for
JLabel lblFightingFoodHealsAmount = new JLabel("Food heals amount");
lblFightingFoodHealsAmount.setForeground(Color_WhiteSmoke);
lblFightingFoodHealsAmount.setBounds(200, 120, 150, 20);
fightingPanel.add(lblFightingFoodHealsAmount);
fightingFoodHealsAmount.setBounds(200, 140, 150, 20);
fightingFoodHealsAmount.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// we don't need to do anything here
}
@Override
public void focusLost(FocusEvent e) {
try {
Variables.fighting_food_heals_amount = Integer.parseInt(fightingFoodHealsAmount.getText());
} catch (Exception ಠ_ಠ) {
Variables.fighting_food_heals_amount = 20;
}
}
});
fightingPanel.add(fightingFoodHealsAmount);
/*
* Thieving Panel
*/
@@ -470,6 +602,22 @@ public class UI extends JFrame {
lblThievingNpcCustomID.setVisible(false);
thievingNpcCustomID.setVisible(false);
// What should we do with our items
JLabel lblThievingMethod = new JLabel("Method");
lblThievingMethod.setForeground(Color_WhiteSmoke);
lblThievingMethod.setBounds(20, 60, 150, 20);
thievingPanel.add(lblThievingMethod);
thievingMethod.setModel(new DefaultComboBoxModel(new String[]{
"Drop",
}));
thievingMethod.setBounds(20, 80, 150, 20);
thievingMethod.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.thieving_method = thievingMethod.getSelectedItem().toString();
}
});
thievingPanel.add(thievingMethod);
/*
* Fishing Panel
*/
@@ -480,29 +628,40 @@ public class UI extends JFrame {
tabbedPane.addTab("Fishing", fishingPanel);
fishingPanel.setLayout(null);
// Select which npc should be our victim
// Select our fishing type
JLabel lblFishingTypeSelect = new JLabel("Fishing Type");
lblFishingTypeSelect.setForeground(Color_WhiteSmoke);
lblFishingTypeSelect.setBounds(20, 20, 73, 20);
fishingPanel.add(lblFishingTypeSelect);
fishingTypeSelect.setModel(new DefaultComboBoxModel(new String[]{
Npcs.Option.NET.name(),
Npcs.Option.BAIT.name(),
Npcs.Option.CAGE.name(),
Npcs.Option.HARPOON.name(),
}));
fishingTypeSelect.setModel(new DefaultComboBoxModel(FishingSpots.toStringArray()));
fishingTypeSelect.setBounds(20, 40, 150, 20);
fishingTypeSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Npcs.Option option : Npcs.Option.values()) {
if (option.name().equalsIgnoreCase(fishingTypeSelect.getSelectedItem().toString())) {
Variables.fishing_type_selected = option;
for (FishingSpots fishingSpot : FishingSpots.values()) {
if (fishingSpot.name().equalsIgnoreCase(fishingTypeSelect.getSelectedItem().toString())) {
Variables.fishing_spot_selected = fishingSpot;
}
}
}
});
fishingPanel.add(fishingTypeSelect);
// What should we do with out fish
JLabel lblFishingMethod = new JLabel("Method");
lblFishingMethod.setForeground(Color_WhiteSmoke);
lblFishingMethod.setBounds(20, 60, 150, 20);
fishingPanel.add(lblFishingMethod);
fishingMethod.setModel(new DefaultComboBoxModel(new String[]{
"Drop",
}));
fishingMethod.setBounds(20, 80, 150, 20);
fishingMethod.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.fishing_method = fishingMethod.getSelectedItem().toString();
}
});
fishingPanel.add(fishingMethod);
/*
* Slave Panel
*
@@ -524,7 +683,7 @@ public class UI extends JFrame {
slavePanel.add(slaveMaster);
slaveMaster.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.slaveMaster = slaveMaster.getText();
Variables.slave_master = slaveMaster.getText();
}
});
*/
@@ -536,29 +695,7 @@ public class UI extends JFrame {
Variables.setAccountUsername(username.getText());
Variables.setAccountPassword(password.getText());
}
/*
for (Location loc : Location.values()) {
if (loc.getName().equalsIgnoreCase(location.getSelectedItem().toString())) {
Variables.setLocation(loc);
}
}
for (Tree selectedTree : Tree.values()) {
if (selectedTree.getName().equalsIgnoreCase(treeSelect.getSelectedItem().toString())) {
Variables.setTree(selectedTree);
System.out.println(selectedTree.getName());
}
}
if (drop.isSelected()) {
Variables.setDrop(true);
}
if (bank.isSelected()) {
Variables.setBanking(true);
}
if (birdsNest.isSelected()) {
Variables.setPickupBirdNests(true);
}
dispose();
*/
Variables.bank_items = UpdateBank.loadBankFile();
Variables.running = !Variables.running;
start.setText(Variables.running ? "PAUSE" : "START");
start.setBackground(Variables.running ? Color_Alizarin : Color_Emerald);
@@ -566,7 +703,6 @@ public class UI extends JFrame {
});
start.setBackground(Color_Emerald);
start.setForeground(Color_MidnightBlue);
// these next two lines do the magic..
start.setContentAreaFilled(false);
start.setOpaque(true);
start.setBounds(20, 220, 360, 40);