Table of Contents

Class BankSetItemBroadcastSerializer

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Wire format for BankSetItemBroadcast.

public static class BankSetItemBroadcastSerializer
Inheritance
BankSetItemBroadcastSerializer
Inherited Members

Remarks

Hand written for the same two fields as InventorySetItemBroadcastSerializer, and for the same reason. TemplateID is a deterministic 32-bit hash (CachedScriptableObject.AddToCache) and Seed is full entropy by construction, so both span the whole range and FishNet's signed-packed form spends FIVE bytes on each where unpacked spends four. The login sync ships the ENTIRE bank in one BankSetMultipleItemsBroadcast, and a bank is the largest container a character owns. InstanceID stays packed — a database sequence value is small — as do the slot index and stack size. See ObservedBuffEntry.

Fields

MaxBankItems

Upper bound accepted for a bank array length, against a corrupt stream.

public const int MaxBankItems = 4096

Field Value

int

Remarks

Anchored on the container: BankController.OnAwake calls AddSlots(null, 100), so the largest legitimate array — a full bank sent in one BankSetMultipleItemsBroadcast at login — is 100 entries. As with the inventory there is no Constants value for it; the capacity lives in the controller, and this bound restates it rather than referencing it.

Deliberately looser than the inventory's ceiling relative to today's capacity, because the bank is the container most likely to grow — tabs, purchased expansions, shared account storage all add slots to this one. Truncating a legitimate array would silently delete rows from a player's stored goods, which is far worse than the allocation being prevented, so the headroom is large on purpose. Four thousand of these structs is a rounding error in memory; two billion is not, and that is the only case this stops.

Server → client, so the realistic trigger is a mangled or truncated stream rather than a hostile client — a reader that has lost its place treating arbitrary bytes as a length prefix. Insurance against corruption, not a security control.

Methods

ReadBankSetItemBroadcast(Reader)

public static BankSetItemBroadcast ReadBankSetItemBroadcast(this Reader reader)

Parameters

reader Reader

Returns

BankSetItemBroadcast

ReadBankSetItemBroadcastArray(Reader)

Reads an array of BankSetItemBroadcast.

public static BankSetItemBroadcast[] ReadBankSetItemBroadcastArray(this Reader reader)

Parameters

reader Reader

Returns

BankSetItemBroadcast[]

Remarks

A length past MaxBankItems cannot be allocated and cannot be resynchronised past either — the entries behind it are only locatable by trusting the count just rejected — so the array comes back empty and the caller applies nothing. Only the sender's own -1, which is not a length at all, means null.

WriteBankSetItemBroadcast(Writer, BankSetItemBroadcast)

public static void WriteBankSetItemBroadcast(this Writer writer, BankSetItemBroadcast value)

Parameters

writer Writer
value BankSetItemBroadcast

WriteBankSetItemBroadcastArray(Writer, BankSetItemBroadcast[])

Writes an array of BankSetItemBroadcast.

public static void WriteBankSetItemBroadcastArray(this Writer writer, BankSetItemBroadcast[] value)

Parameters

writer Writer
value BankSetItemBroadcast[]

Remarks

Explicit because the element carries [UseGlobalCustomSerializer]. That attribute tells FishNet the element has a hand-written serializer, and codegen then declines to synthesise one for the ARRAY as well — it emits nothing and says nothing at build time. The gap only appears when a broadcast carrying the array is actually sent, as "Write method not found for BankSetItemBroadcast[]", by which point the send has already failed. A null array is written as length -1 so it round-trips as null rather than as empty.