Table of Contents

Struct BuffReconcileEntry

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A single buff entry for reconcile serialization. Uses tick-based timing fields (ExpiryTick, NextTickTick) mirroring CooldownReconcileEntry's immutable tick design. Tick values are absolute network ticks, so they are stable between structural changes (add/remove/stack), allowing the delta serializer's ReferenceEquals fast-path to suppress transmission on unchanged ticks with zero network overhead. Implements IEquatable<T> for efficient delta comparison in CharacterReconcileDataDeltaSerializer.

public struct BuffReconcileEntry : IEquatable<BuffReconcileEntry>
Implements
Inherited Members

Fields

CumulativeTickMultiplier

Running sum of (1 + Stacks) for each tick that has fired on this buff. See CumulativeTickMultiplier for the rationale. Carried in the reconcile entry so rollback replay and post-reconcile buff removal both reverse exactly the cumulative modifier applied.

public int CumulativeTickMultiplier

Field Value

int

ExpiryTick

Absolute network tick at which this buff expires.

public uint ExpiryTick

Field Value

uint

NextTickTick

Absolute network tick at which the next OnTick fires.

public uint NextTickTick

Field Value

uint

Stacks

Current stack count for this buff.

public int Stacks

Field Value

int

TemplateID

The buff template ID.

public int TemplateID

Field Value

int

TickCount

Number of ticks remaining for periodic effects.

public int TickCount

Field Value

int

Methods

Equals(BuffReconcileEntry)

Compares all fields for equality. Used by the delta serializer to determine which entries changed between ticks.

public bool Equals(BuffReconcileEntry other)

Parameters

other BuffReconcileEntry

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ReadArrayDelta(Reader, BuffReconcileEntry[])

Reads a buff array from the delta stream. High header bit = index-delta over prev, otherwise full array.

public static BuffReconcileEntry[] ReadArrayDelta(Reader reader, BuffReconcileEntry[] prev)

Parameters

reader Reader
prev BuffReconcileEntry[]

Returns

BuffReconcileEntry[]

Remarks

When count exceeds FishMMO.Shared.BuffReconcileEntry.MaxEntries, remaining entry data is drained from the reader to keep the stream position valid for subsequent fields. The previous state is preserved.

Allocation note: Both full-array and index-delta paths allocate a fresh array per call (intentional). Full-array is rare (only when the buff count changes). Index-delta copies are small. If profiling shows GC pressure, consider System.Buffers.ArrayPool<BuffReconcileEntry> with an explicit count sidecar, since Rent may return oversized arrays.

ReadFrom(Reader)

Reads a single entry's fields from the network reader.

public static BuffReconcileEntry ReadFrom(Reader reader)

Parameters

reader Reader

Returns

BuffReconcileEntry

WriteArrayDelta(Writer, BuffReconcileEntry[], BuffReconcileEntry[], DeltaSerializerOption)

Compares and writes buff arrays using index-delta compression. The wire header is a packed 16-bit value: high bit = delta mode, low 15 bits = entry count. FishMMO.Shared.BuffReconcileEntry.MaxEntries is 4096, so this saves 2 bytes per array header and 2 bytes per changed index.

public static bool WriteArrayDelta(Writer writer, BuffReconcileEntry[] prev, BuffReconcileEntry[] next, DeltaSerializerOption option)

Parameters

writer Writer
prev BuffReconcileEntry[]
next BuffReconcileEntry[]
option DeltaSerializerOption

Returns

bool

Remarks

Null / empty equivalence: both null and empty arrays serialize as count == 0 on the wire, and ReadArrayDelta(Reader, BuffReconcileEntry[]) returns null for both. Callers must treat null and empty as identical.

WriteTo(Writer)

Writes a single entry's fields to the network writer.

public void WriteTo(Writer writer)

Parameters

writer Writer