gen

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 25 Imported by: 1 module, 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 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

View Source
const MakeCommand = "make siml-names"

The command that regenerates the committed table.

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

View Source
const TablePath = "sim/siml/names.json"

The committed table, relative to the repository's root.

Variables

This section is empty.

Functions

func AppendRecord

func AppendRecord(record []byte, repins []Repin) []byte

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

func Changed(base, now *siml.Names, repinned map[string]bool) []string

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

func FilesUsing(root string, pin Pin) ([]string, error)

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

func GitFile(root, rev, path string) (data []byte, ok bool, err error)

The file at path in commit rev of the checkout at root; ok is false when rev does not hold it.

func IsCheckout

func IsCheckout(root string) bool

Whether root is the top of a git checkout, which a source tarball is not.

func RecordedNames

func RecordedNames(record, base []byte) map[string]bool

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
	// What gear, consumables and preset encounters add to a spec's build beyond what its class registers.
	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 internal cooldown 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

type EnchantRow struct {
	EffectID int32
	Name     string
	Slots    []proto.ItemSlot // In ItemSlot order.
}

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 Item

type Item struct {
	ID    int32
	Name  string
	Level int32 // The item level; 0 when the database states none.
}

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.

func ParsePin

func ParsePin(s string) (Pin, error)

Reads <class>.<namespace>.<name>, shared.<namespace>.<name>, item.<name>, enchant.<name> or suffix.<name>.

func (Pin) String

func (p Pin) String() string

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 internal cooldown trigger.
	ICDSpecs   []string // The specs whose builds list the aura only as an internal cooldown 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

type Repin struct {
	Pin
	Was, Now string
}

A name a repin handed back to the new-name rules: what it meant before, and what it means now.

func (Repin) String

func (r Repin) String() string

The line a repin record holds for r.

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

func Generate(root string, pin *Pin) (*siml.Names, *Report, error)

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

func Update(old *siml.Names, c *Collection, pin *Pin) (*siml.Names, *Report, error)

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.

func (*Report) Write

func (r *Report) Write(w io.Writer, verbose bool)

Writes the report: the entries added, or their count by scope unless verbose; the new class entries a shared name holds the plain name of; the repinned names; the dropped names; the stale pinned names; and what could not be built, or its count unless verbose.

type Suffix

type Suffix struct {
	ID   int32
	Name string
}

Jump to

Keyboard shortcuts

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