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 ClassKeepReason(c character.Character, name string) string
- func FirstAidReason(name string, row store.Row) string
- func HasProfession(c character.Character, name string) bool
- func IsBag(row store.Row) bool
- func IsLockbox(name string) bool
- func LockboxReason(c character.Character, name string) string
- func Money(c int64) string
- func PetFoodReason(diet string) 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
- func StartsReason(quests []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.
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 ¶
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
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
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
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 IsLockbox ¶ added in v0.7.99
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
LockboxReason is why a rogue keeps a lockbox or a junkbox: Pick Lock opens it; the dataset holds no lock skill or contents.
func PetFoodReason ¶ added in v0.7.99
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 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
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.
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
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.
func (Needs) For ¶ added in v0.7.98
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.
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.