Documentation
¶
Overview ¶
Package questie reads the player's own installed QuestieDB, if there is one, to find quests the character could pick up and where quest givers and objectives are. It is an optional, read-only integration: nothing here ships Questie data or code, and the index built from the player's install is cached only in their local cache folder. See docs/design/questie-interop.md.
Index ¶
- Constants
- Variables
- func GameFromSavedVariables(sv string) string
- func OpenGame(game string) (*Index, Status)
- func TrainerOf(e Entity) (profession string, tier int, ok bool)
- type Area
- type ClassOffer
- type Creature
- type Credit
- type Dungeon
- type Entity
- type Index
- func (ix *Index) Available(w Who, at Where, skip func(name string) bool) []Offer
- func (ix *Index) ClassQuests(w Who, at Where, ahead int, skip func(name string) bool) []ClassOffer
- func (ix *Index) ClassTrainers(class string) []Trainer
- func (ix *Index) Describe(refs []Ref) string
- func (ix *Index) DropsOf(npc int) []int
- func (ix *Index) FindByName(name string) []int
- func (ix *Index) FindDungeon(instance int, name string) *Dungeon
- func (ix *Index) Inside(d *Dungeon) Inside
- func (ix *Index) Locate(questID int, complete bool, at Where) (p Place, objective, ok bool)
- func (ix *Index) NodeZones(nodes []Node, at Where) []NodeZone
- func (ix *Index) NpcFaction(id int) string
- func (ix *Index) NpcPlace(id int, at Where) (Place, bool)
- func (ix *Index) ProfessionTrainers(profession string) []Trainer
- type Inside
- type Item
- type Node
- type NodeZone
- type Offer
- type Place
- type Quest
- type Ref
- type Spawn
- type Spot
- type Status
- type Trainer
- type Where
- type Who
- type Yield
Constants ¶
const ( KindOre = "ore" KindFish = "fishing" )
Node kinds a name alone settles; the others are left for the caller to settle from what the node yields.
const MaxClassQuestClasses = 3
MaxClassQuestClasses is the most classes a quest's mask may name for it to count as a class quest.
const MaxSpots = 2
MaxSpots is how many sample coordinates a zone keeps.
const SupportedContract = 4
SupportedContract is the QuestieDB baked-storage contract this reader understands (the TOC's X-Contract-Version).
Variables ¶
var CacheDir = func() string { d, err := os.UserCacheDir() if err != nil { return "" } return filepath.Join(d, "wowc-advisor", "questie") }
CacheDir is where the parsed index is kept: the player's local cache folder, never the repo. Tests point it at a temp folder.
var ErrUnreadable = errors.New("QuestieDB format not recognised")
ErrUnreadable means the database is not in a format this reader understands.
Functions ¶
func GameFromSavedVariables ¶
GameFromSavedVariables derives the game folder from a ForeverScribe.lua path, <game>/WTF/Account/<account>/SavedVariables/<file>; "" when the path has another shape.
func OpenGame ¶
OpenGame probes the game folder and loads its index. A nil index with a non-nil Status is the normal "no Questie" or "unreadable" case.
func TrainerOf ¶ added in v0.7.39
TrainerOf says which profession the NPC trains and up to which skill. The subname decides: "<Profession> Trainer" and "Junior <Profession> Trainer" teach up to 75; a rank word (Journeyman 150, Expert 225, Artisan 300, Master 375) before the profession's person noun gives that tier. A subname with "Supplies" is a vendor. A bare person noun ("Blacksmith") counts only with the trainer bit of npcFlags, at tier 75.
Types ¶
type ClassOffer ¶ added in v0.7.45
ClassOffer is a quest limited to one class (or a few) that the character can take now or soon: StartLevel is the character level it opens at (0 when it is open to the character's level now).
type Dungeon ¶ added in v0.7.33
type Dungeon struct {
Area int
Name string
Alt []int // alternative area ids of the same dungeon
Parent int // the zone area the entrance stands in; 0 when unknown
X, Y float64
Entrance bool // X and Y hold the entrance
Instance int // the instance (map) id, from instanceIdToAreaId.lua; 0 when unknown
Creatures []int
Quests []int
}
Dungeon is one row of Zones/dungeons.lua plus what the index links to it: the creatures that spawn in its areas and the quests that send the player in.
type Entity ¶
type Entity struct {
Name string
Sub string // the NPC's subname, such as a title
Level int
Rank int // 0 normal, 1 elite, 2 rare elite, 3 boss, 4 rare
Faction string // friendlyToFaction: "A", "H", "AH"; empty when Questie names none
Flags int // npcFlags, a bit set; 0x10 marks a trainer
Spawns []Spawn
}
type Index ¶
type Index struct {
Schema int
DB string
Quests map[int]*Quest
Npcs map[int]Entity
Objects map[int]Entity
Items map[int]Item
Areas map[int]Area
// Dungeons are the dungeons from Zones/dungeons.lua with their creatures and quests;
// DungeonReason says why there are none. Drops maps a dungeon creature to the items it drops.
// Nodes are the objects that yield items (herbs, ore, fish, chests), with spawns; NodesReason
// says why there are none.
Nodes map[int]Node
NodesReason string
Dungeons []Dungeon
DungeonReason string
Drops map[int][]int
}
func ForSavedVariables ¶
ForSavedVariables is the index for the game folder a ForeverScribe.lua path sits in, or nil when there is no readable Questie there (the normal case). It never fails.
func Load ¶
Load returns the index for the installed QuestieDB: from the local cache, else a fresh parse that is then cached. A cache that cannot be read or written is ignored.
func Parse ¶
Parse reads the baked TOC at st.TOC and the zone tables beside it. It returns ErrUnreadable (wrapped) when the rows do not decode as expected.
func (*Index) Available ¶
Available lists the quests the character could pick up, whose giver stands on their map: best level fit first, then nearest the character. A character with no position gets none (nothing can be called nearby).
func (*Index) ClassQuests ¶ added in v0.7.45
ClassQuests lists the class-restricted quests the character's class can take now or within ahead levels, with the nearest giver on any map (the character's map first). Race, prerequisites, done and in-log quests follow Eligible; the band below the character's level is w.Below. Available now first, then by level.
func (*Index) ClassTrainers ¶ added in v0.7.45
ClassTrainers lists the NPCs whose subname names the class's trainer ("Warrior Trainer"), by id.
func (*Index) Describe ¶ added in v0.7.25
Describe names the NPCs or objects in refs with the zone of each one's first known spawn, such as "Elder Mira (Tidepool Cove)". It needs no character position.
func (*Index) FindByName ¶ added in v0.7.25
FindByName returns the ids of quests named name: the exact (case-insensitive) matches, else those whose name contains it. Ids are ascending.
func (*Index) FindDungeon ¶ added in v0.7.33
FindDungeon is the dungeon for an instance (map) id, else the one named name (exactly, else by containment either way, case-insensitive). nil when there is none.
func (*Index) Inside ¶ added in v0.7.33
Inside lists what lives in the dungeon and which quests send you there.
func (*Index) Locate ¶
Locate is where to go next for a quest in the log: the turn-in when complete, else the nearest objective, else the turn-in. ok is false when nothing is on the character's map.
func (*Index) NodeZones ¶ added in v0.7.38
NodeZones groups the spawns of the nodes by zone: the character's own zone first (its spots nearest the character first), then the zones with the most spawns. A zone no area table names is left out.
func (*Index) NpcFaction ¶ added in v0.7.37
NpcFaction is the NPC's "friendly to" field: "A", "H" or "AH"; empty when unknown.
func (*Index) NpcPlace ¶ added in v0.7.37
NpcPlace is where the NPC stands: its spawn nearest the character on the character's map, else its first spawn anywhere. ok is false when Questie holds no such NPC or no spawn for it.
func (*Index) ProfessionTrainers ¶ added in v0.7.39
ProfessionTrainers lists the NPCs that train the profession, by id.
type Inside ¶ added in v0.7.33
type Inside struct {
Name string
Zone string // where the entrance is, the parent zone's name
X, Y float64
Entrance bool
Creatures []Creature
Quests []*Quest
}
Inside is what the index knows about one dungeon.
type Item ¶ added in v0.7.0
type Item struct {
Name string
Npcs []int // NPCs that drop it
Objects []int // objects that contain it
}
Item is the part of an item row the planner uses: where it comes from.
type Node ¶ added in v0.7.38
type Node struct {
ID int
Name string
Kind string // KindOre or KindFish when the name says so, else empty
Spawns []Spawn
Yields []Yield
}
Node is an object that yields items: a herb node, an ore vein, a fishing school, or a chest.
type NodeZone ¶ added in v0.7.38
type NodeZone struct {
Zone string
Spawns int
Here bool // the character is in this zone
Spots []Spot
Nodes []string // the node names that spawn here, most spawns first
// contains filtered or unexported fields
}
NodeZone is a zone's spawns of a set of nodes.
type Offer ¶
type Offer struct {
Quest *Quest
Giver Place
Diff int
Class bool // a class quest the character's class can take
}
Offer is a quest that can be picked up, with its nearest giver.
type Place ¶
type Quest ¶
type Quest struct {
ID int
Name string
Level int
Zone int // the area or zone the quest belongs to (field 17), 0 when it has none
MinLevel int
MaxLevel int // 0: none
Races uint64
Classes uint64
PreSingle []int
PreGroup []int
Exclusive []int
Next int // quest that makes this one moot once started or completed
Parent int
Until int // quest whose completion ends availability
Disabled int // quest that disables this one while it is in the log
Starters []Ref
Finishers []Ref
Creatures []Ref // objectives that are kills or talks
Items []int // item objectives (item ids)
Credits []Credit
Objective string // the objective text shown in the quest log (field 8)
Restricted bool // a requirement this reader cannot check (skill, reputation, spell, event)
}
Quest is the part of a quest row the advisor uses.
func (*Quest) ClassQuest ¶ added in v0.7.0
ClassQuest reports whether the quest is limited to one class or a few (its class mask names at most MaxClassQuestClasses of them), not open to everyone.
type Spot ¶ added in v0.7.38
type Spot struct{ X, Y float64 }
Spot is one place to look, in map percent.
type Status ¶
type Status struct {
Questie string // Questie's version, "" when not installed
DB string // QuestieDB's version, "" when not installed
Flavor string
TOC string // path of the QuestieDB TOC that holds the data
Readable bool
Reason string
}
Status is what is installed. Readable is true only when the database is in a format this reader understands; Reason says why not otherwise.
type Trainer ¶ added in v0.7.39
Trainer is a profession trainer found among the NPCs: Tier is the highest skill it teaches (75, 150, 225, 300 or 375).
type Where ¶
Where is the character's last known place: the uiMapID, or the zone name without one; X and Y are map percent.