Table of Contents

Interface IPacket

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

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.

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.

int RequiredSize { get; }

Property Value

int

Session

The session index of the packet.

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.

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.

void Deserialize(NetBuffer buffer)

Parameters

buffer NetBuffer

The buffer to deserialize the packet from.

Serialize(NetBuffer)

Serializes the packet into a NetBuffer.

void Serialize(NetBuffer buffer)

Parameters

buffer NetBuffer

The buffer to serialize the packet into.