Package com.valhalla.sdk.api
Class GameEngine
java.lang.Object
com.valhalla.sdk.api.GameEngine
Compile-time API surface. Implementations are supplied by the Android payload.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbankAction(String operation, int id, int amount, int slot, String text) Dispatches a bank operation.static booleanbankPinDigit(int digit) Queues one bank-PIN digit for native client-thread resolution.static booleanReturnstruewhen north-alignment was accepted.static booleanCancels script-owned walking and replaces any active client route with a semantic native stop at the local player's current tile.static booleancastSpellOnNpc(WidgetSnapshot spell, Npc target) Queues one revision-pinned target spell on one current NPC.static BankSnapshotReturns the most recent bank state and item snapshot.Returns immutable names of features supported by the active native adapter.static Optional<CollisionMap> Returns the live collision map, or an empty value when it is unavailable.static intgetCurrentSkillLevel(int skillId) Reads a boost-aware skill level.static intReturns the active world number, or-1when unavailable.Returns items in occupied equipment slots.static List<GameMessage> Returns game-message lines retained locally by the client.static List<SceneObject> Returns typed objects in the loaded scene.static longReturns the latest 600 ms tick sequence emitted by the native client hook.static List<GroundItem> Returns ground items in the loaded scene.Returns items in occupied inventory slots.static LocalPlayerReturns the current local-player snapshot.static OptionalIntReturns the local player's interpolated terrain height.getNpcs()Returns visible NPC snapshots.Returns visible player snapshots.static intgetRealSkillLevel(int skillId) Reads an unboosted skill level.static TileReturns the southwest tile of the loaded scene.static intgetSkillExperience(int skillId) Reads accumulated skill experience.static OptionalIntgetVarp(int varpId) Reads one client varp from the revision-validated native adapter.Returns live widgets decoded by the active revision-pinned adapter.static List<WidgetSnapshot> Returns complete live-widget observations.static booleanhopWorld(int world) Requests a world hop.static booleaninteractComponent(int packedId, int childIndex, int operation, String target) Dispatches one component operation on an exact widget.static booleaninteractEquipmentSlot(int slot) Invokes the default action for an equipment slot.static booleaninteractGroundItem(int id, Tile tile, int action) Invokes a ground-item action.static booleaninteractInventoryItem(int itemId, int slot, int action) Invokes an action on an inventory item.static booleaninteractInventoryItemAction(int itemId, int slot, String action) Dispatches an exact live inventory menu action on the hooked client thread.static booleaninteractInventoryItemOnItem(int sourceItemId, int sourceSlot, int targetItemId, int targetSlot) Atomically selects one exact inventory item and applies it to another.static booleaninteractInventoryItemOnNpc(int sourceItemId, int sourceSlot, int npcId, int npcIndex) Atomically selects one exact inventory item and uses it on one exact NPC.static booleaninteractInventoryItemOnObject(int sourceItemId, int sourceSlot, int objectId, int worldX, int worldY, int plane) Atomically selects one exact inventory item and uses it on one exact scene object.static booleaninteractInventoryItemPrimaryAction(int itemId, int slot, String expectedAction) Dispatches an item's live primary option, validated against an expected label.static booleaninteractInventorySlot(int slot) Invokes the default action for an inventory slot.static booleaninteractNpc(int index, int action) Invokes an NPC action.static booleaninteractObject(int id, Tile tile, int action) Invokes a scene-object action.static booleaninteractWidget(WidgetSnapshot snapshot, String exactAction) Queues one exact label from a visible, freshWidgetSnapshot.static booleanReturnstruewhen the runtime can accept another native action.static booleanReturns whether the local player currently has a live combat target;falsewhen the adapter cannot determine combat state.static booleanReturnstruewhen the native client reports an active game session.static booleanisTileLoaded(Tile tile) Tests whether a tile is represented by the loaded scene.static booleanlogout()Returnstruewhen the runtime accepted the logout request.static booleanopenTab(int tab) Opens a top-level game tab.static booleansetRunEnabled(boolean enabled) Requests the enabled or disabled player run state.static booleanuseFairyRing(String code) Configures and activates a loaded fairy ring using semantic object and widget hooks.static longwaitForNextTick(long afterSequence, long timeoutMs) Blocks the script thread until a later native 600 ms tick or a bounded timeout.static booleanRequests native movement toward a loaded tile.
-
Method Details
-
getLocalPlayer
Returns the current local-player snapshot.- Returns:
- the current local-player snapshot
-
getLocalSceneHeight
Returns the local player's interpolated terrain height.- Returns:
- scene height, or empty when the active adapter cannot validate the renderer grid for this snapshot
-
getCapabilities
Returns immutable names of features supported by the active native adapter.- Returns:
- immutable names of features supported by the active native adapter
-
getCurrentWorld
public static int getCurrentWorld()Returns the active world number, or-1when unavailable.- Returns:
- the active world number, or
-1when unavailable
-
getVarp
Reads one client varp from the revision-validated native adapter.- Parameters:
varpId- non-negative client varp identifier- Returns:
- the current value, or empty when varp state is unavailable
-
getPlayers
Returns visible player snapshots.- Returns:
- visible player snapshots
-
getNpcs
Returns visible NPC snapshots.- Returns:
- visible NPC snapshots
-
getCurrentSkillLevel
public static int getCurrentSkillLevel(int skillId) Reads a boost-aware skill level.- Parameters:
skillId- stable client skill identifier- Returns:
- the current level
-
getRealSkillLevel
public static int getRealSkillLevel(int skillId) Reads an unboosted skill level.- Parameters:
skillId- stable client skill identifier- Returns:
- the real level
-
getSkillExperience
public static int getSkillExperience(int skillId) Reads accumulated skill experience.- Parameters:
skillId- stable client skill identifier- Returns:
- experience points
-
getGameObjects
Returns typed objects in the loaded scene.- Returns:
- typed objects in the loaded scene
-
getGroundItems
Returns ground items in the loaded scene.- Returns:
- ground items in the loaded scene
-
getInventoryItems
Returns items in occupied inventory slots.- Returns:
- items in occupied inventory slots
-
getEquipmentItems
Returns items in occupied equipment slots.- Returns:
- items in occupied equipment slots
-
getWidgets
Returns live widgets decoded by the active revision-pinned adapter.- Returns:
- live widgets decoded by the active revision-pinned adapter
-
getWidgetSnapshots
Returns complete live-widget observations.Absent geometry stays absent and absent visibility stays unknown, and the adapter's ordered action slots and dynamic child index are retained.
- Returns:
- immutable snapshots in native enumeration order
-
getGameMessages
Returns game-message lines retained locally by the client.- Throws:
SecurityException- when the active package did not requestgame:read-messages
-
getCollisionMap
Returns the live collision map, or an empty value when it is unavailable.- Returns:
- the live collision map, or an empty value when it is unavailable
-
getBankSnapshot
Returns the most recent bank state and item snapshot.- Returns:
- the most recent bank state and item snapshot
- Throws:
SecurityException- whengame:read-bankis not granted
-
bankAction
Dispatches a bank operation.- Parameters:
operation- runtime bank-operation nameid- target item identifier, or-1amount- requested amountslot- target slot, or-1text- optional operation text- Returns:
truewhen the runtime accepted the request
-
bankPinDigit
public static boolean bankPinDigit(int digit) Queues one bank-PIN digit for native client-thread resolution.- Parameters:
digit- one decimal digit from0through9- Returns:
truewhen the runtime accepted the bounded request
-
getSceneBase
Returns the southwest tile of the loaded scene.- Returns:
- the southwest tile of the loaded scene
-
isLoggedIn
public static boolean isLoggedIn()Returnstruewhen the native client reports an active game session.- Returns:
truewhen the native client reports an active game session
-
isInCombat
public static boolean isInCombat()Returns whether the local player currently has a live combat target;falsewhen the adapter cannot determine combat state.- Returns:
- whether the local player currently has a live combat target;
falsewhen the adapter cannot determine combat state
-
getGameTickSequence
public static long getGameTickSequence()Returns the latest 600 ms tick sequence emitted by the native client hook.- Returns:
- the latest 600 ms tick sequence emitted by the native client hook
-
waitForNextTick
public static long waitForNextTick(long afterSequence, long timeoutMs) Blocks the script thread until a later native 600 ms tick or a bounded timeout. -
isActionReady
public static boolean isActionReady()Returnstruewhen the runtime can accept another native action.- Returns:
truewhen the runtime can accept another native action
-
isTileLoaded
Tests whether a tile is represented by the loaded scene.- Parameters:
tile- world tile to test- Returns:
truewhen the tile is loaded
-
interactObject
Invokes a scene-object action.- Parameters:
id- object identifiertile- exact object tileaction- zero-based menu-action index- Returns:
truewhen the runtime accepted the action
-
interactGroundItem
Invokes a ground-item action.- Parameters:
id- item identifiertile- exact item tileaction- zero-based menu-action index- Returns:
truewhen the runtime accepted the action
-
interactNpc
public static boolean interactNpc(int index, int action) Invokes an NPC action.- Parameters:
index- NPC scene indexaction- zero-based menu-action index- Returns:
truewhen the runtime accepted the action
-
walk
Requests native movement toward a loaded tile.- Parameters:
tile- target world tile- Returns:
truewhen the runtime accepted the request
-
cancelWalk
public static boolean cancelWalk()Cancels script-owned walking and replaces any active client route with a semantic native stop at the local player's current tile.- Returns:
truewhen the runtime accepted the cancellation
-
useFairyRing
Configures and activates a loaded fairy ring using semantic object and widget hooks. The player must already be beside a ring and must have a dramen/lunar staff equipped unless staffless travel is unlocked.- Parameters:
code- three-letter destination code, case-insensitive- Returns:
truewhen the runtime accepted the journey request
-
hopWorld
public static boolean hopWorld(int world) Requests a world hop.- Parameters:
world- destination world number- Returns:
truewhen the runtime accepted the request
-
logout
public static boolean logout()Returnstruewhen the runtime accepted the logout request.- Returns:
truewhen the runtime accepted the logout request
-
openTab
public static boolean openTab(int tab) Opens a top-level game tab.- Parameters:
tab- native tab code- Returns:
truewhen the runtime accepted the request
-
interactInventorySlot
public static boolean interactInventorySlot(int slot) Invokes the default action for an inventory slot.- Parameters:
slot- zero-based inventory slot- Returns:
truewhen the runtime accepted the action
-
interactInventoryItem
public static boolean interactInventoryItem(int itemId, int slot, int action) Invokes an action on an inventory item.- Parameters:
itemId- expected item identifierslot- zero-based inventory slotaction- zero-based menu-action index- Returns:
truewhen the runtime accepted the action
-
interactInventoryItemAction
Dispatches an exact live inventory menu action on the hooked client thread. -
interactInventoryItemOnItem
public static boolean interactInventoryItemOnItem(int sourceItemId, int sourceSlot, int targetItemId, int targetSlot) Atomically selects one exact inventory item and applies it to another. -
interactInventoryItemOnObject
public static boolean interactInventoryItemOnObject(int sourceItemId, int sourceSlot, int objectId, int worldX, int worldY, int plane) Atomically selects one exact inventory item and uses it on one exact scene object. -
interactInventoryItemOnNpc
public static boolean interactInventoryItemOnNpc(int sourceItemId, int sourceSlot, int npcId, int npcIndex) Atomically selects one exact inventory item and uses it on one exact NPC. -
interactEquipmentSlot
public static boolean interactEquipmentSlot(int slot) Invokes the default action for an equipment slot.- Parameters:
slot- native equipment-slot index- Returns:
truewhen the runtime accepted the action
-
cameraNorth
public static boolean cameraNorth()Returnstruewhen north-alignment was accepted.- Returns:
truewhen north-alignment was accepted
-
interactInventoryItemPrimaryAction
public static boolean interactInventoryItemPrimaryAction(int itemId, int slot, String expectedAction) Dispatches an item's live primary option, validated against an expected label.- Parameters:
itemId- inventory item identifierslot- inventory slotexpectedAction- label the primary option must carry- Returns:
truewhen the native queue accepted the request
-
interactComponent
Dispatches one component operation on an exact widget.- Parameters:
packedId-group << 16 | childchildIndex- dynamic child index, or -1 for the component itselfoperation- 1-based operation slot of the componenttarget- optional target text; may be empty- Returns:
truewhen the native queue accepted the request
-
interactWidget
Queues one exact label from a visible, freshWidgetSnapshot. Native code re-resolves the widget and derives its action slot; callers cannot provide an opcode, coordinates, sprite identity, or slot. -
castSpellOnNpc
Queues one revision-pinned target spell on one current NPC. Native code revalidates the spell widget, its coherent live panel, and the NPC's exact index/definition/tile before owning the measured two-leg action. Callers cannot supply an opcode, slot, coordinate, sprite, or holder. Acceptance is not a hit or damage confirmation. -
setRunEnabled
public static boolean setRunEnabled(boolean enabled) Requests the enabled or disabled player run state.
-