From 41a3d3729073f3e74e87092b5838f5c53e351bcf Mon Sep 17 00:00:00 2001 From: Danial Date: Thu, 7 Oct 2021 12:16:38 +1300 Subject: [PATCH] initial working stuff --- src/main/java/ParaScript/DesktopTray.java | 41 +++ src/main/java/ParaScript/Main.java | 33 ++- src/main/java/ParaScript/data/Variables.java | 36 ++- .../java/ParaScript/data/variables/Bars.java | 47 ++++ .../data/variables/FishingSpots.java | 58 +++++ .../java/ParaScript/data/variables/Rocks.java | 65 +++++ src/main/java/ParaScript/icon.png | Bin 0 -> 11933 bytes .../java/ParaScript/strategies/BuryBones.java | 18 +- src/main/java/ParaScript/strategies/Eat.java | 41 +++ .../java/ParaScript/strategies/Fighting.java | 27 +- .../strategies/FightingReturnToCoords.java | 41 +++ .../ParaScript/strategies/LoadCannon.java | 51 ++++ .../ParaScript/strategies/PickupClues.java | 59 +++++ .../ParaScript/strategies/PickupItems.java | 28 ++- .../ParaScript/strategies/ScriptState.java | 4 + .../java/ParaScript/strategies/Thieving.java | 2 + .../ParaScript/strategies/UpdateBank.java | 77 ++++++ src/main/java/ParaScript/ui/UI.java | 234 +++++++++++++----- 18 files changed, 753 insertions(+), 109 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/Eat.java create mode 100644 src/main/java/ParaScript/strategies/FightingReturnToCoords.java 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/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..5c8c582 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,8 +35,12 @@ public class Main extends Script implements MessageListener, Paintable { Variables.setBaseExp(); + 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 WoodcutTree()); @@ -55,8 +56,12 @@ public class Main extends Script implements MessageListener, Paintable { 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()); } if(Variables.skill_to_train == Skill.FISHING) { @@ -77,8 +82,9 @@ public class Main extends Script implements MessageListener, Paintable { @Override public void onFinish() { + Variables.desktopTray.removeTray(); ui.dispose(); - System.out.println("Script Stopped"); + System.out.println("2006 AIO Script Stopped"); } @Override @@ -104,25 +110,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..622ceca 100644 --- a/src/main/java/ParaScript/data/Variables.java +++ b/src/main/java/ParaScript/data/Variables.java @@ -1,49 +1,62 @@ package ParaScript.data; +import ParaScript.DesktopTray; 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 Rocks mining_rock_selected = Rocks.ESSENCE; public static String mining_method = "Bank"; + // Smithing + public static Bars smithing_bar_selected = Bars.BRONZE; + public static String smithing_method = "Bank"; + // 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"; // Fishing - public static Npcs.Option fishing_type_selected = Npcs.Option.NET; + public static FishingSpots fishing_spot_selected = FishingSpots.NET; + + // 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 +72,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 +174,11 @@ 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(); + return mining_rock_selected.getItemID(); + case "Attack": + return fighting_item_ids; default: return new int[]{-1}; } @@ -177,6 +191,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; } 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..c316da4 --- /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/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$+_ zvw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Z&bLcYx==w;%skQ?s+Jf_Vim8KW~ixIQB3=jb~hs2}&u@1g^)E^#^FHWv7{pR6LJ z)I4IQXx^4OM-Fj5#yfDUy6urweEHW}?0x-s&GWcPH-C>4XJn`D;@Z*Gc3B}jD(#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 0 + && Players.getMyPlayer().isInCombat() + && 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 || !Players.getMyPlayer().isInCombat(), 8000); + 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..3b2e68a --- /dev/null +++ b/src/main/java/ParaScript/strategies/FightingReturnToCoords.java @@ -0,0 +1,41 @@ +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.Players; +import org.rev317.min.api.wrappers.Player; +import org.rev317.min.api.wrappers.Tile; +import org.rev317.min.api.wrappers.TilePath; + +import javax.swing.plaf.synth.SynthTextAreaUI; + +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/LoadCannon.java b/src/main/java/ParaScript/strategies/LoadCannon.java new file mode 100644 index 0000000..c078cf6 --- /dev/null +++ b/src/main/java/ParaScript/strategies/LoadCannon.java @@ -0,0 +1,51 @@ +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.Item; +import org.rev317.min.api.wrappers.SceneObject; + +import java.util.Date; + +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 + && 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; + } +} diff --git a/src/main/java/ParaScript/strategies/PickupClues.java b/src/main/java/ParaScript/strategies/PickupClues.java new file mode 100644 index 0000000..3f82750 --- /dev/null +++ b/src/main/java/ParaScript/strategies/PickupClues.java @@ -0,0 +1,59 @@ +package ParaScript.strategies; + +import ParaScript.Methods; +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.methods.Players; +import org.rev317.min.api.methods.Skill; +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); + 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..e53b2ce 100644 --- a/src/main/java/ParaScript/strategies/PickupItems.java +++ b/src/main/java/ParaScript/strategies/PickupItems.java @@ -6,17 +6,22 @@ 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.Item; +import org.rev317.min.api.wrappers.Player; +import org.rev317.min.api.wrappers.Tile; + +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 +32,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 +46,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/ScriptState.java b/src/main/java/ParaScript/strategies/ScriptState.java index e2ab555..bb18b60 100644 --- a/src/main/java/ParaScript/strategies/ScriptState.java +++ b/src/main/java/ParaScript/strategies/ScriptState.java @@ -3,6 +3,10 @@ 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.Players; +import org.rev317.min.api.methods.SceneObjects; +import org.rev317.min.api.wrappers.SceneObject; public class ScriptState implements Strategy { 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/ui/UI.java b/src/main/java/ParaScript/ui/UI.java index 5da4693..278242f 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,16 +30,23 @@ 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(); @@ -56,6 +62,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 +132,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 +177,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(); } } } @@ -238,22 +248,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"); @@ -272,6 +283,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 mine + 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 +324,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 +350,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 +367,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 +377,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 +409,40 @@ public class UI extends JFrame { }); fightingPanel.add(fightingBuryBones); + // Should we hold a position (aggressive npcs) 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 +466,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 +482,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 */ @@ -480,23 +610,18 @@ 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; } } } @@ -524,7 +649,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 +661,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 +669,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);