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
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
// never reaches the page: only what its hook gives.
|
|
4
4
|
import { basename } from "node:path";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { campaignFileName, readOneSetting, readTextSetting } from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { isInParty } from "
|
|
14
|
-
import {
|
|
15
|
-
import { campaignPackages, gameViewOf, packageCode } from "./
|
|
16
|
-
import {
|
|
6
|
+
import { campaignFileName, readOneSetting, readTextSetting } from "../../../campaign/index.js";
|
|
7
|
+
import { cardPages } from "../../../core/package-api.js";
|
|
8
|
+
import { widgetPlaces } from "../../../core/package-declarations.js";
|
|
9
|
+
import { files } from "../../../core/store.js";
|
|
10
|
+
import { comparableText } from "../../../core/text.js";
|
|
11
|
+
import { wordIn } from "../../../extensions/index.js";
|
|
12
|
+
import { findImage } from "../../../images/index.js";
|
|
13
|
+
import { isInParty } from "../../../pages/index.js";
|
|
14
|
+
import { campaignWorld } from "../world.js";
|
|
15
|
+
import { campaignPackages, gameViewOf, packageCode } from "./code.js";
|
|
16
|
+
import { campaignExtensions, packageWords, pageAddress, runsCode } from "./extensions.js";
|
|
17
17
|
/** 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. */
|
|
18
|
-
|
|
18
|
+
const widgetSpots = [...widgetPlaces.filter((place) => place !== "page" && place !== "card"), ...cardPages, "off"];
|
|
19
19
|
// How long the hooks may take, all together, before the page goes on without those still at work, and the most a widget may give, as JSON.
|
|
20
20
|
const hookTime = 2000;
|
|
21
21
|
const mostShown = 12_000;
|
|
@@ -78,6 +78,50 @@ export function extensionWordsProblems(root, context) {
|
|
|
78
78
|
return problem === undefined ? [] : [{ path: campaignFileName, message: problem, fix: `or install it again with package install ${extension.name}` }];
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* 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
|
|
83
|
+
* dashboard has. It throws what is wrong, and how to write it.
|
|
84
|
+
*/
|
|
85
|
+
export function checkWidgetSpots(root, context, entries) {
|
|
86
|
+
const spots = campaignWidgetNames(root, context);
|
|
87
|
+
const known = Object.keys(spots);
|
|
88
|
+
for (const [name, value] of Object.entries(entries)) {
|
|
89
|
+
const own = Object.entries(spots).find(([one]) => comparableText(one) === comparableText(name))?.[1];
|
|
90
|
+
if (own === undefined) {
|
|
91
|
+
const names = known.length === 0 ? "the campaign's packages have none" : `the campaign's are ${known.join(", ")}`;
|
|
92
|
+
throw new Error(`There is no widget ${name}: ${names}. Write one as ${known[0] ?? "weather.today"}: side. Nothing changed.`);
|
|
93
|
+
}
|
|
94
|
+
// A widget made for each of the party shows only there, or nowhere, as its hook needs who (D-514); another may come there too (D-516).
|
|
95
|
+
const place = typeof value === "string" ? value : value !== null && typeof value === "object" && "place" in value ? value.place : undefined;
|
|
96
|
+
if (own.place === "person" && place !== "person" && place !== "off") {
|
|
97
|
+
throw new Error(`${name} stands on each of the party: write ${name}: off, or ${name}: person. Nothing changed.`);
|
|
98
|
+
}
|
|
99
|
+
if (own.place === "card") {
|
|
100
|
+
throw new Error(`${name} shows only in the card its package asks a roll in, so it has no place to choose: take ${name} out of widgets. Nothing changed.`);
|
|
101
|
+
}
|
|
102
|
+
if (!spotSchema.safeParse(value).success) {
|
|
103
|
+
// Of a place written as its parts, what is wrong with them, as an order that is no whole number.
|
|
104
|
+
const issue = value !== null && typeof value === "object" ? spotObject.safeParse(value).error?.issues[0] : undefined;
|
|
105
|
+
const why = issue === undefined ? "" : ` Here ${[...issue.path, ""].join(" ")}${issue.message}.`;
|
|
106
|
+
throw new Error(`${name} takes ${widgetSpots.join(", ")}, or {place, page, order}, such as ${name}: side.${why} Nothing changed.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* What one widget of a package shows now, for the card of a question (D-507): read as the dashboard reads it, in the campaign's language; nothing when its
|
|
112
|
+
* hook is not there, fails, gives what no part draws, or is late.
|
|
113
|
+
*/
|
|
114
|
+
export async function widgetCard(root, context, extension, name, key, who) {
|
|
115
|
+
return await widgetFor(root, context, extension, name, { key, ...(who === undefined ? {} : { who }) });
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* What one widget of a package shows for a card of its page code, for the character the card shows (D-514): the package by its npm name, the widget declared
|
|
119
|
+
* by it; nothing when either is not the campaign's, or as for a card of a question.
|
|
120
|
+
*/
|
|
121
|
+
export async function packageWidget(root, context, packageName, name, who) {
|
|
122
|
+
const owner = campaignPackages(root, context).find((one) => one.package === packageName);
|
|
123
|
+
return owner === undefined || !owner.widgets.some((widget) => widget.name === name) ? undefined : await widgetFor(root, context, owner, name, who === undefined ? {} : { who });
|
|
124
|
+
}
|
|
81
125
|
/** A widget with what its hook shows now, or why it shows nothing: its code, a hook it lacks, a hook that failed or was late, what it gave. */
|
|
82
126
|
async function widgetNow(root, context, extension, name, base, loaded, words, late, party) {
|
|
83
127
|
const hook = "error" in loaded ? undefined : loaded.loaded?.widgets?.[name];
|
|
@@ -138,38 +182,9 @@ function hookCall(root, extension, widget, call) {
|
|
|
138
182
|
return started;
|
|
139
183
|
}
|
|
140
184
|
/** The widgets of the campaign's packages by the names campaign.yaml gives them, as weather.today, with where each package puts it. */
|
|
141
|
-
|
|
185
|
+
function campaignWidgetNames(root, context) {
|
|
142
186
|
return Object.fromEntries(campaignPackages(root, context).flatMap((extension) => extension.widgets.map((widget) => [`${extension.name}.${widget.name}`, ownSpot(widget)])));
|
|
143
187
|
}
|
|
144
|
-
/**
|
|
145
|
-
* 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
|
|
146
|
-
* dashboard has. It throws what is wrong, and how to write it.
|
|
147
|
-
*/
|
|
148
|
-
export function checkWidgetSpots(root, context, entries) {
|
|
149
|
-
const spots = campaignWidgetNames(root, context);
|
|
150
|
-
const known = Object.keys(spots);
|
|
151
|
-
for (const [name, value] of Object.entries(entries)) {
|
|
152
|
-
const own = Object.entries(spots).find(([one]) => comparableText(one) === comparableText(name))?.[1];
|
|
153
|
-
if (own === undefined) {
|
|
154
|
-
const names = known.length === 0 ? "the campaign's packages have none" : `the campaign's are ${known.join(", ")}`;
|
|
155
|
-
throw new Error(`There is no widget ${name}: ${names}. Write one as ${known[0] ?? "weather.today"}: side. Nothing changed.`);
|
|
156
|
-
}
|
|
157
|
-
// A widget made for each of the party shows only there, or nowhere, as its hook needs who (D-514); another may come there too (D-516).
|
|
158
|
-
const place = typeof value === "string" ? value : value !== null && typeof value === "object" && "place" in value ? value.place : undefined;
|
|
159
|
-
if (own.place === "person" && place !== "person" && place !== "off") {
|
|
160
|
-
throw new Error(`${name} stands on each of the party: write ${name}: off, or ${name}: person. Nothing changed.`);
|
|
161
|
-
}
|
|
162
|
-
if (own.place === "card") {
|
|
163
|
-
throw new Error(`${name} shows only in the card its package asks a roll in, so it has no place to choose: take ${name} out of widgets. Nothing changed.`);
|
|
164
|
-
}
|
|
165
|
-
if (!spotSchema.safeParse(value).success) {
|
|
166
|
-
// Of a place written as its parts, what is wrong with them, as an order that is no whole number.
|
|
167
|
-
const issue = value !== null && typeof value === "object" ? spotObject.safeParse(value).error?.issues[0] : undefined;
|
|
168
|
-
const why = issue === undefined ? "" : ` Here ${[...issue.path, ""].join(" ")}${issue.message}.`;
|
|
169
|
-
throw new Error(`${name} takes ${widgetSpots.join(", ")}, or {place, page, order}, such as ${name}: side.${why} Nothing changed.`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
188
|
// The places campaign.yaml may give a widget.
|
|
174
189
|
const spotPlaces = [...widgetPlaces.filter((place) => place !== "card"), "off"];
|
|
175
190
|
// The most and least order of a card among those of its place.
|
|
@@ -369,21 +384,6 @@ function shownTrack(track) {
|
|
|
369
384
|
const [held, marked, coming] = [fit(track.held), fit(track.marked), fit(track.coming)];
|
|
370
385
|
return { ...track, value, ...(held === undefined ? {} : { held }), ...(marked === undefined ? {} : { marked }), ...(coming === undefined ? {} : { coming }) };
|
|
371
386
|
}
|
|
372
|
-
/**
|
|
373
|
-
* What one widget of a package shows now, for the card of a question (D-507): read as the dashboard reads it, in the campaign's language; nothing when its
|
|
374
|
-
* hook is not there, fails, gives what no part draws, or is late.
|
|
375
|
-
*/
|
|
376
|
-
export async function widgetCard(root, context, extension, name, key, who) {
|
|
377
|
-
return await widgetFor(root, context, extension, name, { key, ...(who === undefined ? {} : { who }) });
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* What one widget of a package shows for a card of its page code, for the character the card shows (D-514): the package by its npm name, the widget declared
|
|
381
|
-
* by it; nothing when either is not the campaign's, or as for a card of a question.
|
|
382
|
-
*/
|
|
383
|
-
export async function packageWidget(root, context, packageName, name, who) {
|
|
384
|
-
const owner = campaignPackages(root, context).find((one) => one.package === packageName);
|
|
385
|
-
return owner === undefined || !owner.widgets.some((widget) => widget.name === name) ? undefined : await widgetFor(root, context, owner, name, who === undefined ? {} : { who });
|
|
386
|
-
}
|
|
387
387
|
/** What a widget shows for a card: for a question, by its key, the attempt; for a card of the page code, by who it shows. */
|
|
388
388
|
async function widgetFor(root, context, extension, name, asked) {
|
|
389
389
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Coin } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
1
|
+
import { type Coin } from "../../money/index.ts";
|
|
2
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
3
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
4
4
|
/**
|
|
5
5
|
* The counters of a page as the outputs show them, such as hp 5/12: all those it holds, and those it inherits written as current/max (D-116, as for copies in D-110).
|
|
6
6
|
* A statistic it inherits, such as ac 13, is read from its base. With the campaign's coins, its money too, held or inherited (MON-7).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { comparableText, sameName } from "
|
|
2
|
-
import { readCounter } from "
|
|
3
|
-
import { formatAmount, readAmount } from "
|
|
4
|
-
import { declaredKind, isDeclaredUncounted, isEmptyField, isStandardField } from "
|
|
1
|
+
import { comparableText, sameName } from "../../core/text.js";
|
|
2
|
+
import { readCounter } from "../../counters/index.js";
|
|
3
|
+
import { formatAmount, readAmount } from "../../money/index.js";
|
|
4
|
+
import { declaredKind, isDeclaredUncounted, isEmptyField, isStandardField } from "../../pages/index.js";
|
|
5
5
|
import { effectiveFields, effectsOf } from "./effect-layer.js";
|
|
6
|
-
import { experienceOf, experienceText } from "./
|
|
6
|
+
import { experienceOf, experienceText } from "./experience.js";
|
|
7
7
|
import { counterOf } from "./sheet.js";
|
|
8
8
|
import { signedText } from "./worked-out.js";
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type SystemWords } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type SystemWords } from "../../systems/index.ts";
|
|
3
3
|
/** What the page has of a language: its phrases so far, whether they are being translated, whether this computer can, and how many it still lacks. */
|
|
4
4
|
export interface PageWords {
|
|
5
5
|
phrases: Record<string, string>;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { stringify } from "yaml";
|
|
7
|
-
import { files } from "
|
|
8
|
-
import { languagePackFor, packPhrases } from "
|
|
9
|
-
import { layeredSystemWords, systemContentFolders, systemWords } from "
|
|
7
|
+
import { files } from "../../core/store.js";
|
|
8
|
+
import { languagePackFor, packPhrases } from "../../languages/index.js";
|
|
9
|
+
import { layeredSystemWords, systemContentFolders, systemWords } from "../../systems/index.js";
|
|
10
10
|
// How many phrases go in one request.
|
|
11
11
|
const batchSize = 130;
|
|
12
12
|
// How long a language whose translation stopped short waits before it is tried again, so that a writer that fails is not called at every reading.
|
|
@@ -57,7 +57,8 @@ export function pageTranslator(context, page, notify) {
|
|
|
57
57
|
const waiting = context.now().getTime() - (stopped.get(language) ?? -pause) < pause;
|
|
58
58
|
if (can && !waiting && !running.has(language) && (missing > 0 || (system !== undefined && systemMissing(context.home, language, system)))) {
|
|
59
59
|
running.set(language, new Set());
|
|
60
|
-
|
|
60
|
+
// A translation that fails leaves the page in English, never the server down with it.
|
|
61
|
+
void run(language, system).catch(() => undefined).finally(() => {
|
|
61
62
|
running.delete(language);
|
|
62
63
|
stopped.set(language, context.now().getTime());
|
|
63
64
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type World } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type World } from "../../pages/index.ts";
|
|
3
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
4
4
|
/** A part of the instructions as the core and the system give it, with no regard to what was told; undefined when neither has it. */
|
|
5
5
|
export declare function partText(name: string, system: GameSystem | undefined): string | undefined;
|
|
6
6
|
/** A part of the instructions for a situation that opens: once in a chat where the MCP server keeps what it told, until instructions; every time elsewhere. Empty when there is none, or it was told. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The parts of the master's instructions that the tools give when a situation opens, such as a fight or a new day (D-97, D-121).
|
|
2
|
-
import { readSettings } from "
|
|
3
|
-
import { corePart, layeredPart } from "
|
|
4
|
-
import { playerCharacters } from "
|
|
5
|
-
import { campaignSystem } from "./
|
|
2
|
+
import { readSettings } from "../../campaign/index.js";
|
|
3
|
+
import { corePart, layeredPart } from "../../instructions/index.js";
|
|
4
|
+
import { playerCharacters } from "../../pages/index.js";
|
|
5
|
+
import { campaignSystem } from "./world.js";
|
|
6
6
|
/** A part of the instructions as the core and the system give it, with no regard to what was told; undefined when neither has it. */
|
|
7
7
|
export function partText(name, system) {
|
|
8
8
|
const core = corePart(name);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type Page, type Position, type World } from "
|
|
3
|
-
import { type Measures } from "./
|
|
1
|
+
import type { Problem } from "../../core/problem.ts";
|
|
2
|
+
import { type Page, type Position, type World } from "../../pages/index.ts";
|
|
3
|
+
import { type Measures } from "./roads.ts";
|
|
4
4
|
/** A region (POS-6): a place with a position and a radius, which covers the circle. */
|
|
5
5
|
export interface Region {
|
|
6
6
|
page: Page;
|
|
7
7
|
centre: Position;
|
|
8
8
|
radius: number;
|
|
9
9
|
}
|
|
10
|
-
/** How to write a relation, for messages. */
|
|
11
|
-
export declare const relationHelp = "a distance, a direction and a place with a position, such as 12 km NE of [[Guadoscuro]]";
|
|
12
10
|
/**
|
|
13
11
|
* Where a page is on the map (POS-4): the first of its chain, itself first, with a position: its own; for a stop, on the line between the nearest stops of its
|
|
14
12
|
* road that have one, by the lengths; undefined when none has one. A character or an item is where the place that holds it is.
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Positions in play (D-259, POS-1–POS-8): where a place is, its own position or one worked out; relations turned into a position; regions; what is near a point;
|
|
2
2
|
// each on its map, with the coordinates its map uses (D-320).
|
|
3
|
-
import { lengthHelp, readLength } from "
|
|
4
|
-
import { comparableText } from "
|
|
5
|
-
import { biomes, directionHelp, directionName, directionTo, distanceBetween, meanPoint, placeKinds, pointAlong, pointFrom, readDirection } from "
|
|
6
|
-
import { environmentAt, formatPosition, isEmptyField, locate, pageNamed, pagesWithName, parsePageReference, readPosition, readStops } from "
|
|
7
|
-
import {
|
|
8
|
-
import { lengthText, roadsOf } from "./game-roads.js";
|
|
3
|
+
import { lengthHelp, readLength } from "../../core/length.js";
|
|
4
|
+
import { comparableText } from "../../core/text.js";
|
|
5
|
+
import { biomes, directionHelp, directionName, directionTo, distanceBetween, meanPoint, placeKinds, pointAlong, pointFrom, readDirection } from "../../map/index.js";
|
|
6
|
+
import { environmentAt, formatPosition, isEmptyField, locate, mapKey, mapOf, pageNamed, pagesWithName, parsePageReference, readPosition, readStops, sameFrame } from "../../pages/index.js";
|
|
7
|
+
import { lengthText, roadsOf } from "./roads.js";
|
|
9
8
|
/** How to write a relation, for messages. */
|
|
10
|
-
|
|
9
|
+
const relationHelp = "a distance, a direction and a place with a position, such as 12 km NE of [[Guadoscuro]]";
|
|
11
10
|
/**
|
|
12
11
|
* Where a page is on the map (POS-4): the first of its chain, itself first, with a position: its own; for a stop, on the line between the nearest stops of its
|
|
13
12
|
* road that have one, by the lengths; undefined when none has one. A character or an item is where the place that holds it is.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type World } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type World } from "../../pages/index.ts";
|
|
4
4
|
/** Every problem in a campaign: its settings, its game system and coins, its log, its world, its pictures, its roads, its game time, its planned events, its effects and its open scene. */
|
|
5
5
|
export declare function campaignProblems(root: string, world: World, context: Context): Problem[];
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { checkSettings } from "
|
|
2
|
-
import { checkLog } from "
|
|
3
|
-
import { checkWorld } from "
|
|
4
|
-
import { bondProblems } from "./
|
|
5
|
-
import { effectProblems } from "./
|
|
6
|
-
import { eventProblems } from "./
|
|
7
|
-
import { experienceProblems } from "./
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { shortRoadProblems } from "./
|
|
16
|
-
import { questProblems } from "./
|
|
17
|
-
import { passageProblems, roadProblems } from "./
|
|
18
|
-
import { readOpenScene, sceneProblems } from "./
|
|
19
|
-
import { themeProblems } from "./game-theme.js";
|
|
20
|
-
import { readPresent, timeProblems } from "./game-time.js";
|
|
21
|
-
import { extensionWordsProblems } from "./game-widgets.js";
|
|
22
|
-
import { campaignSystem, systemOccasions, systemProblems, systemSettingProblems } from "./game-world.js";
|
|
1
|
+
import { checkSettings } from "../../campaign/index.js";
|
|
2
|
+
import { checkLog } from "../../core/log.js";
|
|
3
|
+
import { checkWorld, mapProblems } from "../../pages/index.js";
|
|
4
|
+
import { bondProblems } from "./bonds.js";
|
|
5
|
+
import { effectProblems } from "./effects.js";
|
|
6
|
+
import { eventProblems } from "./events.js";
|
|
7
|
+
import { experienceProblems } from "./experience.js";
|
|
8
|
+
import { gridProblems } from "./grids.js";
|
|
9
|
+
import { imageProblems } from "./images.js";
|
|
10
|
+
import { limitProblems } from "./limits.js";
|
|
11
|
+
import { modeProblems } from "./mode.js";
|
|
12
|
+
import { moneyProblems } from "./money.js";
|
|
13
|
+
import { campaignExtensions } from "./packages/extensions.js";
|
|
14
|
+
import { extensionWordsProblems } from "./packages/widgets.js";
|
|
15
|
+
import { shortRoadProblems } from "./positions.js";
|
|
16
|
+
import { questProblems } from "./quests.js";
|
|
17
|
+
import { passageProblems, roadProblems } from "./roads.js";
|
|
18
|
+
import { readOpenScene, sceneProblems } from "./scene.js";
|
|
23
19
|
import { listValueProblems } from "./sheet.js";
|
|
20
|
+
import { themeProblems } from "./theme.js";
|
|
21
|
+
import { readPresent, timeProblems } from "./time.js";
|
|
24
22
|
import { workedOutProblems } from "./worked-out.js";
|
|
23
|
+
import { campaignSystem, systemOccasions, systemProblems, systemSettingProblems } from "./world.js";
|
|
25
24
|
/** Every problem in a campaign: its settings, its game system and coins, its log, its world, its pictures, its roads, its game time, its planned events, its effects and its open scene. */
|
|
26
25
|
export function campaignProblems(root, world, context) {
|
|
27
26
|
const system = systemProblems(root, context);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
1
|
+
import type { Problem } from "../../core/problem.ts";
|
|
2
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
3
3
|
/** A field the rows give, with its value and the items it comes from, such as rage-damage +2 from Barbarian 3 (PRO-2). */
|
|
4
4
|
export interface ProgressionValue {
|
|
5
5
|
field: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// What the classes of a character give (D-201, D-219, PRO-1–PRO-4): the row of each class's table at its level, and the features gained so far, with those its
|
|
2
2
|
// subclasses add. The tables are the pages' own; this is where the system's progression meets the pages of a world.
|
|
3
|
-
import { listItems } from "
|
|
4
|
-
import { comparableText, valueNamed } from "
|
|
5
|
-
import { pagesWithName, sectionTitles, systemPageNamed } from "
|
|
6
|
-
import { featureParts, fieldName, gainedFeatures, levelledFeatures, levelTable, mergedFeatures, rowFields } from "
|
|
3
|
+
import { listItems } from "../../core/formula.js";
|
|
4
|
+
import { comparableText, valueNamed } from "../../core/text.js";
|
|
5
|
+
import { pagesWithName, sectionTitles, systemPageNamed } from "../../pages/index.js";
|
|
6
|
+
import { featureParts, fieldName, gainedFeatures, levelledFeatures, levelTable, mergedFeatures, rowFields } from "../../progression/index.js";
|
|
7
7
|
/** What the classes in these fields give, by the system's progression; undefined when the system has none or the fields name no class (PRO-1). */
|
|
8
8
|
export function progressionOf(world, fields) {
|
|
9
9
|
const rule = world.system?.progression;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type Page, type World } from "
|
|
4
|
-
import { type GameDate } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
4
|
+
import { type GameDate } from "../../time/index.ts";
|
|
5
5
|
/** What a quest measures (D-367): its counters with a maximum, its clock with its name, its deadline with the game minutes left, and whether it is the main one. */
|
|
6
6
|
export interface QuestMeasures {
|
|
7
7
|
main: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { appendLogEntry } from "
|
|
2
|
-
import { comparableText } from "
|
|
3
|
-
import { readCounter } from "
|
|
4
|
-
import { everyGoalTicked, isEmptyField } from "
|
|
5
|
-
import { formatDuration, formatGameDate, minutesBetween, readGameDate } from "
|
|
6
|
-
import { newDatedLogEntry } from "./
|
|
1
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
2
|
+
import { comparableText } from "../../core/text.js";
|
|
3
|
+
import { readCounter } from "../../counters/index.js";
|
|
4
|
+
import { everyGoalTicked, isEmptyField } from "../../pages/index.js";
|
|
5
|
+
import { formatDuration, formatGameDate, minutesBetween, readGameDate } from "../../time/index.js";
|
|
6
|
+
import { newDatedLogEntry } from "./time.js";
|
|
7
7
|
// What the master does with such a quest.
|
|
8
8
|
const advice = "if the story has ended it, write status done";
|
|
9
9
|
// The fields of a quest the journal shows apart; any other counter is a bar.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Effect } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import type { GameSystem, Recipe } from "
|
|
1
|
+
import type { Effect } from "../../effects/index.ts";
|
|
2
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
3
|
+
import type { GameSystem, Recipe } from "../../systems/index.ts";
|
|
4
4
|
/** The recipe of the game system with this name, with the system; refused, with those it has, when it has none. */
|
|
5
5
|
export declare function recipeNamed(system: GameSystem | undefined, name: string): {
|
|
6
6
|
system: GameSystem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The recipes of a game system (D-185, DAT-4): which pages a rest goes to, the effects it ends, the fields it brings back, and what it leaves to the master.
|
|
2
|
-
import { comparableText } from "
|
|
3
|
-
import { readCounter } from "
|
|
4
|
-
import { isDeclaredUncounted, isInParty, locate, playerCharacters } from "
|
|
2
|
+
import { comparableText } from "../../core/text.js";
|
|
3
|
+
import { readCounter } from "../../counters/index.js";
|
|
4
|
+
import { isDeclaredUncounted, isInParty, locate, playerCharacters } from "../../pages/index.js";
|
|
5
5
|
import { effectiveFields, effectsOf } from "./effect-layer.js";
|
|
6
6
|
import { formulaValue, refillAmount } from "./worked-out.js";
|
|
7
7
|
/** The recipe of the game system with this name, with the system; refused, with those it has, when it has none. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Effect } from "
|
|
2
|
-
import type { Page, World } from "
|
|
3
|
-
import type { Scene } from "
|
|
4
|
-
import type { GameSystem } from "
|
|
1
|
+
import { type Effect } from "../../effects/index.ts";
|
|
2
|
+
import type { Page, World } from "../../pages/index.ts";
|
|
3
|
+
import type { Scene } from "../../scene/index.ts";
|
|
4
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
5
5
|
/** "Viola keeps Eroismo (Corrado): lost 7 hp. Read rules Concentration.": what someone keeps alive, when the counter the game system names goes down by `lost` (EFF-14). */
|
|
6
6
|
export declare function keepingLossNote(world: World, scene: Scene | undefined, system: GameSystem | undefined, name: string, field: string, lost: number): string;
|
|
7
7
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// What a fight asks the master to keep by hand, said when it happens (D-266): what can break what someone keeps alive (EFF-14), the effects at a turn and at a rest
|
|
2
2
|
// (EFF-15), the counter that shields another (DAT-14). The engine only says it: it ends and changes nothing by itself.
|
|
3
|
-
import { comparableText } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { keeperOf } from "
|
|
3
|
+
import { comparableText } from "../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../counters/index.js";
|
|
5
|
+
import { keeperOf } from "../../effects/index.js";
|
|
6
6
|
import { effectiveFields, effectsOf } from "./effect-layer.js";
|
|
7
|
-
import { effectsOn, keptEffectHolders, keptEffects, systemNamed } from "./
|
|
7
|
+
import { effectsOn, keptEffectHolders, keptEffects, systemNamed } from "./effects.js";
|
|
8
8
|
/** "Viola keeps Eroismo (Corrado): lost 7 hp. Read rules Concentration.": what someone keeps alive, when the counter the game system names goes down by `lost` (EFF-14). */
|
|
9
9
|
export function keepingLossNote(world, scene, system, name, field, lost) {
|
|
10
10
|
const keeping = system?.keeping;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ImperialUnits, type UnitSystem } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type Speed, type Start, type Step, type Stretch, type Way } from "
|
|
4
|
-
import { type Page, type World } from "
|
|
5
|
-
import type { GameSystem, TravelKind } from "
|
|
1
|
+
import { type ImperialUnits, type UnitSystem } from "../../core/length.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type Speed, type Start, type Step, type Stretch, type Way } from "../../map/index.ts";
|
|
4
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
5
|
+
import type { GameSystem, TravelKind } from "../../systems/index.ts";
|
|
6
6
|
/** The roads of the world (ROA-4): their stretches, in the order of the pages and of their stops; the page of each road by its name; the names of the stops. */
|
|
7
7
|
export interface Roads {
|
|
8
8
|
stretches: Stretch[];
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Roads in play (D-256, D-260, D-262): the roads of the world as stretches, the stop a journey starts or ends at, how fast one goes on each stretch, the quickest
|
|
2
2
|
// way, and the measures in the player's units.
|
|
3
|
-
import { readTextSetting, unitSystems } from "
|
|
4
|
-
import { formatLength, formatSpeed, readSpeed, speedHelp, trueImperialUnits } from "
|
|
5
|
-
import { comparableText, sameName } from "
|
|
6
|
-
import { quickestWay, stretchesOf } from "
|
|
7
|
-
import { environmentAt, isEmptyField, isInParty, locate, pagesWithName, playerCharacters, readStops } from "
|
|
3
|
+
import { readTextSetting, unitSystems } from "../../campaign/index.js";
|
|
4
|
+
import { formatLength, formatSpeed, readSpeed, speedHelp, trueImperialUnits } from "../../core/length.js";
|
|
5
|
+
import { comparableText, sameName } from "../../core/text.js";
|
|
6
|
+
import { quickestWay, stretchesOf } from "../../map/index.js";
|
|
7
|
+
import { environmentAt, isEmptyField, isInParty, locate, mapKey, pagesWithName, playerCharacters, readStops } from "../../pages/index.js";
|
|
8
8
|
import { effectiveFields } from "./effect-layer.js";
|
|
9
|
-
import { mapKey } from "./game-maps.js";
|
|
10
9
|
/** The roads of the world (ROA-1, ROA-4): every place of the campaign with stops that read; a stretch counts only between two places of the campaign. */
|
|
11
10
|
export function roadsOf(world) {
|
|
12
11
|
let roads = known.get(world);
|
|
@@ -55,13 +54,6 @@ export function playersApart(world, journeyMovers) {
|
|
|
55
54
|
const party = travellingParty(world, lead, journeyMovers);
|
|
56
55
|
return living.every((page) => party.includes(page)) ? undefined : living.map((page) => `${page.name}, in ${placeOf(world, page)?.name ?? "the open"}`).join("; ");
|
|
57
56
|
}
|
|
58
|
-
/** The living player characters that are somewhere, in a place or on the journey, and the first of them, else the first living, else the first. */
|
|
59
|
-
function leadingPlayers(world, journeyMovers) {
|
|
60
|
-
const players = playerCharacters(world);
|
|
61
|
-
const somewhere = (page) => locate(world, page).chain.length > 0 || journeyMovers.some((name) => comparableText(name) === comparableText(page.name));
|
|
62
|
-
const living = players.filter((page) => page.fields.status !== "dead" && somewhere(page));
|
|
63
|
-
return { lead: living[0] ?? players.find((page) => page.fields.status !== "dead") ?? players[0], living };
|
|
64
|
-
}
|
|
65
57
|
/**
|
|
66
58
|
* What moves for the travellers (TRV-6): the vehicle they are all in, the outermost item that holds them below a place, or themselves. When only some are in a
|
|
67
59
|
* vehicle, or in different ones, each vehicle goes with those on foot, at their pace. Refused when they are in different places, or beside a boat that goes only by water.
|
|
@@ -87,26 +79,6 @@ export function moversOf(world, system, travellers) {
|
|
|
87
79
|
}
|
|
88
80
|
return { movers: movers.filter((page, index) => movers.indexOf(page) === index) };
|
|
89
81
|
}
|
|
90
|
-
/**
|
|
91
|
-
* The vehicle a page is in (TRV-6): the outermost of the items that hold it, when what holds that is a place or nothing; none in what a character carries.
|
|
92
|
-
* Refused when that item is no vehicle of the game, as a barrel with a thief in it.
|
|
93
|
-
*/
|
|
94
|
-
function vehicleOf(world, system, page) {
|
|
95
|
-
const chain = locate(world, page).chain;
|
|
96
|
-
const items = chain.findIndex((holder) => holder.type !== "item");
|
|
97
|
-
const inner = items === -1 ? chain : chain.slice(0, items);
|
|
98
|
-
const above = chain[inner.length];
|
|
99
|
-
const outer = inner.at(-1);
|
|
100
|
-
if (outer === undefined || (above !== undefined && above.type !== "place")) {
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
if (!isVehicle(world, system, outer)) {
|
|
104
|
-
const declared = system?.travel?.vehicles[0];
|
|
105
|
-
const remedy = declared === undefined ? "declare what is a vehicle with travel.vehicles in campaign.yaml" : `give ${outer.name} ${declared.field} ${declared.value}, or derive it from an item that has it`;
|
|
106
|
-
throw new Error(`${page.name} is in ${outer.name}, which is no vehicle of this game: move them out, leave them out of who, or ${remedy}. Nothing changed.`);
|
|
107
|
-
}
|
|
108
|
-
return outer;
|
|
109
|
-
}
|
|
110
82
|
/** The stop a journey starts from or ends at (ROA-5): the nearest page of the chain of `page`, itself first, that is a stop of a road. */
|
|
111
83
|
export function stopOf(world, roads, page) {
|
|
112
84
|
return [page, ...locate(world, page).chain].find((holder) => roads.stops.has(holder.name));
|
|
@@ -274,6 +246,44 @@ export function passageProblems(world, system) {
|
|
|
274
246
|
: [{ path: road.path, message: `${road.name} joins places of different maps, as only a passage does.`, fix: `write ${road.name}, set kind=portal, if it is one; else move its stops onto one map` }];
|
|
275
247
|
});
|
|
276
248
|
}
|
|
249
|
+
/** Whether a vehicle travels only the kinds of road that are travelled in it, as a boat (TRV-2): some kind names it; a cart, which none names, goes at the pace. */
|
|
250
|
+
export function isVehicleOnly(world, system, vehicle) {
|
|
251
|
+
return (system?.travel?.kinds ?? []).some((kind) => carries(world, vehicle, kind));
|
|
252
|
+
}
|
|
253
|
+
/** What the terrain of a road or a region does to a pace (TRV-3, TRV-12): the factor the system gives the value of the terrain entry of its environment, 1 for any other. */
|
|
254
|
+
export function terrainFactor(world, system, road) {
|
|
255
|
+
const terrain = environmentAt(world, road).find(({ entry }) => comparableText(entry.name) === "terrain")?.entry.value;
|
|
256
|
+
const factors = system?.travel?.terrain ?? {};
|
|
257
|
+
const value = terrain === undefined ? undefined : sameName(Object.keys(factors), terrain);
|
|
258
|
+
return value === undefined ? 1 : factors[value];
|
|
259
|
+
}
|
|
260
|
+
/** The living player characters that are somewhere, in a place or on the journey, and the first of them, else the first living, else the first. */
|
|
261
|
+
function leadingPlayers(world, journeyMovers) {
|
|
262
|
+
const players = playerCharacters(world);
|
|
263
|
+
const somewhere = (page) => locate(world, page).chain.length > 0 || journeyMovers.some((name) => comparableText(name) === comparableText(page.name));
|
|
264
|
+
const living = players.filter((page) => page.fields.status !== "dead" && somewhere(page));
|
|
265
|
+
return { lead: living[0] ?? players.find((page) => page.fields.status !== "dead") ?? players[0], living };
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The vehicle a page is in (TRV-6): the outermost of the items that hold it, when what holds that is a place or nothing; none in what a character carries.
|
|
269
|
+
* Refused when that item is no vehicle of the game, as a barrel with a thief in it.
|
|
270
|
+
*/
|
|
271
|
+
function vehicleOf(world, system, page) {
|
|
272
|
+
const chain = locate(world, page).chain;
|
|
273
|
+
const items = chain.findIndex((holder) => holder.type !== "item");
|
|
274
|
+
const inner = items === -1 ? chain : chain.slice(0, items);
|
|
275
|
+
const above = chain[inner.length];
|
|
276
|
+
const outer = inner.at(-1);
|
|
277
|
+
if (outer === undefined || (above !== undefined && above.type !== "place")) {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
if (!isVehicle(world, system, outer)) {
|
|
281
|
+
const declared = system?.travel?.vehicles[0];
|
|
282
|
+
const remedy = declared === undefined ? "declare what is a vehicle with travel.vehicles in campaign.yaml" : `give ${outer.name} ${declared.field} ${declared.value}, or derive it from an item that has it`;
|
|
283
|
+
throw new Error(`${page.name} is in ${outer.name}, which is no vehicle of this game: move them out, leave them out of who, or ${remedy}. Nothing changed.`);
|
|
284
|
+
}
|
|
285
|
+
return outer;
|
|
286
|
+
}
|
|
277
287
|
/** The nearest place of a page's chain, itself first. */
|
|
278
288
|
function placeOf(world, page) {
|
|
279
289
|
return [page, ...locate(world, page).chain].find((holder) => holder.type === "place");
|
|
@@ -299,10 +309,6 @@ function readRoads(world) {
|
|
|
299
309
|
}
|
|
300
310
|
return { stretches, pages, stops };
|
|
301
311
|
}
|
|
302
|
-
/** Whether a vehicle travels only the kinds of road that are travelled in it, as a boat (TRV-2): some kind names it; a cart, which none names, goes at the pace. */
|
|
303
|
-
export function isVehicleOnly(world, system, vehicle) {
|
|
304
|
-
return (system?.travel?.kinds ?? []).some((kind) => carries(world, vehicle, kind));
|
|
305
|
-
}
|
|
306
312
|
/** Whether an item is a vehicle of the game (TRV-6): it has a field at a value travel.vehicles declares, or is what a kind of road is travelled in. */
|
|
307
313
|
function isVehicle(world, system, item) {
|
|
308
314
|
return (system?.travel?.vehicles ?? []).some((match) => hasValue(world, item, match)) || isVehicleOnly(world, system, item);
|
|
@@ -323,13 +329,6 @@ function vehicleSpeed(world, vehicle, kind) {
|
|
|
323
329
|
const field = kind.vehicle === undefined ? undefined : sameName(Object.keys(fields), kind.vehicle.speed);
|
|
324
330
|
return field === undefined ? undefined : readSpeed(fields[field]);
|
|
325
331
|
}
|
|
326
|
-
/** What the terrain of a road or a region does to a pace (TRV-3, TRV-12): the factor the system gives the value of the terrain entry of its environment, 1 for any other. */
|
|
327
|
-
export function terrainFactor(world, system, road) {
|
|
328
|
-
const terrain = environmentAt(world, road).find(({ entry }) => comparableText(entry.name) === "terrain")?.entry.value;
|
|
329
|
-
const factors = system?.travel?.terrain ?? {};
|
|
330
|
-
const value = terrain === undefined ? undefined : sameName(Object.keys(factors), terrain);
|
|
331
|
-
return value === undefined ? 1 : factors[value];
|
|
332
|
-
}
|
|
333
332
|
/** "Fiume Nero, a river travelled in a waterborne vehicle, such as one that derives from [[Keelboat]]": a road and what it needs. */
|
|
334
333
|
function kindText(world, system, road) {
|
|
335
334
|
if (road === undefined) {
|