A referência da API é gerada a partir dos comentários de documentação Go no código-fonte e está escrita em inglês.
package mergegame
import "github.com/nsgo-dev/game/pkg/mergegame"Visão geral
Package mergegame is experimental: its API and documented formats may change in a minor release. See the API stability policy. defines the small, deterministic data contract used by merge-game templates. A chain lists ordered tiers and their sell values.
Índice
Constantes
Funções
func Encode(d Document) ([]byte, error)Encode validates d and writes its deterministic YAML representation.
Tipos
type Chain struct {
// ID is the chain's non-empty identifier without surrounding spaces, unique within the document.
ID string `yaml:"id"`
// Tiers lists at least two tiers from lowest to highest, each with an ID unique within the chain.
Tiers []Tier `yaml:"tiers"`
}Chain describes the ordered tiers in one progression path.
type Document struct {
// Version is the format version and must be FormatVersion.
Version int `yaml:"version"`
// Chains lists at least one chain, each with a unique ID.
Chains []Chain `yaml:"chains"`
}Document is a versioned collection of merge chains.
func Parse(data []byte) (Document, error)Parse decodes and validates one canonical merge-chain YAML document.
func (d Document) ChainIDs() []stringChainIDs returns chain IDs in document order.
func (d Document) Next(chainID, tierID string) (Tier, bool)Next returns the tier immediately after tierID in chainID. It reports false when the tier is the chain's final tier or either ID is unknown.
func (d Document) SortedChainIDs() []stringSortedChainIDs returns a stable alphabetical copy of chain IDs.
func (d Document) Validate() errorValidate reports whether d has a supported version and unique valid chains and tiers.
type Tier struct {
// ID is the tier's non-empty identifier without surrounding spaces.
ID string `yaml:"id"`
// Value is the tier's non-negative sell value.
Value int `yaml:"value"`
}Tier is one merge progression level and its value.