Table of Contents

Class SimDataSchema

Namespace
LlamaLogic.Packages.Models.SimData
Assembly
LlamaLogic.Packages.dll

Represents the schema of a SimDataObject (🔒)

public sealed class SimDataSchema
Inheritance
SimDataSchema
Inherited Members

Remarks

The order of Columns is the order in which the columns' values are laid out in each row. For schemas the game reads with a fixed layout (e.g. Client_ and Renderer. schemas), this order must match the game's, which is why Decode(ReadOnlyMemory<byte>) preserves it. The game derives a schema's hash from its name and layout (see ComputedHash), so changing the columns or their order changes the hash the game expects.

Constructors

SimDataSchema(string, IEnumerable<SimDataColumn>)

Initializes a new SimDataSchema whose Hash is its ComputedHash

public SimDataSchema(string name, IEnumerable<SimDataColumn> columns)

Parameters

name string

The name of the schema

columns IEnumerable<SimDataColumn>

The columns of the schema, in layout order

Exceptions

ArgumentException

columns is empty, contains null, or contains two columns with the same name

SimDataSchema(string, uint, IEnumerable<SimDataColumn>)

Initializes a new SimDataSchema

public SimDataSchema(string name, uint hash, IEnumerable<SimDataColumn> columns)

Parameters

name string

The name of the schema

hash uint

The hash identifying the schema

columns IEnumerable<SimDataColumn>

The columns of the schema, in layout order

Exceptions

ArgumentException

columns is empty, contains null, or contains two columns with the same name

Properties

Columns

Gets the columns of the schema, in layout order

public IReadOnlyList<SimDataColumn> Columns { get; }

Property Value

IReadOnlyList<SimDataColumn>

ComputedHash

Gets the hash the game derives from the schema's Name and the layout of its Columns

public uint ComputedHash { get; }

Property Value

uint

Remarks

The game computes this as the sum of the Fnv32 hash of the lowercased name, the row size shifted left 16 bits, the number of columns, and, for each column, the Fnv32 hash of its lowercased name XOR its type shifted left 16 bits XOR its offset in the row shifted left 8 bits. Column flags do not contribute.

Hash

Gets the hash identifying the schema

public uint Hash { get; }

Property Value

uint

Name

Gets the name of the schema

public string Name { get; }

Property Value

string

Methods

GetColumnIndex(string)

Gets the index of the column with the specified name, or null if there is no such column

public int? GetColumnIndex(string name)

Parameters

name string

Returns

int?