rpg-engine 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adventures/source.d.ts +3 -1
- package/dist/adventures/source.js +31 -1
- package/dist/campaign/find-campaign.js +8 -4
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +6 -0
- package/dist/campaign/settings.js +22 -1
- package/dist/cli/cli.js +1 -1
- package/dist/cli/command-line.js +1 -1
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +6 -6
- package/dist/commands/ask.js +7 -7
- package/dist/commands/change/amounts.d.ts +32 -0
- package/dist/commands/change/amounts.js +150 -0
- package/dist/commands/change/change.d.ts +4 -54
- package/dist/commands/change/change.js +19 -749
- package/dist/commands/change/damage.d.ts +30 -0
- package/dist/commands/change/damage.js +73 -2
- package/dist/commands/change/dice.d.ts +34 -0
- package/dist/commands/change/dice.js +59 -0
- package/dist/commands/change/fields.d.ts +37 -0
- package/dist/commands/change/fields.js +156 -0
- package/dist/commands/change/holder.d.ts +48 -0
- package/dist/commands/change/holder.js +162 -0
- package/dist/commands/change/recipe-pace.js +1 -1
- package/dist/commands/change/recipe.d.ts +58 -0
- package/dist/commands/change/recipe.js +179 -0
- package/dist/commands/choices.js +3 -3
- package/dist/commands/config/config.d.ts +15 -0
- package/dist/commands/config/config.js +355 -0
- package/dist/commands/config/custom-levels.d.ts +7 -0
- package/dist/commands/config/custom-levels.js +32 -0
- package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
- package/dist/commands/config/dashboard.js +171 -0
- package/dist/commands/config/entries.d.ts +17 -0
- package/dist/commands/config/entries.js +76 -0
- package/dist/commands/config/news.d.ts +7 -0
- package/dist/commands/config/news.js +88 -0
- package/dist/commands/config/shown.d.ts +9 -0
- package/dist/commands/config/shown.js +80 -0
- package/dist/commands/config/words.d.ts +27 -0
- package/dist/commands/config/words.js +204 -0
- package/dist/commands/effect.js +9 -9
- package/dist/commands/find.js +1 -1
- package/dist/commands/image.js +6 -6
- package/dist/commands/import/import.d.ts +0 -2
- package/dist/commands/import/import.js +68 -45
- package/dist/commands/import/run.js +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/init.js +2 -2
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +6 -6
- package/dist/commands/mode.d.ts +2 -2
- package/dist/commands/mode.js +8 -8
- package/dist/commands/mood.js +4 -4
- package/dist/commands/move.js +10 -10
- package/dist/commands/package/consent.d.ts +11 -0
- package/dist/commands/package/consent.js +52 -0
- package/dist/commands/package/here.d.ts +51 -0
- package/dist/commands/package/here.js +128 -0
- package/dist/commands/package/install.d.ts +10 -0
- package/dist/commands/package/install.js +337 -0
- package/dist/commands/package/package.d.ts +18 -0
- package/dist/commands/package/package.js +270 -0
- package/dist/commands/package/result.d.ts +89 -0
- package/dist/commands/package/result.js +1 -0
- package/dist/commands/package/uninstall.d.ts +6 -0
- package/dist/commands/package/uninstall.js +70 -0
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +5 -5
- package/dist/commands/roll/roll.js +11 -9
- package/dist/commands/roll/tables.js +1 -1
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +3 -3
- package/dist/commands/save.d.ts +2 -2
- package/dist/commands/save.js +2 -2
- package/dist/commands/scene/close.d.ts +18 -0
- package/dist/commands/scene/close.js +179 -0
- package/dist/commands/scene/members.d.ts +14 -0
- package/dist/commands/scene/members.js +32 -0
- package/dist/commands/scene/open.d.ts +6 -0
- package/dist/commands/scene/open.js +298 -0
- package/dist/commands/scene/result.d.ts +98 -0
- package/dist/commands/scene/result.js +2 -0
- package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
- package/dist/commands/scene/scene.js +210 -0
- package/dist/commands/scene/turns.d.ts +18 -0
- package/dist/commands/scene/turns.js +229 -0
- package/dist/commands/shared/books/adventure-layers.d.ts +89 -0
- package/dist/commands/shared/books/adventure-layers.js +201 -0
- package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +28 -9
- package/dist/commands/shared/{adventures.js → books/adventures.js} +77 -35
- package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
- package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
- package/dist/commands/shared/{library.js → books/library.js} +9 -9
- package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
- package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
- package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
- package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
- package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
- package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
- package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
- package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
- package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
- package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
- package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
- package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
- package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
- package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
- package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
- package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
- package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
- package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
- package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
- package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
- package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
- package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
- package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
- package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
- package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
- package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
- package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
- package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
- package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
- package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
- package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
- package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
- package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
- package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
- package/dist/commands/shared/characters/orders.d.ts +4 -0
- package/dist/commands/shared/characters/orders.js +10 -0
- package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +9 -6
- package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +17 -7
- package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
- package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
- package/dist/commands/shared/examples.js +2 -2
- package/dist/commands/shared/packages/catalog.js +2 -2
- package/dist/commands/shared/packages/code.d.ts +1 -1
- package/dist/commands/shared/packages/code.js +8 -8
- package/dist/commands/shared/packages/extensions.d.ts +1 -1
- package/dist/commands/shared/packages/extensions.js +1 -1
- package/dist/commands/shared/packages/hooks.d.ts +1 -1
- package/dist/commands/shared/packages/hooks.js +1 -1
- package/dist/commands/shared/packages/widgets.d.ts +3 -3
- package/dist/commands/shared/packages/widgets.js +3 -3
- package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
- package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
- package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
- package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
- package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
- package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
- package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
- package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
- package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
- package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
- package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
- package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
- package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
- package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
- package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
- package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
- package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
- package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
- package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
- package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
- package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
- package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
- package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
- package/dist/commands/shared/{scene.js → scene/scene.js} +10 -8
- package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
- package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
- package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
- package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
- package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
- package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
- package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
- package/dist/commands/shared/sheet/effect-values.js +69 -0
- package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
- package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
- package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
- package/dist/commands/shared/sheet/formula-problems.js +140 -0
- package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
- package/dist/commands/shared/sheet/formula-scope.js +235 -0
- package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
- package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
- package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
- package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
- package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +7 -5
- package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
- package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
- package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
- package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
- package/dist/commands/shared/sheet/system-fields.js +45 -0
- package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
- package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
- package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
- package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
- package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
- package/dist/commands/shared/sheet/worked-out.js +291 -0
- package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
- package/dist/commands/shared/sheet/worked-text.js +55 -0
- package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
- package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
- package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
- package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
- package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
- package/dist/commands/shared/{events.js → time/events.js} +10 -13
- package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
- package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
- package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
- package/dist/commands/shared/{time.js → time/time.js} +6 -6
- package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
- package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
- package/dist/commands/show.d.ts +9 -0
- package/dist/commands/show.js +43 -10
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +28 -22
- package/dist/commands/thoughts.d.ts +1 -0
- package/dist/commands/thoughts.js +26 -18
- package/dist/commands/trade.js +8 -8
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/travel/open.d.ts +1 -1
- package/dist/commands/travel/open.js +2 -2
- package/dist/commands/travel/route.js +7 -6
- package/dist/commands/travel/travel.d.ts +1 -1
- package/dist/commands/travel/travel.js +8 -8
- package/dist/commands/validate.js +3 -3
- package/dist/commands/view/journal.d.ts +2 -2
- package/dist/commands/view/journal.js +2 -2
- package/dist/commands/view/layers.d.ts +34 -0
- package/dist/commands/view/layers.js +44 -0
- package/dist/commands/view/map.d.ts +1 -1
- package/dist/commands/view/map.js +6 -6
- package/dist/commands/view/memory.d.ts +16 -0
- package/dist/commands/view/memory.js +96 -0
- package/dist/commands/view/page.d.ts +32 -0
- package/dist/commands/view/page.js +166 -0
- package/dist/commands/view/place.d.ts +7 -2
- package/dist/commands/view/place.js +30 -12
- package/dist/commands/view/result.d.ts +252 -0
- package/dist/commands/view/result.js +1 -0
- package/dist/commands/view/saves.d.ts +6 -0
- package/dist/commands/view/saves.js +53 -0
- package/dist/commands/view/story.d.ts +32 -0
- package/dist/commands/view/story.js +227 -0
- package/dist/commands/view/view.d.ts +29 -292
- package/dist/commands/view/view.js +31 -536
- package/dist/commands/view/world.d.ts +1 -1
- package/dist/commands/view/world.js +3 -3
- package/dist/commands/write/checks.d.ts +42 -0
- package/dist/commands/write/checks.js +291 -0
- package/dist/commands/write/here.d.ts +1 -1
- package/dist/commands/write/here.js +5 -5
- package/dist/commands/write/inheritance.d.ts +40 -0
- package/dist/commands/write/inheritance.js +185 -0
- package/dist/commands/write/input.d.ts +29 -0
- package/dist/commands/write/input.js +124 -0
- package/dist/commands/write/layer.d.ts +44 -0
- package/dist/commands/write/layer.js +68 -0
- package/dist/commands/write/notes.d.ts +22 -0
- package/dist/commands/write/notes.js +76 -0
- package/dist/commands/write/progression.d.ts +27 -0
- package/dist/commands/write/progression.js +175 -0
- package/dist/commands/write/write.d.ts +2 -0
- package/dist/commands/write/write.js +36 -816
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +7 -0
- package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
- package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
- package/dist/core/session-store.js +3 -3
- package/dist/core/store.d.ts +2 -2
- package/dist/core/store.js +18 -4
- package/dist/core/text.d.ts +2 -0
- package/dist/core/text.js +4 -0
- package/dist/dashboard/acts/acts.js +1 -1
- package/dist/dashboard/acts/sending.js +110 -0
- package/dist/dashboard/acts/sheet.js +2 -2
- package/dist/dashboard/acts/strip.js +1 -1
- package/dist/dashboard/address.js +6 -0
- package/dist/dashboard/api.js +19 -1
- package/dist/dashboard/app.js +51 -171
- package/dist/dashboard/dice/roller.js +1 -1
- package/dist/dashboard/dice/sets.js +2 -2
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/dice/tray.js +6 -6
- package/dist/dashboard/guide/ar.md +7 -3
- package/dist/dashboard/guide/cs.md +9 -5
- package/dist/dashboard/guide/da.md +9 -5
- package/dist/dashboard/guide/de.md +7 -3
- package/dist/dashboard/guide/el.md +9 -5
- package/dist/dashboard/guide/en.md +4 -0
- package/dist/dashboard/guide/es.md +8 -4
- package/dist/dashboard/guide/fi.md +9 -5
- package/dist/dashboard/guide/fr.md +8 -4
- package/dist/dashboard/guide/he.md +7 -3
- package/dist/dashboard/guide/hi.md +10 -6
- package/dist/dashboard/guide/hu.md +8 -4
- package/dist/dashboard/guide/is.md +9 -5
- package/dist/dashboard/guide/it.md +5 -1
- package/dist/dashboard/guide/ja.md +9 -5
- package/dist/dashboard/guide/ko.md +8 -4
- package/dist/dashboard/guide/nb.md +8 -4
- package/dist/dashboard/guide/nl.md +8 -4
- package/dist/dashboard/guide/pl.md +8 -4
- package/dist/dashboard/guide/pt.md +7 -3
- package/dist/dashboard/guide/ro.md +9 -5
- package/dist/dashboard/guide/ru.md +8 -4
- package/dist/dashboard/guide/sv.md +9 -5
- package/dist/dashboard/guide/tr.md +9 -5
- package/dist/dashboard/guide/uk.md +8 -4
- package/dist/dashboard/guide/zh.md +8 -4
- package/dist/dashboard/help/help.js +3 -3
- package/dist/dashboard/i18n/ar.json +29 -0
- package/dist/dashboard/i18n/cs.json +29 -0
- package/dist/dashboard/i18n/da.json +29 -0
- package/dist/dashboard/i18n/de.json +29 -0
- package/dist/dashboard/i18n/el.json +29 -0
- package/dist/dashboard/i18n/es.json +29 -0
- package/dist/dashboard/i18n/fi.json +29 -0
- package/dist/dashboard/i18n/fr.json +29 -0
- package/dist/dashboard/i18n/he.json +29 -0
- package/dist/dashboard/i18n/hi.json +29 -0
- package/dist/dashboard/i18n/hu.json +29 -0
- package/dist/dashboard/i18n/is.json +29 -0
- package/dist/dashboard/i18n/it.json +29 -0
- package/dist/dashboard/i18n/ja.json +30 -1
- package/dist/dashboard/i18n/ko.json +29 -0
- package/dist/dashboard/i18n/nb.json +29 -0
- package/dist/dashboard/i18n/nl.json +29 -0
- package/dist/dashboard/i18n/pl.json +29 -0
- package/dist/dashboard/i18n/pt.json +29 -0
- package/dist/dashboard/i18n/ro.json +29 -0
- package/dist/dashboard/i18n/ru.json +29 -0
- package/dist/dashboard/i18n/sv.json +29 -0
- package/dist/dashboard/i18n/tr.json +29 -0
- package/dist/dashboard/i18n/uk.json +29 -0
- package/dist/dashboard/i18n/zh.json +29 -0
- package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
- package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
- package/dist/dashboard/kit.js +3 -3
- package/dist/dashboard/packages/ask-card.js +3 -3
- package/dist/dashboard/packages/catalog.js +196 -0
- package/dist/dashboard/packages/changes.js +111 -0
- package/dist/dashboard/packages/engine.js +87 -0
- package/dist/dashboard/packages/installed.js +53 -0
- package/dist/dashboard/packages/library.js +97 -0
- package/dist/dashboard/packages/outcomes.js +45 -0
- package/dist/dashboard/packages/packages.js +27 -578
- package/dist/dashboard/packages/page-code.js +15 -2
- package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
- package/dist/dashboard/packages/rows.js +84 -0
- package/dist/dashboard/packages/share.js +44 -0
- package/dist/dashboard/packages/widgets.js +3 -3
- package/dist/dashboard/{card.js → parts/card.js} +1 -1
- package/dist/dashboard/parts/changed.js +37 -0
- package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
- package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
- package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
- package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
- package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
- package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
- package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
- package/dist/dashboard/{refusals.js → parts/refusals.js} +5 -1
- package/dist/dashboard/{status.js → parts/status.js} +4 -4
- package/dist/dashboard/{widgets.js → parts/widgets.js} +5 -3
- package/dist/dashboard/place/key.js +24 -0
- package/dist/dashboard/place/paper.js +67 -0
- package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
- package/dist/dashboard/place/things.js +129 -0
- package/dist/dashboard/place/tokens.js +93 -0
- package/dist/dashboard/place/view.js +124 -0
- package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
- package/dist/dashboard/{asked.js → play/asked.js} +10 -10
- package/dist/dashboard/{choices.js → play/choices.js} +11 -10
- package/dist/dashboard/{requested.js → play/requested.js} +1 -1
- package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
- package/dist/dashboard/{scene.js → play/scene.js} +14 -14
- package/dist/dashboard/{turns.js → play/turns.js} +12 -12
- package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
- package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
- package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
- package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
- package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
- package/dist/dashboard/{party.js → sheet/party.js} +8 -8
- package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
- package/dist/dashboard/{sheet.js → sheet/sheet.js} +27 -24
- package/dist/dashboard/{story.js → sheet/story.js} +3 -3
- package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
- package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
- package/dist/dashboard/{master.js → shell/master.js} +2 -2
- package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
- package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
- package/dist/dashboard/shell/shown.js +38 -0
- package/dist/dashboard/{table.js → shell/table.js} +2 -2
- package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
- package/dist/dashboard/{top.js → shell/top.js} +7 -7
- package/dist/dashboard/style.css +288 -4
- package/dist/dashboard/world/calendar.js +4 -4
- package/dist/dashboard/world/drawing.js +92 -0
- package/dist/dashboard/world/key.js +21 -0
- package/dist/dashboard/world/lore.js +10 -6
- package/dist/dashboard/world/map-card.js +186 -0
- package/dist/dashboard/world/place-card.js +39 -0
- package/dist/dashboard/world/places.js +29 -0
- package/dist/dashboard/world/world.js +9 -341
- package/dist/extensions/extension.d.ts +1 -1
- package/dist/extensions/extension.js +1 -1
- package/dist/images/images.js +12 -9
- package/dist/index.d.ts +1 -1
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/packages/npm.js +1 -1
- package/dist/page.d.ts +2 -2
- package/dist/page.js +1 -1
- package/dist/pages/check.js +23 -1
- package/dist/pages/containers.d.ts +1 -1
- package/dist/pages/containers.js +1 -1
- package/dist/pages/index.d.ts +4 -2
- package/dist/pages/index.js +4 -2
- package/dist/pages/inheritance.d.ts +2 -2
- package/dist/pages/layers.d.ts +52 -0
- package/dist/pages/layers.js +105 -0
- package/dist/pages/markdown.d.ts +5 -1
- package/dist/pages/markdown.js +13 -1
- package/dist/pages/rename-page.js +1 -1
- package/dist/pages/stacks/writes.js +48 -22
- package/dist/pages/standard-fields.d.ts +1 -1
- package/dist/pages/system-pages.d.ts +5 -3
- package/dist/pages/system-pages.js +16 -7
- package/dist/pages/world.d.ts +8 -1
- package/dist/pages/world.js +16 -4
- package/dist/pages/write-layer.d.ts +23 -0
- package/dist/pages/write-layer.js +162 -0
- package/dist/pages/write-page.d.ts +2 -2
- package/dist/pages/write-page.js +2 -2
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/rules/search.d.ts +1 -1
- package/dist/rules/shown.d.ts +1 -1
- package/dist/server/dashboard/choices.d.ts +2 -0
- package/dist/server/dashboard/choices.js +6 -4
- package/dist/server/dashboard/files.js +5 -5
- package/dist/server/dashboard/index.d.ts +2 -2
- package/dist/server/dashboard/index.js +7 -3
- package/dist/server/dashboard/news.js +4 -3
- package/dist/server/dashboard/player.js +1 -1
- package/dist/server/dashboard/writes.d.ts +7 -0
- package/dist/server/dashboard/writes.js +48 -7
- package/dist/server/mcp.js +28 -13
- package/dist/systems/campaign-data.d.ts +15 -0
- package/dist/systems/campaign-data.js +85 -0
- package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
- package/dist/systems/{system-code.js → code.js} +2 -2
- package/dist/systems/game-system.d.ts +7 -61
- package/dist/systems/game-system.js +1 -984
- package/dist/systems/index.d.ts +6 -3
- package/dist/systems/index.js +6 -3
- package/dist/systems/installed.d.ts +31 -0
- package/dist/systems/installed.js +89 -0
- package/dist/systems/maps.d.ts +3 -0
- package/dist/systems/maps.js +9 -0
- package/dist/systems/read.d.ts +3 -0
- package/dist/systems/read.js +471 -0
- package/dist/systems/schema.d.ts +289 -0
- package/dist/systems/schema.js +243 -0
- package/dist/systems/settings.d.ts +19 -0
- package/dist/systems/settings.js +78 -0
- package/dist/systems/versions.d.ts +12 -0
- package/dist/systems/versions.js +52 -0
- package/dist/testing/index.js +1 -1
- package/instructions/import.md +1 -1
- package/instructions/play.md +1 -1
- package/instructions/voices.md +1 -1
- package/package.json +1 -1
- package/dist/commands/config.js +0 -948
- package/dist/commands/package.d.ts +0 -143
- package/dist/commands/package.js +0 -785
- package/dist/commands/scene.js +0 -894
- package/dist/commands/shared/worked-out.js +0 -805
- package/dist/dashboard/place/map-view.js +0 -417
- /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
- /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
- /package/dist/core/{package-api.js → packages/api.js} +0 -0
- /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
- /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
- /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
- /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
- /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
- /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
- /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
- /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
- /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
- /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
- /package/dist/languages/{language-pack.js → pack.js} +0 -0
- /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
- /package/dist/pages/{page-file.js → file.js} +0 -0
- /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
- /package/dist/pages/{page-types.js → types.js} +0 -0
- /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
- /package/dist/rules/{rule-book.js → book.js} +0 -0
- /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
- /package/dist/systems/{system-folders.js → folders.js} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Writing the campaign's layer over a page of its game system (SYS-11): only what differs from the system, and no layer left empty.
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { files } from "../core/store.js";
|
|
4
|
+
import { comparableText, sameName, valueNamed } from "../core/text.js";
|
|
5
|
+
import { changedFields, changeFields, joinPageFile, readFields, splitPageFile } from "./file.js";
|
|
6
|
+
import { isNeverInherited } from "./inheritance.js";
|
|
7
|
+
import { layerParts, layersFolderName, layerTakes, systemOriginal } from "./layers.js";
|
|
8
|
+
import { introductionText, partContent, readSection, repeatedNames, sectionTitles, writeText } from "./markdown.js";
|
|
9
|
+
import { systemLabel } from "./system-pages.js";
|
|
10
|
+
/**
|
|
11
|
+
* Writes the campaign's layer over a page of its game system (SYS-11): the change is read on the page as the campaign has it, and the layer keeps only what then differs
|
|
12
|
+
* from the system. unset, or an empty text, takes the layer's own value or section away, and the page reads the system's again. The system's files never change.
|
|
13
|
+
*/
|
|
14
|
+
export function writeLayer(world, page, change) {
|
|
15
|
+
if (page.system === undefined) {
|
|
16
|
+
throw new Error(`${page.name} is a page of the campaign: write it without layer. A layer changes a page of the game system for the whole campaign. Nothing changed.`);
|
|
17
|
+
}
|
|
18
|
+
const original = systemOriginal(page);
|
|
19
|
+
const path = page.layer?.path ?? `${layersFolderName}/${page.system}/${original.path}`;
|
|
20
|
+
const fullPath = join(world.root, path);
|
|
21
|
+
const before = files().fresh(fullPath);
|
|
22
|
+
const file = splitPageFile(before ?? "");
|
|
23
|
+
const held = readFields(file.frontmatter, path);
|
|
24
|
+
const fields = layerFields(world, page, original, held, change);
|
|
25
|
+
const frontmatter = fields.set.length + fields.unsetKeys.length === 0 ? file.frontmatter : changeFields(file.frontmatter, { set: fields.values, unset: fields.unsetKeys }, path);
|
|
26
|
+
const body = change.text === undefined ? file.body : withoutIdleSections(layerText(page, original, file.body, change), original.body);
|
|
27
|
+
checkNamedOnce(page, file.body, body);
|
|
28
|
+
const empty = (frontmatter ?? "").trim() === "" && body.trim() === "";
|
|
29
|
+
const text = joinPageFile({ frontmatter, body });
|
|
30
|
+
const changed = empty ? before !== undefined : text !== (before === undefined ? undefined : joinPageFile(file));
|
|
31
|
+
if (empty && before !== undefined) {
|
|
32
|
+
files().remove(fullPath);
|
|
33
|
+
}
|
|
34
|
+
else if (changed) {
|
|
35
|
+
files().write(fullPath, text);
|
|
36
|
+
}
|
|
37
|
+
return { path, changed, removed: empty && before !== undefined, set: fields.set, again: fields.again, unset: fields.unset };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Takes the campaign's whole layer off a page of its game system (SYS-11): its file goes, one that does not read too, and the page reads as the system writes it
|
|
41
|
+
* again. Refused when the page has none.
|
|
42
|
+
*/
|
|
43
|
+
export function removeLayer(world, page) {
|
|
44
|
+
if (page.system === undefined) {
|
|
45
|
+
throw new Error(`${page.name} is a page of the campaign, which has no layer: a layer changes a page of the game system for the whole campaign. Nothing changed.`);
|
|
46
|
+
}
|
|
47
|
+
const path = page.layer?.path ?? `${layersFolderName}/${page.system}/${systemOriginal(page).path}`;
|
|
48
|
+
const fullPath = join(world.root, path);
|
|
49
|
+
if (files().fresh(fullPath) === undefined) {
|
|
50
|
+
throw new Error(`The campaign has no layer over ${page.name} to take off: it already reads as the system ${page.system} writes it. Nothing changed.`);
|
|
51
|
+
}
|
|
52
|
+
files().remove(fullPath);
|
|
53
|
+
return { path, changed: true, removed: true, set: [], again: page.layer?.fields ?? [], unset: [] };
|
|
54
|
+
}
|
|
55
|
+
/** The fields a change gives the layer: those that differ from the system's go in, those equal to it come out, unset takes the layer's own away. */
|
|
56
|
+
function layerFields(world, page, original, held, change) {
|
|
57
|
+
const lists = Object.fromEntries([...Object.keys(change.add ?? {}), ...Object.keys(change.remove ?? {})].map((field) => {
|
|
58
|
+
const current = valueNamed(page.fields, field);
|
|
59
|
+
const list = changedFields({ [field]: current ?? [] }, { add: pick(change.add, field), remove: pick(change.remove, field) })[field];
|
|
60
|
+
return [field, list];
|
|
61
|
+
}));
|
|
62
|
+
const given = { ...change.set, ...lists };
|
|
63
|
+
const values = {};
|
|
64
|
+
const unsetKeys = [];
|
|
65
|
+
const [set, again, unset] = [[], [], []];
|
|
66
|
+
for (const [field, value] of Object.entries(given)) {
|
|
67
|
+
checkLayerField(world, page, original, field, value);
|
|
68
|
+
const system = sameName(Object.keys(original.fields), field);
|
|
69
|
+
const own = sameName(Object.keys(held), field);
|
|
70
|
+
const key = own ?? system ?? field;
|
|
71
|
+
if (system !== undefined && JSON.stringify(original.fields[system]) === JSON.stringify(value)) {
|
|
72
|
+
again.push(field);
|
|
73
|
+
if (own !== undefined) {
|
|
74
|
+
unsetKeys.push(own);
|
|
75
|
+
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
set.push(field);
|
|
79
|
+
values[key] = value;
|
|
80
|
+
}
|
|
81
|
+
for (const field of change.unset ?? []) {
|
|
82
|
+
const own = sameName(Object.keys(held), field);
|
|
83
|
+
if (own === undefined) {
|
|
84
|
+
const system = valueNamed(original.fields, field) === undefined ? "" : `: it is the system's own, which a layer cannot remove; set another value instead`;
|
|
85
|
+
throw new Error(`The campaign's layer over ${page.name} holds no ${field} to remove${system}. Nothing changed.`);
|
|
86
|
+
}
|
|
87
|
+
unset.push(field);
|
|
88
|
+
unsetKeys.push(own);
|
|
89
|
+
}
|
|
90
|
+
return { values, unsetKeys, set, again, unset };
|
|
91
|
+
}
|
|
92
|
+
/** Refuses what a layer never changes (SYS-11): the name, the type, a field never inherited (INH-8), and a counter of uses on an item that is a kind (STK-1). */
|
|
93
|
+
function checkLayerField(world, page, original, field, value) {
|
|
94
|
+
if (layerTakes(original, field, value, world.system?.fields)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const why = ["name", "type"].includes(comparableText(field))
|
|
98
|
+
? `a layer changes neither the name nor the type of ${page.name}`
|
|
99
|
+
: isNeverInherited(field)
|
|
100
|
+
? `${field} is a field no page inherits (INH-8), and ${page.name} is ${systemLabel(page)}, which is nowhere and derives only from the system`
|
|
101
|
+
: `uses of its own would make ${page.name}, a kind counted in stacks, no kind: one with uses is an item of the campaign that derives from it, with item=[[${page.name}]]`;
|
|
102
|
+
throw new Error(`${field} cannot go in the campaign's layer over ${page.name}: ${why}. Nothing changed.`);
|
|
103
|
+
}
|
|
104
|
+
/** The layer's text after a change: a section or the introduction equal to the system's comes out, an empty one takes the layer's own away. */
|
|
105
|
+
function layerText(page, original, body, change) {
|
|
106
|
+
const section = change.section;
|
|
107
|
+
const own = section === undefined ? introductionText(body) : partContent(body, section)?.content;
|
|
108
|
+
const system = section === undefined ? introductionText(original.body) : partContent(original.body, section);
|
|
109
|
+
const shown = section === undefined ? introductionText(page.body) : partContent(page.body, section)?.content;
|
|
110
|
+
const content = change.append === true ? [shown ?? "", change.text.trim()].filter((part) => part !== "").join("\n\n") : change.text.trim();
|
|
111
|
+
const where = section === undefined ? "the introduction" : `"${section}"`;
|
|
112
|
+
const systemText = typeof system === "string" ? system : system?.content;
|
|
113
|
+
if (content === "" || content === systemText) {
|
|
114
|
+
if (own === undefined || own === "") {
|
|
115
|
+
const under = section === undefined ? [] : layerParts(body).filter((part) => part.content !== "" && comparableText(part.under ?? "") === comparableText(section)).map((part) => part.name);
|
|
116
|
+
const remedy = content !== ""
|
|
117
|
+
? ""
|
|
118
|
+
: under.length > 0
|
|
119
|
+
? `: what the layer writes under it, ${under.join(", ")}, goes by its own name`
|
|
120
|
+
: systemText !== undefined && systemText !== ""
|
|
121
|
+
? `: the system's text cannot be removed, only written over with another`
|
|
122
|
+
: "";
|
|
123
|
+
throw new Error(content === "" ? `The campaign's layer over ${page.name} has no ${where} of its own to remove${remedy}. Nothing changed.` : `${where} of ${page.name} already reads like that. Nothing changed.`);
|
|
124
|
+
}
|
|
125
|
+
// A section loses its own text alone: what the layer writes under it stays, and a heading left with nothing goes with the idle ones.
|
|
126
|
+
return section === undefined ? writeText(body, "", { mode: "replace" }) : writeText(body, "", { section, mode: partContent(body, section)?.secret === true ? "remove" : "replace" });
|
|
127
|
+
}
|
|
128
|
+
const secret = change.secret === true || (typeof system === "object" && system.secret);
|
|
129
|
+
return writeText(body, content, { mode: "replace", ...(section === undefined ? {} : { section, secret: own === undefined && secret }) });
|
|
130
|
+
}
|
|
131
|
+
/** Refuses a text that gives the layer a section or secret it already holds, as a heading of one written before: Page#Name finds one place. */
|
|
132
|
+
function checkNamedOnce(page, before, after) {
|
|
133
|
+
const already = repeatedNames(before).map(comparableText);
|
|
134
|
+
const [repeated] = repeatedNames(after).filter((name) => !already.includes(comparableText(name)));
|
|
135
|
+
if (repeated !== undefined) {
|
|
136
|
+
throw new Error(`The campaign's layer over ${page.name} would hold "${repeated}" twice, and each section is written once: to change it, write ${page.name}#${repeated} with layer; for a new one, pick another name. Nothing changed.`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A layer's text without the sections that give nothing (SYS-11): the text of one that says what the system's says comes out, and a heading left with no text,
|
|
141
|
+
* no section under it and no secret goes, from the last, so that the one it was written under goes with it.
|
|
142
|
+
*/
|
|
143
|
+
function withoutIdleSections(body, system) {
|
|
144
|
+
let text = body;
|
|
145
|
+
for (const name of [...sectionTitles(body)].reverse()) {
|
|
146
|
+
const own = partContent(text, name);
|
|
147
|
+
if (own === undefined || own.secret) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (own.content !== "" && own.content === partContent(system, name)?.content) {
|
|
151
|
+
text = writeText(text, "", { section: name, mode: "replace" });
|
|
152
|
+
}
|
|
153
|
+
// Its heading alone: no text, no section under it, no secret.
|
|
154
|
+
if (readSection(text, name)?.includes("\n") === false) {
|
|
155
|
+
text = writeText(text, "", { section: name, mode: "remove" });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return text;
|
|
159
|
+
}
|
|
160
|
+
function pick(lists, field) {
|
|
161
|
+
return lists?.[field] === undefined ? undefined : { [field]: lists[field] };
|
|
162
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type FieldChange } from "./file.ts";
|
|
1
2
|
import { type TextMode } from "./markdown.ts";
|
|
2
|
-
import { type
|
|
3
|
-
import { type PageType } from "./page-types.ts";
|
|
3
|
+
import { type PageType } from "./types.ts";
|
|
4
4
|
import { type Page, type World } from "./world.ts";
|
|
5
5
|
/** What to change on a page: its fields, and the text of its introduction, of one section or of one secret. */
|
|
6
6
|
export interface PageChange extends FieldChange {
|
package/dist/pages/write-page.js
CHANGED
|
@@ -2,14 +2,14 @@ import { join } from "node:path";
|
|
|
2
2
|
import { files } from "../core/store.js";
|
|
3
3
|
import { comparableText, withArticle } from "../core/text.js";
|
|
4
4
|
import { holdRefusal } from "./containers.js";
|
|
5
|
+
import { changeFields, holdsNestedList, joinPageFile, readFields, splitPageFile } from "./file.js";
|
|
5
6
|
import { baseChain, baseFieldOf, baseValue, derivedPages, ownFieldChange, sameAsBase } from "./inheritance.js";
|
|
6
7
|
import { introductionText, partContent, readSection, repeatedNames, secretNames, sectionTitles, writeText } from "./markdown.js";
|
|
7
|
-
import { changeFields, holdsNestedList, joinPageFile, readFields, splitPageFile } from "./page-file.js";
|
|
8
|
-
import { pageTypeNames, pageTypes, worldFolderName } from "./page-types.js";
|
|
9
8
|
import { isKind, notKindReason } from "./stacks/kinds.js";
|
|
10
9
|
import { checkStackEdits, checkStacks, isKindNamed } from "./stacks/writes.js";
|
|
11
10
|
import { canHold, checkStandardFields, containerFieldOf, containerFields, isFieldName, isStandardField, misspelledStandardField, newPageFields } from "./standard-fields.js";
|
|
12
11
|
import { alwaysInList, alwaysInMessage, heldSystemPageMessage, hidingMessage, readOnlyMessage, systemLabel } from "./system-pages.js";
|
|
12
|
+
import { pageTypeNames, pageTypes, worldFolderName } from "./types.js";
|
|
13
13
|
import { checkPageName, findPage, heldNames, holdersOf, isCountedItem, linksIn, locate, readPage, validHoldersOf, withPage } from "./world.js";
|
|
14
14
|
/**
|
|
15
15
|
* Writes a page: creates it when there is no page with that name and `type` is given, then applies the change. A change that leaves the page as it was writes nothing.
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export { bookTitles, readRuleBook, ruleFiles, type RuleSection, ruleSections } from "./book.ts";
|
|
1
2
|
export { bookHeadings, findPages, type PageExcerpt, pageExcerpt, type PageFinding, pageTitle, type SearchedBook } from "./page-search.ts";
|
|
2
|
-
export { bookTitles, readRuleBook, ruleFiles, type RuleSection, ruleSections } from "./rule-book.ts";
|
|
3
3
|
export { findRules, hasAllWords, isTitled, type RuleFinding } from "./search.ts";
|
|
4
4
|
export { type ShownRule, shownRules } from "./shown.ts";
|
package/dist/rules/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Rules as text (D-161, D-178, RUL): the sections of markdown files, found by their words and read exactly as they are written; and the pages of the player's
|
|
2
2
|
// books, found as BM25 counts them, each shown by the section the words are in (D-491, LIB-6, LIB-7).
|
|
3
|
+
export { bookTitles, readRuleBook, ruleFiles, ruleSections } from "./book.js";
|
|
3
4
|
export { bookHeadings, findPages, pageExcerpt, pageTitle } from "./page-search.js";
|
|
4
|
-
export { bookTitles, readRuleBook, ruleFiles, ruleSections } from "./rule-book.js";
|
|
5
5
|
export { findRules, hasAllWords, isTitled } from "./search.js";
|
|
6
6
|
export { shownRules } from "./shown.js";
|
package/dist/rules/search.d.ts
CHANGED
package/dist/rules/shown.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuleSection } from "./
|
|
1
|
+
import type { RuleSection } from "./book.ts";
|
|
2
2
|
import type { RuleFinding } from "./search.ts";
|
|
3
3
|
/** A section as an answer shows it: whole, or, when it is too long, its own text with the titles of its parts. */
|
|
4
4
|
export interface ShownRule {
|
|
@@ -12,6 +12,8 @@ export interface OptionPage {
|
|
|
12
12
|
name: string;
|
|
13
13
|
title: string;
|
|
14
14
|
opening: string;
|
|
15
|
+
/** It is, or derives from, a page of the game system the campaign changed with a layer (SYS-11). */
|
|
16
|
+
layered?: true;
|
|
15
17
|
}
|
|
16
18
|
/** A set of choices as the page shows it. */
|
|
17
19
|
export interface ShownChoices {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { findCampaign, readChoices, readSettings, writeChoices } from "../../campaign/index.js";
|
|
3
3
|
import { confirmedNotes, offeredPages, optionParts } from "../../commands/choices.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { campaignSystem, campaignWorld } from "../../commands/shared/campaign/world.js";
|
|
5
|
+
import { knownIntroduction, knowsPage, playerKnowledge, withPagesKnown } from "../../commands/shared/characters/knowledge.js";
|
|
6
|
+
import { newDatedLogEntry } from "../../commands/shared/time/time.js";
|
|
7
|
+
import { isLayered } from "../../commands/view/layers.js";
|
|
7
8
|
import { appendLogEntry } from "../../core/log.js";
|
|
8
9
|
import { withFiles } from "../../core/store.js";
|
|
9
10
|
import { firstSentence } from "../../core/text.js";
|
|
@@ -90,7 +91,8 @@ function shownOption(world, knowledge, option) {
|
|
|
90
91
|
const found = parts.pages.map((name) => findPage(world, name)).filter((page) => page !== undefined);
|
|
91
92
|
const pages = found.filter((page, index) => found.findIndex((other) => other.name === page.name) === index).map((page) => {
|
|
92
93
|
const introduction = knowledge === undefined ? withoutComments(introductionText(page.translated ?? page.body)) : knownIntroduction(world, knowledge, page);
|
|
93
|
-
|
|
94
|
+
const layered = isLayered(world, page, (base) => knowledge === undefined || knowsPage(knowledge, base)) ? { layered: true } : {};
|
|
95
|
+
return { name: page.name, title: page.title ?? page.name, opening: firstSentence(linkWords(world, introduction).replace(/\s+/g, " ").trim()), ...layered };
|
|
94
96
|
});
|
|
95
97
|
return {
|
|
96
98
|
text: option,
|
|
@@ -6,11 +6,11 @@ import { dirname, extname, join, resolve } from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { findCampaign } from "../../campaign/index.js";
|
|
9
|
-
import { imageFolders } from "../../commands/shared/images.js";
|
|
9
|
+
import { imageFolders } from "../../commands/shared/campaign/images.js";
|
|
10
|
+
import { campaignTheme } from "../../commands/shared/campaign/theme.js";
|
|
11
|
+
import { campaignSystem } from "../../commands/shared/campaign/world.js";
|
|
10
12
|
import { campaignPackages } from "../../commands/shared/packages/code.js";
|
|
11
13
|
import { campaignPageModules } from "../../commands/shared/packages/extensions.js";
|
|
12
|
-
import { campaignTheme } from "../../commands/shared/theme.js";
|
|
13
|
-
import { campaignSystem } from "../../commands/shared/world.js";
|
|
14
14
|
import { realPath } from "../../core/files.js";
|
|
15
15
|
import { files, isInside, withFiles } from "../../core/store.js";
|
|
16
16
|
import { findHiddenImage, findImage } from "../../images/index.js";
|
|
@@ -64,8 +64,8 @@ const importMap = JSON.stringify({
|
|
|
64
64
|
},
|
|
65
65
|
});
|
|
66
66
|
// The page runs only its own files and the import map written in it, known by its hash; and the physics of the dice, which Rapier's module carries as
|
|
67
|
-
// WebAssembly and compiles.
|
|
68
|
-
export const pagePolicy = `default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'sha256-${createHash("sha256").update(importMap).digest("base64")}'; base-uri 'none'; form-action 'none'`;
|
|
67
|
+
// WebAssembly and compiles. No page frames it: a second guard behind the refusal of a frame's request (T-170).
|
|
68
|
+
export const pagePolicy = `default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'sha256-${createHash("sha256").update(importMap).digest("base64")}'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'`;
|
|
69
69
|
export const pageHtml = [
|
|
70
70
|
"<!doctype html>",
|
|
71
71
|
'<html lang="en">',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ServerResponse } from "node:http";
|
|
2
|
-
import type { PlayerSetting } from "../../commands/config.ts";
|
|
2
|
+
import type { PlayerSetting } from "../../commands/config/dashboard.ts";
|
|
3
|
+
import { type PageTranslator } from "../../commands/shared/books/words.ts";
|
|
3
4
|
import type { Catalog } from "../../commands/shared/packages/catalog.ts";
|
|
4
|
-
import { type PageTranslator } from "../../commands/shared/page-words.ts";
|
|
5
5
|
import type { Context, Player, SystemTexts } from "../../core/context.ts";
|
|
6
6
|
import type { SessionStore } from "../../core/session-store.ts";
|
|
7
7
|
import { type Acts } from "../player-acts.ts";
|
|
@@ -5,10 +5,10 @@ import { connect } from "node:net";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { findCampaign } from "../../campaign/index.js";
|
|
7
7
|
import { importShown } from "../../commands/import/import.js";
|
|
8
|
+
import { systemTexts } from "../../commands/shared/books/system-texts.js";
|
|
9
|
+
import { pageTranslator } from "../../commands/shared/books/words.js";
|
|
8
10
|
import { loadCampaignCode } from "../../commands/shared/packages/code.js";
|
|
9
11
|
import { campaignWidgets, packageWidget } from "../../commands/shared/packages/widgets.js";
|
|
10
|
-
import { pageTranslator } from "../../commands/shared/page-words.js";
|
|
11
|
-
import { systemTexts } from "../../commands/shared/system-texts.js";
|
|
12
12
|
import { view } from "../../commands/view/view.js";
|
|
13
13
|
import { isBoolean } from "../../core/registry.js";
|
|
14
14
|
import { withFiles } from "../../core/store.js";
|
|
@@ -21,7 +21,7 @@ import { builtPage, packagePageFile, pageFile, pageHtml, pageModulesOf, pagePoli
|
|
|
21
21
|
import { act, deliverActs, keepProblems, listenForBell, notes, pageNews, setupWord, story } from "./news.js";
|
|
22
22
|
import { answerAsked, closeCard, listenForChanges, pagePlayer, pageSeen, rollNamesOf, spendShown } from "./player.js";
|
|
23
23
|
import { campaignPorts } from "./ports.js";
|
|
24
|
-
import { addPackage, catalogNow, changeLibrary, changePackage, changeSaves, changeSetting, engineNow, exportCampaign, exportedFile, libraryNow, packagesNow, runForPlayer } from "./writes.js";
|
|
24
|
+
import { addPackage, catalogNow, changeLibrary, changePackage, changeSaves, changeSetting, engineNow, exportCampaign, exportedFile, libraryNow, packagesNow, runForPlayer, takeLayerOff, } from "./writes.js";
|
|
25
25
|
export { campaignPorts, dashboardPorts } from "./ports.js";
|
|
26
26
|
// The commands the page may run: what the player may see, never the master's (VIEW-1). Roles will say more (phase 2).
|
|
27
27
|
const playerCommands = [view];
|
|
@@ -261,6 +261,10 @@ async function answer(request, response, served) {
|
|
|
261
261
|
await changeSaves(request, response, served);
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
+
if (request.method === "POST" && path === "/api/layer" && origin !== undefined) {
|
|
265
|
+
await takeLayerOff(request, response, served);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
264
268
|
if (path === "/api/words" && (request.method === "GET" || (request.method === "POST" && origin !== undefined))) {
|
|
265
269
|
await pageWords(request, response, served, url);
|
|
266
270
|
return;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { findCampaign, requireCampaign } from "../../campaign/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { campaignWorld } from "../../commands/shared/world.js";
|
|
3
|
+
import { playerSettings, setupQuestions, setupSettingNamed } from "../../commands/config/dashboard.js";
|
|
4
|
+
import { playerChangeNews } from "../../commands/config/news.js";
|
|
5
|
+
import { campaignWorld } from "../../commands/shared/campaign/world.js";
|
|
6
|
+
import { playerStory } from "../../commands/shared/characters/knowledge.js";
|
|
6
7
|
import { withFiles } from "../../core/store.js";
|
|
7
8
|
import { comparableText } from "../../core/text.js";
|
|
8
9
|
import { codexClient } from "../../helpers/index.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { findCampaign, readTextSetting } from "../../campaign/index.js";
|
|
6
|
-
import { campaignSystem } from "../../commands/shared/world.js";
|
|
6
|
+
import { campaignSystem } from "../../commands/shared/campaign/world.js";
|
|
7
7
|
import { playerWait } from "../../core/context.js";
|
|
8
8
|
import { withFiles } from "../../core/store.js";
|
|
9
9
|
import { rollName } from "../../systems/index.js";
|
|
@@ -19,6 +19,13 @@ export declare function changeSetting(request: IncomingMessage, response: Server
|
|
|
19
19
|
* mode of saves allows it or refuses it as in the chat, and starting over needs the campaign's name written. The master hears of it at their next call (D-359).
|
|
20
20
|
*/
|
|
21
21
|
export declare function changeSaves(request: IncomingMessage, response: ServerResponse, served: Served): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* A layer of the campaign the player takes off a page of the game system on the page (SYS-11), as write does with layer and reset, with the player as who did it;
|
|
24
|
+
* the master hears of it at their next call. Off any page the view lists, one the player may not read too (D-565); any other name gets one answer. Every
|
|
25
|
+
* page waits while a scene is open, whoever is in it: what derives from the page would change in the middle of it, and a refusal for its copies alone would
|
|
26
|
+
* tell what the scene holds (D-254).
|
|
27
|
+
*/
|
|
28
|
+
export declare function takeLayerOff(request: IncomingMessage, response: ServerResponse, served: Served): Promise<void>;
|
|
22
29
|
/**
|
|
23
30
|
* The packages as the page shows them (D-475): the game system, those on this computer with whether the campaign uses them, those it lists and lacks, what npm
|
|
24
31
|
* has when asked, and the one the player is working on now.
|
|
@@ -2,16 +2,21 @@ import { basename, join } from "node:path";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { readAdventureZip } from "../../adventures/index.js";
|
|
4
4
|
import { findCampaign, readSettings, readTextSetting, requireCampaign, settingNames } from "../../campaign/index.js";
|
|
5
|
-
import { config
|
|
6
|
-
import {
|
|
5
|
+
import { config } from "../../commands/config/config.js";
|
|
6
|
+
import { playerSettingNamed, playerSettings, setupSettingNamed } from "../../commands/config/dashboard.js";
|
|
7
|
+
import { isInstalledPackage } from "../../commands/package/here.js";
|
|
8
|
+
import { adventureText, packageCommand } from "../../commands/package/package.js";
|
|
7
9
|
import { playerSaveNews, save } from "../../commands/save.js";
|
|
8
|
-
import { installAdventure } from "../../commands/shared/adventures.js";
|
|
9
|
-
import { libraryContents, libraryEntries, startLibraryReading, unquoted } from "../../commands/shared/library.js";
|
|
10
|
-
import { campaignMode } from "../../commands/shared/mode.js";
|
|
10
|
+
import { installAdventure } from "../../commands/shared/books/adventures.js";
|
|
11
|
+
import { libraryContents, libraryEntries, startLibraryReading, unquoted } from "../../commands/shared/books/library.js";
|
|
12
|
+
import { campaignMode } from "../../commands/shared/campaign/mode.js";
|
|
13
|
+
import { exportsFolderName, resetPoints } from "../../commands/shared/campaign/saves.js";
|
|
14
|
+
import { campaignSystem, campaignWorld } from "../../commands/shared/campaign/world.js";
|
|
11
15
|
import { catalog } from "../../commands/shared/packages/catalog.js";
|
|
12
16
|
import { packageCommands } from "../../commands/shared/packages/code.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
17
|
+
import { readOpenScene } from "../../commands/shared/scene/scene.js";
|
|
18
|
+
import { listedLayer } from "../../commands/view/layers.js";
|
|
19
|
+
import { write } from "../../commands/write/write.js";
|
|
15
20
|
import { packagesFolder } from "../../core/context.js";
|
|
16
21
|
import { Refusal, refusalBody } from "../../core/refusal.js";
|
|
17
22
|
import { files, withFiles } from "../../core/store.js";
|
|
@@ -169,6 +174,42 @@ export async function changeSaves(request, response, served) {
|
|
|
169
174
|
sendJson(response, 400, { error: error instanceof Error ? error.message : String(error) });
|
|
170
175
|
}
|
|
171
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* A layer of the campaign the player takes off a page of the game system on the page (SYS-11), as write does with layer and reset, with the player as who did it;
|
|
179
|
+
* the master hears of it at their next call. Off any page the view lists, one the player may not read too (D-565); any other name gets one answer. Every
|
|
180
|
+
* page waits while a scene is open, whoever is in it: what derives from the page would change in the middle of it, and a refusal for its copies alone would
|
|
181
|
+
* tell what the scene holds (D-254).
|
|
182
|
+
*/
|
|
183
|
+
export async function takeLayerOff(request, response, served) {
|
|
184
|
+
const parsed = z.object({ page: z.string().trim().min(1).max(mostSaid) }).strict().safeParse(await readBody(request));
|
|
185
|
+
if (!parsed.success) {
|
|
186
|
+
sendJson(response, 400, { error: "Send the page of the game system whose change to take off: { page }." });
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
await served.session.ready();
|
|
191
|
+
const done = await withFiles(served.session, async () => {
|
|
192
|
+
const root = requireCampaign(served.context.folder);
|
|
193
|
+
const world = campaignWorld(root, served.context);
|
|
194
|
+
const page = listedLayer(world, parsed.data.page);
|
|
195
|
+
if (page === undefined) {
|
|
196
|
+
throw new Refusal(`The campaign changes no page of the game system named ${parsed.data.page}: reload the page.`, "no-layer", { page: parsed.data.page });
|
|
197
|
+
}
|
|
198
|
+
const open = readOpenScene(root);
|
|
199
|
+
// A scene that does not read counts as open.
|
|
200
|
+
if (open.scene !== undefined || open.problem !== undefined) {
|
|
201
|
+
throw new Refusal(`A scene is being played: take the campaign's change off ${page.name} once it is over.`, "scene-open", { page: page.name });
|
|
202
|
+
}
|
|
203
|
+
return await write.run(write.input.parse({ page: page.name, layer: true, reset: true }), { ...served.context, actor: "player" });
|
|
204
|
+
});
|
|
205
|
+
const followers = done.followers.length === 0 ? "" : ` What reads from it changed with it: ${done.followers.join(", ")}.`;
|
|
206
|
+
served.events.push(`The player, on the dashboard, took the campaign's change off ${done.page}: it reads as the system writes it again.${followers}`);
|
|
207
|
+
sendJson(response, 202, {});
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
sendJson(response, error instanceof Refusal && error.code === "scene-open" ? 409 : 400, refusalBody(error));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
172
213
|
/**
|
|
173
214
|
* The packages as the page shows them (D-475): the game system, those on this computer with whether the campaign uses them, those it lists and lacks, what npm
|
|
174
215
|
* has when asked, and the one the player is working on now.
|
package/dist/server/mcp.js
CHANGED
|
@@ -5,14 +5,14 @@ import { join } from "node:path";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { findCampaign, hasCharacterAgent, readTextSetting, refreshHostFiles } from "../campaign/index.js";
|
|
7
7
|
import { commands } from "../commands/index.js";
|
|
8
|
-
import { installCampaignSystem } from "../commands/package.js";
|
|
8
|
+
import { installCampaignSystem } from "../commands/package/install.js";
|
|
9
|
+
import { libraryRunner } from "../commands/shared/books/library-reader.js";
|
|
10
|
+
import { pagePhrase } from "../commands/shared/books/words.js";
|
|
11
|
+
import { outsideNews, whileClosedNews } from "../commands/shared/campaign/outside.js";
|
|
12
|
+
import { newChatText, wentBackTo } from "../commands/shared/campaign/saves.js";
|
|
13
|
+
import { campaignWorld } from "../commands/shared/campaign/world.js";
|
|
9
14
|
import { campaignExamples } from "../commands/shared/examples.js";
|
|
10
|
-
import { libraryRunner } from "../commands/shared/library-reader.js";
|
|
11
|
-
import { outsideNews, whileClosedNews } from "../commands/shared/outside.js";
|
|
12
15
|
import { packageCommands } from "../commands/shared/packages/code.js";
|
|
13
|
-
import { pagePhrase } from "../commands/shared/page-words.js";
|
|
14
|
-
import { newChatText, wentBackTo } from "../commands/shared/saves.js";
|
|
15
|
-
import { campaignWorld } from "../commands/shared/world.js";
|
|
16
16
|
import { systemConfirm } from "../confirm/index.js";
|
|
17
17
|
import { defaultContext, packagesFolder, playerWait } from "../core/context.js";
|
|
18
18
|
import { downloadBytes } from "../core/download.js";
|
|
@@ -312,6 +312,8 @@ async function runTool(command, input, context, extra, prepare, installer, outsi
|
|
|
312
312
|
: command.slow === true
|
|
313
313
|
? reportProgress(extra, () => "still working")
|
|
314
314
|
: undefined;
|
|
315
|
+
// Any call that waits for the campaign's system to install, as on a slow network, says so too (SYS-10).
|
|
316
|
+
const installing = keepAlive === undefined ? reportProgress(extra, () => "installing the campaign's game system", installer.busy) : undefined;
|
|
315
317
|
let news;
|
|
316
318
|
let changedOutside = [];
|
|
317
319
|
let installed = [];
|
|
@@ -360,6 +362,7 @@ async function runTool(command, input, context, extra, prepare, installer, outsi
|
|
|
360
362
|
}
|
|
361
363
|
finally {
|
|
362
364
|
clearInterval(keepAlive);
|
|
365
|
+
clearInterval(installing);
|
|
363
366
|
// An answer that never goes, as for a call the user stopped, gives what the player changed back to the next one, and its parts.
|
|
364
367
|
if (extra.signal.aborted) {
|
|
365
368
|
news?.restore();
|
|
@@ -386,13 +389,19 @@ function systemInstaller(context) {
|
|
|
386
389
|
const tried = new Set();
|
|
387
390
|
let untold = [];
|
|
388
391
|
let installing = Promise.resolve();
|
|
392
|
+
let waiting = 0;
|
|
389
393
|
return {
|
|
390
394
|
// One at a time: two calls at once wait for the same install.
|
|
391
|
-
install: () =>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
395
|
+
install: () => {
|
|
396
|
+
waiting++;
|
|
397
|
+
installing = installing.then(async () => {
|
|
398
|
+
// A campaign that does not read installs nothing: the call says why.
|
|
399
|
+
const line = await installCampaignSystem(context, tried).catch(() => undefined);
|
|
400
|
+
untold = line === undefined ? untold : [...untold, line];
|
|
401
|
+
}).finally(() => waiting--);
|
|
402
|
+
return installing;
|
|
403
|
+
},
|
|
404
|
+
busy: () => waiting > 0,
|
|
396
405
|
take: () => {
|
|
397
406
|
const lines = untold;
|
|
398
407
|
untold = [];
|
|
@@ -505,14 +514,20 @@ function formPlayer(server, unavailable) {
|
|
|
505
514
|
},
|
|
506
515
|
};
|
|
507
516
|
}
|
|
508
|
-
/**
|
|
509
|
-
|
|
517
|
+
/**
|
|
518
|
+
* Progress notifications while the player decides or a slow command works, when the host asked for them, saying what it waits for; only while `now` holds,
|
|
519
|
+
* when given. Undefined when the host asked for none.
|
|
520
|
+
*/
|
|
521
|
+
function reportProgress(extra, saying, now = () => true) {
|
|
510
522
|
const progressToken = extra._meta?.progressToken;
|
|
511
523
|
if (progressToken === undefined) {
|
|
512
524
|
return undefined;
|
|
513
525
|
}
|
|
514
526
|
let progress = 0;
|
|
515
527
|
return setInterval(() => {
|
|
528
|
+
if (!now()) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
516
531
|
void extra.sendNotification({ method: "notifications/progress", params: { progressToken, progress: ++progress, message: saying() } }).catch(() => undefined);
|
|
517
532
|
}, progressEvery);
|
|
518
533
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What campaign.yaml adds to the game system, as it writes it: checked when the system is read with it (CAM-3). */
|
|
2
|
+
export type CampaignData = Partial<Record<(typeof campaignDataNames)[number], unknown>>;
|
|
3
|
+
/** What an extension or the campaign adds to the game system (CAM-1, CAM-2): from where, as messages name it, and what. */
|
|
4
|
+
export interface SystemLayer {
|
|
5
|
+
from: string;
|
|
6
|
+
data: CampaignData;
|
|
7
|
+
}
|
|
8
|
+
/** What a campaign may add to its game system in campaign.yaml (CAM-1): its own fields, tables, formulas, counters, recipes, line of the player character and travel. */
|
|
9
|
+
export declare const campaignDataNames: readonly ["fields", "tables", "computed", "counters", "recipes", "status-line", "travel", "values", "condition-icons"];
|
|
10
|
+
/**
|
|
11
|
+
* A system's data with a campaign's additions over it (CAM-2): fields, tables, formulas and counters by name, the campaign's taking the place of the system's
|
|
12
|
+
* with that name; a recipe added to the system's of that name, field by field, with its occasions and rules; the line's fields after the system's; travel key
|
|
13
|
+
* by key, its paces, terrain, vehicles and kinds by name.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withCampaignData(raw: unknown, data: CampaignData): Record<string, unknown>;
|