Documentation
¶
Overview ¶
Package digest builds the in-game digest the WoWCompanion_Digest slot addon shows (schema 2.0, one 1.2 entry per character, see docs/digest.md). It adds no advice logic of its own: quests come from advice.WhatsNext, gear from gear.Find, and the rest is read from the capture.
Index ¶
- Constants
- func CheckInstalled(digestPath string) error
- func DigestPath(savedVariables string) (string, error)
- func Quote(s string) string
- func Same(path string, d Envelope) bool
- func SameText(path, text string) bool
- func Select(chars []character.Character) (kept, skipped []character.Character)
- func SiblingPath(path, file string) string
- func SlotCheck(src string) error
- func SlotPath(savedVariables, addon, file string) (path string, ok bool)
- func Write(path string, d Envelope) error
- func WriteFile(path, text string) error
- type Digest
- type DungeonLine
- type Envelope
- type Line
- type Options
- type Section
- type TalentLine
Constants ¶
const ( Schema = "1.2" EnvelopeSchema = "2.0" )
Schema is the version of one character's entry; EnvelopeSchema is the file's.
const ( NextQuests = "next_quests" Upgrades = "upgrades" KeepMaterials = "keep_materials" Notes = "notes" )
Section ids the panel knows.
const ( MaxQuests = 8 MaxUpgrades = 8 MaxMaterials = 10 MaxNotes = 6 MaxDungeons = 3 MaxTalents = 3 MaxText = 60 )
Caps: the most lines a section holds, and the longest line, in characters. The panel is narrow.
const MaxCharacters = 30
MaxCharacters is the most characters one file holds.
const NoDataText = "Game data not downloaded yet; see Setup"
NoDataText is what NEXT says when no game dataset has downloaded.
const SlotAddon = "WoWCompanion_Digest"
SlotAddon is the data-only addon the digest is written into.
Variables ¶
This section is empty.
Functions ¶
func CheckInstalled ¶
CheckInstalled is an error when the slot addon's folder is not there. Nothing is created.
func DigestPath ¶
DigestPath derives the digest file from a SavedVariables path: <game>/WTF/Account/<acct>/SavedVariables/<file> gives <game>/Interface/AddOns/WoWCompanion_Digest/Digest.lua. Both Windows and Unix paths are accepted, and the result keeps the input's separator.
func Quote ¶
Quote renders s as a Lua string literal: backslash, quote and control bytes are escaped, so the result holds no raw newline and nothing that could end the literal early.
func Same ¶ added in v0.3.0
Same reports whether the file at path already holds the envelope, ignoring the generated times (they change on every build, so a rebuild of the same advice would never match byte for byte).
func SameText ¶ added in v0.6.0
SameText is Same for any data-only Lua text carrying a `generated = N,` line.
func Select ¶
Select picks the characters a file holds: the most recently captured first, at most MaxCharacters, one per name (the first wins). The rest come back as skipped.
func SiblingPath ¶ added in v0.6.0
SiblingPath is the file named file in the folder of the digest file at path, keeping its separator.
func SlotCheck ¶
SlotCheck is the addon repo's tests/slotcheck.lua (WoW-Companion/addon) ported to Go, rule for rule: after comments are dropped and every string replaced by 0, the file must be one `WoWCompanionDigest = {...}` assignment with no parentheses (calls), no bare identifiers as values, no call or index on a name, and no `..`, `:` or `#` operators.
func SlotPath ¶
SlotPath derives <game>/Interface/AddOns/<addon>/<file> from a SavedVariables path; ok is false when the path is not <game>/WTF/Account/<account>/SavedVariables/<file>.
Types ¶
type Digest ¶
type Digest struct {
Schema string
Generated int64
Build string
Character string
Sections []Section
Dungeons []DungeonLine // optional, at most MaxDungeons
Talents []TalentLine // optional, at most MaxTalents
}
Digest is the whole file.
type DungeonLine ¶
DungeonLine is one dungeons entry: the dungeon, its level fit and top upgrade; Item is zero when absent.
type Envelope ¶
type Envelope struct {
Generated int64
Characters []Digest // in file order; each Character is its key
}
Envelope is the whole file, schema 2.0: one entry per captured character, keyed by the name as captured.
type Options ¶
type Options struct {
Now time.Time
Client character.Client // the game client that wrote the capture
DatasetBuild string // the dataset's game build; empty when none
Questie *questie.Index // the player's own QuestieDB; nil when they have none
}
Options is what Build needs besides the capture and the dataset.
type TalentLine ¶
TalentLine is one talents entry: the next point to spend; Spell is zero when the dataset has none.