Class CharacterBuffsBroadcastSerializer
Wire format for CharacterBuffsBroadcast.
public static class CharacterBuffsBroadcastSerializer
- Inheritance
-
CharacterBuffsBroadcastSerializer
- Inherited Members
Remarks
Hand written for the same reason CharacterAttributesBroadcast is: a null array is
simply an empty one here rather than a sentinel, the removals are omitted entirely on a full
set, and the caps stop a malformed message allocating an arbitrarily large array before the
stream runs out.
It is not written for the length prefix, and this remark used to claim it was — that
the generated array serializer "spends four bytes on each length". It does not:
Writer.WriteArray writes the count with WriteSignedPackedWhole, one byte for
any count seen here. Worse, the counts below used to be written with
WriteUInt16, which is always two unpacked bytes (Writer.WriteUInt16
forwards straight to WriteUInt16Unpacked) — so the hand-written form was costing one
byte MORE per count than the generated one it was justified against. They are packed
WriteInt32/ReadInt32 now, which is one byte for a strip of up to 63 buffs.
Fields
MAX_BUFFS
Hard cap on entries, and separately on removals, in one message.
public const int MAX_BUFFS = 4096
Field Value
Remarks
Far above any real character's visible strip; small enough that either count still costs two packed bytes at the very worst, and one for anything a character actually carries.
Methods
ReadCharacterBuffsBroadcast(Reader)
Reads a CharacterBuffsBroadcast.
public static CharacterBuffsBroadcast ReadCharacterBuffsBroadcast(this Reader reader)
Parameters
readerReader
Returns
WriteCharacterBuffsBroadcast(Writer, CharacterBuffsBroadcast)
Writes a CharacterBuffsBroadcast.
public static void WriteCharacterBuffsBroadcast(this Writer writer, CharacterBuffsBroadcast value)
Parameters
writerWritervalueCharacterBuffsBroadcast