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 Arrival
- type Basis
- type Coverage
- type DungeonLevel
- type Envelope
- type Errand
- type Exit
- type FindStop
- type Finisher
- type FollowNote
- type Guide
- type GuideItem
- type Here
- type HereQuest
- type Instance
- type Nearby
- type Node
- type Options
- type Parked
- type Places
- type Plan
- type Point
- type Problem
- type Stop
- type Trip
- type UIMap
- type ZonePlan
Constants ¶
const ( ErrandTrain = "train" ErrandBank = "bank" ErrandClass = "class" ErrandProfession = "profession" ErrandTurnIn = "turnin" )
Errand kinds (Plan.lua 1.7).
const ( MaxFinisherQuests = 40 // logged quests listed MaxFinisherSpawns = 3 // turn-in places per quest )
Caps on the Plan.lua "finishers" table (docs/plan-format.md, schema 1.4).
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 = 2 // a quest above the player's level + this goes to "later" // PickupBelow is how far under the player's level a new pick-up may be; MaxPickups is how many new // pick-ups the run takes; PickupDetour is how far (map percent, about 300 yards) a giver may be from the // route or the player to be "on the way". PickupBelow = 3 MaxPickups = 3 PickupDetour = 6.0 // DungeonReach is how far above the player's level a dungeon's minimum may be, and how far under // the player's level its maximum may be, for its quests to be worth picking up in town. DungeonReach = 3 // DefaultLogCap is the quest log's size; NearlyFull is how many free slots or fewer limit pick-ups. DefaultLogCap = 40 NearlyFull = 2 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 ( ParkTooHigh = "toohigh" ParkGrey = "grey" ParkDungeon = "dungeon" ParkSeasonal = "seasonal" )
Parked kinds (Plan.lua 1.6).
const ( TooHighMargin = 3 // a quest more than this many levels above the player is parked GreyGap = 8 // a quest this many levels or more below the player is grey )
Limits of the parked list.
const ( ArriveFlight = "flight" ArriveWalk = "walk" )
Arrival 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 FlyLegs = 2
FlyLegs is the most fly-and-turn-in legs a plan adds.
const FlyMinGap = 10
FlyMinGap is how far below the player's level a ready quest may be and still be worth a trip.
const FromGame = "game"
FromGame marks a position taken from the game's own quest map point, captured by the addon.
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 KindErrand = "errand"
KindErrand is the kind of a stop that is only an errand: a trainer, the bank.
const NearbyRadius = 12.0
NearbyRadius is how far (map percent) from an NPC a quest giver still counts as "nearby".
const NoPos = -1
NoPos is the X and Y of a stop with no position: the addon reads it as "do not draw". A stop is never emitted at 0, 0.
const Schema = "1.7"
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 Arrival ¶ added in v0.7.93
type Arrival struct {
Kind string `json:"kind"` // ArriveFlight or ArriveWalk
NPC int64 `json:"npc,omitempty"` // a flight master's NPC id
Name string `json:"name,omitempty"` // the flight master, or the side the player walks in from
Place string `json:"place,omitempty"` // the subzone of a flight master, when known
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Known bool `json:"known"` // X and Y are a known position
}
Arrival is where the player arrives in a zone they are not in.
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 Coverage ¶ added in v0.7.94
type Coverage struct {
Quests int // quests in the log
NoData int // of those, quests the Questie database does not know
Questie int // objectives placed from the Questie database
Game int // objectives placed from the game's own quest map point
Approx int // objectives placed approximately, at a subzone named in the quest text
Unplaced int // objectives with no position at all
Layout string
Available bool // false: no Questie database to read
}
Coverage counts how the objectives of the quests in the character's log are placed.
func CoverageOf ¶ added in v0.7.94
CoverageOf walks the quests in c's log the way the route does and counts their objectives.
type DungeonLevel ¶ added in v0.7.85
DungeonLevel is a dungeon's level range; Map is its instance id (0 when unknown).
type Errand ¶ added in v0.7.96
type Errand struct {
N int `json:"n"`
Kind string `json:"kind"`
Label string `json:"label"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Why string `json:"why"`
}
Errand marks one step of the run as a city errand, so the addon can label it. The stop itself is an ordinary numbered step (N).
type Exit ¶ added in v0.7.95
type Exit struct {
Label string `json:"label"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Via string `json:"via"` // "flight", "zeppelin", "boat" or "walk"
}
Exit is the last line of the run here: how to leave for the next trip. It is nil when the next trip is in the same zone.
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"`
// Hint and Zone are on a logged quest with no place on the map, mostly a done quest whose finisher is
// unknown: Hint is the quest's own objective text, Zone where it is known to be (Plan.lua 1.7).
Hint string `json:"hint,omitempty"`
Zone string `json:"zone,omitempty"`
}
FindStop is an objective the planner could not place on the map: something to find, with no x or y.
type Finisher ¶ added in v0.7.86
type Finisher struct {
QuestID int `json:"quest_id"`
Quest string `json:"quest"`
NPC string `json:"npc,omitempty"`
Object string `json:"object,omitempty"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Place string `json:"place"`
// A trip: the quest has nothing to do and is handed in elsewhere (Plan.lua 1.5). Finisher is this
// row's NPC or object, FinisherPlace where it is, Instance the dungeon it stands in, when one.
Trip bool `json:"trip,omitempty"`
Finisher string `json:"finisher,omitempty"`
FinisherPlace string `json:"finisher_place,omitempty"`
Instance string `json:"instance,omitempty"`
}
Finisher is one place a logged quest can be handed in: the addon compares it with the player's position and the log's ready state live, between reloads.
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
// Dungeons are the dungeons' level ranges: a pick-up in town for a dungeon the player fits is a
// current step. XP is the quest XP table (nil: no XP is shown). LogCap is the quest log's size
// (0 is DefaultLogCap).
Dungeons []DungeonLevel
Places *Places // the dataset's UI map and instance names, for maps Questie does not name
XP map[int]int
LogCap int
// GroupPlan is set when the player has a plan to run dungeons with a group: their quests become trips
// to the entrance zone. Otherwise a dungeon quest is parked.
GroupPlan bool
// PickupCap is how many new pick-ups the run takes (0 is MaxPickups, negative none); AnyPickup lifts the "on the way
// or in the hub" rule, for a caller that wants every pick-up of the map.
PickupCap int
AnyPickup bool
// Data is the dataset, for the class trainer's spells in a city errand (nil: none). Trainable counts
// the spells the character can train now; nil reads them from Data.
Data store.DataStore
Trainable func(c character.Character) int
}
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 Parked ¶ added in v0.7.95
type Parked struct {
QuestID int `json:"quest_id"`
Quest string `json:"quest"`
Why string `json:"why"`
Kind string `json:"kind"`
}
Parked is a logged quest that is in no step and no trip, and why.
type Places ¶ added in v0.7.92
Places names the maps Questie's area table does not: the dataset's UI maps and instances. The zero value (and nil) knows only the built-in Classic dungeon table.
func (*Places) IsInstance ¶ added in v0.7.93
IsInstance reports whether UI map m shows an instance (a dungeon or raid).
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)
Finishers []Finisher `json:"finishers,omitempty"` // where each logged quest is handed in (Plan.lua 1.4)
Zones []ZonePlan `json:"zones,omitempty"` // one connected route per other zone with stops (Plan.lua 1.5)
Exit *Exit `json:"exit,omitempty"` // the run's last line: the way to the next trip (Plan.lua 1.6)
Trips []Trip `json:"trips,omitempty"` // logged quests outside the run, by destination zone (Plan.lua 1.6)
Parked []Parked `json:"parked,omitempty"` // logged quests set aside, and why (Plan.lua 1.6)
Errands []Errand `json:"errands,omitempty"` // which steps are city errands (Plan.lua 1.7)
}
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"`
// Optional is set on a holiday-event quest's stops: the player opted in, and they come after the rest.
Optional bool `json:"optional,omitempty"`
// ZoneOnly is a stop with no known position: X and Y are -1 and only Place is known.
ZoneOnly bool `json:"zone_only,omitempty"`
// Unplaced marks a stop with no position: X and Y are -1, the "no position" marker. Approx marks a
// position taken from a subzone's centre, not from the objective's own spawn.
Unplaced bool `json:"unplaced,omitempty"`
Approx bool `json:"approx,omitempty"`
// Source names where a position came from when it is not the usual NPC or object spawn.
Source string `json:"source,omitempty"`
// A trip is a turn-in for a quest with nothing to do, handed in at another NPC or object (Plan.lua 1.5).
// Finisher is that NPC, FinisherPlace where it is, Instance the dungeon it stands in, when one.
Trip bool `json:"trip,omitempty"`
Finisher string `json:"finisher,omitempty"`
FinisherPlace string `json:"finisher_place,omitempty"`
Instance string `json:"instance,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
// Errand is the kind of a city errand stop ("train", "bank", "class", "profession", "turnin"); empty on
// an ordinary stop (Plan.lua 1.7).
Errand string `json:"errand,omitempty"`
}
Stop is one place on the route.
type Trip ¶ added in v0.7.95
type Trip struct {
Order int `json:"order"`
Map int `json:"map"`
Zone string `json:"zone,omitempty"`
Ready int `json:"ready"` // quests ready to turn in there
Todo int `json:"todo"` // quests with work left there
Pickups int `json:"pickups"` // quests not yet in the log that can be picked up there (not in QuestIDs)
QuestIDs []int `json:"quest_ids"`
Reason string `json:"reason"`
Travel string `json:"travel"`
Instance string `json:"instance,omitempty"`
XP int `json:"xp,omitempty"`
// contains filtered or unexported fields
}
Trip is the logged quests that wait in one zone outside the run here, in suggested travel order.
type UIMap ¶ added in v0.7.92
type UIMap struct {
ID int
Name string
Parent int // the parent UI map, 0 when none
Instance int // the instance map id the UI map shows, 0 when it is not an instance
}
UIMap is a row of the dataset's ui_maps table.
type ZonePlan ¶ added in v0.7.93
type ZonePlan struct {
Map int `json:"map"`
Zone string `json:"zone,omitempty"`
Arrival Arrival `json:"arrival"`
Order []int `json:"order"`
Travel string `json:"travel"` // the route step that goes there
}
ZonePlan is the one connected route through a zone the player is not in: it starts at Arrival and visits Order, the `n` of the zone's stops in Plan.Later.