session

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: 13 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 session answers "I've got 30 minutes" and "is this quest worth it?". It turns the quest route into a loop that fits a time budget, and rates each quest in the log by XP for the time.

The time model is deliberately simple and every number is a constant below:

  • Travel: the straight-line distance between stops in map percent, times MapYards/100 yards per percent, times PathFactor (roads and hills), at WalkSpeed yards a second (MountSpeed from MountLevel).
  • Each pick-up or turn-in costs TalkSecs.
  • Each objective costs KillSecs per creature still to kill, or GatherSecs per item or object still to collect or use, from the count in its label ("Kill Wolf (2/8)" is six kills).
  • A trainer stop costs TrainerSecs; the loop ends at the nearest flight point or inn when the session is short (up to ShortSession minutes), and that walk is counted.

Nothing here promises minutes: a total is rounded to five and worded "about". Quest XP comes from the player's quest XP table when there is one, else from the quest's level (Estimate), and is cut the way the game cuts it for a quest well below the character's level.

Index

Constants

View Source
const (
	WalkSpeed    = 7.0    // yards a second on foot (the game's run speed)
	MountSpeed   = 11.2   // yards a second mounted: the 60% ground mount of level 40 (the 100% mount costs far more)
	MountLevel   = 40     // the level a mount is assumed from
	MapYards     = 4000.0 // yards across a typical zone map (3,500 to 5,300 for the starting zones): one map percent is MapYards/100 yards
	PathFactor   = 1.3    // real paths are longer than the straight line
	TalkSecs     = 20.0   // a pick-up or turn-in
	KillSecs     = 25.0   // one creature: find, fight, recover
	GatherSecs   = 20.0   // one item or object
	TrainerSecs  = 60.0   // a trainer visit
	ShortSession = 45     // minutes; a session this short or shorter ends at a flight point or inn
	LogSize      = 20     // quests the log holds

	FarPercent = 60.0 // a quest this far away (map percent) from the start is far
)

The time model.

View Source
const (
	FlagGrey  = "grey"
	FlagFar   = "far"
	FlagGroup = "group"
	FlagChain = "chain starter"
)

Flags a quest can carry.

View Source
const (
	AdviceTurnIn  = "turn it in"
	AdviceKeep    = "keep it"
	AdviceIfOnWay = "finish only if it is on the way"
	AdviceGroup   = "do it with a group or skip it"
	AdviceFar     = "finish only if you are heading there"
)

Verdicts.

Variables

This section is empty.

Functions

func Estimate

func Estimate(level int) int

Estimate is the fallback quest XP from the quest's level alone: about 40 a level less 50, never under 30. It is a rough guide, and everything built on it says so.

func LoadXP

func LoadXP(savedVariables string) map[int]int

LoadXP reads the quest XP table of the capture's game folder; nil when there is none.

func ParseXP

func ParseXP(src string) map[int]int

ParseXP reads a quest XP table; see questie.ParseXP.

func RoundMinutes

func RoundMinutes(sec float64) int

RoundMinutes rounds seconds to the nearest five minutes, at least five.

func Scale

func Scale(diff int) float64

Scale is the share of a quest's XP the game gives a character who is diff levels above the quest (the Classic table of the Warcraft Wiki: full XP up to five levels above, then 80%, 60%, 40%, 20% and from ten levels on 10%). A quest under level 10 gives full XP only up to four levels above, so the first cut comes a level earlier (ScaleFor).

func ScaleFor added in v0.7.97

func ScaleFor(mine, quest int) float64

ScaleFor is Scale for a character of level mine and a quest of level quest.

func StopSecs

func StopSecs(s route.Stop) float64

StopSecs is the time spent at a stop, not counting the walk to it.

Types

type Anchor

type Anchor struct {
	Name string
	Map  int
	X, Y float64
}

Anchor is a place to end a session: a flight point or an inn.

type In

type In struct {
	Char    character.Character
	Route   route.Plan
	Info    Info
	Anchors []Anchor       // flight points and inns on the route's map
	Trainer *route.Stop    // the class trainer when training is due; nil otherwise
	Names   map[int]string // quest names, from the log
}

In is everything a plan or a triage needs.

func Live

func Live(c character.Character, ds store.DataStore, qx *questie.Index, plan route.Plan, xp map[int]int) In

Live builds the inputs for a character from the route, the player's QuestieDB and the dataset. xp is the quest XP table (may be nil).

func (In) QuestXP

func (in In) QuestXP(id, level int) (xp int, estimated bool)

QuestXP is the XP a quest gives this character, and whether it is an estimate from the level.

func (In) Triage

func (in In) Triage() []Verdict

Triage rates every quest in the log, best value first.

func (In) TriageFacts

func (in In) TriageFacts(name string) string

TriageFacts is the grounded block for "what should I abandon?", "my log is full" and "is <quest> worth it?" (name set): the rated quests and, for the first two, the quests to drop.

func (In) UpgradeBonus

func (in In) UpgradeBonus() float64

UpgradeBonus is the XP-equivalent an upgrade reward adds to a quest: a tenth of the level, never under 300.

func (In) WalkSecs

func (in In) WalkSecs(a, b route.Point) float64

WalkSecs is the time to go from a to b: zero across maps (a stop on another map is not planned).

type Info

type Info struct {
	Level   func(id int) int               // the quest's level, 0 when unknown
	XP      func(id int) (xp int, ok bool) // the table's XP at the quest's own level
	Group   func(id int) bool              // elite objectives or a dungeon
	Upgrade func(id int) bool              // the reward is a gear upgrade
	Chain   func(id int) bool              // the quest starts a chain
}

Info is what the planner learns about a quest from outside the route; every field is optional.

type Session

type Session struct {
	Budget    int // minutes asked for
	Steps     []Step
	Seconds   float64
	Quests    []string // quests finished by the plan
	XP        int
	SharePct  float64 // of the level; 0 when the level's size is unknown
	Estimated bool    // some XP is estimated from quest levels
	EndsAt    string  // the flight point or inn the loop ends at; "" when none
	Skipped   []Skip
	Notes     []string
}

Session is a plan that fits a time budget.

func Plan

func Plan(in In, minutes int) Session

Plan fits a session of minutes into the route: ready turn-ins first, then the quests that give the most XP for the time they add, never a quest that needs a group, ending at a flight point or inn when the session is short.

func (Session) Facts

func (s Session) Facts() string

Facts is the grounded block for a session question; the model words the answer from it.

func (Session) Minutes

func (s Session) Minutes() int

Minutes is the total in whole minutes, rounded to five (never under five).

type Skip

type Skip struct {
	Quest, Why string
}

Skip is a quest left out of a plan and why.

type Step

type Step struct {
	Label   string
	Kind    string
	Quest   string
	Minutes float64
}

Step is one line of a session plan.

type Verdict

type Verdict struct {
	ID        int
	Name      string
	Level     int
	Complete  bool
	XP        int
	Estimated bool
	Minutes   float64 // standalone time; 0 when no place is known
	PerMin    float64 // XP a minute, counting an upgrade reward's bonus
	Upgrade   bool
	Flags     []string
	Advice    string
	Value     float64
}

Verdict is one quest's rating.

func Abandon

func Abandon(vs []Verdict, free int) []Verdict

Abandon picks the quests to drop to free room, weakest first: never a quest ready to hand in, one whose reward is an upgrade, or one that starts a chain. Flagged quests (grey, far, group) come first; only a full log is filled up with unflagged ones, so there is room to take new quests.

func (Verdict) Describe

func (v Verdict) Describe(in In) string

Describe is the verdict as one grounded line.

func (Verdict) Has

func (v Verdict) Has(f string) bool

Has reports whether the verdict carries a flag.

Jump to

Keyboard shortcuts

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