inventory

package
v0.7.80 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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 inventory sorts a captured character's bags and bank into what to equip, keep for professions, hand in for quests, vendor, bank, or leave alone. The rules are in docs/inventory.md.

Nothing is guessed: an item the dataset does not know, a price the dataset does not hold and a quest link the capture does not state are each reported as unknown.

Index

Constants

View Source
const FarBelow = 10

FarBelow is how many levels under a character an item's required level must be for gear to count as far below their level.

Variables

View Source
var Actions = []Action{Sell, Mail, Keep_, Toss, Unsure}

Actions is the order the answer lists them in.

Order is the precedence of the groups, and the order Render lists them.

Functions

func Money

func Money(c int64) string

Money formats copper as gold, silver and copper.

func Render

func Render(r Result) string

Render is the plain-text form of a result.

func RenderAll added in v0.7.44

func RenderAll(r CrossResult, chars int) string

RenderAll is the plain-text form: Sell, Mail, Keep, Toss, then what is not sure.

func RenderFind added in v0.7.44

func RenderFind(r FindResult) string

RenderFind is the plain-text form of a Find result.

func RenderMail added in v0.7.44

func RenderMail(r CrossResult, name string) string

RenderMail is the plain-text form of MailFor.

Types

type Action added in v0.7.44

type Action string

Action is what to do with a stack, judged across all the captured characters.

const (
	Sell   Action = "sell"
	Mail   Action = "mail"
	Keep_  Action = "keep"
	Toss   Action = "toss"
	Unsure Action = "unsure"
)

type CrossResult added in v0.7.44

type CrossResult struct {
	Lines []Line
	// SellValue is the copper the vendor stacks sell for, over the stacks with a known price.
	SellValue    int64
	SellUnpriced int // vendor stacks with no known price, left out of SellValue
	SlotsFreed   int // bag slots emptied by selling, tossing or mailing what sits in the bags
	Notes        []string
}

CrossResult is the review across all characters.

func MailFor added in v0.7.44

func MailFor(chars []character.Character, target string, ds store.DataStore) (r CrossResult, name string, ok bool)

MailFor is what the other characters hold that the named character's professions or class use. ok is false when no captured character has that name.

func ReviewAll added in v0.7.44

func ReviewAll(chars []character.Character, ds store.DataStore) CrossResult

ReviewAll judges every stack of every character: sell, mail to an alt, keep or toss. It never guesses: an item the dataset lacks, or a rule the dataset cannot settle, is "unsure", and a price the dataset lacks stays unknown.

type Entry

type Entry struct {
	ItemID    int64
	Name      string
	Count     int
	Where     string // "bags" or "bank"
	Group     Group
	Reason    string
	SellPrice *int64 // copper per item; nil when the dataset has no price
}

Entry is one stack and why it is in its group.

type FindResult added in v0.7.44

type FindResult struct {
	Query string
	Items []Found
	Notes []string // characters whose bank was never seen
}

FindResult answers "where is my X".

func Find added in v0.7.44

func Find(chars []character.Character, query string, ds store.DataStore) FindResult

Find lists every character holding an item whose name contains query (a trailing plural "s" is forgiven), in bags or bank, and says which banks were never seen.

type Found added in v0.7.44

type Found struct {
	ItemID   int
	Item     string
	Holdings []Holding
	Total    int
}

Found is one item and everyone who holds it.

type Group

type Group string

Group is where an item belongs. An item takes the first group that fits, in this order.

const (
	Equip   Group = "equip"
	Keep    Group = "keep"
	Quest   Group = "quest"
	Vendor  Group = "vendor"
	Bank    Group = "bank"
	Unknown Group = "unknown"
)

type Holding added in v0.7.44

type Holding struct {
	Character string
	Where     string
	Count     int
}

Holding is one character's stack of a found item.

type Line added in v0.7.44

type Line struct {
	Character string
	ItemID    int64
	Item      string
	Count     int
	Where     string // "bags" or "bank"
	Action    Action
	To        string // the character to mail to, for Mail
	Reason    string
	Price     *int64 // copper per item the vendor pays; nil when the dataset has none
	AH        bool   // Sell: advice is the Auction House, so no vendor value is counted
}

Line is one stack and what to do with it.

type Result

type Result struct {
	Groups map[Group][]Entry
	// VendorValue is the copper the vendor stacks sell for, over the stacks with a known price.
	VendorValue int64
	// VendorUnpriced counts vendor stacks with no known price; VendorValue leaves them out.
	VendorUnpriced int
	// SlotsFreed is the bag slots emptied by vendoring and banking what sits in the bags.
	SlotsFreed int
	Notes      []string
}

Result is what Review found.

func Review

Review groups every bag and bank stack. ds may be nil: items are then placed only by the capture (quest objectives) and everything else is unknown.

Jump to

Keyboard shortcuts

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