Documentation
¶
Overview ¶
Package gear finds equipment upgrades for a captured character from the dataset's items and loot_sources tables. The rules are in docs/gear.md.
The dataset records which stat types an item has, not their sizes. With stat types known, an item is scored from its item level scaled by how much the spec's weights value those types; otherwise from item level and quality alone, and the answer says so.
Index ¶
- Constants
- func ArmorTypeWord(classID, subclass int) string
- func EstimateRequiredLevel(itemLevel int) int
- func FromEverloot(v any) bool
- func Render(c character.Character, r Result) string
- func Upgrades(c character.Character, ds store.DataStore, group string) (map[string][]Candidate, error)
- func Weights(class, group string) (spec string, w map[int64]float64, rationale string, ok bool)
- type Candidate
- type Item
- type Options
- type Result
- type Source
Constants ¶
const ( SourceBelow = 5 SourceAbove = 3 )
Source level window: a creature is "in range" when its levels reach into [level-SourceBelow, level+SourceAbove].
const ( BasisStats = "stats" BasisItemLevel = "item level" )
Basis of a candidate's score.
const EquipWindow = 2
EquipWindow is how many levels above the character an item may require (known or estimated).
const EstimateGap = 20
EstimateGap is how far the estimate may exceed a known required level before the known one is distrusted: the dataset holds required level 1 for about 80 equippable items of item level 30 to 70 (scaling and event items), which are no use to a level-5 character. Real level-60 gear stays within it (item level 83 needs 60).
const EstimateOffset = 5
EstimateOffset is how far below its item level an item's required level is estimated to sit when the dataset holds 0 (unknown) for it: required level ~ max(1, item level - EstimateOffset).
const MaxSources = 3
MaxSources is how many sources a candidate lists.
Variables ¶
This section is empty.
Functions ¶
func ArmorTypeWord ¶ added in v0.7.11
ArmorTypeWord is an armor subclass as a player says it ("mail"); "" for anything else, a weapon or a shield included.
func EstimateRequiredLevel ¶
EstimateRequiredLevel is the required level assumed for an item whose dataset value is unknown.
func FromEverloot ¶
FromEverloot is true when an npcs.name_source value (nil on a client row) says Everloot named the creature.
Types ¶
type Candidate ¶
type Candidate struct {
Item Item
Slot string
Score float64
Delta float64 // score minus the equipped item's; the full score for an empty slot
Basis string // BasisStats or BasisItemLevel
Empty bool // the slot is empty
Soon bool // the item's ReqLevel is above the character's level (within EquipWindow)
Sources []Source
}
Candidate is an item that beats what the character wears in a slot.
type Item ¶
type Item struct {
ID int64
Name string
ItemLevel int
RequiredLevel int // the dataset's; 0 is unknown
ReqLevel int // what the search used: RequiredLevel, or an estimate when that is 0
Estimated bool
Quality int
Slot int
Bonding int
StatTypes []int64
StatsKnown bool
}
Item is the part of an items row the advisor uses.
type Options ¶
type Options struct {
Slot string // one capture slot name; empty for all
Limit int // most candidates per slot, best first; 0 for all
// NoSources skips the per-candidate source lookup, for a caller that finds its own.
NoSources bool
}
Options narrows a search. The zero value searches every slot and keeps every candidate.
type Result ¶
type Result struct {
Slots map[string][]Candidate
// ItemLevelOnly is true when no candidate was scored from stats.
ItemLevelOnly bool
Spec string // spec the weights are for; empty when none apply
Rationale string
Reason string // why scoring fell back to item level, when it did
}
Result is what a search found.
type Source ¶
type Source struct {
Kind string // creature, object, quest reward
ID int64
Name string // empty when the dataset has no name for it
// Everloot is true when the name comes from Everloot's drop rows (npcs.name_source).
Everloot bool
MinLevel *int
MaxLevel *int
Chance *float64 // percent, from drops / kills
InRange bool // a creature whose levels reach the character's level range
}
Source is one place an item drops or is rewarded. Level and chance fields are nil when unknown.