Documentation
¶
Overview ¶
Package gen writes the SIML name table, sim/siml/names.json (SPEC.md §7.4): it asks the sim what every spec registers, adds a name for each spell, aura, item, enchant and random suffix the table does not name yet, and keeps every name the table already holds.
Index ¶
- Constants
- func AppendRecord(record []byte, repins []Repin) []byte
- func Changed(base, now *siml.Names, repinned map[string]bool) []string
- func FilesUsing(root string, pin Pin) ([]string, error)
- func GitFile(root, rev, path string) (data []byte, ok bool, err error)
- func IsCheckout(root string) bool
- func RecordedNames(record, base []byte) map[string]bool
- type Collection
- type EnchantRow
- type Identity
- type Item
- type Pin
- type Registration
- type Repin
- type Report
- type Suffix
Constants ¶
const MakeCommand = "make siml-names"
The command that regenerates the committed table.
const RecordPath = "sim/siml/gen/repinned.txt"
The repin record, relative to the repository's root: a line for each name a -repin gave another meaning.
const TablePath = "sim/siml/names.json"
The committed table, relative to the repository's root.
Variables ¶
This section is empty.
Functions ¶
func AppendRecord ¶
record with a line for each of repins that gave its name another meaning and is not in it yet, and the header first when record is empty.
func Changed ¶
One line for each name of base that now means something else or nothing, unless repinned holds it, such as "hunter.spell.arcane_shot: was spell 3044, now spell 2643". A name means its ids, tag, rank and slots; registeredBy is no part of it.
func FilesUsing ¶
The .siml files under root/ui/specs that write the name pin holds and mean its entry by it, relative to root: every committed file whose meaning a repin of the name can change. The files are read with the committed table, and a class's name is meant only in a file of that class.
func GitFile ¶
The file at path in commit rev of the checkout at root; ok is false when rev does not hold it.
func IsCheckout ¶
Whether root is the top of a git checkout, which a source tarball is not.
func RecordedNames ¶
The names of the lines record holds that base, an earlier record, does not hold.
Types ¶
type Collection ¶
type Collection struct {
// Every spell and aura any build registers, by namespace.
Registered map[siml.Namespace]map[Identity]Registration
// What the builds of a class's specs register with no gear, consumables or preset encounter.
Classes map[proto.Class]map[siml.Namespace]map[Identity]bool
Shared map[siml.Namespace]map[Identity]bool
// The specs of each class, by Player spec field name.
Specs map[proto.Class][]string
// The items whose effect a spec's build lists only as an ICD trigger, by item id, with those
// specs in byte order.
ICDItems map[int32][]string
SpellNames map[int32]string // Game names by spell id.
Items []Item // In the database's order: its items, then its consumables and item icons.
Enchants []EnchantRow // In the database's order.
Suffixes []Suffix
Skipped []string // What could not be built, for the report.
}
What the sim and the database hold, which the names are generated from.
func Collect ¶
func Collect(root string, old *siml.Names) (*Collection, error)
Builds every spec the sim can build and reads the database. root is the repository's root, which holds the talent trees (ui/sim/talents/trees). old is the committed table, whose spell ids get game names besides the registered ones.
type EnchantRow ¶
One enchant row: an effect id, its name, and the slots of the item types it fits.
type Identity ¶
type Identity struct{ SpellID, Tag int32 }
A spell id and tag, what an ActionID means to the sim: it finds a spell or an aura by them whatever the rank.
type Pin ¶
type Pin struct {
Class proto.Class // ClassUnknown for a shared, item, enchant or suffix entry.
Namespace siml.Namespace
Name string
}
A name of the table: a class's or the shared spell-like entry, or an item, enchant or suffix entry.
type Registration ¶
type Registration struct {
Rank int32 // The highest rank a build registers it with.
Castable bool // Whether a build registers it castable from the APL (SpellFlagAPL), which SpellStats.is_castable reports.
Specs []string // The specs whose builds register it, in byte order.
ICDOnly bool // In one build: an aura it lists only as an ICD trigger.
ICDSpecs []string // The specs whose builds list the aura only as an ICD trigger, in byte order.
TalentOnly bool // In one build: a talent's spell it lists as nothing but the talent.
// The specs of which some build lists the spell only as a talent, and those of which some build lists it otherwise,
// in byte order. The first without the second know it only as a talent.
TalentSpecs, ListedSpecs []string
}
type Repin ¶
A name a repin handed back to the new-name rules: what it meant before, and what it means now.
type Report ¶
type Report struct {
Added []string // One line per new entry, such as warrior.spell.heroic_strike = spell 11567 tag 1.
Qualified []string // New class entries whose plain name a shared entry holds, which the class's files mean by it.
Repinned []Repin // The names a repin handed back to the new-name rules, by name.
Dropped []string // Names HEAD's table does not hold whose entries nothing gives now, such as hunter.spell.x = spell 1.
Stale []string // Pinned names no build registers while an id of the same game name is registered.
Unregistered int // Pinned spell-like entries no build registers.
Skipped []string
}
What a run changed and could not do.
func Generate ¶
Reads the table under root, collects what the sim and the database hold, and returns the table the one under root grows into, with pin handed back to the new-name rules when it is not nil. In a git checkout, the entries whose names HEAD's table does not hold and that the sim and the database no longer give are dropped first, so a name added during work in progress does not outlive what it named.
func Update ¶
The table old grows into with c: every entry of old keeps its name and meaning, the registered-by lists are regenerated, and each spell, aura, item, enchant and random suffix of c that old does not name gets a new entry. With a pin, the entries of that name's namespace whose game names give the same name are dropped first, so the new-name rules decide what each of their names means again.