professions

package
v0.7.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 10 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 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

View Source
const (
	MinRecipes = 3
	MaxRecipes = 5
)

Plan sizes: the fewest and most recipes a plan lists.

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

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

View Source
const EfficiencyFormula = "" /* 142-byte string literal not displayed */

EfficiencyFormula is how the score is built; lower is better.

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

View Source
const MaxBands = 8

MaxBands is how many bands one answer shows; the rest come with the next part.

View Source
const SkillUpMax = 3

SkillUpMax is how many recipes a skill-up path lists.

Variables

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

func FarMaterials(c character.Character, ds store.DataStore) map[int64][]string

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 Money added in v0.7.34

func Money(c int64) string

Money writes copper as gold, silver and copper.

func NextSkillUp added in v0.7.34

func NextSkillUp(c character.Character, ds store.DataStore, profession string) string

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 Render

func Render(plans []Leveling) string

Render is the plain-text form of plans.

func RenderBenchmark added in v0.7.36

func RenderBenchmark(b Benchmark) string

RenderBenchmark is the plain-text report of a benchmark.

func RenderPairings added in v0.7.34

func RenderPairings(a []Advice) string

RenderPairings is the plain text of pairing advice.

func RenderPath added in v0.7.34

func RenderPath(pa Path) string

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

type Advice struct {
	A, B   string
	Reason string
}

Advice is one suggested pair of primary professions with a one-line reason.

func Pairings added in v0.7.34

func Pairings(c character.Character, ds store.DataStore) []Advice

Pairings suggests profession pairs from the curated notes, ordered by what the character already has, their class and how they play; any pair is fine and the answer says so.

type Band added in v0.7.34

type Band struct {
	From, To int
	Best     Option
	Or       *Option
}

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"`
	Materials        []BenchMaterial `json:"materials"`
	Alternative      string          `json:"alternative,omitempty"`
}

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 BenchMaterial added in v0.7.36

type BenchMaterial struct {
	Item  string `json:"item"`
	ID    int64  `json:"item_id"`
	Count int    `json:"count"`
}

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
}

BenchOptions describe the synthetic character of a benchmark.

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"`
}

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

func KeepList(c character.Character, ds store.DataStore) ([]Keep, error)

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.

func Plan

func Plan(c character.Character, ds store.DataStore, profession string) Leveling

Plan lists the next recipes that still give skill-ups for one profession, with what each needs and how much of it the bags and bank hold.

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
}

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

func LoadNotes(ds store.DataStore) Notes

LoadNotes reads the curated notes; a dataset without them yields the default tiers and nothing else.

func (Notes) CapAt added in v0.7.34

func (n Notes) CapAt(level int) (int, Tier)

CapAt is the highest skill cap a character of this level may train to, and its tier.

func (Notes) NextTier added in v0.7.34

func (n Notes) NextTier(cap int) (Tier, bool)

NextTier is the tier after cap, when there is one.

func (Notes) TierAt added in v0.7.34

func (n Notes) TierAt(skill int) Tier

TierAt is the tier a skill lies in (the last one at or above the cap).

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

	// 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

type Reagent struct {
	ItemID  int64
	Name    string
	Need    int
	Have    int
	Missing int
}

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.

func Recipes

func Recipes(ds store.DataStore, profession string) ([]Recipe, error)

Recipes returns the profession's recipes from the dataset, once per spell, or ErrNoRecipes.

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

func Select(recipes []Recipe, skill int) []Step

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.

type Tier added in v0.7.34

type Tier struct {
	Name     string
	SkillMin int
	SkillCap int
	MinLevel int
}

Tier is one rank of a profession: the skill range it covers and the character level that opens it.

Jump to

Keyboard shortcuts

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