Documentation
¶
Overview ¶
Package stats is the stat compass: per class, spec and role stat priorities (our own curated table), a plain-words stat check of a character against them, and the weights every other feature (upgrade ranking, Auction House suffixes) shares, so the advice agrees everywhere.
THE WEIGHTS ARE BALLPARK. They say how much a stat type matters to a play style, from 0 to 1, as a guide for a leveling or dungeon character, not a simulation. Players differ; the advice says so.
Index ¶
- Constants
- Variables
- func Adjust(weights map[string]float64, pref string) map[string]float64
- func ClassWord(class string) string
- func Classes() []string
- func Effects(class string, t *character.Totals) map[string]string
- func ItemStats(row store.Row) map[int64]int
- func Name(stat string) string
- func SuffixRows(ds store.DataStore) []store.Row
- func Verified(s Suffix, rows []store.Row) bool
- type Agreement
- type Prof
- type Profile
- type Result
- type Suffix
Constants ¶
const ( NeedsPlayStyle = "play_style" Hook = "Choose a play style for a stat check" )
NeedsPlayStyle and Hook are ADV-093's structured answer for a character with no play style.
const ( MaxInsights = 3 MaxInsight = 120 )
MaxInsights and MaxInsight bound what the player reads.
const ( SourceCaptured = "captured" // the addon's recorded totals SourceGear = "gear" // derived: how many worn items carry each stat SourceNone = "none" )
Sources of the totals.
const ( SpellHealing = "spell_healing" SpellDamage = "spell_damage" ExtraArmor = "extra_armor" )
The weight names of the older item stats: bonus healing and bonus damage on a Classic item, and the extra armor a green item adds to its base armor.
const ( Defense = "defense" Hit = "hit" MP5 = "mp5" )
The weight names of the combat ratings a Classic-era item carries: Defense Rating, Hit Rating and mana per five seconds. Crit is the stat package's own Crit.
const ( Strength = "strength" Agility = "agility" Stamina = "stamina" Intellect = "intellect" Spirit = "spirit" Armor = "armor" Dodge = "dodge" Parry = "parry" Block = "block" AttackPower = "attack_power" Crit = "crit" )
Stat names, as the profile tables and the gear weights spell them.
const ( RoleDamage = "damage" RoleTank = "tank" RoleHealer = "healer" )
Roles.
const ( PrefBalanced = "balanced" PrefDamage = "damage" PrefSurvival = "survival" )
Stat preferences, stored with the play style.
const LowLevel = 20
LowLevel is the level below which the numbers are small and quest gear matters more than tuning.
const SpellPower = "spell_power"
SpellPower is the weight name of the item stat that adds damage and healing to spells.
Variables ¶
var Prefs = []struct{ Value, Label string }{ {PrefBalanced, "Balanced"}, {PrefDamage, "More damage"}, {PrefSurvival, "More survivability"}, }
Prefs are the allowed stat preferences with the words the player sees.
Primary are the stats an item carries and a total can be compared across.
var StatNames = map[int64]string{/* contains filtered or unexported fields */}
StatNames maps the dataset's stat type ids to stat names.
var Suffixes = []Suffix{ {"eagle", "of the Eagle", []int64{idStamina, idIntellect}, "Stamina + Intellect"}, {"owl", "of the Owl", []int64{idIntellect, idSpirit}, "Intellect + Spirit"}, {"whale", "of the Whale", []int64{idStamina, idSpirit}, "Stamina + Spirit"}, {"bear", "of the Bear", []int64{idStrength, idStamina}, "Strength + Stamina"}, {"tiger", "of the Tiger", []int64{idStrength, idAgility}, "Strength + Agility"}, {"monkey", "of the Monkey", []int64{idAgility, idStamina}, "Agility + Stamina"}, {"falcon", "of the Falcon", []int64{idAgility, idIntellect}, "Agility + Intellect"}, {"wolf", "of the Wolf", []int64{idAgility, idSpirit}, "Agility + Spirit"}, {"boar", "of the Boar", []int64{idStrength, idSpirit}, "Strength + Spirit"}, {"gorilla", "of the Gorilla", []int64{idStrength, idIntellect}, "Strength + Intellect"}, {"strength", "of Strength", []int64{idStrength}, "Strength"}, {"agility", "of Agility", []int64{idAgility}, "Agility"}, {"stamina", "of Stamina", []int64{idStamina}, "Stamina"}, {"intellect", "of Intellect", []int64{idIntellect}, "Intellect"}, {"spirit", "of Spirit", []int64{idSpirit}, "Spirit"}, }
Suffixes is every suffix the advice can name, in the order a tie falls back to.
Functions ¶
func Adjust ¶
Adjust returns the weights with a stat preference applied: "damage" lifts the damage stats and eases the survival ones, "survival" the reverse. Weights stay within 0 to 1, and the primary stat (the one the profile weights highest) always keeps the lead: a preference moves the other stats up or down next to it but never past it.
func Effects ¶ added in v0.7.56
Effects are the per-point numbers for a character, one phrase per stat ("+0.06% spell crit a point"): the client's own when the capture has them, else derived from class rules and shown only when they agree with the captured mana and spell crit (see CrossCheck). Empty when there are none to trust.
func ItemStats ¶ added in v0.7.80
ItemStats is how much of each stat an items row carries, keyed by the client's stat type id: the dataset's `stats` column (type and amount of each stat). The store reads that column as one flat list, all the types and then all the amounts, so the list is used only when it is twice as long as `stat_types` and its first half is exactly those types; any other shape (an older dataset without the column, a mismatch) gives nil, and the caller falls back to counting the types.
func SuffixRows ¶ added in v0.7.64
SuffixRows is the dataset's random_suffixes table, or nil when the dataset has none (or no dataset): then the curated table above is trusted as it stands.
Types ¶
type Agreement ¶ added in v0.7.63
Agreement is the cross-check of the class rules against a character's capture.
func CrossCheck ¶ added in v0.7.63
CrossCheck predicts manaMax and spell crit from the class rules and compares them with the capture. ok is false when the class has no rule or the capture lacks Intellect, level, mana or spell crit.
type Prof ¶
Prof is a character's profile and its adjusted weights: the one source every feature reads.
func For ¶
For is the profile and weights of a character with a play style; ok is false with none or for a class the table does not know. group is the character's top talent group, used when the play style names no spec.
func (Prof) ItemWeights ¶ added in v0.7.80
ItemWeights are the profile's weights read for gear: the five primaries as they stand, plus the item stats a profile does not list but that do the same job as its lead stat. Spell Power counts as much as Intellect for a caster or healer (it is what their gear carries instead of, or besides, Intellect), and so does the older bonus healing for a healer and bonus damage for a caster; Attack Power counts four-fifths of the better of Strength and Agility for a melee, ranged or feral build, as the gear weights file does for the specs it lists. A tank, whose profile already names armor and defences, counts the extra armor a green item adds as much as armor, and Defense Rating as much as Stamina. A damage dealer counts Hit and Crit Rating, a healer Crit Rating and mana per five seconds. The stat check and the digest keep reading Weights.
func (Prof) Order ¶ added in v0.7.56
Order is the profile's priority: the stats that matter (weight at least fineWeight, the five primary stats and, for tanks, armor), highest weight first. The primary stat always leads (see Adjust); a tie keeps the table's order of the primary stats.
func (Prof) RankSuffixes ¶ added in v0.7.56
RankSuffixes orders the suffixes for a priority: only suffixes that carry the priority's lead stat and no stat the priority leaves out (a weight under fineWeight: Spirit for a Destruction Warlock), best first by the sum of the weights of the stats they give (so Stamina + Intellect beats Intellect + Spirit when Stamina outweighs Spirit, and a pair beats the single stat). A tie keeps the table order.
type Profile ¶
type Profile struct {
Class string // class token, "WARRIOR"
Spec string // tree name; empty for the class's fallback
Role string
Arch string // which reasons apply
Weights map[string]float64
}
Profile is one stat priority list.
func Lookup ¶
Lookup picks the profile for a class, a spec the player chose (a tree name, or a talent group name that contains one) and a role. The spec wins when it names a profile of the class; else the role's first profile; else the class's balanced fallback (its first profile). ok is false for a class the table does not know.
type Result ¶
type Result struct {
Needs string `json:"needs,omitempty" jsonschema:"play_style when the character has no play style; offer the choices"`
Hook string `json:"hook,omitempty"`
Profile string `json:"profile,omitempty" jsonschema:"for example 'Fury · leveling'"`
Insights []string `json:"insights,omitempty" jsonschema:"one to three plain sentences, ranked by impact"`
Asks []string `json:"asks,omitempty"`
// Internal: for the answer's reasoning and the report, never to be quoted as numbers.
Source string `json:"source,omitempty" jsonschema:"captured totals, gear-only (derived from worn items) or none"`
Lean map[string]float64 `json:"lean,omitempty" jsonschema:"per stat, how far the wanted share is above (positive) or below the share held; internal"`
Totals map[string]float64 `json:"totals,omitempty" jsonschema:"the numbers the check read; internal, never quote them"`
Swap []string `json:"swap,omitempty" jsonschema:"worn items that carry a stat the play style barely uses, to swap first"`
Weight map[string]float64 `json:"weights,omitempty" jsonschema:"the profile's stat weights after the preference; internal"`
// Priority is the stats in order, the primary stat first; Suffixes the item suffixes that fit, best first.
Priority []string `json:"priority,omitempty" jsonschema:"the stats that matter, the primary stat first; internal"`
Suffixes []string `json:"suffixes,omitempty" jsonschema:"item suffixes that fit the priority, best first, such as 'of the Eagle'"`
}
Result is a stat check. Insights are the player's words; Lean and the totals are internal.
type Suffix ¶ added in v0.7.56
Suffix is a random stat suffix of world-drop gear: its name, the stats it gives (the client's stat type ids) and the words for them. This is a curated game-fact table (the dataset holds item names and stat ids, not the suffix list); a suffix is checked against the dataset's random_suffixes table when there is one (see Verified).
func SuffixByKey ¶ added in v0.7.56
SuffixByKey is the suffix with the key, "eagle".