IPacket

Namespace: SharpPluginLoader.Core.Networking

Represents a packet that can be sent to via the game's networking system.

public interface IPacket

Properties

Id

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

public abstract uint Id { get; }

Property Value

UInt32

Remarks:

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

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 abstract PacketType Type { get; }

Property Value

PacketType

Remarks:

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 abstract int RequiredSize { get; }

Property Value

Int32

Methods

Serialize(NetBuffer)

Serializes the packet into a NetBuffer.

void Serialize(NetBuffer buffer)

Parameters

buffer NetBuffer
The buffer to serialize the packet into.

Deserialize(NetBuffer)

Deserializes the packet from a NetBuffer.

void Deserialize(NetBuffer buffer)

Parameters

buffer NetBuffer
The buffer to deserialize the packet from.