Documentation
¶
Overview ¶
Package route plans an efficient order for a character's quest stops: pick-ups, objectives and turn-ins, with map coordinates. The order comes from a deterministic optimiser (Held-Karp up to ExactMax stops, then nearest-neighbour improved by order-respecting 2-opt and or-opt), never from a language model. The rules are in docs/plan-format.md.
Index ¶
- Constants
- func Lines(p Plan, limit int) (lines []string, summary string)
- func QuestOrder(p Plan) []int
- func Render(p Plan, limit int) string
- func Solve(p *Problem, seeds ...[]int) []int
- func StepText(s Stop) string
- func UnlockNotes(p Plan) map[int][]string
- type Basis
- type Envelope
- type FindStop
- type FollowNote
- type Guide
- type GuideItem
- type Here
- type HereQuest
- type Nearby
- type Node
- type Options
- type Plan
- type Point
- type Problem
- type Stop
Constants ¶
const ( MaxSteps = 20 // stops on the route; the rest go to "later" MaxTotal = 25 // stops on the route, locked follow-ups included MaxLater = 30 // stops listed in "later" LevelMargin = 1 // a quest above the player's level + this goes to "later" MergeRadius = 3.0 // objective stops this close (map percent) on one map are one stop ClusterSize = 8.0 // spawns this close (map percent) are one cluster )
Limits.
const ( KindPickup = "pickup" KindObjective = "objective" KindTurnIn = "turnin" KindTravel = "travel" )
Stop kinds.
const ExactMax = 12
ExactMax is the most stops solved exactly; larger routes use the heuristic.
const File = "Plan.lua"
File is the file name, next to Digest.lua.
const FromQuestie = "from your Questie database"
FromQuestie marks a position that came from the player's own Questie database rather than the dataset.
const GroupRadius = 3.0
GroupRadius is how close (map percent) a pick-up or turn-in must be to another stop, or to the player, to be done together with it.
const NearbyRadius = 12.0
NearbyRadius is how far (map percent) from an NPC a quest giver still counts as "nearby".
const Schema = "1.3"
Schema is the Plan.lua format version (docs/plan-format.md).
Variables ¶
This section is empty.
Functions ¶
func QuestOrder ¶ added in v0.7.78
QuestOrder is the quest ids in route order: each quest where its first stop is. The panel's Next quests and the answers' facts follow it, so the route, the panel and the AI agree.
func Solve ¶
Solve returns the best order found. seeds are extra feasible orders to start the heuristic from (for example the naive quest-by-quest order); the result is never longer than any of them.
func StepText ¶ added in v0.7.5
StepText is one overlay line: the action, and for a locked step where it waits. The place is not in it: X and Y are separate fields for the UI to show dimly.
func UnlockNotes ¶ added in v0.7.5
UnlockNotes is, for each turn-in quest id, the "Quest (from NPC, here)" texts of the follow-ups it unlocks on this route.
Types ¶
type Basis ¶ added in v0.7.60
type Basis struct {
Captured int64 `json:"captured,omitempty"` // capture time, unix seconds; 0 when unknown
InLog []int `json:"in_log,omitempty"` // quest ids in the log when the plan was built, sorted
}
Basis is the state a plan starts from. "Done" in a plan means done after Captured: a reader judges steps against it, and never counts what was already true (a quest in InLog) as progress.
type FindStop ¶ added in v0.7.0
type FindStop struct {
N int `json:"n"`
QuestID int `json:"quest_id,omitempty"`
Quest string `json:"quest,omitempty"`
Label string `json:"label"`
}
FindStop is an objective the planner could not place on the map: something to find, with no x or y.
type FollowNote ¶ added in v0.7.5
type FollowNote struct {
QuestID int `json:"quest_id"`
Quest string `json:"quest"`
NPC string `json:"npc,omitempty"`
Here bool `json:"here,omitempty"` // the NPC who takes the unlocking turn-in
Observed bool `json:"observed,omitempty"`
UnlockedBy []int `json:"unlocked_by"`
}
FollowNote describes one follow-up quest on the route, for the digest's "Unlocks:" line.
type Guide ¶ added in v0.7.74
type Guide struct {
QuestID int `json:"quest_id"`
Quest string `json:"quest"`
Class bool `json:"class,omitempty"` // a class quest
Steps []int `json:"steps,omitempty"` // the route steps that serve the quest, in order
Objectives []GuideItem `json:"objectives,omitempty"` // what to do once accepted
TurnIn *GuideItem `json:"turn_in,omitempty"` // where to hand it in; absent when withheld or unknown
After string `json:"after"` // a short line pointing to the next planned step
}
Guide is what one quest needs once it is accepted: its objectives, its turn-in and where it sits on the route. It is data for the addon (Plan.lua 1.2), worked out ahead of time because the game only writes the app's files on a reload, and the addon must never ask for one.
type GuideItem ¶ added in v0.7.74
type GuideItem struct {
Text string `json:"text"`
Map int `json:"map,omitempty"`
X float64 `json:"x,omitempty"`
Y float64 `json:"y,omitempty"`
Zone string `json:"zone,omitempty"`
// Place is the subzone (else the zone) the position is in, in words: "Windsong Lake".
Place string `json:"place,omitempty"`
}
GuideItem is one thing to do and where. With no position known only Zone is set.
type Here ¶ added in v0.7.76
type Here struct {
NPC string `json:"npc"`
NPCID int `json:"npc_id,omitempty"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Place string `json:"place,omitempty"`
Steps []int `json:"steps"` // the route steps at this NPC
Can []string `json:"can,omitempty"` // "turn in", "pick up", "train", "buy and sell", "repair"
Quests []HereQuest `json:"quests,omitempty"`
Nearby []Nearby `json:"nearby,omitempty"`
}
Here is what the plan knows about one NPC stop: what can be done there, what each quest involving the NPC still needs and where, and quests available nearby that are not on the route. It is data for the addon (Plan.lua 1.3): the addon shows it when the player stands at the NPC.
type HereQuest ¶ added in v0.7.76
type HereQuest struct {
QuestID int `json:"quest_id"`
Quest string `json:"quest"`
Role string `json:"role"` // "turnin" or "pickup"
Text string `json:"text"` // the line to show
Missing []GuideItem `json:"missing,omitempty"`
}
HereQuest is one quest involving the NPC: its role here and what is still missing.
type Nearby ¶ added in v0.7.76
type Nearby struct {
QuestID int `json:"quest_id"`
Quest string `json:"quest"`
Giver string `json:"giver"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Guidance Guide `json:"guidance"`
}
Nearby is a quest available close to the NPC that is not on the route, with its guidance.
type Options ¶ added in v0.7.5
type Options struct {
Lines unlock.Lines // the dataset's quest lines: a fallback where Questie is silent
Obs []unlock.Obs // unlocks learned in game (the local file)
Events []unlock.Event // the addon's observation log
Depth int // follow-up links to look ahead; 0 is unlock.DefaultDepth
}
Options are the chain-aware inputs of a plan; the zero value plans from Questie alone.
func OptionsFor ¶ added in v0.7.5
OptionsFor gathers the chain-aware inputs of a plan: the dataset's quest lines (ds may be nil), the addon's observation log read from addonSV (the addon's WoWCompanion.lua; empty or unreadable: none) and the local file of observed unlocks, which this call updates with what the log newly shows. Everything stays on the player's machine.
type Plan ¶
type Plan struct {
Character string `json:"character"`
Zone string `json:"zone,omitempty"`
Start *Point `json:"start,omitempty"`
Steps []Stop `json:"steps"`
Later []Stop `json:"later,omitempty"`
Find []FindStop `json:"find,omitempty"` // objectives with no known location; not on the route
Distance float64 `json:"distance"` // route length in map percent
Naive float64 `json:"naive_distance"` // the quest-by-quest order's length, for comparison
Total int `json:"total"` // stops on the route, a travel stop included
Notes []string `json:"notes,omitempty"`
Follow []FollowNote `json:"follow_ups,omitempty"` // the locked follow-ups on the route, one per quest
Basis Basis `json:"basis"` // what the plan was built from
Guides []Guide `json:"guides,omitempty"` // what each listed quest needs once accepted (Plan.lua 1.2)
Here []Here `json:"here,omitempty"` // what can be done at each NPC stop (Plan.lua 1.3)
}
Plan is the ordered route for one character.
type Problem ¶
type Problem struct {
Nodes []Node
Start *[2]float64
// Scale multiplies a distance (map percent to yards, say); 0 means 1. It does not change the order
// on a single map, only the reported length.
Scale float64
}
Problem is an open path from Start (nil: free start) through every node, respecting Pred.
type Stop ¶
type Stop struct {
N int `json:"n"`
Kind string `json:"kind"`
QuestID int `json:"quest_id,omitempty"`
Quest string `json:"quest,omitempty"`
// QuestIDs is every quest the stop serves (a merged stop serves several); QuestID is the first.
QuestIDs []int `json:"quest_ids,omitempty"`
Label string `json:"label"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Done bool `json:"done"`
Place string `json:"place,omitempty"` // the subzone or zone the stop is in, in words (Plan.lua 1.3)
// Priority is set on a class quest's stops: they are worth doing first, so they come early.
Priority bool `json:"priority,omitempty"`
// ZoneOnly is a stop with no known position: X and Y are 0 and only Place is known.
ZoneOnly bool `json:"zone_only,omitempty"`
// Source names where a position came from when it is not the usual NPC or object spawn.
Source string `json:"source,omitempty"`
// Chain-aware plan (Plan.lua 1.1). A locked step is a follow-up the plan's turn-ins unlock.
Locked bool `json:"locked,omitempty"`
UnlockedBy []int `json:"unlocked_by,omitempty"` // the turn-ins that unlock it
Depth int `json:"depth,omitempty"` // links from a planned quest
Chain string `json:"chain,omitempty"` // the quest line's name, when known
Unlocks []int `json:"unlocks,omitempty"` // on a turn-in: the follow-ups it unlocks
After int `json:"after,omitempty"` // on a locked step: the step number of its last unlocking turn-in
Observed bool `json:"observed,omitempty"` // the link or the giver was observed in game
Giver string `json:"giver,omitempty"` // on a locked pick-up: the NPC
Here bool `json:"here,omitempty"` // on a locked pick-up: the same NPC as the unlocking turn-in
}
Stop is one place on the route.