Commit graph

2 commits

Author SHA1 Message Date
Kelsi
9318b6c006 feat(editor): add WMAT JSON round-trip (--export/--import-wmat-json)
Closes the editing loop on the item-material catalog: dump a
.wmat to JSON, hand-edit materialKind / weightCategory / foley /
impact sound bindings / material flags (e.g. swap a Hide entry
from Light to Medium weight, add IsBreakable to a wooden bow,
re-bind Plate's foley to a different WSND entry, mark a new
HolyForged variant), re-import to a byte-identical binary.

Three different field types each take dual int+name forms:
  - materialKind: int 0..11 OR "cloth"/"leather"/"mail"/"plate"/
    "wood"/"stone"/"metal"/"liquid"/"organic"/"crystal"/
    "ethereal"/"hide"
  - weightCategory: int 0..2 OR "light"/"medium"/"heavy"
  - materialFlags: int bitfield OR pipe-separated label string
    ("IsMagical|IsBreakable|IsHolyCharged"). Importer prefers
    int form when both present so unknown bits round-trip
    losslessly.

Verified byte-identical round-trip on all three presets
(armor / weapon / magical). CLI flag count 948 -> 950.
2026-05-09 22:16:13 -07:00
Kelsi
b220eeba61 feat(editor): add WMAT (Item Material) open catalog format
Open replacement for Blizzard's Material.dbc plus the Material
and SheatheType fields in ItemDisplayInfo.dbc. Defines the
material categorization that items reference (Cloth / Leather /
Mail / Plate / Wood / Steel / Crystal / Ethereal / etc), each
with its own foley sound (played on item use), impact sound
(played on drop / hit), weight category, and material-property
flags (IsBreakable / IsMagical / IsFlammable / IsConductive /
IsHolyCharged / IsCursed).

The engine plays a sword's metallic clang from impactSoundId
when it hits a stone wall, but a cloth tabard makes no such
sound — the difference is exactly the material assigned by this
catalog. Every armor and weapon item in WIT references a
materialId here.

Twelve materialKind values cover the standard armor classes
(Cloth/Leather/Mail/Plate/Hide), structural materials (Wood /
Stone / Metal), and special categories (Liquid / Organic /
Crystal / Ethereal). Three weight tiers (Light / Medium / Heavy)
control encumbrance UI hints.

Cross-references back to WSND (foleySoundId / impactSoundId
reference WSND sound entries) and forward to WIT (item entries
reference materialId here).

Three preset emitters: --gen-mat (5 armor materials matching
WoW's armor classes), --gen-mat-weapon (5 weapon materials from
breakable+flammable Wood through enchanted endgame steel),
--gen-mat-magical (4 magical materials with special flags
including the IsHolyCharged anti-undead property).

Validation enforces id+name presence, materialKind 0..11,
weightCategory 0..2, no duplicate ids; warns on:
  - IsHolyCharged + IsCursed both set (engine picks one,
    typically IsCursed wins)
  - Plate kind that's not Heavy weight (canonical violation)
  - Cloth kind that's not Light weight (canonical violation)

Wired through the cross-format table; WMAT appears automatically
in all 11 cross-format utilities. Format count 75 -> 76; CLI flag
count 943 -> 948.
2026-05-09 22:14:44 -07:00