Table of Contents

Class Packet

Namespace
SharpPluginLoader.Core.Networking
Assembly
SharpPluginLoader.Core.dll

Represents a game packet.

public class Packet : MtObject, IPacket
Inheritance
Packet
Implements
Inherited Members

Remarks

Warning: Do not inherit from this class for the purpose of creating custom packets! Implement the IPacket interface directly instead.

Constructors

Packet()

public Packet()

Packet(nint)

public Packet(nint instance)

Parameters

instance nint

Properties

Id

The ID of the packet. This is used to identify the packet type.

public uint Id { get; }

Property Value

uint

Remarks

The game uses the DTI Id of each packet as the packet ID. You can use Crc32(string, int) to generate a unique Id.
Note: Do not serialize this value. It is automatically serialized by the framework.

RequiredSize

The number of bytes required for the native representation of the packet.

public int RequiredSize { get; }

Property Value

int

Session

The session index of the packet.

public SessionIndex Session { get; }

Property Value

SessionIndex

Remarks

Note: Do not serialize this value. It is automatically serialized by the framework.

Type

The type of the packet.

public PacketType Type { get; }

Property Value

PacketType

Remarks

Note: Do not serialize this value. It is automatically serialized by the framework.

Methods

Deserialize(NetBuffer)

Deserializes the packet from a NetBuffer.

public void Deserialize(NetBuffer buffer)

Parameters

buffer NetBuffer

The buffer to deserialize the packet from.

Serialize(NetBuffer)

Serializes the packet into a NetBuffer.

public void Serialize(NetBuffer buffer)

Parameters

buffer NetBuffer

The buffer to serialize the packet into.