route

package
v0.7.121 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 28 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 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

View Source
const (
	// AreaRadius is the clustering radius in map percent: about 300 yards (the same scale as PickupDetour).
	AreaRadius = 6.0
	// MaxAreas is what the merge step cuts a crowded zone down to.
	MaxAreas = 5
)

Plan by area (Plan.lua 1.8). The route's stops are grouped into a few named areas, the areas are ordered so the route never doubles back (the area where the run leaves the zone is last), and each area lists its tasks. `steps` stay as they were; each step gains `area`.

View Source
const (
	ErrandRestock  = "restock"
	ErrandRepair   = "repair"
	ErrandSellJunk = "selljunk"
	ErrandMail     = "mail"
)

"While you're here" errand kinds (Plan.lua 1.9).

View Source
const (
	BundleReach  = 5.0
	RestockBatch = 5 // crafts of each consumable a restock covers

)

Bundling limits. A map percent is about 30 yards on a zone map, so BundleReach is about 150 yards.

View Source
const (
	ErrandTrain      = "train"
	ErrandBank       = "bank"
	ErrandClass      = "class"
	ErrandProfession = "profession"
	ErrandTurnIn     = "turnin"
)

Errand kinds (Plan.lua 1.7).

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

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

View Source
const (
	KindPickup    = "pickup"
	KindObjective = "objective"
	KindTurnIn    = "turnin"
	KindTravel    = "travel"
)

Stop kinds.

View Source
const (
	ParkTooHigh  = "toohigh"
	ParkGrey     = "grey"
	ParkDungeon  = "dungeon"
	ParkSeasonal = "seasonal"
	ParkHidden   = "hidden" // the player hid it
	ParkElite    = "elite"  // an elite quest, needs a group
)

Parked kinds (Plan.lua 1.6).

View Source
const (
	TerritoryFriendly  = "friendly"
	TerritoryContested = "contested"
	TerritoryHostile   = "hostile"
)

Territory is how a zone stands to the character's side.

View Source
const (
	ModeFly    = "fly"
	ModeWalk   = "walk"
	ModeHearth = "hearth"
)

Leg modes.

View Source
const (
	ArriveFlight = "flight"
	ArriveWalk   = "walk"
)

Arrival kinds.

View Source
const ExactMax = 12

ExactMax is the most stops solved exactly; larger routes use the heuristic.

View Source
const ExtraReachSlack = 3

ExtraReachSlack is how far above the level reach an extra quest may sit: a quest picked up on the way is allowed to be a little harder than one the plan would walk to.

View Source
const ExtraSizeFactor = 1.5

ExtraSizeFactor is how much bigger than its own size without extras a plan's Plan.lua text may grow.

View Source
const File = "Plan.lua"

File is the file name, next to Digest.lua.

View Source
const FlyLegs = 2

FlyLegs is the most fly-and-turn-in legs a plan adds.

View Source
const FlyMinGap = 10

FlyMinGap is how far below the player's level a ready quest may be and still be worth a trip.

View Source
const FromGame = "game"

FromGame marks a position taken from the game's own quest map point, captured by the addon.

View Source
const FromQuestie = "from your Questie database"

FromQuestie marks a position that came from the player's own Questie database rather than the dataset.

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

View Source
const KindErrand = "errand"

KindErrand is the kind of a stop that is only an errand: a trainer, the bank.

View Source
const MaxExtraGuides = 80

MaxExtraGuides is the most guides a plan adds for quests it does not route.

View Source
const MaxFlights = 60

MaxFlights caps the Plan.lua "flights" table (docs/plan-format.md, additive keys, no schema bump).

View Source
const NearReady = 5.0

NearReady is how close (map percent, about 250 yards) a ready turn-in or delivery must be to the player, or to the run's start, to be done first.

View Source
const NearbyRadius = 12.0

NearbyRadius is how far (map percent) from an NPC a quest giver still counts as "nearby".

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

View Source
const Schema = "1.9"

Schema is the Plan.lua format version (docs/plan-format.md).

Variables

This section is empty.

Functions

func DiffOf added in v0.7.98

func DiffOf(q, p int) string

DiffOf is the game's difficulty colour of a quest of level q for a player of level p: "red" 5 or more levels above, "orange" 3 to 4, "yellow" within 2, "green" down to the level above GreyLevel, then "grey". Empty when the level is unknown.

func ErrandGaps added in v0.7.100

func ErrandGaps(c character.Character) []string

ErrandGaps says what the capture lacks for the "while you're here" errands, for the doctor.

func GreyLevel added in v0.7.100

func GreyLevel(p int) int

GreyLevel is the highest quest level that is grey (gives next to no XP and no colour) for a player of level p, 0 when none is: the game's gray level, which the Warcraft Wiki gives for quests as for creatures. Under level 5 no level is grey; to level 39 it is p-5-p/10, to level 59 p-1-p/5, and from level 60 on p-9 (a gap of 6 at level 10, 7 at level 20, 8 at level 30, 11 at level 50, 9 at level 60), not one gap for every level.

func Lines

func Lines(p Plan, limit int) (lines []string, summary string)

Lines is the plan as short numbered lines for the overlay, with a one-line summary.

func NextArea added in v0.7.116

func NextArea(p Plan) string

NextArea is the "what next" line: the first area with work left. "" when the plan has no areas.

func QuestOrder added in v0.7.78

func QuestOrder(p Plan) []int

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 Render

func Render(p Plan, limit int) string

Render is the plan as plain text for a prompt: the first limit steps and a count.

func Solve

func Solve(p *Problem, seeds ...[]int) []int

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

func StepText(s Stop) string

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

func UnlockNotes(p Plan) map[int][]string

UnlockNotes is, for each turn-in quest id, the "Quest (from NPC, here)" texts of the follow-ups it unlocks on this route.

func ZoneTerritory added in v0.7.113

func ZoneTerritory(c character.Character, zone string) string

ZoneTerritory is how a zone stands to a character's side: friendly, contested or hostile; "" when the zone is not listed or the character's side is not known.

Types

type Area added in v0.7.116

type Area struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Map    int     `json:"map"`
	X      float64 `json:"x"`
	Y      float64 `json:"y"`
	Radius float64 `json:"radius"`
	Tasks  []Task  `json:"tasks"`
	Eta    int     `json:"eta"`    // minutes on foot from the previous area (from the start for the first)
	Travel string  `json:"travel"` // "Walk about 450 yards"
	Exit   bool    `json:"exit,omitempty"`
	Steps  []int   `json:"steps"` // the numbers of the steps in the area, in the order to do them
}

Area is one named part of the zone with its tasks.

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
	Hearth   string `json:"hearth,omitempty"`   // why the hearthstone is not on the route: a bind the advisor could not place
}

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 Bound added in v0.7.119

type Bound struct {
	Map                    int
	Name                   string
	World                  int
	MinX, MinY, MaxX, MaxY float64
}

Bound is one zone map's world rectangle.

type Chore added in v0.7.100

type Chore struct {
	Kind   string
	Do     string // "buy 5 Empty Vial", "repair", "sell junk", "mail Linen Cloth to Bob"
	Prep   string // "from", "at", "to"
	Why    string
	Urgent bool
	Spots  []Spot
}

Chore is an errand the capture shows, before it has a place in the route. Label is the lower-case verb phrase ("buy 5 Empty Vial from Sly Garrett" is built from Do and the spot).

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
	TriggerEnd int // of the placed ones, exploration objectives placed from Questie's triggerEnd
	Layout     string
	FlagLayout string // where the npcFlags bit names came from
	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

func CoverageOf(c character.Character, qx *questie.Index, opt Options) Coverage

CoverageOf walks the quests in c's log the way the route does and counts their objectives.

func (Coverage) Line added in v0.7.94

func (c Coverage) Line() string

Line is the one-line summary.

func (Coverage) Total added in v0.7.94

func (c Coverage) Total() int

Total is the number of objectives counted.

type DungeonLevel added in v0.7.85

type DungeonLevel struct {
	Map      int
	Name     string
	Min, Max int
}

DungeonLevel is a dungeon's level range; Map is its instance id (0 when unknown).

type Envelope

type Envelope struct {
	Generated int64
	Plans     []Plan
}

Envelope is the whole file: one plan per character.

func (Envelope) Lua

func (e Envelope) Lua() string

Lua renders the one data-only `WoWCompanionPlan = {...}` assignment.

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"`
	// Attach is the step a "while you're here" errand (restock, repair, selljunk, mail) rides on; N is 0 then.
	// NPC names who or what to use.
	Attach int    `json:"attach,omitempty"`
	NPC    string `json:"npc,omitempty"`
}

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", "hearth" 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"`
	Level   int    `json:"level,omitempty"`
	Diff    string `json:"diff,omitempty"`
	Elite   bool   `json:"elite,omitempty"` // the quest is elite or a group quest (Plan.lua 1.7)
	// 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 Flight added in v0.7.99

type Flight struct {
	Map   int     `json:"map"`
	X     float64 `json:"x"`
	Y     float64 `json:"y"`
	Name  string  `json:"name"`
	Node  string  `json:"node"`
	Known bool    `json:"known"`
}

Flight is a flight master the addon can suggest for a far stop: where it stands, its name, the flight node (the place the flight path is named after) and whether the character has opened it.

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 Geo added in v0.7.119

type Geo struct {
	Bounds    map[int]Bound
	Overrides []Override
	// contains filtered or unexported fields
}

Geo is the zone geometry for overland directions. The nil value gives none, so every walk keeps its plain wording.

func GeoFrom added in v0.7.119

func GeoFrom(ds store.DataStore) *Geo

GeoFrom reads map_bounds (nil when the dataset has none) and the curated overrides.

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
	Extra      bool        `json:"extra,omitempty"`      // not a planned quest: a quest the player may pick up on the way, routed live once accepted (Plan.lua planned = false)
	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 Instance added in v0.7.92

type Instance struct {
	Map      int
	Name     string
	Entrance string // the entrance zone's name
}

Instance is a row of the dataset's instances table.

type Mailing added in v0.7.100

type Mailing struct {
	Item  string
	ID    int64
	Count int
	To    string
}

Mailing is a stack the advice sends to another character.

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 Node

type Node struct {
	X, Y float64
	Pred []int
}

Node is one place to visit. Pred lists the indexes of nodes that must come first.

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
	Geo      *Geo    // the dataset's zone rectangles, for the heading and crossing of a walk (nil: plain wording)
	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
	// Others are the player's captured characters, for the mail errands; BagSlots is the bag size (0: not
	// captured, so no sell-junk errand).
	Others   []character.Character
	BagSlots int
	// Now is the plan's time in unix seconds, to age the hearthstone's captured wait; 0 is the capture
	// time itself, so the wait counts as the capture gave it.
	Now int64
}

Options are the chain-aware inputs of a plan; the zero value plans from Questie alone.

func OptionsFor added in v0.7.5

func OptionsFor(addonSV string, ds store.DataStore) Options

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 Override added in v0.7.119

type Override struct {
	A  int     `json:"a"`
	B  int     `json:"b"`
	AX float64 `json:"a_x"`
	AY float64 `json:"a_y"`
	BX float64 `json:"b_x"`
	BY float64 `json:"b_y"`
}

Override is a curated crossing between two zone maps, in each map's percent coordinates. It wins over the computed one.

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"`
	Level   int    `json:"level,omitempty"`
	Diff    string `json:"diff,omitempty"`
	Elite   bool   `json:"elite,omitempty"`
}

Parked is a logged quest that is in no step and no trip, and why.

type Places added in v0.7.92

type Places struct {
	UIMaps    map[int]UIMap
	Instances map[int]Instance
}

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

func (p *Places) IsInstance(m int) bool

IsInstance reports whether UI map m shows an instance (a dungeon or raid).

func (*Places) Name added in v0.7.92

func (p *Places) Name(m int) string

Name is the name of UI map m from the dataset, "" when it knows none: its ui_maps name, else the instance's name, else the parent's name plus " (instance)".

func (*Places) Travel added in v0.7.92

func (p *Places) Travel(m int) string

Travel is the name for a travel target: "Shadowfang Keep (Silverpine Forest)" for an instance.

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)
	Areas     []Area       `json:"areas,omitempty"`      // the run by area, in route order (Plan.lua 1.8)
	Flights   []Flight     `json:"flights,omitempty"`    // flight masters of the run's zones, known or not (Plan.lua "flights")
	// contains filtered or unexported fields
}

Plan is the ordered route for one character.

func Build

func Build(c character.Character, qx *questie.Index) Plan

Build plans c's route from the player's own QuestieDB. A nil index or a character with no level gives an empty plan with a note saying why.

func BuildWith added in v0.7.5

func BuildWith(c character.Character, qx *questie.Index, opt Options) Plan

BuildWith is Build with the chain-aware inputs: the dataset's quest lines, unlocks learned in game and the addon's observation log.

type Point

type Point struct {
	Map int     `json:"map"`
	X   float64 `json:"x"`
	Y   float64 `json:"y"`
	At  int64   `json:"at,omitempty"` // when the save the plan was built from was captured (unix seconds)
}

Point is a place on a map, in map percent.

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.

func (*Problem) Feasible

func (p *Problem) Feasible(order []int) bool

Feasible reports whether order visits every node once with each node after its predecessors.

func (*Problem) Length

func (p *Problem) Length(order []int) float64

Length is the path length of order, in map percent (before Scale).

type Shared added in v0.7.117

type Shared struct {
	QuestID int    `json:"quest_id"`
	Quest   string `json:"quest"`
	Text    string `json:"text"` // the objective without its count: "Kill Lashtail Raptor"
	Need    int    `json:"need"`
	Have    int    `json:"have"`
	Parked  bool   `json:"parked,omitempty"` // a parked quest riding along: its progress counts now
	Why     string `json:"why,omitempty"`    // with Parked: why the quest is parked
}

Shared is one quest's objective inside a shared hunt step (Plan.lua 1.9 `shared`).

type Short added in v0.7.100

type Short struct {
	Item  string
	ID    int64
	Need  int
	Spots []Spot
	Note  string   // what the plan could not see, said in the buy's reason
	For   []string // what the reagent is for: a poison, a class spell
}

Short is a reagent the player is short of for a batch, and who sells it.

type Spot added in v0.7.100

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

Spot is a place an errand can be done: an NPC or a mailbox.

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)
	// Level is the quest's level (0 when unknown) and Diff its difficulty colour for the player.
	Level int    `json:"level,omitempty"`
	Diff  string `json:"diff,omitempty"`
	// Elite is set when the quest is elite or a group quest; the addon's level tag reads it (Plan.lua 1.7).
	Elite bool `json:"elite,omitempty"`
	// 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"`
	// Area is the id ("A", "B", ...) of the area the step is in (Plan.lua 1.8); empty on a step outside the areas.
	Area string `json:"area,omitempty"`
	// Shared lists each quest's objective when several quests share this hunt, smallest need first
	// (Plan.lua 1.9); absent on a step for one quest.
	Shared []Shared `json:"shared,omitempty"`
	// Needs are the numbers of the steps that must be done first: a quest's pick-up before its objectives
	// and turn-in, its objectives before the turn-in, a chain's unlocking turn-ins before the follow-up
	// (Plan.lua "after").
	Needs []int `json:"needs"`
}

Stop is one place on the route.

type Task added in v0.7.116

type Task struct {
	Kind     string  `json:"kind"`
	Label    string  `json:"label"`
	QuestIDs []int   `json:"quest_ids,omitempty"`
	N        int     `json:"n"` // how many steps or objectives the task covers
	X        float64 `json:"x,omitempty"`
	Y        float64 `json:"y,omitempty"`
	Radius   float64 `json:"radius,omitempty"` // a hunt's region
}

Task is one thing to do in an area: "pickup", "turnin", "hunt" (concurrent kill and collect objectives), or "errand".

type TravelFaster added in v0.7.113

type TravelFaster struct {
	Learn   string `json:"learn"`
	Minutes int    `json:"minutes"`
	Saves   int    `json:"saves"`
	Text    string `json:"text"`
}

TravelFaster is the route when one unknown flight point were learned.

type TravelLeg added in v0.7.113

type TravelLeg struct {
	Mode    string       `json:"mode" jsonschema:"fly, zeppelin, boat, tram, portal, hearth or walk (walk or ride)"`
	From    string       `json:"from"`
	To      string       `json:"to"`
	Minutes int          `json:"minutes"`
	Text    string       `json:"text"`
	Zones   []TravelZone `json:"zones,omitempty" jsonschema:"the zones the leg enters, in order, each with how it stands to the character's side"`
	Steps   []string     `` /* 138-byte string literal not displayed */
}

TravelLeg is one step of a travel route.

type TravelRoute added in v0.7.113

type TravelRoute struct {
	From    string        `json:"from"`
	To      string        `json:"to"`
	Found   bool          `json:"found"`
	Minutes int           `json:"minutes"`
	Legs    []TravelLeg   `json:"legs"`
	Learn   []string      `json:"learn,omitempty" jsonschema:"flight points on the way the character has not opened yet"`
	Faster  *TravelFaster `json:"faster,omitempty"`
	Notes   []string      `json:"notes,omitempty"`
}

TravelRoute is the answer: ordered legs, the flight points to learn on the way and the faster route if one were learned.

func Travel added in v0.7.113

func Travel(c character.Character, qx *questie.Index, opt Options, from, to string) TravelRoute

Travel is the route from one place to another for c. from "" is the character's position. A nil index gives a note and no route. opt.Now dates the hearthstone's readiness.

func (TravelRoute) Text added in v0.7.113

func (r TravelRoute) Text() string

Text is the route in plain words for an answer: the legs in order, what to learn and the faster route.

func (TravelRoute) WalkSteps added in v0.7.120

func (r TravelRoute) WalkSteps() []string

WalkSteps is the direction lines of every walk leg, in order, word for word; nil for a route with none (a flight only, or no map bounds to word the zones from).

type TravelZone added in v0.7.113

type TravelZone struct {
	Zone      string `json:"zone"`
	Territory string `json:"territory,omitempty"`
}

TravelZone is a zone a leg enters and how it stands to the character's side.

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"`
	ETA      int    `json:"eta"` // minutes of travel from the previous stop on the route (the exit for the first trip)
	// 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
	Areas   []Area  `json:"areas,omitempty"` // the zone's later stops by area, in route order (Plan.lua 1.9)
}

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.

Jump to

Keyboard shortcuts

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