quests

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package quests places a quest in its quest line, from the dataset's quest_lines table. The rules are in docs/chain.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(c Chain, name string) string

Render is the plain-text form. name is the asked-for quest's name, which may be empty.

func Resolve

func Resolve(ds store.DataStore, text string) (id int64, name string, candidates []string)

Resolve turns a quest id or name into a quest id and name. The name index lists no quests, so a name is matched by scanning the quests table: exactly before partially; otherwise it returns the candidates and id 0.

Types

type Chain

type Chain struct {
	Found    bool   `json:"found"`
	LineID   int64  `json:"line_id,omitempty"`
	Line     string `json:"line,omitempty"`
	QuestID  int64  `json:"quest_id"`
	Position int    `json:"position,omitempty" jsonschema:"1-based place of the quest in the line"`
	Steps    []Step `json:"steps"`
	// NextQuestID is the quest after this one, 0 on the last step.
	NextQuestID int64 `json:"next_quest_id,omitempty"`
}

Chain is where a quest sits in its quest line. Found is false when the dataset has no quest_lines table or no line holds the quest; the other fields are then empty.

func Of

func Of(ds store.DataStore, questID int64) Chain

Of returns the chain the quest sits in; when it is in several lines, the one with the lowest id. Steps are ordered by the table's position column when it has one, else by file order.

func (Chain) Total

func (c Chain) Total() int

Total is the number of steps in the line.

func (Chain) Unlocks

func (c Chain) Unlocks() bool

Unlocks is true when another step follows this quest.

type Step

type Step struct {
	Position int    `json:"position" jsonschema:"1-based place in the line"`
	QuestID  int64  `json:"quest_id"`
	Name     string `json:"name,omitempty" jsonschema:"empty when the dataset has no quest name"`
}

Step is one quest of a line.

Jump to

Keyboard shortcuts

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