Appearance
sdk.engine
High-level reads: local player, creatures, viewport, typed inbound events. GetLocalPlayer / GetCreatures take native game.get_local_player / game.get_creatures when those C++ exports return a snapshot, then overlay TPlayerData (capacity, xp, ...) from the session walk. The walks below are also the fallback when native returns nil. GetPlayers / GetMonsters / GetNpcs use ClassifyKind.
lua
local M = require("sdk.engine")GetLocalPlayer
function · GetLocalPlayer()
Returns LocalPlayer|nil.
Returns
| Type | Summary |
|---|---|
LocalPlayer|nil | — |
GetLocalPosition
function · GetLocalPosition()
Local character map position, or nil when not in world.
GetSessionState
function · GetSessionState()
Sanitized official login/game-session state. No credentials, tokens, character identifiers, raw packets, or native pointers are exposed. has_credentials is a boolean only: the client may persist the email, never the password.
Returns
| Type | Summary |
|---|---|
GameSessionStatus|nil | state |
string|nil | err |
Reconnect
function · Reconnect(...)
Queue Tibia's retained-credential reconnect path. This accepts no arguments; true means locally queued, not that the server has admitted the character.
Returns
| Type | Summary |
|---|---|
boolean|nil | ok |
string|nil | status_or_error |
IsInProtectionZone
function · IsInProtectionZone()
true/false when the live PlayerState or current mapped tile is known; nil while logged out or when both sources are unavailable.
Returns
| Type | Summary |
|---|---|
boolean|nil | in_zone |
IsInPz
alias · IsInPz = IsInProtectionZone
Same as IsInProtectionZone.
Alias
Same as IsInProtectionZone.
GetWorldViewport
function · GetWorldViewport()
Visible world-map rectangle and camera.
GetCreatures
function · GetCreatures()
On-screen creatures as Player objects.
GetCreatureSnapshot
function · GetCreatureSnapshot()
Strict consumers (notably AoE/PvP safety) need to distinguish an authoritative empty creature list from a fallback that may be incomplete. The native snapshot is considered complete when the host call itself succeeds; the memory-walk fallback remains useful but is marked incomplete.
GetPlayers
function · GetPlayers()
GetCreatures filtered to other players.
GetMonsters
function · GetMonsters()
GetCreatures filtered to monsters.
GetNpcs
function · GetNpcs()
GetCreatures filtered to NPCs.
GetBattleList
function · GetBattleList()
On-screen creatures in battle-list order: same floor, visible viewport, then Chebyshev distance from the local player (official default sort).
on
function · on(name, fn)
Typed catalog names apply the recovered protobuf schema, then the matching sdk.events.* decoder (when one exists) before the callback. Raw "packet" still receives the universal named-field view.
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | — |
fn | fun(ev: | table): any |
off
function · off(id)
Release a subscription id from Engine.on / game.on.
onAny
function · onAny(fn)
Subscribe to every inbound protobuf event. The returned event always has raw_hex, size/object_size, has_bits (when present), and offset readers.
subscribe
alias · subscribe = on
Same as on.
Alias
Same as on.
unsubscribe
alias · unsubscribe = off
Same as off.
Alias
Same as off.
Events
function · Events()
Complete IDA-recovered inbound catalog. Rows contain type, name, rtti, size.
Event
function · Event(name_or_type)
Inbound catalog row by name or type id.
Schema
function · Schema(name)
1:1 TcParseTable row (size, has_bits, named fields) for any catalog type.
Fields
function · Fields(name)
Recovered schema fields for an inbound type.
help
function · help(name)
Usage text: subscribe line, RTTI, and every recovered field.
GetEventState
function · GetEventState(name)
Latest cached decoder state for an event kind.
GetContainerState
function · GetContainerState(container_id)
Cached open-container view by runtime id.
GetContainerStates
function · GetContainerStates()
All cached open-container views.
GetItems
function · GetItems(x, y, z)
Tracked map-tile item stacks at x,y,z.
GetTopMoveItem
function · GetTopMoveItem(x, y, z)
Top movable item on a tile, if known.
SquareContainsItem
function · SquareContainsItem(x, y, z, item_id)
True when the tile cache contains item_id.