Table of Contents

Class WorldObjectDataModel

Namespace
LlamaLogic.Packages.Models.World
Assembly
LlamaLogic.Packages.dll

Represents a WorldObjectData resource: the objects, routing footprints and locators of a world's lots (🔓)

public sealed class WorldObjectDataModel : Model, IModel<WorldObjectDataModel>, IModel
Inheritance
WorldObjectDataModel
Implements
Inherited Members

Remarks

A world file is a package (see DataBasePackedFile); this models one of the resources in it, not the file. Versions 7 through 10 are supported: 10 is the version of every world file the game currently ships, and 7 that of older ones. Version 8 added each object's Snow flag, version 9 each lot's StairLocators and version 10 each object's Flags.

Properties

Lots

Gets the lots

public Collection<WorldObjectDataLot> Lots { get; }

Property Value

Collection<WorldObjectDataLot>

ResourceName

Gets the name of this resource if it has one

public override string? ResourceName { get; }

Property Value

string

SupportedTypes

Gets a list of resource types that this model supports

public static ISet<ResourceType> SupportedTypes { get; }

Property Value

ISet<ResourceType>

Version

Gets/sets the version of the resource, which determines which values Encode() writes

public uint Version { get; set; }

Property Value

uint

Exceptions

ArgumentOutOfRangeException

The value is not 7 through 10

Methods

Decode(ReadOnlyMemory<byte>)

Decodes the resource in raw format to produce an operable model (🔄️🏃)

public static WorldObjectDataModel Decode(ReadOnlyMemory<byte> data)

Parameters

data ReadOnlyMemory<byte>

Returns

WorldObjectDataModel

Exceptions

InvalidDataException

The data is not a well-formed world object data resource of version 7 through 10

Encode()

Encodes the resource model into raw format (🔄️🏃)

public override ReadOnlyMemory<byte> Encode()

Returns

ReadOnlyMemory<byte>

Exceptions

InvalidOperationException

A lot has StairLocators but Version is less than 9, which cannot store them

GetName(Stream)

Gets the name of a resource from its raw data, if it has one (🔄️💤)

public static string? GetName(Stream stream)

Parameters

stream Stream

Returns

string

GetNameAsync(Stream, CancellationToken)

Gets the name of a resource from its raw data, if it has one, asynchronously (🔄️💤)

public static Task<string?> GetNameAsync(Stream stream, CancellationToken cancellationToken = default)

Parameters

stream Stream
cancellationToken CancellationToken

Returns

Task<string>