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
|
@@ -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). */
|
|
@@ -10,10 +10,18 @@ export interface TitledRule {
|
|
|
10
10
|
text: string;
|
|
11
11
|
precedents: string[];
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The rule with this title: a house rule first, else the game system's, in the campaign's language where the system has its rules in it, by the title's word
|
|
15
|
+
* there, Prono for Prone (D-542); undefined when neither has a section so titled.
|
|
16
|
+
*/
|
|
14
17
|
export declare function ruleTitled(root: string, system: GameSystem, title: string): TitledRule | undefined;
|
|
15
|
-
/**
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The rules of a game system, its own with those of the version of its rules (VER-3): a chapter of the version takes the place of a common one of its file.
|
|
20
|
+
* In a language the system has its rules in, a chapter translated takes the place of its English one (D-542).
|
|
21
|
+
*/
|
|
22
|
+
export declare function systemRuleBook(system: GameSystem, language?: string): RuleSection[];
|
|
23
|
+
/** Whether a game system has its rules in a language, in one of its folders (D-542). */
|
|
24
|
+
export declare function hasTranslatedRules(system: GameSystem, language: string | undefined): boolean;
|
|
17
25
|
/** "Poisoned is a condition of the system 5e, by a house rule:" and the text, then the precedents on it, with what to do when they disagree with the book. */
|
|
18
26
|
export declare function ruleBlock(rule: TitledRule): string;
|
|
19
27
|
/** The rule a precedent is about: the name before its colon, as in "Poisoned: …" (D-179); undefined when it has none. */
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
import { join } from "node:path";
|
|
3
|
+
import { houseRulesFolderName, readListSetting, readTextSetting } from "../../campaign/index.js";
|
|
4
|
+
import { translationFolder } from "../../core/files.js";
|
|
5
|
+
import { comparableText } from "../../core/text.js";
|
|
6
|
+
import { isTitled, readRuleBook } from "../../rules/index.js";
|
|
7
|
+
import { layeredSystemWords, systemContentFolders } from "../../systems/index.js";
|
|
8
|
+
/** The source of the campaign's own rules, in the campaign's rules folder. */
|
|
9
|
+
export const houseRules = "house rules";
|
|
10
|
+
/** What to do when a precedent and the book disagree (D-181). */
|
|
11
|
+
export const disagreementAdvice = "When the text and a precedent disagree, tell the player and ask whether to keep the precedent: if so, write it again saying it is a house rule, against the book; if not, remove it. Both with config.";
|
|
12
|
+
/**
|
|
13
|
+
* The rule with this title: a house rule first, else the game system's, in the campaign's language where the system has its rules in it, by the title's word
|
|
14
|
+
* there, Prono for Prone (D-542); undefined when neither has a section so titled.
|
|
15
|
+
*/
|
|
16
|
+
export function ruleTitled(root, system, title) {
|
|
17
|
+
const titled = (section) => isTitled(section, title);
|
|
18
|
+
const language = readTextSetting(root, "language");
|
|
19
|
+
const own = ownWord(system, language, title);
|
|
20
|
+
const house = readRuleBook(join(root, houseRulesFolderName), houseRules).find(titled);
|
|
21
|
+
const section = house ?? systemRuleBook(system, language).find((one) => titled(one) || (own !== undefined && isTitled(one, own))) ?? systemRuleBook(system).find(titled);
|
|
22
|
+
if (section === undefined) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const precedents = readListSetting(root, "precedents").filter((precedent) => comparableText(precedentRule(precedent) ?? "") === comparableText(title));
|
|
26
|
+
return { source: section.source, text: section.text, precedents };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The rules of a game system, its own with those of the version of its rules (VER-3): a chapter of the version takes the place of a common one of its file.
|
|
30
|
+
* In a language the system has its rules in, a chapter translated takes the place of its English one (D-542).
|
|
31
|
+
*/
|
|
32
|
+
export function systemRuleBook(system, language) {
|
|
33
|
+
const [own, version] = systemContentFolders(system).map((folder) => translatedBook(readRuleBook(join(folder, "rules"), system.name), translationFolder(folder, language), system.name));
|
|
34
|
+
return version === undefined ? own : [...own.filter((section) => !version.some((other) => other.file === section.file)), ...version];
|
|
35
|
+
}
|
|
36
|
+
/** Whether a game system has its rules in a language, in one of its folders (D-542). */
|
|
37
|
+
export function hasTranslatedRules(system, language) {
|
|
38
|
+
return systemContentFolders(system).some((folder) => {
|
|
39
|
+
const translations = translationFolder(folder, language);
|
|
40
|
+
return translations !== undefined && readRuleBook(join(translations, "rules"), system.name).length > 0;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** A word of the system in a language, by its English, as Prono for Prone; none without it, or when its words do not read, which validate says. */
|
|
44
|
+
function ownWord(system, language, english) {
|
|
45
|
+
try {
|
|
46
|
+
return language === undefined ? undefined : layeredSystemWords(systemContentFolders(system), language)?.words[english];
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function translatedBook(book, translations, system) {
|
|
53
|
+
const translated = translations === undefined ? [] : readRuleBook(join(translations, "rules"), system);
|
|
54
|
+
const files = new Set(translated.map((section) => section.file));
|
|
55
|
+
return files.size === 0 ? book : [...book.filter((section) => !files.has(section.file)), ...translated].sort((first, second) => (first.file < second.file ? -1 : first.file > second.file ? 1 : 0));
|
|
56
|
+
}
|
|
57
|
+
/** "Poisoned is a condition of the system 5e, by a house rule:" and the text, then the precedents on it, with what to do when they disagree with the book. */
|
|
58
|
+
export function ruleBlock(rule) {
|
|
59
|
+
const precedents = rule.precedents.length === 0 ? "" : `\n\nPrecedents of the table: ${rule.precedents.join(" · ")}`;
|
|
60
|
+
const advice = rule.precedents.length > 0 && rule.source !== houseRules ? `\n${disagreementAdvice}` : "";
|
|
61
|
+
return `${rule.text}${precedents}${advice}`;
|
|
62
|
+
}
|
|
63
|
+
/** The rule a precedent is about: the name before its colon, as in "Poisoned: …" (D-179); undefined when it has none. */
|
|
64
|
+
export function precedentRule(precedent) {
|
|
65
|
+
return precedent.includes(":") ? precedent.split(":")[0].trim() : undefined;
|
|
66
|
+
}
|
|
@@ -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;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// The character sheet of the game system (D-204, D-207, DAT-2): its groups as show gives them, the fields a character still lacks, and the names a list takes (SYS-8).
|
|
2
|
-
import { listItemNames, numberOf } from "
|
|
3
|
-
import { comparableText, valueNamed } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, entryPage, inheritedFields, isEmptyField, isStandardField, linksIn, readEntry, stackName, stacksOf, textsIn, validHoldersOf, weightUnit, } from "
|
|
6
|
-
import { fieldName } from "
|
|
2
|
+
import { listItemNames, numberOf } from "../../core/formula.js";
|
|
3
|
+
import { comparableText, valueNamed } from "../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../counters/index.js";
|
|
5
|
+
import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, entryPage, inheritedFields, isEmptyField, isStandardField, linksIn, readEntry, stackName, stacksOf, textsIn, validHoldersOf, weightUnit, } from "../../pages/index.js";
|
|
6
|
+
import { fieldName } from "../../progression/index.js";
|
|
7
7
|
import { effectiveFields } from "./effect-layer.js";
|
|
8
|
-
import { experienceOf, experienceText, levelNeed } from "./
|
|
8
|
+
import { experienceOf, experienceText, levelNeed } from "./experience.js";
|
|
9
9
|
import { givenItems, progressionOf } from "./progression.js";
|
|
10
10
|
import { carriedIn, counterLimits, formulaValue, hasSheet, isUse, itemLines, itemList, signedText, workedFields, workedLine, workedMaximum, workedParts } from "./worked-out.js";
|
|
11
11
|
/** The sheet of the game system as status gives it before there is a player character (DAT-2); undefined when the system has none. */
|
|
@@ -112,10 +112,6 @@ export function sheetData(world, system, page) {
|
|
|
112
112
|
return values.length === 0 ? [] : [{ name: group.name, ...iconOf(group), values }];
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
/** A group's icon, as the data of the sheet carries it: none when the system gives none. */
|
|
116
|
-
function iconOf(group) {
|
|
117
|
-
return group.icon === undefined ? {} : { icon: group.icon };
|
|
118
|
-
}
|
|
119
115
|
/**
|
|
120
116
|
* The icon on the token of one of the party (D-414): the system's for the first item of its field that has one, by its name or by a page it derives from, as a
|
|
121
117
|
* class of the campaign built on the system's; none when the system gives none.
|
|
@@ -280,18 +276,6 @@ export function checkListValues(system, lists, onSheet = false) {
|
|
|
280
276
|
}
|
|
281
277
|
}
|
|
282
278
|
}
|
|
283
|
-
/** Text with commas outside links and parentheses, as "simple weapons, martial weapons": several names that a list holds apart. */
|
|
284
|
-
function isCommaText(value) {
|
|
285
|
-
return typeof value === "string" && value.replace(/\[\[[^\]]*\]\]/g, "").replace(/\([^)]*\)/g, "").includes(",");
|
|
286
|
-
}
|
|
287
|
-
/** A field the system declares as a list, such as classes. */
|
|
288
|
-
function isListField(system, field) {
|
|
289
|
-
return Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
290
|
-
}
|
|
291
|
-
/** A list the system declares without the names it takes, which are checked by name, as weapon-proficiencies (SYS-8). */
|
|
292
|
-
function isOpenList(system, field) {
|
|
293
|
-
return allowedValues(system, field, false) === undefined && Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
294
|
-
}
|
|
295
279
|
/**
|
|
296
280
|
* The lists written on the campaign's pages with names the game system does not take, or as text with commas, which reads as one name (SYS-8), such as one
|
|
297
281
|
* written by hand.
|
|
@@ -311,6 +295,76 @@ export function listValueProblems(world, system) {
|
|
|
311
295
|
});
|
|
312
296
|
});
|
|
313
297
|
}
|
|
298
|
+
/** A character's load when it is over its limit, as status says it under the rigor «rules» or «simulation» (LOAD-3): "load 230 / 210 lb, over the limit"; undefined otherwise. */
|
|
299
|
+
export function overLoad(world, system, page) {
|
|
300
|
+
if (system?.load === undefined || !hasSheet(world, page)) {
|
|
301
|
+
return undefined;
|
|
302
|
+
}
|
|
303
|
+
const fields = effectiveFields(world, page);
|
|
304
|
+
const load = carriedIn(fields) ?? carriedWeight(world, system.load, page);
|
|
305
|
+
const limit = formulaValue(world, fields, system.load.limit);
|
|
306
|
+
const value = loadValue(world, system, page, fields);
|
|
307
|
+
return limit === undefined || load <= limit || value === undefined ? undefined : `load ${value.text}, over the limit`;
|
|
308
|
+
}
|
|
309
|
+
/** For an item created without a weight, its own or its base's, when the system counts loads: the AI estimates one (LOAD-1). */
|
|
310
|
+
export function weightlessNote(system, world, page) {
|
|
311
|
+
if (system?.load === undefined || page.type !== "item" || valueNamed(inheritedFields(world, page), system.load.field) !== undefined) {
|
|
312
|
+
return [];
|
|
313
|
+
}
|
|
314
|
+
const unit = weightUnit(world, system.load.field) ?? "lb";
|
|
315
|
+
return [`${page.name} has no ${system.load.field}, so it adds nothing to a load: if it weighs, estimate it from things like it, such as set ${system.load.field}="2 ${unit}".`];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* A field's value as a counter, with the limits the field writes or the system works out (FOR-6): 18/24, or momentum 4 from -6; undefined for a number that is
|
|
319
|
+
* no counter, such as str 14, and for any other value.
|
|
320
|
+
*/
|
|
321
|
+
export function counterOf(world, fields, field, value) {
|
|
322
|
+
const kind = declaredKind(world, field);
|
|
323
|
+
const read = readCounter(value);
|
|
324
|
+
const limits = counterLimits(world, fields, field);
|
|
325
|
+
// A field the system declares as anything else is never one, as a challenge rating of 1/4.
|
|
326
|
+
const counted = kind === "counter" || (kind === undefined && (read?.max !== undefined || limits.min !== undefined || limits.max !== undefined));
|
|
327
|
+
return read === undefined || !counted ? undefined : { ...limits, ...read };
|
|
328
|
+
}
|
|
329
|
+
/** The experience between the points of the character's level and those of the next, for the field that counts it (PRO-6); none at the last level. */
|
|
330
|
+
export function experienceProgress(world, fields, field) {
|
|
331
|
+
if (comparableText(field) !== comparableText(world.system?.progression?.experience?.field ?? "")) {
|
|
332
|
+
return undefined;
|
|
333
|
+
}
|
|
334
|
+
const experience = experienceOf(world, fields);
|
|
335
|
+
return experience?.next === undefined ? undefined : { value: experience.points, from: experience.least ?? 0, to: experience.next.points };
|
|
336
|
+
}
|
|
337
|
+
/** What the points of the field that counts the experience say of the levels (PRO-6); none for another field, or at the last level. */
|
|
338
|
+
export function experienceNeed(world, fields, field) {
|
|
339
|
+
const experience = comparableText(field) === comparableText(world.system?.progression?.experience?.field ?? "") ? experienceOf(world, fields) : undefined;
|
|
340
|
+
return experience === undefined ? undefined : levelNeed(experience);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* What the master is told as a roll of the player character recalls what they know, as History, by the fields the system declares (sheet-knowledge): its
|
|
344
|
+
* outcome said as knowledge, never as an episode of their past the player did not tell (Elena's tests of 28 October, where a high roll brought one).
|
|
345
|
+
*/
|
|
346
|
+
export function knowledgeNote(system, fields) {
|
|
347
|
+
const knowledge = new Set((system?.sheetKnowledge ?? []).map(comparableText));
|
|
348
|
+
return fields.some((field) => knowledge.has(comparableText(field)))
|
|
349
|
+
? "What it reveals is what the world shows or their trade knows, said as knowledge: an episode of their past the player has not told is a question to them."
|
|
350
|
+
: undefined;
|
|
351
|
+
}
|
|
352
|
+
/** A group's icon, as the data of the sheet carries it: none when the system gives none. */
|
|
353
|
+
function iconOf(group) {
|
|
354
|
+
return group.icon === undefined ? {} : { icon: group.icon };
|
|
355
|
+
}
|
|
356
|
+
/** Text with commas outside links and parentheses, as "simple weapons, martial weapons": several names that a list holds apart. */
|
|
357
|
+
function isCommaText(value) {
|
|
358
|
+
return typeof value === "string" && value.replace(/\[\[[^\]]*\]\]/g, "").replace(/\([^)]*\)/g, "").includes(",");
|
|
359
|
+
}
|
|
360
|
+
/** A field the system declares as a list, such as classes. */
|
|
361
|
+
function isListField(system, field) {
|
|
362
|
+
return Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
363
|
+
}
|
|
364
|
+
/** A list the system declares without the names it takes, which are checked by name, as weapon-proficiencies (SYS-8). */
|
|
365
|
+
function isOpenList(system, field) {
|
|
366
|
+
return allowedValues(system, field, false) === undefined && Object.entries(system.fields).some(([name, kind]) => kind === "list" && comparableText(name) === comparableText(field));
|
|
367
|
+
}
|
|
314
368
|
/** How many marks each computed field earns (D-217, DAT-2): one for each list of the system's marks that it reads with its item, where that item changes it. */
|
|
315
369
|
function markCounts(world, system, fields) {
|
|
316
370
|
const marking = new Set(system.marks.map(comparableText));
|
|
@@ -391,25 +445,6 @@ function carriedRows(world, holder, marks, depth = 0, seen = new Set()) {
|
|
|
391
445
|
return [row(page.name, "", page), ...carriedRows(world, page, marks, depth + 1, seen)];
|
|
392
446
|
});
|
|
393
447
|
}
|
|
394
|
-
/** A character's load when it is over its limit, as status says it under the rigor «rules» or «simulation» (LOAD-3): "load 230 / 210 lb, over the limit"; undefined otherwise. */
|
|
395
|
-
export function overLoad(world, system, page) {
|
|
396
|
-
if (system?.load === undefined || !hasSheet(world, page)) {
|
|
397
|
-
return undefined;
|
|
398
|
-
}
|
|
399
|
-
const fields = effectiveFields(world, page);
|
|
400
|
-
const load = carriedIn(fields) ?? carriedWeight(world, system.load, page);
|
|
401
|
-
const limit = formulaValue(world, fields, system.load.limit);
|
|
402
|
-
const value = loadValue(world, system, page, fields);
|
|
403
|
-
return limit === undefined || load <= limit || value === undefined ? undefined : `load ${value.text}, over the limit`;
|
|
404
|
-
}
|
|
405
|
-
/** For an item created without a weight, its own or its base's, when the system counts loads: the AI estimates one (LOAD-1). */
|
|
406
|
-
export function weightlessNote(system, world, page) {
|
|
407
|
-
if (system?.load === undefined || page.type !== "item" || valueNamed(inheritedFields(world, page), system.load.field) !== undefined) {
|
|
408
|
-
return [];
|
|
409
|
-
}
|
|
410
|
-
const unit = weightUnit(world, system.load.field) ?? "lb";
|
|
411
|
-
return [`${page.name} has no ${system.load.field}, so it adds nothing to a load: if it weighs, estimate it from things like it, such as set ${system.load.field}="2 ${unit}".`];
|
|
412
|
-
}
|
|
413
448
|
/** What a character carries weighs, against its limit, as the sheet shows it (D-432, LOAD-2): "23 / 210 lb", in the system's unit; none when the system counts no load. */
|
|
414
449
|
function loadValue(world, system, page, fields) {
|
|
415
450
|
if (system.load === undefined) {
|
|
@@ -465,18 +500,6 @@ function sheetFields(system) {
|
|
|
465
500
|
function entryFields(entries) {
|
|
466
501
|
return entries.flatMap((entry) => (entry.beside === undefined ? [entry.field] : [entry.field, entry.beside]));
|
|
467
502
|
}
|
|
468
|
-
/**
|
|
469
|
-
* A field's value as a counter, with the limits the field writes or the system works out (FOR-6): 18/24, or momentum 4 from -6; undefined for a number that is
|
|
470
|
-
* no counter, such as str 14, and for any other value.
|
|
471
|
-
*/
|
|
472
|
-
export function counterOf(world, fields, field, value) {
|
|
473
|
-
const kind = declaredKind(world, field);
|
|
474
|
-
const read = readCounter(value);
|
|
475
|
-
const limits = counterLimits(world, fields, field);
|
|
476
|
-
// A field the system declares as anything else is never one, as a challenge rating of 1/4.
|
|
477
|
-
const counted = kind === "counter" || (kind === undefined && (read?.max !== undefined || limits.min !== undefined || limits.max !== undefined));
|
|
478
|
-
return read === undefined || !counted ? undefined : { ...limits, ...read };
|
|
479
|
-
}
|
|
480
503
|
/** A value of the sheet as data, without marks or what is beside it: its kind, its text, a counter with its limits and the names of a list. */
|
|
481
504
|
function sheetValue(world, fields, field, value) {
|
|
482
505
|
const kind = declaredKind(world, field);
|
|
@@ -484,19 +507,6 @@ function sheetValue(world, fields, field, value) {
|
|
|
484
507
|
const items = Array.isArray(value) ? value.map((item) => linkText(String(item).trim())) : undefined;
|
|
485
508
|
return { field, ...(kind === undefined ? {} : { kind }), text: valueText(world, field, value), ...(counter === undefined ? {} : { counter }), ...(items === undefined ? {} : { items }), marks: 0 };
|
|
486
509
|
}
|
|
487
|
-
/** The experience between the points of the character's level and those of the next, for the field that counts it (PRO-6); none at the last level. */
|
|
488
|
-
export function experienceProgress(world, fields, field) {
|
|
489
|
-
if (comparableText(field) !== comparableText(world.system?.progression?.experience?.field ?? "")) {
|
|
490
|
-
return undefined;
|
|
491
|
-
}
|
|
492
|
-
const experience = experienceOf(world, fields);
|
|
493
|
-
return experience?.next === undefined ? undefined : { value: experience.points, from: experience.least ?? 0, to: experience.next.points };
|
|
494
|
-
}
|
|
495
|
-
/** What the points of the field that counts the experience say of the levels (PRO-6); none for another field, or at the last level. */
|
|
496
|
-
export function experienceNeed(world, fields, field) {
|
|
497
|
-
const experience = comparableText(field) === comparableText(world.system?.progression?.experience?.field ?? "") ? experienceOf(world, fields) : undefined;
|
|
498
|
-
return experience === undefined ? undefined : levelNeed(experience);
|
|
499
|
-
}
|
|
500
510
|
/**
|
|
501
511
|
* The free roll of an entry of the sheet (D-280): the dice the system rolls its number with, or the number beside it, as str-mod by str; none for a text. Other
|
|
502
512
|
* dice when the system's formula says so, as Stealth with disadvantage in heavy armor (D-445).
|
|
@@ -604,13 +614,3 @@ function wrongText(system, field, wrong, onSheet) {
|
|
|
604
614
|
const names = wrong.map((name) => `"${name}"`).join(", ");
|
|
605
615
|
return `${names} ${wrong.length === 1 ? "is not one of the names" : "are not names"} ${field} takes in the system ${system.name}: ${allowed.join(", ")}.${list}${own}`;
|
|
606
616
|
}
|
|
607
|
-
/**
|
|
608
|
-
* What the master is told as a roll of the player character recalls what they know, as History, by the fields the system declares (sheet-knowledge): its
|
|
609
|
-
* outcome said as knowledge, never as an episode of their past the player did not tell (Elena's tests of 28 October, where a high roll brought one).
|
|
610
|
-
*/
|
|
611
|
-
export function knowledgeNote(system, fields) {
|
|
612
|
-
const knowledge = new Set((system?.sheetKnowledge ?? []).map(comparableText));
|
|
613
|
-
return fields.some((field) => knowledge.has(comparableText(field)))
|
|
614
|
-
? "What it reveals is what the world shows or their trade knows, said as knowledge: an episode of their past the player has not told is a question to them."
|
|
615
|
-
: undefined;
|
|
616
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type HeldStack, type MovePlan, type Page, type World } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type HeldStack, type MovePlan, type Page, type World } from "../../pages/index.ts";
|
|
3
3
|
/** A stack that changes: in which container, of which kind, from how many to how many, written with which label (STK-12). */
|
|
4
4
|
export interface StackStep {
|
|
5
5
|
container: Page;
|
|
@@ -33,11 +33,6 @@ export declare function writeStacks(root: string, context: Context, world: World
|
|
|
33
33
|
world: World;
|
|
34
34
|
notes: string[];
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Writes a plan with stack steps in it, and their lines in the log (STK-12): stopped halfway, the lines of the stacks already written are still logged, then the stop is
|
|
38
|
-
* said (STK-9).
|
|
39
|
-
*/
|
|
40
|
-
export declare function applyLogged(root: string, context: Context, world: World, plan: MovePlan, steps: StackStep[], why?: string, asked?: Record<string, unknown>): World;
|
|
41
36
|
/** One line in the log for each stack that changed (STK-12): public when its container concerns the player, as a counter's (CNT-10); `asked` is how, as spend 1. */
|
|
42
37
|
export declare function logStackSteps(root: string, context: Context, world: World, steps: StackStep[], why: string | undefined, asked?: Record<string, unknown>): void;
|
|
43
38
|
/**
|
|
@@ -74,5 +69,3 @@ export declare function changeStack(root: string, context: Context, world: World
|
|
|
74
69
|
to?: number | string;
|
|
75
70
|
why?: string;
|
|
76
71
|
}): StackChange;
|
|
77
|
-
/** Whether two pages are the same one, as read in two worlds. */
|
|
78
|
-
export declare function samePage(first: Page, second: Page): boolean;
|