Documentation ¶
Overview ¶
Package gamedata provides types for the following game data:
- Figure Data
- Figure Map
- Avatar Actions
- Furni Data
- Product Data
- External Texts
- External Variables
It also provides a web-based gamedata.Manager implementation for dynamically fetching and caching assets.
Index ¶
- type AvatarActionInfo
- type AvatarActions
- type ExternalTexts
- type ExternalVariables
- type FigureColorPaletteMap
- type FigureData
- type FigureDataManager
- type FigureLibraryManager
- type FigureManager
- type FigureMap
- type FigureMapLib
- type FigurePartColorInfo
- type FigurePartInfo
- type FigurePartSetInfo
- type FigurePartSetMap
- type FurniData
- type FurniDataManager
- type FurniInfo
- type FurniLibraryManager
- type FurniManager
- type Manager
- type ProductData
- type ProductInfo
- type ProductManager
- type TextManager
- type Type
- type VariableManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvatarActionInfo ¶
type AvatarActionInfo struct {
Id string
}
type AvatarActions ¶
type AvatarActions map[string]*AvatarActionInfo
func (*AvatarActions) UnmarshalBytes ¶
func (actions *AvatarActions) UnmarshalBytes(data []byte) (err error)
type ExternalTexts ¶
ExternalTexts defines dynamic strings loaded by the client.
func (*ExternalTexts) UnmarshalBytes ¶
func (texts *ExternalTexts) UnmarshalBytes(data []byte) (err error)
Unmarshals a text file as raw bytes into an ExternalTexts.
type ExternalVariables ¶
ExternalVariables defines dynamic variables loaded by the client.
func (*ExternalVariables) ClientVersion ¶
func (vars *ExternalVariables) ClientVersion() (version string, err error)
Gets the client version from the external variables, or returns an error if the key is not found.
func (*ExternalVariables) UnmarshalBytes ¶
func (vars *ExternalVariables) UnmarshalBytes(data []byte) (err error)
Unmarshals a text file as raw bytes into an ExternalVariables.
type FigureColorPaletteMap ¶
type FigureColorPaletteMap map[int]*FigurePartColorInfo
A FigureColorPaletteMap maps FigurePartColorInfo by ID.
type FigureData ¶
type FigureData struct { // Palettes maps figure color palettes by ID. // Each figure part set uses a certain color palette. Palettes map[int]FigureColorPaletteMap // SetPalettes maps figure part types to color palette IDs. SetPalettes map[nx.FigurePartType]int Sets map[nx.FigurePartType]FigurePartSetMap }
FigureData defines the figure part sets and color palettes used for Habbo avatars.
func (*FigureData) PaletteFor ¶
func (fd *FigureData) PaletteFor(partType nx.FigurePartType) FigureColorPaletteMap
PaletteFor finds the color palette for the specified figure part type.
func (*FigureData) UnmarshalBytes ¶
func (fd *FigureData) UnmarshalBytes(data []byte) (err error)
Unmarshals an XML document as raw bytes into a FigureData.
type FigureDataManager ¶
type FigureDataManager interface { Figure() *FigureData // Gets the figure data. FigureMap() *FigureMap // Gets the figure map. AvatarActions() AvatarActions // Gets the avatar actions. }
A FigureDataManager provides an interface to get figure data, figure map and avatar actions.
type FigureLibraryManager ¶
type FigureLibraryManager interface { res.LibraryManager LoadFigureParts(libraries ...string) error }
A FigureLibraryManager provides an interface to manage figure part libraries.
type FigureManager ¶
type FigureManager interface { FigureDataManager FigureLibraryManager }
A FigureManager provides an interface to manage figure data and libraries.
type FigureMap ¶
type FigureMap struct { Libs map[string]*FigureMapLib // Maps library name -> library. Parts map[nx.FigurePart]*FigureMapLib // Maps figure part -> library. }
A FigureMap defines mappings between figure part libraries and figure part identifiers.
func (*FigureMap) UnmarshalBytes ¶
Unmarshals an XML document as raw bytes into a FigureMap.
type FigureMapLib ¶
type FigureMapLib struct { Name string Revision int Parts []nx.FigurePart }
A FigureMapLib defines a figure part library name, revision and the figure parts contained within the library.
type FigurePartColorInfo ¶
type FigurePartColorInfo = x.FigureColor
A FigurePartColorInfo defines information used to color figure parts.
type FigurePartInfo ¶
type FigurePartInfo struct { Id int Type nx.FigurePartType Colorable bool Index int ColorIndex int }
A FigurePartInfo contains information about a figure part.
type FigurePartSetInfo ¶
type FigurePartSetInfo struct { Id int Gender string Club int Colorable bool // Whether this part set is colorable. Selectable bool // Whether this part set can be selected. Preselectable bool Parts []FigurePartInfo // The parts contained in this part set. HiddenLayers []nx.FigurePartType // Defines layers to be hidden when this part set is worn. }
A FigurePartSetInfo contains information about a collection of figure parts.
type FigurePartSetMap ¶
type FigurePartSetMap map[int]*FigurePartSetInfo
A FigurePartSetMap maps FigurePartsetInfo by ID.
type FurniData ¶
FurniData maps furniture info by identifier.
func (*FurniData) UnmarshalBytes ¶
Unmarshals a JSON document as raw bytes into a FurniData.
type FurniDataManager ¶
type FurniDataManager interface {
Furni() FurniData // Gets the furni data.
}
A FurniDataManager provides an interface to get furni data.
type FurniInfo ¶
type FurniInfo struct { // A numeric identifier for the furni. // A floor and wall item may share the same kind. // This identifier may differ between hotels. // Also known as the "Id" in the original document. // It is named "Kind" to differentiate it from a furni's unique instance ID. Kind int // The type of the furni, which may be a floor or wall item. Type nx.ItemType // A unique string identifier for a kind of furniture. // This identifier is the same across hotels. // Also known as "ClassName" in the original document. Identifier string Revision int Name string Description string Category string Environment string Line string DefaultDir int XDim int YDim int PartColors []string OfferId int Buyout bool BC bool ExcludedDynamic bool CustomParams string SpecialType nx.FurniType CanStandOn bool CanSitOn bool CanLayOn bool }
FurniInfo defines various information about a furniture.
type FurniLibraryManager ¶
type FurniLibraryManager interface { res.LibraryManager LoadFurni(libraries ...string) error // Loads the specified furni libraries by name. }
A FurniLibraryManager provides an interface to manage furni libraries.
type FurniManager ¶
type FurniManager interface { FurniDataManager FurniLibraryManager }
A FurniManager provides an interface to manage furni data and libraries.
type Manager ¶
type Manager interface { FigureManager FurniManager ProductManager TextManager VariableManager // Loads the specified game data types. // If none are specified, all game data types are loaded. Load(types ...Type) error // Gets whether all of the specified game data types are loaded. Loaded(types ...Type) bool }
A Manager provides an interface to manage game data.
func NewManager ¶
Creates a new web-based game data manager. The provided manager fetches assets from the web and caches assets to disk. The cache directory is located under `xabbo/nx` within the user's cache directory.
type ProductData ¶
type ProductData map[string]*ProductInfo
ProductData maps product info by product code.
func (*ProductData) UnmarshalBytes ¶
func (pd *ProductData) UnmarshalBytes(data []byte) (err error)
Unmarshals a JSON document as raw bytes into a ProductData.
type ProductInfo ¶
ProductInfo defines a product code, name and description.
type ProductManager ¶
type ProductManager interface {
Products() ProductData // Gets the products data.
}
A ProductManager provides an interface to get product data.
type TextManager ¶
type TextManager interface {
Texts() ExternalTexts // Gets the external texts.
}
A TextManager provides an interface to get external texts.
type Type ¶
type Type string
Represents a type of game data.
const ( GameDataHashes Type = "hashes" GameDataFurni Type = "furnidata" GameDataProduct Type = "productdata" GameDataVariables Type = "external_variables" GameDataTexts Type = "external_texts" GameDataFigure Type = "figurepartlist" GameDataFigureMap Type = "figuremap" GameDataAvatar Type = "HabboAvatarActions" )
type VariableManager ¶
type VariableManager interface {
Variables() ExternalVariables // Gets the external variables.
}
A VariableManager provides an interface to get external variables.