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
- Variables
- func HasProfession(c character.Character, name string) bool
- func IsBag(row store.Row) bool
- func Money(c int64) string
- func Reason(quests []string) string
- func Render(r Result) string
- func RenderAll(r CrossResult, chars int) string
- func RenderFind(r FindResult) string
- func RenderMail(r CrossResult, name string) string
- type Action
- type CrossResult
- type Entry
- type FindResult
- type Found
- type Group
- type Holding
- type Line
- type Needs
- type Protected
- type Result
Constants ¶
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.
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 ¶
Actions is the order the answer lists them in.
Order is the precedence of the groups, and the order Render lists them.
Functions ¶
func HasProfession ¶ added in v0.7.97
HasProfession reports whether the character has the named profession.
func IsBag ¶ added in v0.7.97
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 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.
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.
func ReviewAllWith ¶ added in v0.7.98
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".
type Group ¶
type Group string
Group is where an item belongs. An item takes the first group that fits, in this order.
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 (Needs) Finished ¶ added in v0.7.98
Finished names a completed quest that used the item, or "" when none is known.
type Protected ¶ added in v0.7.98
Protected is one stack the quest log needs.
func ProtectedItems ¶ added in v0.7.98
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.
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.