-
Notifications
You must be signed in to change notification settings - Fork 20
packet_object
Stjepan Bakrac edited this page May 22, 2020
·
1 revision
A packet object is a struct_object returned from the packet parser. It analyses incoming and outgoing packets and parses them according to the definition in the types.lua
file. The technical metadata of the packet is not part of this. It is passed to a registered function as the second parameter.
Assume you register the following function:
local packets = require('packets')
packets.incoming[0x017]:register(fn)
The incoming packet 0x017
is defined as follows in the types.lua
file:
-- Incoming Chat
types.incoming[0x017] = struct({
chat = {0x00, chat},
gm = {0x01, boolbit(uint8), offset=0},
formatted = {0x01, boolbit(uint8), offset=3},
zone = {0x02, zone},
name = {0x04, pc_name},
message = {0x14, string(0xEC)},
})
Now the fn
function might receive the following struct as the first parameter:
{
-- Content data, only provided based on what is defined in the types.lua
chat = 1, -- /say
gm = true, -- Sent by a GM
formatted = false, -- No specific formatting
zone = 0, -- This parameter is only set during /yell
name = 'Dave', -- Name of the sender
message = 'Jormy is looking forward to you...', -- Message
}
And this info would be the second parameter:
{
-- Technical data, always provided
modified = '...', -- binary string
modified_size = 256,
original = '...', -- binary string
original_size = 256,
id = 23,
direction = 'incoming',
timestamp = 123456789,
blocked = false,
injected = false,
path = '/incoming/23',
}
- Background and Architecture
- Windower Data Locations
- Code Standards and Guidelines
- Addon Development
- Windower Commands
- Packet Tutorial
- burdometer
- config
- delay_me_not
- distance
- dress_up
- enternity
- fps
- ime
- logger
- party_time
- paste
- pouches
- send
- shortcuts
- speedometer
- target_info
- terminate
- timestamp
- window_title
- Game
- Windower
- General