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 Render(plans []Leveling) string
- func RenderPairings(a []Advice) string
- func RenderPath(pa Path) string
- type Advice
- type Band
- type Feeder
- type Keep
- type Leveling
- 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 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.
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 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
Band is one stretch of skill, from From to To, with the recipe to make and an alternative.
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 Need ¶ added in v0.7.34
type Need struct {
Item string
Total int
Have int
Missing int
From string // where to get the missing part; empty when nothing is missing
}
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
Needs []Need
}
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.
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
}
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.