From 8c989607ac4a719c84cfaba4821bf7b0f4bc2c7d Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:47:57 -0500 Subject: [PATCH 01/17] fix: use ItemName to click widget & close bank interface if open --- .../client/plugins/microbot/smelting/AutoSmeltingScript.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/smelting/AutoSmeltingScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/smelting/AutoSmeltingScript.java index 4a13e4dc07..4190c684fe 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/smelting/AutoSmeltingScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/smelting/AutoSmeltingScript.java @@ -62,6 +62,8 @@ public boolean run(AutoSmeltingConfig config) { // walk to the initial position (near furnace) if (initialPlayerLocation.distanceTo(Rs2Player.getWorldLocation()) > 4) { + if (Rs2Bank.isOpen()) + Rs2Bank.closeBank(); Rs2Walker.walkTo(initialPlayerLocation, 4); return; } @@ -73,7 +75,7 @@ public boolean run(AutoSmeltingConfig config) { Rs2GameObject.interact(furnace, "smelt"); sleepUntilOnClientThread(() -> Rs2Widget.getWidget(17694733) != null); if (Rs2Widget.getWidget(17694733) != null) { - Rs2Widget.clickWidget(17694734 + config.SELECTED_BAR_TYPE().ordinal()); + Rs2Widget.clickWidget(config.SELECTED_BAR_TYPE().getName()); Rs2Player.waitForAnimation(); expectingXPDrop = true; } From 8e1c13682f2643cebff1ca915f125d7bd659da92 Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:08:21 -0500 Subject: [PATCH 02/17] fix: use item list to bank if looting by ItemList chore: change Random to Rs2Random fix: change to hopWhenPlayerDetected --- .../microbot/looter/AutoLooterPlugin.java | 29 ++++++++++--------- .../looter/scripts/DefaultScript.java | 11 +++++-- .../microbot/looter/scripts/FlaxScript.java | 10 ++----- .../looter/scripts/NatureRuneChestScript.java | 4 +-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/AutoLooterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/AutoLooterPlugin.java index ba14349c60..6cfb73dd3e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/AutoLooterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/AutoLooterPlugin.java @@ -47,27 +47,28 @@ AutoLooterConfig provideConfig(ConfigManager configManager) { @Override protected void startUp() throws AWTException { - - if(config.looterActivity() == LooterActivity.DEFAULT){ - defaultScript.run(config); - } else if (config.looterActivity() == LooterActivity.FLAX) { - flaxScript.run(config); - } else if (config.looterActivity() == LooterActivity.NATURE_RUNE_CHEST) { - natureRuneChestScript.run(config); + + switch (config.looterActivity()) { + case DEFAULT: + defaultScript.run(config); + break; + case FLAX: + flaxScript.run(config); + break; + case NATURE_RUNE_CHEST: + natureRuneChestScript.run(config); + break; } + if(overlayManager != null){ overlayManager.add(autoLooterOverlay); } } protected void shutDown() throws Exception { - if(config.looterActivity() == LooterActivity.DEFAULT){ - defaultScript.shutdown(); - } else if (config.looterActivity() == LooterActivity.FLAX) { - flaxScript.shutdown(); - } else if (config.looterActivity() == LooterActivity.NATURE_RUNE_CHEST) { - natureRuneChestScript.shutdown(); - } + defaultScript.shutdown(); + flaxScript.shutdown(); + natureRuneChestScript.shutdown(); overlayManager.remove(autoLooterOverlay); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java index d66c582bff..9f48184424 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java @@ -16,6 +16,7 @@ import net.runelite.client.plugins.microbot.util.inventory.Rs2Item; import net.runelite.client.plugins.microbot.util.player.Rs2Player; +import java.util.Arrays; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -79,8 +80,13 @@ public boolean run(AutoLooterConfig config) { } break; case BANKING: - if (!Rs2Bank.bankItemsAndWalkBackToOriginalPosition(Rs2Inventory.all().stream().map(Rs2Item::getName).collect(Collectors.toList()), initialPlayerLocation, config.minFreeSlots())) - return; + if (config.looterStyle() == DefaultLooterStyle.ITEM_LIST) { + if (!Rs2Bank.bankItemsAndWalkBackToOriginalPosition(Arrays.stream(config.listOfItemsToLoot().split(",")).collect(Collectors.toList()), initialPlayerLocation, config.minFreeSlots())) + return; + } else { + if (!Rs2Bank.bankItemsAndWalkBackToOriginalPosition(Rs2Inventory.all().stream().map(Rs2Item::getName).collect(Collectors.toList()), initialPlayerLocation, config.minFreeSlots())) + return; + } state = LooterState.LOOTING; break; } @@ -115,7 +121,6 @@ private void applyAntiBanSettings() { Rs2AntibanSettings.dynamicIntensity = true; Rs2AntibanSettings.devDebug = false; Rs2AntibanSettings.moveMouseRandomly = true; - Rs2AntibanSettings.takeMicroBreaks = true; Rs2AntibanSettings.microBreakDurationLow = 3; Rs2AntibanSettings.microBreakDurationHigh = 15; Rs2AntibanSettings.actionCooldownChance = 0.4; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java index f788b1579c..0d65d4164f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java @@ -28,9 +28,6 @@ public boolean run(AutoLooterConfig config) { Microbot.enableAutoRunOn = false; initialPlayerLocation = null; - if (config.hopWhenPlayerDetected()) { - Microbot.showMessage("Make sure autologin plugin is enabled and randomWorld checkbox is checked!"); - } Rs2Antiban.resetAntibanSettings(); applyAntiBanSettings(); Rs2Antiban.setActivity(Activity.GENERAL_COLLECTING); @@ -57,10 +54,8 @@ public boolean run(AutoLooterConfig config) { state = LooterState.BANKING; return; } - if (config.hopWhenPlayerDetected()) { - Rs2Player.logoutIfPlayerDetected(1, 10); - return; - } + if (config.hopWhenPlayerDetected() && Rs2Player.hopIfPlayerDetected(1, 10, 10)) return; + GameObject flaxObject = Rs2GameObject.findObject("flax", false, config.distanceToStray(), true, initialPlayerLocation); if (flaxObject != null) { if(Rs2GameObject.interact(flaxObject, "pick")){ @@ -132,7 +127,6 @@ private void applyAntiBanSettings() { Rs2AntibanSettings.dynamicIntensity = true; Rs2AntibanSettings.devDebug = false; Rs2AntibanSettings.moveMouseRandomly = true; - Rs2AntibanSettings.takeMicroBreaks = true; Rs2AntibanSettings.microBreakDurationLow = 3; Rs2AntibanSettings.microBreakDurationHigh = 15; Rs2AntibanSettings.actionCooldownChance = 0.4; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java index 69e366ae24..ec3cfb7d0b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java @@ -10,6 +10,7 @@ import net.runelite.client.plugins.microbot.util.antiban.enums.Activity; import net.runelite.client.plugins.microbot.util.gameobject.Rs2GameObject; import net.runelite.client.plugins.microbot.util.math.Random; +import net.runelite.client.plugins.microbot.util.math.Rs2Random; import net.runelite.client.plugins.microbot.util.player.Rs2Player; import net.runelite.client.plugins.microbot.util.walker.Rs2Walker; @@ -62,7 +63,7 @@ public boolean run(AutoLooterConfig config) { Rs2Antiban.actionCooldown(); Rs2Antiban.takeMicroBreakByChance(); sleepUntilTrue(() -> !Rs2Player.isInteracting(), 500, 8000); - sleep(Random.random(18000, 20000)); + sleep(Rs2Random.between(18000, 20000)); } } break; @@ -118,7 +119,6 @@ private void applyAntiBanSettings() { Rs2AntibanSettings.dynamicIntensity = true; Rs2AntibanSettings.devDebug = false; Rs2AntibanSettings.moveMouseRandomly = true; - Rs2AntibanSettings.takeMicroBreaks = true; Rs2AntibanSettings.microBreakDurationLow = 3; Rs2AntibanSettings.microBreakDurationHigh = 15; Rs2AntibanSettings.actionCooldownChance = 0.4; From 27813a3938e7690cfff824af98225c8855732433 Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:09:09 -0500 Subject: [PATCH 03/17] fix: gmaul spec energy to 600 --- .../plugins/microbot/util/misc/SpecialAttackWeaponEnum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/misc/SpecialAttackWeaponEnum.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/misc/SpecialAttackWeaponEnum.java index 2704748a87..8225f5acc8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/misc/SpecialAttackWeaponEnum.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/misc/SpecialAttackWeaponEnum.java @@ -36,7 +36,7 @@ public enum SpecialAttackWeaponEnum { ABYSSAL_BLUDGEON("abyssal bludgeon", 500, true), BARRELCHEST_ANCHOR("barrelchest anchor", 500, true), GRANITE_HAMMER("granite hammer", 600, false), - GRANITE_MAUL("granite maul", 500, true), + GRANITE_MAUL("granite maul", 600, true), RUNE_CLAWS("rune claws", 250, true), EXCALIBUR("excalibur", 1000, false), DARKLIGHT("darklight", 500, false), From 42986c67f625de8f065f43a812a6b2cd2c2a5ae3 Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:11:41 -0500 Subject: [PATCH 04/17] fix: remove microbreaks --- .../client/plugins/microbot/looter/scripts/DefaultScript.java | 1 - .../client/plugins/microbot/looter/scripts/FlaxScript.java | 1 - .../plugins/microbot/looter/scripts/NatureRuneChestScript.java | 1 - 3 files changed, 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java index 9f48184424..820c67420e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/DefaultScript.java @@ -71,7 +71,6 @@ public boolean run(AutoLooterConfig config) { if (Rs2GroundItem.lootItemBasedOnValue(valueParams)) { Microbot.pauseAllScripts = false; Rs2Antiban.actionCooldown(); - Rs2Antiban.takeMicroBreakByChance(); } } if (Rs2Inventory.getEmptySlots() <= config.minFreeSlots()) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java index 0d65d4164f..edde1f40c8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/FlaxScript.java @@ -60,7 +60,6 @@ public boolean run(AutoLooterConfig config) { if (flaxObject != null) { if(Rs2GameObject.interact(flaxObject, "pick")){ Rs2Antiban.actionCooldown(); - Rs2Antiban.takeMicroBreakByChance(); } } break; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java index ec3cfb7d0b..a734e6ced0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/looter/scripts/NatureRuneChestScript.java @@ -61,7 +61,6 @@ public boolean run(AutoLooterConfig config) { if (natureRuneChest.isPresent()) { if(Rs2GameObject.interact(natureRuneChest.get(), "Search for traps")){ Rs2Antiban.actionCooldown(); - Rs2Antiban.takeMicroBreakByChance(); sleepUntilTrue(() -> !Rs2Player.isInteracting(), 500, 8000); sleep(Rs2Random.between(18000, 20000)); } From 667e1381a94ad16b04c4306a14df39d7240f9b42 Mon Sep 17 00:00:00 2001 From: lhndl93 <61633800+lhndl93@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:42:46 +0000 Subject: [PATCH 05/17] Switched the IDS again, they like going back and forward and changing them --- .../zerozero/birdhunter/BirdHunterScript.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java index 2bd6d60385..d56acb2e76 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java @@ -25,24 +25,24 @@ public class BirdHunterScript extends Script { - private static final int SUCCESSFUL_TRAP_1 = 9348; - private static final int SUCCESSFUL_TRAP_2 = 9376; - private static final int SUCCESSFUL_TRAP_3 = 9378; - private static final int SUCCESSFUL_TRAP_4 = 9374; - private static final int SUCCESSFUL_TRAP_5 = 9373; - - private static final int CATCHING_TRAP_1 = 9349; - private static final int CATCHING_TRAP_2 = 9347; - private static final int CATCHING_TRAP_3 = 9377; - private static final int CATCHING_TRAP_4 = 9379; - private static final int CATCHING_TRAP_5 = 9375; + private static final int CATCHING_TRAP_1 = 9348; + private static final int CATCHING_TRAP_2 = 9376; + private static final int CATCHING_TRAP_3 = 9378; + private static final int CATCHING_TRAP_4 = 9374; + private static final int CATCHING_TRAP_5 = 9373; + + private static final int SUCCESSFUL_TRAP_1 = 9349; + private static final int SUCCESSFUL_TRAP_2 = 9347; + private static final int SUCCESSFUL_TRAP_3 = 9377; + private static final int SUCCESSFUL_TRAP_4 = 9379; + private static final int SUCCESSFUL_TRAP_5 = 9375; private static final int BIRD_SNARE = 10006; private static final int FAILED_TRAP = 9344; private static final int IDLE_TRAP = 9345; - public static String version = "1.0.0"; + public static String version = "1.0.1"; private WorldArea dynamicHuntingArea; private WorldPoint huntingCenter; @@ -51,7 +51,7 @@ public boolean run(BirdHunterConfig config) { if (!hasRequiredSnares()) { Microbot.log("Not enough bird snares in inventory. Stopping the script."); - return false; // Stop the script if there aren't enough snares + return false; } huntingCenter = Rs2Player.getWorldLocation(); updateHuntingArea(config); From 8773a2519197dab1beceb63db040660b35f4baa0 Mon Sep 17 00:00:00 2001 From: Superfluxus <38507824+Superfluxus@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:17:11 +0000 Subject: [PATCH 06/17] Update GildedAltarPlugin.java --- .../microbot/prayer/GildedAltarPlugin.java | 200 +++++++++++++----- 1 file changed, 151 insertions(+), 49 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarPlugin.java index 4d6b1f4140..7799205b66 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarPlugin.java @@ -1,20 +1,16 @@ package net.runelite.client.plugins.microbot.prayer; -import java.awt.AWTException; +import java.awt.*; import java.util.Arrays; -import java.util.stream.Collectors; - +import java.util.Objects; import javax.inject.Inject; - import com.google.inject.Provides; - import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ObjectID; -import net.runelite.api.TileObject; +import net.runelite.api.*; +import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; import net.runelite.api.widgets.Widget; import net.runelite.client.config.ConfigManager; @@ -27,9 +23,11 @@ import net.runelite.client.plugins.microbot.util.keyboard.Rs2Keyboard; import net.runelite.client.plugins.microbot.util.math.Random; import net.runelite.client.plugins.microbot.util.npc.Rs2Npc; +import net.runelite.client.plugins.microbot.util.player.Rs2Player; import net.runelite.client.plugins.microbot.util.tabs.Rs2Tab; import net.runelite.client.plugins.microbot.util.widget.Rs2Widget; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.api.ChatMessageType; @PluginDescriptor( name = PluginDescriptor.Mocrosoft + "Gilded Altar", @@ -41,6 +39,7 @@ public class GildedAltarPlugin extends Plugin { @Inject private GildedAltarConfig config; + @Provides GildedAltarConfig provideConfig(ConfigManager configManager) { return configManager.getConfig(GildedAltarConfig.class); @@ -57,6 +56,16 @@ GildedAltarConfig provideConfig(ConfigManager configManager) { @Setter int skipTicks; private final int HOUSE_PORTAL_OBJECT = 4525; + private Widget toggleArrow; + boolean listen = false; + Widget targetWidget; + String houseOwner; + private TileObject cachedAltar = null; // Cache for the altar object + private WorldPoint portalCoords; + private WorldPoint altarCoords; + private Boolean usePortal; + private boolean visitedOnce; + GildedAltarPlayerState state = GildedAltarPlayerState.IDLE; @@ -78,30 +87,27 @@ protected void startUp() throws AWTException { overlayManager.add(gildedAltarOverlay); } } + /** - * * @param name plugin name * @return the plguin */ public static Plugin findPlugin(String name) { return Microbot.getPluginManager().getPlugins().stream().filter(x -> x.getName().equals(name)).findFirst().orElse(null); } + @Override protected void shutDown() { overlayManager.remove(gildedAltarOverlay); } @Subscribe - public void onGameTick(GameTick gameTick) - { + public void onGameTick(GameTick gameTick) { if (client.getGameState() != GameState.LOGGED_IN) return; - if (skipTicks > 0) - { - if (Random.random(1, 7) != 2) { - skipTicks--; - } + if (skipTicks > 0) { + skipTicks--; return; } @@ -141,22 +147,32 @@ public void onGameTick(GameTick gameTick) } private void calculateState() { - if (hasUnNotedBones() && !inHouse()) { - state = GildedAltarPlayerState.ENTER_HOUSE; - } else if (hasUnNotedBones() && inHouse()) { - state = GildedAltarPlayerState.BONES_ON_ALTAR; - } else if (!hasUnNotedBones() && !inHouse()) { - state = GildedAltarPlayerState.UNNOTE_BONES; - } else if (!hasUnNotedBones() && inHouse()) { - state = GildedAltarPlayerState.LEAVE_HOUSE; + boolean inHouse = inHouse(); + boolean hasUnNotedBones = hasUnNotedBones(); + + // If we have unNoted bones: + // If we're in the house, use bones on altar. Else, enter the portal + // If we don't have unNoted bones: + // If we're in the house, leave house. Else, talk to Phials + if (hasUnNotedBones) { + state = inHouse ? GildedAltarPlayerState.BONES_ON_ALTAR : GildedAltarPlayerState.ENTER_HOUSE; + } else { + state = inHouse ? GildedAltarPlayerState.LEAVE_HOUSE : GildedAltarPlayerState.UNNOTE_BONES; } } public void leaveHouse() { System.out.println("Attempting to leave house..."); - - if (Rs2GameObject.findObjectById(HOUSE_PORTAL_OBJECT) == null) { - System.out.println("Not in house, HOUSE_PORTAL_OBJECT not found."); + + // We should only rely on using the settings menu if the portal is several rooms away from the portal. Bringing up 3 different interfaces when we can see the portal on screen is unnecessary. + if(usePortal) { + TileObject portalObject = Rs2GameObject.findObjectById(HOUSE_PORTAL_OBJECT); + if (portalObject == null) { + System.out.println("Not in house, HOUSE_PORTAL_OBJECT not found."); + return; + } + Rs2GameObject.interact(portalObject); + setSkipTicks(5); return; } @@ -164,9 +180,14 @@ public void leaveHouse() { Rs2Tab.switchToSettingsTab(); setSkipTicks(2); + //If the house options button is not visible, player is on Display or Sound settings, need to click Controls. + if(!(Rs2Widget.isWidgetVisible(7602207))){ + Rs2Widget.clickWidget(7602243); + setSkipTicks(1); + } + // Click House Options if (Rs2Widget.clickWidget(7602207)) { - System.out.println("Clicked House Options button"); setSkipTicks(2); } else { System.out.println("House Options button not found."); @@ -175,8 +196,8 @@ public void leaveHouse() { // Click Leave House if (Rs2Widget.clickWidget(24248341)) { - System.out.println("Clicked Leave House button"); - setSkipTicks(4); + listen = true; + setSkipTicks(5); } else { System.out.println("Leave House button not found."); } @@ -197,35 +218,116 @@ public void unnoteBones() { } private void enterHouse() { - boolean isAdvertisementWidgetOpen = Rs2Widget.hasWidget("House advertisement"); + // If we've already visited a house this session, use 'Visit-Last' on advertisement board + if (visitedOnce) { + Rs2GameObject.interact(ObjectID.HOUSE_ADVERTISEMENT, "Visit-Last"); + setSkipTicks(4); + listen = false; + return; + } + + boolean isAdvertisementWidgetOpen = Rs2Widget.isWidgetVisible(3407875); if (!isAdvertisementWidgetOpen) { Rs2GameObject.interact(ObjectID.HOUSE_ADVERTISEMENT, "View"); setSkipTicks(2); - return; } - Widget container = Rs2Widget.getWidget(52, 9); - if (container == null || container.getChildren() == null) return; + Widget containerNames = Rs2Widget.getWidget(52, 9); + Widget containerEnter = Rs2Widget.getWidget(52, 19); + if (containerNames == null || containerNames.getChildren() == null) return; - for (String player : config.housePlayerName().split(",")) { - Widget playerHouse = Rs2Widget.findWidget(player, Arrays.stream(container.getChildren()).collect(Collectors.toList())); - if (playerHouse != null) { - Rs2Widget.clickChildWidget(3407891, playerHouse.getIndex()); - setSkipTicks(2); - return; - } + //Sort house advertisements by Gilded Altar availability + toggleArrow = Rs2Widget.getWidget(3407877); + if (toggleArrow.getSpriteId() == 1050) { + Rs2Widget.clickWidget(3407877); + setSkipTicks(1); } + + // Get all names on house board and find the one with the smallest Y value + if (containerNames.getChildren() != null) { + int smallestOriginalY = Integer.MAX_VALUE; // Track the smallest OriginalY + + Widget[] children = containerNames.getChildren(); + + for (int i = 0; i < children.length; i++) { + Widget child = children[i]; + if (child.getText() == null || child.getText().isEmpty()|| child.getText() == ""){ + continue; + } + if (child.getText() != null) { + if (child.getOriginalY() < smallestOriginalY) { + houseOwner = child.getText(); + smallestOriginalY = child.getOriginalY(); + } + } + } + + // Use playername at top of advertisement board as search criteria and find their Enter button + Widget[] children2 = containerEnter.getChildren(); + for (int i = 0; i < children2.length; i++) { + Widget child = children2[i]; + if (child == null || child.getOnOpListener() == null) { + continue; + } + Object[] listenerArray = child.getOnOpListener(); + boolean containsHouseOwner = Arrays.stream(listenerArray) + .filter(Objects::nonNull) // Ensure no null elements + .anyMatch(obj -> obj.toString().contains(houseOwner)); // Check if houseOwner is part of any listener object + if (containsHouseOwner) { + targetWidget = child; + break; + } + } + setSkipTicks(1); + Rs2Widget.clickChildWidget(3407891, targetWidget.getIndex()); + visitedOnce = true; + listen = false; + setSkipTicks(5); + } } public void bonesOnAltar() { - TileObject altar = Rs2GameObject.findObjectById(ObjectID.ALTAR_40878); - if (altar == null) { - altar = Rs2GameObject.findObjectById(ObjectID.ALTAR_13197); + // If we haven't cached the altar yet or it's no longer valid, find it + if (cachedAltar == null) { + cachedAltar = Rs2GameObject.findObjectById(ObjectID.ALTAR_40878); + if (cachedAltar == null) { + cachedAltar = Rs2GameObject.findObjectById(ObjectID.ALTAR_13197); + } } - if (altar != null) { - Rs2Inventory.useUnNotedItemOnObject("bones", altar); - setSkipTicks(1); + if(portalCoords == null){ + portalCoords = Rs2Player.getWorldLocation(); } - } + + // Use bones on the altar if it's valid + if (cachedAltar != null) { + Rs2Inventory.useUnNotedItemOnObject("bones", cachedAltar); + } + if(altarCoords == null){ + altarCoords = Rs2Player.getWorldLocation(); + } + // If portal is more than 10 tiles from altar, use settings menu to leave. Else, just walk back to portal. + if(usePortal == null){ + usePortal = altarCoords.distanceTo(portalCoords) <= 10; + } + } + + @Subscribe + public void onChatMessage(ChatMessage chatMessage) { + if(!listen){ + return; + } + if(chatMessage.getType() == ChatMessageType.PUBLICCHAT){ + return; + } + String chatMsg = chatMessage.getMessage().toLowerCase(); + if(chatMsg.contains("that player is offline")||chatMsg.contains("haven't visited anyone this session")){ + // If we try to use Visit-Last unsuccessfully, these chat messages will appear, and we need to reset vars. + visitedOnce= false; + cachedAltar= null; + usePortal = null; + altarCoords = null; + portalCoords = null; + } +} } From 8cd21e8431f1bc2ae71e63576d9791bf49559f2e Mon Sep 17 00:00:00 2001 From: Superfluxus <38507824+Superfluxus@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:17:27 +0000 Subject: [PATCH 07/17] Update GildedAltarConfig.java --- .../microbot/prayer/GildedAltarConfig.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarConfig.java index 29e37314f9..47ec2ccda9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/prayer/GildedAltarConfig.java @@ -6,25 +6,14 @@ @ConfigGroup("GildedAltar") public interface GildedAltarConfig extends Config { + @ConfigItem( keyName = "Guide", name = "How to use", description = "How to use the script", position = 0 ) - default String GUIDE() - { + default String GUIDE() { return "This only supports house advertisements. Use this script in w330"; } - - @ConfigItem( - keyName = "Player Name", - name = "Player Name Houses", - description = "Choose the player name's house comma seperated", - position = 1 - ) - default String housePlayerName() - { - return "xgrace,workless"; - } } From adfb0a400303cd85056fe5c2c32277b5e7be0814 Mon Sep 17 00:00:00 2001 From: lhndl93 <61633800+lhndl93@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:46:15 +0000 Subject: [PATCH 08/17] Added hunting areas for fast travel, helps with rumours --- .../shortestpath/ShortestPathPanel.java | 35 ++++++++++++ .../util/walker/enums/HuntingAreas.java | 57 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/enums/HuntingAreas.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java index 67b0b142d5..a2d781216a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java @@ -33,6 +33,7 @@ public class ShortestPathPanel extends PluginPanel { private JComboBox hopsComboBox; private JComboBox treesComboBox; private JComboBox compostBinsComboBox; + private JComboBox hunterCreatureComboBox; @Inject private ShortestPathPanel(ShortestPathPlugin plugin) { @@ -49,6 +50,8 @@ private ShortestPathPanel(ShortestPathPlugin plugin) { add(createSlayerMasterPanel()); add(Box.createRigidArea(new Dimension(0, 10))); add(createFarmingPanel()); + add(Box.createRigidArea(new Dimension(0, 10))); + add(createHunterCreaturePanel()); } private Border createCenteredTitledBorder(String title, String iconPath) { @@ -260,6 +263,34 @@ private JPanel createFarmingPanel() { return panel; } + private JPanel createHunterCreaturePanel() { + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.setBorder(createCenteredTitledBorder("Travel to Hunter Creature", "/net/runelite/client/plugins/microbot/shortestpath/Map_link_icon.png")); + + hunterCreatureComboBox = new JComboBox<>(HuntingAreas.values()); + hunterCreatureComboBox.setRenderer(new ComboBoxListRenderer()); + hunterCreatureComboBox.setAlignmentX(Component.CENTER_ALIGNMENT); + hunterCreatureComboBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, hunterCreatureComboBox.getPreferredSize().height)); + ((JLabel) hunterCreatureComboBox.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER); + + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + JButton startButton = new JButton("Start"); + JButton stopButton = new JButton("Stop"); + + startButton.addActionListener(e -> startWalking(getSelectedHunterCreature().getWorldPoint())); + stopButton.addActionListener(e -> stopWalking()); + + buttonPanel.add(startButton); + buttonPanel.add(stopButton); + + panel.add(hunterCreatureComboBox); + panel.add(Box.createRigidArea(new Dimension(0, 5))); + panel.add(buttonPanel); + + return panel; + } + public WorldPoint getCustomLocation() { try { int x = Integer.parseInt(xField.getText()); @@ -326,6 +357,10 @@ public String getSelectedFarmingLocationName() { return "Unknown"; } } + + public HuntingAreas getSelectedHunterCreature() { + return (HuntingAreas) hunterCreatureComboBox.getSelectedItem(); + } private void startWalking(WorldPoint point) { Microbot.log("Web walking starting. Traveling to Custom Location (" + point.getX() + ", " + point.getY() + ", " + point.getPlane() + ")."); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/enums/HuntingAreas.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/enums/HuntingAreas.java new file mode 100644 index 0000000000..c526441907 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/enums/HuntingAreas.java @@ -0,0 +1,57 @@ +package net.runelite.client.plugins.microbot.util.walker.enums; + +import lombok.Getter; +import net.runelite.api.coords.WorldPoint; + +@Getter +public enum HuntingAreas { + HUNTER_GUILD("Hunter Guild", new WorldPoint(1555, 3420, 0)), + BARB_TAILED_KEBBIT("Barb-tailed Kebbit (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)), + BLACK_CHINCHOMPA("Black Chinchompa (Wilderness)", new WorldPoint(3142, 3771, 0)), + BLACK_SALAMANDER("Black Salamander (Boneyard Hunter Area)", new WorldPoint(3294, 3673, 0)), + BLACK_WARLOCK("Black Warlock (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)), + CARNIVOROUS_CHINCHOMPA("Carnivorous Chinchompa (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)), + CARNIVOROUS_CHINCHOMPA_2("Carnivorous Chinchompa (Gwenith Hunter Area Outside)", new WorldPoint(2269, 3408, 0)), + CARNIVOROUS_CHINCHOMPA_3("Carnivorous Chinchompa (Gwenith Hunter Area Inside)", new WorldPoint(3293, 6160, 0)), + CHINCHOMPA("Chinchompa (Isle of Souls North West)", new WorldPoint(2127, 2950, 0)), + CHINCHOMPA_2("Chinchompa (Piscatoris Hunter Area)", new WorldPoint(2335, 3584, 0)), + COPPER_LONGTAIL("Copper Longtail (Aldarin North)", new WorldPoint(1357, 2977, 0)), + COPPER_LONGTAIL_2("Copper Longtail (Isle of Souls North)", new WorldPoint(2207, 2964, 0)), + CRIMSON_SWIFT("Crimson Swift (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)), + CRIMSON_SWIFT_2("Crimson Swift (Isle of Souls South West)", new WorldPoint(2158, 2822, 0)), + DARK_KEBBIT("Dark Kebbit (Falconry)", new WorldPoint(2379, 3599, 0)), + DASHING_KEBBIT("Dashing Kebbit (Falconry)", new WorldPoint(2379, 3599, 0)), + EMBERTAILED_JERBOA("Embertailed Jerboa (Hunter Guild West)", new WorldPoint(1515, 3047, 0)), + FELDIP_WEASEL("Feldip Weasel (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)), + FISH_SHOAL("Fish Shoal (Fossil Island Underwater)", new WorldPoint(3743, 10295, 0)), + HERBIBOAR("Herbiboar (Fossil Island 1)", new WorldPoint(3693, 3800, 0)), + HORNED_GRAAHK("Horned Graahk (Karamja)", new WorldPoint(2786, 3001, 0)), + MOONLIGHT_ANTELOPE("Moonlight Antelope (Hunter Guild Caverns)", new WorldPoint(1559, 9420, 0)), + ORANGE_SALAMANDER("Orange Salamander (Necropolis)", new WorldPoint(3285, 2739, 0)), + ORANGE_SALAMANDER_2("Orange Salamander (Uzer Hunter Area)", new WorldPoint(3401, 3104, 0)), + PYRE_FOX("Pyre Fox (Avium Savannah)", new WorldPoint(1616, 2999, 0)), + RED_SALAMANDER("Red Salamander (Ourania Hunter Area East)", new WorldPoint(2447, 3219, 0)), + RED_SALAMANDER_2("Red Salamander (Ourania Hunter Area South)", new WorldPoint(2475, 3240, 0)), + RUBY_HARVEST("Ruby Harvest (Aldarin West)", new WorldPoint(1342, 2934, 0)), + SANDWORMS("Sandworms (Port Piscarilius Beach)", new WorldPoint(1840, 3802, 0)), + SPINED_LARUPIA("Spined Larupia (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)), + SPOTTED_KEBBIT("Spotted Kebbit (Falconry)", new WorldPoint(2379, 3599, 0)), + SUNLIGHT_ANTELOPE("Sunlight Antelope (Avium Savannah East)", new WorldPoint(1745, 3008, 0)), + SUNLIGHT_MOTH("Sunlight Moth (Hunter Guild North)", new WorldPoint(1556, 3091, 0)), + SUNLIGHT_MOTH_2("Sunlight Moth (Hunter Guild Southeast)", new WorldPoint(1575, 3020, 0)), + TECU_SALAMANDER("Tecu Salamander (Ralos Rise)", new WorldPoint(1475, 3096, 0)), + TROPICAL_WAGTAIL("Tropical Wagtail (Feldip Hunter Area)", new WorldPoint(2557, 2912, 0)); + + private final String name; + private final WorldPoint worldPoint; + + HuntingAreas(String name, WorldPoint worldPoint) { + this.name = name; + this.worldPoint = worldPoint; + } + + @Override + public String toString() { + return name; + } +} From 44f21bd3a64e9e2592181206579928336f413aa4 Mon Sep 17 00:00:00 2001 From: lhndl93 <61633800+lhndl93@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:04:39 +0000 Subject: [PATCH 09/17] added icon --- .../microbot/shortestpath/ShortestPathPanel.java | 2 +- .../plugins/microbot/shortestpath/Hunter_icon.png | Bin 0 -> 204 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/Hunter_icon.png diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java index a2d781216a..d8ca0f5610 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPanel.java @@ -266,7 +266,7 @@ private JPanel createFarmingPanel() { private JPanel createHunterCreaturePanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); - panel.setBorder(createCenteredTitledBorder("Travel to Hunter Creature", "/net/runelite/client/plugins/microbot/shortestpath/Map_link_icon.png")); + panel.setBorder(createCenteredTitledBorder("Travel to Hunter Creature", "/net/runelite/client/plugins/microbot/shortestpath/Hunter_icon.png")); hunterCreatureComboBox = new JComboBox<>(HuntingAreas.values()); hunterCreatureComboBox.setRenderer(new ComboBoxListRenderer()); diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/Hunter_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/Hunter_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5a317c5221c1be1f1cce0d4073bac025d7dffa01 GIT binary patch literal 204 zcmeAS@N?(olHy`uVBq!ia0vp^{2t= zQVd}MRwg=1)4D4Jk~!Nzk|jZY!3+-1ZlnP@@t!V@Asp9zdoS`fDDbeJX1l~&!NOL+ za+pP;gi$f4DcO6q{I}PaPCpf#xN+JO9%e5dex1*ZKUkIvTzYoofk&p5Tjq2p3-{aC vIhWoKHR`KPVQdcjJo`9P Date: Tue, 26 Nov 2024 13:17:50 +0000 Subject: [PATCH 10/17] Changed to object/item ids --- .../zerozero/birdhunter/BirdHunterScript.java | 56 +++++++------------ 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java index d56acb2e76..61dcff2813 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/zerozero/birdhunter/BirdHunterScript.java @@ -1,6 +1,8 @@ package net.runelite.client.plugins.microbot.zerozero.birdhunter; import net.runelite.api.GameObject; +import net.runelite.api.ObjectID; +import net.runelite.api.ItemID; import net.runelite.api.Skill; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldArea; @@ -24,24 +26,6 @@ public class BirdHunterScript extends Script { - - private static final int CATCHING_TRAP_1 = 9348; - private static final int CATCHING_TRAP_2 = 9376; - private static final int CATCHING_TRAP_3 = 9378; - private static final int CATCHING_TRAP_4 = 9374; - private static final int CATCHING_TRAP_5 = 9373; - - private static final int SUCCESSFUL_TRAP_1 = 9349; - private static final int SUCCESSFUL_TRAP_2 = 9347; - private static final int SUCCESSFUL_TRAP_3 = 9377; - private static final int SUCCESSFUL_TRAP_4 = 9379; - private static final int SUCCESSFUL_TRAP_5 = 9375; - - private static final int BIRD_SNARE = 10006; - private static final int FAILED_TRAP = 9344; - private static final int IDLE_TRAP = 9345; - - public static String version = "1.0.1"; private WorldArea dynamicHuntingArea; private WorldPoint huntingCenter; @@ -85,7 +69,7 @@ private boolean hasRequiredSnares() { int hunterLevel = Rs2Player.getRealSkillLevel(Skill.HUNTER); int allowedSnares = getAvailableTraps(hunterLevel); // Calculate the allowed number of snares - int snaresInInventory = Rs2Inventory.count(BIRD_SNARE); + int snaresInInventory = Rs2Inventory.count(ItemID.BIRD_SNARE); Microbot.log("Allowed snares: " + allowedSnares + ", Snares in inventory: " + snaresInInventory); return snaresInInventory >= allowedSnares; // Return true if enough snares, false otherwise @@ -126,26 +110,26 @@ private void walkBackToArea() { private void handleTraps(BirdHunterConfig config) { List successfulTraps = new ArrayList<>(); - successfulTraps.addAll(Rs2GameObject.getGameObjects(SUCCESSFUL_TRAP_1)); - successfulTraps.addAll(Rs2GameObject.getGameObjects(SUCCESSFUL_TRAP_2)); - successfulTraps.addAll(Rs2GameObject.getGameObjects(SUCCESSFUL_TRAP_3)); - successfulTraps.addAll(Rs2GameObject.getGameObjects(SUCCESSFUL_TRAP_4)); - successfulTraps.addAll(Rs2GameObject.getGameObjects(SUCCESSFUL_TRAP_5)); + successfulTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9349)); + successfulTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9347)); + successfulTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9377)); + successfulTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9379)); + successfulTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9375)); List catchingTraps = new ArrayList<>(); - catchingTraps.addAll(Rs2GameObject.getGameObjects(CATCHING_TRAP_1)); - catchingTraps.addAll(Rs2GameObject.getGameObjects(CATCHING_TRAP_2)); - catchingTraps.addAll(Rs2GameObject.getGameObjects(CATCHING_TRAP_3)); - catchingTraps.addAll(Rs2GameObject.getGameObjects(CATCHING_TRAP_4)); - catchingTraps.addAll(Rs2GameObject.getGameObjects(CATCHING_TRAP_5)); + catchingTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9348)); + catchingTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9376)); + catchingTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9378)); + catchingTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9374)); + catchingTraps.addAll(Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9373)); - List failedTraps = Rs2GameObject.getGameObjects(FAILED_TRAP); - List idleTraps = Rs2GameObject.getGameObjects(IDLE_TRAP); + List failedTraps = Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE); + List idleTraps = Rs2GameObject.getGameObjects(ObjectID.BIRD_SNARE_9345); int availableTraps = getAvailableTraps(Rs2Player.getRealSkillLevel(Skill.HUNTER)); int totalTraps = successfulTraps.size() + failedTraps.size() + idleTraps.size() + catchingTraps.size(); - if (Rs2GroundItem.exists(BIRD_SNARE, 20)) { + if (Rs2GroundItem.exists(ItemID.BIRD_SNARE, 20)) { pickUpBirdSnare(); return; } @@ -176,7 +160,7 @@ private void handleTraps(BirdHunterConfig config) { private void setTrap(BirdHunterConfig config) { - if (!Rs2Inventory.contains(BIRD_SNARE)) return; + if (!Rs2Inventory.contains(ItemID.BIRD_SNARE)) return; if (Rs2Player.isStandingOnGameObject()) { movePlayerOffObject(); @@ -186,7 +170,7 @@ private void setTrap(BirdHunterConfig config) { } private void layBirdSnare() { - Rs2Item birdSnare = Rs2Inventory.get(BIRD_SNARE); + Rs2Item birdSnare = Rs2Inventory.get(ItemID.BIRD_SNARE); if (Rs2Inventory.interact(birdSnare, "Lay")) { if (sleepUntil(Rs2Player::isAnimating, 2000)) { sleepUntil(() -> !Rs2Player.isAnimating(), 3000); @@ -263,8 +247,8 @@ private boolean interactWithTrap(GameObject birdSnare) { } private void pickUpBirdSnare() { - if (Rs2GroundItem.exists(BIRD_SNARE, 20)) { - Rs2GroundItem.loot(BIRD_SNARE); + if (Rs2GroundItem.exists(ItemID.BIRD_SNARE, 20)) { + Rs2GroundItem.loot(ItemID.BIRD_SNARE); Microbot.log("Picked up bird snare from the ground."); } } From ec84e566ee93e5b99ef3ceac181cf54be04042a0 Mon Sep 17 00:00:00 2001 From: chsami Date: Tue, 26 Nov 2024 16:11:03 +0100 Subject: [PATCH 11/17] alwaysOn=true for webwalker --- .../plugins/microbot/shortestpath/ShortestPathPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPlugin.java index 963ed23c92..bb20aef16e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/ShortestPathPlugin.java @@ -79,7 +79,7 @@ description = "Draws the shortest path to a chosen destination on the map (right click a spot on the world map to use)", tags = {"pathfinder", "map", "waypoint", "navigation", "microbot"}, enabledByDefault = true, - alwaysOn = false + alwaysOn = true ) public class ShortestPathPlugin extends Plugin implements KeyListener { protected static final String CONFIG_GROUP = "shortestpath"; From 71f0ce1576c966bda256899d38ca1348f6397d7e Mon Sep 17 00:00:00 2001 From: chsami Date: Tue, 26 Nov 2024 16:37:38 +0100 Subject: [PATCH 12/17] teleport outside house portal --- .../client/plugins/microbot/util/walker/Rs2Walker.java | 8 ++++++-- .../plugins/microbot/shortestpath/agility_shortcuts.tsv | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java index 3bdcf4c243..87a7e499f4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java @@ -1059,8 +1059,6 @@ private static boolean handleTeleportItem(Transport transport) { break; if (succesfullAction) break; - System.out.println(itemId); - //If an action is succesfully we break out of the loop succesfullAction = handleInventoryTeleports(transport, itemId) || handleWearableTeleports(transport, itemId); @@ -1095,8 +1093,14 @@ public static boolean handleInventoryTeleports(Transport transport, int itemId) .findFirst() .orElse(null); + //House portal by default outside + if (itemId == 8013) { + itemAction = "Outside"; + } + // If no location-based action found, try generic actions if (itemAction == null) { + itemAction = Arrays.stream(rs2Item.getInventoryActions()) .filter(action -> action != null && genericKeyWords.stream().anyMatch(keyword -> action.toLowerCase().contains(keyword.toLowerCase()))) .findFirst() diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/agility_shortcuts.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/agility_shortcuts.tsv index d5daa83028..4aef320f17 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/agility_shortcuts.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/agility_shortcuts.tsv @@ -172,4 +172,9 @@ 2925 2949 0 2925 2948 0 Cross;Stepping stones;23647 30 Agility 2 2925 2947 0 2925 2948 0 Cross;Stepping stones;23647 30 Agility 2 3713 3830 0 3715 3815 0 Climb through;Hole;31482 70 Agility -3715 3815 0 3713 3830 0 Climb through;Hole;31481 70 Agility \ No newline at end of file +3715 3815 0 3713 3830 0 Climb through;Hole;31481 70 Agility +2946 3439 0 2943 3439 0 Climb-up;Climbing rocks;53255 66 Agility +1324 3777 0 1324 3784 0 Climb;Rocks;34397 29 Agility 4 +1324 3787 0 1324 3795 0 Climb;Rocks;34396 62 Agility 4 +1324 3784 0 1324 3777 0 Climb;Rocks;34397 29 Agility 4 +1324 3795 0 1324 3787 0 Climb;Rocks;34396 62 Agility 4 \ No newline at end of file From 980a69dc7c25c7a22fe27ff1e9b3c49e4e21ad16 Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:46:25 -0500 Subject: [PATCH 13/17] fix: force ItemCharge Plugin to be on by default (this is used by the webwalker) --- .../runelite/client/plugins/itemcharges/ItemChargePlugin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java index 1252a00caf..cccc652310 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java @@ -70,7 +70,8 @@ @PluginDescriptor( name = "Item Charges", description = "Show number of item charges remaining", - tags = {"inventory", "notifications", "overlay"} + tags = {"inventory", "notifications", "overlay"}, + alwaysOn = true ) @Slf4j public class ItemChargePlugin extends Plugin From dd31e90ed802e220ae19349c85830b7787b2b013 Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:48:35 -0500 Subject: [PATCH 14/17] chore: deprecate Microbot.getQuestState, this is redunant --- .../main/java/net/runelite/client/plugins/microbot/Microbot.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/Microbot.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/Microbot.java index 221c54b284..ffbab9fee8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/Microbot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/Microbot.java @@ -368,6 +368,7 @@ public static boolean isPluginEnabled(Class c) { return isPluginEnabled(c.getName()); } + @Deprecated(since = "1.6.2 - Use Rs2Player variant") public static QuestState getQuestState(Quest quest) { return getClientThread().runOnClientThread(() -> quest.getState(client)); } From 7aa42f87b742cedb1c3313e4ed19522f0c30dde1 Mon Sep 17 00:00:00 2001 From: g-mason0 <19415334+g-mason0@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:04:17 -0500 Subject: [PATCH 15/17] fix: updated various TSV headers for them to be processed correctly by the Transport Constructor chore: broke out useTransport method into smaller helper methods to better display the logic at hand --- .../microbot/shortestpath/Transport.java | 15 +- .../pathfinder/PathfinderConfig.java | 290 ++++++++++-------- .../plugins/microbot/shortestpath/boats.tsv | 6 +- .../plugins/microbot/shortestpath/canoes.tsv | 52 ++-- .../plugins/microbot/shortestpath/npcs.tsv | 2 +- 5 files changed, 203 insertions(+), 162 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/Transport.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/Transport.java index 6e0d8f5a06..a98b716461 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/Transport.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/Transport.java @@ -205,7 +205,7 @@ public class Transport { } //END microbot variables - if ((value = fieldMap.get("Skills")) != null) { + if ((value = fieldMap.get("Skills")) != null && !value.trim().isEmpty()) { String[] skillRequirements = value.split(DELIM_MULTI); for (String requirement : skillRequirements) { @@ -228,7 +228,7 @@ public class Transport { } } - if ((value = fieldMap.get("Item IDs")) != null) { + if ((value = fieldMap.get("Item IDs")) != null && !value.trim().isEmpty()) { String[] itemIdsList = value.split(DELIM_MULTI); for (String listIds : itemIdsList) { Set multiitemList = new HashSet<>(); @@ -241,13 +241,14 @@ public class Transport { } } - if ((value = fieldMap.get("Quests")) != null) { + if ((value = fieldMap.get("Quests")) != null && !value.trim().isEmpty()) { this.quests = findQuests(value); } - if ((value = fieldMap.get("Duration")) != null && !value.isEmpty()) { + if ((value = fieldMap.get("Duration")) != null && !value.trim().isEmpty()) { this.duration = Integer.parseInt(value); } + if (TransportType.TELEPORTATION_ITEM.equals(transportType) || TransportType.TELEPORTATION_SPELL.equals(transportType)) { // Teleportation items and spells should always have a non-zero wait, @@ -265,11 +266,11 @@ public class Transport { this.isConsumable = "T".equals(value) || "yes".equals(value.toLowerCase()); } - if ((value = fieldMap.get("Wilderness level")) != null && !value.isEmpty()) { + if ((value = fieldMap.get("Wilderness level")) != null && !value.trim().isEmpty()) { this.maxWildernessLevel = Integer.parseInt(value); } - if ((value = fieldMap.get("Varbits")) != null) { + if ((value = fieldMap.get("Varbits")) != null && !value.trim().isEmpty()) { for (String varbitCheck : value.split(DELIM_MULTI)) { String[] parts; TransportVarbit.Operator operator; @@ -319,7 +320,7 @@ private static Set findQuests(String questNamesCombined) { Set quests = new HashSet<>(); for (String questName : questNames) { for (Quest quest : Quest.values()) { - if (quest.getName().equals(questName)) { + if (quest.getName().equalsIgnoreCase(questName.trim())) { quests.add(quest); break; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/pathfinder/PathfinderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/pathfinder/PathfinderConfig.java index 60d77f22b2..85a3a38180 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/pathfinder/PathfinderConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/shortestpath/pathfinder/PathfinderConfig.java @@ -11,6 +11,7 @@ import net.runelite.client.plugins.microbot.util.equipment.Rs2Equipment; import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory; import net.runelite.client.plugins.microbot.util.magic.Rs2Magic; +import net.runelite.client.plugins.microbot.util.player.Rs2Player; import net.runelite.client.plugins.microbot.util.tabs.Rs2Tab; import net.runelite.client.plugins.microbot.util.walker.Rs2Walker; @@ -175,14 +176,14 @@ public void refreshTeleports(int packedLocation, int wildernessLevel) { } private void refreshTransports() { - useFairyRings &= !QuestState.NOT_STARTED.equals(Microbot.getQuestState(Quest.FAIRYTALE_II__CURE_A_QUEEN)) + useFairyRings &= !QuestState.NOT_STARTED.equals(Rs2Player.getQuestState(Quest.FAIRYTALE_II__CURE_A_QUEEN)) && (Rs2Inventory.contains(ItemID.DRAMEN_STAFF, ItemID.LUNAR_STAFF) || Rs2Equipment.isWearing(ItemID.DRAMEN_STAFF) || Rs2Equipment.isWearing(ItemID.LUNAR_STAFF) || Microbot.getVarbitValue(Varbits.DIARY_LUMBRIDGE_ELITE) == 1); - useGnomeGliders &= QuestState.FINISHED.equals(Microbot.getQuestState(Quest.THE_GRAND_TREE)); - useSpiritTrees &= QuestState.FINISHED.equals(Microbot.getQuestState(Quest.TREE_GNOME_VILLAGE)); - useQuetzals &= QuestState.FINISHED.equals(Microbot.getQuestState(Quest.TWILIGHTS_PROMISE)); + useGnomeGliders &= QuestState.FINISHED.equals(Rs2Player.getQuestState(Quest.THE_GRAND_TREE)); + useSpiritTrees &= QuestState.FINISHED.equals(Rs2Player.getQuestState(Quest.TREE_GNOME_VILLAGE)); + useQuetzals &= QuestState.FINISHED.equals(Rs2Player.getQuestState(Quest.TWILIGHTS_PROMISE)); transports.clear(); transportsPacked.clear(); @@ -192,7 +193,13 @@ private void refreshTransports() { for (Transport transport : entry.getValue()) { for (Quest quest : transport.getQuests()) { try { - questStates.put(quest, Microbot.getQuestState(quest)); + QuestState currentState = questStates.get(quest); + QuestState newState = Rs2Player.getQuestState(quest); + + // Only update if the new state is more progressed + if (currentState == null || isMoreProgressed(newState, currentState)) { + questStates.put(quest, newState); + } } catch (NullPointerException ignored) { System.out.println(ignored.getMessage()); } @@ -242,7 +249,13 @@ private void refreshRestrictionData() { // Fetch quest states and varbit values directly for (Quest quest : questsToFetch) { try { - questStates.put(quest, Microbot.getQuestState(quest)); + QuestState currentState = questStates.get(quest); + QuestState newState = Rs2Player.getQuestState(quest); + + // Only update if the new state is more progressed + if (currentState == null || isMoreProgressed(newState, currentState)) { + questStates.put(quest, newState); + } } catch (NullPointerException ignored) { // Handle exceptions if necessary } @@ -319,7 +332,8 @@ public boolean isInLevel30Wilderness(int packedPoint){ private boolean completedQuests(Transport transport) { for (Quest quest : transport.getQuests()) { - if (!QuestState.FINISHED.equals(questStates.getOrDefault(quest, QuestState.NOT_STARTED))) { + QuestState state = questStates.getOrDefault(quest, QuestState.NOT_STARTED); + if (state != QuestState.FINISHED) { return false; } } @@ -338,94 +352,18 @@ private boolean varbitChecks(Transport transport) { } private boolean useTransport(Transport transport) { - final boolean isQuestLocked = transport.isQuestLocked(); - - //START microbot variables - final boolean isNpc = transport.getType() == TransportType.NPC; - if (isNpc && !useNpcs){ - return false; - } - //END microbot variables - - if (!hasRequiredLevels(transport)) { - return false; - } - - //ship charters, mine cart will check for coins before using them - if (transport.getAmtItemRequired() > 0 && !Rs2Inventory.hasItemAmount(transport.getItemRequired(), transport.getAmtItemRequired())) - return false; - - TransportType type = transport.getType(); - - - if (AGILITY_SHORTCUT.equals(type) && (!useAgilityShortcuts || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (GRAPPLE_SHORTCUT.equals(type) && (!useGrappleShortcuts || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (BOAT.equals(type) && (!useBoats || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (CANOE.equals(type) && (!useCanoes || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (CHARTER_SHIP.equals(type) && (!useCharterShips || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (SHIP.equals(type) && !useShips) { - return false; - } else if (FAIRY_RING.equals(type) && (!useFairyRings || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (GNOME_GLIDER.equals(type) && (!useGnomeGliders || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (MINECART.equals(type) && (!useMinecarts || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (QUETZAL.equals(type) && (!useQuetzals || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (SPIRIT_TREE.equals(type) && (!useSpiritTrees || !client.getWorldType().contains(WorldType.MEMBERS))) { - return false; - } else if (TELEPORTATION_ITEM.equals(type)) { - switch (useTeleportationItems) { - case ALL: - case INVENTORY: - if (transport.getItemIdRequirements().stream().flatMap(Collection::stream).anyMatch(itemId -> itemId == ItemID.CHRONICLE)) { - String charges = Microbot.getConfigManager().getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE); - if (charges == null || charges.isEmpty()) { - if (Rs2Inventory.hasItem(ItemID.CHRONICLE)) { - Rs2Inventory.interact(ItemID.CHRONICLE, "Check charges"); - charges = Microbot.getConfigManager().getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE); - } else if (Rs2Equipment.hasEquipped(ItemID.CHRONICLE)) { - Rs2Equipment.interact(ItemID.CHRONICLE, "Check charges"); - charges = Microbot.getConfigManager().getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE); - } else { - return false; - } - } - return Integer.parseInt(charges) > 0; - } - break; - case NONE: - return false; - case INVENTORY_NON_CONSUMABLE: - case ALL_NON_CONSUMABLE: - if (transport.isConsumable()) { - return false; - } - break; - } - } else if (TELEPORTATION_LEVER.equals(type) && !useTeleportationLevers) { - return false; - } else if (TELEPORTATION_PORTAL.equals(type) && !useTeleportationPortals) { - return false; - } else if (TELEPORTATION_SPELL.equals(type) && !useTeleportationSpells) { - return false; - } else if (WILDERNESS_OBELISK.equals(type) && !useWildernessObelisks) { - return false; - } - - if (isQuestLocked && !completedQuests(transport)) { - return false; - } - - if (!varbitChecks(transport)) { - return false; - } + // Check if the feature flag is disabled + if (!isFeatureEnabled(transport.getType())) return false; + // If you don't meet level requirements + if (!hasRequiredLevels(transport)) return false; + // If you don't have the required Items & Amount for transport (used for charters & minecarts) + if (transport.getAmtItemRequired() > 0 && !Rs2Inventory.hasItemAmount(transport.getItemRequired(), transport.getAmtItemRequired())) return false; + // Check Teleport Item Settings + if (transport.getType() == TELEPORTATION_ITEM) return isTeleportationItemUsable(transport); + // If the transport has quest requirements & the quest haven't been completed + if (transport.isQuestLocked() && !completedQuests(transport)) return false; + // If the transport has varbit requirements & the varbits do not match + if (!varbitChecks(transport)) return false; return true; } @@ -460,42 +398,144 @@ private boolean hasRequiredLevels(Restriction restriction) { return true; } + private boolean isFeatureEnabled(TransportType type) { + if (!client.getWorldType().contains(WorldType.MEMBERS)) { + // Transport types that require membership + switch (type) { + case AGILITY_SHORTCUT: + case GRAPPLE_SHORTCUT: + case BOAT: + case CANOE: + case CHARTER_SHIP: + case FAIRY_RING: + case GNOME_GLIDER: + case MINECART: + case QUETZAL: + case SPIRIT_TREE: + return false; // Not enabled without membership + } + } + + switch (type) { + case AGILITY_SHORTCUT: + return useAgilityShortcuts; + case GRAPPLE_SHORTCUT: + return useGrappleShortcuts; + case BOAT: + return useBoats; + case CANOE: + return useCanoes; + case CHARTER_SHIP: + return useCharterShips; + case SHIP: + return useShips; + case FAIRY_RING: + return useFairyRings; + case GNOME_GLIDER: + return useGnomeGliders; + case MINECART: + return useMinecarts; + case NPC: + return useNpcs; + case QUETZAL: + return useQuetzals; + case SPIRIT_TREE: + return useSpiritTrees; + case TELEPORTATION_ITEM: + return useTeleportationItems != TeleportationItem.NONE; + case TELEPORTATION_LEVER: + return useTeleportationLevers; + case TELEPORTATION_PORTAL: + return useTeleportationPortals; + case TELEPORTATION_SPELL: + return useTeleportationSpells; + case WILDERNESS_OBELISK: + return useWildernessObelisks; + default: + return true; // Default to enabled if no specific toggle + } + } + + /** Checks if a teleportation item is usable */ + private boolean isTeleportationItemUsable(Transport transport) { + if (useTeleportationItems == TeleportationItem.NONE) return false; + // Check consumable items configuration + if (useTeleportationItems == TeleportationItem.ALL_NON_CONSUMABLE && transport.isConsumable()) return false; + + return hasRequiredItems(transport); + } + /** Checks if the player has all the required equipment and inventory items for the transport */ private boolean hasRequiredItems(Transport transport) { + // Global flag to disable teleports if (Rs2Walker.disableTeleports) return false; - if ((TeleportationItem.ALL.equals(useTeleportationItems) || - TeleportationItem.ALL_NON_CONSUMABLE.equals(useTeleportationItems)) && - TransportType.TELEPORTATION_ITEM.equals(transport.getType())) { - return true; - } - if (TeleportationItem.NONE.equals(useTeleportationItems) && - TransportType.TELEPORTATION_ITEM.equals(transport.getType())) { - return false; - } - if (transport.getType() == TELEPORTATION_SPELL) { - //START microbot variables - return Rs2Magic.quickCanCast(transport.getDisplayInfo()); - //END microbot variables - } else { - //START microbot variables - if (!Microbot.getClient().getWorldType().contains(WorldType.MEMBERS)) return false; - //END microbot variables - // TODO: this does not check quantity - return transport.getItemIdRequirements().stream().flatMap(Collection::stream).anyMatch(x -> Rs2Equipment.isWearing(x) || Rs2Inventory.hasItem(x)); - /* List inventoryItems = Arrays.stream(new InventoryID[]{InventoryID.INVENTORY, InventoryID.EQUIPMENT}) - .map(client::getItemContainer) - .filter(Objects::nonNull) - .map(ItemContainer::getItems) - .flatMap(Arrays::stream) - .map(Item::getId) - .filter(itemId -> itemId != -1) - .collect(Collectors.toList()); - return transport.getItemIdRequirements().stream().anyMatch(requirements -> requirements.stream().allMatch(inventoryItems::contains));*/ - } + // Handle teleportation items + if (TransportType.TELEPORTATION_ITEM.equals(transport.getType())) + return transport.getItemIdRequirements() + .stream() + .flatMap(Collection::stream) + .anyMatch(itemId -> Rs2Equipment.isWearing(itemId) || Rs2Inventory.hasItem(itemId)); + + // Handle teleportation spells + if (TransportType.TELEPORTATION_SPELL.equals(transport.getType())) return Rs2Magic.quickCanCast(transport.getDisplayInfo()); + + // Special case for Chronicle teleport + if (requiresChronicle(transport)) return hasChronicleCharges(); + + // Check membership restrictions + if (!client.getWorldType().contains(WorldType.MEMBERS)) return false; + + // General item requirements + return transport.getItemIdRequirements() + .stream() + .flatMap(Collection::stream) + .anyMatch(itemId -> Rs2Equipment.isWearing(itemId) || Rs2Inventory.hasItem(itemId)); + } + + /** Checks if the transport requires the Chronicle */ + private boolean requiresChronicle(Transport transport) { + return transport.getItemIdRequirements() + .stream() + .flatMap(Collection::stream) + .anyMatch(itemId -> itemId == ItemID.CHRONICLE); } - //microbot method + /** Checks if the Chronicle has charges */ + private boolean hasChronicleCharges() { + String charges = Microbot.getConfigManager() + .getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE); + + // If charges are unknown, attempt to retrieve them + if (charges == null || charges.isEmpty()) { + if (Rs2Inventory.hasItem(ItemID.CHRONICLE)) { + Rs2Inventory.interact(ItemID.CHRONICLE, "Check charges"); + } else if (Rs2Equipment.hasEquipped(ItemID.CHRONICLE)) { + Rs2Equipment.interact(ItemID.CHRONICLE, "Check charges"); + } + charges = Microbot.getConfigManager().getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE); + } + + // Validate charges + return charges != null && Integer.parseInt(charges) > 0; + } + + /** Checks if a QuestState is further progressed than currentState **/ + private boolean isMoreProgressed(QuestState newState, QuestState currentState) { + if (currentState == null) return false; + if (newState == null) return false; + + // Define the progression order of states + List progressionOrder = Arrays.asList( + QuestState.NOT_STARTED, + QuestState.IN_PROGRESS, + QuestState.FINISHED + ); + + return progressionOrder.indexOf(newState) > progressionOrder.indexOf(currentState); + } + + @Deprecated(since = "1.6.2 - Add Restrictions to restrictions.tsv", forRemoval = true) public void setRestrictedTiles(Restriction... restrictions){ this.customRestrictions = List.of(restrictions); } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/boats.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/boats.tsv index 30fc26ae3f..3e26bd1595 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/boats.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/boats.tsv @@ -1,4 +1,4 @@ -# Origin Destination menuOption menuTarget objectID Skill Requirements Item Requirements Quest Wait Display Info Varbits +# Origin Destination menuOption menuTarget objectID Skills Items Quests Wait Display Info Varbits # Fishing Platform 2720 3301 0 2782 3273 0 Travel;Holgart;7789 Sea Slug 9 2782 3273 0 2720 3301 0 Travel;Holgart;5070 Sea Slug 9 @@ -34,8 +34,8 @@ 2311 3781 0 2644 3710 0 Rellekka;Maria Gunnars;1882 The Fremennik Trials 14 # Rellekka, Pirates' Cove -2620 3693 0 2213 3794 0 Pirate's Cove;Lokar Searunner;3855 The Fremennik Trials 9 -2213 3794 0 2620 3693 0 Rellekka;Lokar Searunner;9306 The Fremennik Trials 9 +2620 3693 0 2213 3794 0 Pirate's Cove;Lokar Searunner;3855 The Fremennik Trials;Lunar Diplomacy 9 +2213 3794 0 2620 3693 0 Rellekka;Lokar Searunner;9306 The Fremennik Trials;Lunar Diplomacy 9 # Rellekka, Iceberg 2707 3736 0 2660 3989 1 Iceberg;Boat;21176 Cold War 9 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/canoes.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/canoes.tsv index 14b07bd1c0..63cf2e359c 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/canoes.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/canoes.tsv @@ -1,35 +1,35 @@ -# X Y Z X Y Z menuOption menuTarget objectID Skill requirements Item requirements Quest Travel time Info +# Origin Destination menuOption menuTarget objectID Skills Item IDs Quest Travel time Info # Edgeville -3132 3510 0 3109 3415 0 Paddle Canoe;Canoe Station;12166 12 Woodcutting 1 Bronze axe 30 Barbarian Village -3132 3510 0 3199 3344 0 Paddle Canoe;Canoe Station;12166 27 Woodcutting 1 Bronze axe 30 Champions Guild -3132 3510 0 3240 3242 0 Paddle Canoe;Canoe Station;12166 42 Woodcutting 1 Bronze axe 30 Lumbridge -3132 3510 0 3154 3638 0 Paddle Canoe;Canoe Station;12166 57 Woodcutting 1 Bronze axe 20 Ferox Enclave -3132 3510 0 3141 3796 0 Paddle Canoe;Canoe Station;12166 57 Woodcutting 1 Bronze axe 20 Wilderness Pond +3132 3510 0 3109 3415 0 Paddle Canoe;Canoe Station;12166 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Barbarian Village +3132 3510 0 3199 3344 0 Paddle Canoe;Canoe Station;12166 27 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Champions Guild +3132 3510 0 3240 3242 0 Paddle Canoe;Canoe Station;12166 42 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Lumbridge +3132 3510 0 3154 3638 0 Paddle Canoe;Canoe Station;12166 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Ferox Enclave +3132 3510 0 3141 3796 0 Paddle Canoe;Canoe Station;12166 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Wilderness Pond # Barbarian Village -3112 3411 0 3199 3344 0 Paddle Canoe;Canoe Station;12165 12 Woodcutting 1 Bronze axe 30 Champions Guild -3112 3411 0 3128 3503 0 Paddle Canoe;Canoe Station;12165 12 Woodcutting 1 Bronze axe 30 Edgeville -3112 3411 0 3240 3242 0 Paddle Canoe;Canoe Station;12165 27 Woodcutting 1 Bronze axe 30 Lumbridge -3112 3411 0 3154 3638 0 Paddle Canoe;Canoe Station;12165 57 Woodcutting 1 Bronze axe 20 Ferox Enclave -3112 3411 0 3141 3796 0 Paddle Canoe;Canoe Station;12165 57 Woodcutting 1 Bronze axe 20 Wilderness Pond +3112 3411 0 3199 3344 0 Paddle Canoe;Canoe Station;12165 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Champions Guild +3112 3411 0 3128 3503 0 Paddle Canoe;Canoe Station;12165 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Edgeville +3112 3411 0 3240 3242 0 Paddle Canoe;Canoe Station;12165 27 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Lumbridge +3112 3411 0 3154 3638 0 Paddle Canoe;Canoe Station;12165 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Ferox Enclave +3112 3411 0 3141 3796 0 Paddle Canoe;Canoe Station;12165 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Wilderness Pond # Champions' Guild -3202 3343 0 3240 3242 0 Paddle Canoe;Canoe Station;12164 12 Woodcutting 1 Bronze axe 30 Lumbridge -3202 3343 0 3109 3415 0 Paddle Canoe;Canoe Station;12164 12 Woodcutting 1 Bronze axe 30 Barbarian Village -3202 3343 0 3128 3503 0 Paddle Canoe;Canoe Station;12164 27 Woodcutting 1 Bronze axe 30 Edgeville -3202 3343 0 3154 3638 0 Paddle Canoe;Canoe Station;12164 57 Woodcutting 1 Bronze axe 20 Ferox Enclave -3202 3343 0 3141 3796 0 Paddle Canoe;Canoe Station;12164 57 Woodcutting 1 Bronze axe 20 Wilderness Pond +3202 3343 0 3240 3242 0 Paddle Canoe;Canoe Station;12164 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Lumbridge +3202 3343 0 3109 3415 0 Paddle Canoe;Canoe Station;12164 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Barbarian Village +3202 3343 0 3128 3503 0 Paddle Canoe;Canoe Station;12164 27 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Edgeville +3202 3343 0 3154 3638 0 Paddle Canoe;Canoe Station;12164 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Ferox Enclave +3202 3343 0 3141 3796 0 Paddle Canoe;Canoe Station;12164 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Wilderness Pond # Lumbridge -3243 3237 0 3199 3344 0 Paddle Canoe;Canoe Station;12163 12 Woodcutting 1 Bronze axe 30 Champions Guild -3243 3237 0 3109 3415 0 Paddle Canoe;Canoe Station;12163 27 Woodcutting 1 Bronze axe 30 Barbarian Village -3243 3237 0 3128 3503 0 Paddle Canoe;Canoe Station;12163 42 Woodcutting 1 Bronze axe 30 Edgeville -3243 3237 0 3154 3638 0 Paddle Canoe;Canoe Station;12163 57 Woodcutting 1 Bronze axe 20 Ferox Enclave -3243 3237 0 3141 3796 0 Paddle Canoe;Canoe Station;12163 57 Woodcutting 1 Bronze axe 20 Wilderness Pond +3243 3237 0 3199 3344 0 Paddle Canoe;Canoe Station;12163 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Champions Guild +3243 3237 0 3109 3415 0 Paddle Canoe;Canoe Station;12163 27 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Barbarian Village +3243 3237 0 3128 3503 0 Paddle Canoe;Canoe Station;12163 42 Woodcutting 1351;1349;1361;1353;1355;1357;1359 30 Edgeville +3243 3237 0 3154 3638 0 Paddle Canoe;Canoe Station;12163 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Ferox Enclave +3243 3237 0 3141 3796 0 Paddle Canoe;Canoe Station;12163 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Wilderness Pond # Ferox Enclave -3154 3630 0 3128 3503 0 Paddle Canoe;Canoe Station;39638 12 Woodcutting 1 Bronze axe 20 Edgeville -3154 3630 0 3109 3415 0 Paddle Canoe;Canoe Station;39638 27 Woodcutting 1 Bronze axe 20 Barbarian Village -3154 3630 0 3199 3344 0 Paddle Canoe;Canoe Station;39638 42 Woodcutting 1 Bronze axe 20 Champions Guild -3154 3630 0 3240 3242 0 Paddle Canoe;Canoe Station;39638 57 Woodcutting 1 Bronze axe 20 Lumbridge -3154 3630 0 3141 3796 0 Paddle Canoe;Canoe Station;39638 57 Woodcutting 1 Bronze axe 20 Wilderness Pond +3154 3630 0 3128 3503 0 Paddle Canoe;Canoe Station;39638 12 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Edgeville +3154 3630 0 3109 3415 0 Paddle Canoe;Canoe Station;39638 27 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Barbarian Village +3154 3630 0 3199 3344 0 Paddle Canoe;Canoe Station;39638 42 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Champions Guild +3154 3630 0 3240 3242 0 Paddle Canoe;Canoe Station;39638 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Lumbridge +3154 3630 0 3141 3796 0 Paddle Canoe;Canoe Station;39638 57 Woodcutting 1351;1349;1361;1353;1355;1357;1359 20 Wilderness Pond diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/npcs.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/npcs.tsv index ec4ccac2e7..24e1dcdb22 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/npcs.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/npcs.tsv @@ -1,4 +1,4 @@ -# Origin Destination menuOption menuTarget objectID Skill requirements Item requirements Quest Duration Display info +# Origin Destination menuOption menuTarget objectID Skills Item IDs Quests Duration Display info # Lumbridge cellar 3319 9615 0 3232 9610 0 Cellar;Mistag;7299 Death to the Dorgeshuun 3319 9615 0 3245 9648 0 Watermill;Mistag;7299 Death to the Dorgeshuun From 8dd09b74c4f5fc7b89b145bcab7febdc990e0254 Mon Sep 17 00:00:00 2001 From: chsami Date: Wed, 27 Nov 2024 07:00:26 +0100 Subject: [PATCH 16/17] 1.6.3 --- .github/workflows/release.yml | 4 ++-- runelite-client/pom.xml | 2 +- .../client/plugins/microbot/example/ExampleScript.java | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b804cea320..ff8a8107ac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,9 +27,9 @@ jobs: uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "1.6.2" + automatic_release_tag: "1.6.3" prerelease: false - title: "Release 1.6.2" + title: "Release 1.6.3" files: | /home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index e691d8ccf4..5a6d63917c 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -41,7 +41,7 @@ nogit false false - 1.6.2 + 1.6.3 diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java index 9e6141478e..6f51b1b27c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java @@ -2,6 +2,7 @@ import net.runelite.client.plugins.microbot.Microbot; import net.runelite.client.plugins.microbot.Script; +import net.runelite.client.plugins.microbot.util.player.Rs2Player; import java.util.concurrent.TimeUnit; @@ -19,6 +20,8 @@ public boolean run(ExampleConfig config) { //CODE HERE + Rs2Player.attack(Rs2Player.getPlayers().get(0)); + long endTime = System.currentTimeMillis(); long totalTime = endTime - startTime; System.out.println("Total time for loop " + totalTime); From f6df2ddcd3f3a4136dc248f5daf34a17693c6ad7 Mon Sep 17 00:00:00 2001 From: chsami Date: Wed, 27 Nov 2024 07:01:09 +0100 Subject: [PATCH 17/17] cleanup --- .../client/plugins/microbot/example/ExampleScript.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java index 6f51b1b27c..9e6141478e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/ExampleScript.java @@ -2,7 +2,6 @@ import net.runelite.client.plugins.microbot.Microbot; import net.runelite.client.plugins.microbot.Script; -import net.runelite.client.plugins.microbot.util.player.Rs2Player; import java.util.concurrent.TimeUnit; @@ -20,8 +19,6 @@ public boolean run(ExampleConfig config) { //CODE HERE - Rs2Player.attack(Rs2Player.getPlayers().get(0)); - long endTime = System.currentTimeMillis(); long totalTime = endTime - startTime; System.out.println("Total time for loop " + totalTime);