Appearance
sdk.packet
Catalog lookup + enqueue for uncovered protocol ops. Resolve by name (TalkMessage / GameclientMessageTalk), never by RVA. Nested objects (ObjectPosition, ObjectIdentifier) are not packets; write their live vtable the same way. Do not hard-code catalog counts: the IDA-generated inbound table is refreshed whenever the client protocol moves.
lua
local M = require("sdk.packet")Constants
Lua 5.4 has no enums — these are integer (or string) fields on the module.
| Name | Value | Summary |
|---|---|---|
TALK_PRIVATE_FROM | 4 | — |
TALK_PRIVATE_TO | 5 | — |
TALK_GM_PRIVATE_FROM | 15 | — |
TALK_GM_PRIVATE_TO | 16 | — |
STASH_STOW_ITEM | 0 | StashAction (type 40). Recovered from GameclientMessageStashAction serialize: field 1 action (varint +40), field 2 ObjectPosition* (+24), field 3 ObjectIdentifier* (+32), field 4 count (varint +44), field 5 extra (+48). Canary codes: 0 stow item, 1 stow container, 2 stow stack, 3 withdraw. |
STASH_STOW_CONTAINER | 1 | — |
STASH_STOW_STACK | 2 | — |
STASH_WITHDRAW | 3 | — |
QUICK_LOOT_SINGLE | 0 | Official proto: SINGLE_CORPSE=0, AREA_AT_CORPSE=1, AREA_AT_PLAYER=2 |
QUICK_LOOT_AREA_CORPSE | 1 | — |
QUICK_LOOT_AREA_PLAYER | 2 | — |
FIGHT_OFFENSIVE | 1 | — |
FIGHT_BALANCED | 2 | — |
FIGHT_DEFENSIVE | 3 | — |
CHASE_STAND | 0 | — |
CHASE_FOLLOW | 1 | — |
PVP_DOVE | 0 | — |
PVP_WHITE | 1 | — |
PVP_YELLOW | 2 | — |
PVP_RED | 3 | — |
get
function · get(name)
Returns table|nil: spec { name, rtti, type, va, rva, enqueue_rva }
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | catalog name or type id (TalkMessage, GameclientMessageTalk, 150) |
Returns
| Type | Summary |
|---|---|
table|nil | spec { name, rtti, type, va, rva, enqueue_rva } |
string|nil | err packet not in catalog |
list
function · list()
All outbound catalog rows.
supported
function · supported(name)
True when the type has a generated enqueue helper.
schema
function · schema(name)
1:1 TcParseTable row for an outbound or inbound type. Prefer catalog names (TalkMessage, SeekInContainer) so the client twin wins over the server one.
fields
function · fields(name)
Recovered schema fields for a packet name.
help
function · help(name)
Usage text: send line, RTTI, and every recovered field.
enqueue
function · enqueue(spec, queue, msg)
Enqueue a built message via the catalog helper. Do not pass an RVA.
identifier
function · identifier(item_id)
ObjectIdentifier nested message for an item id.
inventoryPos
function · inventoryPos(slot)
ObjectPosition case 2 (inventory slot 1..10).
containerPos
function · containerPos(container, slot)
ObjectPosition case 3 (container + slot).
objectPos
function · objectPos(nested, type_id)
Low-level ObjectPosition with an explicit type tag.
coordinate
function · coordinate(x, y, z)
Coordinate nested message.
worldmapPos
function · worldmapPos(x, y, z, stackpos)
ObjectPosition case 1 (worldmap). Never use this for inventory.
fromLoc
function · fromLoc(loc)
ObjectPosition from an SDK location table.
moveObject
function · moveObject(from, to, item_id, count)
MoveObject from one location to another.
talk
function · talk(text, opts)
TalkMessage (type 150). mode 1=say, 2=whisper, 5=private-to, 12=NPC.
Parameters
| Name | Type | Summary |
|---|---|---|
text | string | — |
opts | table|nil | mode, receiver, channel |
Returns
| Type | Summary |
|---|---|
boolean|nil | ok |
string|nil | err |
privateMessage
function · privateMessage(receiver, text)
Private talk to a character name.
useOnCreature
function · useOnCreature(item_id, loc, creature_id)
Use an item on a creature.
useObject
function · useObject(item_id, loc)
Use an item at a location.
buy
function · buy(item_id, count, opts)
BuyObject while an NPC trade is open.
stash
function · stash(action, pos, item_id, stackpos, count)
Stash stow/withdraw action.
sell
function · sell(item_id, count)
SellObject while an NPC trade is open.
greet
function · greet(creature_id)
Greet a creature id.
attack
function · attack(target)
Attack a creature id or Player.
follow
function · follow(target)
Follow a creature id or Player.
identAndPos
function · identAndPos(item_id, loc)
Pair an identifier with an ObjectPosition.
quickLoot
function · quickLoot(opts)
Official quick-loot (single, area corpse, or area player).
cancel
function · cancel()
Cancel the current action.
quitGame
function · quitGame()
Request logout / quit game.
setTactics
function · setTactics(opts)
Set fight/chase/secure/pvp tactics.
equipObject
function · equipObject(item_id)
Equip an item id (ammo to a worn quiver uses inventory case 2).
closeContainer
function · closeContainer(container)
Close a container id.
new
function · new(name)
Allocate an exact-size generated message object for advanced packets. The caller fills IDA-recovered offsets with these writers, then calls send(). Prefer the named helpers below whenever one exists.
upContainer
function · upContainer(container)
Open the parent of a container.
openParentContainer
function · openParentContainer()
Open-parent using the current container context.
seekInContainer
function · seekInContainer(container, index, category)
Seek/paginate a container.
useTwoObjects
function · useTwoObjects(from_id, from_loc, to_id, to_loc)
Use one object on another.
rotate
function · rotate(dir)
Turn to a direction.
send
function · send(name, values)
Fill scalar / string fields from the recovered schema and enqueue. Nested msg/rep fields still need a named helper (talk, moveObject, ...). Presence uses (1 << hasbit) from TcParseTable, not (1 << (field_no - 1)).
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | catalog or RTTI name |
values | table<string, | any>|nil |