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
- type Character
- type Client
- type EquippedItem
- type File
- type Giver
- type ItemStack
- type Location
- type NPC
- type Objective
- type PlanPick
- type Position
- type Profile
- type Quest
- type Reputation
- type Skill
- type Spot
- type Talent
- type TalentGroup
- type TalentPlan
- type TalentTree
- type Talents
- type Totals
Constants ¶
const DBVariable = "ForeverScribeDB"
DBVariable is the one global the addon writes.
const NearFraction = 0.75
NearFraction is the share of objectives done at which an open quest counts as nearly complete.
const RecentGiver = 7 * 24 * time.Hour
RecentGiver is how recently a giver must have been met to be flagged as a recent interaction.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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
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
CompletedQuests []int
Talents *Talents
Skills []Skill
SkillsCaptured bool
Professions []Skill // each profession once
Reputations []Reputation
// Profile and Plan are 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
// 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
Plan *TalentPlan
// Totals are the stat totals the addon records (WoWCompanionDB.stats), attached with AttachTotals;
// nil when none.
Totals *Totals
}
func AttachTotals ¶ added in v0.7.12
AttachTotals returns c with its recorded stat totals read from the addon's SavedVariables file; c is unchanged when the file is unreadable or holds none.
func (Character) LastKnownPosition ¶ added in v0.5.0
LastKnownPosition is nil when neither a located save nor any NPC sighting exists.
type EquippedItem ¶
type File ¶
File is everything one SavedVariables file holds.
func LoadFile ¶
LoadFile reads and parses a ForeverScribe.lua file. A malformed file is a *lua.ParseError.
func (File) CapturedAt ¶
CapturedAt is the newest capture time over all characters.
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 Location ¶ added in v0.4.0
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 PlanPick ¶ added in v0.7.0
PlanPick is one entry of a talent plan: a captured node's name and the rank to reach.
type Position ¶ added in v0.5.0
Position is the character's last known place: the saved location when it has coordinates, else (Approximate) where the most recent NPC interaction happened.
type Profile ¶ added in v0.7.0
type Profile struct {
Role string `json:"role"`
Focus string `json:"focus"`
Spec string `json:"spec,omitempty"`
GuideURL string `json:"guide_url,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, and optionally a guide page.
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
}
func (Quest) Fraction ¶ added in v0.5.0
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) NearlyDone ¶ added in v0.5.0
NearlyDone reports a quest that is complete or has at least NearFraction of its objectives done.
func (Quest) ObjectiveProgress ¶ added in v0.5.0
ObjectiveProgress is ProgressText without the quest name: "3/8 Crab Claws; 1/1 Boss".
func (Quest) ProgressText ¶ added in v0.5.0
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.
type Reputation ¶
type TalentGroup ¶
TalentGroup is one named branch of a tree (for example "Discipline") and its spent points.
type TalentPlan ¶ added in v0.7.0
type TalentPlan struct {
Spec string `json:"spec"`
GuideURL string `json:"guide_url"`
Date string `json:"date"` // YYYY-MM-DD the plan was built
Picks []PlanPick `json:"picks"`
}
TalentPlan is an ordered list of talent nodes with target ranks, from the player's chosen guide. It holds node names and ranks only, never guide text.
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
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
Level *int
Str, Agi, Sta, Int, Spi *float64
Armor, AP, Crit, Dodge, Parry, Block *float64
}
Totals are a character's stat totals as the WoW Companion addon records them read-only in WoWCompanionDB.stats[<character key>] (every field optional; nil when the addon wrote none).
func ParseTotals ¶ added in v0.7.12
ParseTotals reads WoWCompanionDB.stats[key] 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.