[Foundry] Map structured stat blocks (sidebar_fields, #130) into npc_to_actor #148
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation/Context
#130 ("[Table Tools] One-click 'Flesh out' NPC backstory and stat block in the wiki") stores generated stat blocks as both markdown in
bodyand structuredsidebar_fieldsrows ({label, value, visibility}), explicitly "semi-machine-readable (eases a future Foundry push)" per its own Decisions section — it names this Foundry pillar (#9/#10, v4.1.0) and the FoundryVTT live-push investigation (2026-07-15) as the consumers. Until this mapping exists, an NPC's "stats" are unmappable free prose from a Foundry adapter's point of view, which undercuts the headline live-push ask ("push stats", not just a name and a description). This issue is the direct extension of #9'snpc_to_actorthat makes thesidebar_fieldsrows actually land on pf2e actor fields.Approach
Extend the pf2e
npc_to_actor()adapter (#9) to consumeLoreEntry.sidebar_fieldsrows in addition totitle/body/gm_notes:{label, value}rows to pf2e actor system fields (level, HP, AC, saves, ability scores, etc.) where the label recognizably maps to a known pf2e field.genericadapter.visibility: gmorplayer_privatemust never be written intosystem.details.publicNotesor any player-visible actor field — they go into GM-only fields (system.details.privateNotesor equivalent) only. Public rows may populate public-facing fields.{label, value}pairs guided by free-textgame_systemrather than a schema-validated pf2e representation, this mapping is inherently best-effort. Note explicitly (in code comments and this issue) that the separate game-aware-systems investigation (structured per-system stat schemas replacing free-formgame_system, referenced in #130's "Related/future" section) is what would eventually make this mapping reliable instead of best-effort. The two efforts should be sequenced deliberately: this issue ships the best-effort mapping now so live push (Phase 2.5) isn't blocked on game-aware systems landing first; if/when game-aware systems lands, this mapping should be revisited to target the real schema instead of guessing from free-form labels.Dependencies
npc_to_actor) — this issue has no standalone value without #9's base actor-creation path.sidebar_fieldsstat rows — there is nothing to map until then.foundry_links) as the "what gets synced" logic behind that table's create-vs-update lookups, and is a hard dependency for the live-push slice in v4.4.0 ("Send to live scene", "Push update").Out of scope
genericadapter, #10, which already degrades to biography-only).sidebar_fieldsitself or #130's generation prompts.Acceptance criteria
npc_to_actor()readssidebar_fieldsand maps recognized pf2e-relevant rows onto actor system fields.sidebar_fieldsrows never appear in player-visible actor fields.