asset

package
v0.0.0-...-d091464 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive struct {
	// contains filtered or unexported fields
}

Archive is a collection of related asset.

func NewArchive

func NewArchive(data []byte) (*Archive, error)

NewArchive returns a new handle for an archive with data.

func (*Archive) File

func (a *Archive) File(name string) ([]byte, error)

File returns the data associated with a file in the archive.

type CacheFile

type CacheFile struct {
	// contains filtered or unexported fields
}

CacheFile is a handle to the game server cache data.

func NewCacheFile

func NewCacheFile(path string, index int) *CacheFile

NewCacheFile returns a handle to section of the game server cache data specified by an index.

func (*CacheFile) Archive

func (c *CacheFile) Archive(index int) (*Archive, error)

Archive returns a handle to an archive located within the game server cache.

func (*CacheFile) Data

func (c *CacheFile) Data(index int) ([]byte, error)

Data returns a slice of bytes representing a blob of data located at an index in the game server cache.

type DataReader

type DataReader struct {
	*bytes.Reader
}

func NewDataReader

func NewDataReader(b []byte) *DataReader

func (*DataReader) Byte

func (r *DataReader) Byte() (byte, error)

Byte reads a single byte.

func (*DataReader) HasMore

func (r *DataReader) HasMore() bool

HasMore returns true if more data is available to be read.

func (*DataReader) String

func (r *DataReader) String() (string, error)

String reads a variable-length string.

func (*DataReader) Uint16

func (r *DataReader) Uint16() (uint16, error)

Uint16 reads an unsigned, 16-bit integer in big-endian format.

func (*DataReader) Uint24

func (r *DataReader) Uint24() (uint32, error)

Uint24 reads an unsigned, 24-bit integer in big-endian format.

func (*DataReader) Uint32

func (r *DataReader) Uint32() (uint32, error)

Uint32 reads an unsigned, 32-bit integer in big-endian format.

func (*DataReader) VarByte

func (r *DataReader) VarByte() (uint16, error)

VarByte reads a variable-length value, either a byte or 2-bytes, depending on the most significant byte.

type InterfaceLoader

type InterfaceLoader struct {
	// contains filtered or unexported fields
}

InterfaceLoader loads interface data from game asset files.

func NewInterfaceLoader

func NewInterfaceLoader(archive *Archive) *InterfaceLoader

NewInterfaceLoader returns a new loader for interface data.

func (*InterfaceLoader) Load

func (l *InterfaceLoader) Load() ([]*model.Interface, error)

Load returns a slice of interface data extracted from game assets, or an error if the data could not be read.

type ItemLoader

type ItemLoader struct {
	// contains filtered or unexported fields
}

ItemLoader loads item data from game asset files.

func NewItemLoader

func NewItemLoader(archive *Archive) *ItemLoader

func (*ItemLoader) Load

func (l *ItemLoader) Load() ([]*model.Item, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles loading and managing game assets.

func NewManager

func NewManager(baseDir string) *Manager

NewManager returns a new asset Manager instance with game assets located at the given baseDir. You should call the Close() method once all assets have been loaded to free up resources.

func (*Manager) Close

func (m *Manager) Close()

Close releases all resources related to located assets.

func (*Manager) Interfaces

func (m *Manager) Interfaces() ([]*model.Interface, error)

Interfaces returns a slice of model.Interface data extracted from game assets.

func (*Manager) Items

func (m *Manager) Items() ([]*model.Item, error)

Items returns a slice of model.Item data extracted from game assets.

func (*Manager) Map

func (m *Manager) Map(objects []*model.WorldObject) (*model.Map, error)

Map returns the world map extracted from game assets and populated with objects.

func (*Manager) WorldObjects

func (m *Manager) WorldObjects() ([]*model.WorldObject, error)

WorldObjects returns a slice of model.WorldObject data extracted from game assets.

type MapLoader

type MapLoader struct {
	// contains filtered or unexported fields
}

MapLoader loads world map data from game asset files.

func NewMapLoader

func NewMapLoader(archive *Archive, cache *CacheFile) *MapLoader

func (*MapLoader) Load

func (l *MapLoader) Load(objects []*model.WorldObject) (*model.Map, error)

type WorldObjectLoader

type WorldObjectLoader struct {
	// contains filtered or unexported fields
}

WorldObjectLoader loads world object data from game asset files.

func NewWorldObjectLoader

func NewWorldObjectLoader(archive *Archive) *WorldObjectLoader

func (*WorldObjectLoader) Load

func (l *WorldObjectLoader) Load() ([]*model.WorldObject, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL