inventory

package
v0.7.114 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 13 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 BagReason = "a bag or quiver: the dataset holds no bag size, so it can't say whether it beats the one you carry"

BagReason is why a bag or quiver is left unplaced: the dataset holds no slot count for it.

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.

View Source
const KeyReason = "a key: keep it on your key ring; the dataset does not say what it opens or where to get another"

KeyReason is why a key is kept: the dataset says what a key is (item class 13), never what it opens or how to get another.

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 ClassKeepReason added in v0.7.99

func ClassKeepReason(c character.Character, name string) string

ClassKeepReason is why a character keeps an item their own class's spells use up (a druid's Maple Seed, a warlock's Soul Shard) or make (a warlock's Healthstone), by the item's name; "" for any other item or another class's. The dataset holds no spell reagent table, so this is the advisor's own short list (package classreagent). A hunter also keeps the pet food of the advisor's own short list (package petfood).

func FirstAidReason added in v0.7.99

func FirstAidReason(name string, row store.Row) string

FirstAidReason is why anyone keeps a bandage or an anti-venom: any character can use one with or without First Aid, and the dataset holds no heal amount or cure to rank one against another. A bandage is an item the dataset files as class 0 subclass 7 or one named so (the dataset files the Dense Runecloth Bandage as subclass 8); an anti-venom is named. "" for any other item.

func HasProfession added in v0.7.97

func HasProfession(c character.Character, name string) bool

HasProfession reports whether the character has the named profession.

func IsBag added in v0.7.97

func IsBag(row store.Row) bool

IsBag reports whether an item row is a bag, a quiver or an ammo pouch: a container worn in a bag slot, which is no gear to bank or sell.

func IsLockbox added in v0.7.99

func IsLockbox(name string) bool

IsLockbox reports whether an item is a lockbox or a junkbox, by name: the dataset files them as ordinary consumables and holds no lock skill or contents.

func LockboxReason added in v0.7.99

func LockboxReason(c character.Character, name string) string

LockboxReason is why a rogue keeps a lockbox or a junkbox: Pick Lock opens it; the dataset holds no lock skill or contents.

func Money

func Money(c int64) string

Money formats copper as gold, silver and copper.

func PetFoodReason added in v0.7.99

func PetFoodReason(diet string) string

PetFoodReason is why a hunter keeps an item that is food for a pet: the dataset holds no pet diet, so the advisor's own short list of pet foods decides.

func Reason added in v0.7.98

func Reason(quests []string) string

Reason is the keep line for a protected item.

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.

func StartsReason added in v0.7.100

func StartsReason(quests []string) string

StartsReason is the keep line for an item that starts a quest.

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
	SellAuction  int // Sell stacks the advice sends to the Auction House: the dataset holds no price for them
	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.

func ReviewAllWith added in v0.7.98

func ReviewAllWith(chars []character.Character, ds store.DataStore, qx *questie.Index) CrossResult

ReviewAllWith is ReviewAll that also reads the quests' items from the player's QuestieDB (qx may be nil). An item a quest in a character's log needs is kept by rule: never sold, tossed or mailed away.

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 Needs added in v0.7.98

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

Needs is what the quests in a character's log need, by rule: an item a quest in the log needs is never advised for sale, toss or a mail to an alt. A ready quest still needs its items, so an objective marked done counts.

The sources are the log's own item objectives (by name), and, from the player's QuestieDB when there is one, each log quest's item objectives, required source items and start item (by id).

func NeedsOf added in v0.7.98

func NeedsOf(c character.Character, qx *questie.Index) Needs

NeedsOf reads what the quests in c's log need. qx may be nil.

func (Needs) Finished added in v0.7.98

func (n Needs) Finished(id int64) string

Finished names a completed quest that used the item, or "" when none is known.

func (Needs) For added in v0.7.98

func (n Needs) For(id int64, name string, row store.Row) []string

For returns the titles of the log quests that need the item, empty when none does. A quest-bound item (quest class or bonding 4) is also needed when a log quest's objective text names it.

func (Needs) Names added in v0.7.98

func (n Needs) Names() []string

Names lists the lower-cased item names the log's item objectives name.

func (Needs) Starts added in v0.7.100

func (n Needs) Starts(id int64) []string

Starts returns the names of the quests the item starts that the character has not taken or done and could take, empty when none.

type Protected added in v0.7.98

type Protected struct {
	ItemID int64
	Item   string
	Quests []string
}

Protected is one stack the quest log needs.

func ProtectedItems added in v0.7.98

func ProtectedItems(c character.Character, ds store.DataStore, qx *questie.Index) []Protected

ProtectedItems lists, once per item, the items in the bags and bank that a quest in the log needs. ds and qx may be nil.

func (Protected) Reason added in v0.7.98

func (p Protected) Reason() string

Reason is "needed for <quest>".

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.

func ReviewWith added in v0.7.98

func ReviewWith(c character.Character, ds store.DataStore, qx *questie.Index) Result

ReviewWith is Review that also reads the quests' items from the player's QuestieDB (qx may be nil).

Jump to

Keyboard shortcuts

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