Class TeleportsService
- java.lang.Object
-
- net.openosrs.api.service.movement.teleports.TeleportsService
-
@Singleton public class TeleportsService extends java.lang.ObjectRegistry and fail-closed invoker for built-inTeleportDefinitions.Dispatch always goes through the owning service (Inventory / Equipment / Magic), which validate actions against live widget state. This service adds only availability + magic-level gates; it never invents component tuples.
Semantics:
canInvoke(TeleportDefinition)is a pure readback check.invoke(TeleportDefinition)submits a command. Returning normally means "dispatch accepted or queued by the owning service", NOT that the player arrived anywhere.- "Rub"-style items open a destination dialog on a later tick. After
invoking such a definition, call
resolveDialogueChoice()from subsequent ticks until it returns true. It never blocks or sleeps. arrivedAt(TeleportDefinition)compares the live player position with the definition's verified landing area; definitions with dynamic destinations (POH/home) always report false.
-
-
Constructor Summary
Constructors Constructor Description TeleportsService(InventoryService inventory, EquipmentService equipment, MagicService magic, DialogueService dialogue, SkillService skills, MovementService movement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvanceOperations()java.util.List<TeleportDefinition>all()All built-in verified definitions (spells, tablets, jewellery both modes).booleanarrivedAt(TeleportDefinition def)Observed-state arrival check against the definition's verified landing area (Chebyshev distance withinarrivalRadius).TeleportOperationbeginTeleport(OperationOwner owner, TeleportDefinition definition)TeleportOperationbeginTeleport(OperationOwner owner, TeleportDefinition definition, long timeoutTicks)TeleportOperationbeginTeleport(OperationOwner owner, TeleportDefinition definition, long timeoutTicks, java.util.function.Predicate<DialogueService> expectedMenu)Custom definitions must identify their expected destination menu, for example by its header.voidcancelSession()booleancanInvoke(TeleportDefinition def)Availability readback: item present in inventory / worn in slot / spell widget visible, plus magic-level gate when the definition has one.voidclearPendingChoice()voidconfigureOperations(net.runelite.api.Client client, SessionTickClock clock, OperationLeases leases)java.util.List<TeleportDefinition>find(java.lang.String namePart)Definitions whose name contains the given text, case-insensitive.voidinvoke(TeleportDefinition def)Submit the teleport command through the owning service.TeleportOperationlastOperation()Last operation remains available after cancellation/failure for diagnostics.TeleportDefinitionpendingChoice()booleanresolveDialogueChoice()Legacy polling adapter: true only on the call observing a newly submitted choice.
-
-
-
Constructor Detail
-
TeleportsService
@Inject public TeleportsService(InventoryService inventory, EquipmentService equipment, MagicService magic, DialogueService dialogue, SkillService skills, MovementService movement)
-
-
Method Detail
-
configureOperations
@Inject public void configureOperations(net.runelite.api.Client client, SessionTickClock clock, OperationLeases leases)
-
beginTeleport
public TeleportOperation beginTeleport(OperationOwner owner, TeleportDefinition definition)
-
beginTeleport
public TeleportOperation beginTeleport(OperationOwner owner, TeleportDefinition definition, long timeoutTicks)
-
beginTeleport
public TeleportOperation beginTeleport(OperationOwner owner, TeleportDefinition definition, long timeoutTicks, java.util.function.Predicate<DialogueService> expectedMenu)
Custom definitions must identify their expected destination menu, for example by its header.
-
advanceOperations
public void advanceOperations()
-
cancelSession
public void cancelSession()
-
all
public java.util.List<TeleportDefinition> all()
All built-in verified definitions (spells, tablets, jewellery both modes).
-
find
public java.util.List<TeleportDefinition> find(java.lang.String namePart)
Definitions whose name contains the given text, case-insensitive.
-
canInvoke
public boolean canInvoke(TeleportDefinition def)
Availability readback: item present in inventory / worn in slot / spell widget visible, plus magic-level gate when the definition has one.
-
invoke
public void invoke(TeleportDefinition def)
Submit the teleport command through the owning service.- Throws:
java.lang.IllegalArgumentException- when the definition is unknown/invalidjava.lang.IllegalStateException- when the teleport is not currently available (canInvoke(net.openosrs.api.service.movement.teleports.TeleportDefinition)false), or when a previous destination-dialog choice is still pending
-
resolveDialogueChoice
public boolean resolveDialogueChoice()
Legacy polling adapter: true only on the call observing a newly submitted choice.
-
pendingChoice
public TeleportDefinition pendingChoice()
-
lastOperation
public TeleportOperation lastOperation()
Last operation remains available after cancellation/failure for diagnostics.
-
clearPendingChoice
public void clearPendingChoice()
-
arrivedAt
public boolean arrivedAt(TeleportDefinition def)
Observed-state arrival check against the definition's verified landing area (Chebyshev distance withinarrivalRadius). Always false for dynamic destinations — we do not pretend to know where a POH is.
-
-