character

package
v0.7.114 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 14 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 character reads characters captured by ForeverScribe (https://github.com/MattMaximo/foreverscribe, MIT) into a typed model.

Fields ForeverScribe did not capture are nil (or an empty string for text), never invented.

Index

Constants

View Source
const (
	SourceWoWC = "WoW Companion addon"
	SourceFS   = "ForeverScribe"
)

Source names for Character.Source.

View Source
const (
	FSFile   = "ForeverScribe.lua"
	WoWCFile = "WoWCompanion.lua"
)

File names beside each other in one SavedVariables folder.

View Source
const DBVariable = "ForeverScribeDB"

DBVariable is the one global the addon writes.

View Source
const DefaultLevelReach = 3

DefaultLevelReach is how many levels above the player an unfinished quest may be and still be planned.

View Source
const FlightNodeRadius = 3.0

FlightNodeRadius is how far, in map percent, a flight master may stand from its captured node and still match it.

View Source
const NearFraction = 0.75

NearFraction is the share of objectives done at which an open quest counts as nearly complete.

View Source
const RecentGiver = 7 * 24 * time.Hour

RecentGiver is how recently a giver must have been met to be flagged as a recent interaction.

View Source
const SeenByYou = "seen by you"

SeenByYou is the mark on a fact that came from what the player saw in game (WoWCompanionDB.observed, docs/observed-format.md of the addon).

View Source
const StaleAfter = 30 * 24 * time.Hour

StaleAfter is how old an observation may be and still count as current price data.

View Source
const WoWCVariable = "WoWCompanionDB"

WoWCVariable is the global the WoW Companion addon writes; its characters sit in `characters` (docs/capture-format.md of the addon).

Variables

This section is empty.

Functions

func OpenWindowTip added in v0.7.98

func OpenWindowTip(profession string) string

OpenWindowTip is the one line to say when a profession's recipes were never captured.

func ParseAddon added in v0.7.47

func ParseAddon(text, key, name string) (*Totals, *Observed)

ParseAddon reads the addon's SavedVariables text: the stat totals of one character and what the player saw.

func ParseQuestRewards added in v0.7.112

func ParseQuestRewards(vars map[string]any) map[int]QuestReward

ParseQuestRewards reads WoWCompanionDB.questRewards out of parsed variables. It is tolerant: a capture without the table, or an entry without items, gives nothing for it. nil when none.

func SeenAgo added in v0.7.53

func SeenAgo(t int64, now time.Time) string

SeenAgo says when something was seen, in plain words ("seen 3 days ago"); "" when t is unknown.

func SeenNote added in v0.7.53

func SeenNote(t int64, now time.Time) string

SeenNote is the freshness phrase for an observation: "seen 3 days ago", with "; prices may have changed" added once it is older than StaleAfter.

func Siblings added in v0.7.47

func Siblings(path string) (fsPath, wowcPath string)

Siblings returns the ForeverScribe and the WoW Companion file in the folder of path. A path named WoWCompanion.lua is the addon's file; any other name is taken as ForeverScribe's.

func Stale added in v0.7.53

func Stale(t int64, now time.Time) bool

Stale reports whether an observation made at t is too old to count as current prices.

func StandingName added in v0.7.99

func StandingName(id int) string

StandingName is the name of a reputation standing id, "" for an id outside 1 to 8.

Types

type Character

type Character struct {
	Key        string // "Realm:Name"; the name alone when the realm is empty
	Name       string
	Realm      string
	Level      *int
	Class      string
	Race       string
	Faction    string
	Money      *int
	XP         *int
	XPMax      *int
	RestedXP   *int // experience points (GetXPExhaustion), not a percentage
	CapturedAt *int64
	Addon      string
	Client     Client
	Location   *Location // nil when the capture holds none
	Hearth     string    // the hearthstone's bind location name
	// HearthHave, HearthReadyIn (seconds left when captured) and HearthCD (the full cooldown, seconds) are nil
	// in a capture made before the addon read them; see HearthWait. HearthCD is short because a test guards
	// that no Character field says "cooldown" (a craft's).
	HearthHave    *bool
	HearthReadyIn *int
	HearthCD      *int
	// Source says which capture the character came from: SourceWoWC, SourceFS or both joined.
	Source string

	Equipment    map[string]EquippedItem // nil when not captured
	Bags         []ItemStack
	BagsCaptured bool
	Bank         []ItemStack
	BankCaptured bool // false until the player has opened the bank with ForeverScribe running

	NPCs           []NPC // nil when the capture holds no npcs table
	Quests         []Quest
	QuestsCaptured bool
	// QuestPOI is the point the client's quest map gave for a quest in the log, by quest id: the
	// area of its current objective. Nil when the capture holds none.
	QuestPOI        map[int]QuestPOI
	CompletedQuests []int
	// PlanPrefs are the player's plan settings (WoWCompanionDB.characters[key].planPrefs); nil means defaults.
	PlanPrefs *PlanPrefs
	// Abandoned are quests the player abandoned (from the addon's events) and has not accepted again or
	// unhidden since; they count as hidden. Filled by unlock.Apply.
	Abandoned      map[int]bool
	Talents        *Talents
	Skills         []Skill
	SkillsCaptured bool
	Professions    []Skill // each profession once
	Reputations    []Reputation

	// Profile is the player's own, kept locally (internal/profile) and attached after the
	// capture is read; nil when the player has set none. They are never part of a capture.
	Profile *Profile
	// Seasonal is the player's holiday-event setting, kept with the profile: "" (off), "on" or
	// "on:<event keys>" (see questie.Seasonal).
	Seasonal string
	// KnownSpells are the spell ids the character knows (a recipe's spell id included), when a capture
	// lists them; nil when it does not.
	KnownSpells map[int64]bool
	// Recipes are the recipes the client's own trade skill window listed, by profession (lower-case);
	// nil when none were recorded. A recipe listed here is known.
	Recipes map[string]SeenRecipes
	// Totals are the stat totals the addon records (WoWCompanionDB.characters[key].stats), attached with AttachTotals;
	// nil when none.
	Totals *Totals
	// Seen is what the player saw in game (WoWCompanionDB.observed): trainers, vendors, gathering and
	// quest givers; nil when nothing was recorded. These "seen by you" facts come before the dataset.
	Seen *Observed
	// QuestRewards are the reward windows the player saw (WoWCompanionDB.questRewards), by quest id, account-wide;
	// nil when the capture has none.
	QuestRewards map[int]QuestReward
}

func AttachAddon added in v0.7.47

func AttachAddon(addonSV string, c Character) Character

AttachAddon returns c with what the addon recorded in its SavedVariables file: the stat totals and the observations ("seen by you"). Nothing is attached when the file is missing or unreadable.

func AttachTotals added in v0.7.12

func AttachTotals(addonSV string, c Character) Character

AttachTotals returns c with what the addon recorded in its SavedVariables file: its stat totals and what the player saw (Seen). c is unchanged when the file is unreadable or holds none.

func LoadCharacter

func LoadCharacter(key string, rec lua.Table) Character

func LoadWoWCharacter added in v0.7.47

func LoadWoWCharacter(key string, rec lua.Table) Character

LoadWoWCharacter builds one character from a WoWCompanionDB.characters record.

func MergeCharacters added in v0.7.47

func MergeCharacters(a, b Character) Character

MergeCharacters returns the newer capture, with each part it lacks filled from the other.

func (Character) Carries added in v0.7.98

func (c Character) Carries(item int64) bool

Carries reports whether the item is in the bags or the bank.

func (Character) ElitesIncluded added in v0.7.98

func (c Character) ElitesIncluded() bool

ElitesIncluded reports whether the player plans elite quests.

func (Character) HasRecipeList added in v0.7.98

func (c Character) HasRecipeList(profession string) bool

HasRecipeList reports whether the capture holds recipes for the profession (its trade skill or craft window was read).

func (Character) HearthWait added in v0.7.101

func (c Character) HearthWait(now int64) (wait int, usable bool)

HearthWait says whether the character has a hearthstone to use and, if so, the seconds until it is ready at time now (unix seconds): the captured wait aged by the time since the capture. A capture without the hearthstone fields counts as present and ready when a bind is set; no bind or no stone is not usable.

func (Character) IsAbandoned added in v0.7.107

func (c Character) IsAbandoned(id int) bool

IsAbandoned reports whether the quest counts as hidden only because the player abandoned it.

func (Character) IsHidden added in v0.7.98

func (c Character) IsHidden(id int) bool

IsHidden reports whether the player hid the quest from the plan.

func (Character) KnowsRecipe added in v0.7.77

func (c Character) KnowsRecipe(profession string, spell int64, name string, creates int64) Knowledge

KnowsRecipe decides whether the character knows a recipe, by its spell id, its name and the item it creates. Known spells and the recorded recipes for the profession both count as known; when either source exists and the recipe is in neither, it is not known (even if the other source is empty).

func (Character) LastKnownPosition added in v0.5.0

func (c Character) LastKnownPosition() *Position

LastKnownPosition is nil when neither a located save nor any NPC sighting exists.

func (Character) LikelyKnowsMaker added in v0.7.98

func (c Character) LikelyKnowsMaker(profession string, creates int64) bool

LikelyKnowsMaker reports whether the character probably knows a recipe of the profession that makes the item: no recipe list was captured for the profession and the item is in the bags or the bank.

func (Character) NearbyGivers added in v0.5.0

func (c Character) NearbyGivers(now time.Time) []Giver

NearbyGivers lists kind "quest" NPCs in the position's zone (same map when both ids are known), nearest first. A giver sighted at several spots is listed once.

func (Character) Reach added in v0.7.98

func (c Character) Reach() int

Reach is the level reach in effect: the default when the character has no prefs, -1 for off.

func (Character) Recipe added in v0.7.53

func (c Character) Recipe(profession, name string) (SeenRecipe, bool)

Recipe finds a recipe the player's window listed for the profession, by name (case-blind).

func (Character) RecipeEntry added in v0.7.108

func (c Character) RecipeEntry(profession string, spell int64, name string, creates int64) (SeenRecipe, bool)

RecipeEntry finds the recipe the profession's window listed by spell id, name (case-blind) or created item id, whichever the caller holds; a zero id or empty name is not matched.

func (Character) ReputationNamed added in v0.7.99

func (c Character) ReputationNamed(text string) (Reputation, bool)

ReputationNamed is the character's reputation with the faction the text names, or false: the first of ReputationsNamed.

func (Character) ReputationsNamed added in v0.7.106

func (c Character) ReputationsNamed(text string) []Reputation

ReputationsNamed are the character's reputations with the factions the text names. A faction whose full name the text holds (case-insensitive) is the answer alone; failing that, the factions the short name a player says stands for: the first word of the name without a leading "The" ("Timbermaw" for Timbermaw Hold, "Gnomeregan" for Gnomeregan Exiles, "Thorium" for Thorium Brotherhood) or its last long word ("Nozdormu" for Brood of Nozdormu, "Arathor"), as a whole word.

func (Character) TrainerUsed added in v0.7.108

func (c Character) TrainerUsed(spell int64, name string) bool

TrainerUsed reports whether a trainer the player opened lists the recipe (by spell id or name) as "used": already learned. The window's own list is the newer word when it holds the recipe; this is for a recipe it lacks.

func (Character) WithRecipeProfessions added in v0.7.64

func (c Character) WithRecipeProfessions() Character

WithRecipeProfessions adds a profession for each one the character has recorded recipes for and the skills do not list: a recipe window only opens for a profession the character has. The skill level of an added one is unknown. It returns c unchanged when nothing needs adding.

func (Character) ZoneOfMap added in v0.7.47

func (c Character) ZoneOfMap(mapID int) string

ZoneOfMap names the zone of a uiMapID from what the capture knows (where the character stood, the NPCs it met); "" when it knows none. A name is never invented.

type Client

type Client struct {
	Version string
	Build   string
	TOC     string
}

Client is the game client that wrote the capture.

func (Client) Empty

func (c Client) Empty() bool

type EquippedItem

type EquippedItem struct {
	Slot          string
	ItemID        *int
	Enchant       *int
	Link          string
	Name          string
	ItemLevel     *int
	Quality       *int
	Durability    *int
	DurabilityMax *int
	// Stats is the item's own stats as the addon recorded them (agi, sta, armor, ...); nil when it did not. Enchants are not in it.
	Stats map[string]float64
}

type File

type File struct {
	Addon      string
	Schema     *int
	Client     Client
	Characters []Character
	// HasWoWC and HasFS say which capture files were read (WoWCompanionDB.characters, ForeverScribeDB).
	HasWoWC, HasFS bool
}

File is everything one SavedVariables file holds.

func Load

func Load(vars map[string]any) (File, error)

Load builds models from parsed variables (the result of lua.Parse).

func LoadFile

func LoadFile(path string) (File, error)

LoadFile reads the character captures beside path: the WoW Companion addon's (WoWCompanionDB.characters in WoWCompanion.lua) and ForeverScribe's. A character in both is merged: the newer capture leads and the other fills the parts it lacks. A file that is missing or unreadable is skipped when the other gives characters; otherwise the error is the one for path. A malformed file is a *lua.ParseError.

func LoadWoWC added in v0.7.47

func LoadWoWC(vars map[string]any) (File, error)

LoadWoWC builds models from parsed variables holding WoWCompanionDB.characters. The result has no characters (and HasWoWC false upstream) when the table is absent.

func (File) CapturedAt

func (f File) CapturedAt() *int64

CapturedAt is the newest capture time over all characters.

func (File) ClientOf

func (f File) ClientOf(c Character) Client

ClientOf is the client block of one character, falling back to the file's.

type FlightNode added in v0.7.114

type FlightNode struct {
	ID    int
	Map   int
	X, Y  float64
	Name  string // "Ratchet, The Barrens"
	State string // "reachable" or "unreachable" for a known node
}

FlightNode is one node of the flight map as the addon captured it.

func (FlightNode) Known added in v0.7.114

func (n FlightNode) Known() bool

Known reports whether the capture marks the node as a flight point the character has.

type Giver added in v0.5.0

type Giver struct {
	NPC
	Distance float64 // straight line in map percent
	Recent   bool    // met within RecentGiver
}

Giver is a quest-giver NPC the character has met, with its distance from the position.

type ItemStack

type ItemStack struct {
	ItemID int
	Count  int
	Name   string
	Link   string
	// The addon's optional per-item fields; nil or empty when it did not record them.
	Quality   *int
	ItemLevel *int
	ReqLevel  *int
	EquipLoc  string
	Suffix    string
	// Enchant is the enchant id on the item; nil when none or not recorded.
	Enchant *int
	// Stats is the item's own stats as the addon recorded them; nil when it did not.
	Stats map[string]float64
}

type Knowledge added in v0.7.77

type Knowledge int

Knowledge says whether the character knows a recipe.

const (
	// RecipeUnknown: nothing recorded decides it (no known spells and no recorded list for the profession).
	RecipeUnknown Knowledge = iota
	// RecipeKnown: the spell is a known spell, or the recipe is in the recorded list for the profession.
	RecipeKnown
	// RecipeNotKnown: the character has a spell list or a recorded recipe list and the recipe is in neither.
	RecipeNotKnown
	// RecipeLikelyKnown: no recipe list was recorded for the profession (its window was never opened), but the
	// character carries the item the recipe makes. It is inferred, never read: say "likely", never "learn it".
	RecipeLikelyKnown
)

type Location added in v0.4.0

type Location struct {
	Zone    string
	Subzone string
	MapName string
	MapID   *int
	X, Y    *float64
}

Location is where the character stood at the last save (ForeverScribe snapshot.location). X and Y are percent of the map (0 to 100) and nil when the client gave no position.

type NPC added in v0.5.0

type NPC struct {
	ID      int
	Name    string
	MapID   *int
	Zone    string
	Subzone string
	X, Y    *float64
	Kind    string
	First   *int64
	Seen    *int64 // t: last interaction, epoch seconds
	Count   *int   // n: interactions
	Spots   []Spot
}

NPC is one NPC sighting (ForeverScribe npcs["<npcID>:<uiMapID>"]). Kind is "quest" or "gossip".

type Objective

type Objective struct {
	Text string
	Have *int
	Need *int
	Done *bool
	Type string
}

func (Objective) Label added in v0.7.2

func (o Objective) Label() string

Label is the objective's text without its have/need count: "Windsong Crawler Meat".

func (Objective) ObjectiveDone added in v0.7.79

func (o Objective) ObjectiveDone() bool

ObjectiveDone reports whether o is finished, by its done flag or its count.

type Observed added in v0.7.47

type Observed struct {
	Trainers []SeenTrainer
	Vendors  []SeenVendor
	Gather   []SeenGather
	Givers   []SeenGiver
	// Flights are the flight masters the player opened.
	Flights []SeenFlight
	// Nodes are the flight map nodes the addon captured (flightPoints.nodes of every character), merged by node id.
	Nodes []FlightNode
}

Observed is what the player saw, read from the addon's SavedVariables. Every list may be empty.

func ParseObserved added in v0.7.47

func ParseObserved(vars map[string]any) *Observed

ParseObserved reads WoWCompanionDB.observed out of parsed variables: trainers, vendors, gathering and the quest givers of accepted events (the newest sighting of each quest wins). It is tolerant: a missing section or field is empty.

func (*Observed) Empty added in v0.7.47

func (o *Observed) Empty() bool

Empty reports whether nothing was observed.

func (*Observed) FlightsFor added in v0.7.53

func (o *Observed) FlightsFor(faction string) []SeenFlight

FlightsFor lists the seen flight masters open to the faction, newest first.

func (*Observed) GiverOf added in v0.7.47

func (o *Observed) GiverOf(questID int) (SeenGiver, bool)

GiverOf is the seen giver of a quest.

func (*Observed) NodeNear added in v0.7.114

func (o *Observed) NodeNear(m int, x, y float64) (FlightNode, bool)

NodeNear is the captured node on map m nearest (x, y) within FlightNodeRadius.

func (*Observed) TrainersFor added in v0.7.47

func (o *Observed) TrainersFor(faction string) []SeenTrainer

TrainersFor lists the seen trainers open to the character's faction, newest first.

func (*Observed) VendorsOf added in v0.7.47

func (o *Observed) VendorsOf(item int64, faction string) (vs []SeenVendor, stock []SeenStock)

VendorsOf lists the seen vendors open to the faction that sold the item, with the stock row.

type PerPoint added in v0.7.56

type PerPoint struct {
	SpellCritFromInt, CritFromAgi, ManaRegenFromSpi, HealthRegenFromSpi *float64
}

PerPoint are the client's per-point getters, every field optional: stats.perPoint.spellCritFromInt, critFromAgi, manaRegenFromSpi and healthRegenFromSpi.

type PlanPrefs added in v0.7.98

type PlanPrefs struct {
	LevelReach   int
	Hidden       map[int]bool
	IncludeElite bool
	Updated      int64 // when the addon last wrote the prefs (0 when it does not say)
}

PlanPrefs are the player's plan settings. LevelReach is 0 to 10, or -1 for no limit; Hidden are the quests the player dismissed; IncludeElite plans elite (group) quests.

type Position added in v0.5.0

type Position struct {
	Zone, Subzone string
	MapID         *int
	X, Y          float64
	Approximate   bool
}

Position is the character's last known place: the saved location when it has coordinates, else (Approximate) where the most recent NPC interaction happened.

func (Position) InZone added in v0.5.0

func (p Position) InZone(zone string) bool

InZone reports whether a quest's zone name matches the position's zone or subzone.

func (Position) Label added in v0.5.0

func (p Position) Label() string

Label describes the position, marking an approximate one.

type Profile added in v0.7.0

type Profile struct {
	Role  string `json:"role"`
	Focus string `json:"focus"`
	Spec  string `json:"spec,omitempty"`
	// StatPref is the optional stat preference: balanced, damage or survival ("" is balanced).
	StatPref string `json:"stat_pref,omitempty"`
}

Profile is a character's play style: role (tank, healer, damage or balanced), focus (leveling, dungeons, pvp or mixed), the spec tree the player chose.

type Quest

type Quest struct {
	QuestID    int
	Title      string
	Level      *int
	Zone       string
	Complete   *bool
	Failed     *bool
	Objectives []Objective
	// Observed marks a quest the addon saw accepted after the capture: it is in the log, but its
	// objectives are not in the capture.
	Observed bool
	// Elite is set when the addon flagged the quest elite (a group quest); nil or false when not.
	Elite *bool
	// Group is the quest's suggested group size from the addon (0 or nil: none); above 0 the quest is a group quest.
	Group *int
}

func (Quest) Fraction added in v0.5.0

func (q Quest) Fraction() (float64, bool)

Fraction is the share of the quest's objectives that are done, and whether it is known. A complete quest is 1; a quest with no readable objectives is unknown.

func (Quest) IsElite added in v0.7.105

func (q Quest) IsElite() (elite, ok bool)

IsElite reports whether the capture itself marks the quest elite, and whether it says anything: ok is false for a capture with neither an elite flag nor a group size, which leaves the answer to other sources.

func (Quest) NearlyDone added in v0.5.0

func (q Quest) NearlyDone() bool

NearlyDone reports a quest that is complete or has at least NearFraction of its objectives done.

func (Quest) ObjectiveProgress added in v0.5.0

func (q Quest) ObjectiveProgress() string

ObjectiveProgress is ProgressText without the quest name: "3/8 Crab Claws; 1/1 Boss".

func (Quest) ProgressText added in v0.5.0

func (q Quest) ProgressText() string

ProgressText is the quest's objective progress, such as "Crab Season: 3/8 Crab Claws; 1/1 Boss". It is empty when the quest has no objective with a count.

func (Quest) Readiness added in v0.7.79

func (q Quest) Readiness() string

Readiness is the quest's state in words: "ready to turn in", "1 of 3 objectives done", or "not ready to turn in" when the capture lists no objectives.

func (Quest) Ready added in v0.7.79

func (q Quest) Ready() bool

Ready reports whether the quest can be handed in: the game says it is complete, or it has objectives and every one is finished. A quest with no readable objectives is not ready.

type QuestPOI added in v0.7.94

type QuestPOI struct {
	Map    int
	X, Y   float64
	SeenAt int64
}

QuestPOI is one captured quest map point: a map, a position as percent of that map, and when the client gave it (0 when not recorded).

type QuestReward added in v0.7.112

type QuestReward struct {
	QuestID int
	Choices []RewardItem
	Fixed   []RewardItem
	Money   int64
	XP      int
	Rep     []RewardRep
	SeenAt  int64
}

QuestReward is what the quest's reward window showed the player (WoWCompanionDB.questRewards[questID], the addon's docs/capture-format.md): the items to choose from, the items always given, money in copper, experience and reputation. It is account-wide: any character that saw it recorded it.

type Reputation

type Reputation struct {
	FactionID int
	Name      string
	Standing  *int
	Value     *int
	Min       *int
	Max       *int
	AtWar     *bool
	Group     string
}

func (Reputation) Progress added in v0.7.99

func (r Reputation) Progress() string

Progress says where the character stands with the faction: the standing, the points inside it and the points to the next standing, from the capture's own bar (min, max and value) and, where the capture lacks them, the game's public thresholds. It says what is not known and never a guess: "" when the capture holds no standing.

type RewardItem added in v0.7.112

type RewardItem struct {
	ID    int64
	Name  string
	Count int
}

RewardItem is one item a quest reward window showed.

type RewardRep added in v0.7.112

type RewardRep struct {
	Faction string
	Amount  int
}

RewardRep is the reputation a quest gives with one faction.

type SeenFlight added in v0.7.53

type SeenFlight struct {
	NPC     int64
	Name    string
	Map     int
	X, Y    float64
	Faction string
	T       int64
	Node    string // the taxi node name recorded for this flight master, when the addon had it
}

SeenFlight is one flight master the player opened: a known flight point.

type SeenGather added in v0.7.47

type SeenGather struct {
	Kind               string // herb, mine, skin or fish
	Source             string
	Map                int
	CX, CY             int // the cell: floor(percent / 5)
	N                  int
	T                  int64
	SkillMin, SkillMax int
	Items              map[int64]int // item id -> total looted
}

SeenGather is one aggregated gathering or fishing row: where, what and how much.

type SeenGiver added in v0.7.47

type SeenGiver struct {
	QuestID int
	NPC     string
	NPCID   int64
	Map     int
	X, Y    float64
	T       int64
}

SeenGiver is where the player saw a quest's giver, from an accepted event.

type SeenOffer added in v0.7.47

type SeenOffer struct {
	Name       string
	Rank       string
	State      string // available, unavailable or used (already known)
	Cost       int64  // copper
	Level      int    // the character level it needs, 0 when none shown
	Skill      string // the skill gate's profession, "" when none
	SkillLevel int
	Spell      int64
}

SeenOffer is one thing a trainer teaches, as the trainer window showed it.

type SeenRecipe added in v0.7.53

type SeenRecipe struct {
	Name       string
	ID         int64  // the spell or item id in the recipe's link, 0 when none
	Difficulty string // orange, yellow, green or grey at the skill the window was opened at
	Makes      int64  // item id, 0 when none
	MakesCount int
	Reagents   []ItemStack
}

SeenRecipe is one recipe the player's own trade skill window listed.

type SeenRecipes added in v0.7.53

type SeenRecipes struct {
	SeenAt  int64
	Entries []SeenRecipe
}

SeenRecipes is one profession's recipes and when the window was read.

type SeenStock added in v0.7.47

type SeenStock struct {
	ItemID int64
	Price  int64
	Ext    bool // also costs tokens or items
}

SeenStock is one item a vendor sold, with its price in copper.

type SeenTrainer added in v0.7.47

type SeenTrainer struct {
	NPC     int64
	Name    string
	Map     int
	X, Y    float64
	Faction string
	T       int64
	Offers  []SeenOffer
}

SeenTrainer is one trainer the player opened.

type SeenVendor added in v0.7.47

type SeenVendor struct {
	NPC     int64
	Name    string
	Map     int
	X, Y    float64
	Faction string
	T       int64
	Items   []SeenStock
}

SeenVendor is one vendor the player opened.

type Skill

type Skill struct {
	Name    string
	SkillID *int
	Rank    *int
	Max     *int
	Group   string
	// FromRecipes marks a profession known only because the character's recipes for it were recorded;
	// its skill level is not captured.
	FromRecipes bool
}

type Spot added in v0.5.0

type Spot struct {
	X, Y *float64
	T    *int64
	N    *int
}

Spot is one place an NPC was seen (map percent) and when.

type Talent

type Talent struct {
	Name    string
	Group   string
	Rank    int
	MaxRank *int
	NodeID  *int
	SpellID *int
	Type    string // node type as captured, "" when absent
	CanBuy  *bool  // nil when the capture does not say
}

type TalentGroup

type TalentGroup struct {
	Name  string
	Order *int
	Spent int
}

TalentGroup is one named branch of a tree (for example "Discipline") and its spent points.

type TalentTree

type TalentTree struct {
	Name      string
	Key       string // "professions" for a profession tree; "" for a class tree
	Points    *int   // points spent in the tree
	Unspent   *int   // currency.unspent
	MaxPoints *int   // currency.max
	MaxAvail  *int   // currency.maxAvailable
	Groups    []TalentGroup
	Talents   []Talent
}

func (TalentTree) IsProfession added in v0.7.0

func (t TalentTree) IsProfession() bool

IsProfession reports whether the tree is a profession talent tree, not a class tree.

type Talents

type Talents struct {
	System  string
	Loadout string
	Unspent *int // class talent points (class tree currencies, else the top-level field)
	Trees   []TalentTree
}

func (*Talents) ProfessionUnspent added in v0.7.0

func (t *Talents) ProfessionUnspent() int

ProfessionUnspent is the unspent points over the profession trees; 0 when there are none.

type Totals added in v0.7.12

type Totals struct {
	At    *int64 // stats.seenAt
	Level *int   // stats.level
	// The five stats, as the totals the player sees (stats.stats.<stat>.total); Base, Pos and Neg are the
	// same stat's unmodified value and its gear/buff and penalty parts.
	Str, Agi, Sta, Int, Spi *float64
	Base, Pos, Neg          map[string]float64 // keyed "str", "agi", "sta", "int", "spi"
	HealthMax, ManaMax      *float64
	Armor, AttackPower      *float64
	RangedAttackPower       *float64
	// Crit is the melee crit chance (stats.meleeCrit); RangedCrit and SpellCrit (the best school) are percents.
	Crit, RangedCrit, SpellCrit *float64
	Dodge, Parry, Block         *float64
	ManaRegenBase               *float64 // stats.manaRegen.base
	ManaRegenCasting            *float64 // stats.manaRegen.casting
	SpellDamage, SpellHealing   *float64
	// Per are what the client's own per-point getters report for this character (stats.perPoint); nil when
	// the addon wrote none.
	Per *PerPoint
}

Totals are a character's stat numbers as the WoW Companion addon records them read-only in WoWCompanionDB.characters[<character key>].stats (every field optional; nil when the addon wrote none).

func ParseTotals added in v0.7.12

func ParseTotals(text, key, name string) *Totals

ParseTotals reads WoWCompanionDB.characters[key].stats out of the addon's SavedVariables text, tolerantly: a missing table, entry or field gives nil or a nil field. The key is matched as captured, then case-insensitively, then by character name alone.

func (*Totals) Any added in v0.7.12

func (t *Totals) Any() bool

Any reports whether at least one total is present and positive.

func (*Totals) Total added in v0.7.63

func (t *Totals) Total(k string) float64

Total is the stat's total (0 when the capture has none), keyed like Base.

Jump to

Keyboard shortcuts

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