-
-
Notifications
You must be signed in to change notification settings - Fork 486
Feat/mushtree and digsite transport #1671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| package net.runelite.client.plugins.microbot.shortestpath; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import net.runelite.api.TileObject; | ||
| import net.runelite.api.coords.WorldPoint; | ||
| import net.runelite.client.plugins.microbot.util.player.Rs2Player; | ||
| import net.runelite.client.plugins.microbot.util.widget.Rs2Widget; | ||
|
|
||
| import static net.runelite.client.plugins.microbot.util.Global.sleepUntil; | ||
|
|
||
| /** | ||
| * Handles the Magic Mushtree (Mycelium Transportation System) on Fossil Island. | ||
| * The mushtree network connects four locations: | ||
| * - House on the Hill | ||
| * - Verdant Valley | ||
| * - Sticky Swamp | ||
| * - Mushroom Meadow | ||
| */ | ||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum MagicMushtree { | ||
| HOUSE_ON_THE_HILL("House on the Hill", new WorldPoint(3764, 3879, 1)), | ||
| VERDANT_VALLEY("Verdant Valley", new WorldPoint(3760, 3758, 0)), | ||
| STICKY_SWAMP("Sticky Swamp", new WorldPoint(3676, 3755, 0)), | ||
| MUSHROOM_MEADOW("Mushroom Meadow", new WorldPoint(3676, 3871, 0)); | ||
|
|
||
| private final String destinationName; | ||
| private final WorldPoint destination; | ||
|
|
||
| // Object IDs for the Magic Mushtrees | ||
| public static final int MUSHTREE_HOUSE_ON_HILL = 30920; | ||
| public static final int MUSHTREE_OTHER = 30924; | ||
|
|
||
| private static final int OFFSET = 10; | ||
|
|
||
| /** | ||
| * Checks if the given object ID is a Magic Mushtree. | ||
| */ | ||
| public static boolean isMagicMushtree(int objectId) { | ||
| return objectId == MUSHTREE_HOUSE_ON_HILL || objectId == MUSHTREE_OTHER; | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the given TileObject is a Magic Mushtree. | ||
| */ | ||
| public static boolean isMagicMushtree(TileObject tileObject) { | ||
| return tileObject != null && isMagicMushtree(tileObject.getId()); | ||
| } | ||
|
|
||
| /** | ||
| * Handles the Magic Mushtree transport after the initial "Use" interaction. | ||
| * Waits for the menu to appear, then clicks the appropriate destination. | ||
| * | ||
| * @param transport The transport containing the destination | ||
| * @return true if the transport was handled successfully | ||
| */ | ||
| public static boolean handleTransport(Transport transport) { | ||
| WorldPoint dest = transport.getDestination(); | ||
| MagicMushtree destination = getByDestination(dest); | ||
|
|
||
| if (destination == null) { | ||
| return false; | ||
| } | ||
|
|
||
| // Wait for the mushtree menu widget to appear | ||
| if (!sleepUntil(() -> Rs2Widget.hasWidget("Mycelium"), 5000)) { | ||
| return false; | ||
| } | ||
|
|
||
| // Click the destination option | ||
| if (!Rs2Widget.clickWidget(destination.getDestinationName())) { | ||
| return false; | ||
| } | ||
|
|
||
| // Wait until we arrive at destination | ||
| sleepUntil(() -> Rs2Player.getWorldLocation().distanceTo(dest) < OFFSET, 10000); | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the MagicMushtree enum by destination WorldPoint. | ||
| */ | ||
| public static MagicMushtree getByDestination(WorldPoint destination) { | ||
| if (destination == null) return null; | ||
|
|
||
| for (MagicMushtree mushtree : values()) { | ||
| WorldPoint dest = mushtree.getDestination(); | ||
| if (dest.equals(destination)) { | ||
| return mushtree; | ||
| } | ||
| // Also match by X and Y only (ignore plane differences in destination matching) | ||
| if (dest.getX() == destination.getX() && dest.getY() == destination.getY()) { | ||
| return mushtree; | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| import net.runelite.api.gameval.VarbitID; | ||
| import net.runelite.client.plugins.microbot.Microbot; | ||
| 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.player.Rs2Player; | ||
|
|
||
| @Getter | ||
|
|
@@ -128,7 +129,9 @@ public boolean hasRequirements() { | |
| boolean isWearingCraftingGuild = (Rs2Equipment.isWearing("brown apron") || Rs2Equipment.isWearing("golden apron")) || | ||
| (Rs2Equipment.isWearing("max cape") || Rs2Equipment.isWearing("max hood")) || | ||
| (Rs2Equipment.isWearing("crafting cape") || Rs2Equipment.isWearing("crafting hood")); | ||
| return isWearingCraftingGuild && (hasMaxedCrafting || hasFaladorHardDiary); | ||
| // Also check if crafting cape is in inventory (can equip it to teleport and enter) | ||
| boolean hasCraftingCapeInInventory = Rs2Inventory.contains("crafting cape") || Rs2Inventory.contains("crafting cape(t)"); | ||
| return (isWearingCraftingGuild || hasCraftingCapeInInventory) && (hasMaxedCrafting || hasFaladorHardDiary); | ||
|
Comment on lines
129
to
+134
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent handling of trimmed crafting cape between equipment and inventory checks. The new inventory check on line 133 correctly handles both 🔧 Proposed fix for consistency boolean isWearingCraftingGuild = (Rs2Equipment.isWearing("brown apron") || Rs2Equipment.isWearing("golden apron")) ||
(Rs2Equipment.isWearing("max cape") || Rs2Equipment.isWearing("max hood")) ||
- (Rs2Equipment.isWearing("crafting cape") || Rs2Equipment.isWearing("crafting hood"));
+ (Rs2Equipment.isWearing("crafting cape") || Rs2Equipment.isWearing("crafting cape(t)") || Rs2Equipment.isWearing("crafting hood"));🤖 Prompt for AI Agents |
||
| case LUMBRIDGE_BASEMENT: | ||
| return Rs2Player.getQuestState(Quest.RECIPE_FOR_DISASTER__ANOTHER_COOKS_QUEST) == QuestState.FINISHED; | ||
| case COOKS_GUILD: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return failure if arrival wait times out.
sleepUntilis ignored, sohandleTransportcan return success even when the teleport fails or times out. Return the boolean result instead.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents