Struct BuffReconcileEntry
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
ExpiryTick
Absolute network tick at which this buff expires.
public uint ExpiryTick
Field Value
NextTickTick
Absolute network tick at which the next OnTick fires.
public uint NextTickTick
Field Value
Stacks
Current stack count for this buff.
public int Stacks
Field Value
TemplateID
The buff template ID.
public int TemplateID
Field Value
TickCount
Number of ticks remaining for periodic effects.
public int TickCount
Field Value
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
otherBuffReconcileEntry
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
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
readerReaderprevBuffReconcileEntry[]
Returns
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
readerReader
Returns
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
writerWriterprevBuffReconcileEntry[]nextBuffReconcileEntry[]optionDeltaSerializerOption
Returns
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
writerWriter