database

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 50 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

Index

Constants

View Source
const EndTimeEchoLootString = `` /* 1177-byte string literal not displayed */
View Source
const ListfilePath = "./tools/db2tool/listfile.csv"

ListfilePath is where tools/db2tool caches the community listfile. It maps file data ids to game paths and is a second output contract of the extractor, alongside wowsims.db.

View Source
const MIN_ENCHANT_EFFECT_ID = 0

Enchantment IDs at or below this are not generated.

View Source
const RankLevel = 60
View Source
const TmplStrBuffs = `// Code generated by tools/database/gen_spelldata. DO NOT EDIT.

package buffs

import (
{{- if .NeedsSpells}}
	"time"

{{ end }}
	"github.com/wowsims/forever/sim/core"
{{- if .NeedsEnums}}
	"github.com/wowsims/forever/sim/core/dbcenums"
{{- end}}
	"github.com/wowsims/forever/sim/core/proto"
{{- if .NeedsSpells}}
	"github.com/wowsims/forever/sim/core/spelldata"
{{- end}}
)
` + tmplStrBuffRows + `
func applyGeneratedBuffs(char *core.Character, raid *proto.RaidBuffs, party *proto.PartyBuffs, individual *proto.IndividualBuffs) {
{{- range .Rows}}
{{- if and .Supported .HasApply}}
	if {{.ApplyIf}} {
		{{.ApplyBody}}
	}
{{- end}}
{{- end}}
}
`
View Source
const TmplStrDebuffs = `// Code generated by tools/database/gen_spelldata. DO NOT EDIT.

package buffs

import (
{{- if .NeedsSpells}}
	"time"

{{ end }}
	"github.com/wowsims/forever/sim/core"
{{- if .NeedsEnums}}
	"github.com/wowsims/forever/sim/core/dbcenums"
{{- end}}
	"github.com/wowsims/forever/sim/core/proto"
{{- if .NeedsSpells}}
	"github.com/wowsims/forever/sim/core/spelldata"
{{- end}}
)
` + tmplStrBuffRows + `
// The generated debuffs by the spell they read.
var debuffMetas = map[int32]*Meta{
{{- range .Rows}}
{{- if .Supported}}
	{{.SpellID}}: {{.MetaVar}},
{{- end}}
{{- end}}
}

func applyGeneratedDebuffs(target *core.Unit, debuffs *proto.Debuffs, raid *proto.Raid) {
{{- range .Rows}}
{{- if and .Supported .HasApply}}
	if {{.ApplyIf}} {
		{{.ApplyBody}}
	}
{{- end}}
{{- end}}
}
`
View Source
const TmplStrEnchant = `` /* 3351-byte string literal not displayed */
View Source
const TmplStrMissingEffects = `` /* 1251-byte string literal not displayed */
View Source
const TmplStrOnUse = `` /* 2479-byte string literal not displayed */
View Source
const TmplStrProc = `` /* 5506-byte string literal not displayed */

Variables

View Source
var AtlasLootFactions = map[string]proto.Faction{
	"FACTIONS_CONTENT":       proto.Faction_Unknown,
	"FACTIONS_ALLI_CONTENT":  proto.Faction_Alliance,
	"FACTIONS_HORDE_CONTENT": proto.Faction_Horde,
}
View Source
var ClassBuiltImbues = map[int32]struct{}{

	2892:  {},
	2893:  {},
	6947:  {},
	6949:  {},
	6950:  {},
	8926:  {},
	8927:  {},
	8928:  {},
	8984:  {},
	8985:  {},
	20844: {},
}

Weapon imbues a class builds itself: they ship whatever the imbue builder makes of their rows, and the generated imbue registrations leave them out. Keep these sorted by item ID.

View Source
var ConsumableAllowList = []int32{
	7676,
	9088,
	9155,
	9421,
	13442,
	13452,
	13454,
	12662,
	12217,

	274273,
	274274,
	274275,
	274276,
}

Item Ids of consumables to allow

View Source
var ConsumableDenyList = []int32{

	5265,
	23578,
	23579,
	23794,
	23795,
	23796,

	289082,
	289083,
	289084,
	289086,
	289087,
	289088,
	289321,
	289329,
	289330,
	289334,

	275069,
	277483,
	277493,

	206177,
	210708,
	211815,
	211816,
	211953,
	211954,
	211955,
	211956,
	211957,
	213564,
	215127,
	217308,
	217398,
	217495,
	223913,
	223914,
	227286,
	228978,
	228980,
	232436,
	232438,
	232611,
	238637,
	238638,
	238639,

	289082,
	289083,
	289084,
	289087,
}
View Source
var ConsumableExclusiveGroups = []ConsumableGroup{
	{Group: ElixirGroup(dbcenums.A_MOD_STAT, 0), Items: []int32{
		12451,
	}},
	{Group: ElixirGroup(dbcenums.A_MOD_ATTACK_POWER, 0), Items: []int32{
		12460,
	}},
	{Group: ElixirGroup(dbcenums.A_MOD_DAMAGE_DONE, 1), Items: []int32{
		5206,
	}},
	{Group: ConsumableGroupKey{Key: "Zanza", Name: "Zanza"}, Items: []int32{
		8410,
		8411,
		8412,
		8423,
		8424,
		20079,
	}},
	{Group: ConsumableGroupKey{Key: "Rum", Name: "Rum"}, Items: []int32{
		17048,
		18269,
		18284,
		20709,
		21114,
		21151,
	}},
	{Group: ConsumableGroupKey{Key: "Hit food", Name: "Hit food"}, Items: []int32{
		22237,
		23327,
	}},
}

Exclusive groups the server keeps that the rows do not state: the game files carry no stacking table, the rows group by aura only elixirs and scrolls, and by category only the stat consumables whose category cooldown lasts as long as their buffs. A consumable named here takes this group instead of the one its rows give it.

TODO: check in game whether these stack with the elixir group of the aura they open on, and add each one that does not: Oil of Olaf 1177 (A_MOD_ARMOR_NO_MODS), Call of the Raptor 4546 (A_MOD_STAT Agility), Very Berry Cream 22238 and Midsummer Sausage 23326 (A_MOD_DAMAGE_DONE every school).

View Source
var ConsumableOverrides = []*proto.Consumable{}
View Source
var DatabasePath string
View Source
var DenyListNameRegexes = []*regexp.Regexp{
	regexp.MustCompile(`30 Epic`),
	regexp.MustCompile(`130 Epic`),
	regexp.MustCompile(`63 Blue`),
	regexp.MustCompile(`63 Green`),
	regexp.MustCompile(`66 Epic`),
	regexp.MustCompile(`90 Epic`),
	regexp.MustCompile(`90 Green`),
	regexp.MustCompile(`Boots 1`),
	regexp.MustCompile(`Boots 2`),
	regexp.MustCompile(`Boots 3`),
	regexp.MustCompile(`Bracer 1`),
	regexp.MustCompile(`Bracer 2`),
	regexp.MustCompile(`Bracer 3`),
	regexp.MustCompile(`DB\d`),
	regexp.MustCompile(`DEPRECATED`),
	regexp.MustCompile(`OLD`),
	regexp.MustCompile(`Deprecated`),
	regexp.MustCompile(`Deprecated: Keanna`),
	regexp.MustCompile(`Indalamar`),
	regexp.MustCompile(`Monster -`),
	regexp.MustCompile(`NEW`),
	regexp.MustCompile(`PH`),
	regexp.MustCompile(`QR XXXX`),
	regexp.MustCompile(`TEST`),
	regexp.MustCompile(`Test`),
	regexp.MustCompile(`Enchant Template`),
	regexp.MustCompile(`Deleted`),
	regexp.MustCompile(`DELETED`),
	regexp.MustCompile(`zOLD`),
	regexp.MustCompile(`Archaic Spell`),
	regexp.MustCompile(`Well Repaired`),
	regexp.MustCompile(`Boss X`),
	regexp.MustCompile(`Adventurine`),
	regexp.MustCompile(`Sardonyx`),
	regexp.MustCompile(`Zyanite`),
	regexp.MustCompile(`zzold`),
	regexp.MustCompile(`Tom's`),
	regexp.MustCompile(`Stabilized Eternium Scope`),
	regexp.MustCompile(`\[TMP\]`),
	regexp.MustCompile(`\[DNT\]`),
	regexp.MustCompile(`Placeholder`),
	regexp.MustCompile(` DEP$`),
	regexp.MustCompile(` UNUSED$`),
}

If any of these match the item name, don't include it.

View Source
var EffectFloorExemptions = map[int32]string{
	7284: "Red Whelp Gloves: melee players wear them for the Firebolt proc (EV-0177)",
	9449: "Manual Crowd Pummeler: a level 60 melee swaps it in for its on-use attack speed",
}

Items below core.MinEffectItemLevel whose effects are generated anyway, keyed by item ID with the reason a level 60 character still uses them.

View Source
var EnchantAllowList = []int32{
	804,
	684,
	963,
	1900,
	2564,
	2583,
	2588,
}
View Source
var EnchantDenyList = map[int32]struct{}{}
View Source
var EnchantDenyListItems = map[int32]struct{}{}
View Source
var EnchantDenyListSpells = map[int32]struct{}{}
View Source
var EnchantOverrides = []*proto.UIEnchant{

	{EffectId: 2681, ItemId: 22635, SpellId: 28162, Name: "Savage Guard", Stats: stats.Stats{stats.NatureResistance: 10}.ToProtoArray()},
	{EffectId: 2682, ItemId: 22636, SpellId: 28164, Name: "Ice Guard", Stats: stats.Stats{stats.FrostResistance: 10}.ToProtoArray()},
	{EffectId: 2683, ItemId: 22638, SpellId: 28166, Name: "Shadow Guard", Stats: stats.Stats{stats.ShadowResistance: 10}.ToProtoArray()},
}

Note: EffectId is required for all enchants, because they are used by various importers/exporters Note: ItemId, SpellId and Name are part of the enchant DB key, so they must match the generated enchant or the override is added as a separate entry.

View Source
var EveryClassSpell bool

Set by gen_spelldata -everyClassSpell: roots the store at every spell of a class family as well, for an export of the game files' class spells rather than a store the sim is built against. The export renders no override, area bonus or hand trigger, so it states what the game files state.

View Source
var HolidayConsumables = map[int32]string{
	23211: "Midsummer Fire Festival",
	23326: "Midsummer Fire Festival",
	23327: "Midsummer Fire Festival",
}

Holiday consumables whose item states no RequiredHoliday: the Midsummer Fire Festival food only expires 14 days after it is bought.

View Source
var HolidayNames = map[int]string{
	324: "Hallow's End",
	327: "Lunar Festival",
	335: "Love is in the Air",
}

The world events by the ItemSparse.RequiredHoliday ids the items state.

View Source
var IgnoreMissingEffectBySpellID = map[int]string{
	16372:   "Seal of Ascension - no tooltip and no mechanic",
	1318846: "Eye of the Beast - no tooltip and no mechanic; the item's crit and its on-use are its other two effects",
}

Spells that are flavour rather than mechanics, keyed by spell ID so that reporting them as missing effects can be suppressed without hiding anything real.

Keyed per spell on purpose. The obvious shortcut - treat an effect made only of A_DUMMY auras as noise, which is what MoP does - does not hold in TBC, where A_DUMMY is how a whole class of real item effects is encoded: every relic, idol, libram and totem bonus, plus Zandalarian Hero Medallion, Thick Obsidian Breastplate and Ashtongue Talisman of Zeal. That rule removed 48 entries here and only a handful of them were noise.

View Source
var IgnoreSpellEffectAloneByAuraType = []dbc.EffectAuraType{
	dbcenums.A_MOD_DECREASE_SPEED,
}

Auras the sim has nothing to simulate for, which put a spell out of scope only where they are all it carries: Frostguard's Chilled 16927 slows movement beside a melee slow.

Allows you to ignore certain Spell Effects that the Sim does not support. This prevents them from being added to the missing effects list to prevent confusion towards users. Empty array means ignore all effects of that type, otherwise it will be ignored based on EffectMiscValue_0

View Source
var IgnoreSpellEffectBySpellEffectType = map[dbc.SpellEffectType][]int{
	dbcenums.E_CREATE_ITEM:    {},
	dbcenums.E_SUMMON:         {},
	dbcenums.E_TELEPORT_UNITS: {},
}
View Source
var ItemAllowList = map[int32]struct{}{
	1168:  {},
	2140:  {},
	2505:  {},
	7284:  {},
	8345:  {},
	11815: {},
	18168: {},
	19337: {},
}

Keep these sorted by item ID.

View Source
var ItemDamageByTableAndItemLevel = make(map[string]map[int]dbc.ItemDamageTable)
View Source
var ItemDenyList = map[int32]struct{}{}/* 820 elements not displayed */

Keep these sorted by item ID.

View Source
var ItemOverrides = []*proto.UIItem{
	{
		Id:             22589,
		ClassAllowlist: []proto.Class{proto.Class_ClassMage},
	},
	{
		Id:             22630,
		ClassAllowlist: []proto.Class{proto.Class_ClassWarlock},
	},
	{
		Id:             22631,
		ClassAllowlist: []proto.Class{proto.Class_ClassPriest},
	},
	{
		Id:             22632,
		ClassAllowlist: []proto.Class{proto.Class_ClassDruid},
	},
}

Each Atiesh comes from its own class's quest, and nothing in the game files ties a staff to a class: AllowableClass is -1 on all four, and no spell creates them. The class follows the party aura each one carries.

Each Naxxramas tier 3 armor piece comes from its own class's quest, and the game files open every one to every class: AllowableClass is 32767, or 1535 on Dreadnaught's and most of Bonescythe's. Only the set's ring names the class, so each piece of the set takes it. Keyed by item set id.

View Source
var NotVendorNpcs = map[int32]string{
	230565: "Ironforge Guard",
	230566: "Kor'kron Elite",
}

NPCs QuestieDB lists as vendors that sell nothing in game, keyed by NPC id.

View Source
var OtherItemIdsToFetch = []string{}
View Source
var SharedSpellsIcons = []int32{

	10060,
	16190,
	29166,
	2825,

	17051,

	25898,

	20140,
	8071,

	14767,

	8075,

	20045,

	30808,
	19506,

	12861,
	18696,

	20245,
	5675,
	16206,

	17007,

	8512,
	29193,

	24907,

	3738,
	8227,

	16840,

	8647,

	770,
	702,
	18180,

	12879,
	16862,

	20337,

	3043,

	1490,

	20271,

	11374,
	15235,

	603,
	688,
	691,
	697,
	704,
	706,
	712,
	6117,
	7302,
	8024,
	8033,
	8232,
	9885,
	10538,
	10938,
	10958,
	12470,
	13339,
	13376,
	13889,
	14325,
	17768,
	18803,
	19615,
	20554,
	20572,
	20574,
	20594,
	20597,
	23110,
	23563,
	25076,
	21564,
	25782,
	25894,
	25895,
	25916,
	25918,
	27681,
	27683,
	26654,
	28142,
	28143,
	29414,

	1259686,
	1259688,
	1259705,
	1259719,
	1259799,
	1259812,
	1259813,
	1259817,
	1259821,
	1259823,
	1260198,
	1270842,
	1299026,
}

Raid buffs / debuffs

View Source
var UnsupportedAbsorbBySpellID = map[int32]string{}

Absorbs a server script restricts to spells the game files do not list, keyed by spell ID with the reason the generated file gives.

Functions

func AddConsumableIcons

func AddConsumableIcons(db *WowDatabase, catalogue []dbc.Consumable, instance *dbc.DBC, artPaths map[int]string)

Puts every consumable db.json ships into the item icon table, which is where the UI looks a consumable's icon up: the game files' icon for an item the catalogue or the item table carries, and the icon an override states for one the game files do not ship.

func AddEnchantSources

func AddEnchantSources(enchants map[EnchantDBKey]*proto.UIEnchant, recipes map[EnchantDBKey][]int, inputs ItemSourceInputs)

Sets each enchant's sources to those of its own item and the items that teach it, by their ids in recipes, without repeats. An enchant neither has any source for takes none: the game files hold no trainers, so one a trainer teaches looks the same.

func AddPotionClasses

func AddPotionClasses(db *WowDatabase) error

Lists the classes of each potion, which the settings offer it under and the APL potion placeholders cast it by. A gain of mana, rage or energy the potion builder models is a resource potion, a heal or absorb a defensive one, damage to enemies an offensive one, and the stats it grants of the class the major cooldown manager files the buff under: any armor, avoidance, health or resistance, or Stamina alone, defensive, mana regen alone resource, anything else offensive. A potion with no class fails. Runs after AddUnparsedStats, so the stats against creature types, listed as mob type stats, and the hit and crit percents count.

A miscellaneous consumable is classed the same way, for the settings to split its row. Its Stamina counts as the health it brings, an aura of dodge, parry or block chance or of Defense skill, which the stat parse leaves out, is defensive, and one that the rest leave with no class is offensive.

func AddSourceZonesAndNpcs

func AddSourceZonesAndNpcs(db, from *WowDatabase, areaNames map[int32]string, questie *WowDatabase)

The zones and NPCs the drop sources of from's items and enchants name, each only where db lacks it, so a row db holds stays as it is. A zone takes its AreaTable name and an NPC its QuestieDB row; AtlasLoot's are already in db whole.

func AddUnparsedStats

func AddUnparsedStats(db *WowDatabase) error

Adds to the stats, pseudo stats, mob type stats and zone stats db.json lists for a consumable, which the settings offer and order it by, what its on-use grants that the stat parse leaves out: the stats against creature types as mob type stats under the mob types the aura's mask names (Potion of Demon Slaying 9224's 11406: attack power against Demons), or as plain stats where the mask names none, the hit and crit of one channel (Fire-toasted Bun 23327's 29332: A_MOD_HIT_CHANCE 2 as 2% melee and ranged hit), an all-channel crit (Elixir of the Mongoose 13452's 17538: A_MOD_CRIT_PCT 2 as 2% melee, ranged and spell crit), and a Natural flask's zone bonus as zone stats under naturalFlaskZones, at the rating one percent takes, attack and casting speed as haste.

func AppendQuestieSources

func AppendQuestieSources(db, questie *WowDatabase)

Adds QuestieDB's sources to the items the database has.

func ApplyItemSetClasses

func ApplyItemSetClasses(db *WowDatabase)

Every item of a set in ItemSetClasses gets that class as its whole allowlist. It replaces the list rather than merging, so the ring, which already names the class, does not name it twice.

func ApplyQuestClasses

func ApplyQuestClasses(db *WowDatabase, quests map[int32]*QuestieQuest, items map[int]dbc.Item)

A bind-on-pickup item whose every source is a quest some classes alone may take is open to those classes alone: the game files open the Sunken Temple and Silithus class quests' rewards to every class. An item another source reaches, a craft or a drop, stays open, and one that already has an allowlist keeps it. Quests that together allow every class leave the item open.

func AtlasLootSourcesBeside

func AtlasLootSourcesBeside(existing, atlasLoot []*proto.UIItemSource) []*proto.UIItemSource

AtlasLoot's sources for an item that already holds existing from the game files, less the ones they repeat: the crafting spell both state, and a rep source of the faction the game files name.

func BuildItemNamePostfix

func BuildItemNamePostfix(itemId int, instance *dbc.DBC) string

func CacheBy

func CacheBy[T any, K comparable](items []T, keyFunc func(T) K) map[K]T

func CheckSpellDataFiles

func CheckSpellDataFiles(helper *DBHelper) (stale []string, behind []string, err error)

The committed files that no longer match what the generator writes, for a caller that wants to know rather than to regenerate. Silent on the way there: its output is the lists it returns. behind names the spell data groups recorded on a different game build from the database's. Those are not ported yet, and their files are rendered from the committed inputs.

func ConsumableItemFilter

func ConsumableItemFilter() string

The items the consumable catalogue is built from, over Item as i and ItemSparse as s. Every Consumable-class item but the permanent enhancements of subclass 6, which the enchant table carries; the Trade Goods explosives; and any item whose on-use shares the explosives' category or casts a temporary enchant (Effect 54, or the imbue Effect 360, as IsTemporaryEnchantEffect reads it), whatever class the game files put it under: Crystal Charge 11566 is a Quest item and Lesser Mana Oil 20747 an Enchanting trade good. The item has to state an on-use spell, and one that also teaches a spell is an Engrave rune rather than a consumable. Test, QA, UNUSED, placeholder ([PH]) and deprecated ([DEP]) names are left out: UNUSED Flask of Merciless Pursuit 215126.

func DropListedSetPiecesBesideUnlistedOnes

func DropListedSetPiecesBesideUnlistedOnes(db *WowDatabase, listed map[int32]bool)

Where a set ships a piece its ItemSet row does not list, a piece the row does list for that slot is dropped. The row of each reissued dungeon set 2 lists eight pieces no player wears, beside the pieces players wear, which carry the set's id and are not on its list (EV-0144). A set whose row lists the pieces it ships loses nothing, so this drops nothing once the game files list the worn pieces.

func DropLowerSameNameSets

func DropLowerSameNameSets(db *WowDatabase)

Where two sets with items share a name, a piece of the lower set id ships only when the higher set has no piece of its type, and then joins the higher set and takes the classes its pieces allow; an ItemAllowList item stays. The Classic pieces allow every class, while their quests and the reissued pieces name one. In game a reissued piece counts toward its own set and takes that row's bonuses, never the Classic set's (EV-0144).

func GenerateBulkSimConstantsTSFile

func GenerateBulkSimConstantsTSFile() error

func GenerateBulkSimTuningConstantsTSFile

func GenerateBulkSimTuningConstantsTSFile() error

GenerateBulkSimTuningConstantsTSFile mirrors the Go bulk-sim tuning constants and stage ladder into the wasm bulk path, so browser and backend runs use the same numbers.

func GenerateCharacterConstantsTSFile

func GenerateCharacterConstantsTSFile() error

func GenerateConsumableRegistrations

func GenerateConsumableRegistrations(instance *dbc.DBC, db *WowDatabase, routes map[int]*ConsumableRouting) error

Writes the registration of every consumable a builder in sim/common/shared runs from its rows, one file per family, and each one a builder refuses as a commented-out table entry beneath the reason. The ids are spelled out rather than read from the loaded database, which the browser's sim does not have when the effects register. routes holds the routings gen_db already made, by item id.

func GenerateConsumablesTSFile

func GenerateConsumablesTSFile(db *WowDatabase) error

Writes one named export per consumable db.json ships, carrying its item id, which the presets name consumables by. Names shared by several items all take their item id.

func GenerateEffectsFile

func GenerateEffectsFile(groups []*Group, outFile string, templateString string) error

func GenerateEnchantEffects

func GenerateEnchantEffects(instance *dbc.DBC, db *WowDatabase)

func GenerateItemEffectRandomPropPoints

func GenerateItemEffectRandomPropPoints(instance *dbc.DBC, db *WowDatabase)

func GenerateItemEffects

func GenerateItemEffects(instance *dbc.DBC, db *WowDatabase)

func GenerateMissingEffectsFile

func GenerateMissingEffectsFile(instance *dbc.DBC, db *WowDatabase, generated []GeneratedSet) (KnownRates, UnvalidatedRates, error)

Writes the missing effects file, and returns the gear's settled and unvalidated proc rates for StampProcRates.

func GenerateProtos

func GenerateProtos(dbcData *dbc.DBC, db *WowDatabase, only SpellDataGroups)

Writes the talent protos, TS configs and tree JSON of the classes only takes; the others keep their committed files.

func GenerateSimTablesTSFile

func GenerateSimTablesTSFile() error

Writes the sim's item slot and weapon tables and its melee and ranged distances, which the UI reads.

func GenerateSpellDataFiles

func GenerateSpellDataFiles(helper *DBHelper, unchecked bool, only SpellDataGroups) error

Regenerates every spell data file, once the sim compiles against all of them - or without that check when unchecked is set - and writes the game files rows the store was built from beside them: they are what lets the store be regenerated and checked without the game files database, so they are written from the same pass that wrote it and only once that pass has landed.

func GenerateStatWeightConstantsTSFile

func GenerateStatWeightConstantsTSFile() error

Mirrors the stat weight Target ± constants into the UI, so the EP ± and the stat sweep's Target ± use the sim's numbers.

func GenerateTalentJsonFromDB

func GenerateTalentJsonFromDB(dbHelper *DBHelper, only SpellDataGroups) error

func GetEffectStatString

func GetEffectStatString(itemEffect *proto.ItemEffect) string

func GetIconName

func GetIconName(artPaths map[int]string, fdid int) string

func InferPhases

func InferPhases(db *WowDatabase, inputs PhaseInputs)

Sets the phase of every item and enchant in db, from their sources.

func InferPvpSource

func InferPvpSource(item *proto.UIItem)

Appends a PvpSource after the item's other sources when its name is a PvP name. Items of the same name can share one Sources slice, so the append copies it.

func IsExplosive

func IsExplosive(c *dbc.Consumable, routing *ConsumableRouting) bool

Whether the catalogue's consumable is an explosive, which the explosive picker offers and the explosives builder runs: its on-use shares the explosives' category and its spell routes as damage. Bag of Marbles 1191 shares the category and deals no damage.

func IsPeriodicAura

func IsPeriodicAura(aura dbc.EffectAuraType) bool

func IsThreatEffect

func IsThreatEffect(effect dbc.SpellEffectType) bool

The game files state a flat threat amount on the abilities whose point is threat: Feint and Cower shed it, Distracting Shot adds it. 22 ranked spells across four families carry one.

func IsWeaponDamageEffect

func IsWeaponDamageEffect(effect dbc.SpellEffectType) bool

func ItemEffectIsSupported

func ItemEffectIsSupported(instance *dbc.DBC, effectID int) bool

func KeepConsumable

func KeepConsumable(consumable *proto.Consumable) bool

Whether a consumable in db.json survives the global filters. ConsumableAllowList keeps it, ConsumableDenyList drops it, and so does a test or QA name.

func KeepEnchant

func KeepEnchant(enchant *proto.UIEnchant) bool

Whether an enchant in db.json survives the global filters: a Season of Discovery item, or a deny-list, template, test or QA name drops it.

func LoadAndWriteArmorLocation

func LoadAndWriteArmorLocation(dbHelper *DBHelper, inputsDir string) (map[int]dbc.ArmorLocation, error)

func LoadAndWriteConsumables

func LoadAndWriteConsumables(dbHelper *DBHelper, inputsDir string) ([]dbc.Consumable, error)

func LoadAndWriteDropSources

func LoadAndWriteDropSources(dbHelper *DBHelper, inputsDir string) (
	sourcesByItem map[int][]*proto.DropSource,
	namesByZone map[int]string,
	err error,
)

func LoadAndWriteEnchantDescriptions

func LoadAndWriteEnchantDescriptions(outputPath string, db *WowDatabase, instance *dbc.DBC) error

func LoadAndWriteItemArmorQuality

func LoadAndWriteItemArmorQuality(dbHelper *DBHelper, inputsDir string) (map[int]dbc.ItemArmorQuality, error)

func LoadAndWriteItemArmorShield

func LoadAndWriteItemArmorShield(dbHelper *DBHelper, inputsDir string) (map[int]dbc.ItemArmorShield, error)

func LoadAndWriteItemArmorTotal

func LoadAndWriteItemArmorTotal(dbHelper *DBHelper, inputsDir string) (map[int]dbc.ItemArmorTotal, error)

func LoadAndWriteItemDamageTables

func LoadAndWriteItemDamageTables(dbHelper *DBHelper, inputsDir string) (map[string]map[int]dbc.ItemDamageTable, error)

func LoadAndWriteItemEffects

func LoadAndWriteItemEffects(dbHelper *DBHelper, inputsDir string) ([]dbc.ItemEffect, error)

func LoadAndWriteItemSetSpells

func LoadAndWriteItemSetSpells(dbHelper *DBHelper, inputsDir string) ([]dbc.ItemSetSpell, error)

func LoadAndWriteRandomPropAllocations

func LoadAndWriteRandomPropAllocations(dbHelper *DBHelper, inputsDir string) (map[int32]RandPropAllocationRow, error)

func LoadAndWriteRawEnchants

func LoadAndWriteRawEnchants(dbHelper *DBHelper, inputsDir string) ([]dbc.Enchant, error)

func LoadAndWriteRawItems

func LoadAndWriteRawItems(dbHelper *DBHelper, filter string, inputsDir string) ([]dbc.Item, error)

func LoadAndWriteRawRandomSuffixes

func LoadAndWriteRawRandomSuffixes(dbHelper *DBHelper, inputsDir string) ([]dbc.RandomSuffix, error)

func LoadAndWriteRawSpellEffects

func LoadAndWriteRawSpellEffects(dbHelper *DBHelper, inputsDir string) (map[int]map[int]dbc.SpellEffect, error)

func LoadAndWriteSpells

func LoadAndWriteSpells(dbHelper *DBHelper, inputsDir string) ([]dbc.Spell, error)

func LoadAreaTableNames

func LoadAreaTableNames(dbHelper *DBHelper) (map[int32]string, error)

Every AreaTable id in the game files, with its name.

func LoadArtTexturePaths

func LoadArtTexturePaths(filePath string) (map[int]string, error)

func LoadCraftedItems

func LoadCraftedItems(dbHelper *DBHelper) (
	sourcesByItem map[int][]*proto.CraftedSource,
)

func LoadCreatorClassMasks

func LoadCreatorClassMasks(dbHelper *DBHelper) (map[int]int, error)

The class mask of each soulbound item the game files leave open to every class while only class spells create it, such as the warlock's Firestone and the mage's mana gems: the creating spells' SkillLineAbility class bits, ORed. A soulbound item never leaves the character who made it. A tradable one (Healthstone, Conjured Water, Blinding Powder) stays open to every class.

func LoadDungeonZoneIDs

func LoadDungeonZoneIDs(dbHelper *DBHelper) (map[int32]bool, error)

The dungeons' zones, found the way LoadRaidZoneMaps finds the raids'.

func LoadItemSetListedItems

func LoadItemSetListedItems(dbHelper *DBHelper) (map[int32]bool, error)

The item ids the ItemSet rows list as their sets' pieces.

func LoadItemUpgradePath

func LoadItemUpgradePath(dbHelper *DBHelper) (upgradePath map[int][]int, err error)

func LoadRaidZoneMaps

func LoadRaidZoneMaps(dbHelper *DBHelper) (map[int32]int32, error)

The raid map of each raid zone. A raid zone is the zone a Map with InstanceType 2 names in AreaTableID, or an area whose ContinentID is such a Map. The first path finds each vanilla raid, Onyxia's Lair included, whose ContinentID is Kalimdor. The second adds the raids' sub-areas, such as Zul'Gurub's and Ruins of Ahn'Qiraj's, and the raid maps that leave AreaTableID 0.

func LoadRepItems

func LoadRepItems(dbHelper *DBHelper) (
	sourcesByItem map[int][]*proto.RepSource,
	factionNames map[int32]string,
	err error,
)

The items whose ItemSparse row asks for a standing with a faction, and the names of those factions.

func LoadRows

func LoadRows[T any](db *sql.DB, query string, scanFunc func(*sql.Rows) (T, error), args ...any) ([]T, error)

func LoadSpellIcons

func LoadSpellIcons(dbHelper *DBHelper) (map[int]SpellIcon, error)

func LoadSpellReagents

func LoadSpellReagents(dbHelper *DBHelper) (map[int32][]int32, error)

The reagent items of each spell, read as the spell store reads them.

func LoadSpellRecipes

func LoadSpellRecipes(dbHelper *DBHelper) (map[int32][]int32, error)

The shipped items that teach each spell.

func LoadZoneAreas

func LoadZoneAreas(db *WowDatabase, dbHelper *DBHelper) error

Adds each zone's kinds of area from AreaGroupMember. A repeated name folds into the zone already listed.

func MaxedTalentsString

func MaxedTalentsString(tabs []TalentTabConfig) string

MaxedTalentsString is the talents string with every talent at its maximum, in the form the UI parses (ui/sim/talents/talents_string.ts, serializeTalentsString): one digit per talent in tree order, trees joined by "-", trailing zeros and dashes dropped.

func ParseDungeonDifficulty

func ParseDungeonDifficulty(isRaid bool) proto.DungeonDifficulty

func ParseRandomSuffixOptions

func ParseRandomSuffixOptions(optionsString sql.NullString) ([]int32, error)

func ParseTooltipForMissingEffect

func ParseTooltipForMissingEffect(parsed *proto.UIItem, itemEffect *proto.ItemEffect, instance *dbc.DBC, groupMap map[string]Group, groupMapName string)

func PhaseSources

func PhaseSources(inputs ItemSourceInputs) map[int32][]*proto.UIItemSource

Every source the game files, AtlasLoot and QuestieDB give each item. QuestieDB's drops beside an AtlasLoot drop count here: Blood of the Mountain, a reagent the database does not hold, is a Molten Core drop in AtlasLoot and a world drop in QuestieDB.

func PruneQuestieSources

func PruneQuestieSources(questie *WowDatabase, raidZones, dungeonZones map[int32]bool, areaNames map[int32]string)

Removes the vendors and drops with no zone or a zone that is not in the game files, and sets each drop's difficulty from its zone, which stays unknown in the open world. A world drop names neither an NPC nor a zone.

func ReadQuestieQuests

func ReadQuestieQuests(path string) map[int32]*QuestieQuest

func RenderBuffsDebuffsTS

func RenderBuffsDebuffsTS(rows []ResolvedBuff) ([]byte, error)

RenderBuffsDebuffsTS renders one input per resolved row that has one, plus the four registries the settings tab reads.

func RequireCommittedHotfixes

func RequireCommittedHotfixes(helper *DBHelper, only SpellDataGroups) error

Refuses the database when the committed inputs hold later hotfixes for a group only takes on the same game build.

func RequireSpellCastTimes

func RequireSpellCastTimes(helper *DBHelper) error

func RunOverrides

func RunOverrides(dbHelper *DBHelper, overridesFolder string) error

func ScanArmorLocation

func ScanArmorLocation(rows *sql.Rows) (dbc.ArmorLocation, error)

func ScanConsumable

func ScanConsumable(rows *sql.Rows) (dbc.Consumable, error)

func ScanCraftedItems

func ScanCraftedItems(rows *sql.Rows) (itemID int, ds *proto.CraftedSource, err error)

func ScanDropRow

func ScanDropRow(rows *sql.Rows) (itemID int, ds *proto.DropSource, instanceName string, err error)

func ScanEnchantsTable

func ScanEnchantsTable(rows *sql.Rows) (dbc.Enchant, error)

func ScanItemArmorQualityTable

func ScanItemArmorQualityTable(rows *sql.Rows) (dbc.ItemArmorQuality, error)

func ScanItemArmorShieldTable

func ScanItemArmorShieldTable(rows *sql.Rows) (dbc.ItemArmorShield, error)

func ScanItemArmorTotalTable

func ScanItemArmorTotalTable(rows *sql.Rows) (dbc.ItemArmorTotal, error)

func ScanItemDamageTable

func ScanItemDamageTable(rows *sql.Rows) (dbc.ItemDamageTable, error)

ItemDamage tables

func ScanItemEffect

func ScanItemEffect(rows *sql.Rows) (dbc.ItemEffect, error)

func ScanItemSetSpell

func ScanItemSetSpell(rows *sql.Rows) (dbc.ItemSetSpell, error)

func ScanItemUpgradePath

func ScanItemUpgradePath(rows *sql.Rows) (UpgradeID int, upgradePathID int, ilvl int, err error)

func ScanRawItemData

func ScanRawItemData(rows *sql.Rows) (dbc.Item, error)

func ScanRepItems

func ScanRepItems(rows *sql.Rows) (itemID int, factionName string, ds *proto.RepSource, err error)

func ScanSpellEffect

func ScanSpellEffect(rows *sql.Rows) (dbc.SpellEffect, error)

func ScanSpells

func ScanSpells(rows *sql.Rows) (dbc.Spell, error)

func ShippedConsumable

func ShippedConsumable(c *dbc.Consumable, routing *ConsumableRouting, instance *dbc.DBC) *proto.Consumable

The catalogue's consumable as db.json carries it, typed an explosive where IsExplosive says so, with its exclusive group.

func ShipsConsumable

func ShipsConsumable(routing *ConsumableRouting) bool

Whether the catalogue's consumable goes into db.json: its spell routes to a shape, or ConsumableAllowList, ClassBuiltImbues or ConsumableOverrides names it. KeepConsumable runs after.

func SimItemFilter

func SimItemFilter(maxLevel int32) string

The gear the sim ships: weapons, armour and relics of a quality the game hands out, at or below the level the sim plays. RequiredLevel 0 means "no level requirement", so <= keeps those. Written here rather than at the call site because the spell data store selects the item procs it carries through the same predicate.

func SpellHasDummyEffect

func SpellHasDummyEffect(spellId int, instance *dbc.DBC) bool

func SpellHasTriggerEffect

func SpellHasTriggerEffect(spellId int, instance *dbc.DBC) bool

func SpellUsesStacks

func SpellUsesStacks(spellId int, instance *dbc.DBC) bool

func StampProcRates

func StampProcRates(db *WowDatabase, known KnownRates, unvalidated UnvalidatedRates)

Sets the proc rate the gear tab shows on each item, enchant and set bonus, settled or unvalidated. An enchant's rate goes on every enchant sharing its effect id. The rates are for display only: the sim rolls the rates on the effects.

func StoreMissingEffect

func StoreMissingEffect(effectType string, name string, variant Variant)

func TryParseEnchantEffect

func TryParseEnchantEffect(enchant *proto.UIEnchant, slots []dbc.EnchantProcSlot, groupMapProc map[string]Group, instance *dbc.DBC, enchantSpellEffects map[int]*dbc.SpellEffect)

func UpdateItemFirstSeen

func UpdateItemFirstSeen(path string, items map[int32]*proto.UIItem, now int64)

Stamps the items the file does not hold yet with now and writes the file back.

func WriteQuestieQuests

func WriteQuestieQuests(path string, quests map[int32]*QuestieQuest)

Writes quests one per line, by id.

Types

type BlizzardAuthResponse

type BlizzardAuthResponse struct {
	AccessToken string `json:"access_token"`
}

type BlizzardItemResponse

type BlizzardItemResponse struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	Quality struct {
		Type string `json:"type"`
	} `json:"quality"`

	ItemClass struct {
		Id int `json:"id"`
	} `json:"item_class"`

	ItemSubclass struct {
		Id int `json:"id"`
	} `json:"item_subclass"`

	InventoryType struct {
		Type string `json:"type"`
	} `json:"inventory_type"`

	PreviewItem struct {
		Armor struct {
			Value int `json:"value"`
		} `json:"armor"`

		Stats []struct {
			Type struct {
				Type string `json:"type"`
			} `json:"type"`
			Value int `json:"value"`
		} `json:"stats"`
	} `json:"preview_item"`
}

There are more fields, these are just the ones we care about

func (BlizzardItemResponse) GetStatValue

func (item BlizzardItemResponse) GetStatValue(statType string) int

type ClassData

type ClassData struct {
	ClassName          string
	LowerCaseClassName string
	FileName           string
	Talents            []TalentConfig
	TalentTabs         []TalentTabConfig
}

type ConsumableGroup

type ConsumableGroup struct {
	Group ConsumableGroupKey
	Items []int32
}

An exclusive group the rows do not state: a row group the items join, or one of their own.

type ConsumableGroupKey

type ConsumableGroupKey struct {
	Key  string
	Name string
}

func ElixirGroup

func ElixirGroup(aura dbcenums.EffectAuraType, misc int) ConsumableGroupKey

The group of the elixirs and scrolls whose on-use spell's first aura is the aura type with the misc value.

type ConsumableKind

type ConsumableKind string

The shape a consumable's on-use spell is built in. Damage and heals are routed the way an item's on-use is, and have builders; the other shapes name the builder a consumable of that kind needs.

const (
	ConsumableDamage           ConsumableKind = "damage"
	ConsumableHeal             ConsumableKind = "heal"
	ConsumableEnergize         ConsumableKind = "energize"
	ConsumableStatAura         ConsumableKind = "stat aura"
	ConsumablePercentStat      ConsumableKind = "percent stat"
	ConsumableTemporaryEnchant ConsumableKind = "temporary enchant"
	ConsumableAbsorb           ConsumableKind = "absorb"
)

type ConsumableRouting

type ConsumableRouting struct {
	ItemID  int
	SpellID int32
	// Empty when no shape fits the spell.
	Kind        ConsumableKind
	Unsupported []string
}

func RouteConsumable

func RouteConsumable(c *dbc.Consumable, instance *dbc.DBC) *ConsumableRouting

Routes the spell the consumable's first on-use row casts: as damage, a heal or an absorb where the on-use routing takes it, as damage where its missile leaves a cloud that deals it (shared.DamageCloudOf), and otherwise by the first of its effects, or of the spells it triggers on the user, that fits a consumable shape. A heal, an absorb or a gain of a resource is supported only where the potion builder runs the spell.

func (*ConsumableRouting) Reason

func (r *ConsumableRouting) Reason() string

func (*ConsumableRouting) Supported

func (r *ConsumableRouting) Supported() bool

type DBHelper

type DBHelper struct {
	// contains filtered or unexported fields
}

func NewDBHelper

func NewDBHelper() (*DBHelper, error)

func (*DBHelper) Close

func (d *DBHelper) Close() error

type EffectParseResult

type EffectParseResult byte
const (
	EffectParseResultInvalid     EffectParseResult = iota // Returned when the effect is invalid for the current parameters
	EffectParseResultUnsupported                          // Returned when the effect could be parsed but is not supported for effect generation
	EffectParseResultSuccess                              // Returned when the effect was parsed successfuly
	EffectParseResultRefused                              // Returned when the effect was parsed, is not supported, and said so in an entry of its own
)

func TryParseEquipAuraEffect

func TryParseEquipAuraEffect(parsed *proto.UIItem, itemEffect *proto.ItemEffect, instance *dbc.DBC, groupMapProc map[string]Group) EffectParseResult

An equip spell with no stats that applies an aura the stat path cannot state, read from the row it keeps up. One the rows cannot build is refused in an entry of its own, with the reasons.

func TryParseOnUseEffect

func TryParseOnUseEffect(parsed *proto.UIItem, itemEffect *proto.ItemEffect, instance *dbc.DBC, groupMap map[string]Group) EffectParseResult

func TryParseProcEffect

func TryParseProcEffect(parsed *proto.UIItem, itemEffect *proto.ItemEffect, instance *dbc.DBC, groupMapProc map[string]Group) EffectParseResult

type EnchantDBKey

type EnchantDBKey struct {
	EffectID   int32
	ItemID     int32
	SpellID    int32
	EffectName string
}

func EnchantToDBKey

func EnchantToDBKey(enchant *proto.UIEnchant) EnchantDBKey

type Entry

type Entry struct {
	Variants  []*Variant
	Tooltip   []string
	ProcInfo  ProcInfo
	Supported bool
	// What adds a stack while the window is open, for the trinkets whose effect carries a
	// separate accumulating aura. Nil for everything else.
	StackProcInfo *ProcInfo
	// Set for an on-use whose window accumulates a separate aura, which needs the stacking
	// helper rather than the flat one. Carries what that helper cannot read from the database.
	StackingOnUse *StackingOnUse
	// Set for effects an ignore list deliberately excludes. These emit a comment only, so that
	// skipping them is visible in the generated file rather than silent.
	Skipped bool
	// Set when the proc is resolved from the game files' own rows at run time, which is every proc
	// but the two shapes that need more than the rows state: a window that accumulates a second
	// aura, and an effect a hand-written constructor already covers.
	Proc *ProcRouting
	// What a registered on-use leaves out, stated beside its call.
	NotSimulated string
}

func (*Entry) AddVariant

func (entry *Entry) AddVariant(variant *Variant)

type GeneratedSet

type GeneratedSet struct {
	ID         int32
	Name       string
	Slots      []proto.ItemSlot
	Profession proto.Profession    // The profession the ItemSet row gates the bonuses on, if any.
	Bonuses    []GeneratedSetBonus // In piece count order.
}

A set no hand-written set covers, as gen_db writes it.

func GenerateSetBonuses

func GenerateSetBonuses(instance *dbc.DBC, db *WowDatabase) ([]GeneratedSet, error)

Writes the sets no hand-written set covers, and answers them for the missing-effects list. gen_db runs it before anything calls RegisterAllSetBonuses, so the registered sets are the hand-written ones.

func (GeneratedSet) Registers

func (set GeneratedSet) Registers() bool

Whether the set registers any of its bonuses.

type GeneratedSetBonus

type GeneratedSetBonus struct {
	Pieces      int32
	Spells      []int32
	Tooltips    []string   // One per spell.
	Unsupported [][]string // One per spell, empty where the row registers.
}

A piece count of a generated set: the rows the game files grant at it, and what keeps each from registering.

func (GeneratedSetBonus) Supported

func (bonus GeneratedSetBonus) Supported() bool

Whether every row of the bonus registers, which is when the bonus does.

type Group

type Group struct {
	Name    string
	Entries []*Entry
}

Group holds a category of effects.

type HandProc

type HandProc struct {
	SpellID int32
	Row     KnownRate // The rate the row states, none where it states none.
}

A proc row of hand-written gear.

type ItemFirstSeen

type ItemFirstSeen struct {
	ID        int32 `json:"id"`
	FirstSeen int64 `json:"firstSeen"` // Unix seconds of the gen_db run that first saw the item.
}

func StampItemFirstSeen

func StampItemFirstSeen(known []ItemFirstSeen, items map[int32]*proto.UIItem, now int64) []ItemFirstSeen

Every known entry stays, the ids of items no longer in the database too, so an item that returns keeps its first sighting and the file only ever gains lines.

type ItemSourceInputs

type ItemSourceInputs struct {
	Crafted map[int][]*proto.CraftedSource
	Rep     map[int][]*proto.RepSource
	Atlas   *WowDatabase
	Questie *WowDatabase
}

What says where an item comes from, keyed by item id. Atlas and Questie are the pruned inputs.

type KnownRate

type KnownRate struct {
	ID     int32 // The item id, the enchant effect id or the set id.
	Pieces int32 // The set bonus's piece count; 0 on an item or an enchant.
	Kind   overrides.RateKind
	Rate   float64              // Procs per minute for a ppm, a percent from 0 to 100 for a chance.
	Status proto.ProcRateStatus // Measured for a rate an evidence id settles, GameFiles for one a row states.
}

A settled proc rate the sim uses on a piece of gear.

type KnownRates

type KnownRates struct {
	Items      []KnownRate
	Enchants   []KnownRate
	SetBonuses []KnownRate
}

type LiveProcs

type LiveProcs struct {
	Count    int  // How many register.
	RowBuilt bool // Whether every one resolves its rate from the rows at run time, where a rate override on the row reaches it.
}

The generated procs of one item or enchant that register.

type MissingItemEffect

type MissingItemEffect struct {
	ItemID  int32
	Name    string
	Effects []Variant
}

type MissingSetBonus

type MissingSetBonus struct {
	ID       int32 // The set id.
	Pieces   int32
	Name     string
	Spells   []int32
	Tooltips []string // One per spell.
}

A set bonus the game files grant at a piece count the sim registers no effect for.

type PhaseInputs

type PhaseInputs struct {
	Sources        map[int32][]*proto.UIItemSource // Every source the inputs give each item, the ones the database does not show included.
	Reagents       map[int32][]int32               // The reagent items of each spell.
	Recipes        map[int32][]int32               // The items that teach each spell.
	EnchantRecipes map[EnchantDBKey][]int          // The items that teach each enchant.
	Quests         map[int32]*QuestieQuest         // The reward quests by id.
	RaidMaps       map[int32]int32                 // The raid map of each raid zone.
}

What InferPhases reads besides the database's items.

type ProcInfo

type ProcInfo struct {
	Outcome             core.HitOutcome
	Callback            core.AuraCallback
	ProcMask            core.ProcMask
	MaxCumulativeStacks int32
	RequireDamageDealt  bool
	ClassSpellsOnly     bool
	// See core.ProcTrigger.
	RequireDamageComponent bool
	// The listener's Can Proc From Procs attribute: it also hears hits from proc spells.
	CanProcFromProcs bool
	// A "Chance on hit" item effect or a combat enchant, cast by the game off every eligible
	// weapon hit regardless of proc flags. Decided by the trigger type, not by the item slot.
	IsWeaponProc bool
	// An aura proc carrying Aura Is Weapon Proc, which skips hits that suppress weapon procs.
	HonoursWeaponProcSuppression bool
}

func BuildProcInfo

func BuildProcInfo(parsed *proto.UIItem, itemEffectID int, instance *dbc.DBC, tooltip string) (ProcInfo, bool)

func BuildSpellProcInfo

func BuildSpellProcInfo(procSpell *dbc.Spell, tooltip string, itemType proto.ItemType) (ProcInfo, bool)

type ProcRouting

type ProcRouting struct {
	TriggerSpellID int
	// Zero where the trigger's own row is the buff.
	BuffSpellID int
	// A "Chance on hit" item effect or a combat enchant, cast by the game off every eligible weapon
	// hit whatever the row's proc flags say.
	IsWeaponProc bool
	// A weapon's own procs-per-minute rate, stated on its item effect; zero where the rows state one.
	ItemPPM float64
	Shape   ProcShape
	// Empty when the rows state enough to build the listener.
	Unsupported []string
	// What the rows resolve to, for the reader of the generated file.
	Summary string
}

The two spells an item or enchant proc is resolved from at run time, and what the rows say the sim cannot model. The reasons are the ones sim/core/spelldata answers, so the registration the generator writes and the listener the sim builds come from the same reading.

func (*ProcRouting) OnUseConstructor

func (r *ProcRouting) OnUseConstructor() string

The constructor an on-use routed from its spell registers through. A refused one that is neither damage nor a heal names the stat constructor in its commented call.

func (*ProcRouting) ProcConstructor

func (r *ProcRouting) ProcConstructor() string

The constructor an item or enchant proc registers through.

func (*ProcRouting) Reason

func (r *ProcRouting) Reason() string

Renders the reasons as the generated file states them, one clause per shape.

func (*ProcRouting) Supported

func (r *ProcRouting) Supported() bool

type ProcShape

type ProcShape uint8
const (
	// A buff granting stats, or on an on-use none of the shapes below.
	ShapeStats ProcShape = iota
	// Deals damage instead of granting an aura: there is no buff to build.
	ShapeDamage
	// Heals the wearer.
	ShapeHeal
	// Shields the wearer with an absorb.
	ShapeAbsorb
	// An on-use that raises the wearer's speeds.
	ShapeSpeed
	// Restores the wearer's mana, rage or energy.
	ShapeEnergize
	// Puts a debuff on the enemy it lands on.
	ShapeDebuff
	// Applies auras on the wearer, its pets or an enemy.
	ShapeAura
	// An equip spell's auras, kept up for as long as the item is worn rather than applied by a proc.
	ShapeEquip
	// Grants the wearer extra attacks: main-hand swings under the granting spell's name.
	ShapeExtraAttack
	// An on-use aura on the wearer that casts area damage on every enemy each period.
	ShapePeriodicDamage
)

type QuestieQuest

type QuestieQuest struct {
	Zone    int32   `json:"zone,omitempty"`    // An AreaTable id; a negative QuestSort id for a quest sorted by theme.
	Items   []int32 `json:"items,omitempty"`   // The objectives' items, then the items it needs that are no objective.
	Classes int32   `json:"classes,omitempty"` // The game's class bits; 0 is every class.
}

A reward quest's zone and the items it asks for, which decide the phase of the items it rewards, and the classes that may take it.

type RandPropAllocationRow

type RandPropAllocationRow struct {
	Ilvl       int32
	Allocation dbc.RandomPropAllocation
}

RandPropPoints TBC ANNI: This table exists and contains data, so removing it seems bad, BUT item stats do not match MoP+. Stats come from two places - ItemSparse inside of StatModifier, and ItemEffect as Static (effectDuration = -1) and Proc/On-Use (effectDuration > 0)

func ScanRandPropAllocationRow

func ScanRandPropAllocationRow(rows *sql.Rows) (RandPropAllocationRow, error)

type RawTalent

type RawTalent struct {
	DefinitionID   int
	TierID         int
	TalentName     string
	ColumnIndex    int
	ClassMask      int
	SpellID        int
	MaxRanks       int
	SpellRank      string
	PrereqRank     string
	PrereqTalent   string
	TabName        string
	BackgroundFile string
	PrereqRow      sql.NullInt64
	PrereqCol      sql.NullInt64
}

func LoadTalents

func LoadTalents(dbHelper *DBHelper) ([]RawTalent, error)

func LoadTraitTalents

func LoadTraitTalents(dbHelper *DBHelper) ([]RawTalent, error)

LoadTraitTalents reads the class trees out of the Trait* tables and returns them as RawTalent rows, so the proto/json generators keep working unchanged.

func ScanTalent

func ScanTalent(rows *sql.Rows) (RawTalent, error)

type ResolvedBuff

type ResolvedBuff struct {
	buffmanifest.BuffSpec

	Scope buffmanifest.BuffScope
	Go    string // identifier stem: "BattleShout"
	Proto buffmanifest.BuffProtoType
	// Kind is the manifest's, or a damage shield where the spell states one.
	Kind buffmanifest.BuffKind

	// Name is the game files' name for the spell the player learns, and AuraName the aura's where the
	// manifest names a cast beside it. Both are "" for a spell no class family files, which is also
	// when Owner is the manifest's rather than the family's.
	Name     string
	AuraName string
	Owner    proto.Class

	SpellID     int32 // the spell the aura's numbers are read from
	CastSpellID int32 // the cast, where the manifest pins one; SpellID otherwise
	DurationMs  int32 // -1 or 0 never expires
	CooldownMs  int32 // 0 when the game files state none; read from the cast
	Totem       bool  // the cast summons into a totem slot, so the owner's true pets stand under it too

	// Spell is the row the store carries for SpellID, built from the same
	// captured game files rows the store is rendered from.
	Spell *spelldata.Spell
	// ScopeSpell is the row whose targeting states who the aura reaches: Spell, or the group spell a
	// raid input stands for.
	ScopeSpell *spelldata.Spell

	// A rank select's states, in the order the proto field counts them from 1.
	RankStates []rankState

	// SkipAuraTypes are the auras the row states at 0 beside the buff, which the parse leaves out.
	SkipAuraTypes []dbcenums.EffectAuraType
	// FullComboPoints says a debuff's amount is stated per combo point, and the
	// raid config's copy is the finisher at full combo points.
	FullComboPoints bool

	// Applied is what the parse attaches for the row, and LeftOut the aura
	// effects it leaves out, one note each.
	Applied []spelldata.Applied
	LeftOut []string

	// TalentRanks is how many points the improving talent takes, 0 for a row
	// no talent prices.
	TalentRanks          int32
	TalentScalesDuration bool

	// TalentSpellID is the spell of the trait node that prices the improvement,
	// which is the icon the UI shows for the improved state. TalentPosition is
	// the effect of that spell the improvement is read from, counted the way
	// EffectN counts.
	TalentSpellID  int32
	TalentPosition int32
	// TalentDivisor prices a row whose talent states its effect only in its tooltip, as
	// ${$m1/-N*$<SpellID>m1}: rank m1 of N is worth m1/N of every amount the spell attaches. A row
	// whose own tooltip shows the talent's $<Talent>s1 takes the node's ranks as N. 0 for a talent
	// priced by a spell modifier.
	TalentDivisor int32

	ScopeFromClient buffmanifest.BuffScope

	DBName string

	Supported bool
	Reason    string
	Warnings  []string
}

ResolvedBuff is one manifest row plus everything the database states about it.

type SpellDataGroups

type SpellDataGroups map[string]bool

The groups a run takes from the game files database. Nil means every group: a full regeneration.

func ParseSpellDataGroups

func ParseSpellDataGroups(classes string, racials, shared bool) (SpellDataGroups, error)

The groups -classes, -racials and -shared name, plus items, which every run takes. classes is a comma-separated list of class package names, "all" or "none". With no flag set (shared stays true) it returns nil, the default selection.

func ResolveSpellDataGroups

func ResolveSpellDataGroups(helper *DBHelper, classes string, racials, shared bool) (SpellDataGroups, []string, error)

The groups a run takes: the ones -classes, -racials and -shared name, or the default groups when none is set, with a line for each group the default leaves on its committed build.

func (SpellDataGroups) Takes

func (only SpellDataGroups) Takes(group string) bool

type SpellIcon

type SpellIcon struct {
	SpellID int
	FDID    int
	HasBuff bool
	Name    string
	Rank    int
}

func ScanSpellIcon

func ScanSpellIcon(rows *sql.Rows) (SpellIcon, error)

type StackingOnUse

type StackingOnUse struct {
	Name       string
	CooldownMs int32
}

The literals a stacking on-use needs in the generated call. Everything else - stacks, per-stack stats, which aura is which - the helper reads from the database at runtime.

type TalentConfig

type TalentConfig struct {
	FieldName        string          `json:"fieldName"`
	FancyName        string          `json:"fancyName"`
	Location         TalentLocation  `json:"location"`
	SpellID          int             `json:"spellId"`
	DefinitionID     int             `json:"definitionId,omitempty"`
	MaxPoints        int             `json:"maxPoints"`
	PrereqLocation   *TalentLocation `json:"prereqLocation,omitempty"`
	TabName          string          `json:"tabName"`
	ProtoFieldNumber int
}

type TalentLocation

type TalentLocation struct {
	RowIdx int `json:"rowIdx"`
	ColIdx int `json:"colIdx"`
}

type TalentTabConfig

type TalentTabConfig struct {
	Name          string         `json:"name"`
	BackgroundUrl string         `json:"backgroundUrl"`
	Talents       []TalentConfig `json:"talents"`
}

type TooltipManager

type TooltipManager struct {
	FilePath   string
	UrlPattern string
}

Generic class for fetching tooltip info from the web.

func (*TooltipManager) Fetch

func (tm *TooltipManager) Fetch(minId, maxId int32, otherIds []string)

func (*TooltipManager) FetchFromWeb

func (tm *TooltipManager) FetchFromWeb(idsToFetch []string) map[string]string

func (*TooltipManager) Read

func (tm *TooltipManager) Read() map[int32]string

type UnvalidatedRate

type UnvalidatedRate struct {
	ID     int32 // The item id, the enchant effect id or the set id.
	Pieces int32 // The set bonus's piece count; 0 on an item or an enchant.
	Name   string
	Kind   overrides.RateKind
	Rate   float64 // What the sim uses: procs per minute for a ppm, a percent from 0 to 100 for a chance; 0 where no single rate applies.
	Origin string  // "vanilla", "tbc" or "observed".
}

A proc rate on gear that the game files do not state and no measurement on Forever has settled.

type UnvalidatedRates

type UnvalidatedRates struct {
	Items      []UnvalidatedRate
	Enchants   []UnvalidatedRate
	SetBonuses []UnvalidatedRate
}

type Variant

type Variant struct {
	ID      int
	SpellID int
	Name    string
}

Entry represents a effect with its Item ID, Spell ID and display name.

type WowDatabase

type WowDatabase struct {
	Items          map[int32]*proto.UIItem
	RandomSuffixes map[int32]*proto.ItemRandomSuffix
	Enchants       map[EnchantDBKey]*proto.UIEnchant

	Zones    map[int32]*proto.UIZone
	Npcs     map[int32]*proto.UINPC
	Factions map[int32]*proto.UIFaction

	ItemIcons                map[int32]*proto.IconData
	SpellIcons               map[int32]*proto.IconData
	ItemEffectRandPropPoints map[int32]*proto.ItemEffectRandPropPoints

	Encounters []*proto.PresetEncounter

	Consumables map[int32]*proto.Consumable
	Effects     map[int32]*proto.SpellEffect

	SetBonusProcRates []*proto.SetBonusProcRate
}

func NewWowDatabase

func NewWowDatabase() *WowDatabase

func ReadAtlasLootData

func ReadAtlasLootData(dbHelper *DBHelper) *WowDatabase

func ReadDatabaseFromJson

func ReadDatabaseFromJson(jsonStr string) *WowDatabase

func ReadQuestieData

func ReadQuestieData() (*WowDatabase, map[int32]*QuestieQuest)

Every item QuestieDB lists a reward quest, a vendor or a dropping NPC for, as Quest, SoldBy and Drop sources, with the NPCs of the listed drops in Npcs, and each of those reward quests by id.

func (*WowDatabase) AddItemIcon

func (db *WowDatabase) AddItemIcon(id int32, icon string, name string)

func (*WowDatabase) AddSpellIcon

func (db *WowDatabase) AddSpellIcon(id int32, icon string, name string)

func (*WowDatabase) Clone

func (db *WowDatabase) Clone() *WowDatabase

func (*WowDatabase) MergeConsumable

func (db *WowDatabase) MergeConsumable(src *proto.Consumable)

func (*WowDatabase) MergeEffect

func (db *WowDatabase) MergeEffect(src *proto.SpellEffect)

func (*WowDatabase) MergeEnchant

func (db *WowDatabase) MergeEnchant(src *proto.UIEnchant)

func (*WowDatabase) MergeEnchants

func (db *WowDatabase) MergeEnchants(arr []*proto.UIEnchant)

func (*WowDatabase) MergeFaction

func (db *WowDatabase) MergeFaction(src *proto.UIFaction)

func (*WowDatabase) MergeItem

func (db *WowDatabase) MergeItem(src *proto.UIItem)

func (*WowDatabase) MergeItems

func (db *WowDatabase) MergeItems(arr []*proto.UIItem)

func (*WowDatabase) MergeNpc

func (db *WowDatabase) MergeNpc(src *proto.UINPC)

func (*WowDatabase) MergeNpcs

func (db *WowDatabase) MergeNpcs(arr []*proto.UINPC)

func (*WowDatabase) MergeZone

func (db *WowDatabase) MergeZone(src *proto.UIZone)

func (*WowDatabase) MergeZones

func (db *WowDatabase) MergeZones(arr []*proto.UIZone)

func (*WowDatabase) ToUIProto

func (db *WowDatabase) ToUIProto() *proto.UIDatabase

func (*WowDatabase) WriteBinary

func (db *WowDatabase) WriteBinary(binFilePath string)

func (*WowDatabase) WriteBinaryAndJson

func (db *WowDatabase) WriteBinaryAndJson(binFilePath, jsonFilePath string)

func (*WowDatabase) WriteJson

func (db *WowDatabase) WriteJson(jsonFilePath string)

Directories

Path Synopsis
Package buffmanifest is the checked-in manifest of every raid, party, individual and enemy-debuff proto field the sim knows about.
Package buffmanifest is the checked-in manifest of every raid, party, individual and enemy-debuff proto field the sim knows about.
Regenerates the spell store, sim/<class>/spell_data_auto_gen.go, the hunter's pet_families_auto_gen.go and ammo_auto_gen.go, and the raid buffs from the game files database.
Regenerates the spell store, sim/<class>/spell_data_auto_gen.go, the hunter's pet_families_auto_gen.go and ammo_auto_gen.go, and the raid buffs from the game files database.
Package overrides holds the numbers the spelldata store carries that the game files do not state.
Package overrides holds the numbers the spelldata store carries that the game files do not state.

Jump to

Keyboard shortcuts

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