rpg-engine 0.7.0 → 0.9.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/index.d.ts +1 -1
- package/dist/adventures/index.js +1 -1
- package/dist/adventures/source.js +13 -13
- package/dist/campaign/create-campaign.js +10 -1
- package/dist/campaign/host-files.d.ts +2 -1
- package/dist/campaign/host-files.js +11 -11
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +55 -64
- package/dist/campaign/settings.js +171 -174
- package/dist/{cli.js → cli/cli.js} +3 -3
- package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
- package/dist/{command-line.js → cli/command-line.js} +21 -20
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +7 -7
- package/dist/commands/ask.d.ts +1 -8
- package/dist/commands/ask.js +16 -29
- package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
- package/dist/commands/{change.js → change/change.js} +46 -52
- package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
- package/dist/commands/{game-damage.js → change/damage.js} +3 -3
- package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
- package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
- package/dist/commands/config.d.ts +4 -4
- package/dist/commands/config.js +142 -138
- package/dist/commands/effect.d.ts +1 -1
- package/dist/commands/effect.js +11 -12
- package/dist/commands/find.d.ts +4 -4
- package/dist/commands/find.js +2 -2
- package/dist/commands/image.js +6 -6
- package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
- package/dist/commands/{import.js → import/import.js} +101 -101
- package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
- package/dist/commands/{game-import.js → import/run.js} +13 -12
- package/dist/commands/index.js +7 -7
- package/dist/commands/init.js +3 -3
- 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 +13 -20
- package/dist/commands/package.d.ts +2 -2
- package/dist/commands/package.js +138 -93
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +29 -18
- package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
- package/dist/commands/{roll.js → roll/roll.js} +69 -69
- package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
- package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +17 -9
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/save.js +18 -18
- package/dist/commands/scene.d.ts +4 -4
- package/dist/commands/scene.js +31 -28
- package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
- package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
- package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
- package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
- package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
- package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
- package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
- package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
- package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
- package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
- package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
- package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
- package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
- package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
- package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
- package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
- package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
- package/dist/commands/{game-events.js → shared/events.js} +20 -22
- package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
- package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
- package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
- package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
- package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
- package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
- package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
- package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
- package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
- package/dist/commands/{game-images.js → shared/images.js} +7 -6
- package/dist/commands/shared/inputs.d.ts +9 -0
- package/dist/commands/shared/inputs.js +12 -0
- package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
- package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
- package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
- package/dist/commands/{game-knowledge.js → shared/knowledge.js} +56 -44
- package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
- package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
- package/dist/commands/{game-library.js → shared/library.js} +70 -50
- package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
- package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
- package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
- package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
- package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
- package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
- package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
- package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
- package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
- package/dist/commands/{game-money.js → shared/money.js} +4 -4
- package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
- package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
- package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
- package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
- package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
- package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
- package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
- package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
- package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
- package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
- package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
- package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
- package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
- package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
- package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
- package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
- package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
- package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
- package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
- package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
- package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
- package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
- package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
- package/dist/commands/{parts.js → shared/parts.js} +4 -4
- package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
- package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
- package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
- package/dist/commands/{problems.js → shared/problems.js} +21 -22
- package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
- package/dist/commands/{progression.js → shared/progression.js} +4 -4
- package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
- package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
- package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
- package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
- package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
- package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
- package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
- package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
- package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +13 -5
- package/dist/commands/shared/rules.js +66 -0
- package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
- package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
- package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
- package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
- package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
- package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
- package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
- package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
- package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
- package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
- package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
- package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
- package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
- package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
- package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
- package/dist/commands/{game-time.js → shared/time.js} +6 -6
- package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
- package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
- package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
- package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
- package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
- package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
- package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
- package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
- package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
- package/dist/commands/{game-world.js → shared/world.js} +72 -76
- package/dist/commands/show.d.ts +4 -1
- package/dist/commands/show.js +36 -18
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.js +28 -28
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +9 -10
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
- package/dist/commands/{game-open.js → travel/open.js} +4 -5
- package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
- package/dist/commands/{route.js → travel/route.js} +9 -10
- package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
- package/dist/commands/{travel.js → travel/travel.js} +19 -21
- package/dist/commands/validate.js +5 -5
- package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
- package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
- package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
- package/dist/commands/{game-view-map.js → view/map.js} +15 -16
- package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
- package/dist/commands/{game-view-place.js → view/place.js} +108 -108
- package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
- package/dist/commands/{view.js → view/view.js} +41 -36
- package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
- package/dist/commands/{game-view-world.js → view/world.js} +7 -7
- package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
- package/dist/commands/{game-here.js → write/here.js} +18 -12
- package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
- package/dist/commands/{write.js → write/write.js} +44 -41
- package/dist/confirm/confirm.d.ts +2 -0
- package/dist/confirm/confirm.js +15 -5
- package/dist/core/consents.d.ts +3 -2
- package/dist/core/consents.js +43 -4
- package/dist/core/context.d.ts +8 -6
- package/dist/core/context.js +4 -2
- package/dist/core/download.js +16 -5
- package/dist/core/files.d.ts +8 -1
- package/dist/core/files.js +53 -21
- package/dist/core/formula.d.ts +7 -2
- package/dist/core/formula.js +63 -66
- package/dist/core/instruction-parts.js +1 -1
- package/dist/core/mood.d.ts +0 -1
- package/dist/core/mood.js +3 -3
- package/dist/core/package-api.d.ts +11 -0
- package/dist/core/package-api.js +2 -1
- package/dist/core/package-declarations.d.ts +9 -9
- package/dist/core/package-declarations.js +3 -3
- package/dist/core/process-mark.d.ts +8 -0
- package/dist/core/process-mark.js +72 -0
- package/dist/core/registry.d.ts +5 -0
- package/dist/core/registry.js +10 -0
- package/dist/core/session-store.d.ts +0 -1
- package/dist/core/session-store.js +11 -14
- package/dist/core/store.d.ts +4 -0
- package/dist/core/store.js +29 -8
- package/dist/core/text.d.ts +4 -0
- package/dist/core/text.js +11 -2
- package/dist/core/yaml-file.js +2 -2
- package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
- package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
- package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
- package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
- package/dist/dashboard/app.js +13 -13
- package/dist/dashboard/asked.js +1 -1
- package/dist/dashboard/dice/burn.js +1 -1
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/game-words.js +4 -4
- package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
- package/dist/dashboard/{help.js → help/help.js} +6 -6
- package/dist/dashboard/journal.js +1 -1
- package/dist/dashboard/kit.js +6 -5
- package/dist/dashboard/labels.js +7 -3
- package/dist/dashboard/markdown.js +1 -1
- package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
- package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
- package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
- package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
- package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
- package/dist/dashboard/party.js +1 -1
- package/dist/dashboard/person-panel.js +2 -13
- package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
- package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
- package/dist/dashboard/scene.js +4 -4
- package/dist/dashboard/settings.js +1 -1
- package/dist/dashboard/sheet.js +4 -4
- package/dist/dashboard/text.js +6 -0
- package/dist/dashboard/top.js +2 -2
- package/dist/dashboard/turns.js +2 -2
- package/dist/dashboard/widgets.js +1 -1
- package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
- package/dist/dashboard/{lore.js → world/known.js} +1 -1
- package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
- package/dist/dashboard/{world-map.js → world/map.js} +1 -1
- package/dist/dashboard/{world.js → world/world.js} +14 -14
- package/dist/dice/evaluate.js +1 -1
- package/dist/dice/index.d.ts +2 -2
- package/dist/dice/index.js +2 -2
- package/dist/dice/notation.d.ts +2 -0
- package/dist/dice/notation.js +22 -4
- package/dist/documents/markup.js +2 -2
- package/dist/documents/read.js +29 -13
- package/dist/effects/effect.js +2 -5
- package/dist/extensions/extension.js +6 -8
- package/dist/extensions/index.d.ts +1 -4
- package/dist/extensions/index.js +1 -4
- package/dist/extensions/words.js +2 -1
- package/dist/{pictures → helpers}/briefs.js +17 -14
- package/dist/{pictures → helpers}/claude.js +8 -18
- package/dist/{pictures → helpers}/codex.js +3 -15
- package/dist/helpers/index.d.ts +7 -0
- package/dist/helpers/index.js +9 -0
- package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
- package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
- package/dist/images/images.js +7 -5
- package/dist/images/index.d.ts +1 -1
- package/dist/images/index.js +1 -1
- package/dist/importer/index.d.ts +1 -1
- package/dist/importer/index.js +1 -1
- package/dist/importer/work.d.ts +0 -2
- package/dist/importer/work.js +9 -30
- package/dist/instructions/index.d.ts +2 -0
- package/dist/instructions/index.js +10 -0
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/languages/language-pack.js +15 -3
- package/dist/library/books.js +29 -83
- package/dist/{extensions → packages}/engine.d.ts +1 -1
- package/dist/{extensions → packages}/engine.js +1 -1
- package/dist/packages/index.d.ts +3 -0
- package/dist/packages/index.js +4 -0
- package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
- package/dist/{extensions/packages.js → packages/npm.js} +74 -45
- package/dist/page.d.ts +9 -11
- package/dist/page.js +1 -2
- package/dist/pages/check.js +31 -40
- package/dist/pages/containers.js +20 -20
- package/dist/pages/environment.js +15 -15
- package/dist/pages/index.d.ts +9 -9
- package/dist/pages/index.js +9 -9
- package/dist/pages/inheritance.d.ts +2 -1
- package/dist/pages/inheritance.js +24 -24
- package/dist/pages/load.js +7 -7
- package/dist/pages/maps.d.ts +20 -0
- package/dist/pages/maps.js +51 -1
- package/dist/pages/markdown.d.ts +2 -0
- package/dist/pages/markdown.js +110 -79
- package/dist/pages/page-file.d.ts +2 -1
- package/dist/pages/page-file.js +31 -29
- package/dist/pages/rename-page.d.ts +4 -1
- package/dist/pages/rename-page.js +7 -3
- package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
- package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
- package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
- package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
- package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
- package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
- package/dist/pages/system-pages.js +15 -15
- package/dist/pages/world.d.ts +4 -0
- package/dist/pages/world.js +52 -20
- package/dist/pages/write-page.js +35 -34
- package/dist/player-notes/index.d.ts +1 -1
- package/dist/player-notes/index.js +1 -1
- package/dist/rules/page-search.js +3 -4
- package/dist/rules/rule-book.js +1 -1
- package/dist/rules/search.js +21 -21
- package/dist/rules/shown.js +1 -3
- package/dist/saves/saves.d.ts +2 -2
- package/dist/saves/saves.js +15 -3
- package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
- package/dist/server/dashboard/files.d.ts +59 -0
- package/dist/server/dashboard/files.js +326 -0
- package/dist/server/dashboard/index.d.ts +114 -0
- package/dist/server/dashboard/index.js +419 -0
- package/dist/server/dashboard/news.d.ts +39 -0
- package/dist/server/dashboard/news.js +390 -0
- package/dist/server/dashboard/player.d.ts +48 -0
- package/dist/server/dashboard/player.js +242 -0
- package/dist/server/dashboard/ports.d.ts +10 -0
- package/dist/server/dashboard/ports.js +15 -0
- package/dist/server/dashboard/writes.d.ts +58 -0
- package/dist/server/dashboard/writes.js +492 -0
- package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
- package/dist/{mcp-server.js → server/mcp.js} +57 -42
- package/dist/systems/game-system.d.ts +5 -3
- package/dist/systems/game-system.js +178 -149
- package/dist/systems/index.d.ts +1 -1
- package/dist/systems/index.js +1 -1
- package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
- package/dist/{testing.js → testing/index.js} +32 -18
- package/dist/{system-checks.js → testing/system-checks.js} +18 -12
- package/dist/themes/theme.d.ts +3 -3
- package/dist/themes/theme.js +14 -14
- package/dist/time/calendar.js +5 -2
- package/dist/triggers/trigger.js +5 -8
- package/instructions/dashboard-guide.md +2 -1
- package/instructions/play.md +1 -1
- package/package.json +5 -5
- package/dist/commands/game-maps.d.ts +0 -20
- package/dist/commands/game-maps.js +0 -51
- package/dist/commands/game-rules.js +0 -36
- package/dist/dashboard-server.d.ts +0 -47
- package/dist/dashboard-server.js +0 -1830
- package/dist/pictures/index.d.ts +0 -7
- package/dist/pictures/index.js +0 -9
- /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
- /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
- /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
- /package/dist/commands/{notes.js → shared/notes.js} +0 -0
- /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
- /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
- /package/dist/dashboard/{people.js → packages/people.js} +0 -0
- /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
- /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
- /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.js +0 -0
- /package/dist/{pictures → helpers}/claude.d.ts +0 -0
- /package/dist/{pictures → helpers}/codex.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.js +0 -0
- /package/dist/{pictures → helpers}/svg.d.ts +0 -0
- /package/dist/{pictures → helpers}/svg.js +0 -0
- /package/dist/{extensions → packages}/tarball.d.ts +0 -0
- /package/dist/{extensions → packages}/tarball.js +0 -0
- /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
- /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
- /package/dist/{player-acts.js → server/player-acts.js} +0 -0
- /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
|
@@ -12,38 +12,40 @@ import { join } from "node:path";
|
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
13
13
|
import { parse, stringify } from "yaml";
|
|
14
14
|
import { z } from "zod";
|
|
15
|
-
import { campaignFileName, findCampaign, readTextSetting, requireCampaign } from "
|
|
16
|
-
import { installedFromFolder, realPath } from "
|
|
17
|
-
import { parseFormula } from "
|
|
18
|
-
import { appendLogEntry } from "
|
|
19
|
-
import { defineCommand } from "
|
|
20
|
-
import { files } from "
|
|
21
|
-
import { sameName, sameWord, valueNamed } from "
|
|
22
|
-
import { getVersion } from "
|
|
23
|
-
import { readCounter } from "
|
|
24
|
-
import { rollDice } from "
|
|
25
|
-
import { withEffect } from "
|
|
26
|
-
import { wordIn } from "
|
|
27
|
-
import { concernsPlayer, environmentAt, isInParty, isPartyMember, isPlayerCharacter, locate, pagesWithNameOrAlias, playerCharacters } from "
|
|
28
|
-
import { givenCode, loadSystemCode, systemHasCode, systemPackage, systemPageModule } from "
|
|
29
|
-
import { formatGameDate } from "
|
|
30
|
-
import { askedRoll, isCheckDice, tonesOf } from "
|
|
31
|
-
import { change } from "
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { behindTheScreen, sealHiddenRoll } from "
|
|
36
|
-
import { keepingConditionNote } from "
|
|
37
|
-
import { readOpenScene } from "
|
|
38
|
-
import { calendarDayOf, newDatedLogEntry, presentDate } from "
|
|
39
|
-
import {
|
|
40
|
-
import { campaignSystem, campaignSystemWords, campaignWorld } from "
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
15
|
+
import { campaignFileName, findCampaign, readTextSetting, requireCampaign } from "../../../campaign/index.js";
|
|
16
|
+
import { installedFromFolder, realPath } from "../../../core/files.js";
|
|
17
|
+
import { parseFormula } from "../../../core/formula.js";
|
|
18
|
+
import { appendLogEntry } from "../../../core/log.js";
|
|
19
|
+
import { commandLineFieldProblem, defineCommand } from "../../../core/registry.js";
|
|
20
|
+
import { files } from "../../../core/store.js";
|
|
21
|
+
import { sameName, sameWord, valueNamed } from "../../../core/text.js";
|
|
22
|
+
import { getVersion } from "../../../core/version.js";
|
|
23
|
+
import { readCounter } from "../../../counters/index.js";
|
|
24
|
+
import { rollDice } from "../../../dice/index.js";
|
|
25
|
+
import { withEffect } from "../../../effects/index.js";
|
|
26
|
+
import { wordIn } from "../../../extensions/index.js";
|
|
27
|
+
import { carriesNamed, concernsPlayer, environmentAt, isInParty, isPartyMember, isPlayerCharacter, locate, pagesWithNameOrAlias, playerCharacters } from "../../../pages/index.js";
|
|
28
|
+
import { givenCode, loadSystemCode, systemHasCode, systemPackage, systemPageModule } from "../../../systems/index.js";
|
|
29
|
+
import { formatGameDate } from "../../../time/index.js";
|
|
30
|
+
import { askedRoll, isCheckDice, tonesOf } from "../../ask.js";
|
|
31
|
+
import { change } from "../../change/change.js";
|
|
32
|
+
import { writePackageFields } from "../../write/write.js";
|
|
33
|
+
import { effectiveFields, effectsOf } from "../effect-layer.js";
|
|
34
|
+
import { checkEffectsReadable, saveEffects } from "../effects.js";
|
|
35
|
+
import { behindTheScreen, sealHiddenRoll } from "../master-rolls.js";
|
|
36
|
+
import { keepingConditionNote } from "../reminders.js";
|
|
37
|
+
import { readOpenScene } from "../scene.js";
|
|
38
|
+
import { calendarDayOf, newDatedLogEntry, presentDate } from "../time.js";
|
|
39
|
+
import { formulaValue } from "../worked-out.js";
|
|
40
|
+
import { campaignSystem, campaignSystemWords, campaignWorld } from "../world.js";
|
|
41
|
+
import { campaignExtensions, packageWords, runsCode } from "./extensions.js";
|
|
42
|
+
import { widgetCard } from "./widgets.js";
|
|
43
43
|
/** The folder of the campaign where a package keeps its own files, its state among them (D-433, D-436): an extension's, or its game system's. */
|
|
44
|
-
|
|
44
|
+
const extensionsFolderName = "extensions";
|
|
45
45
|
/** The longest description a command of a package may give the master, in words (D-441): it is read in every chat. */
|
|
46
46
|
const descriptionWords = 150;
|
|
47
|
+
// The longest a package's timePassed may take, a question to the player included: past it, or after the call is stopped, the time has passed all the same.
|
|
48
|
+
const longestPackageWait = 10 * 60 * 1000;
|
|
47
49
|
/** The packages that bring code to the campaign (D-514): its game system first, then its extensions in the order campaign.yaml lists them. */
|
|
48
50
|
export function campaignPackages(root, context) {
|
|
49
51
|
const system = campaignSystemPackage(root, context);
|
|
@@ -62,7 +64,8 @@ export function packageLabel(code) {
|
|
|
62
64
|
* The commands of the campaign's packages whose code may run (D-63, D-428, D-441), as commands of rpg-engine: each runs with the game of D-436 and gives the
|
|
63
65
|
* master its text; by name, the package and version that give it, so that a server knows when another takes its place.
|
|
64
66
|
*/
|
|
65
|
-
export async function packageCommands(root, context
|
|
67
|
+
export async function packageCommands(root, context) {
|
|
68
|
+
const taken = await engineCommandNames();
|
|
66
69
|
const commands = [];
|
|
67
70
|
const sources = {};
|
|
68
71
|
const problems = [];
|
|
@@ -85,7 +88,8 @@ export async function packageCommands(root, context, taken) {
|
|
|
85
88
|
return { commands, sources, problems };
|
|
86
89
|
}
|
|
87
90
|
/** The names of a package's commands, its code loaded and checked as the campaign would use it; it throws what keeps it from being used. */
|
|
88
|
-
export async function packageCommandNames(code, context
|
|
91
|
+
export async function packageCommandNames(code, context) {
|
|
92
|
+
const taken = await engineCommandNames();
|
|
89
93
|
const names = [];
|
|
90
94
|
for (const command of (await packageCode(code, context))?.commands ?? []) {
|
|
91
95
|
names.push(asCommand(code, command, [...taken, ...names]).name);
|
|
@@ -97,8 +101,8 @@ export function packagesInstalled() {
|
|
|
97
101
|
installs += 1;
|
|
98
102
|
}
|
|
99
103
|
/** What keeps the code of the campaign's packages from being used, for validate and status: it loads them. */
|
|
100
|
-
export async function packageCodeProblems(root, context
|
|
101
|
-
return (await packageCommands(root, context
|
|
104
|
+
export async function packageCodeProblems(root, context) {
|
|
105
|
+
return [...(await packageCommands(root, context)).problems, ...packageStateProblems(root, context)];
|
|
102
106
|
}
|
|
103
107
|
/**
|
|
104
108
|
* What the campaign's packages say after time passed from one date to another, or as the game starts, when both are the same (D-436). The time has passed
|
|
@@ -110,12 +114,22 @@ export async function timePassedLines(root, context, from, to) {
|
|
|
110
114
|
try {
|
|
111
115
|
const given = await packageCode(code, context);
|
|
112
116
|
if (given?.timePassed !== undefined) {
|
|
113
|
-
|
|
117
|
+
// Its own stop, which the cap and the call's own stop both give: past either, its game writes nothing more.
|
|
118
|
+
const own = new AbortController();
|
|
119
|
+
const signal = context.signal === undefined ? own.signal : AbortSignal.any([context.signal, own.signal]);
|
|
120
|
+
const game = gameOf(root, { ...context, signal }, code);
|
|
121
|
+
const said = await withinCall(given.timePassed({ from: momentOf(root, context, from), to: momentOf(root, context, to) }, game), signal, () => own.abort());
|
|
122
|
+
if (said !== undefined && (!Array.isArray(said) || !said.every((line) => typeof line === "string"))) {
|
|
123
|
+
throw new Error("its timePassed gave no list of lines, which is what it gives");
|
|
124
|
+
}
|
|
125
|
+
lines.push(...cappedLines(code, (said ?? [])));
|
|
114
126
|
}
|
|
115
127
|
}
|
|
116
128
|
catch (error) {
|
|
117
|
-
// One line: the master reads it among others.
|
|
118
|
-
lines.push(
|
|
129
|
+
// One line: the master reads it among others; a call the player stopped is no fault of the package's.
|
|
130
|
+
lines.push(error instanceof StoppedCall
|
|
131
|
+
? `The ${packageLabel(code)} gave nothing before the call was stopped. The time did pass: do not advance again.`
|
|
132
|
+
: `The ${packageLabel(code)} failed after the time passed: ${firstLine(error)}. The time did pass: do not advance again; validate says how to fix it.`);
|
|
119
133
|
}
|
|
120
134
|
}
|
|
121
135
|
return lines;
|
|
@@ -162,7 +176,7 @@ export async function loadCampaignCode(context) {
|
|
|
162
176
|
try {
|
|
163
177
|
const root = findCampaign(context.folder);
|
|
164
178
|
if (root !== undefined) {
|
|
165
|
-
await packageCommands(root, context
|
|
179
|
+
await packageCommands(root, context);
|
|
166
180
|
}
|
|
167
181
|
}
|
|
168
182
|
catch {
|
|
@@ -192,9 +206,6 @@ export async function loadNewSystemCode(context) {
|
|
|
192
206
|
await loadCampaignCode(context);
|
|
193
207
|
}
|
|
194
208
|
}
|
|
195
|
-
/** The most a package says in one call, after the engine's writes or as time passes, in lines and in characters; what is more is cut, with a line. */
|
|
196
|
-
const mostLines = 5;
|
|
197
|
-
const mostCharacters = 600;
|
|
198
209
|
/** A package's lines for the master, cut at the most it may say in one call, with a line that says so. */
|
|
199
210
|
export function cappedLines(code, lines) {
|
|
200
211
|
const kept = [];
|
|
@@ -208,10 +219,6 @@ export function cappedLines(code, lines) {
|
|
|
208
219
|
}
|
|
209
220
|
return kept;
|
|
210
221
|
}
|
|
211
|
-
/** A package that is an extension. */
|
|
212
|
-
export function isExtension(code) {
|
|
213
|
-
return code.kind === "extension";
|
|
214
|
-
}
|
|
215
222
|
/**
|
|
216
223
|
* The game as a package's code reaches it (D-436, D-505, D-514): what a widget reads, the dice, asking the player, its own state, the fields it may write and
|
|
217
224
|
* the log; nothing else is written. A command's or time's game writes nothing once the call is stopped (ASK-9); a hook's finishes what the engine began.
|
|
@@ -248,10 +255,11 @@ export function gameOf(root, context, code, options = {}) {
|
|
|
248
255
|
},
|
|
249
256
|
change: (page, field, amount, why) => {
|
|
250
257
|
live();
|
|
251
|
-
|
|
252
|
-
|
|
258
|
+
// By, to or spend alone, as the kit's types say: never a recipe or faces, which code written by hand could slip in.
|
|
259
|
+
const { by, to, spend } = amount;
|
|
260
|
+
const result = change.run(change.input.parse({ page, field, by, to, spend, why }), context);
|
|
253
261
|
if (result instanceof Promise) {
|
|
254
|
-
throw new Error("game.change changes a counter or money at once: give it by, to or spend
|
|
262
|
+
throw new Error("game.change changes a counter or money at once: give it by, to or spend. Nothing changed.");
|
|
255
263
|
}
|
|
256
264
|
return change.format(result);
|
|
257
265
|
},
|
|
@@ -265,7 +273,7 @@ export function gameOf(root, context, code, options = {}) {
|
|
|
265
273
|
const { who, question, check, notation } = wanted;
|
|
266
274
|
const told = toldOf(root, context, code, wanted, who);
|
|
267
275
|
asked.card = told.card ?? asked.card;
|
|
268
|
-
return askedOf(await askedRoll(root, context, askedQuestion(packageText(root, code, question), check, notation), [{ label: check.trim(), notation }], who, told));
|
|
276
|
+
return askedOf(await askedRoll(root, context, askedQuestion(packageText(root, code, question), check, notation), [{ label: packageText(root, code, check.trim()), notation }], who, told));
|
|
269
277
|
})();
|
|
270
278
|
},
|
|
271
279
|
state: {
|
|
@@ -323,7 +331,7 @@ export function gameViewOf(root, context, code) {
|
|
|
323
331
|
setting: (name) => readTextSetting(root, name),
|
|
324
332
|
// A name in the campaign's language is the system's by its words, Prono its Prone (D-403).
|
|
325
333
|
sameName: (one, other) => sameWord(one, other, campaignSystemWords(root, context)),
|
|
326
|
-
state: { read: () =>
|
|
334
|
+
state: { read: () => readPackageState(root, code) },
|
|
327
335
|
};
|
|
328
336
|
}
|
|
329
337
|
/**
|
|
@@ -351,6 +359,26 @@ export function toldOf(root, context, code, wanted, who) {
|
|
|
351
359
|
export function firstLine(error) {
|
|
352
360
|
return (error instanceof Error ? error.message : String(error)).split("\n")[0].replace(/[:.]$/, "");
|
|
353
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* A system's code as the engine loaded it, or why it is not there: not loaded, loaded at another version than the one installed now, refused or broken; undefined
|
|
364
|
+
* when it brings none.
|
|
365
|
+
*/
|
|
366
|
+
/** Whether a package's code is refused, as another's without the player's yes, one made for another API or with commands refused: said once, not at each call. */
|
|
367
|
+
export function codeRefused(code, context) {
|
|
368
|
+
const loaded = context.systemCode?.[code.name];
|
|
369
|
+
return isExtension(code) ? refused.has(codeKey(code)) : loaded !== undefined && "refused" in loaded;
|
|
370
|
+
}
|
|
371
|
+
/** The names of rpg-engine's own commands, which no package's command may take; read when needed, as the list of commands holds this module. */
|
|
372
|
+
async function engineCommandNames() {
|
|
373
|
+
return (await import("../../index.js")).commands.map((command) => command.name);
|
|
374
|
+
}
|
|
375
|
+
/** The most a package says in one call, after the engine's writes or as time passes, in lines and in characters; what is more is cut, with a line. */
|
|
376
|
+
const mostLines = 5;
|
|
377
|
+
const mostCharacters = 600;
|
|
378
|
+
/** A package that is an extension. */
|
|
379
|
+
function isExtension(code) {
|
|
380
|
+
return code.kind === "extension";
|
|
381
|
+
}
|
|
354
382
|
function systemCodePackage(system) {
|
|
355
383
|
const own = systemPackage(system.folder);
|
|
356
384
|
const page = systemPageModule(system.folder);
|
|
@@ -371,6 +399,7 @@ function systemCodePackage(system) {
|
|
|
371
399
|
}
|
|
372
400
|
/** A command of a package as a command of rpg-engine, refused when its name is not the package's or is taken, or its description is too long. */
|
|
373
401
|
function asCommand(code, command, taken) {
|
|
402
|
+
checkCommandShape(command);
|
|
374
403
|
const name = command.name.trim();
|
|
375
404
|
const words = command.description.split(/\s+/).length;
|
|
376
405
|
if (name !== code.name && !name.startsWith(`${code.name}-`)) {
|
|
@@ -395,7 +424,11 @@ function asCommand(code, command, taken) {
|
|
|
395
424
|
const campaign = requireCampaign(called.folder);
|
|
396
425
|
const asked = {};
|
|
397
426
|
try {
|
|
398
|
-
|
|
427
|
+
const text = await command.run(input, gameOf(campaign, called, code, { asked }));
|
|
428
|
+
if (typeof text !== "string") {
|
|
429
|
+
throw new Error(`The extension ${code.package}'s command ${name} gave no text: a command gives the master its answer as text. Tell its author.`);
|
|
430
|
+
}
|
|
431
|
+
return { text };
|
|
399
432
|
}
|
|
400
433
|
finally {
|
|
401
434
|
// The card of its last question, as it is after the dice, read once the call ends, however it ends (D-507).
|
|
@@ -407,6 +440,57 @@ function asCommand(code, command, taken) {
|
|
|
407
440
|
format: (result) => result.text,
|
|
408
441
|
});
|
|
409
442
|
}
|
|
443
|
+
/** A call the player stopped while a package's code had not answered. */
|
|
444
|
+
class StoppedCall extends Error {
|
|
445
|
+
}
|
|
446
|
+
/** What a package's code gives, unless the call is stopped first or it takes longer than any answer of the player's should: then why not. */
|
|
447
|
+
async function withinCall(work, signal, giveUp) {
|
|
448
|
+
// Never a rejection that nothing handles, when it ends after the call went on without it.
|
|
449
|
+
Promise.resolve(work).catch(() => undefined);
|
|
450
|
+
let timer;
|
|
451
|
+
let abort = () => undefined;
|
|
452
|
+
const stopped = new Promise((_, refuse) => {
|
|
453
|
+
timer = setTimeout(() => {
|
|
454
|
+
refuse(new Error(`it gave nothing for ${longestPackageWait / 60_000} minutes`));
|
|
455
|
+
giveUp();
|
|
456
|
+
}, longestPackageWait);
|
|
457
|
+
abort = () => refuse(new StoppedCall("the call was stopped before it gave anything"));
|
|
458
|
+
if (signal?.aborted === true) {
|
|
459
|
+
abort();
|
|
460
|
+
}
|
|
461
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
462
|
+
});
|
|
463
|
+
try {
|
|
464
|
+
return await Promise.race([Promise.resolve(work), stopped]);
|
|
465
|
+
}
|
|
466
|
+
finally {
|
|
467
|
+
clearTimeout(timer);
|
|
468
|
+
signal?.removeEventListener("abort", abort);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/** A package's command as its code must give it, for an author who writes it by hand: refused with the shape it takes. */
|
|
472
|
+
function checkCommandShape(command) {
|
|
473
|
+
const given = command;
|
|
474
|
+
const name = typeof given.name === "string" ? given.name.trim() : "";
|
|
475
|
+
if (name === "") {
|
|
476
|
+
throw new Error("a command has no name: give each command a name, the package's or one starting with it");
|
|
477
|
+
}
|
|
478
|
+
if (typeof given.description !== "string" || given.description.trim() === "") {
|
|
479
|
+
throw new Error(`its command ${name} has no description: give it one, written for an AI`);
|
|
480
|
+
}
|
|
481
|
+
if (!(given.input instanceof z.ZodObject)) {
|
|
482
|
+
throw new Error(`its command ${name} gives its input in another shape: give it as z.object({...}), with the z the kit gives`);
|
|
483
|
+
}
|
|
484
|
+
if (typeof given.run !== "function") {
|
|
485
|
+
throw new Error(`its command ${name} has no run: give it run(input, game), which gives its answer as text`);
|
|
486
|
+
}
|
|
487
|
+
// A field the command line would read as something else is refused at once, never lost when the command runs.
|
|
488
|
+
const positionals = Array.isArray(given.positionals) ? given.positionals : [];
|
|
489
|
+
const problem = Object.keys(given.input.shape).map((field) => commandLineFieldProblem(`its command ${name}`, field, positionals.includes(field))).find((found) => found !== undefined);
|
|
490
|
+
if (problem !== undefined) {
|
|
491
|
+
throw new Error(problem.replace(/: rename it\.$/, ": rename it"));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
410
494
|
// The code of each extension, by its file and version, loaded once for the process: an import is never undone, a new version is another. What each gave,
|
|
411
495
|
// once loaded, is kept apart too, for the hooks the commands call at once.
|
|
412
496
|
const loaded = new Map();
|
|
@@ -435,15 +519,6 @@ function extensionCode(extension) {
|
|
|
435
519
|
function codeKey(code) {
|
|
436
520
|
return `${code.package}@${code.version}#${installs}`;
|
|
437
521
|
}
|
|
438
|
-
/**
|
|
439
|
-
* A system's code as the engine loaded it, or why it is not there: not loaded, loaded at another version than the one installed now, refused or broken; undefined
|
|
440
|
-
* when it brings none.
|
|
441
|
-
*/
|
|
442
|
-
/** Whether a package's code is refused, as another's without the player's yes, one made for another API or with commands refused: said once, not at each call. */
|
|
443
|
-
export function codeRefused(code, context) {
|
|
444
|
-
const loaded = context.systemCode?.[code.name];
|
|
445
|
-
return isExtension(code) ? refused.has(codeKey(code)) : loaded !== undefined && "refused" in loaded;
|
|
446
|
-
}
|
|
447
522
|
function systemCode(code, context) {
|
|
448
523
|
if (!systemHasCode(code.folder)) {
|
|
449
524
|
return undefined;
|
|
@@ -478,6 +553,27 @@ function momentOf(root, context, date) {
|
|
|
478
553
|
function statePath(root, code) {
|
|
479
554
|
return join(root, extensionsFolderName, code.name, "state.yaml");
|
|
480
555
|
}
|
|
556
|
+
/** A package's state as its code reads it; it throws, naming the file and how to fix it, when the file does not read. */
|
|
557
|
+
function readPackageState(root, code) {
|
|
558
|
+
const read = parsedState(root, code);
|
|
559
|
+
if (read.problem !== undefined) {
|
|
560
|
+
throw new Error(`${read.problem.path} does not read: ${read.problem.message} Fix: ${read.problem.fix}.`);
|
|
561
|
+
}
|
|
562
|
+
return read.value;
|
|
563
|
+
}
|
|
564
|
+
/** The packages' state files that do not read, which only their code reads, for validate. */
|
|
565
|
+
function packageStateProblems(root, context) {
|
|
566
|
+
return campaignPackages(root, context).flatMap((code) => parsedState(root, code).problem ?? []);
|
|
567
|
+
}
|
|
568
|
+
function parsedState(root, code) {
|
|
569
|
+
try {
|
|
570
|
+
return { value: parse(files().text(statePath(root, code)) ?? "null") };
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
const fix = `correct it by hand, or delete it for the ${packageLabel(code)} to start its state again`;
|
|
574
|
+
return { problem: { path: `${extensionsFolderName}/${code.name}/state.yaml`, message: `${firstLine(error)}.`, fix } };
|
|
575
|
+
}
|
|
576
|
+
}
|
|
481
577
|
/**
|
|
482
578
|
* A page as a package reads it (D-505): in the party or not, the player's or not, its fields as show gives them, effects and what the system works out included;
|
|
483
579
|
* an effect it has by the system's name or its word in the campaign's language (D-403).
|
|
@@ -494,6 +590,7 @@ function gamePage(world, page, words) {
|
|
|
494
590
|
return counter === undefined ? undefined : { value: counter.value, ...(counter.max === undefined ? {} : { max: counter.max }) };
|
|
495
591
|
},
|
|
496
592
|
has: (effect) => effectsOf(page).some((one) => sameWord(effect, one.name, words)),
|
|
593
|
+
carries: (thing) => carriesNamed(world, page, thing, (one, other) => sameWord(one, other, words)),
|
|
497
594
|
formula: (text) => {
|
|
498
595
|
let formula;
|
|
499
596
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { InstructionPart } from "
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
import type
|
|
6
|
-
import { type GameSystem } from "
|
|
1
|
+
import type { Context } from "../../../core/context.ts";
|
|
2
|
+
import type { InstructionPart } from "../../../core/instruction-parts.ts";
|
|
3
|
+
import type { FigureSize } from "../../../core/package-api.ts";
|
|
4
|
+
import type { Problem } from "../../../core/problem.ts";
|
|
5
|
+
import { type CodePackage, type Extension, type ExtensionWords } from "../../../extensions/index.ts";
|
|
6
|
+
import { type GameSystem } from "../../../systems/index.ts";
|
|
7
7
|
/** The extensions the campaign uses, and what keeps one from being used, with how to fix it. */
|
|
8
8
|
export interface CampaignExtensions {
|
|
9
9
|
extensions: Extension[];
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// The extensions a campaign uses (D-27, D-28, D-427): those campaign.yaml lists, as installed, and their parts of the instructions over the system's (D-121).
|
|
2
2
|
import { basename, join, resolve } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { campaignFileName, readOneSetting, readTextSetting } from "
|
|
5
|
-
import { packageCodeMayRun } from "
|
|
6
|
-
import { updateEngine } from "
|
|
7
|
-
import { files, isInside } from "
|
|
8
|
-
import { comparableText } from "
|
|
9
|
-
import { extensionWords, findExtension, hasConsent
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { campaignFileName, readOneSetting, readTextSetting } from "../../../campaign/index.js";
|
|
5
|
+
import { packageCodeMayRun } from "../../../core/consents.js";
|
|
6
|
+
import { updateEngine } from "../../../core/package-declarations.js";
|
|
7
|
+
import { files, isInside } from "../../../core/store.js";
|
|
8
|
+
import { comparableText } from "../../../core/text.js";
|
|
9
|
+
import { extensionWords, findExtension, hasConsent } from "../../../extensions/index.js";
|
|
10
|
+
import { isVerified } from "../../../packages/index.js";
|
|
11
|
+
import { isCoreField } from "../../../pages/index.js";
|
|
12
|
+
import { layeredSystemWords, systemApiProblem, systemContentFolders, systemPageModule, systemWords } from "../../../systems/index.js";
|
|
12
13
|
/**
|
|
13
14
|
* The extensions campaign.yaml lists (D-27), each as installed on this computer, in the order written: the nearest layer last. One not installed, that does not
|
|
14
15
|
* read, that needs another game system or has the name of another is left out, with its problem: the campaign plays without it.
|
|
@@ -26,7 +27,8 @@ export function extensionSources(root, context) {
|
|
|
26
27
|
export function listedExtensions(root) {
|
|
27
28
|
try {
|
|
28
29
|
const listed = readOneSetting(root, "extensions");
|
|
29
|
-
|
|
30
|
+
// A version written as a number, as 1.0, is the version all the same.
|
|
31
|
+
return z.record(z.string(), z.union([z.string(), z.number().transform(String)])).safeParse(listed).data ?? {};
|
|
30
32
|
}
|
|
31
33
|
catch {
|
|
32
34
|
return {};
|
|
@@ -82,19 +84,6 @@ export function campaignPageModules(root, context, system) {
|
|
|
82
84
|
}]);
|
|
83
85
|
return [...systems, ...extensions];
|
|
84
86
|
}
|
|
85
|
-
/** A package's words in the campaign's language, when it is written in another; none when they are not there or do not read, which validate says. */
|
|
86
|
-
function wordsIn(language, own, read) {
|
|
87
|
-
if (language === undefined || language.split("-")[0] === own.split("-")[0]) {
|
|
88
|
-
return {};
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const words = read();
|
|
92
|
-
return words === undefined || Object.keys(words).length === 0 ? {} : { words };
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
return {};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
87
|
/** The address the dashboard serves a package's page module at: by the package's name and version, its folder's files beside it. */
|
|
99
88
|
export function pageAddress(name, version, file) {
|
|
100
89
|
return `/pkg/${encodeURIComponent(name)}/${encodeURIComponent(version)}/${encodeURIComponent(basename(file))}`;
|
|
@@ -121,6 +110,19 @@ export function extensionsLine(root, context) {
|
|
|
121
110
|
const { extensions } = campaignExtensions(root, context);
|
|
122
111
|
return extensions.length === 0 ? "" : `Extensions: ${extensions.map((extension) => `${extension.name} (${extension.about})`).join("; ")}.`;
|
|
123
112
|
}
|
|
113
|
+
/** A package's words in the campaign's language, when it is written in another; none when they are not there or do not read, which validate says. */
|
|
114
|
+
function wordsIn(language, own, read) {
|
|
115
|
+
if (language === undefined || language.split("-")[0] === own.split("-")[0]) {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const words = read();
|
|
120
|
+
return words === undefined || Object.keys(words).length === 0 ? {} : { words };
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
124
126
|
/** The fields of the core an extension declares among its fields or counters, which no extension may declare (D-505). */
|
|
125
127
|
function coreFieldsOf(extension) {
|
|
126
128
|
return [...Object.keys(extension.adds.fields ?? {}), ...Object.keys(extension.adds.counters ?? {})].filter(isCoreField);
|
|
@@ -129,6 +131,14 @@ function readCampaignExtensions(root, context) {
|
|
|
129
131
|
const extensions = [];
|
|
130
132
|
const problems = [];
|
|
131
133
|
const system = readTextSetting(root, "system");
|
|
134
|
+
// A list written by hand, or a map that does not read, would leave the campaign without its extensions in silence.
|
|
135
|
+
if (extensionsUnread(root)) {
|
|
136
|
+
problems.push({
|
|
137
|
+
path: campaignFileName,
|
|
138
|
+
message: 'extensions in campaign.yaml does not read: it is a map of each package and its version, such as "@rpgengine/weather": "0.2.3"; the campaign plays without them.',
|
|
139
|
+
fix: "add each with package install",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
132
142
|
for (const name of Object.keys(listedExtensions(root))) {
|
|
133
143
|
let extension;
|
|
134
144
|
try {
|
|
@@ -178,3 +188,14 @@ function readCampaignExtensions(root, context) {
|
|
|
178
188
|
}
|
|
179
189
|
return { extensions, problems };
|
|
180
190
|
}
|
|
191
|
+
/** Whether campaign.yaml writes extensions that do not read as a map of package and version, as a list. */
|
|
192
|
+
function extensionsUnread(root) {
|
|
193
|
+
try {
|
|
194
|
+
const written = readOneSetting(root, "extensions");
|
|
195
|
+
const none = written === undefined || written === null || (typeof written === "object" && !Array.isArray(written) && Object.keys(written).length === 0);
|
|
196
|
+
return !none && Object.keys(listedExtensions(root)).length === 0;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { CounterChange, Rolled } from "
|
|
3
|
-
import type { Told } from "
|
|
1
|
+
import type { Context } from "../../../core/context.ts";
|
|
2
|
+
import type { CounterChange, Rolled } from "../../../core/package-api.ts";
|
|
3
|
+
import type { Told } from "../../ask.ts";
|
|
4
4
|
/**
|
|
5
5
|
* What the packages' code said after a command's change: the system's lines, which may take the place of the engine's own note, as a death save does; the
|
|
6
6
|
* extensions' lines, which come after it; and apart why some did not run or failed, which the caller adds to its notes, never deciding by it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { campaignSystemPackage, cappedLines, codeRefused, firstLine, gameOf, gameViewOf, loadedCode, packageLabel, toldOf } from "./
|
|
3
|
-
import {
|
|
1
|
+
import { campaignSystem } from "../world.js";
|
|
2
|
+
import { campaignSystemPackage, cappedLines, codeRefused, firstLine, gameOf, gameViewOf, loadedCode, packageLabel, toldOf } from "./code.js";
|
|
3
|
+
import { campaignExtensions } from "./extensions.js";
|
|
4
4
|
/** All the packages' code said, its problems last. */
|
|
5
5
|
export function allSaid(said) {
|
|
6
6
|
return [...said.lines, ...said.added, ...(said.problem === undefined ? [] : [said.problem])];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { CardTint, Widget, WidgetText, WidgetValue } from "
|
|
3
|
-
import { type
|
|
4
|
-
import type
|
|
5
|
-
import {
|
|
6
|
-
import { type
|
|
1
|
+
import type { Context } from "../../../core/context.ts";
|
|
2
|
+
import type { CardTint, Widget, WidgetText, WidgetValue } from "../../../core/package-api.ts";
|
|
3
|
+
import { type CardPage, type FigureSize } from "../../../core/package-api.ts";
|
|
4
|
+
import { type WidgetPlace } from "../../../core/package-declarations.ts";
|
|
5
|
+
import type { Problem } from "../../../core/problem.ts";
|
|
6
|
+
import { type CodePackage } from "../../../extensions/index.ts";
|
|
7
7
|
/** Where a widget stands: a place of the dashboard, with its page for a card in one, and its order among the cards there; or off. */
|
|
8
8
|
export interface WidgetSpot {
|
|
9
9
|
place: WidgetPlace | "off";
|
|
@@ -72,8 +72,6 @@ export type ShownPart = Exclude<NonNullable<Widget["parts"]>[number], {
|
|
|
72
72
|
};
|
|
73
73
|
alt: WidgetText;
|
|
74
74
|
};
|
|
75
|
-
/** The places a campaign may put a widget in, in campaign.yaml: top, side, a page, which is a card in that page, or off. */
|
|
76
|
-
export declare const widgetSpots: readonly [...("top" | "side" | "person")[], "scene", "sheet", "world", "journal", "off"];
|
|
77
75
|
/**
|
|
78
76
|
* The widgets of the campaign's packages, its game system's first, in the order of the packages and of their widgets, each where it stands and with what its
|
|
79
77
|
* hook shows now. The hooks run together, within one time for all; one that takes longer shows nothing this time, and is not called again while it works.
|
|
@@ -81,8 +79,6 @@ export declare const widgetSpots: readonly [...("top" | "side" | "person")[], "s
|
|
|
81
79
|
export declare function campaignWidgets(root: string, context: Context): Promise<ShownWidget[]>;
|
|
82
80
|
/** What keeps the words of the campaign's extensions from being read in its language, for validate: the file, and how to fix it (D-502). */
|
|
83
81
|
export declare function extensionWordsProblems(root: string, context: Context): Problem[];
|
|
84
|
-
/** The widgets of the campaign's packages by the names campaign.yaml gives them, as weather.today, with where each package puts it. */
|
|
85
|
-
export declare function campaignWidgetNames(root: string, context: Context): Record<string, WidgetSpot>;
|
|
86
82
|
/**
|
|
87
83
|
* Where campaign.yaml would put the widgets it names, checked before it is written: each a widget of the campaign's extensions, each place one of those the
|
|
88
84
|
* dashboard has. It throws what is wrong, and how to write it.
|