stats

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: 8 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 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

View Source
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.

View Source
const (
	MaxInsights = 3
	MaxInsight  = 120
)

MaxInsights and MaxInsight bound what the player reads.

View Source
const (
	SourceCaptured = "captured" // the addon's recorded totals
	SourceGear     = "gear"     // derived: how many worn items carry each stat
	SourceNone     = "none"
)

Sources of the totals.

View Source
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.

View Source
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.

View Source
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.

View Source
const (
	RoleDamage = "damage"
	RoleTank   = "tank"
	RoleHealer = "healer"
)

Roles.

View Source
const (
	PrefBalanced = "balanced"
	PrefDamage   = "damage"
	PrefSurvival = "survival"
)

Stat preferences, stored with the play style.

View Source
const LowLevel = 20

LowLevel is the level below which the numbers are small and quest gear matters more than tuning.

View Source
const SpellPower = "spell_power"

SpellPower is the weight name of the item stat that adds damage and healing to spells.

Variables

View Source
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.

View Source
var StatNames = map[int64]string{/* contains filtered or unexported fields */}

StatNames maps the dataset's stat type ids to stat names.

View Source
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

func Adjust(weights map[string]float64, pref string) map[string]float64

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 ClassWord

func ClassWord(class string) string

ClassWord is "Warrior" for "WARRIOR".

func Classes

func Classes() []string

Classes are the class tokens the table covers.

func Effects added in v0.7.56

func Effects(class string, t *character.Totals) map[string]string

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

func ItemStats(row store.Row) map[int64]int

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 Name

func Name(stat string) string

Name is a stat as a player says it.

func SuffixRows added in v0.7.64

func SuffixRows(ds store.DataStore) []store.Row

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.

func Verified added in v0.7.56

func Verified(s Suffix, rows []store.Row) bool

Verified reports whether the random_suffixes rows hold the suffix with exactly the stats it says. With no rows the curated table is trusted. Item names are never matched: elixirs and scrolls share the words.

Types

type Agreement added in v0.7.63

type Agreement struct {
	PredictedMana, PredictedCrit float64
	ManaOK, CritOK               bool
}

Agreement is the cross-check of the class rules against a character's capture.

func CrossCheck added in v0.7.63

func CrossCheck(class string, t *character.Totals) (Agreement, bool)

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.

func (Agreement) OK added in v0.7.63

func (c Agreement) OK() bool

OK reports whether the rules agree with the capture on both mana and spell crit.

type Prof

type Prof struct {
	Profile
	Weights map[string]float64 // after the stat preference
	Focus   string
}

Prof is a character's profile and its adjusted weights: the one source every feature reads.

func For

func For(c character.Character, group string) (Prof, bool)

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

func (p Prof) ItemWeights() map[string]float64

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) Lead added in v0.7.56

func (p Prof) Lead() string

Lead is the primary stat.

func (Prof) Order added in v0.7.56

func (p Prof) Order() []string

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

func (p Prof) RankSuffixes() []Suffix

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.

func (Prof) Title

func (p Prof) Title() string

Title is "Fury · leveling".

func (Prof) VerifiedTop added in v0.7.56

func (p Prof) VerifiedTop(rows []store.Row, n int) []Suffix

VerifiedTop is the top n suffixes for the priority that the random_suffixes rows confirm.

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 ForClass

func ForClass(class string) (Profile, bool)

ForClass is the balanced fallback of a class.

func Lookup

func Lookup(class, spec, role string) (Profile, bool)

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.

func (Profile) Label

func (p Profile) Label() string

Label is the profile's short name: the spec, or the class for a fallback.

func (Profile) Reason

func (p Profile) Reason(stat string) string

Reason is the one-line plain reason a stat matters (or not) to a profile.

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.

func Check

func Check(c character.Character, ds store.DataStore, group string) Result

Check reads the character's stats against its play style's profile. group is the character's top talent group name ("" when unknown). ds may be nil: only recorded totals are then read.

type Suffix added in v0.7.56

type Suffix struct {
	Key   string
	Name  string
	Stats []int64
	Words string
}

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

func SuffixByKey(key string) (Suffix, bool)

SuffixByKey is the suffix with the key, "eagle".

Jump to

Keyboard shortcuts

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