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 HasTool(c character.Character, profession string) (has, needed bool)
- func Money(c int64) string
- func NextSkillUp(c character.Character, ds store.DataStore, profession string) string
- func ProfessionStems(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
- func RouteFacts(c character.Character, ds store.DataStore, qx *questie.Index, ...) string
- func SkillPerCraft(d string) string
- func ToolOf(name string) 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 Coverage
- type Feeder
- type GatherHint
- type GatherNode
- type Keep
- type Leveling
- type Make
- type Need
- type NextStep
- type Notes
- type Option
- type Pairing
- type Path
- type Reagent
- type Recipe
- type Route
- type RouteHint
- type RouteMaterial
- type RouteStep
- type SkillUpStep
- type Step
- type Stock
- 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 Green = "green" // halfway from yellow to grey: a skill-up one craft in four (a skill-up path says so) 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 0.75, a green craft 0.25 " +
"(green starts halfway between the dataset's yellow and grey skill), 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 = "" /* 249-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", "Mining"}
Trades are the professions whose recipes ReagentUsers reads. Mining is one: it smelts the ore and stone it digs, so a miner's alt is where those go.
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 HasTool ¶ added in v0.7.90
HasTool reports whether the character carries or wears the profession's tool; needed is false when the profession has none this code knows.
func Money ¶ added in v0.7.34
Money writes copper as gold, silver and copper, every unit that is not zero ("1g 23s 45c"): the same wording and the same amount, to the copper, as a vendor price. Nothing is "0c".
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 ProfessionStems ¶ added in v0.7.102
ProfessionStems are the words a trainer's subName uses for a profession ("Master Tailor", "Herbalist Trainer").
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.
func RouteFacts ¶ added in v0.7.90
func RouteFacts(c character.Character, ds store.DataStore, qx *questie.Index, profession string) string
RouteFacts is the route advice for a skill-up question: the step covering the player's skill and the next two, with crafts scaled to the skill, materials counted over bags and bank, the tier trainer, and the tool only when it is missing. "" when the profession has no route.
func SkillPerCraft ¶ added in v0.7.97
SkillPerCraft words how often a craft of the colour gives a skill point.
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
RankVia string // how that rank is gained when a trainer does not teach it ("it is a book from ..."); "" for a trainer
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"`
GreenCrafts int `json:"green_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
LearnVia string `json:"learn_via,omitempty"` // known, trainer or item
LearnCopper int64 `json:"learn_copper,omitempty"` // what the trainer or the pattern's vendor charges; 0 when unknown or free
}
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"` // distinct rare materials
RareUnits int `json:"rare_units"`
GatheredUnits int `json:"gathered_units"`
AuctionUnits int `json:"auction_units"`
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"`
TrainerUnpriced int `json:"trainer_recipes_unpriced,omitempty"` // of those, how many have no price in the dataset
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 Coverage ¶ added in v0.7.98
type Coverage struct {
Profession string
Captured int // recipes in the capture; 0 when the window was never read
Recipes int // recipes the dataset lists
Trainers int
Vendors int // distinct vendors that sell an item teaching one of the recipes
Sources map[string]int // recipes by where they are learned from
}
Coverage says what the advisor has for one profession: the recipes the character's own window listed, and the dataset's recipes, trainers, vendors of recipe items and recipe sources.
func CoverageOf ¶ added in v0.7.98
CoverageOf lists a row for each of the character's professions, each recipe window professions the class has (Poisons for a rogue) and each profession with captured recipes. A nil store leaves the dataset counts at zero.
type Feeder ¶ added in v0.7.34
type Feeder struct{ From, To, Text string }
Feeder is a profession that supplies another.
type GatherHint ¶ added in v0.7.102
type GatherHint struct {
Skill int
To int
Nodes []GatherNode
}
GatherHint names the nodes a gathering path stretch opens, the skill it climbs to and the character's skill.
type GatherNode ¶ added in v0.7.102
GatherNode is a node the dataset's gathering_nodes opens at a skill, with every zone it grows in.
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
Estimated bool // Skill is estimated from the recipe colours, not captured: say "about"
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 NextStep ¶ added in v0.7.102
NextStep is the next skill-up band of a path: Crafts of Recipe to reach skill To, with its materials.
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
GreenCrafts 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 Route ¶ added in v0.7.90
type Route struct {
Profession string
Steps []RouteStep
Alts map[int][]RouteStep // by main step number
}
Route is the main steps of a profession in order, with each step's alternatives.
type RouteHint ¶ added in v0.7.102
type RouteHint struct {
Profession string
// TrainTier is the rank the character can train now (level and skill allow it, a trainer teaches it); empty
// when none is due. TrainRecipe is a recipe the next band needs that a trainer teaches, when no rank is due.
TrainTier string
TrainRecipe string
// Next is the next crafting step of the path: the band a craft batch or a purchase would serve. Nil for a
// gathering profession or when the path has no step.
Next *NextStep
// Gather is set for Herbalism, Mining and Skinning when the path's next stretch is gathered: the nodes it names.
Gather *GatherHint
}
RouteHint is what one of the character's professions asks of the route: the facts the skill-up path already holds, so a route line and the profession answer never disagree.
type RouteMaterial ¶ added in v0.7.90
RouteMaterial is one material of a route step: the count one craft uses (the dataset's profession_routes holds materials per craft).
type RouteStep ¶ added in v0.7.90
type RouteStep struct {
ID int64
Step int
From, To int
SpellID int64 // 0 when the row did not resolve in the dataset
Recipe string
Crafts int
Materials []RouteMaterial
LearnedFrom string
Alternative int64 // the id or step number this row is an alternative of; 0 for a main step
Notes string
// Gather is true for a gathering step (Herbalism, Mining, Skinning, Fishing): no recipe, the zones in
// Where, and the materials listed are what to gather (count 0).
Gather bool
Where []string
}
RouteStep is one row of the dataset's profession_routes table: the efficient path of the wow-professions.com Forever guides, as facts.
type SkillUpStep ¶ added in v0.7.29
type SkillUpStep struct {
Recipe string
Creates string
Difficulty string // Orange, Yellow or Green at the character's skill, as the game colours it
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
// contains filtered or unexported fields
}
SkillUpStep is one recipe of a skill-up path. Crafts is an estimate: an orange recipe gives one point per craft, a yellow one three in four, a green one one in four.
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, yellow or green at their skill, those whose materials they already hold (bags and bank) first, then known ones, then orange before yellow before green, 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 before green (the colours the game shows, so a recipe that gives a skill-up one craft in four is never called yellow), and within a colour 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.