From daed741a840f5d5bd2e43c4f2cf6c915f0575646 Mon Sep 17 00:00:00 2001 From: Krulvis Date: Tue, 9 Sep 2025 18:47:08 +0200 Subject: [PATCH 01/10] init rework tsv --- .../shortestpath/ShortestPathPlugin.java | 1 + .../microbot/shortestpath/Transport.java | 30 +- .../pathfinder/PathfinderConfig.java | 34 +- .../microbot/util/cache/Rs2PohCache.java | 98 ++++-- .../serialization/PohTeleportDataAdapter.java | 8 +- .../microbot/util/poh/PohTeleports.java | 3 + .../microbot/util/poh/PohTransport.java | 39 +++ .../microbot/util/walker/Rs2Walker.java | 50 +-- .../shortestpath/teleportation_poh.tsv | 298 ------------------ ..._poh.tsv => teleportation_portals_poh.tsv} | 0 10 files changed, 183 insertions(+), 378 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_poh.tsv rename runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/{teleportation_portal_poh.tsv => teleportation_portals_poh.tsv} (100%) 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 d40c7e356a4..0f2e2ec1e15 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 @@ -200,6 +200,7 @@ protected void startUp() { cacheConfigValues(); SplitFlagMap map = SplitFlagMap.fromResources(); Map> transports = Transport.loadAllFromResources(); + List restrictions = Restriction.loadAllFromResources(); pathfinderConfig = new PathfinderConfig(map, transports, restrictions, client, config); 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 7e25c01c8ca..d6c94e16e8c 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 @@ -8,6 +8,11 @@ import net.runelite.api.Skill; import net.runelite.api.coords.WorldPoint; import net.runelite.client.plugins.microbot.Microbot; +import net.runelite.client.plugins.microbot.util.poh.PohTeleports; +import net.runelite.client.plugins.microbot.util.poh.PohTransport; +import net.runelite.client.plugins.microbot.util.poh.data.HouseStyle; +import net.runelite.client.plugins.microbot.util.poh.data.MountedMythical; +import net.runelite.client.plugins.microbot.util.poh.data.NexusPortal; import java.io.IOException; import java.io.InputStream; @@ -27,14 +32,6 @@ public class Transport { private int objectId; @Getter private String name; - /** - * Used by PohTransport to trace back to the PohTransportable that can execute the teleportation - */ - @Getter - private String enumValue; - @Getter - private String enumClass; - //END microbot variables /** * A location placeholder different from null to use for permutation transports @@ -174,7 +171,6 @@ public class Transport { //START microbot variables this.name = origin.getName(); this.objectId = origin.getObjectId(); - this.enumValue = origin.getEnumValue(); this.action = origin.getAction(); this.currencyName = origin.getCurrencyName(); this.currencyAmount = origin.getCurrencyAmount(); @@ -182,6 +178,12 @@ public class Transport { //END microbot variables } + public Transport(WorldPoint destination, String displayInfo, TransportType transportType) { + this.destination = destination; + this.displayInfo = displayInfo; + this.type = transportType; + } + Transport(Map fieldMap, TransportType transportType) { final String DELIM = " "; final String DELIM_MULTI = ";"; @@ -209,13 +211,6 @@ public class Transport { } //START microbot variables - if((value = fieldMap.get("EnumValue")) != null && !value.trim().isEmpty()) { - this.enumValue = value.trim(); - } - if((value = fieldMap.get("EnumClass")) != null && !value.trim().isEmpty()) { - this.enumClass = value.trim(); - } - if ((value = fieldMap.get("menuOption menuTarget objectID")) != null && !value.trim().isEmpty()) { value = value.trim(); // Remove leading/trailing spaces @@ -544,12 +539,11 @@ public static HashMap> loadAllFromResources() { addTransports(transports, "teleportation_minigames.tsv", TransportType.TELEPORTATION_MINIGAME); addTransports(transports, "teleportation_levers.tsv", TransportType.TELEPORTATION_LEVER); addTransports(transports, "teleportation_portals.tsv", TransportType.TELEPORTATION_PORTAL); + addTransports(transports, "teleportation_portals_poh.tsv", TransportType.TELEPORTATION_PORTAL); addTransports(transports, "teleportation_spells.tsv", TransportType.TELEPORTATION_SPELL); addTransports(transports, "wilderness_obelisks.tsv", TransportType.WILDERNESS_OBELISK); addTransports(transports, "magic_carpets.tsv", TransportType.MAGIC_CARPET); addTransports(transports, "npcs.tsv", TransportType.NPC); - addTransports(transports, "teleportation_portal_poh.tsv", TransportType.TELEPORTATION_PORTAL); - addTransports(transports, "teleportation_poh.tsv", TransportType.POH); System.out.println("Loaded " + transports.size() + " transports"); return transports; } 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 2958ae219ed..10787992e52 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 @@ -29,6 +29,7 @@ import net.runelite.client.plugins.microbot.util.magic.RuneFilter; import net.runelite.client.plugins.microbot.util.player.Rs2Player; import net.runelite.client.plugins.microbot.util.poh.PohTeleports; +import net.runelite.client.plugins.microbot.util.poh.PohTransport; import net.runelite.client.plugins.microbot.util.poh.data.HouseStyle; import net.runelite.client.plugins.microbot.util.tabs.Rs2Tab; import net.runelite.client.plugins.microbot.util.walker.Rs2Walker; @@ -255,14 +256,12 @@ private void refreshTransports(WorldPoint target) { 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)); - usePoh &= PohTeleports.hasHouse(); transports.clear(); transportsPacked.clear(); usableTeleports.clear(); - // Check spirit tree farming states for farmable spirit trees - Rs2SpiritTreeCache.getInstance().update(); - //Rs2SpiritTreeCache.logAllTreeStates(); + + Map.Entry> extraTransport = null; for (Map.Entry> entry : allTransports.entrySet()) { WorldPoint point = entry.getKey(); Set usableTransports = new HashSet<>(entry.getValue().size()); @@ -283,6 +282,19 @@ private void refreshTransports(WorldPoint target) { transportsPacked.put(WorldPointUtil.packWorldPoint(point), usableTransports); } } + + HouseStyle style = HouseStyle.getStyle(); + if (usePoh && style != null) { + //Since we have a house style, we have a house and can therefore add available transports + WorldPoint origin = style.getPohLocation(); + int packedOrigin = WorldPointUtil.packWorldPoint(origin); + List pohTransports = Rs2PohCache.getAvailableTransports() + .stream().filter(this::useTransport).collect(Collectors.toList()); + Set existingTransports = transports.getOrDefault(origin, new HashSet<>()); + existingTransports.addAll(pohTransports.stream().filter(pohTransport -> !existingTransports.contains(pohTransport)).collect(Collectors.toSet())); + transports.put(origin, existingTransports); + transportsPacked.put(packedOrigin, existingTransports); + } // Filter similar transports based on distance when walk with banked transports is enabled if (useBankItems && config.maxSimilarTransportDistance() > 0) { @@ -449,16 +461,19 @@ private boolean useTransport(Transport transport) { } // Check Spirit Tree specific requirements (farming state for farmable trees) if (transport.getType() == TransportType.SPIRIT_TREE) return isSpiritTreeUsable(transport); + // If the transport has varbit requirements & the varbits do not match if (!varbitChecks(transport)) { log.debug("Transport ( O: {} D: {} ) requires varbits {}", transport.getOrigin(), transport.getDestination(), transport.getVarbits()); return false; } + // If the transport has varplayer requirements & the varplayers do not match if (!varplayerChecks(transport)) { log.debug("Transport ( O: {} D: {} ) requires varplayers {}", transport.getOrigin(), transport.getDestination(), transport.getVarplayers()); return false; } + // If you don't have the required currency & amount for transport if (transport.getCurrencyAmount() > 0 && !Rs2Inventory.hasItemAmount(transport.getCurrencyName(), transport.getCurrencyAmount()) @@ -466,19 +481,12 @@ private boolean useTransport(Transport transport) { log.debug("Transport ( O: {} D: {} ) requires {} x {}", transport.getOrigin(), transport.getDestination(), transport.getCurrencyAmount(), transport.getCurrencyName()); return false; } + // Check if Teleports are globally disabled if (TransportType.isTeleport(transport.getType()) && Rs2Walker.disableTeleports) { log.debug("Transport ( O: {} D: {} ) is a teleport but teleports are globally disabled", transport.getOrigin(), transport.getDestination()); return false; } - if (transport.getType() == TransportType.POH) { - boolean isUsable = Rs2PohCache.isTransportUsable(transport); - if (!isUsable) - { - log.debug("Transport ( O: {} D: {} ) is a POH teleport but is not usable", transport.getOrigin(), transport.getDestination()); - } - return isUsable; - } // Check Teleport Item Settings if (transport.getType() == TELEPORTATION_ITEM) { @@ -511,6 +519,8 @@ private boolean useTransport(Transport transport) { //Check PoH fairy ring requirement if(transport.getType() == FAIRY_RING && HouseStyle.isPohExitLocation(transport.getOrigin())) { + //At this point we've already checked the Varbit requirement + //Now we need to check in cache if the object actually exists in the PoH boolean isUsable = Rs2PohCache.isTransportUsable(transport); if (!isUsable) { log.debug("Transport ( O: {} D: {} ) is a POH-Fairy-ring teleport but is not usable", transport.getOrigin(), transport.getDestination()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java index 03cffdb7d60..a58a9b8605e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java @@ -13,10 +13,12 @@ import net.runelite.client.plugins.microbot.util.cache.util.LogOutputMode; import net.runelite.client.plugins.microbot.util.cache.util.Rs2CacheLoggingUtils; import net.runelite.client.plugins.microbot.util.poh.PohTeleports; +import net.runelite.client.plugins.microbot.util.poh.PohTransport; import net.runelite.client.plugins.microbot.util.poh.data.*; import java.lang.reflect.Type; import java.util.*; +import java.util.stream.Collectors; @Slf4j public class Rs2PohCache extends Rs2Cache> implements CacheSerializable { @@ -59,6 +61,7 @@ public void onGameStateChanged(GameStateChanged event) { @Subscribe public void onDecorativeObjectSpawned(DecorativeObjectSpawned event) { DecorativeObject go = event.getDecorativeObject(); + if (go == null) return; if (MountedMythical.isMountedMythsCape(go)) { setTeleports(MountedMythical.class, List.of(MountedMythical.values())); } else if (MountedXerics.isMountedXerics(go)) { @@ -70,9 +73,26 @@ public void onDecorativeObjectSpawned(DecorativeObjectSpawned event) { } } + @Subscribe + public void onDecorativeObjectDespawned(DecorativeObjectDespawned event) { + DecorativeObject go = event.getDecorativeObject(); + if (go == null) return; + if (MountedMythical.isMountedMythsCape(go)) { + remove(MountedMythical.class.getSimpleName()); + } else if (MountedXerics.isMountedXerics(go)) { + remove(MountedXerics.class.getSimpleName()); + } else if (MountedDigsite.isMountedDigsite(go)) { + remove(MountedDigsite.class.getSimpleName()); + } else if (MountedGlory.isMountedGlory(go)) { + remove(MountedGlory.class.getSimpleName()); + } + } + @Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { + //TODO("Make sure we only add transport's when we're inside our own home.") GameObject go = event.getGameObject(); + if (go == null) return; PohPortal portal = PohPortal.getPohPortal(go); if (portal != null) { addTeleport(PohPortal.class, portal); @@ -81,7 +101,7 @@ public void onGameObjectSpawned(GameObjectSpawned event) { JewelleryBoxType jewelleryBoxType = JewelleryBoxType.getJewelleryBoxType(go); if (jewelleryBoxType != null) { setTeleports(JewelleryBox.class, jewelleryBoxType.getAvailableTeleports()); - }else if (NexusPortal.isNexusPortal(go)) { + } else if (NexusPortal.isNexusPortal(go)) { setTeleports(NexusPortal.class, NexusPortal.getAvailableTeleports()); } else if (PohTeleports.isFairyRing(go)) { log.info("Found fairy rings in POH"); @@ -89,26 +109,53 @@ public void onGameObjectSpawned(GameObjectSpawned event) { } } - private void addTeleport(Class> type, PohTeleport transport) { - String key = type.getSimpleName(); - List transports = get(key, ArrayList::new); - if (transports.contains(transport)) { + + @Subscribe + public void onGameObjectDespawned(GameObjectDespawned event) { + GameObject go = event.getGameObject(); + if (go == null) return; + PohPortal portal = PohPortal.getPohPortal(go); + if (portal != null) { + removeTeleport(PohPortal.class, portal); return; } - transports.add(transport); - put(key, transports); - log.info("Putting {} Teleport to {}", get(key).size(), key); + JewelleryBoxType jewelleryBoxType = JewelleryBoxType.getJewelleryBoxType(go); + if (jewelleryBoxType != null) { + remove(JewelleryBox.class.getSimpleName()); + } else if (NexusPortal.isNexusPortal(go)) { + remove(NexusPortal.class.getSimpleName()); + } else if (PohTeleports.isFairyRing(go)) { + log.info("Removing Fairy Rings from POH"); + remove("fairyRings"); + } } - private void setTeleports(Class> type, List transports) { + private void removeTeleport(Class> type, PohTeleport teleport) { String key = type.getSimpleName(); - put(key, Collections.unmodifiableList(transports)); - log.info("Putting {} Teleports to {}", get(key).size(), key); + List teleports = get(key, ArrayList::new); + if (!teleports.contains(teleport)) { + return; + } + teleports.remove(teleport); + put(key, teleports); + log.info("Removing {} Teleport from {}", teleport.name(), key); } - @Subscribe - public void onGameObjectDespawned(GameObjectDespawned event) { + private void addTeleport(Class> type, PohTeleport teleport) { + String key = type.getSimpleName(); + List teleports = get(key, ArrayList::new); + if (teleports.contains(teleport)) { + return; + } + teleports.add(teleport); + put(key, teleports); + log.info("Adding {} Teleport to {}", teleport.name(), key); + } + private void setTeleports(Class> type, List teleports) { + String key = type.getSimpleName(); + put(key, Collections.unmodifiableList(teleports)); + log.info("Putting {} Teleports to {}", get(key).size(), key); } @Override @@ -127,23 +174,24 @@ public boolean shouldPersist() { } public static boolean isTransportUsable(Transport transport) { + if (transport == null) return false; if (transport.getType() == TransportType.FAIRY_RING) { + //For fairy ring we only have to check if the cache contains the key return getInstance().containsKey("fairyRings"); } - return getTeleport(transport) != null; - } + // For anything else we have to see if the PohTeleport exists in the cache + if (!(transport instanceof PohTransport)) return false; - public static PohTeleport getTeleport(Transport transport) { - String key = transport.getEnumClass(); - String name = transport.getEnumValue(); - List obj = getInstance().get(key); - if (obj == null) return null; - - PohTeleport teleport = obj.stream() - .filter(pt -> pt.name().equals(name)) - .findFirst().orElse(null); + PohTransport pohTransport = (PohTransport) transport; + PohTeleport teleport = pohTransport.getTeleport(); + String key = teleport.getClass().getSimpleName(); + return getInstance().containsKey(key); + } - return teleport; + public static List getAvailableTransports() { + return getInstance().values().stream() + .flatMap(Collection::stream).map(PohTransport::new) + .collect(Collectors.toList()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/serialization/PohTeleportDataAdapter.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/serialization/PohTeleportDataAdapter.java index 41dddeec51f..dab352e513b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/serialization/PohTeleportDataAdapter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/serialization/PohTeleportDataAdapter.java @@ -3,6 +3,7 @@ import com.google.gson.*; import lombok.extern.slf4j.Slf4j; +import net.runelite.client.plugins.microbot.util.poh.PohTransport; import net.runelite.client.plugins.microbot.util.poh.data.PohTeleport; import java.lang.reflect.Type; @@ -24,10 +25,11 @@ public JsonElement serialize(Map> src, Type typeOfSrc, obj.addProperty("pohTeleport", entry.getKey()); JsonArray transports = new JsonArray(); - for (PohTeleport transport : entry.getValue()) { + for (PohTeleport teleport : entry.getValue()) { JsonObject tObj = new JsonObject(); - tObj.addProperty("class", transport.getClass().getName()); - tObj.addProperty("name", transport.name()); // assuming PohTransport is enum + + tObj.addProperty("class", teleport.getClass().getName()); + tObj.addProperty("name", teleport.name()); // assuming PohTeleport is enum transports.add(tObj); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java index 93ffd356183..c2dd8204db3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java @@ -2,6 +2,7 @@ import net.runelite.api.GameObject; import net.runelite.api.TileObject; +import net.runelite.api.coords.WorldPoint; import net.runelite.api.gameval.InterfaceID; import net.runelite.api.gameval.ObjectID; import net.runelite.api.widgets.Widget; @@ -11,6 +12,7 @@ import net.runelite.client.plugins.microbot.util.keyboard.Rs2Keyboard; import net.runelite.client.plugins.microbot.util.player.Rs2Player; import net.runelite.client.plugins.microbot.util.poh.data.HouseLocation; +import net.runelite.client.plugins.microbot.util.poh.data.HouseStyle; import net.runelite.client.plugins.microbot.util.poh.data.JewelleryBoxType; import net.runelite.client.plugins.microbot.util.poh.data.NexusPortal; import net.runelite.client.plugins.microbot.util.widget.Rs2Widget; @@ -18,6 +20,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import static net.runelite.client.plugins.microbot.util.Global.sleepUntil; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java new file mode 100644 index 00000000000..bdfabf00587 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java @@ -0,0 +1,39 @@ +package net.runelite.client.plugins.microbot.util.poh; + +import lombok.Getter; +import net.runelite.api.coords.WorldPoint; +import net.runelite.client.plugins.microbot.shortestpath.Transport; +import net.runelite.client.plugins.microbot.shortestpath.TransportType; +import net.runelite.client.plugins.microbot.util.poh.data.HouseStyle; +import net.runelite.client.plugins.microbot.util.poh.data.PohTeleport; + +public class PohTransport extends Transport { + + @Getter + private final PohTeleport teleport; + + public PohTransport(PohTeleport teleport) { + super(teleport.getDestination(), teleport.displayInfo(), TransportType.POH); + this.teleport = teleport; + } + + @Override + public WorldPoint getOrigin() { + HouseStyle style = HouseStyle.getStyle(); + return style != null ? style.getPohLocation() : new WorldPoint(-1, -1, -1); + } + + public boolean execute() { + return teleport.execute(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + PohTransport that = (PohTransport) o; + return teleport.equals(that.teleport); + } + +} 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 be61ed4096b..713dd9835e7 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 @@ -61,6 +61,8 @@ import net.runelite.client.plugins.microbot.util.player.Rs2Player; import net.runelite.client.plugins.microbot.util.player.Rs2Pvp; import net.runelite.client.plugins.microbot.util.poh.PohTeleports; +import net.runelite.client.plugins.microbot.util.poh.PohTransport; +import net.runelite.client.plugins.microbot.util.poh.data.HouseStyle; import net.runelite.client.plugins.microbot.util.poh.data.PohTeleport; import net.runelite.client.plugins.microbot.util.tabs.Rs2Tab; import net.runelite.client.plugins.microbot.util.tile.Rs2Tile; @@ -1409,8 +1411,9 @@ public static Tile getTile(WorldPoint point) { * @return */ private static boolean handleTransports(List path, int indexOfStartPoint) { - - for (Transport transport : ShortestPathPlugin.getTransports().getOrDefault(path.get(indexOfStartPoint), new HashSet<>())) { + Set transports = ShortestPathPlugin.getTransports().getOrDefault(path.get(indexOfStartPoint), new HashSet<>()); + log.debug("Found transports: {}", transports.stream().map(Transport::getDisplayInfo).collect(Collectors.joining(", "))); + for (Transport transport : transports) { Collection worldPointCollections; //in some cases the getOrigin is null, for teleports that start the player location if (transport.getOrigin() == null) { @@ -1418,6 +1421,7 @@ private static boolean handleTransports(List path, int indexOfStartP } else { worldPointCollections = WorldPoint.toLocalInstance(Microbot.getClient().getTopLevelWorldView(), transport.getOrigin()); } + log.debug("Considering transport: {}", transport.getDisplayInfo()); for (WorldPoint origin : worldPointCollections) { if (transport.getOrigin() != null && Rs2Player.getWorldLocation().getPlane() != transport.getOrigin().getPlane()) { continue; @@ -1626,11 +1630,10 @@ private static boolean handleTransports(List path, int indexOfStartP * @return true if the transport is an instance of PohTransport and its transport method executes successfully, false otherwise */ private static boolean handlePohTransport(Transport transport) { - PohTeleport teleport = Rs2PohCache.getTeleport(transport); - if(teleport == null) { - throw new IllegalStateException(String.format("PohTransport for Transport {} is null", transport)); + if(!(transport instanceof PohTransport)) { + throw new IllegalStateException("handlePohTransport should not be called for non-PohTransports"); } - return teleport.execute(); + return ((PohTransport)transport).execute(); } private static void handleObject(Transport transport, TileObject tileObject) { @@ -2579,25 +2582,28 @@ private static boolean handleFairyRing(Transport transport) { ObjectComposition composition = Rs2GameObject.convertToObjectComposition(fairyRingObject); log.info("Interacting with Fairy Ring @ {}", fairyRingObject.getWorldLocation()); + // we can use the last-destination to handle fairy rings if (Rs2GameObject.hasAction(composition, lastDestinationAction, true)) { - return Rs2GameObject.interact(fairyRingObject, lastDestinationAction); - }else if (Rs2GameObject.hasAction(composition, treeLastDestinationAction, true)) { - return Rs2GameObject.interact(fairyRingObject, treeLastDestinationAction); - } - if (Rs2GameObject.hasAction(composition, "Configure", true)) { - Rs2GameObject.interact(fairyRingObject, "Configure"); - } else if (Rs2GameObject.hasAction(composition, "Ring-configure", true)) { - Rs2GameObject.interact(fairyRingObject, "Ring-configure"); - } - sleepUntil(() -> !Rs2Player.isMoving() && !Rs2Widget.isHidden(ComponentID.FAIRY_RING_TELEPORT_BUTTON), 10000); + Rs2GameObject.interact(fairyRingObject, lastDestinationAction); + } else if (Rs2GameObject.hasAction(composition, treeLastDestinationAction, true)) { + Rs2GameObject.interact(fairyRingObject, treeLastDestinationAction); + } else { + // We have to configure fairy rings through the interface + if (Rs2GameObject.hasAction(composition, "Configure", true)) { + Rs2GameObject.interact(fairyRingObject, "Configure"); + } else if (Rs2GameObject.hasAction(composition, "Ring-configure", true)) { + Rs2GameObject.interact(fairyRingObject, "Ring-configure"); + } + sleepUntil(() -> !Rs2Player.isMoving() && !Rs2Widget.isHidden(ComponentID.FAIRY_RING_TELEPORT_BUTTON), 10000); - rotateSlotToDesiredRotation(SLOT_ONE, Rs2Widget.getWidget(SLOT_ONE).getRotationY(), getDesiredRotation(transport.getDisplayInfo().charAt(0)), SLOT_ONE_ACW_ROTATION, SLOT_ONE_CW_ROTATION); - rotateSlotToDesiredRotation(SLOT_TWO, Rs2Widget.getWidget(SLOT_TWO).getRotationY(), getDesiredRotation(transport.getDisplayInfo().charAt(1)), SLOT_TWO_ACW_ROTATION, SLOT_TWO_CW_ROTATION); - rotateSlotToDesiredRotation(SLOT_THREE, Rs2Widget.getWidget(SLOT_THREE).getRotationY(), getDesiredRotation(transport.getDisplayInfo().charAt(2)), SLOT_THREE_ACW_ROTATION, SLOT_THREE_CW_ROTATION); - Rs2Widget.clickWidget(ComponentID.FAIRY_RING_TELEPORT_BUTTON); + rotateSlotToDesiredRotation(SLOT_ONE, Rs2Widget.getWidget(SLOT_ONE).getRotationY(), getDesiredRotation(transport.getDisplayInfo().charAt(0)), SLOT_ONE_ACW_ROTATION, SLOT_ONE_CW_ROTATION); + rotateSlotToDesiredRotation(SLOT_TWO, Rs2Widget.getWidget(SLOT_TWO).getRotationY(), getDesiredRotation(transport.getDisplayInfo().charAt(1)), SLOT_TWO_ACW_ROTATION, SLOT_TWO_CW_ROTATION); + rotateSlotToDesiredRotation(SLOT_THREE, Rs2Widget.getWidget(SLOT_THREE).getRotationY(), getDesiredRotation(transport.getDisplayInfo().charAt(2)), SLOT_THREE_ACW_ROTATION, SLOT_THREE_CW_ROTATION); + Rs2Widget.clickWidget(ComponentID.FAIRY_RING_TELEPORT_BUTTON); + } - sleepUntil(() -> Rs2Player.hasSpotAnimation(fairyRingGraphicId)); - sleepUntil(() -> Objects.equals(Rs2Player.getWorldLocation(), transport.getDestination()) && !Rs2Player.hasSpotAnimation(fairyRingGraphicId), 10000); + sleepUntil(() -> Rs2Player.getGraphicId() == fairyRingGraphicId); + sleepUntil(() -> Objects.equals(Rs2Player.getWorldLocation(), transport.getDestination()) && Rs2Player.getGraphicId() != fairyRingGraphicId, 10000); if (startingWeapon != null) { Rs2ItemModel finalStartingWeapon = startingWeapon; diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_poh.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_poh.tsv deleted file mode 100644 index 44a3f0f60e0..00000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_poh.tsv +++ /dev/null @@ -1,298 +0,0 @@ -Origin Destination isMembers EnumValue EnumClass Display info Wilderness level Duration -1858 5707 0 3213 3424 0 Y VARROCK NexusPortal NexusTeleport -> Varrock 19 6 -1922 5707 2 3213 3424 0 Y VARROCK NexusPortal NexusTeleport -> Varrock 19 6 -1986 5707 0 3213 3424 0 Y VARROCK NexusPortal NexusTeleport -> Varrock 19 6 -1858 5707 0 3164 3478 0 Y VARROCK_GE NexusPortal NexusTeleport -> Grand Exchange 19 6 -1922 5707 2 3164 3478 0 Y VARROCK_GE NexusPortal NexusTeleport -> Grand Exchange 19 6 -1986 5707 0 3164 3478 0 Y VARROCK_GE NexusPortal NexusTeleport -> Grand Exchange 19 6 -1858 5707 0 3222 3218 0 Y LUMBRIDGE NexusPortal NexusTeleport -> Lumbridge 19 6 -1922 5707 2 3222 3218 0 Y LUMBRIDGE NexusPortal NexusTeleport -> Lumbridge 19 6 -1986 5707 0 3222 3218 0 Y LUMBRIDGE NexusPortal NexusTeleport -> Lumbridge 19 6 -1858 5707 0 2965 3381 0 Y FALADOR NexusPortal NexusTeleport -> Falador 19 6 -1922 5707 2 2965 3381 0 Y FALADOR NexusPortal NexusTeleport -> Falador 19 6 -1986 5707 0 2965 3381 0 Y FALADOR NexusPortal NexusTeleport -> Falador 19 6 -1858 5707 0 2757 3477 0 Y CAMELOT NexusPortal NexusTeleport -> Camelot 19 6 -1922 5707 2 2757 3477 0 Y CAMELOT NexusPortal NexusTeleport -> Camelot 19 6 -1986 5707 0 2757 3477 0 Y CAMELOT NexusPortal NexusTeleport -> Camelot 19 6 -1858 5707 0 1643 3672 0 Y KOUREND NexusPortal NexusTeleport -> Kourend Castle 19 6 -1922 5707 2 1643 3672 0 Y KOUREND NexusPortal NexusTeleport -> Kourend Castle 19 6 -1986 5707 0 1643 3672 0 Y KOUREND NexusPortal NexusTeleport -> Kourend Castle 19 6 -1858 5707 0 2664 3306 0 Y ARDOUGNE NexusPortal NexusTeleport -> Ardougne 19 6 -1922 5707 2 2664 3306 0 Y ARDOUGNE NexusPortal NexusTeleport -> Ardougne 19 6 -1986 5707 0 2664 3306 0 Y ARDOUGNE NexusPortal NexusTeleport -> Ardougne 19 6 -1858 5707 0 2547 3114 0 Y WATCHTOWER NexusPortal NexusTeleport -> Watchtower 19 6 -1922 5707 2 2547 3114 0 Y WATCHTOWER NexusPortal NexusTeleport -> Watchtower 19 6 -1986 5707 0 2547 3114 0 Y WATCHTOWER NexusPortal NexusTeleport -> Watchtower 19 6 -1858 5707 0 2796 2791 0 Y MARIM NexusPortal NexusTeleport -> Marim 19 6 -1922 5707 2 2796 2791 0 Y MARIM NexusPortal NexusTeleport -> Marim 19 6 -1986 5707 0 2796 2791 0 Y MARIM NexusPortal NexusTeleport -> Marim 19 6 -1858 5707 0 3319 3336 0 Y SENNTISTEN NexusPortal NexusTeleport -> Senntisten 19 6 -1922 5707 2 3319 3336 0 Y SENNTISTEN NexusPortal NexusTeleport -> Senntisten 19 6 -1986 5707 0 3319 3336 0 Y SENNTISTEN NexusPortal NexusTeleport -> Senntisten 19 6 -1858 5707 0 3494 3473 0 Y KHARYRLL NexusPortal NexusTeleport -> Kharyrll 19 6 -1922 5707 2 3494 3473 0 Y KHARYRLL NexusPortal NexusTeleport -> Kharyrll 19 6 -1986 5707 0 3494 3473 0 Y KHARYRLL NexusPortal NexusTeleport -> Kharyrll 19 6 -1858 5707 0 3157 3667 0 Y CARRALLANGER NexusPortal NexusTeleport -> Carrallanger 19 6 -1922 5707 2 3157 3667 0 Y CARRALLANGER NexusPortal NexusTeleport -> Carrallanger 19 6 -1986 5707 0 3157 3667 0 Y CARRALLANGER NexusPortal NexusTeleport -> Carrallanger 19 6 -1858 5707 0 2546 3755 0 Y WATERBIRTH NexusPortal NexusTeleport -> Waterbirth Island 19 6 -1922 5707 2 2546 3755 0 Y WATERBIRTH NexusPortal NexusTeleport -> Waterbirth Island 19 6 -1986 5707 0 2546 3755 0 Y WATERBIRTH NexusPortal NexusTeleport -> Waterbirth Island 19 6 -1858 5707 0 3288 3888 0 Y ANNAKARL NexusPortal NexusTeleport -> Annakarl 19 6 -1922 5707 2 3288 3888 0 Y ANNAKARL NexusPortal NexusTeleport -> Annakarl 19 6 -1986 5707 0 3288 3888 0 Y ANNAKARL NexusPortal NexusTeleport -> Annakarl 19 6 -1858 5707 0 2977 3872 0 Y GHORROCK NexusPortal NexusTeleport -> Ghorrock 19 6 -1922 5707 2 2977 3872 0 Y GHORROCK NexusPortal NexusTeleport -> Ghorrock 19 6 -1986 5707 0 2977 3872 0 Y GHORROCK NexusPortal NexusTeleport -> Ghorrock 19 6 -1858 5707 0 2113 3915 0 Y LUNAR_ISLE NexusPortal NexusTeleport -> Lunar Isle 19 6 -1922 5707 2 2113 3915 0 Y LUNAR_ISLE NexusPortal NexusTeleport -> Lunar Isle 19 6 -1986 5707 0 2113 3915 0 Y LUNAR_ISLE NexusPortal NexusTeleport -> Lunar Isle 19 6 -1858 5707 0 2802 3449 0 Y CATHERBY NexusPortal NexusTeleport -> Catherby 19 6 -1922 5707 2 2802 3449 0 Y CATHERBY NexusPortal NexusTeleport -> Catherby 19 6 -1986 5707 0 2802 3449 0 Y CATHERBY NexusPortal NexusTeleport -> Catherby 19 6 -1858 5707 0 2612 3391 0 Y FISHING_GUILD NexusPortal NexusTeleport -> Fishing Guild 19 6 -1922 5707 2 2612 3391 0 Y FISHING_GUILD NexusPortal NexusTeleport -> Fishing Guild 19 6 -1986 5707 0 2612 3391 0 Y FISHING_GUILD NexusPortal NexusTeleport -> Fishing Guild 19 6 -1858 5707 0 2891 3678 0 Y TROLL_STRONGHOLD NexusPortal NexusTeleport -> Troll Stronghold 19 6 -1922 5707 2 2891 3678 0 Y TROLL_STRONGHOLD NexusPortal NexusTeleport -> Troll Stronghold 19 6 -1986 5707 0 2891 3678 0 Y TROLL_STRONGHOLD NexusPortal NexusTeleport -> Troll Stronghold 19 6 -1858 5707 0 2846 3940 0 Y WEISS NexusPortal NexusTeleport -> Weiss 19 6 -1922 5707 2 2846 3940 0 Y WEISS NexusPortal NexusTeleport -> Weiss 19 6 -1986 5707 0 2846 3940 0 Y WEISS NexusPortal NexusTeleport -> Weiss 19 6 -1858 5707 0 1632 3838 0 Y ARCEUUS_LIBRARY NexusPortal NexusTeleport -> Arceuus Library 19 6 -1922 5707 2 1632 3838 0 Y ARCEUUS_LIBRARY NexusPortal NexusTeleport -> Arceuus Library 19 6 -1986 5707 0 1632 3838 0 Y ARCEUUS_LIBRARY NexusPortal NexusTeleport -> Arceuus Library 19 6 -1858 5707 0 3108 3352 0 Y DRAYNOR_MANOR NexusPortal NexusTeleport -> Draynor Manor 19 6 -1922 5707 2 3108 3352 0 Y DRAYNOR_MANOR NexusPortal NexusTeleport -> Draynor Manor 19 6 -1986 5707 0 3108 3352 0 Y DRAYNOR_MANOR NexusPortal NexusTeleport -> Draynor Manor 19 6 -1858 5707 0 1349 3739 0 Y BATTLEFRONT NexusPortal NexusTeleport -> Battlefront 19 6 -1922 5707 2 1349 3739 0 Y BATTLEFRONT NexusPortal NexusTeleport -> Battlefront 19 6 -1986 5707 0 1349 3739 0 Y BATTLEFRONT NexusPortal NexusTeleport -> Battlefront 19 6 -1858 5707 0 2979 3509 0 Y MIND_ALTAR NexusPortal NexusTeleport -> Mind Altar 19 6 -1922 5707 2 2979 3509 0 Y MIND_ALTAR NexusPortal NexusTeleport -> Mind Altar 19 6 -1986 5707 0 2979 3509 0 Y MIND_ALTAR NexusPortal NexusTeleport -> Mind Altar 19 6 -1858 5707 0 3433 3461 0 Y SALVE_GRAVEYARD NexusPortal NexusTeleport -> Salve Graveyard 19 6 -1922 5707 2 3433 3461 0 Y SALVE_GRAVEYARD NexusPortal NexusTeleport -> Salve Graveyard 19 6 -1986 5707 0 3433 3461 0 Y SALVE_GRAVEYARD NexusPortal NexusTeleport -> Salve Graveyard 19 6 -1858 5707 0 3548 3528 0 Y FENKENSTRAINS_CASTLE NexusPortal NexusTeleport -> Fenken' Castle 19 6 -1922 5707 2 3548 3528 0 Y FENKENSTRAINS_CASTLE NexusPortal NexusTeleport -> Fenken' Castle 19 6 -1986 5707 0 3548 3528 0 Y FENKENSTRAINS_CASTLE NexusPortal NexusTeleport -> Fenken' Castle 19 6 -1858 5707 0 2500 3291 0 Y WEST_ARDOUGNE NexusPortal NexusTeleport -> West Ardougne 19 6 -1922 5707 2 2500 3291 0 Y WEST_ARDOUGNE NexusPortal NexusTeleport -> West Ardougne 19 6 -1986 5707 0 2500 3291 0 Y WEST_ARDOUGNE NexusPortal NexusTeleport -> West Ardougne 19 6 -1858 5707 0 3797 2866 0 Y HARMONY_ISLAND NexusPortal NexusTeleport -> Harmony Island 19 6 -1922 5707 2 3797 2866 0 Y HARMONY_ISLAND NexusPortal NexusTeleport -> Harmony Island 19 6 -1986 5707 0 3797 2866 0 Y HARMONY_ISLAND NexusPortal NexusTeleport -> Harmony Island 19 6 -1858 5707 0 2978 3763 0 Y CEMETERY NexusPortal NexusTeleport -> Cemetery 19 6 -1922 5707 2 2978 3763 0 Y CEMETERY NexusPortal NexusTeleport -> Cemetery 19 6 -1986 5707 0 2978 3763 0 Y CEMETERY NexusPortal NexusTeleport -> Cemetery 19 6 -1858 5707 0 3565 3315 0 Y BARROWS NexusPortal NexusTeleport -> Barrows 19 6 -1922 5707 2 3565 3315 0 Y BARROWS NexusPortal NexusTeleport -> Barrows 19 6 -1986 5707 0 3565 3315 0 Y BARROWS NexusPortal NexusTeleport -> Barrows 19 6 -1858 5707 0 2770 2703 0 Y APE_ATOLL_DUNGEON NexusPortal NexusTeleport -> Ape Atoll Dungeon 19 6 -1922 5707 2 2770 2703 0 Y APE_ATOLL_DUNGEON NexusPortal NexusTeleport -> Ape Atoll Dungeon 19 6 -1986 5707 0 2770 2703 0 Y APE_ATOLL_DUNGEON NexusPortal NexusTeleport -> Ape Atoll Dungeon 19 6 -1858 5707 0 1681 3133 0 Y CIVITAS_ILLA_FORTIS NexusPortal NexusTeleport -> Civitas illa Fortis 19 6 -1922 5707 2 1681 3133 0 Y CIVITAS_ILLA_FORTIS NexusPortal NexusTeleport -> Civitas illa Fortis 19 6 -1986 5707 0 1681 3133 0 Y CIVITAS_ILLA_FORTIS NexusPortal NexusTeleport -> Civitas illa Fortis 19 6 -1858 5707 0 3763 3869 0 Y FOSSIL_ISLAND MountedDigsite MountedDigsite -> Fossil Island 19 4 -1922 5707 2 3763 3869 0 Y FOSSIL_ISLAND MountedDigsite MountedDigsite -> Fossil Island 19 4 -1986 5707 0 3763 3869 0 Y FOSSIL_ISLAND MountedDigsite MountedDigsite -> Fossil Island 19 4 -1858 5707 0 3339 3445 0 Y DIGSITE MountedDigsite MountedDigsite -> Digsite 19 4 -1922 5707 2 3339 3445 0 Y DIGSITE MountedDigsite MountedDigsite -> Digsite 19 4 -1986 5707 0 3339 3445 0 Y DIGSITE MountedDigsite MountedDigsite -> Digsite 19 4 -1858 5707 0 3547 10456 0 Y LITHKREN MountedDigsite MountedDigsite -> Lithkren 19 4 -1922 5707 2 3547 10456 0 Y LITHKREN MountedDigsite MountedDigsite -> Lithkren 19 4 -1986 5707 0 3547 10456 0 Y LITHKREN MountedDigsite MountedDigsite -> Lithkren 19 4 -1858 5707 0 3087 3496 0 Y EDGEVILLE MountedGlory MountedGlory -> Edgeville 19 4 -1922 5707 2 3087 3496 0 Y EDGEVILLE MountedGlory MountedGlory -> Edgeville 19 4 -1986 5707 0 3087 3496 0 Y EDGEVILLE MountedGlory MountedGlory -> Edgeville 19 4 -1858 5707 0 2918 3176 0 Y KARAMJA MountedGlory MountedGlory -> Karamja 19 4 -1922 5707 2 2918 3176 0 Y KARAMJA MountedGlory MountedGlory -> Karamja 19 4 -1986 5707 0 2918 3176 0 Y KARAMJA MountedGlory MountedGlory -> Karamja 19 4 -1858 5707 0 3105 3251 0 Y DRAYNOR_VILLAGE MountedGlory MountedGlory -> Draynor Village 19 4 -1922 5707 2 3105 3251 0 Y DRAYNOR_VILLAGE MountedGlory MountedGlory -> Draynor Village 19 4 -1986 5707 0 3105 3251 0 Y DRAYNOR_VILLAGE MountedGlory MountedGlory -> Draynor Village 19 4 -1858 5707 0 3293 3163 0 Y AL_KHARID MountedGlory MountedGlory -> Al Kharid 19 4 -1922 5707 2 3293 3163 0 Y AL_KHARID MountedGlory MountedGlory -> Al Kharid 19 4 -1986 5707 0 3293 3163 0 Y AL_KHARID MountedGlory MountedGlory -> Al Kharid 19 4 -1858 5707 0 2520 3571 0 Y BARBARIAN_ASSAULT JewelleryBox JewelleryBox -> BARBARIAN_ASSAULT 19 6 -1922 5707 2 2520 3571 0 Y BARBARIAN_ASSAULT JewelleryBox JewelleryBox -> BARBARIAN_ASSAULT 19 6 -1986 5707 0 2520 3571 0 Y BARBARIAN_ASSAULT JewelleryBox JewelleryBox -> BARBARIAN_ASSAULT 19 6 -1858 5707 0 2898 3554 0 Y BURTHORPE_GAMES_ROOM JewelleryBox JewelleryBox -> BURTHORPE_GAMES_ROOM 19 6 -1922 5707 2 2898 3554 0 Y BURTHORPE_GAMES_ROOM JewelleryBox JewelleryBox -> BURTHORPE_GAMES_ROOM 19 6 -1986 5707 0 2898 3554 0 Y BURTHORPE_GAMES_ROOM JewelleryBox JewelleryBox -> BURTHORPE_GAMES_ROOM 19 6 -1858 5707 0 3245 9500 0 Y TEARS_OF_GUTHIX JewelleryBox JewelleryBox -> TEARS_OF_GUTHIX 19 6 -1922 5707 2 3245 9500 0 Y TEARS_OF_GUTHIX JewelleryBox JewelleryBox -> TEARS_OF_GUTHIX 19 6 -1986 5707 0 3245 9500 0 Y TEARS_OF_GUTHIX JewelleryBox JewelleryBox -> TEARS_OF_GUTHIX 19 6 -1858 5707 0 2967 4384 0 Y CORPOREAL_BEAST JewelleryBox JewelleryBox -> CORPOREAL_BEAST 19 6 -1922 5707 2 2967 4384 0 Y CORPOREAL_BEAST JewelleryBox JewelleryBox -> CORPOREAL_BEAST 19 6 -1986 5707 0 2967 4384 0 Y CORPOREAL_BEAST JewelleryBox JewelleryBox -> CORPOREAL_BEAST 19 6 -1858 5707 0 1624 3938 0 Y WINTERTODT_CAMP JewelleryBox JewelleryBox -> WINTERTODT_CAMP 19 6 -1922 5707 2 1624 3938 0 Y WINTERTODT_CAMP JewelleryBox JewelleryBox -> WINTERTODT_CAMP 19 6 -1986 5707 0 1624 3938 0 Y WINTERTODT_CAMP JewelleryBox JewelleryBox -> WINTERTODT_CAMP 19 6 -1858 5707 0 3315 3235 0 Y PVP_ARENA JewelleryBox JewelleryBox -> PVP_ARENA 19 6 -1922 5707 2 3315 3235 0 Y PVP_ARENA JewelleryBox JewelleryBox -> PVP_ARENA 19 6 -1986 5707 0 3315 3235 0 Y PVP_ARENA JewelleryBox JewelleryBox -> PVP_ARENA 19 6 -1858 5707 0 3151 3636 0 Y FEROX_ENCLAVE JewelleryBox JewelleryBox -> FEROX_ENCLAVE 19 6 -1922 5707 2 3151 3636 0 Y FEROX_ENCLAVE JewelleryBox JewelleryBox -> FEROX_ENCLAVE 19 6 -1986 5707 0 3151 3636 0 Y FEROX_ENCLAVE JewelleryBox JewelleryBox -> FEROX_ENCLAVE 19 6 -1858 5707 0 2441 3091 0 Y CASTLE_WARS JewelleryBox JewelleryBox -> CASTLE_WARS 19 6 -1922 5707 2 2441 3091 0 Y CASTLE_WARS JewelleryBox JewelleryBox -> CASTLE_WARS 19 6 -1986 5707 0 2441 3091 0 Y CASTLE_WARS JewelleryBox JewelleryBox -> CASTLE_WARS 19 6 -1858 5707 0 1793 3107 0 Y FORTIS_COLOSSEUM JewelleryBox JewelleryBox -> FORTIS_COLOSSEUM 19 6 -1922 5707 2 1793 3107 0 Y FORTIS_COLOSSEUM JewelleryBox JewelleryBox -> FORTIS_COLOSSEUM 19 6 -1986 5707 0 1793 3107 0 Y FORTIS_COLOSSEUM JewelleryBox JewelleryBox -> FORTIS_COLOSSEUM 19 6 -1858 5707 0 2883 3549 0 Y WARRIORS_GUILD JewelleryBox JewelleryBox -> WARRIORS_GUILD 19 6 -1922 5707 2 2883 3549 0 Y WARRIORS_GUILD JewelleryBox JewelleryBox -> WARRIORS_GUILD 19 6 -1986 5707 0 2883 3549 0 Y WARRIORS_GUILD JewelleryBox JewelleryBox -> WARRIORS_GUILD 19 6 -1858 5707 0 3189 3368 0 Y CHAMPIONS_GUILD JewelleryBox JewelleryBox -> CHAMPIONS_GUILD 19 6 -1922 5707 2 3189 3368 0 Y CHAMPIONS_GUILD JewelleryBox JewelleryBox -> CHAMPIONS_GUILD 19 6 -1986 5707 0 3189 3368 0 Y CHAMPIONS_GUILD JewelleryBox JewelleryBox -> CHAMPIONS_GUILD 19 6 -1858 5707 0 3053 3487 0 Y EDGEVILLE_MONASTERY JewelleryBox JewelleryBox -> EDGEVILLE_MONASTERY 19 6 -1922 5707 2 3053 3487 0 Y EDGEVILLE_MONASTERY JewelleryBox JewelleryBox -> EDGEVILLE_MONASTERY 19 6 -1986 5707 0 3053 3487 0 Y EDGEVILLE_MONASTERY JewelleryBox JewelleryBox -> EDGEVILLE_MONASTERY 19 6 -1858 5707 0 2654 3441 0 Y RANGING_GUILD JewelleryBox JewelleryBox -> RANGING_GUILD 19 6 -1922 5707 2 2654 3441 0 Y RANGING_GUILD JewelleryBox JewelleryBox -> RANGING_GUILD 19 6 -1986 5707 0 2654 3441 0 Y RANGING_GUILD JewelleryBox JewelleryBox -> RANGING_GUILD 19 6 -1858 5707 0 2613 3390 0 Y FISHING_GUILD_NECK JewelleryBox JewelleryBox -> FISHING_GUILD_NECK 19 6 -1922 5707 2 2613 3390 0 Y FISHING_GUILD_NECK JewelleryBox JewelleryBox -> FISHING_GUILD_NECK 19 6 -1986 5707 0 2613 3390 0 Y FISHING_GUILD_NECK JewelleryBox JewelleryBox -> FISHING_GUILD_NECK 19 6 -1858 5707 0 3049 9762 0 Y MINING_GUILD JewelleryBox JewelleryBox -> MINING_GUILD 19 6 -1922 5707 2 3049 9762 0 Y MINING_GUILD JewelleryBox JewelleryBox -> MINING_GUILD 19 6 -1986 5707 0 3049 9762 0 Y MINING_GUILD JewelleryBox JewelleryBox -> MINING_GUILD 19 6 -1858 5707 0 2934 3294 0 Y CRAFTING_GUILD JewelleryBox JewelleryBox -> CRAFTING_GUILD 19 6 -1922 5707 2 2934 3294 0 Y CRAFTING_GUILD JewelleryBox JewelleryBox -> CRAFTING_GUILD 19 6 -1986 5707 0 2934 3294 0 Y CRAFTING_GUILD JewelleryBox JewelleryBox -> CRAFTING_GUILD 19 6 -1858 5707 0 3145 3438 0 Y COOKING_GUILD JewelleryBox JewelleryBox -> COOKING_GUILD 19 6 -1922 5707 2 3145 3438 0 Y COOKING_GUILD JewelleryBox JewelleryBox -> COOKING_GUILD 19 6 -1986 5707 0 3145 3438 0 Y COOKING_GUILD JewelleryBox JewelleryBox -> COOKING_GUILD 19 6 -1858 5707 0 1662 3505 0 Y WOODCUTTING_GUILD JewelleryBox JewelleryBox -> WOODCUTTING_GUILD 19 6 -1922 5707 2 1662 3505 0 Y WOODCUTTING_GUILD JewelleryBox JewelleryBox -> WOODCUTTING_GUILD 19 6 -1986 5707 0 1662 3505 0 Y WOODCUTTING_GUILD JewelleryBox JewelleryBox -> WOODCUTTING_GUILD 19 6 -1858 5707 0 1249 3717 0 Y FARMING_GUILD JewelleryBox JewelleryBox -> FARMING_GUILD 19 6 -1922 5707 2 1249 3717 0 Y FARMING_GUILD JewelleryBox JewelleryBox -> FARMING_GUILD 19 6 -1986 5707 0 1249 3717 0 Y FARMING_GUILD JewelleryBox JewelleryBox -> FARMING_GUILD 19 6 -1858 5707 0 3087 3496 0 Y EDGEVILLE JewelleryBox JewelleryBox -> EDGEVILLE 19 6 -1922 5707 2 3087 3496 0 Y EDGEVILLE JewelleryBox JewelleryBox -> EDGEVILLE 19 6 -1986 5707 0 3087 3496 0 Y EDGEVILLE JewelleryBox JewelleryBox -> EDGEVILLE 19 6 -1858 5707 0 2918 3176 0 Y KARAMJA JewelleryBox JewelleryBox -> KARAMJA 19 6 -1922 5707 2 2918 3176 0 Y KARAMJA JewelleryBox JewelleryBox -> KARAMJA 19 6 -1986 5707 0 2918 3176 0 Y KARAMJA JewelleryBox JewelleryBox -> KARAMJA 19 6 -1858 5707 0 3105 3251 0 Y DRAYNOR_VILLAGE JewelleryBox JewelleryBox -> DRAYNOR_VILLAGE 19 6 -1922 5707 2 3105 3251 0 Y DRAYNOR_VILLAGE JewelleryBox JewelleryBox -> DRAYNOR_VILLAGE 19 6 -1986 5707 0 3105 3251 0 Y DRAYNOR_VILLAGE JewelleryBox JewelleryBox -> DRAYNOR_VILLAGE 19 6 -1858 5707 0 3293 3163 0 Y AL_KHARID JewelleryBox JewelleryBox -> AL_KHARID 19 6 -1922 5707 2 3293 3163 0 Y AL_KHARID JewelleryBox JewelleryBox -> AL_KHARID 19 6 -1986 5707 0 3293 3163 0 Y AL_KHARID JewelleryBox JewelleryBox -> AL_KHARID 19 6 -1858 5707 0 2535 3862 0 Y MISCELLANIA JewelleryBox JewelleryBox -> MISCELLANIA 19 6 -1922 5707 2 2535 3862 0 Y MISCELLANIA JewelleryBox JewelleryBox -> MISCELLANIA 19 6 -1986 5707 0 2535 3862 0 Y MISCELLANIA JewelleryBox JewelleryBox -> MISCELLANIA 19 6 -1858 5707 0 3162 3480 0 Y GRAND_EXCHANGE JewelleryBox JewelleryBox -> GRAND_EXCHANGE 19 6 -1922 5707 2 3162 3480 0 Y GRAND_EXCHANGE JewelleryBox JewelleryBox -> GRAND_EXCHANGE 19 6 -1986 5707 0 3162 3480 0 Y GRAND_EXCHANGE JewelleryBox JewelleryBox -> GRAND_EXCHANGE 19 6 -1858 5707 0 2995 3375 0 Y FALADOR_PARK JewelleryBox JewelleryBox -> FALADOR_PARK 19 6 -1922 5707 2 2995 3375 0 Y FALADOR_PARK JewelleryBox JewelleryBox -> FALADOR_PARK 19 6 -1986 5707 0 2995 3375 0 Y FALADOR_PARK JewelleryBox JewelleryBox -> FALADOR_PARK 19 6 -1858 5707 0 2831 10165 0 Y DONDAKAN JewelleryBox JewelleryBox -> DONDAKAN 19 6 -1922 5707 2 2831 10165 0 Y DONDAKAN JewelleryBox JewelleryBox -> DONDAKAN 19 6 -1986 5707 0 2831 10165 0 Y DONDAKAN JewelleryBox JewelleryBox -> DONDAKAN 19 6 -1858 5707 0 3213 3424 0 Y VARROCK PohPortal PoHPortal -> Varrock 19 4 -1922 5707 2 3213 3424 0 Y VARROCK PohPortal PoHPortal -> Varrock 19 4 -1986 5707 0 3213 3424 0 Y VARROCK PohPortal PoHPortal -> Varrock 19 4 -1858 5707 0 3162 3480 0 Y GRAND_EXCHANGE PohPortal PoHPortal -> Grand Exchange 19 4 -1922 5707 2 3162 3480 0 Y GRAND_EXCHANGE PohPortal PoHPortal -> Grand Exchange 19 4 -1986 5707 0 3162 3480 0 Y GRAND_EXCHANGE PohPortal PoHPortal -> Grand Exchange 19 4 -1858 5707 0 3222 3218 0 Y LUMBRIDGE PohPortal PoHPortal -> Lumbridge 19 4 -1922 5707 2 3222 3218 0 Y LUMBRIDGE PohPortal PoHPortal -> Lumbridge 19 4 -1986 5707 0 3222 3218 0 Y LUMBRIDGE PohPortal PoHPortal -> Lumbridge 19 4 -1858 5707 0 2965 3381 0 Y FALADOR PohPortal PoHPortal -> Falador 19 4 -1922 5707 2 2965 3381 0 Y FALADOR PohPortal PoHPortal -> Falador 19 4 -1986 5707 0 2965 3381 0 Y FALADOR PohPortal PoHPortal -> Falador 19 4 -1858 5707 0 2757 3477 0 Y CAMELOT PohPortal PoHPortal -> Camelot 19 4 -1922 5707 2 2757 3477 0 Y CAMELOT PohPortal PoHPortal -> Camelot 19 4 -1986 5707 0 2757 3477 0 Y CAMELOT PohPortal PoHPortal -> Camelot 19 4 -1858 5707 0 2664 3306 0 Y ARDOUGNE PohPortal PoHPortal -> Ardougne 19 4 -1922 5707 2 2664 3306 0 Y ARDOUGNE PohPortal PoHPortal -> Ardougne 19 4 -1986 5707 0 2664 3306 0 Y ARDOUGNE PohPortal PoHPortal -> Ardougne 19 4 -1858 5707 0 2547 3114 0 Y WATCHTOWER PohPortal PoHPortal -> Watchtower 19 4 -1922 5707 2 2547 3114 0 Y WATCHTOWER PohPortal PoHPortal -> Watchtower 19 4 -1986 5707 0 2547 3114 0 Y WATCHTOWER PohPortal PoHPortal -> Watchtower 19 4 -1858 5707 0 2891 3678 0 Y TROLL_STRONGHOLD PohPortal PoHPortal -> Troll Stronghold 19 4 -1922 5707 2 2891 3678 0 Y TROLL_STRONGHOLD PohPortal PoHPortal -> Troll Stronghold 19 4 -1986 5707 0 2891 3678 0 Y TROLL_STRONGHOLD PohPortal PoHPortal -> Troll Stronghold 19 4 -1858 5707 0 2796 2791 0 Y APE_ATOLL PohPortal PoHPortal -> Ape Atoll 19 4 -1922 5707 2 2796 2791 0 Y APE_ATOLL PohPortal PoHPortal -> Ape Atoll 19 4 -1986 5707 0 2796 2791 0 Y APE_ATOLL PohPortal PoHPortal -> Ape Atoll 19 4 -1858 5707 0 1643 3672 0 Y KOUREND_CASTLE PohPortal PoHPortal -> Kourend Castle 19 4 -1922 5707 2 1643 3672 0 Y KOUREND_CASTLE PohPortal PoHPortal -> Kourend Castle 19 4 -1986 5707 0 1643 3672 0 Y KOUREND_CASTLE PohPortal PoHPortal -> Kourend Castle 19 4 -1858 5707 0 3319 3336 0 Y SENNTISTEN PohPortal PoHPortal -> Senntisten 19 4 -1922 5707 2 3319 3336 0 Y SENNTISTEN PohPortal PoHPortal -> Senntisten 19 4 -1986 5707 0 3319 3336 0 Y SENNTISTEN PohPortal PoHPortal -> Senntisten 19 4 -1858 5707 0 3494 3473 0 Y KHARYRLL PohPortal PoHPortal -> Kharyrll 19 4 -1922 5707 2 3494 3473 0 Y KHARYRLL PohPortal PoHPortal -> Kharyrll 19 4 -1986 5707 0 3494 3473 0 Y KHARYRLL PohPortal PoHPortal -> Kharyrll 19 4 -1858 5707 0 3157 3667 0 Y CARRALLANGAR PohPortal PoHPortal -> Carrallangar 19 4 -1922 5707 2 3157 3667 0 Y CARRALLANGAR PohPortal PoHPortal -> Carrallangar 19 4 -1986 5707 0 3157 3667 0 Y CARRALLANGAR PohPortal PoHPortal -> Carrallangar 19 4 -1858 5707 0 3288 3888 0 Y ANNAKARL PohPortal PoHPortal -> Annakarl 19 4 -1922 5707 2 3288 3888 0 Y ANNAKARL PohPortal PoHPortal -> Annakarl 19 4 -1986 5707 0 3288 3888 0 Y ANNAKARL PohPortal PoHPortal -> Annakarl 19 4 -1858 5707 0 2977 3872 0 Y GHORROCK PohPortal PoHPortal -> Ghorrock 19 4 -1922 5707 2 2977 3872 0 Y GHORROCK PohPortal PoHPortal -> Ghorrock 19 4 -1986 5707 0 2977 3872 0 Y GHORROCK PohPortal PoHPortal -> Ghorrock 19 4 -1858 5707 0 2113 3915 0 Y LUNAR_ISLE PohPortal PoHPortal -> Lunar Isle 19 4 -1922 5707 2 2113 3915 0 Y LUNAR_ISLE PohPortal PoHPortal -> Lunar Isle 19 4 -1986 5707 0 2113 3915 0 Y LUNAR_ISLE PohPortal PoHPortal -> Lunar Isle 19 4 -1858 5707 0 2546 3755 0 Y WATERBIRTH PohPortal PoHPortal -> Waterbirth 19 4 -1922 5707 2 2546 3755 0 Y WATERBIRTH PohPortal PoHPortal -> Waterbirth 19 4 -1986 5707 0 2546 3755 0 Y WATERBIRTH PohPortal PoHPortal -> Waterbirth 19 4 -1858 5707 0 2802 3449 0 Y CATHERBY PohPortal PoHPortal -> Catherby 19 4 -1922 5707 2 2802 3449 0 Y CATHERBY PohPortal PoHPortal -> Catherby 19 4 -1986 5707 0 2802 3449 0 Y CATHERBY PohPortal PoHPortal -> Catherby 19 4 -1858 5707 0 1632 3838 0 Y ARCEUUS_LIBRARY PohPortal PoHPortal -> Arceuus Library 19 4 -1922 5707 2 1632 3838 0 Y ARCEUUS_LIBRARY PohPortal PoHPortal -> Arceuus Library 19 4 -1986 5707 0 1632 3838 0 Y ARCEUUS_LIBRARY PohPortal PoHPortal -> Arceuus Library 19 4 -1858 5707 0 3108 3352 0 Y DRAYNOR_MANOR PohPortal PoHPortal -> Draynor Manor 19 4 -1922 5707 2 3108 3352 0 Y DRAYNOR_MANOR PohPortal PoHPortal -> Draynor Manor 19 4 -1986 5707 0 3108 3352 0 Y DRAYNOR_MANOR PohPortal PoHPortal -> Draynor Manor 19 4 -1858 5707 0 1349 3739 0 Y BATTLEFRONT PohPortal PoHPortal -> Battlefront 19 4 -1922 5707 2 1349 3739 0 Y BATTLEFRONT PohPortal PoHPortal -> Battlefront 19 4 -1986 5707 0 1349 3739 0 Y BATTLEFRONT PohPortal PoHPortal -> Battlefront 19 4 -1858 5707 0 2979 3509 0 Y MIND_ALTAR PohPortal PoHPortal -> Mind Altar 19 4 -1922 5707 2 2979 3509 0 Y MIND_ALTAR PohPortal PoHPortal -> Mind Altar 19 4 -1986 5707 0 2979 3509 0 Y MIND_ALTAR PohPortal PoHPortal -> Mind Altar 19 4 -1858 5707 0 3433 3461 0 Y SALVE_GRAVEYARD PohPortal PoHPortal -> Salve Graveyard 19 4 -1922 5707 2 3433 3461 0 Y SALVE_GRAVEYARD PohPortal PoHPortal -> Salve Graveyard 19 4 -1986 5707 0 3433 3461 0 Y SALVE_GRAVEYARD PohPortal PoHPortal -> Salve Graveyard 19 4 -1858 5707 0 3548 3528 0 Y FENKENSTRAINS_CASTLE PohPortal PoHPortal -> Fenkenstrain's Castle 19 4 -1922 5707 2 3548 3528 0 Y FENKENSTRAINS_CASTLE PohPortal PoHPortal -> Fenkenstrain's Castle 19 4 -1986 5707 0 3548 3528 0 Y FENKENSTRAINS_CASTLE PohPortal PoHPortal -> Fenkenstrain's Castle 19 4 -1858 5707 0 2500 3291 0 Y WEST_ARDOUGNE PohPortal PoHPortal -> West Ardougne 19 4 -1922 5707 2 2500 3291 0 Y WEST_ARDOUGNE PohPortal PoHPortal -> West Ardougne 19 4 -1986 5707 0 2500 3291 0 Y WEST_ARDOUGNE PohPortal PoHPortal -> West Ardougne 19 4 -1858 5707 0 3797 2866 0 Y HARMONY_ISLAND PohPortal PoHPortal -> Harmony Island 19 4 -1922 5707 2 3797 2866 0 Y HARMONY_ISLAND PohPortal PoHPortal -> Harmony Island 19 4 -1986 5707 0 3797 2866 0 Y HARMONY_ISLAND PohPortal PoHPortal -> Harmony Island 19 4 -1858 5707 0 3565 3315 0 Y BARROWS PohPortal PoHPortal -> Barrows 19 4 -1922 5707 2 3565 3315 0 Y BARROWS PohPortal PoHPortal -> Barrows 19 4 -1986 5707 0 3565 3315 0 Y BARROWS PohPortal PoHPortal -> Barrows 19 4 -1858 5707 0 2846 3940 0 Y WEISS PohPortal PoHPortal -> Weiss 19 4 -1922 5707 2 2846 3940 0 Y WEISS PohPortal PoHPortal -> Weiss 19 4 -1986 5707 0 2846 3940 0 Y WEISS PohPortal PoHPortal -> Weiss 19 4 -1858 5707 0 1576 3528 0 Y LOOKOUT MountedXerics MountedXerics -> Xeric's Lookout 19 4 -1922 5707 2 1576 3528 0 Y LOOKOUT MountedXerics MountedXerics -> Xeric's Lookout 19 4 -1986 5707 0 1576 3528 0 Y LOOKOUT MountedXerics MountedXerics -> Xeric's Lookout 19 4 -1858 5707 0 1754 3564 0 Y GLADE MountedXerics MountedXerics -> Xeric's Glade 19 4 -1922 5707 2 1754 3564 0 Y GLADE MountedXerics MountedXerics -> Xeric's Glade 19 4 -1986 5707 0 1754 3564 0 Y GLADE MountedXerics MountedXerics -> Xeric's Glade 19 4 -1858 5707 0 1504 3819 0 Y INFERNO MountedXerics MountedXerics -> Xeric's Inferno 19 4 -1922 5707 2 1504 3819 0 Y INFERNO MountedXerics MountedXerics -> Xeric's Inferno 19 4 -1986 5707 0 1504 3819 0 Y INFERNO MountedXerics MountedXerics -> Xeric's Inferno 19 4 -1858 5707 0 1641 3670 0 Y HEART MountedXerics MountedXerics -> Xeric's Heart 19 4 -1922 5707 2 1641 3670 0 Y HEART MountedXerics MountedXerics -> Xeric's Heart 19 4 -1986 5707 0 1641 3670 0 Y HEART MountedXerics MountedXerics -> Xeric's Heart 19 4 -1858 5707 0 2458 2851 0 Y MYTHS_GUILD MountedMythical MountedMythical -> Myths guild 19 4 -1922 5707 2 2458 2851 0 Y MYTHS_GUILD MountedMythical MountedMythical -> Myths guild 19 4 -1986 5707 0 2458 2851 0 Y MYTHS_GUILD MountedMythical MountedMythical -> Myths guild 19 4 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portal_poh.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portals_poh.tsv similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portal_poh.tsv rename to runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portals_poh.tsv From f933b290e9bc5a4b02fda5e4f97b95c02bb574dd Mon Sep 17 00:00:00 2001 From: krulvis Date: Tue, 9 Sep 2025 21:01:05 +0200 Subject: [PATCH 02/10] chore(Pathfinder): add POH transports on runtime --- .../pathfinder/PathfinderConfig.java | 23 ++++++------------- .../microbot/util/cache/Rs2PohCache.java | 12 ++++++++++ .../microbot/util/walker/Rs2Walker.java | 8 +++---- 3 files changed, 23 insertions(+), 20 deletions(-) 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 10787992e52..e8eb54e4281 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 @@ -261,11 +261,15 @@ private void refreshTransports(WorldPoint target) { transportsPacked.clear(); usableTeleports.clear(); - Map.Entry> extraTransport = null; + Map> pohTransports = Rs2PohCache.getAvailableTransportsMap(); for (Map.Entry> entry : allTransports.entrySet()) { WorldPoint point = entry.getKey(); - Set usableTransports = new HashSet<>(entry.getValue().size()); - for (Transport transport : entry.getValue()) { + ArrayList pointTransports = new ArrayList<>(entry.getValue()); + if (pohTransports.containsKey(point)) { + pointTransports.addAll(pohTransports.get(point)); + } + Set usableTransports = new HashSet<>(pointTransports.size()); + for (Transport transport : pointTransports) { // Mutate action updateActionBasedOnQuestState(transport); @@ -283,19 +287,6 @@ private void refreshTransports(WorldPoint target) { } } - HouseStyle style = HouseStyle.getStyle(); - if (usePoh && style != null) { - //Since we have a house style, we have a house and can therefore add available transports - WorldPoint origin = style.getPohLocation(); - int packedOrigin = WorldPointUtil.packWorldPoint(origin); - List pohTransports = Rs2PohCache.getAvailableTransports() - .stream().filter(this::useTransport).collect(Collectors.toList()); - Set existingTransports = transports.getOrDefault(origin, new HashSet<>()); - existingTransports.addAll(pohTransports.stream().filter(pohTransport -> !existingTransports.contains(pohTransport)).collect(Collectors.toSet())); - transports.put(origin, existingTransports); - transportsPacked.put(packedOrigin, existingTransports); - } - // Filter similar transports based on distance when walk with banked transports is enabled if (useBankItems && config.maxSimilarTransportDistance() > 0) { filterSimilarTransports(target); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java index a58a9b8605e..2ecf50f06ff 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java @@ -5,6 +5,7 @@ import net.runelite.api.DecorativeObject; import net.runelite.api.GameObject; import net.runelite.api.GameState; +import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.*; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.microbot.shortestpath.Transport; @@ -194,6 +195,17 @@ public static List getAvailableTransports() { .collect(Collectors.toList()); } + public static Map> getAvailableTransportsMap() { + Map> transports = new HashMap<>(); + HouseStyle style = HouseStyle.getStyle(); + if (style == null) return Collections.emptyMap(); + + transports.put(style.getPohLocation(), getInstance().values().stream() + .flatMap(Collection::stream).map(PohTransport::new) + .collect(Collectors.toSet())); + return transports; + } + public static void logState(LogOutputMode mode) { Rs2PohCache cache = getInstance(); 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 5d822f1b67f..aca9d23ec08 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 @@ -315,8 +315,8 @@ private static WalkerState processWalk(WorldPoint target, int distance) { boolean doorOrTransportResult = false; for (int i = indexOfStartPoint; i < path.size(); i++) { WorldPoint currentWorldPoint = path.get(i); - - System.out.println("start loop " + i); + WorldPoint nextWorldPoint = i + 1 < path.size() ? path.get(i + 1) : null; + System.out.printf(String.format("start loop {}, from={}, to={}\n" + i, currentWorldPoint, nextWorldPoint)); // add breakpoint here @@ -350,7 +350,7 @@ private static WalkerState processWalk(WorldPoint target, int distance) { //Again, would be nice to have access to current node, since we're going to have to handle transports in instance (PoH) boolean inInstance = Microbot.getClient().getTopLevelWorldView().isInstance(); - if (config.usePoh() || !inInstance) { + if (PohTeleports.isInHouse() || !inInstance) { doorOrTransportResult = handleTransports(path, i); } @@ -1495,7 +1495,7 @@ private static boolean handleTransports(List path, int indexOfStartP } if (transport.getType() == TransportType.POH) { - System.out.println("Using POH transport: " + transport.getName() + " " + transport.getType()); + log.debug("Using POH transport: " + transport.getDisplayInfo() + " " + transport.getType()); if (handlePohTransport(transport)) { sleepUntil(() -> Rs2Player.getWorldLocation().distanceTo(transport.getDestination()) < OFFSET, 10000); break; From a63dc04be755f92ec7a6127da7aace7088232071 Mon Sep 17 00:00:00 2001 From: krulvis Date: Tue, 9 Sep 2025 21:40:37 +0200 Subject: [PATCH 03/10] chore: format sout --- .../runelite/client/plugins/microbot/util/walker/Rs2Walker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 aca9d23ec08..480e2b94836 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 @@ -316,7 +316,7 @@ private static WalkerState processWalk(WorldPoint target, int distance) { for (int i = indexOfStartPoint; i < path.size(); i++) { WorldPoint currentWorldPoint = path.get(i); WorldPoint nextWorldPoint = i + 1 < path.size() ? path.get(i + 1) : null; - System.out.printf(String.format("start loop {}, from={}, to={}\n" + i, currentWorldPoint, nextWorldPoint)); + System.out.printf("start loop %s, from=%s, to=%s\n", i, currentWorldPoint, nextWorldPoint); // add breakpoint here From 0cf6eff03e8520b96cef5a0a110ec58858de5a93 Mon Sep 17 00:00:00 2001 From: krulvis Date: Tue, 9 Sep 2025 22:55:51 +0200 Subject: [PATCH 04/10] chore: small explanatory debug --- .../microbot/shortestpath/pathfinder/PathfinderConfig.java | 2 ++ 1 file changed, 2 insertions(+) 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 e8eb54e4281..7a0ec86659f 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 @@ -261,11 +261,13 @@ private void refreshTransports(WorldPoint target) { transportsPacked.clear(); usableTeleports.clear(); + // Get usable PoH transports, mapped to house location Map> pohTransports = Rs2PohCache.getAvailableTransportsMap(); for (Map.Entry> entry : allTransports.entrySet()) { WorldPoint point = entry.getKey(); ArrayList pointTransports = new ArrayList<>(entry.getValue()); if (pohTransports.containsKey(point)) { + // At this point we can insert all the PoH Transports pointTransports.addAll(pohTransports.get(point)); } Set usableTransports = new HashSet<>(pointTransports.size()); From 372c025ebb94dc361e4913648471efd89de58326 Mon Sep 17 00:00:00 2001 From: krulvis Date: Tue, 9 Sep 2025 22:57:29 +0200 Subject: [PATCH 05/10] chore: re-add Rs2SpiritTreeCache update --- .../microbot/shortestpath/pathfinder/PathfinderConfig.java | 4 ++++ 1 file changed, 4 insertions(+) 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 7a0ec86659f..5bdd9f4ddc0 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 @@ -261,6 +261,10 @@ private void refreshTransports(WorldPoint target) { transportsPacked.clear(); usableTeleports.clear(); + // Check spirit tree farming states for farmable spirit trees + Rs2SpiritTreeCache.getInstance().update(); + //Rs2SpiritTreeCache.logAllTreeStates(); + // Get usable PoH transports, mapped to house location Map> pohTransports = Rs2PohCache.getAvailableTransportsMap(); for (Map.Entry> entry : allTransports.entrySet()) { From e004d221b98f317d0ec5edfb2fdd919c19f36854 Mon Sep 17 00:00:00 2001 From: krulvis Date: Tue, 9 Sep 2025 23:01:42 +0200 Subject: [PATCH 06/10] chore: reduce function replication --- .../client/plugins/microbot/util/cache/Rs2PohCache.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java index 2ecf50f06ff..2b866a8c882 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java @@ -189,10 +189,10 @@ public static boolean isTransportUsable(Transport transport) { return getInstance().containsKey(key); } - public static List getAvailableTransports() { + public static Set getAvailableTransports() { return getInstance().values().stream() .flatMap(Collection::stream).map(PohTransport::new) - .collect(Collectors.toList()); + .collect(Collectors.toSet()); } public static Map> getAvailableTransportsMap() { @@ -200,9 +200,7 @@ public static Map> getAvailableTransportsMap() { HouseStyle style = HouseStyle.getStyle(); if (style == null) return Collections.emptyMap(); - transports.put(style.getPohLocation(), getInstance().values().stream() - .flatMap(Collection::stream).map(PohTransport::new) - .collect(Collectors.toSet())); + transports.put(style.getPohLocation(), getAvailableTransports()); return transports; } From 1372ddaa88b3e1fbf9545bd52acf82bf8556c836 Mon Sep 17 00:00:00 2001 From: krulvis Date: Tue, 9 Sep 2025 23:05:48 +0200 Subject: [PATCH 07/10] chore: Add documentation --- .../microbot/util/poh/PohTransport.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java index bdfabf00587..8f2fa989f4e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java @@ -7,22 +7,39 @@ import net.runelite.client.plugins.microbot.util.poh.data.HouseStyle; import net.runelite.client.plugins.microbot.util.poh.data.PohTeleport; +/** + * Represents a transport mechanism using the Player-Owned House (POH) teleportation system. + * This class extends the base Transport class and provides specific implementations + * for POH teleportation. + */ public class PohTransport extends Transport { @Getter private final PohTeleport teleport; + private final WorldPoint exitPortalPoint; public PohTransport(PohTeleport teleport) { super(teleport.getDestination(), teleport.displayInfo(), TransportType.POH); this.teleport = teleport; + HouseStyle style = HouseStyle.getStyle(); + this.exitPortalPoint = style != null ? style.getPohLocation() : new WorldPoint(-1, -1, -1); } + /** + * The origin of a PoH transport is the WorldPoint inside Player-Owned House (POH) on entering + * + * @return WorldPoint N.W. of Exit Portal + */ @Override public WorldPoint getOrigin() { - HouseStyle style = HouseStyle.getStyle(); - return style != null ? style.getPohLocation() : new WorldPoint(-1, -1, -1); + return exitPortalPoint; } + /** + * Executes the Transport's PoH teleportation action. + * + * @return true on successful teleportation + */ public boolean execute() { return teleport.execute(); } From c0589a5f47f85b3600c0682197ec1ee1cb7f05b2 Mon Sep 17 00:00:00 2001 From: krulvis Date: Wed, 10 Sep 2025 23:50:32 +0200 Subject: [PATCH 08/10] chore: remove teleports to PoH from TSV --- .../microbot/shortestpath/Transport.java | 26 ++++ .../microbot/util/cache/Rs2PohCache.java | 1 - .../microbot/util/poh/PohTeleports.java | 23 +++- .../shortestpath/teleportation_items.tsv | 29 ----- .../teleportation_portals_poh.tsv | 118 ------------------ .../shortestpath/teleportation_spells.tsv | 14 --- 6 files changed, 45 insertions(+), 166 deletions(-) delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portals_poh.tsv 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 d6c94e16e8c..e0f9f58aa37 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 @@ -184,6 +184,32 @@ public Transport(WorldPoint destination, String displayInfo, TransportType trans this.type = transportType; } + public Transport(WorldPoint origin, WorldPoint destination, String displayInfo, TransportType transportType, String action, String target, int objectId) { + this.origin = origin; + this.destination = destination; + this.displayInfo = displayInfo; + this.type = transportType; + this.action = action; + this.name = target; + this.objectId = objectId; + } + + public Transport(WorldPoint destination, String displayInfo, TransportType transportType, Set> itemIdRequirements) { + this.destination = destination; + this.displayInfo = displayInfo; + this.type = transportType; + this.itemIdRequirements = itemIdRequirements; + } + + public Transport(WorldPoint destination, String displayInfo, TransportType transportType, Map skillRequirement) { + this.destination = destination; + this.displayInfo = displayInfo; + this.type = transportType; + for (Map.Entry entry : skillRequirement.entrySet()) { + this.skillLevels[entry.getKey().ordinal()] = entry.getValue(); + } + } + Transport(Map fieldMap, TransportType transportType) { final String DELIM = " "; final String DELIM_MULTI = ";"; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java index 2b866a8c882..696f2a31968 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java @@ -204,7 +204,6 @@ public static Map> getAvailableTransportsMap() { return transports; } - public static void logState(LogOutputMode mode) { Rs2PohCache cache = getInstance(); StringBuilder logContent = new StringBuilder(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java index c2dd8204db3..bfedb0b2156 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java @@ -1,12 +1,15 @@ package net.runelite.client.plugins.microbot.util.poh; import net.runelite.api.GameObject; +import net.runelite.api.Skill; import net.runelite.api.TileObject; import net.runelite.api.coords.WorldPoint; import net.runelite.api.gameval.InterfaceID; import net.runelite.api.gameval.ObjectID; import net.runelite.api.widgets.Widget; import net.runelite.client.plugins.microbot.Microbot; +import net.runelite.client.plugins.microbot.shortestpath.Transport; +import net.runelite.client.plugins.microbot.shortestpath.TransportType; import net.runelite.client.plugins.microbot.util.equipment.JewelleryLocationEnum; import net.runelite.client.plugins.microbot.util.gameobject.Rs2GameObject; import net.runelite.client.plugins.microbot.util.keyboard.Rs2Keyboard; @@ -17,10 +20,7 @@ import net.runelite.client.plugins.microbot.util.poh.data.NexusPortal; import net.runelite.client.plugins.microbot.util.widget.Rs2Widget; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import static net.runelite.client.plugins.microbot.util.Global.sleepUntil; @@ -63,6 +63,7 @@ public static boolean checkIsInHouse() { /** * Checks if the player has a house + * * @return true if a house location is found */ public static boolean hasHouse() { @@ -231,4 +232,18 @@ public static boolean isSpiritTree(TileObject tileObject) { return SPIRIT_TREE_IDS.stream().anyMatch(id -> id == tileObject.getId()); } + public static List getTeleportsToPoh() { + HouseStyle style = HouseStyle.getStyle(); + HouseLocation location = HouseLocation.getHouseLocation(); + if (style == null || location == null) return List.of(); + WorldPoint insidePoint = style.getPohLocation(); + WorldPoint outsidePoint = location.getPortalLocation(); + return List.of( + new Transport(insidePoint, "Teleport to House", TransportType.TELEPORTATION_SPELL, Map.of(Skill.MAGIC, 40)), + new Transport(insidePoint, "Construction cape: Tele to POH", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(9789), Set.of(9790))), + new Transport(insidePoint, "Teleport to House tablet: Outside", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(8013))), + new Transport(outsidePoint, insidePoint, location.name() + " -> PoH", TransportType.TELEPORTATION_PORTAL, "Home", "Portal", location.getPortalId()) + ); + } + } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_items.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_items.tsv index 777add82d98..c1130a74796 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_items.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_items.tsv @@ -110,20 +110,6 @@ 3239 6077 0 8013 2187=7 Y T 19 4 Teleport to House tablet: Outside # 8 - Hosidius 1740 3517 0 8013 2187=8 Y T 19 4 Teleport to House tablet: Outside -# Teleport inside POH with tablet -1858 5707 0 8013 2188=1 Y T 19 4 Teleport to House tablet: Inside -1858 5707 1 8013 2188=2 Y T 19 4 Teleport to House tablet: Inside -1858 5707 2 8013 2188=3 Y T 19 4 Teleport to House tablet: Inside -1858 5707 3 8013 2188=4 Y T 19 4 Teleport to House tablet: Inside -1922 5707 0 8013 2188=5 Y T 19 4 Teleport to House tablet: Inside -1922 5707 1 8013 2188=6 Y T 19 4 Teleport to House tablet: Inside -1922 5707 2 8013 2188=7 Y T 19 4 Teleport to House tablet: Inside -1922 5707 3 8013 2188=8 Y T 19 4 Teleport to House tablet: Inside -1986 5707 0 8013 2188=10 Y T 19 4 Teleport to House tablet: Inside -1986 5707 0 8013 2188=11 Y T 19 4 Teleport to House tablet: Inside -1986 5707 1 8013 2188=12 Y T 19 4 Teleport to House tablet: Inside -1986 5707 2 8013 2188=13 Y T 19 4 Teleport to House tablet: Inside -1986 5707 3 8013 2188=14 Y T 19 4 Teleport to House tablet: Inside # Teleport tablets 3213 3424 0 8007 4585=0 Y T 19 4 Varrock tablet 3164 3478 0 8007 4480=1;4585=1 Y T 19 4 Varrock tablet: Grand exchange @@ -217,22 +203,7 @@ # capes 2931 3286 0 9780;9781 Y F 19 4 Crafting cape: Teleport -# The Construction cape's home teleports, determined by varbit 2188 (HouseStyle) -1858 5707 0 9789;9790 2188=1 Y F 19 4 Construction cape: Tele to POH -1858 5707 1 9789;9790 2188=2 Y F 19 4 Construction cape: Tele to POH -1858 5707 2 9789;9790 2188=3 Y F 19 4 Construction cape: Tele to POH -1858 5707 3 9789;9790 2188=4 Y F 19 4 Construction cape: Tele to POH -1922 5707 0 9789;9790 2188=5 Y F 19 4 Construction cape: Tele to POH -1922 5707 1 9789;9790 2188=6 Y F 19 4 Construction cape: Tele to POH -1922 5707 2 9789;9790 2188=7 Y F 19 4 Construction cape: Tele to POH -1922 5707 3 9789;9790 2188=8 Y F 19 4 Construction cape: Tele to POH -1986 5707 0 9789;9790 2188=10 Y F 19 4 Construction cape: Tele to POH -1986 5707 0 9789;9790 2188=11 Y F 19 4 Construction cape: Tele to POH -1986 5707 1 9789;9790 2188=12 Y F 19 4 Construction cape: Tele to POH -1986 5707 2 9789;9790 2188=13 Y F 19 4 Construction cape: Tele to POH -1986 5707 3 9789;9790 2188=14 Y F 19 4 Construction cape: Tele to POH # 8 - Hosidius -#1740 3517 0 9789;9790 2187=8 Y F 19 4 Construction cape: Home 2952 3224 0 9789;9790 Y F 19 4 2. Construction cape: Rimmington 2892 3465 0 9789;9790 Y F 19 4 3. Construction cape: Taverley 3339 3004 0 9789;9790 Y F 19 4 4. Construction cape: Pollnivneach diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portals_poh.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portals_poh.tsv deleted file mode 100644 index 4f953e30361..00000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portals_poh.tsv +++ /dev/null @@ -1,118 +0,0 @@ -Origin Destination isMembers menuOption menuTarget objectID Varbits Display info Duration -2954 3224 0 1858 5707 0 Y Home;Portal;15478 2188=1;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1858 5707 1 Y Home;Portal;15478 2188=2;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1858 5707 2 Y Home;Portal;15478 2188=3;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1858 5707 3 Y Home;Portal;15478 2188=4;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1922 5707 0 Y Home;Portal;15478 2188=5;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1922 5707 1 Y Home;Portal;15478 2188=6;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1922 5707 2 Y Home;Portal;15478 2188=7;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1922 5707 3 Y Home;Portal;15478 2188=8;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1986 5707 0 Y Home;Portal;15478 2188=10;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1986 5707 0 Y Home;Portal;15478 2188=11;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1986 5707 1 Y Home;Portal;15478 2188=12;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1986 5707 2 Y Home;Portal;15478 2188=13;2187=1 RIMMINGTON -> PoH 1 -2954 3224 0 1986 5707 3 Y Home;Portal;15478 2188=14;2187=1 RIMMINGTON -> PoH 1 -2894 3465 0 1858 5707 0 Y Home;Portal;15477 2188=1;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1858 5707 1 Y Home;Portal;15477 2188=2;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1858 5707 2 Y Home;Portal;15477 2188=3;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1858 5707 3 Y Home;Portal;15477 2188=4;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1922 5707 0 Y Home;Portal;15477 2188=5;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1922 5707 1 Y Home;Portal;15477 2188=6;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1922 5707 2 Y Home;Portal;15477 2188=7;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1922 5707 3 Y Home;Portal;15477 2188=8;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1986 5707 0 Y Home;Portal;15477 2188=10;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1986 5707 0 Y Home;Portal;15477 2188=11;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1986 5707 1 Y Home;Portal;15477 2188=12;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1986 5707 2 Y Home;Portal;15477 2188=13;2187=2 TAVERLY -> PoH 1 -2894 3465 0 1986 5707 3 Y Home;Portal;15477 2188=14;2187=2 TAVERLY -> PoH 1 -3340 3004 0 1858 5707 0 Y Home;Portal;15479 2188=1;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1858 5707 1 Y Home;Portal;15479 2188=2;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1858 5707 2 Y Home;Portal;15479 2188=3;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1858 5707 3 Y Home;Portal;15479 2188=4;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1922 5707 0 Y Home;Portal;15479 2188=5;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1922 5707 1 Y Home;Portal;15479 2188=6;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1922 5707 2 Y Home;Portal;15479 2188=7;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1922 5707 3 Y Home;Portal;15479 2188=8;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1986 5707 0 Y Home;Portal;15479 2188=10;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1986 5707 0 Y Home;Portal;15479 2188=11;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1986 5707 1 Y Home;Portal;15479 2188=12;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1986 5707 2 Y Home;Portal;15479 2188=13;2187=3 POLIVNEACH -> PoH 1 -3340 3004 0 1986 5707 3 Y Home;Portal;15479 2188=14;2187=3 POLIVNEACH -> PoH 1 -2670 3632 0 1858 5707 0 Y Home;Portal;15480 2188=1;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1858 5707 1 Y Home;Portal;15480 2188=2;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1858 5707 2 Y Home;Portal;15480 2188=3;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1858 5707 3 Y Home;Portal;15480 2188=4;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1922 5707 0 Y Home;Portal;15480 2188=5;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1922 5707 1 Y Home;Portal;15480 2188=6;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1922 5707 2 Y Home;Portal;15480 2188=7;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1922 5707 3 Y Home;Portal;15480 2188=8;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1986 5707 0 Y Home;Portal;15480 2188=10;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1986 5707 0 Y Home;Portal;15480 2188=11;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1986 5707 1 Y Home;Portal;15480 2188=12;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1986 5707 2 Y Home;Portal;15480 2188=13;2187=4 RELLEKKA -> PoH 1 -2670 3632 0 1986 5707 3 Y Home;Portal;15480 2188=14;2187=4 RELLEKKA -> PoH 1 -2758 3178 0 1858 5707 0 Y Home;Portal;15481 2188=1;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1858 5707 1 Y Home;Portal;15481 2188=2;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1858 5707 2 Y Home;Portal;15481 2188=3;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1858 5707 3 Y Home;Portal;15481 2188=4;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1922 5707 0 Y Home;Portal;15481 2188=5;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1922 5707 1 Y Home;Portal;15481 2188=6;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1922 5707 2 Y Home;Portal;15481 2188=7;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1922 5707 3 Y Home;Portal;15481 2188=8;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1986 5707 0 Y Home;Portal;15481 2188=10;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1986 5707 0 Y Home;Portal;15481 2188=11;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1986 5707 1 Y Home;Portal;15481 2188=12;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1986 5707 2 Y Home;Portal;15481 2188=13;2187=5 BRIMHAVEN -> PoH 1 -2758 3178 0 1986 5707 3 Y Home;Portal;15481 2188=14;2187=5 BRIMHAVEN -> PoH 1 -2544 3095 0 1858 5707 0 Y Home;Portal;15482 2188=1;2187=6 YANILLE -> PoH 1 -2544 3095 0 1858 5707 1 Y Home;Portal;15482 2188=2;2187=6 YANILLE -> PoH 1 -2544 3095 0 1858 5707 2 Y Home;Portal;15482 2188=3;2187=6 YANILLE -> PoH 1 -2544 3095 0 1858 5707 3 Y Home;Portal;15482 2188=4;2187=6 YANILLE -> PoH 1 -2544 3095 0 1922 5707 0 Y Home;Portal;15482 2188=5;2187=6 YANILLE -> PoH 1 -2544 3095 0 1922 5707 1 Y Home;Portal;15482 2188=6;2187=6 YANILLE -> PoH 1 -2544 3095 0 1922 5707 2 Y Home;Portal;15482 2188=7;2187=6 YANILLE -> PoH 1 -2544 3095 0 1922 5707 3 Y Home;Portal;15482 2188=8;2187=6 YANILLE -> PoH 1 -2544 3095 0 1986 5707 0 Y Home;Portal;15482 2188=10;2187=6 YANILLE -> PoH 1 -2544 3095 0 1986 5707 0 Y Home;Portal;15482 2188=11;2187=6 YANILLE -> PoH 1 -2544 3095 0 1986 5707 1 Y Home;Portal;15482 2188=12;2187=6 YANILLE -> PoH 1 -2544 3095 0 1986 5707 2 Y Home;Portal;15482 2188=13;2187=6 YANILLE -> PoH 1 -2544 3095 0 1986 5707 3 Y Home;Portal;15482 2188=14;2187=6 YANILLE -> PoH 1 -1744 3517 0 1858 5707 0 Y Home;Portal;28822 2188=1;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1858 5707 1 Y Home;Portal;28822 2188=2;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1858 5707 2 Y Home;Portal;28822 2188=3;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1858 5707 3 Y Home;Portal;28822 2188=4;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1922 5707 0 Y Home;Portal;28822 2188=5;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1922 5707 1 Y Home;Portal;28822 2188=6;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1922 5707 2 Y Home;Portal;28822 2188=7;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1922 5707 3 Y Home;Portal;28822 2188=8;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1986 5707 0 Y Home;Portal;28822 2188=10;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1986 5707 0 Y Home;Portal;28822 2188=11;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1986 5707 1 Y Home;Portal;28822 2188=12;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1986 5707 2 Y Home;Portal;28822 2188=13;2187=8 HOSIDIUS -> PoH 1 -1744 3517 0 1986 5707 3 Y Home;Portal;28822 2188=14;2187=8 HOSIDIUS -> PoH 1 -3239 6076 0 1858 5707 0 Y Home;Portal;34947 2188=1;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1858 5707 1 Y Home;Portal;34947 2188=2;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1858 5707 2 Y Home;Portal;34947 2188=3;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1858 5707 3 Y Home;Portal;34947 2188=4;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1922 5707 0 Y Home;Portal;34947 2188=5;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1922 5707 1 Y Home;Portal;34947 2188=6;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1922 5707 2 Y Home;Portal;34947 2188=7;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1922 5707 3 Y Home;Portal;34947 2188=8;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1986 5707 0 Y Home;Portal;34947 2188=10;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1986 5707 0 Y Home;Portal;34947 2188=11;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1986 5707 1 Y Home;Portal;34947 2188=12;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1986 5707 2 Y Home;Portal;34947 2188=13;2187=9 PRIFDDINAS -> PoH 1 -3239 6076 0 1986 5707 3 Y Home;Portal;34947 2188=14;2187=9 PRIFDDINAS -> PoH 1 -1422 2966 0 1858 5707 0 Y Home;Portal;55353 2188=1;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1858 5707 1 Y Home;Portal;55353 2188=2;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1858 5707 2 Y Home;Portal;55353 2188=3;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1858 5707 3 Y Home;Portal;55353 2188=4;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1922 5707 0 Y Home;Portal;55353 2188=5;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1922 5707 1 Y Home;Portal;55353 2188=6;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1922 5707 2 Y Home;Portal;55353 2188=7;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1922 5707 3 Y Home;Portal;55353 2188=8;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1986 5707 0 Y Home;Portal;55353 2188=10;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1986 5707 0 Y Home;Portal;55353 2188=11;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1986 5707 1 Y Home;Portal;55353 2188=12;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1986 5707 2 Y Home;Portal;55353 2188=13;2187=13 ALDARIN -> PoH 1 -1422 2966 0 1986 5707 3 Y Home;Portal;55353 2188=14;2187=13 ALDARIN -> PoH 1 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_spells.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_spells.tsv index f4c3fc12864..6c7588084a5 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_spells.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_spells.tsv @@ -28,20 +28,6 @@ 3239 6077 0 40 Magic 19 4070=0;2187=7 Y 4 Teleport to House: Outside # 8 - Hosidius 1740 3517 0 40 Magic 19 4070=0;2187=8 Y 4 Teleport to House: Outside -# Teleport to House - Inside - These depend on the player's house style - determined by varbit 2188 -1858 5707 0 40 Magic 19 2188=1 Y 4 Teleport to House -1858 5707 1 40 Magic 19 2188=2 Y 4 Teleport to House -1858 5707 2 40 Magic 19 2188=3 Y 4 Teleport to House -1858 5707 3 40 Magic 19 2188=4 Y 4 Teleport to House -1922 5707 0 40 Magic 19 2188=5 Y 4 Teleport to House -1922 5707 1 40 Magic 19 2188=6 Y 4 Teleport to House -1922 5707 2 40 Magic 19 2188=7 Y 4 Teleport to House -1922 5707 3 40 Magic 19 2188=8 Y 4 Teleport to House -1986 5707 0 40 Magic 19 2188=10 Y 4 Teleport to House -1986 5707 0 40 Magic 19 2188=11 Y 4 Teleport to House -1986 5707 1 40 Magic 19 2188=12 Y 4 Teleport to House -1986 5707 2 40 Magic 19 2188=13 Y 4 Teleport to House -1986 5707 3 40 Magic 19 2188=14 Y 4 Teleport to House # Camelot Teleport 2757 3478 0 45 Magic 19 4070=0 Y 10 Camelot Teleport From f584338f43a608fc7b0e9a454660b09b5308ee75 Mon Sep 17 00:00:00 2001 From: krulvis Date: Thu, 11 Sep 2025 00:07:06 +0200 Subject: [PATCH 09/10] chore: start implementing poh teleports directly --- .../microbot/shortestpath/Transport.java | 1 - .../pathfinder/PathfinderConfig.java | 33 +++++++++++++++---- .../microbot/util/poh/PohTeleports.java | 15 +++++---- 3 files changed, 35 insertions(+), 14 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 e0f9f58aa37..bd6f7e51f60 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 @@ -565,7 +565,6 @@ public static HashMap> loadAllFromResources() { addTransports(transports, "teleportation_minigames.tsv", TransportType.TELEPORTATION_MINIGAME); addTransports(transports, "teleportation_levers.tsv", TransportType.TELEPORTATION_LEVER); addTransports(transports, "teleportation_portals.tsv", TransportType.TELEPORTATION_PORTAL); - addTransports(transports, "teleportation_portals_poh.tsv", TransportType.TELEPORTATION_PORTAL); addTransports(transports, "teleportation_spells.tsv", TransportType.TELEPORTATION_SPELL); addTransports(transports, "wilderness_obelisks.tsv", TransportType.WILDERNESS_OBELISK); addTransports(transports, "magic_carpets.tsv", TransportType.MAGIC_CARPET); 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 5bdd9f4ddc0..6a8423cbe2a 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 @@ -265,15 +265,10 @@ private void refreshTransports(WorldPoint target) { Rs2SpiritTreeCache.getInstance().update(); //Rs2SpiritTreeCache.logAllTreeStates(); - // Get usable PoH transports, mapped to house location - Map> pohTransports = Rs2PohCache.getAvailableTransportsMap(); - for (Map.Entry> entry : allTransports.entrySet()) { + for (Map.Entry> entry : createMergedList().entrySet()) { WorldPoint point = entry.getKey(); ArrayList pointTransports = new ArrayList<>(entry.getValue()); - if (pohTransports.containsKey(point)) { - // At this point we can insert all the PoH Transports - pointTransports.addAll(pohTransports.get(point)); - } + Set usableTransports = new HashSet<>(pointTransports.size()); for (Transport transport : pointTransports) { // Mutate action @@ -299,6 +294,30 @@ private void refreshTransports(WorldPoint target) { } } + private Map> createMergedList() { + // Create a merged map + Map> mergedTransports = new HashMap<>(); + Map> transportsFromPoh = Rs2PohCache.getAvailableTransportsMap(); + Map> transportsToPoh = PohTeleports.getTransportsToPoh(); + + for (var entry : allTransports.entrySet()) { + mergedTransports.put(entry.getKey(), new HashSet<>(entry.getValue())); + } + + for (var entry : transportsFromPoh.entrySet()) { + mergedTransports + .computeIfAbsent(entry.getKey(), k -> new HashSet<>()) + .addAll(entry.getValue()); + } + + for (var entry : transportsToPoh.entrySet()) { + mergedTransports + .computeIfAbsent(entry.getKey(), k -> new HashSet<>()) + .addAll(entry.getValue()); + } + return mergedTransports; + } + public void refresh() { refresh(null); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java index bfedb0b2156..727d716bbe1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java @@ -232,18 +232,21 @@ public static boolean isSpiritTree(TileObject tileObject) { return SPIRIT_TREE_IDS.stream().anyMatch(id -> id == tileObject.getId()); } - public static List getTeleportsToPoh() { + public static Map> getTransportsToPoh() { HouseStyle style = HouseStyle.getStyle(); HouseLocation location = HouseLocation.getHouseLocation(); - if (style == null || location == null) return List.of(); + Map> teleports = new HashMap<>(); + if (style == null || location == null) return teleports; WorldPoint insidePoint = style.getPohLocation(); WorldPoint outsidePoint = location.getPortalLocation(); - return List.of( + + teleports.put(null, Set.of( new Transport(insidePoint, "Teleport to House", TransportType.TELEPORTATION_SPELL, Map.of(Skill.MAGIC, 40)), new Transport(insidePoint, "Construction cape: Tele to POH", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(9789), Set.of(9790))), - new Transport(insidePoint, "Teleport to House tablet: Outside", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(8013))), - new Transport(outsidePoint, insidePoint, location.name() + " -> PoH", TransportType.TELEPORTATION_PORTAL, "Home", "Portal", location.getPortalId()) - ); + new Transport(insidePoint, "Teleport to House tablet: Outside", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(8013))) + )); + teleports.put(outsidePoint, Set.of(new Transport(outsidePoint, insidePoint, location.name() + " -> PoH", TransportType.TELEPORTATION_PORTAL, "Home", "Portal", location.getPortalId()))); + return teleports; } } From c937ffbdc0b4dca6df7d7b2cfec07399fa8a9570 Mon Sep 17 00:00:00 2001 From: krulvis Date: Thu, 11 Sep 2025 09:37:07 +0200 Subject: [PATCH 10/10] fix: remove POH fairy ring from TSV and add on runtime --- .../microbot/shortestpath/Transport.java | 48 +++--- .../pathfinder/PathfinderConfig.java | 32 ++-- .../microbot/util/cache/Rs2PohCache.java | 149 ++++++++++++------ .../microbot/util/poh/PohTeleports.java | 20 +-- .../microbot/util/poh/PohTransport.java | 30 +--- .../microbot/util/poh/data/HouseLocation.java | 2 +- .../microbot/util/poh/data/HouseStyle.java | 9 +- .../microbot/util/walker/Rs2Walker.java | 2 +- .../microbot/shortestpath/fairy_rings.tsv | 27 ---- 9 files changed, 170 insertions(+), 149 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 bd6f7e51f60..ab504558749 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 @@ -131,7 +131,7 @@ public class Transport { * Creates a new transport from an origin-only transport * and a destination-only transport, and merges requirements */ - Transport(Transport origin, Transport destination) { + public Transport(Transport origin, Transport destination) { this.origin = origin.origin; this.destination = destination.destination; @@ -178,35 +178,47 @@ public class Transport { //END microbot variables } - public Transport(WorldPoint destination, String displayInfo, TransportType transportType) { + /** + * Base Transport constructor + */ + public Transport(WorldPoint origin, WorldPoint destination, String displayInfo, TransportType transportType, boolean isMember, int duration) { + this.origin = origin; this.destination = destination; this.displayInfo = displayInfo; this.type = transportType; + this.isMembers = isMember; + this.duration = duration; } - public Transport(WorldPoint origin, WorldPoint destination, String displayInfo, TransportType transportType, String action, String target, int objectId) { - this.origin = origin; - this.destination = destination; - this.displayInfo = displayInfo; - this.type = transportType; + /** + * Object interaction Transport constructor + */ + public Transport(WorldPoint origin, WorldPoint destination, String displayInfo, TransportType transportType, boolean isMember, String action, String target, int objectId) { + this(origin, destination, displayInfo, transportType, isMember, 1); this.action = action; this.name = target; this.objectId = objectId; } - public Transport(WorldPoint destination, String displayInfo, TransportType transportType, Set> itemIdRequirements) { - this.destination = destination; - this.displayInfo = displayInfo; - this.type = transportType; - this.itemIdRequirements = itemIdRequirements; + /** + * Transport constructor with item requirements + */ + public Transport(WorldPoint destination, String displayInfo, TransportType transportType, boolean isMember, int maxWildernessLevel, Set> itemIdRequirements) { + this(null, destination, displayInfo, transportType, isMember, 1); + this.maxWildernessLevel = maxWildernessLevel; + this.itemIdRequirements = itemIdRequirements != null ? new HashSet<>(itemIdRequirements) : new HashSet<>(); } - public Transport(WorldPoint destination, String displayInfo, TransportType transportType, Map skillRequirement) { - this.destination = destination; - this.displayInfo = displayInfo; - this.type = transportType; - for (Map.Entry entry : skillRequirement.entrySet()) { - this.skillLevels[entry.getKey().ordinal()] = entry.getValue(); + /** + * Transport constructor with skill requirements + */ + public Transport(WorldPoint destination, String displayInfo, TransportType transportType, boolean isMember, int maxWildernessLevel, Map skillRequirement) { + this(null, destination, displayInfo, transportType, isMember, 1); + this.maxWildernessLevel = maxWildernessLevel; + if (skillRequirement != null) { + for (Map.Entry entry : skillRequirement.entrySet()) { + this.skillLevels[entry.getKey().ordinal()] = entry.getValue(); + } } } 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 6a8423cbe2a..8633d2f4ecc 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 @@ -193,7 +193,7 @@ public void refresh(WorldPoint target) { } } - /** Specialized method for only updating player-held item and spell transports */ + /** Specialized method for adding usableTeleports to `transports` */ public void refreshTeleports(int packedLocation, int wildernessLevel) { Set usableWildyTeleports = new HashSet<>(usableTeleports.size()); if (ignoreTeleportAndItems) return; @@ -267,10 +267,8 @@ private void refreshTransports(WorldPoint target) { for (Map.Entry> entry : createMergedList().entrySet()) { WorldPoint point = entry.getKey(); - ArrayList pointTransports = new ArrayList<>(entry.getValue()); - - Set usableTransports = new HashSet<>(pointTransports.size()); - for (Transport transport : pointTransports) { + Set usableTransports = new HashSet<>(entry.getValue().size()); + for (Transport transport : entry.getValue()) { // Mutate action updateActionBasedOnQuestState(transport); @@ -295,22 +293,22 @@ private void refreshTransports(WorldPoint target) { } private Map> createMergedList() { - // Create a merged map + if (!usePoh) return allTransports; Map> mergedTransports = new HashMap<>(); - Map> transportsFromPoh = Rs2PohCache.getAvailableTransportsMap(); - Map> transportsToPoh = PohTeleports.getTransportsToPoh(); + // Start with putting all the TSV imported persistent transports for (var entry : allTransports.entrySet()) { mergedTransports.put(entry.getKey(), new HashSet<>(entry.getValue())); } - for (var entry : transportsFromPoh.entrySet()) { + // Add transports from PoH to somewhere in the world + for (var entry : Rs2PohCache.getAvailableTransportsMap(allTransports).entrySet()) { mergedTransports .computeIfAbsent(entry.getKey(), k -> new HashSet<>()) .addAll(entry.getValue()); } - - for (var entry : transportsToPoh.entrySet()) { + // Add transports from the world to PoH + for (var entry : PohTeleports.getTransportsToPoh().entrySet()) { mergedTransports .computeIfAbsent(entry.getKey(), k -> new HashSet<>()) .addAll(entry.getValue()); @@ -533,18 +531,6 @@ private boolean useTransport(Transport transport) { return hasRequiredItems; } - //Check PoH fairy ring requirement - if(transport.getType() == FAIRY_RING && HouseStyle.isPohExitLocation(transport.getOrigin())) { - //At this point we've already checked the Varbit requirement - //Now we need to check in cache if the object actually exists in the PoH - boolean isUsable = Rs2PohCache.isTransportUsable(transport); - if (!isUsable) { - log.debug("Transport ( O: {} D: {} ) is a POH-Fairy-ring teleport but is not usable", transport.getOrigin(), transport.getDestination()); - } - return isUsable; - } - - return true; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java index 696f2a31968..7f660a7e5a6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/cache/Rs2PohCache.java @@ -9,7 +9,6 @@ import net.runelite.api.events.*; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.microbot.shortestpath.Transport; -import net.runelite.client.plugins.microbot.shortestpath.TransportType; import net.runelite.client.plugins.microbot.util.cache.serialization.CacheSerializable; import net.runelite.client.plugins.microbot.util.cache.util.LogOutputMode; import net.runelite.client.plugins.microbot.util.cache.util.Rs2CacheLoggingUtils; @@ -21,12 +20,15 @@ import java.util.*; import java.util.stream.Collectors; +import static net.runelite.client.plugins.microbot.shortestpath.TransportType.FAIRY_RING; + @Slf4j public class Rs2PohCache extends Rs2Cache> implements CacheSerializable { public final static Type TYPE_TOKEN = new TypeToken>>() { }.getType(); public static final String POH_CACHE_KEY = "PohCache"; + public static final String POH_FAIRY_RINGS = "fairyRings"; private static Rs2PohCache instance; @@ -106,7 +108,7 @@ public void onGameObjectSpawned(GameObjectSpawned event) { setTeleports(NexusPortal.class, NexusPortal.getAvailableTeleports()); } else if (PohTeleports.isFairyRing(go)) { log.info("Found fairy rings in POH"); - put("fairyRings", Collections.emptyList()); + put(POH_FAIRY_RINGS, Collections.emptyList()); } } @@ -127,12 +129,17 @@ public void onGameObjectDespawned(GameObjectDespawned event) { remove(NexusPortal.class.getSimpleName()); } else if (PohTeleports.isFairyRing(go)) { log.info("Removing Fairy Rings from POH"); - remove("fairyRings"); + remove(POH_FAIRY_RINGS); } } - private void removeTeleport(Class> type, PohTeleport teleport) { - String key = type.getSimpleName(); + /** + * Removes a teleport from cache using the given Class's simplename as key + * @param clazz Class to use as key + * @param teleport PohTeleports to remove from value + */ + private void removeTeleport(Class> clazz, PohTeleport teleport) { + String key = clazz.getSimpleName(); List teleports = get(key, ArrayList::new); if (!teleports.contains(teleport)) { return; @@ -142,8 +149,13 @@ private void removeTeleport(Class> type, P log.info("Removing {} Teleport from {}", teleport.name(), key); } - private void addTeleport(Class> type, PohTeleport teleport) { - String key = type.getSimpleName(); + /** + * Adds a teleport to cache using the given Class's simplename as key + * @param clazz Class to use as key + * @param teleport PohTeleports to add to value + */ + private void addTeleport(Class> clazz, PohTeleport teleport) { + String key = clazz.getSimpleName(); List teleports = get(key, ArrayList::new); if (teleports.contains(teleport)) { return; @@ -153,55 +165,89 @@ private void addTeleport(Class> type, PohT log.info("Adding {} Teleport to {}", teleport.name(), key); } - private void setTeleports(Class> type, List teleports) { - String key = type.getSimpleName(); + /** + * Sets the teleports in cache using the given Class's simplename as key + * @param clazz Class to use as key + * @param teleports List of PohTeleports to put as value + */ + private void setTeleports(Class> clazz, List teleports) { + String key = clazz.getSimpleName(); put(key, Collections.unmodifiableList(teleports)); log.info("Putting {} Teleports to {}", get(key).size(), key); } - @Override - public void update() { - //Unused - } - - @Override - public String getConfigKey() { - return POH_CACHE_KEY; - } - - @Override - public boolean shouldPersist() { - return true; - } - - public static boolean isTransportUsable(Transport transport) { - if (transport == null) return false; - if (transport.getType() == TransportType.FAIRY_RING) { - //For fairy ring we only have to check if the cache contains the key - return getInstance().containsKey("fairyRings"); - } - // For anything else we have to see if the PohTeleport exists in the cache - if (!(transport instanceof PohTransport)) return false; - PohTransport pohTransport = (PohTransport) transport; - PohTeleport teleport = pohTransport.getTeleport(); - String key = teleport.getClass().getSimpleName(); - return getInstance().containsKey(key); + /** + * + * @return true if fairy ring is present in PoH + */ + public static boolean hasFairyRings() { + return getInstance().containsKey(POH_FAIRY_RINGS); } - public static Set getAvailableTransports() { + /** + * Creates a Set with all available PoH transports directly extracted from cached data + * Excludes things like Fairy rings and spirit trees as they are based on existing data + * @return Set with all cached PoH transports present in Cache flattened down + */ + public static Set getAvailablePohTransports() { + HouseStyle style = HouseStyle.getStyle(); + if (style == null) return Collections.emptySet(); return getInstance().values().stream() - .flatMap(Collection::stream).map(PohTransport::new) + .flatMap(Collection::stream).map(t -> new PohTransport(style.getPohExitWorldPoint(), t)) .collect(Collectors.toSet()); } - public static Map> getAvailableTransportsMap() { - Map> transports = new HashMap<>(); - HouseStyle style = HouseStyle.getStyle(); - if (style == null) return Collections.emptyMap(); + /** + * Creates a map with all available PoH transports based on cached data + * @param allTransports map with all persistent transports extracted from TSV's + * @return Map with all transports available from inside PoH and fairy ring transports towards PoH + */ + public static Map> getAvailableTransportsMap(Map> allTransports) { + Set pohTransports = getAvailablePohTransports(); + Map> transportsMap = new HashMap<>(); + if (pohTransports.isEmpty()) return transportsMap; + WorldPoint exitPortal = pohTransports.stream().findFirst().get().getOrigin(); + //All the PohTransports start from the same WorldPoint, which is the exit portal inside the PoH + if (hasFairyRings()) { + transportsMap.putAll(connectFairyRings(allTransports, exitPortal)); + } + transportsMap.computeIfAbsent(exitPortal, p -> new HashSet<>()).addAll(pohTransports); + return transportsMap; + } - transports.put(style.getPohLocation(), getAvailableTransports()); - return transports; + /** + * Connecting the PoH Fairy ring to all other fairy rings and vise versa + * @param transportsMap map from which currently present fairy rings are found + * @param pohFairyRing position of the PoH fairy ring + * @return map with PoH fairy rings transports added + */ + private static Map> connectFairyRings( + Map> transportsMap, + WorldPoint pohFairyRing + ) { + Map> fairyTransportsMap = new HashMap<>(); + Transport pohFairyTransport = new Transport(pohFairyRing, pohFairyRing, "DIQ", FAIRY_RING, true, 5); + + //Find a point where there is FAIRY_RINGS (because that point will have data for ALL fairy rings) + transportsMap.entrySet().stream() + .filter(e -> e.getValue().stream().anyMatch(t -> t.getType() == FAIRY_RING)).findFirst().ifPresent(e -> { + WorldPoint existingRingPoint = e.getKey(); + for (Transport existingRingTransport : new HashSet<>(e.getValue())) { + if (existingRingTransport.getType() != FAIRY_RING) continue; + // add from poh + fairyTransportsMap + .computeIfAbsent(pohFairyRing, k -> new HashSet<>()) + .add(new Transport(pohFairyTransport, existingRingTransport)); + + // add to poh + fairyTransportsMap + .computeIfAbsent(existingRingPoint, k -> new HashSet<>()) + .add(new Transport(existingRingTransport, pohFairyTransport)); + } + }); + + return fairyTransportsMap; } public static void logState(LogOutputMode mode) { @@ -238,5 +284,20 @@ public static void logState(LogOutputMode mode) { ); } + @Override + public void update() { + //Unused + } + + @Override + public String getConfigKey() { + return POH_CACHE_KEY; + } + + @Override + public boolean shouldPersist() { + return true; + } + } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java index 727d716bbe1..dc3734e469b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTeleports.java @@ -235,18 +235,20 @@ public static boolean isSpiritTree(TileObject tileObject) { public static Map> getTransportsToPoh() { HouseStyle style = HouseStyle.getStyle(); HouseLocation location = HouseLocation.getHouseLocation(); - Map> teleports = new HashMap<>(); - if (style == null || location == null) return teleports; - WorldPoint insidePoint = style.getPohLocation(); + Map> transportMap = new HashMap<>(); + if (style == null || location == null) return transportMap; + WorldPoint insidePoint = style.getPohExitWorldPoint(); WorldPoint outsidePoint = location.getPortalLocation(); - teleports.put(null, Set.of( - new Transport(insidePoint, "Teleport to House", TransportType.TELEPORTATION_SPELL, Map.of(Skill.MAGIC, 40)), - new Transport(insidePoint, "Construction cape: Tele to POH", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(9789), Set.of(9790))), - new Transport(insidePoint, "Teleport to House tablet: Outside", TransportType.TELEPORTATION_ITEM, Set.of(Set.of(8013))) + transportMap.put(null, Set.of( + new Transport(insidePoint, "Teleport to House", TransportType.TELEPORTATION_SPELL, true, 19, Map.of(Skill.MAGIC, 40)), + new Transport(insidePoint, "Construction cape: Tele to POH", TransportType.TELEPORTATION_ITEM,true, 19, Set.of(Set.of(9789), Set.of(9790))), + new Transport(insidePoint, "Teleport to House tablet: Outside", TransportType.TELEPORTATION_ITEM, true, 19, Set.of(Set.of(8013))) )); - teleports.put(outsidePoint, Set.of(new Transport(outsidePoint, insidePoint, location.name() + " -> PoH", TransportType.TELEPORTATION_PORTAL, "Home", "Portal", location.getPortalId()))); - return teleports; + transportMap.put(outsidePoint, Set.of( + new Transport(outsidePoint, insidePoint, location.name() + " -> PoH", TransportType.TELEPORTATION_PORTAL, true, "Home", "Portal", location.getPortalId()) + )); + return transportMap; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java index 8f2fa989f4e..bccdbc8eab5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/PohTransport.java @@ -16,23 +16,14 @@ public class PohTransport extends Transport { @Getter private final PohTeleport teleport; - private final WorldPoint exitPortalPoint; - public PohTransport(PohTeleport teleport) { - super(teleport.getDestination(), teleport.displayInfo(), TransportType.POH); + public PohTransport(WorldPoint exitPortalPoint, PohTeleport teleport) { + super( + java.util.Objects.requireNonNull(exitPortalPoint, "exitPortalPoint is null"), + java.util.Objects.requireNonNull(teleport, "teleport is null").getDestination(), + teleport.displayInfo(), TransportType.POH, true, teleport.getDuration() + ); this.teleport = teleport; - HouseStyle style = HouseStyle.getStyle(); - this.exitPortalPoint = style != null ? style.getPohLocation() : new WorldPoint(-1, -1, -1); - } - - /** - * The origin of a PoH transport is the WorldPoint inside Player-Owned House (POH) on entering - * - * @return WorldPoint N.W. of Exit Portal - */ - @Override - public WorldPoint getOrigin() { - return exitPortalPoint; } /** @@ -44,13 +35,4 @@ public boolean execute() { return teleport.execute(); } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - PohTransport that = (PohTransport) o; - return teleport.equals(that.teleport); - } - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseLocation.java index 8bc577d1b49..5593e7eba36 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseLocation.java @@ -48,7 +48,7 @@ public static String buildPortalMappingTSV() { for (HouseStyle style : HouseStyle.values()) { String origin = formatWorldPoint(location.getPortalLocation()); - String destination = formatWorldPoint(style.getPohLocation()); + String destination = formatWorldPoint(style.getPohExitWorldPoint()); String isMembers = "Y"; String menu = "Home;Portal;" + location.getPortalId(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java index a6603032604..b58af67d076 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java @@ -27,7 +27,7 @@ public enum HouseStyle { ; private final int varbitValue; - private final WorldPoint pohLocation; + private final WorldPoint pohExitWorldPoint; public static HouseStyle getStyle() { int varbitValue = Microbot.getVarbitValue(VarbitID.POH_HOUSE_STYLE); @@ -40,11 +40,16 @@ public static HouseStyle getStyle() { } public static WorldPoint[] getExitPortalLocations() { - return Arrays.stream(values()).map(HouseStyle::getPohLocation).distinct().toArray(WorldPoint[]::new); + return Arrays.stream(values()).map(HouseStyle::getPohExitWorldPoint).distinct().toArray(WorldPoint[]::new); } public static boolean isPohExitLocation(WorldPoint pohLocation) { return Arrays.asList(getExitPortalLocations()).contains(pohLocation); } + + public static WorldPoint getPohExitPoint() { + HouseStyle style = getStyle(); + return style != null ? style.getPohExitWorldPoint() : null; + } } 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 b19dcdfa2e1..460a2e933a3 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 @@ -1495,7 +1495,7 @@ private static boolean handleTransports(List path, int indexOfStartP } if (transport.getType() == TransportType.POH) { - log.debug("Using POH transport: " + transport.getDisplayInfo() + " " + transport.getType()); + log.debug("Using POH transport: " + transport.getDisplayInfo()); if (handlePohTransport(transport)) { sleepUntil(() -> Rs2Player.getWorldLocation().distanceTo(transport.getDestination()) < OFFSET, 10000); break; diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/fairy_rings.tsv b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/fairy_rings.tsv index 4e80315cb70..7e7a8a7d1d5 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/fairy_rings.tsv +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/fairy_rings.tsv @@ -40,19 +40,6 @@ 2682 3081 0 5 3037 4763 0 5 # POH ring -1858 5707 0 2188=1 5 -1858 5707 1 2188=2 5 -1858 5707 2 2188=3 5 -1858 5707 3 2188=4 5 -1922 5707 0 2188=5 5 -1922 5707 1 2188=6 5 -1922 5707 2 2188=7 5 -1922 5707 3 2188=8 5 -1986 5707 0 2188=10 5 -1986 5707 0 2188=11 5 -1986 5707 1 2188=12 5 -1986 5707 2 2188=13 5 -1986 5707 3 2188=14 5 # 2027 5700 0 5 3038 5348 0 5 3108 3149 0 5 @@ -107,20 +94,6 @@ 2740 2738 0 Monkey Madness I 5 CLR 2682 3081 0 5 CLS 3037 4763 0 5 DIP -# POH Ring - 1858 5707 0 2188=1 5 DIQ - 1858 5707 1 2188=2 5 DIQ - 1858 5707 2 2188=3 5 DIQ - 1858 5707 3 2188=4 5 DIQ - 1922 5707 0 2188=5 5 DIQ - 1922 5707 1 2188=6 5 DIQ - 1922 5707 2 2188=7 5 DIQ - 1922 5707 3 2188=8 5 DIQ - 1986 5707 0 2188=10 5 DIQ - 1986 5707 0 2188=11 5 DIQ - 1986 5707 1 2188=12 5 DIQ - 1986 5707 2 2188=13 5 DIQ - 1986 5707 3 2188=14 5 DIQ 3038 5348 0 5 DIR 3108 3149 0 5 DIS 2658 3230 0 5 DJP