gamesetup

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: 25 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 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

View Source
const (
	OK   = "ok"
	Warn = "warn"
	Bad  = "bad"
)

Item statuses.

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

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

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

View Source
const AIPrompt = "Reply with the single word OK."

AIPrompt is the tiny prompt the Test button sends.

View Source
const ActDownloadData = "download-dataset"

ActDownloadData asks the sidecar to fetch the game dataset (the one write besides the addon install).

View Source
const AddonLatestURL = "https://api.github.com/repos/WoW-Companion/addon/releases/latest"

AddonLatestURL is the addon repo's latest-release endpoint.

Variables

View Source
var DataFiles = []string{"Digest.lua", "Plan.lua"}

DataFiles are the files the digest addon's TOC lists, written by the advisor.

Functions

func ExtractAddon

func ExtractAddon(zipb []byte, addons string) error

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

func GameFolder(dir string) (string, bool)

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

func InstallAddon(ctx context.Context, c *http.Client, game string, r *AddonRelease) error

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

func InstalledAddonVersion(game string) (string, bool)

InstalledAddonVersion is the installed WoWCompanion.toc version; ok is false when not installed.

func Newer

func Newer(a, b string) bool

Newer reports whether version a is newer than b, by dotted numbers; an unreadable b counts as older.

func Resolve

func Resolve(o Options) (string, bool)

Resolve picks the game folder: the chosen one, else the one the configured SavedVariables path sits in, else a standard install.

func TestAI

func TestAI(ctx context.Context, command []string) (ok bool, msg string)

TestAI sends one tiny prompt through command; ok says it answered, msg the answer or the error's first line.

func VerifySum

func VerifySum(data []byte, name string, sums []byte) error

VerifySum checks data's SHA-256 against the line for name in a sha256sum-format file.

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

func LatestAddon(ctx context.Context, c *http.Client, apiURL string) (*AddonRelease, error)

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

func ReadDisplay(game string) Display

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 AIItem

func AIItem(name string) Item

AIItem is the AI client row; name is "" when none is detected.

func Check

func Check(o Options) []Item

Check runs every check except the AI client's, which needs the agent (see AIItem).

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.

Jump to

Keyboard shortcuts

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