skilltree

package
v0.1.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package skilltree loads rAthena skill_tree.yml (Header SKILL_TREE_DB, Version 1) into a per-job skill tree registry with inheritance resolution.

Index

Constants

This section is empty.

Variables

View Source
var ErrCircularInherit = errors.New("circular Inherit")

ErrCircularInherit is returned (wrapped) when the Inherit graph between jobs contains a cycle. Detect it with errors.Is.

Functions

This section is empty.

Types

type JobTree

type JobTree struct {
	Job    string
	Skills map[string]*SkillEntry
}

JobTree is a single job's resolved skill tree, keyed by skill Name.

type Registry

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

Registry is a per-job lookup of resolved skill trees.

func Load

func Load(r io.Reader) (*Registry, error)

Load parses a rAthena skill_tree YAML stream and returns a Registry with all inheritances resolved. It expects Header.Type=="SKILL_TREE_DB" and Header.Version==1, otherwise it returns a wrapped error.

func LoadFile

func LoadFile(path string) (*Registry, error)

LoadFile is a convenience wrapper that opens a file and calls Load.

func (*Registry) Get

func (reg *Registry) Get(jobName string) (*JobTree, bool)

Get returns the JobTree for the given job name, or (nil, false) if not present. It is nil-safe on a nil receiver.

func (*Registry) Jobs

func (reg *Registry) Jobs() []string

Jobs returns the registered job names sorted ascending. It is nil-safe on a nil receiver and returns nil for an empty/nil registry.

func (*Registry) Len

func (reg *Registry) Len() int

Len returns the number of loaded jobs. It is nil-safe on a nil receiver.

type SkillEntry

type SkillEntry struct {
	Name      string
	MaxLevel  int16
	Exclude   bool
	BaseLevel int16
	JobLevel  int16
	Requires  []SkillRequirement
}

SkillEntry is one skill as it appears in a job's resolved tree. Every *SkillEntry stored in a Registry is a unique allocation per (job, skill): mutating the entry returned for one job MUST NOT affect any other job.

type SkillRequirement

type SkillRequirement struct {
	Name  string
	Level int16
}

SkillRequirement is a prerequisite skill and the level it must reach for another skill in the same job to be unlockable.

Jump to

Keyboard shortcuts

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