rpg-engine 0.7.0 → 0.8.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 +3 -3
- 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} +42 -42
- 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} +2 -2
- package/dist/commands/{game-rules.js → shared/rules.js} +4 -4
- 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 +1 -1
- package/dist/commands/show.js +32 -17
- 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} +35 -35
- 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 +6 -1
- package/dist/core/files.js +47 -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/{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 +3 -3
- 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.js +25 -19
- 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/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
|
@@ -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) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type RuleSection } from "
|
|
2
|
-
import { type GameSystem } from "
|
|
1
|
+
import { type RuleSection } from "../../rules/index.ts";
|
|
2
|
+
import { type GameSystem } from "../../systems/index.ts";
|
|
3
3
|
/** The source of the campaign's own rules, in the campaign's rules folder. */
|
|
4
4
|
export declare const houseRules = "house rules";
|
|
5
5
|
/** What to do when a precedent and the book disagree (D-181). */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// A rule by its title, as rules finds it (D-179, DAT-3, DAT-6): a house rule of the campaign first, else the game system's, with the table's precedents on it.
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { houseRulesFolderName, readListSetting } from "
|
|
4
|
-
import { comparableText } from "
|
|
5
|
-
import { isTitled, readRuleBook } from "
|
|
6
|
-
import { systemContentFolders } from "
|
|
3
|
+
import { houseRulesFolderName, readListSetting } from "../../campaign/index.js";
|
|
4
|
+
import { comparableText } from "../../core/text.js";
|
|
5
|
+
import { isTitled, readRuleBook } from "../../rules/index.js";
|
|
6
|
+
import { systemContentFolders } from "../../systems/index.js";
|
|
7
7
|
/** The source of the campaign's own rules, in the campaign's rules folder. */
|
|
8
8
|
export const houseRules = "house rules";
|
|
9
9
|
/** What to do when a precedent and the book disagree (D-181). */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { saveModes } from "
|
|
2
|
-
import type { Context } from "
|
|
3
|
-
import { type World } from "
|
|
4
|
-
import { type Save } from "
|
|
1
|
+
import { saveModes } from "../../campaign/index.ts";
|
|
2
|
+
import type { Context } from "../../core/context.ts";
|
|
3
|
+
import { type World } from "../../pages/index.ts";
|
|
4
|
+
import { type Save } from "../../saves/index.ts";
|
|
5
5
|
/** The folder of the saves, at the top of the campaign. */
|
|
6
6
|
export declare const savesFolderName = ".saves";
|
|
7
7
|
/** The folder where an export writes its adventure's zip (ADV-7): no part of the game, so no save holds it. */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// The saves of a campaign as commands use them (D-54, D-55): which files a save holds, a save made at the end of a scene or when asked, and given back.
|
|
2
2
|
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { campaignFileName, hostFileNames, readSettings } from "
|
|
4
|
-
import { filesIn } from "
|
|
5
|
-
import { appendLogEntry, logFileName, logLine, readLog } from "
|
|
6
|
-
import { files, isInside } from "
|
|
7
|
-
import { comparableText } from "
|
|
8
|
-
import { locate, playerCharacters } from "
|
|
9
|
-
import { packFiles, readSaves, saveFileName, unpackFiles } from "
|
|
10
|
-
import { formatGameDate } from "
|
|
11
|
-
import { playerCharacter } from "./
|
|
12
|
-
import { newDatedLogEntry, readPresent } from "./
|
|
13
|
-
import { campaignWorld } from "./
|
|
3
|
+
import { campaignFileName, hostFileNames, readSettings } from "../../campaign/index.js";
|
|
4
|
+
import { filesIn } from "../../core/files.js";
|
|
5
|
+
import { appendLogEntry, logFileName, logLine, readLog } from "../../core/log.js";
|
|
6
|
+
import { files, isInside } from "../../core/store.js";
|
|
7
|
+
import { comparableText } from "../../core/text.js";
|
|
8
|
+
import { locate, playerCharacters } from "../../pages/index.js";
|
|
9
|
+
import { packFiles, readSaves, saveFileName, unpackFiles } from "../../saves/index.js";
|
|
10
|
+
import { formatGameDate } from "../../time/index.js";
|
|
11
|
+
import { playerCharacter } from "./knowledge.js";
|
|
12
|
+
import { newDatedLogEntry, readPresent } from "./time.js";
|
|
13
|
+
import { campaignWorld } from "./world.js";
|
|
14
14
|
/** The folder of the saves, at the top of the campaign. */
|
|
15
15
|
export const savesFolderName = ".saves";
|
|
16
16
|
/** The folder where an export writes its adventure's zip (ADV-7): no part of the game, so no save holds it. */
|
|
@@ -148,17 +148,6 @@ export function resetSave(saves, why, to) {
|
|
|
148
148
|
? saves.find((save) => why.get(save.number) === "session zero")
|
|
149
149
|
: (saves.find((save) => why.get(save.number) === "start") ?? saves.find((save) => why.get(save.number) !== "session zero"));
|
|
150
150
|
}
|
|
151
|
-
/** "before load 003.zip", or "before load 003 (2).zip" when that one is there: a copy before a load never takes the place of another. */
|
|
152
|
-
function freeCopyName(root, save) {
|
|
153
|
-
const taken = new Set(files().entries(join(root, savesFolderName)).map((entry) => entry.name.toLowerCase()));
|
|
154
|
-
const base = `before load ${String(save.number).padStart(3, "0")}`;
|
|
155
|
-
for (let count = 1;; count++) {
|
|
156
|
-
const name = count === 1 ? `${base}.zip` : `${base} (${count}).zip`;
|
|
157
|
-
if (!taken.has(name.toLowerCase())) {
|
|
158
|
-
return name;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
151
|
/** "3 - day 2, 06.10 - Scontro all'ossario": a save as outputs name it. */
|
|
163
152
|
export function saveText(save) {
|
|
164
153
|
return `${save.number} - ${save.label}`;
|
|
@@ -212,6 +201,46 @@ export function partyDeathNotes(root, name) {
|
|
|
212
201
|
`${name} is dead while the others live: ask the table now, before the scene's end saves and the death stays, whether to go back to ${mode === "checkpoint" ? `the last save, ${saveText(last)}` : "a save (save list)"}, for everyone, or to keep the death and go on, with a new character for whoever played ${name} if they want one; save load only once they choose it.`,
|
|
213
202
|
];
|
|
214
203
|
}
|
|
204
|
+
/** Whether a path is one of the game's files: in the campaign, not the host's nor under a name with a dot at its top (SAV-2). */
|
|
205
|
+
export function isGameFile(root, path) {
|
|
206
|
+
return isInside(root, path) && isGameName(relative(root, path).split(sep)[0]);
|
|
207
|
+
}
|
|
208
|
+
/** What loading may do under each mode of saves (D-55); reset, back to the start, in every mode (D-359). */
|
|
209
|
+
export function loadRule(mode) {
|
|
210
|
+
switch (mode) {
|
|
211
|
+
case "free":
|
|
212
|
+
return "With saves free, load goes back to any of them when the player asks, and make saves when they ask.";
|
|
213
|
+
case "checkpoint":
|
|
214
|
+
return "With saves checkpoint, load goes back to the last one, and only once the player character is dead, if the player wants.";
|
|
215
|
+
default:
|
|
216
|
+
return "With saves permadeath, the game never goes back, but to its start with reset when the player wants to start over. "
|
|
217
|
+
+ "If something broke outside the story, the player may unzip a save from .saves by hand.";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/** Why the mode of saves does not allow going back to a save (D-55): permadeath never, checkpoint only to the last and once the player character is dead; undefined when it may. */
|
|
221
|
+
export function loadRefusal(mode, saves, chosen, dead) {
|
|
222
|
+
if (mode === "permadeath") {
|
|
223
|
+
return loadRule(mode);
|
|
224
|
+
}
|
|
225
|
+
if (mode === "checkpoint" && !dead) {
|
|
226
|
+
return "With saves checkpoint, the game goes back only once the player character is dead, and they are alive: go on with the story.";
|
|
227
|
+
}
|
|
228
|
+
if (mode === "checkpoint" && chosen !== saves.at(-1)) {
|
|
229
|
+
return `With saves checkpoint, the game goes back only to the last save, ${saveText(saves.at(-1))}.`;
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
/** "before load 003.zip", or "before load 003 (2).zip" when that one is there: a copy before a load never takes the place of another. */
|
|
234
|
+
function freeCopyName(root, save) {
|
|
235
|
+
const taken = new Set(files().entries(join(root, savesFolderName)).map((entry) => entry.name.toLowerCase()));
|
|
236
|
+
const base = `before load ${String(save.number).padStart(3, "0")}`;
|
|
237
|
+
for (let count = 1;; count++) {
|
|
238
|
+
const name = count === 1 ? `${base}.zip` : `${base} (${count}).zip`;
|
|
239
|
+
if (!taken.has(name.toLowerCase())) {
|
|
240
|
+
return name;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
215
244
|
/** The files a save holds, by their path inside it; refused, with what to do, when the zip cannot be read. */
|
|
216
245
|
function readSave(root, save) {
|
|
217
246
|
try {
|
|
@@ -235,10 +264,6 @@ function gameFiles(root) {
|
|
|
235
264
|
return entry.isFolder ? filesIn(path, () => true) : [path];
|
|
236
265
|
});
|
|
237
266
|
}
|
|
238
|
-
/** Whether a path is one of the game's files: in the campaign, not the host's nor under a name with a dot at its top (SAV-2). */
|
|
239
|
-
export function isGameFile(root, path) {
|
|
240
|
-
return isInside(root, path) && isGameName(relative(root, path).split(sep)[0]);
|
|
241
|
-
}
|
|
242
267
|
/** Whether a name at the top of a campaign is the game's: not the host's, in any case, as Windows reads them, and not starting with a dot. */
|
|
243
268
|
function isGameName(name) {
|
|
244
269
|
return !name.startsWith(".") && !hostNames.has(name.toLowerCase()) && name.toLowerCase() !== exportsFolderName;
|
|
@@ -249,31 +274,6 @@ function joinBytes(first, second) {
|
|
|
249
274
|
joined.set(second, first?.length ?? 0);
|
|
250
275
|
return joined;
|
|
251
276
|
}
|
|
252
|
-
/** What loading may do under each mode of saves (D-55); reset, back to the start, in every mode (D-359). */
|
|
253
|
-
export function loadRule(mode) {
|
|
254
|
-
switch (mode) {
|
|
255
|
-
case "free":
|
|
256
|
-
return "With saves free, load goes back to any of them when the player asks, and make saves when they ask.";
|
|
257
|
-
case "checkpoint":
|
|
258
|
-
return "With saves checkpoint, load goes back to the last one, and only once the player character is dead, if the player wants.";
|
|
259
|
-
default:
|
|
260
|
-
return "With saves permadeath, the game never goes back, but to its start with reset when the player wants to start over. "
|
|
261
|
-
+ "If something broke outside the story, the player may unzip a save from .saves by hand.";
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/** Why the mode of saves does not allow going back to a save (D-55): permadeath never, checkpoint only to the last and once the player character is dead; undefined when it may. */
|
|
265
|
-
export function loadRefusal(mode, saves, chosen, dead) {
|
|
266
|
-
if (mode === "permadeath") {
|
|
267
|
-
return loadRule(mode);
|
|
268
|
-
}
|
|
269
|
-
if (mode === "checkpoint" && !dead) {
|
|
270
|
-
return "With saves checkpoint, the game goes back only once the player character is dead, and they are alive: go on with the story.";
|
|
271
|
-
}
|
|
272
|
-
if (mode === "checkpoint" && chosen !== saves.at(-1)) {
|
|
273
|
-
return `With saves checkpoint, the game goes back only to the last save, ${saveText(saves.at(-1))}.`;
|
|
274
|
-
}
|
|
275
|
-
return undefined;
|
|
276
|
-
}
|
|
277
277
|
/** The place the player character is in, the nearest that holds it, which a save keeps for its picture, as in a video game (D-359); undefined in none. */
|
|
278
278
|
function partyPlace(root, context) {
|
|
279
279
|
try {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import { type Scene, type SceneCopy } from "
|
|
1
|
+
import type { Problem } from "../../core/problem.ts";
|
|
2
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
3
|
+
import { type Scene, type SceneCopy } from "../../scene/index.ts";
|
|
4
4
|
/** A scene that has been closed, as the log keeps it. */
|
|
5
5
|
export interface ClosedScene {
|
|
6
6
|
title: string;
|
|
7
7
|
type: string;
|
|
8
8
|
summary: string;
|
|
9
9
|
}
|
|
10
|
+
/** The place where the open scene is, where its copies are (ENV-2); none when there is no scene, or it is in no place that exists. */
|
|
11
|
+
export declare function scenePlace(world: World, scene: Scene | undefined): Page | undefined;
|
|
10
12
|
/** The open scene, or the problem that keeps state.yaml from giving it; neither when no scene is open. */
|
|
11
13
|
export declare function readOpenScene(root: string): {
|
|
12
14
|
scene?: Scene;
|
|
@@ -65,5 +67,13 @@ export declare function updateScene(root: string, changes: [string[], unknown][]
|
|
|
65
67
|
export declare function openSceneLog(root: string, scene: Scene): string;
|
|
66
68
|
/** The scenes closed so far, newest first, from the log; lines written wrongly by hand are left out. */
|
|
67
69
|
export declare function closedScenes(root: string): ClosedScene[];
|
|
70
|
+
/**
|
|
71
|
+
* The copies of the last scene that closed, at their last numbers as its hidden log lines keep them: those that left during it and those its close removed; with
|
|
72
|
+
* the name of the place it was in, when it had one.
|
|
73
|
+
*/
|
|
74
|
+
export declare function lastClosedCopies(root: string): {
|
|
75
|
+
copies: Record<string, SceneCopy>;
|
|
76
|
+
place?: string;
|
|
77
|
+
};
|
|
68
78
|
/** The problems of the open scene: a scene that cannot be read, links to pages that do not exist, copies named like pages. A state.yaml that cannot be read at all is reported with the game date. */
|
|
69
79
|
export declare function sceneProblems(root: string, world: World): Problem[];
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
// The open scene as several commands use it: read from state.yaml, written back, and checked against the world.
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { changeStateAt, readStateValues } from "
|
|
4
|
-
import { readLog } from "
|
|
5
|
-
import { sameName } from "
|
|
6
|
-
import { baseChain, findPage, isEmptyField, isInParty, kindMessage, locate, pagesWithName, parsePageReference, readOnlyMessage, systemFirstFix, systemLabel, systemPageNamed } from "
|
|
7
|
-
import { readScene } from "
|
|
8
|
-
import { missingSystemHint } from "./game-world.js";
|
|
3
|
+
import { changeStateAt, readStateValues } from "../../campaign/index.js";
|
|
4
|
+
import { readLog } from "../../core/log.js";
|
|
5
|
+
import { sameName } from "../../core/text.js";
|
|
6
|
+
import { baseChain, findPage, isEmptyField, isInParty, kindMessage, locate, pagesWithName, parsePageReference, readOnlyMessage, systemFirstFix, systemLabel, systemPageNamed } from "../../pages/index.js";
|
|
7
|
+
import { readScene } from "../../scene/index.js";
|
|
9
8
|
import { countersText, pageCounters } from "./page-counters.js";
|
|
9
|
+
import { missingSystemHint } from "./world.js";
|
|
10
10
|
const closedSceneSchema = z.looseObject({ title: z.string(), type: z.string(), summary: z.string() });
|
|
11
|
+
const loggedCopiesSchema = z.record(z.string(), z.looseObject({ creature: z.string() }));
|
|
12
|
+
/** The place where the open scene is, where its copies are (ENV-2); none when there is no scene, or it is in no place that exists. */
|
|
13
|
+
export function scenePlace(world, scene) {
|
|
14
|
+
return scene?.place === undefined ? undefined : pagesWithName(world, parsePageReference(scene.place).name)[0];
|
|
15
|
+
}
|
|
11
16
|
/** The open scene, or the problem that keeps state.yaml from giving it; neither when no scene is open. */
|
|
12
17
|
export function readOpenScene(root) {
|
|
13
18
|
let value;
|
|
@@ -110,13 +115,6 @@ export function checkNotSystemPage(world, open, page) {
|
|
|
110
115
|
}
|
|
111
116
|
throw new Error(page.type === "creature" ? `${kindMessage(page)} Nothing changed.` : readOnlyMessage(page, [], world));
|
|
112
117
|
}
|
|
113
|
-
/** The copies in the scene that read from a page, directly or through a variant, with their counters: "Annegato 1 (hp 22/22)". */
|
|
114
|
-
function copiesReadingFrom(world, scene, page) {
|
|
115
|
-
return Object.entries(scene.copies).filter(([name, copy]) => baseChain(world, copyPage(name, copy)).includes(page)).map(([name, copy]) => {
|
|
116
|
-
const counters = countersText(copyCounters(world, copy));
|
|
117
|
-
return counters === "" ? name : `${name} (${counters})`;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
118
|
/**
|
|
121
119
|
* "in the files Ettore is in Mulino abbandonato: if they are in Ossario, move, page Ettore, to Ossario; if they left the scene, scene leave Ettore": the living members
|
|
122
120
|
* of the party in a scene whom the files put elsewhere, as a hand-made change may leave them (CON-8). Empty when there are none, or the scene is a travel one.
|
|
@@ -184,6 +182,29 @@ export function closedScenes(root) {
|
|
|
184
182
|
return parsed.success ? [parsed.data] : [];
|
|
185
183
|
}).reverse();
|
|
186
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* The copies of the last scene that closed, at their last numbers as its hidden log lines keep them: those that left during it and those its close removed; with
|
|
187
|
+
* the name of the place it was in, when it had one.
|
|
188
|
+
*/
|
|
189
|
+
export function lastClosedCopies(root) {
|
|
190
|
+
let copies = {};
|
|
191
|
+
let closed = { copies: {} };
|
|
192
|
+
for (const entry of readLog(root)) {
|
|
193
|
+
if (entry.type === "scene-opened") {
|
|
194
|
+
copies = {};
|
|
195
|
+
}
|
|
196
|
+
else if (entry.type === "scene-closed") {
|
|
197
|
+
const place = typeof entry.data.place === "string" && entry.data.place.trim() !== "" ? parsePageReference(entry.data.place).name : undefined;
|
|
198
|
+
closed = { copies, ...(place === undefined ? {} : { place }) };
|
|
199
|
+
copies = {};
|
|
200
|
+
}
|
|
201
|
+
else if (entry.type === "scene-changed") {
|
|
202
|
+
const logged = loggedCopiesSchema.safeParse(entry.data.copies);
|
|
203
|
+
copies = logged.success ? { ...copies, ...logged.data } : copies;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return closed;
|
|
207
|
+
}
|
|
187
208
|
/** The problems of the open scene: a scene that cannot be read, links to pages that do not exist, copies named like pages. A state.yaml that cannot be read at all is reported with the game date. */
|
|
188
209
|
export function sceneProblems(root, world) {
|
|
189
210
|
try {
|
|
@@ -216,6 +237,13 @@ export function sceneProblems(root, world) {
|
|
|
216
237
|
}));
|
|
217
238
|
return [...missing, ...clashes];
|
|
218
239
|
}
|
|
240
|
+
/** The copies in the scene that read from a page, directly or through a variant, with their counters: "Annegato 1 (hp 22/22)". */
|
|
241
|
+
function copiesReadingFrom(world, scene, page) {
|
|
242
|
+
return Object.entries(scene.copies).filter(([name, copy]) => baseChain(world, copyPage(name, copy)).includes(page)).map(([name, copy]) => {
|
|
243
|
+
const counters = countersText(copyCounters(world, copy));
|
|
244
|
+
return counters === "" ? name : `${name} (${counters})`;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
219
247
|
/** One line of the log as the open scene's log gives it, or nothing for a line it leaves out, such as a turn passing, a save, or one written by hand without what it needs. */
|
|
220
248
|
function sceneLogLine(type, data) {
|
|
221
249
|
const why = typeof data.why === "string" && data.why !== "" ? ` (${data.why})` : "";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type Counter } from "
|
|
3
|
-
import { type Page, type World } from "
|
|
4
|
-
import type { GameSystem, SystemWords } from "
|
|
5
|
-
import { type LevelNeed } from "./
|
|
1
|
+
import type { Problem } from "../../core/problem.ts";
|
|
2
|
+
import { type Counter } from "../../counters/index.ts";
|
|
3
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
4
|
+
import type { GameSystem, SystemWords } from "../../systems/index.ts";
|
|
5
|
+
import { type LevelNeed } from "./experience.ts";
|
|
6
6
|
/** What status says of the sheet before there is a player character (DAT-2): what is written, what only when it applies, what the system works out, and the lists it names. */
|
|
7
7
|
export interface SheetSummary {
|
|
8
8
|
system: string;
|