paths

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 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 paths says how a character can dependably get an item: a quest reward, a craft, the Auction House, a dungeon boss or a named creature. An item with no such way is a random drop and is never offered as an upgrade. The rules are in docs/upgrade-paths.md.

Everything it returns is plain words: names only, never an item, quest, recipe or NPC id.

Index

Constants

View Source
const (
	Quest    = "quest"
	Craft    = "craft"
	Auction  = "auction"
	Dungeon  = "dungeon"
	Creature = "creature"
)

Path kinds, most dependable first. The UI picks an icon from the kind.

View Source
const (
	Often     = 15.0
	Sometimes = 5.0
	// NamedMin is the chance a named creature must carry the item at.
	NamedMin = 10.0
	// NamedMax is how many creatures may carry the item for it to count as theirs.
	NamedMax = 3
	// WorldDropMany is the number of creature sources above which an item is a random world drop.
	WorldDropMany = 5
	// DungeonWindow is how far a dungeon's level range may lie from the character's level.
	DungeonWindow = 3
)

Chance words: a drop chance above Often is "often", from Sometimes up to it "sometimes"; under Sometimes a drop is not dependable.

View Source
const TryPerSlot = 40

TryPerSlot is how many of a slot's best candidates are checked for a way to get them.

Variables

This section is empty.

Functions

func Money

func Money(copper int64) string

Money renders copper as "1g 20s": gold and silver, with copper only when under a silver.

func SlotOf

func SlotOf(c character.Character, ds store.DataStore, group string, itemID int64) string

SlotOf finds the capture slot an item is an upgrade for; "" when it is not one.

func Tradeable

func Tradeable(bonding, quality int) bool

Tradeable reports whether an item can be sold between players: not bound on pickup (1) or a quest item (4, 5), and common quality or better.

Types

type Gettable

type Gettable struct {
	Slot      string
	Candidate gear.Candidate
	Result    Result
}

Gettable is an upgrade candidate with its ways to get it.

func InSlot

func InSlot(c character.Character, ds store.DataStore, group, slot string, opt Options, limit int) ([]Gettable, error)

InSlot returns up to limit upgrades for one slot (empty for every slot, one per slot) that have a dependable way to be got, best first. An upgrade with no way is skipped.

type Options

type Options struct {
	// Prices holds real auction prices by item id; the capture holds none today.
	Prices map[int64]Price
	// PlanQuests are the quest ids the plan has as steps.
	PlanQuests map[int]bool
}

Options carries what the capture and the plan add to the dataset.

type Path

type Path struct {
	Kind     string    `json:"kind"`
	Line     string    `json:"line"` // one line, plain words
	Reagents []Reagent `json:"reagents,omitempty"`
	Quest    string    `json:"quest,omitempty"`
	QuestID  int       `json:"-"`
	Choice   bool      `json:"choice_reward,omitempty"`
}

Path is one dependable way to get an item.

type Price

type Price struct {
	Copper int64  `json:"copper"`
	Seen   string `json:"seen"`
}

Price is a real auction price: copper and the day it was seen (YYYY-MM-DD). A vendor sell price is never one.

type Reagent

type Reagent struct {
	Name    string `json:"name"`
	Need    int    `json:"need"`
	Have    int    `json:"have"`
	InBags  int    `json:"in_bags"`
	InBank  int    `json:"in_bank"`
	Missing int    `json:"missing"`
	How     string `json:"how,omitempty"` // how to get the missing part, in words
	ItemID  int64  `json:"-"`
}

Reagent is one reagent of a craft, with what the character holds and how to get the rest.

type Result

type Result struct {
	Item   string `json:"item"`
	Slot   string `json:"slot,omitempty"`
	Paths  []Path `json:"paths"`
	Reason string `json:"reason,omitempty"` // when there is no path: why, in words
	ItemID int64  `json:"-"`
}

Result is the ways to get one item, best first.

func For

func For(c character.Character, ds store.DataStore, itemID int64, opt Options) Result

For finds the dependable ways the character can get the item, best first.

func (Result) Best

func (r Result) Best() (Path, bool)

Best is the first path.

func (Result) Dependable

func (r Result) Dependable() bool

Dependable reports whether the item has at least one path.

func (Result) Text

func (r Result) Text() string

Text renders the result as plain sentences.

Jump to

Keyboard shortcuts

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