-
Notifications
You must be signed in to change notification settings - Fork 42
Split packets
DummkopfOfHachtenduden edited this page Mar 15, 2022
·
8 revisions
The concept of splitting data across multiple packets is used when its data might exceed 4090 bytes.
Usually such packets marked as Massive and parsed automatically by C# Silkroad Security API but there are some exceptions...
Opcode | Direction | Name |
---|---|---|
0x34A5 | S → C | SERVER_AGENT_CHARACTER_INFO_BEGIN (Empty) |
0x3013 | S → C | SERVER_AGENT_CHARACTER_INFO_DATA |
0x34A6 | S → C | SERVER_AGENT_CHARACTER_INFO_END (Empty) |
Opcode | Direction | Name |
---|---|---|
0x3017 | S → C | SERVER_AGENT_ENTITY_GROUPSPAWN_BEGIN |
0x3019 | S → C | SERVER_AGENT_ENTITY_GROUPSPAWN_DATA |
0x3018 | S → C | SERVER_AGENT_ENTITY_GROUPSPAWN_END |
Opcode | Direction | Name |
---|---|---|
0x34B3 | S → C | SERVER_AGENT_GUILD_INFO_BEGIN |
0x3101 | S → C | SERVER_AGENT_GUILD_INFO_DATA |
0x34B4 | S → C | SERVER_AGENT_GUILD_INFO_END |
Opcode | Direction | Name |
---|---|---|
0x3253 | S → C | SERVER_AGENT_GUILD_STORAGE_BEGIN |
0x3255 | S → C | SERVER_AGENT_GUILD_STORAGE_DATA |
0x3254 | S → C | SERVER_AGENT_GUILD_STORAGE_END |
Opcode | Direction | Name |
---|---|---|
0x3047 | S → C | SERVER_AGENT_INVENTORY_STORAGE_BEGIN |
0x3049 | S → C | SERVER_AGENT_INVENTORY_STORAGE_DATA |
0x3048 | S → C | SERVER_AGENT_INVENTORY_STORAGE_END |
The simplest strategy to parse these packets is to create a new temporary packet on _BEGIN
add the bytes from the _DATA
packet (there can be multiple) to it and handle it upon _END
Example:
private static Packet groupSpawnPacket;
//_BEGIN -> Create temporary packet and write header to it.
public static void EntityGroupSpawnBegin(Packet packet)
{
groupSpawnPacket = new Packet(0x0000);
groupSpawnPacket.WriteUInt8Array(packet.GetBytes());
}
//_DATA -> Write data to it
public static void EntityGroupSpawnData(Packet packet)
{
groupSpawnPacket.WriteUInt8Array(packet.GetBytes());
}
//_END -> Handle temporary packet
public static void EntityGroupSpawnEnd(Packet packet)
{
groupSpawnPacket.Lock();
var groupSpawnType = groupSpawnPacket.ReadUInt8();
var groupSpawnAmount = groupSpawnPacket.ReadInt16();
for (int i = 0; i < groupSpawnAmount; i++)
{
if (groupSpawnType == 0x01)
{
//spawn
parseEntity(groupSpawnPacket);
}
else
{
//despawn
uint uniqueID = groupSpawnPacket.ReadInt32();
}
}
}