Commit graph

2 commits

Author SHA1 Message Date
Kelsi
6b2bfb0f5a feat(editor): add WACR JSON round-trip (--export/--import-wacr-json)
Closes the editing loop on the achievement-criteria catalog: dump
a .wacr to JSON, hand-edit criteriaType / targetId / requiredCount
/ timeLimitMs / progressOrder (e.g. retune a kill-count from 50
boars to 25, swap a quest progression target, add a time limit to
turn a normal achievement into a speedrun, reorder progressOrder
so the easiest sub-objective shows first in the UI), re-import to
a byte-identical binary.

The exporter emits both criteriaType (int 0..12) and the human-
readable criteriaTypeName ("kill-creature" / "reach-level" /
"complete-quest" / "earn-gold" / "gain-honor" / "earn-reputation"
/ "explore-zone" / "loot-item" / "use-item" / "cast-spell" /
"pvp-kill" / "dungeon-run" / "misc"); the importer accepts either
form. The 13-way enum is the largest single-field dual-encoding
implemented so far in any catalog round-trip.

Verified byte-identical round-trip on all three presets
(kill / quest / mixed). CLI flag count 986 -> 988.
2026-05-09 22:45:02 -07:00
Kelsi
94e145541a feat(editor): add WACR (Achievement Criteria) open catalog format
Open replacement for Blizzard's Achievement_Criteria.dbc. Defines
the individual progression criteria that a character must
complete to earn an achievement.

Each WACH achievement has a tree of WACR criteria — "Kill 100
boars" is one criteria entry with criteriaType=KillCreature,
targetId=boarCreatureId, requiredCount=100. Multi-criteria
achievements (e.g. "Visit all 3 capital cities") have one entry
per sub-objective, all referencing the same achievementId, with
progressOrder determining their display sequence in the
achievement UI.

Thirteen criteriaType values cover the full progression variety:
  KillCreature / ReachLevel / CompleteQuest / EarnGold /
  GainHonor / EarnReputation / ExploreZone / LootItem /
  UseItem / CastSpell / PvPKill / DungeonRun / Misc

The targetId field is type-polymorphic — for KillCreature it
references WCRT.creatureId, for CompleteQuest it references
WQT.questId, for ExploreZone it's a WMS.zoneId, etc. The engine
interprets it based on criteriaType.

Cross-references back to WACH (achievementId), WCRT
(KillCreature.targetId), WQT (CompleteQuest.targetId), WIT
(LootItem/UseItem.targetId), WMS (ExploreZone.targetId), WSPL
(CastSpell.targetId). findByAchievement(achId) returns all
criteria for an achievement sorted by progressOrder — used
directly by the achievement UI to render the progress checklist.

Three preset emitters: --gen-acr (5 kill criteria under one
composite achievement showing different creature targets),
--gen-acr-quest (4-step quest progression), --gen-acr-mixed
(5 cross-type criteria demonstrating the full CriteriaType
variety).

Validation enforces id+name+achievementId presence,
criteriaType 0..12, no duplicate ids; warns on:
  - missing targetId for type-specific kinds (KillCreature,
    CompleteQuest, etc. — engine cannot track without it)
  - ReachLevel with requiredCount > 80 (above WotLK cap)
  - timeLimitMs set on non-time-sensitive types (engine
    ignores it for ReachLevel / EarnGold)
  - requiredCount=0 (criteria completes instantly on first
    progress event — usually a misconfig)

Wired through the cross-format table; WACR appears automatically
in all 14 cross-format utilities. Format count 80 -> 81; CLI flag
count 981 -> 986.
2026-05-09 22:43:44 -07:00