equipment

package
v0.0.0-...-5b87e35 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// I know this could be iota but this is way more readable :)
	UnknownSlot = -1
	Amulet      = 0
	Arm         = 1
	Head        = 2
	Leg         = 3
	RingLeft    = 4
	RingRight   = 5
	Torso       = 6
	WeaponLeft  = 7
	WeaponRight = 8
)

Constants for all the item slots. They can be converted to and from strings. UnknownSlot is treated as an invalid slot and used in error cases.

Variables

This section is empty.

Functions

This section is empty.

Types

type Equipment

type Equipment struct {
	Name       string `yaml:"Name"`
	FolderPath string `yaml:"FolderPath"`
	TablePath  string `yaml:"TablePath"`
	Items      []Item `yaml:"Items"`
}

Equipment is an entire equipment of a Titan Quest char plus all metadata for filesystem storage

func FromFile

func FromFile(path string) (*Equipment, error)

FromFile reads a given file path and builds an equipment struct from that.

func New

func New(name, folderPath string) (*Equipment, error)

New creates the memory construct for the table bases

func (*Equipment) Flush

func (e *Equipment) Flush() error

Flush creates the entire representation of the equipment in the filesystem.

type Item

type Item struct {
	SlotIdentifier string `yaml:"SlotIdentifier"`
	BaseName       string `yaml:"BaseName"`
	BaseRecord     string `yaml:"BaseRecord"`
	PrefixName     string `yaml:"PrefixName"`
	PrefixRecord   string `yaml:"PrefixRecord"`
	SuffixName     string `yaml:"SuffixName"`
	SuffixRecord   string `yaml:"SuffixRecord"`
}

Item holds all references to item configuration. Also this is used to represent the config structure.

func (*Item) Validate

func (i *Item) Validate() error

Validate validates an item. Currently this only checks if the slot identifier is valid.

type Slot

type Slot int

Slot is the slot where the equipment goes, lol

func SlotFromString

func SlotFromString(s string) (Slot, error)

SlotFromString converts a string representation of a slot into its constant value.

func (Slot) String

func (i Slot) String() string

Jump to

Keyboard shortcuts

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