Commit graph

2 commits

Author SHA1 Message Date
Kelsi
48ca202716 feat(editor): add WSTM JSON round-trip (--export/--import-wstm-json)
Closes the editing loop on the stat-modifier-curve catalog: dump
a .wstm to JSON, hand-edit baseValue / perLevelDelta /
multiplier / level range / curveKind (e.g. retune SpellCrit base
from 1%% to 1.5%% for a higher-magic server, halve the
ManaPerSpirit slope by setting multiplier=0.5, restrict an armor
curve to lvl 60+ only by raising minLevel), re-import to a
byte-identical binary.

curveKind dual-encoded: int 0..6 OR human-readable name ("crit"
/ "hit" / "power" / "regen" / "resist" / "mitigation" / "misc").
Float fields (baseValue, perLevelDelta, multiplier) round-trip
through JSON's native number type — IEEE 754 single precision
preserves exactly.

Verified byte-identical round-trip on all three presets
(crit / regen / armor). CLI flag count 1081 -> 1083.
2026-05-10 00:07:23 -07:00
Kelsi
9a85cc029e feat(editor): add WSTM (Stat Modifier Curve) open catalog format
Open replacement for the gtChanceTo*.dbc / gtRegen*.dbc /
gtCombatRatings.dbc family of "1D level-keyed curve" tables.
Each entry defines a single linear curve mapping character level
to a stat value: melee crit chance per level, mana regen per
spirit per level, base armor per level, etc.

Curves are linear: value(level) = baseValue + perLevelDelta *
(level - 1), with the result optionally scaled by a global
multiplier and clamped to a level range. Most stock WoW curves
fit this shape — the few that don't (cubic Combat Ratings) live
in the dedicated WCRR catalog with spline support.

Distinct from WCRR (Combat Rating conversion, integer ratings ->
percentages) and WSPC (Spell Power Cost buckets, per-spell
costs). WSTM is for the generic engine-side stat curves that
aren't per-spell or per-rating.

Seven curveKind values classify the major stat families (Crit /
Hit / Power / Regen / Resist / Mitigation / Misc), and each
curve carries its own [minLevel, maxLevel] applicability range
plus a multiplier for global scaling without retuning each
curve's slope.

Three preset emitters: --gen-stm (5 crit-related curves with
canonical 3.3.5a base+per-level scaling — MeleeCrit 5%+0.05/lvl
resolves to 8.95% at lvl 80), --gen-stm-regen (4 regen curves
including ManaPerSpirit and the Vanilla-era 3 rage/sec OOC
decay), --gen-stm-armor (3 armor/mitigation/resistance curves).

The info renderer demos resolveAtLevel(curveId, 80) inline as
the @lvl80 column — server admins can sanity-check what each
curve resolves to at character cap without writing test code.

Validation enforces id+name presence, curveKind 0..6,
minLevel<=maxLevel, no duplicate ids; warns on:
  - maxLevel > 80 (unreachable at WotLK cap)
  - multiplier=0 (curve always evaluates to 0)
  - multiplier<0 (inverts the curve — possibly intentional)
  - perLevelDelta<0 (curve shrinks with level — unusual)

Wired through the cross-format table; WSTM appears in all 18
cross-format utilities. Format count 93 -> 94; CLI flag count
1076 -> 1081.
2026-05-10 00:05:07 -07:00