Documentation
¶
Overview ¶
Package gamesetup checks the player's setup (game folder, ForeverScribe, the WoW Companion addon, display mode, the AI client) and installs or updates the addon on request.
Checks only read. The one write is the addon install, confined to Interface/AddOns, and it runs only when the caller asks. Nothing here touches the game process, and WTF/Config.wtf is never modified.
Index ¶
- Constants
- Variables
- func ExtractAddon(zipb []byte, addons string) error
- func GameFolder(dir string) (string, bool)
- func InstallAddon(ctx context.Context, c *http.Client, game string, r *AddonRelease) error
- func InstalledAddonVersion(game string) (string, bool)
- func Newer(a, b string) bool
- func Resolve(o Options) (string, bool)
- func TestAI(ctx context.Context, command []string) (ok bool, msg string)
- func VerifySum(data []byte, name string, sums []byte) error
- type AddonRelease
- type DatasetState
- type Display
- type Item
- type Options
Constants ¶
const ( OK = "ok" Warn = "warn" Bad = "bad" )
Item statuses.
const ( IDGame = "game" IDScribe = "foreverscribe" IDData = "data" IDDataset = "dataset" IDAddon = "addon" IDDisplay = "display" IDQuestie = "questie" IDAI = "ai" AddonName = "WoWCompanion" ScribeName = "ForeverScribe" ScribeURL = "https://github.com/MattMaximo/foreverscribe" )
Item ids.
const ( ActChooseFolder = "choose-folder" ActOpenURL = "open-url" ActInstallAddon = "install-addon" ActUpdateAddon = "update-addon" ActTestAI = "test-ai" ActWriteData = "write-data" )
Actions an item's button may ask for.
const AIInstallNote = "Install Claude Code, Codex or Antigravity CLI (agy), then sign in once by running it in a terminal."
AIInstallNote is shown when no AI client is found.
const AIPrompt = "Reply with the single word OK."
AIPrompt is the tiny prompt the Test button sends.
const ActDownloadData = "download-dataset"
ActDownloadData asks the sidecar to fetch the game dataset (the one write besides the addon install).
const AddonLatestURL = "https://api.github.com/repos/WoW-Companion/addon/releases/latest"
AddonLatestURL is the addon repo's latest-release endpoint.
Variables ¶
var DataFiles = []string{"Digest.lua", "Plan.lua"}
DataFiles are the files the digest addon's TOC lists, written by the advisor.
Functions ¶
func ExtractAddon ¶
ExtractAddon validates every entry first, then writes. The zip must not hold Digest.lua or anything outside WoWCompanion/ and WoWCompanion_Digest/. addons is the Interface/AddOns folder.
func GameFolder ¶
GameFolder finds the game folder that holds Interface and WTF (for example C:\Program Files (x86)\World of Warcraft\_forever_). dir may be that folder or the WoW root.
func InstallAddon ¶
InstallAddon downloads the release zip and its SHA256SUMS, verifies the hash and extracts into <game>/Interface/AddOns. Nothing is written when the checksum is missing or does not match.
func InstalledAddonVersion ¶
InstalledAddonVersion is the installed WoWCompanion.toc version; ok is false when not installed.
func Newer ¶
Newer reports whether version a is newer than b, by dotted numbers; an unreadable b counts as older.
func Resolve ¶
Resolve picks the game folder: the chosen one, else the one the configured SavedVariables path sits in, else a standard install.
Types ¶
type AddonRelease ¶
type AddonRelease struct {
Version string // without a leading v
ZipURL string
SumsURL string
ZipName string
Checksum bool // a SHA256SUMS asset exists
}
AddonRelease is the newest addon release.
func LatestAddon ¶
LatestAddon looks up the newest addon release. It downloads nothing but the release's JSON.
type DatasetState ¶ added in v0.4.0
type DatasetState struct {
Client character.Client
Cached []string
Failed string
Busy bool
// Revision is the day the matching cached dataset was published (empty when unknown).
Revision string
}
DatasetState is what the Game data row needs: the capture's client, the verified cached builds (newest first), the last failed download and whether one is running.
type Display ¶
type Display struct {
Known bool
Exclusive bool // exclusive fullscreen: the overlay cannot draw over it
Mode string
Unreadable error
}
Display is what Config.wtf says about the window mode.
func ReadDisplay ¶
ReadDisplay reads <game>/WTF/Config.wtf, read-only. The client writes lines like `SET gxWindow "1"` and `SET gxMaximize "1"`: gxWindow 0 is exclusive fullscreen; gxWindow 1 is a window, borderless ("Windowed (Fullscreen)") when gxMaximize is 1.
type Item ¶
type Item struct {
ID string `json:"id"`
Title string `json:"title"`
Status string `json:"status"` // ok, warn or bad
Detail string `json:"detail"`
Optional bool `json:"optional,omitempty"` // may be hidden with "Don't show again"
Action string `json:"action,omitempty"` // the one button, if any
Label string `json:"label,omitempty"` // the button's text
URL string `json:"url,omitempty"` // for ActOpenURL
}
Item is one checklist row.
func DatasetItem ¶ added in v0.4.0
func DatasetItem(st DatasetState) Item
DatasetItem is the "Game data" row. The dataset downloads by itself on first need; this shows whether it has and lets the player retry.
type Options ¶
type Options struct {
GameDir string // the player's chosen WoW folder; empty to detect
SavedVariables string // the configured ForeverScribe.lua; used when GameDir is empty
Latest *AddonRelease
LatestErr string
}
Options says where to look. Latest is the newest addon release, nil when not looked up.