feat(editor): add WWFL (Word Filter) — 116th open format

Novel replacement for the implicit chat-moderation
patterns vanilla WoW carried in the bad-word checker
(the hardcoded substring list the CMSG_MESSAGECHAT
handler walked before broadcasting). Each entry defines
one pattern the chat preprocessor matches against
outbound messages, the replacement to apply (or
"drop"/"warn"/"mute" the sender), and a kind tag for
analytics.

Seven filterKind values (Spam / GoldSeller / AllCaps /
RepeatChar / URL / AdvertReward / Misc) and four
severity levels (Warn — log only, Replace — substitute
matched span, Drop — silently discard, Mute — drop AND
mute sender). Per-filter caseSensitive flag for context-
specific rules (uppercase shouting detection vs
lowercase RMT keyword detection).

Intentionally non-profanity focused — the ecosystem
distributes through CI / public PRs where embedded
profanity creates reviewer-experience and licensing
concerns. The presets cover the moderation surfaces
server admins actually need: makeSpamRMT (5 RMT
patterns: wts/wtb gold drops, g0ld typo-substitution
replace, 1000g-for bulk-offer drop, free-gold mute),
makeAllCaps (3 shouting patterns), makeURLDetect (3
URL-leakage patterns: http://, https://, www.).
Profanity-list integration is left to deployment-time
configuration where local laws and community standards
apply.

Validator's most novel check is per-pattern uniqueness
— two filters with the same pattern would dispatch
ambiguously through the chat preprocessor. Also warns
on Replace severity with empty replacement (would
silently lose match — use Drop explicitly if intended).

Format count 115 -> 116. CLI flag count 1234 -> 1239.
This commit is contained in:
Kelsi 2026-05-10 02:35:06 -07:00
parent aaf169a8af
commit 7d201cd6f3
10 changed files with 712 additions and 0 deletions

View file

@ -2377,6 +2377,16 @@ void printUsage(const char* argv0) {
std::printf(" Export binary .wtrd to a human-editable JSON sidecar (defaults to <base>.wtrd.json; emits both ruleKind and targetingFilter as int + name string; goldEscrowMaxCopper as uint64)\n");
std::printf(" --import-wtrd-json <json-path> [out-base]\n");
std::printf(" Import a .wtrd.json sidecar back into binary .wtrd (ruleKind int OR \"allowed\"/\"forbidden\"/\"soulboundexception\"/\"crossfactionallowed\"/\"levelgated\"/\"goldescrowmax\"/\"auditlogged\"; targetingFilter int OR \"anyplayer\"/\"samerealmonly\"/\"samefactiononly\"/\"sameaccountonly\"/\"gmonly\")\n");
std::printf(" --gen-wfl <wwfl-base> [name]\n");
std::printf(" Emit .wwfl 5 RMT/spam patterns (wts gold drop / wtb gold drop / g0ld typo-substitution replace / 1000g for drop / free gold mute) — non-profanity moderation only\n");
std::printf(" --gen-wfl-caps <wwfl-base> [name]\n");
std::printf(" Emit .wwfl 3 all-caps patterns (case-sensitive uppercase word / triple-exclamation / dollar-symbol spam)\n");
std::printf(" --gen-wfl-url <wwfl-base> [name]\n");
std::printf(" Emit .wwfl 3 URL-detection patterns (http:// / https:// / www. — replace with [link] placeholder)\n");
std::printf(" --info-wwfl <wwfl-base> [--json]\n");
std::printf(" Print WWFL entries (id / kind / severity / case-sensitive / pattern -> replacement / name)\n");
std::printf(" --validate-wwfl <wwfl-base> [--json]\n");
std::printf(" Static checks: id+name+pattern required, filterKind 0..5 OR 255 Misc, severity 0..3, no duplicate filterIds, no two filters with same pattern (preprocessor dispatch ambiguity); warns on Replace severity with empty replacement (would silently lose match — use Drop explicitly if intended)\n");
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
std::printf(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");