Table of Contents

Class EquipmentReplicateInput

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Packs an owner's equipment request into the single byte EquipmentRequest carries.

public static class EquipmentReplicateInput
Inheritance
EquipmentReplicateInput
Inherited Members

Remarks

Layout, low bits first: two bits of EquipmentRequestKind, two bits of InventoryType, four bits of ItemSlot. Every field is checked against its width on the way in, so a value that does not fit is refused rather than silently aliased onto another socket — a sword equipped to the wrong part of the body is the failure ItemSlot's own remarks warn about.

Zero is "no request", by construction: None is zero and occupies the low bits, so a default replicate decodes to nothing asked whatever the other bits hold.

Fields

MaxSocket

The largest ItemSlot value the byte can carry.

public const int MaxSocket = 15

Field Value

int

Methods

TryPack(EquipmentRequestKind, InventoryType, ItemSlot, out byte)

Packs a request. Returns false, and zero, when any field is outside its width.

public static bool TryPack(EquipmentRequestKind kind, InventoryType container, ItemSlot socket, out byte packed)

Parameters

kind EquipmentRequestKind
container InventoryType
socket ItemSlot
packed byte

Returns

bool

TryUnpack(byte, out EquipmentRequestKind, out InventoryType, out ItemSlot)

Unpacks a request. Returns false for the no-request value and for any packed byte whose fields do not name a defined kind, container and socket.

public static bool TryUnpack(byte packed, out EquipmentRequestKind kind, out InventoryType container, out ItemSlot socket)

Parameters

packed byte
kind EquipmentRequestKind
container InventoryType
socket ItemSlot

Returns

bool