Documentation
¶
Overview ¶
Package professions plans profession leveling and lists the materials worth keeping, from the dataset's recipes and recipe_reagents tables and the captured skills, bags and bank. The rules are in docs/professions.md.
Nothing is inferred: a recipe with no skill-up thresholds, a recipe with no reagent rows and a bank that was never captured are each reported as unknown.
Index ¶
- Constants
- Variables
- func FarMaterials(c character.Character, ds store.DataStore) map[int64][]string
- func Money(c int64) string
- func NextSkillUp(c character.Character, ds store.DataStore, profession string) string
- func ReagentUsers(ds store.DataStore) (users map[int64][]string, ok bool)
- func Render(plans []Leveling) string
- func RenderBenchmark(b Benchmark) string
- func RenderPairings(a []Advice) string
- func RenderPath(pa Path) string
- type Advice
- type Band
- type BenchBand
- type BenchEfficiency
- type BenchFishItem
- type BenchFishZone
- type BenchMake
- type BenchMaterial
- type BenchOptions
- type BenchPattern
- type BenchRecipeItem
- type BenchTier
- type BenchTotal
- type Benchmark
- type Feeder
- type Keep
- type Leveling
- type Make
- type Need
- type Notes
- type Option
- type Pairing
- type Path
- type Reagent
- type Recipe
- type SkillUpStep
- type Step
- type Tier
Constants ¶
const ( MinRecipes = 3 MaxRecipes = 5 )
Plan sizes: the fewest and most recipes a plan lists.
const ( Orange = "orange" // below the yellow threshold: always a skill-up Yellow = "yellow" // from the yellow threshold up to grey: still a skill-up Unknown = "unknown" // the dataset has no thresholds for the recipe )
Difficulty of a recipe at the character's skill.
const BenchModel = "Skill-up model: an orange craft gives 1 skill point, a yellow craft about 0.5 " +
"(from the midpoint of the yellow range), a grey craft none. Each band picks the recipe with the lowest " +
"cost per point; ties go to fewer crafts, then the lower spell id. Nothing is held: every material is bought or gathered."
BenchModel states how the benchmark counts skill-ups, in the output itself.
const EfficiencyFormula = "" /* 142-byte string literal not displayed */
EfficiencyFormula is how the score is built; lower is better.
const KeepWindow = 50
KeepWindow is how many skill points above the character's skill a recipe may be learned and still count for the keep list.
const MaxBands = 8
MaxBands is how many bands one answer shows; the rest come with the next part.
const SkillUpMax = 3
SkillUpMax is how many recipes a skill-up path lists.
Variables ¶
var ErrNoRecipes = errors.New("the dataset has no recipes for the profession")
ErrNoRecipes is returned when the dataset has no recipes for a profession.
var Trades = []string{"Alchemy", "Blacksmithing", "Enchanting", "Engineering", "Leatherworking", "Tailoring", "Cooking", "First Aid"}
Trades are the professions whose recipes ReagentUsers reads.
Functions ¶
func FarMaterials ¶
FarMaterials returns the reagent item ids, with their professions, of recipes the character cannot learn for more than KeepWindow skill points: materials to bank, not to carry. A profession with no captured skill or no recipes in the dataset contributes nothing.
func NextSkillUp ¶ added in v0.7.34
NextSkillUp is the one-line next step for a profession ("next skill-up: make 12 × Linen Bandage"), for the digest's profession entries; empty when no step is known.
func ReagentUsers ¶ added in v0.7.44
ReagentUsers maps each reagent item id to the professions whose recipes use it, at any skill. A profession the dataset has no recipes for contributes nothing, and ok is false when none do.
func RenderBenchmark ¶ added in v0.7.36
RenderBenchmark is the plain-text report of a benchmark.
func RenderPairings ¶ added in v0.7.34
RenderPairings is the plain text of pairing advice.
func RenderPath ¶ added in v0.7.34
RenderPath is the plain-text answer: the next step first, then where you are, the bands, and prep.
Types ¶
type Advice ¶ added in v0.7.34
Advice is one suggested pair of primary professions with a one-line reason.
type Band ¶ added in v0.7.34
type Band struct {
From, To int
Best Option
Or *Option
Patterns []Option // recipes learnt from drops, quests or reputation, for a player who has the pattern
Rank string // the rank to train before this band, when it starts one
RankLevel int // the character level that rank needs
Gap string // set when no recipe covers the band: the plain-words line saying so; Best is empty
}
Band is one stretch of skill, from From to To, with the recipe to make and an alternative.
type BenchBand ¶ added in v0.7.36
type BenchBand struct {
From int `json:"from"`
To int `json:"to"`
Recipe string `json:"recipe"`
SpellID int64 `json:"spell_id"`
Crafts int `json:"crafts"`
OrangeCrafts int `json:"orange_crafts"`
YellowCrafts int `json:"yellow_crafts"`
ExpectedSkillUps float64 `json:"expected_skill_ups"`
Learn string `json:"learn,omitempty"`
LearnSkill *int `json:"learn_skill,omitempty"`
LearnSkillSource string `json:"learn_skill_source,omitempty"`
Rank string `json:"rank,omitempty"` // the rank to train before this band
RankLevel int `json:"rank_level,omitempty"` // the character level that rank needs
SubSkillUps float64 `json:"sub_skill_ups,omitempty"`
PatternOptions []BenchPattern `json:"if_you_have_the_pattern,omitempty"`
Materials []BenchMaterial `json:"materials"`
Alternative string `json:"alternative,omitempty"`
Gap string `json:"gap,omitempty"` // set when no recipe covers the band
Source string `json:"source,omitempty"` // how the recipe is learnt, in a few words
}
BenchBand is one stretch of skill.
type BenchEfficiency ¶ added in v0.7.36
type BenchEfficiency struct {
TotalMaterials int `json:"total_materials"`
DistinctMaterials int `json:"distinct_materials"`
VendorCopper int64 `json:"vendor_copper"`
RareMaterials int `json:"rare_materials"`
Score int64 `json:"score"`
Formula string `json:"formula"`
}
BenchEfficiency scores a path: fewer materials, less vendor money and fewer rare materials is better.
type BenchFishItem ¶ added in v0.7.36
type BenchFishItem struct {
Item string `json:"item"`
ID int64 `json:"item_id"`
Rate float64 `json:"rate"`
}
BenchFishItem is one catch with its share of casts.
type BenchFishZone ¶ added in v0.7.36
type BenchFishZone struct {
Zone string `json:"zone"`
Catches []BenchFishItem `json:"catches"`
}
BenchFishZone is one zone's catch list, for Fishing.
type BenchMake ¶ added in v0.7.41
type BenchMake struct {
Recipe string `json:"recipe"`
Profession string `json:"profession"`
Verb string `json:"verb"`
Crafts int `json:"crafts"`
LearnSkill *int `json:"learn_skill,omitempty"`
LearnSkillSource string `json:"learn_skill_source,omitempty"`
ExpectedSkillUps float64 `json:"expected_skill_ups,omitempty"`
Materials []BenchMaterial `json:"materials"`
}
BenchMake is how a material is made: the recipe, its learn skill and what it takes in turn.
type BenchMaterial ¶ added in v0.7.36
type BenchMaterial struct {
Item string `json:"item"`
ID int64 `json:"item_id"`
Count int `json:"count"`
Make *BenchMake `json:"make,omitempty"` // set when the material is smelted or crafted from others
}
BenchMaterial is one material and how many of it.
type BenchOptions ¶ added in v0.7.36
type BenchOptions struct {
Profession string
From, To int // skill to start at (default 1) and to reach (0: the most the level allows)
Level int // character level (default 60)
Faction string // horde or alliance; empty for either
Gather string // a gathering profession the character has, or empty
Known []int64 // recipes (spell ids) the character already knows, drops and quest patterns included
}
BenchOptions describe the synthetic character of a benchmark.
type BenchPattern ¶ added in v0.7.41
type BenchPattern struct {
Recipe string `json:"recipe"`
LearnSkill *int `json:"learn_skill,omitempty"`
LearnSkillSource string `json:"learn_skill_source,omitempty"`
Source string `json:"source,omitempty"`
}
BenchPattern is a recipe from a drop, quest or reputation that fits a band, for a player who has it.
type BenchRecipeItem ¶ added in v0.7.36
type BenchRecipeItem struct {
Recipe string `json:"recipe"`
Item string `json:"item"`
ID int64 `json:"item_id"`
Source string `json:"source"` // vendor, quest, drop or auction
Where string `json:"where"`
Copper int64 `json:"copper,omitempty"`
}
BenchRecipeItem is a recipe that has to be bought or found before it can be learnt.
type BenchTier ¶ added in v0.7.36
type BenchTier struct {
Name string `json:"name"`
SkillMin int `json:"skill_min"`
SkillCap int `json:"skill_cap"`
MinLevel int `json:"min_level"`
Trainer string `json:"trainer,omitempty"`
TrainerCopper int64 `json:"trainer_copper"`
TrainerSpells int `json:"trainer_recipes"`
Reachable bool `json:"reachable"` // the benchmark level may train it
}
BenchTier is one rank of the profession with its gates and what its trainer costs along the path.
type BenchTotal ¶ added in v0.7.36
type BenchTotal struct {
Item string `json:"item"`
ID int64 `json:"item_id"`
Count int `json:"count"`
Kind string `json:"kind"` // vendor, gathering, fishing, disenchant, drop or rare
Source string `json:"source"`
UnitCopper int64 `json:"unit_copper,omitempty"`
CostCopper int64 `json:"cost_copper,omitempty"` // vendor materials only
Rare bool `json:"rare"`
}
BenchTotal is one material over the whole path with where it comes from.
type Benchmark ¶ added in v0.7.36
type Benchmark struct {
Profession string `json:"profession"`
Level int `json:"level"`
Faction string `json:"faction,omitempty"`
Gather string `json:"gather,omitempty"`
From int `json:"from"`
To int `json:"to"`
Model string `json:"model"`
Bands []BenchBand `json:"bands"`
Materials []BenchTotal `json:"materials"`
RecipeItems []BenchRecipeItem `json:"recipe_items"`
Tiers []BenchTier `json:"tiers"`
Efficiency BenchEfficiency `json:"efficiency"`
FishZones []BenchFishZone `json:"fishing_zones,omitempty"`
Notes []string `json:"notes,omitempty"`
GuideCheck string `json:"guide_check"` // one line: each band's recipe and how it is learnt
}
Benchmark is a whole skill-up path for a synthetic character, with totals.
func NewBenchmark ¶ added in v0.7.36
func NewBenchmark(ds store.DataStore, o BenchOptions) Benchmark
NewBenchmark plans a profession for a synthetic fresh character with empty bags and bank.
type Feeder ¶ added in v0.7.34
type Feeder struct{ From, To, Text string }
Feeder is a profession that supplies another.
type Keep ¶
type Keep struct {
ItemID int64
Name string
Count int // bags plus bank
Bags, Bank int
Professions []string
}
Keep is a bag or bank item that is a reagent for a recipe still worth making.
func KeepList ¶
KeepList returns the bag and bank items that are reagents of the character's professions, for recipes learnable within KeepWindow skill points of their current skill and not yet grey, most numerous first. It returns ErrNoRecipes when the dataset has no recipes for any of the professions (the caller then falls back to a guess); a profession whose skill was not captured is skipped.
type Leveling ¶
type Leveling struct {
Profession string
Skill *int
Max *int
Steps []Step
BankKnown bool // false when the bank was never captured: Have counts bags only
Notes []string // everything unknown or missing, in plain words
}
Leveling is the leveling plan for one profession, the result of Plan.
type Make ¶ added in v0.7.41
type Make struct {
Recipe string
Profession string
Verb string // smelt or craft
Crafts int
LearnSkill *int
Around bool // LearnSkill is an estimate
Needs []Need
SkillUps float64 // skill-ups these crafts give, when the recipe is in range of the band
}
Make says a material is made by a recipe the character can use (Mining smelting for bars, the profession's own recipes for grinding stones, bolts and cured leather) and what that takes.
type Need ¶ added in v0.7.34
type Need struct {
ID int64
Item string
Total int
Have int
Missing int
From string // where to get the missing part; empty when nothing is missing
Made string `json:"made,omitempty"` // when the missing part is smelted or crafted: how, in a line
Make *Make `json:"-"` // the same as a tree, for the benchmark
}
Need is one material of a band: what it takes, what is held, and where the rest comes from.
type Notes ¶ added in v0.7.34
type Notes struct {
Tiers []Tier
Pairings []Pairing
Feeders []Feeder
Special map[string]string // profession -> note
Secondary map[string]bool
}
Notes are the curated profession notes (the dataset's profession_notes table): tiers with their level gates, pairings, feeders and special cases.
func LoadNotes ¶ added in v0.7.34
LoadNotes reads the curated notes; a dataset without them yields the default tiers and nothing else.
func (Notes) CapAt ¶ added in v0.7.34
CapAt is the highest skill cap a character of this level may train to, and its tier.
type Option ¶ added in v0.7.34
type Option struct {
Recipe string
Crafts int
Difficulty string
Learn string // how to learn it first; empty when known or no learning is needed
LearnSkill *int // the skill the recipe is learnt at, nil when the dataset has none
LearnFrom string // where LearnSkill came from: trainer, recipe_item, client or estimate
Around bool // LearnSkill is an estimate: say "around skill N"
SubSkillUps float64 // skill-ups the intermediate crafts of this option give on the way
Needs []Need
// Detail for the benchmark: the recipe's spell, crafts that are orange and yellow at the band's
// start and the way it is learnt.
Spell int64
OrangeCrafts int
YellowCrafts int
LearnInfo learnInfo
}
Option is one recipe that carries a band.
type Pairing ¶ added in v0.7.34
type Pairing struct{ A, B, Text string }
Pairing is two professions that go well together, with the reason in one line.
type Path ¶ added in v0.7.34
type Path struct {
Profession string
Skill int
Target int
Tier string
Where []string
Bands []Band // the bands of this part
Part int // 1-based
More bool // later parts exist
Prep []string
Notes []string
}
Path is the computed skill-up path for one profession.
func ComputePath ¶ added in v0.7.34
func ComputePath(c character.Character, ds store.DataStore, profession string, target, part int) Path
ComputePath is the whole skill-up path for one profession from the character's skill to target (the tier cap its level allows when target is 0), as parts of at most MaxBands bands; part is 1-based.
func ComputePathWith ¶ added in v0.7.38
func ComputePathWith(c character.Character, ds store.DataStore, qx *questie.Index, profession string, target, part int) Path
ComputePathWith is ComputePath with the player's QuestieDB (nil without one), whose herb and ore nodes and fishing schools name where to gather the materials still missing.
type Reagent ¶
Reagent is one reagent of a planned recipe. Have counts bags and, when captured, bank.
type Recipe ¶
type Recipe struct {
SpellID int64
Name string
CreatesItem int64 // 0 when the recipe makes no item
LearnSkill *int
YellowSkill *int
GreySkill *int
LearnedFrom string // trainer, item or both; empty when the column is absent
LearnSource string // trainer, recipe_item, client or estimate; empty when the column is absent
}
Recipe is the part of a recipes row the advisor uses. Rank fields are nil when unknown.
type SkillUpStep ¶ added in v0.7.29
type SkillUpStep struct {
Recipe string
Creates string
Difficulty string // Orange or Yellow at the character's skill
Crafts int // estimated crafts to reach Reaches
Reaches int // the skill the crafts reach: the target, or where the recipe turns grey
Known bool // the capture says the recipe is known
LearnFirst bool // the capture lists known recipes and this is not one: learn it at a trainer
Reagents []Reagent
MissingReagents int // reagents the character is short of
}
SkillUpStep is one recipe of a skill-up path. Crafts is an estimate: an orange recipe gives about one point per craft, a yellow one about one in two.
func SkillUp ¶ added in v0.7.29
func SkillUp(c character.Character, ds store.DataStore, profession string, target int, exclude int64) []SkillUpStep
SkillUp is the fastest path from the character's skill in a profession to target: up to SkillUpMax recipes they know or can learn now that are orange or yellow at their skill, those whose materials they already hold (bags and bank) first, then known ones, then orange before yellow, then the most points per craft. exclude is a spell id left out (the recipe the path leads to). Nil when the profession is not captured or no recipe qualifies.
type Step ¶
type Step struct {
Recipe Recipe
CreatesName string // empty when the recipe makes no item or the dataset has no name for it
Difficulty string
Reagents []Reagent
ReagentsKnown bool // false when the dataset lists no reagents for the recipe
}
Step is one recipe in a plan.
func Select ¶
Select picks the recipes a character at skill should make next: those they can already learn (a recipe with no learn skill counts as learnable, and is noted), orange before yellow, and within a difficulty the highest learn skill first, then the lowest spell id. Recipes with no thresholds follow in the same learn-skill order; at most MaxRecipes are returned.