From aa5d2062747cc835c68b33a591100eace5030ae1 Mon Sep 17 00:00:00 2001 From: Danial Date: Thu, 7 Oct 2021 16:07:25 +1300 Subject: [PATCH] Squashed commit of the following: commit fd4615a57fbb977511c923b9ec33dc1d62d805cb Author: Danial Date: Thu Oct 7 16:06:48 2021 +1300 Disable banking/walking atm commit 9ee2538de3324307193591ea9991056bd05139ab Author: Danial Date: Thu Oct 7 16:05:40 2021 +1300 Add WIP strats commit 193d6f7ba12e9b3336a84068a9065954e2b9f62a Author: Danial Date: Thu Oct 7 16:02:06 2021 +1300 Update PickupClues.java commit 36a42333cb3fa2e640dd37f7b9f3ee75399ce3ee Author: Danial Date: Thu Oct 7 15:59:54 2021 +1300 Update LoadCannon.java commit f7dd9f43d775cbb08ee3a1cc5c4db2cd3ea65597 Author: Danial Date: Thu Oct 7 15:56:23 2021 +1300 tidy up commit 4dd586ccd5667ac43436d5904620b1e584ac7740 Author: Danial Date: Thu Oct 7 15:55:57 2021 +1300 Fixup dropping again commit 3eedd24f50fbd731d9669b8210a714ab91005dcb Author: Danial Date: Thu Oct 7 13:58:39 2021 +1300 Fixup dropping items commit ab7be16b6bc75756901fa224e8b876e985ac6e5b Author: Danial Date: Thu Oct 7 13:35:42 2021 +1300 Update dropping items commit e85177ebf9ea94d5e595ef1f03783e32a9be1867 Author: Danial Date: Thu Oct 7 13:14:10 2021 +1300 Update Fletch.java commit 813ab7be3065a8017e58dbf4baea5a85cdab4bb6 Author: Danial Date: Thu Oct 7 13:12:30 2021 +1300 Include drop strat commit 720b679df5bb35243774b8e87446a30055341438 Author: Danial Date: Thu Oct 7 13:12:21 2021 +1300 fletching commit 1517e1b6e47eabc4e1884717953a72a24504af7f Author: Danial Date: Thu Oct 7 13:04:01 2021 +1300 Hide smithing and crafting commit 42590ccf035f42bab970954ef83b639bde3451ee Author: Danial Date: Thu Oct 7 13:02:04 2021 +1300 Update Main.java commit 6825d5843a00e4a4c987c91ca5ea32bd3d023faa Author: Danial Date: Thu Oct 7 12:59:55 2021 +1300 Update Mine.java commit e8a3ea42f3176cc23f3635d77b2ed353835d1589 Author: Danial Date: Thu Oct 7 12:59:52 2021 +1300 Update WoodcutTree.java commit 1a20d915e886600407ffb82a383f1c4b4273a23f Author: Danial Date: Thu Oct 7 12:57:13 2021 +1300 Update Fish.java commit 272b963b15e012d06f24fd1a5f0ae3a221629755 Author: Danial Date: Thu Oct 7 12:56:30 2021 +1300 Update WoodcutTree.java commit 1ab6b0790f142d727bb5f1cd6f93bb8bf76ac3fd Author: Danial Date: Thu Oct 7 12:56:15 2021 +1300 Update WoodcutTree.java commit 5ce89bdef672b8def25e38225210f08e55afa322 Author: Danial Date: Thu Oct 7 12:55:35 2021 +1300 Update WoodcutTree.java commit 4f1aa178eb42c7ca12a271f7d277d59e4752d41f Author: Danial Date: Thu Oct 7 12:55:18 2021 +1300 Update WoodcutTree.java commit 53235ef523a304b1e3f9c852cefe515e82a2ed18 Author: Danial Date: Thu Oct 7 12:54:16 2021 +1300 Update WoodcutTree.java commit 3b3c082ca926b2e330b5d8baa3a68b18c019fd0c Author: Danial Date: Thu Oct 7 12:54:08 2021 +1300 Update ScriptState.java commit 6731fcae6dcd55558d48dab107c9da5e3407930d Author: Danial Date: Thu Oct 7 12:53:37 2021 +1300 Update PickupItems.java commit 03582f61873183520fc9582309bc982dcaaa7f36 Author: Danial Date: Thu Oct 7 12:51:38 2021 +1300 Update Eat.java commit 7464f87e3ae29c57a3b6329e305e098a33af418d Author: Danial Date: Thu Oct 7 12:51:03 2021 +1300 Update Trees.java commit c8f2521e6411274d77df654a561a699f05ebc643 Author: Danial Date: Thu Oct 7 12:50:18 2021 +1300 Update Bank.java commit 419f7212db367160b0cb35f0992f24ae1d609ebb Author: Danial Date: Thu Oct 7 12:37:55 2021 +1300 Update Bank.java commit 86a78089586fecbbb6127a270d6a7382c8d3a81d Author: Danial Date: Thu Oct 7 12:37:46 2021 +1300 Update HandleLogin.java commit b1ade815caa31875c2c93ded2f7d825970fcac8f Author: Danial Date: Thu Oct 7 12:27:32 2021 +1300 Update UpdateExperience.java commit e3cdcfbb9703a4c63941f4176bc2724e5c0e5721 Author: Danial Date: Thu Oct 7 12:26:54 2021 +1300 Update BuryBones.java commit 570c1c9b704c33ec35e62b56fd64f579a9c554ec Author: Danial Date: Thu Oct 7 12:26:03 2021 +1300 Update fishing commit 41a3d3729073f3e74e87092b5838f5c53e351bcf Author: Danial Date: Thu Oct 7 12:16:38 2021 +1300 initial working stuff --- src/main/java/ParaScript/DesktopTray.java | 41 +++ src/main/java/ParaScript/Main.java | 53 ++-- src/main/java/ParaScript/data/Variables.java | 49 +++- .../java/ParaScript/data/variables/Bars.java | 47 +++ .../data/variables/FishingSpots.java | 58 ++++ .../java/ParaScript/data/variables/Rocks.java | 65 +++++ .../java/ParaScript/data/variables/Trees.java | 26 +- src/main/java/ParaScript/icon.png | Bin 0 -> 11933 bytes src/main/java/ParaScript/strategies/Bank.java | 129 +++++++-- .../ParaScript/strategies/BankSmithing.java | 109 +++++++ .../java/ParaScript/strategies/BuryBones.java | 26 +- .../java/ParaScript/strategies/Crafting.java | 59 ++++ src/main/java/ParaScript/strategies/Drop.java | 11 +- src/main/java/ParaScript/strategies/Eat.java | 40 +++ .../java/ParaScript/strategies/Fighting.java | 27 +- .../strategies/FightingReturnToCoords.java | 35 +++ src/main/java/ParaScript/strategies/Fish.java | 12 +- .../{MakeArrowShafts.java => Fletch.java} | 5 +- .../ParaScript/strategies/HandleLogin.java | 55 ++-- .../ParaScript/strategies/LoadCannon.java | 54 ++++ src/main/java/ParaScript/strategies/Mine.java | 48 ++-- .../ParaScript/strategies/PickupClues.java | 57 ++++ .../ParaScript/strategies/PickupItems.java | 26 +- .../java/ParaScript/strategies/Smelt.java | 45 +++ .../java/ParaScript/strategies/Thieving.java | 2 + .../ParaScript/strategies/UpdateBank.java | 77 +++++ .../strategies/UpdateExperience.java | 2 +- .../ParaScript/strategies/WoodcutTree.java | 34 ++- src/main/java/ParaScript/ui/UI.java | 272 +++++++++++++----- 29 files changed, 1232 insertions(+), 232 deletions(-) create mode 100644 src/main/java/ParaScript/DesktopTray.java create mode 100644 src/main/java/ParaScript/data/variables/Bars.java create mode 100644 src/main/java/ParaScript/data/variables/FishingSpots.java create mode 100644 src/main/java/ParaScript/data/variables/Rocks.java create mode 100644 src/main/java/ParaScript/icon.png create mode 100644 src/main/java/ParaScript/strategies/BankSmithing.java create mode 100644 src/main/java/ParaScript/strategies/Crafting.java create mode 100644 src/main/java/ParaScript/strategies/Eat.java create mode 100644 src/main/java/ParaScript/strategies/FightingReturnToCoords.java rename src/main/java/ParaScript/strategies/{MakeArrowShafts.java => Fletch.java} (90%) create mode 100644 src/main/java/ParaScript/strategies/LoadCannon.java create mode 100644 src/main/java/ParaScript/strategies/PickupClues.java create mode 100644 src/main/java/ParaScript/strategies/Smelt.java create mode 100644 src/main/java/ParaScript/strategies/UpdateBank.java diff --git a/src/main/java/ParaScript/DesktopTray.java b/src/main/java/ParaScript/DesktopTray.java new file mode 100644 index 0000000..e444d6d --- /dev/null +++ b/src/main/java/ParaScript/DesktopTray.java @@ -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); + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/Main.java b/src/main/java/ParaScript/Main.java index da6627c..67e7440 100644 --- a/src/main/java/ParaScript/Main.java +++ b/src/main/java/ParaScript/Main.java @@ -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 strategies = new ArrayList(); @@ -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 diff --git a/src/main/java/ParaScript/data/Variables.java b/src/main/java/ParaScript/data/Variables.java index a3b23aa..759de81 100644 --- a/src/main/java/ParaScript/data/Variables.java +++ b/src/main/java/ParaScript/data/Variables.java @@ -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; } diff --git a/src/main/java/ParaScript/data/variables/Bars.java b/src/main/java/ParaScript/data/variables/Bars.java new file mode 100644 index 0000000..006a20c --- /dev/null +++ b/src/main/java/ParaScript/data/variables/Bars.java @@ -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 enumList = Arrays.asList(Bars.values()); + List 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; } +} diff --git a/src/main/java/ParaScript/data/variables/FishingSpots.java b/src/main/java/ParaScript/data/variables/FishingSpots.java new file mode 100644 index 0000000..8f90d94 --- /dev/null +++ b/src/main/java/ParaScript/data/variables/FishingSpots.java @@ -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 enumList = Arrays.asList(FishingSpots.values()); + List 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; + } +} diff --git a/src/main/java/ParaScript/data/variables/Rocks.java b/src/main/java/ParaScript/data/variables/Rocks.java new file mode 100644 index 0000000..716ff2f --- /dev/null +++ b/src/main/java/ParaScript/data/variables/Rocks.java @@ -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 enumList = Arrays.asList(Rocks.values()); + List 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; + } +} diff --git a/src/main/java/ParaScript/data/variables/Trees.java b/src/main/java/ParaScript/data/variables/Trees.java index 6bae767..effbe1f 100644 --- a/src/main/java/ParaScript/data/variables/Trees.java +++ b/src/main/java/ParaScript/data/variables/Trees.java @@ -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; + } } diff --git a/src/main/java/ParaScript/icon.png b/src/main/java/ParaScript/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0c939806af7592579192dd27aca49fa4badb34fb GIT binary patch literal 11933 zcmZ{KbyytF@9^Gnxcec+ij?9G#jUs$EfhIiiWQ0#JDipxEybPUF2(I|iuZ&2L9wET zJN)?m`Tp@fJDbezPM#$DWG0zpK5J_#;p0%_004lmqO73vgyH|Yu`r%skCesm6N1>u zYRCdWO&so>1^Ux7gO#$51^|3weHs@A05|^|zXJfCya2EZ1Atd406^)M(eg&(=>vwP znvw$W_`fTsy(r=74dzD`4MohqxMTn)rtZziTL9q7RZ)=D^I14(SE*uFse9%X+pJ{0 zmHB>u?KTVH@H_+=GPR}B8A9VwKraVgA_j|W#7fKk7Xr{XudNd^Fv!3MSwtY15^aaO zX?ru7{Lj0W)p5P!P*HxaTKdzb%RHp0FN1Bm25HUnHCCadw*yK(s18b}huY=qIup`{ zNpd(3=#CJ0V1;+0BVB0_IS+PI)hyRlP<sG>dI9WkCNJ1ii^fgkTh`|^jj^IdXk63SJ&tjZwq(I@dxBnU&t7ue1RD$+_ zvw7#1;%QvwYQukqrWwKOGC#F87*w4p=MZ{U^Ju*8>O@CjAoki; zz@p5Ci)9y^eM5r__a^{T3h|0DmYy1zdV>y2y+U6)T0HyZB@IQRIcOuWK$)yy9M%D z4%VWM%xw7rC@F8c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D(#iC zcEXu^1F7JGS6q&2@g4hF?vP481Xa2-UWRlgym&gl&GJ$4?MG{ik2bHY+-;r^z|YGk z#>L0S#m}q9%lk@D;FXXd$5V%wSATbk;r}6UcC~h}_5J@7FgH47JP`mYikb?Qa 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; } } } diff --git a/src/main/java/ParaScript/strategies/BankSmithing.java b/src/main/java/ParaScript/strategies/BankSmithing.java new file mode 100644 index 0000000..4e5fe05 --- /dev/null +++ b/src/main/java/ParaScript/strategies/BankSmithing.java @@ -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; + } + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/BuryBones.java b/src/main/java/ParaScript/strategies/BuryBones.java index 366452e..704e53a 100644 --- a/src/main/java/ParaScript/strategies/BuryBones.java +++ b/src/main/java/ParaScript/strategies/BuryBones.java @@ -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}; } } diff --git a/src/main/java/ParaScript/strategies/Crafting.java b/src/main/java/ParaScript/strategies/Crafting.java new file mode 100644 index 0000000..69e16d0 --- /dev/null +++ b/src/main/java/ParaScript/strategies/Crafting.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/Drop.java b/src/main/java/ParaScript/strategies/Drop.java index 68e6bed..dba12ab 100644 --- a/src/main/java/ParaScript/strategies/Drop.java +++ b/src/main/java/ParaScript/strategies/Drop.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/Eat.java b/src/main/java/ParaScript/strategies/Eat.java new file mode 100644 index 0000000..8efaf4b --- /dev/null +++ b/src/main/java/ParaScript/strategies/Eat.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/Fighting.java b/src/main/java/ParaScript/strategies/Fighting.java index 561986b..e17dc11 100644 --- a/src/main/java/ParaScript/strategies/Fighting.java +++ b/src/main/java/ParaScript/strategies/Fighting.java @@ -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 ಠ_ಠ){} diff --git a/src/main/java/ParaScript/strategies/FightingReturnToCoords.java b/src/main/java/ParaScript/strategies/FightingReturnToCoords.java new file mode 100644 index 0000000..c76e027 --- /dev/null +++ b/src/main/java/ParaScript/strategies/FightingReturnToCoords.java @@ -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]); + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/Fish.java b/src/main/java/ParaScript/strategies/Fish.java index e03919d..8a4dadb 100644 --- a/src/main/java/ParaScript/strategies/Fish.java +++ b/src/main/java/ParaScript/strategies/Fish.java @@ -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; } diff --git a/src/main/java/ParaScript/strategies/MakeArrowShafts.java b/src/main/java/ParaScript/strategies/Fletch.java similarity index 90% rename from src/main/java/ParaScript/strategies/MakeArrowShafts.java rename to src/main/java/ParaScript/strategies/Fletch.java index 4529580..f3bbcc1 100644 --- a/src/main/java/ParaScript/strategies/MakeArrowShafts.java +++ b/src/main/java/ParaScript/strategies/Fletch.java @@ -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() diff --git a/src/main/java/ParaScript/strategies/HandleLogin.java b/src/main/java/ParaScript/strategies/HandleLogin.java index e6c2b30..4317b64 100644 --- a/src/main/java/ParaScript/strategies/HandleLogin.java +++ b/src/main/java/ParaScript/strategies/HandleLogin.java @@ -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"); + // } } } diff --git a/src/main/java/ParaScript/strategies/LoadCannon.java b/src/main/java/ParaScript/strategies/LoadCannon.java new file mode 100644 index 0000000..64be5fc --- /dev/null +++ b/src/main/java/ParaScript/strategies/LoadCannon.java @@ -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; + } +} diff --git a/src/main/java/ParaScript/strategies/Mine.java b/src/main/java/ParaScript/strategies/Mine.java index 8759ad9..588bf08 100644 --- a/src/main/java/ParaScript/strategies/Mine.java +++ b/src/main/java/ParaScript/strategies/Mine.java @@ -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,25 +29,30 @@ 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; } -} +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/PickupClues.java b/src/main/java/ParaScript/strategies/PickupClues.java new file mode 100644 index 0000000..998257f --- /dev/null +++ b/src/main/java/ParaScript/strategies/PickupClues.java @@ -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 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 getItems(){ + ArrayList groundItems = new ArrayList(); + for (GroundItem item : GroundItems.getNearest(2677, 2678, 2679)){ + if (item.distanceTo() < 12) + groundItems.add(item); + } + return groundItems; + } +} diff --git a/src/main/java/ParaScript/strategies/PickupItems.java b/src/main/java/ParaScript/strategies/PickupItems.java index a6f4e2c..296f295 100644 --- a/src/main/java/ParaScript/strategies/PickupItems.java +++ b/src/main/java/ParaScript/strategies/PickupItems.java @@ -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 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 getItems(){ + ArrayList groundItems = new ArrayList(); + 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; diff --git a/src/main/java/ParaScript/strategies/Smelt.java b/src/main/java/ParaScript/strategies/Smelt.java new file mode 100644 index 0000000..9678c7e --- /dev/null +++ b/src/main/java/ParaScript/strategies/Smelt.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/Thieving.java b/src/main/java/ParaScript/strategies/Thieving.java index 9978152..f1642f5 100644 --- a/src/main/java/ParaScript/strategies/Thieving.java +++ b/src/main/java/ParaScript/strategies/Thieving.java @@ -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; diff --git a/src/main/java/ParaScript/strategies/UpdateBank.java b/src/main/java/ParaScript/strategies/UpdateBank.java new file mode 100644 index 0000000..23f87e9 --- /dev/null +++ b/src/main/java/ParaScript/strategies/UpdateBank.java @@ -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"); + } + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/UpdateExperience.java b/src/main/java/ParaScript/strategies/UpdateExperience.java index 6b97f9e..9d04135 100644 --- a/src/main/java/ParaScript/strategies/UpdateExperience.java +++ b/src/main/java/ParaScript/strategies/UpdateExperience.java @@ -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; diff --git a/src/main/java/ParaScript/strategies/WoodcutTree.java b/src/main/java/ParaScript/strategies/WoodcutTree.java index 5956484..37e2d45 100644 --- a/src/main/java/ParaScript/strategies/WoodcutTree.java +++ b/src/main/java/ParaScript/strategies/WoodcutTree.java @@ -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; diff --git a/src/main/java/ParaScript/ui/UI.java b/src/main/java/ParaScript/ui/UI.java index 5da4693..c6fa147 100644 --- a/src/main/java/ParaScript/ui/UI.java +++ b/src/main/java/ParaScript/ui/UI.java @@ -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);