unlock

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 11 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 unlock finds the follow-up quests that turning in a plan's quests makes available. The links come from the player's own Questie data (prerequisites, next-in-chain), from the dataset's quest_lines order when Questie is silent, and from unlocks observed in game. Nothing here guesses a giver or a position. The rules are in docs/plan-format.md.

Index

Constants

View Source
const (
	EvAccepted  = "accepted"
	EvTurnedIn  = "turnedin"
	EvAbandoned = "abandoned"
)

Event kinds in WoWCompanionDB.observed.events.

View Source
const DefaultDepth = 2

DefaultDepth is how many links ahead a plan looks.

View Source
const Env = "WOWC_OBSERVED_UNLOCKS"

Env names a file to use instead of the default path.

View Source
const LearnRadius = 12.0

LearnRadius is how close (map percent, same map) the acceptance must be to the turn-in.

View Source
const LearnWindow = 120

LearnWindow is the seconds after a turn-in within which an acceptance counts as unlocked by it.

View Source
const MaxEvents = 400

MaxEvents is the most events read; the newest are kept.

Variables

This section is empty.

Functions

func AddonSV

func AddonSV(foreverScribe string) string

AddonSV is the addon's SavedVariables file beside ForeverScribe.lua; empty when the path has no folder.

func Apply

func Apply(c character.Character, events []Event) character.Character

Apply returns c with the events newer than its capture applied: a quest accepted since is in the log (marked Observed, so its objectives are routed from Questie), one turned in is done, one abandoned is gone. Events for other characters are ignored; c itself is not changed.

func LocalPath

func LocalPath() string

LocalPath is the default file: observed-unlocks.json beside the play-style profiles.

Types

type Event

type Event struct {
	T         int64
	Kind      string
	QuestID   int
	Character string
	Map       int
	X, Y      float64
	NPC       string
	OffPlan   bool // an acceptance of a quest the plan did not list
}

Event is one entry of the addon's bounded observation log.

func ParseEvents

func ParseEvents(text string) []Event

ParseEvents reads WoWCompanionDB.observed.events out of a SavedVariables file's text. Entries with an unknown kind or no quest id are skipped; at most MaxEvents of the newest are returned, oldest first.

type Follow

type Follow struct {
	ID         int
	Depth      int    // 1: unlocked by a planned quest; 2: by a depth-1 follow-up
	UnlockedBy []int  // the turn-ins that unlock it, sorted
	Chain      string // the quest line's name, when known
	Observed   bool   // the link or the start comes from an in-game observation
	Start      *Start // the observed start, when Questie does not give one
}

Follow is a quest the plan's turn-ins unlock.

func Find

func Find(in Input) []Follow

Find lists the follow-ups, shallowest first, then by quest id. A follow-up is kept only when every prerequisite is met by the planned turn-ins (or is done), its level fits the same band as an available quest, it is not exclusive with a planned or done quest, it is not a breadcrumb for a quest already done or planned, and its start is known.

type Input

type Input struct {
	Qx      *questie.Index // may be nil: then only the lines and observations give links, and no quest can be named
	Who     questie.Who    // Done and InLog are the facts at capture (with observed events applied)
	Planned []int          // quests whose turn-in the plan makes
	Lines   Lines          // may be nil
	Obs     []Obs          // learned unlocks, may be nil
	Depth   int            // 0: DefaultDepth
	OnMap   int            // keep a follow-up only when its giver stands on this map; 0: any
	Skip    func(name string) bool
}

Input is what Find needs.

type Lines

type Lines func(questID int) (next int, line string)

Lines gives the quest after questID in its quest line (0 when none) and the line's name.

func FromDataset

func FromDataset(ds store.DataStore) Lines

FromDataset reads quest_lines from ds; nil when ds is nil.

type Obs

type Obs struct {
	From, To int
	NPC      string
	Map      int
	X, Y     float64
	Count    int
	Last     int64
}

Obs is an unlock learned in game: after A was turned in, B was offered by NPC at the place.

func Learn

func Learn(events []Event) []Obs

Learn finds the unlocks in events: a turn-in of A followed within LearnWindow seconds, on the same map and near it, by the acceptance of B with a known place.

type Start

type Start struct {
	NPC  string
	Map  int
	X, Y float64
}

Start is a place seen in game where a quest was offered.

type Store

type Store struct {
	Path string
	Obs  []Obs
}

Store is the local file of observed unlocks. It stays on the player's machine.

func Open

func Open(path string) *Store

Open reads the file; a missing or unreadable one is an empty store.

func (*Store) Merge

func (s *Store) Merge(found []Obs) bool

Merge adds learned unlocks, newest place winning, and reports whether anything changed. An observation already counted (same Last) is not counted twice.

func (*Store) Save

func (s *Store) Save() error

Save writes the file atomically; it does nothing without a path.

Jump to

Keyboard shortcuts

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