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
- func Estimate(level int) int
- func LoadXP(savedVariables string) map[int]int
- func ParseXP(src string) map[int]int
- func RoundMinutes(sec float64) int
- func Scale(diff int) float64
- func ScaleFor(mine, quest int) float64
- func StopSecs(s route.Stop) float64
- type Anchor
- type In
- type Info
- type Session
- type Skip
- type Step
- type Verdict
Constants ¶
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.
const ( FlagGrey = "grey" FlagFar = "far" FlagGroup = "group" FlagChain = "chain starter" )
Flags a quest can carry.
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 ¶
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 RoundMinutes ¶
RoundMinutes rounds seconds to the nearest five minutes, at least five.
func Scale ¶
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).
Types ¶
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 ¶
QuestXP is the XP a quest gives this character, and whether it is an estimate from the level.
func (In) TriageFacts ¶
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 ¶
UpgradeBonus is the XP-equivalent an upgrade reward adds to a quest: a tenth of the level, never under 300.
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
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 ¶
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.
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 ¶
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.