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,6 +1,6 @@
|
|
|
1
|
-
import { type LogEntry } from "
|
|
2
|
-
import { type Page, type World } from "
|
|
3
|
-
import type { Scene } from "
|
|
1
|
+
import { type LogEntry } from "../../core/log.ts";
|
|
2
|
+
import { type Link, type Page, type World } from "../../pages/index.ts";
|
|
3
|
+
import type { Scene } from "../../scene/index.ts";
|
|
4
4
|
/** What a character knows: the pages, and the secrets by the page that writes them. */
|
|
5
5
|
export interface Knowledge {
|
|
6
6
|
/** Whose knowledge it is: the player character, the one in the foreground when there are more (VIEW-12), or another character for the character agent voicing them (VIEW-10). */
|
|
@@ -13,11 +13,6 @@ export interface Knowledge {
|
|
|
13
13
|
}
|
|
14
14
|
/** The player character: the first living character with role pc, else the first dead one; undefined before there is one. */
|
|
15
15
|
export declare function playerCharacter(world: World): Page | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* The player character in the foreground (VIEW-12), whose place, map and squares the view shows: the one named; else, of the living, the one whose turn it is in
|
|
18
|
-
* the open scene, then one in the open scene, then the first; else the first. Undefined before there is one.
|
|
19
|
-
*/
|
|
20
|
-
export declare function foregroundCharacter(root: string, world: World, wanted?: string): Page | undefined;
|
|
21
16
|
/**
|
|
22
17
|
* What the player characters know (VIEW-12): with one, its knowledge; with more, what any of them knows, living or dead, with what each does, and the one in the
|
|
23
18
|
* foreground as whose it is. Undefined before there is one.
|
|
@@ -74,6 +69,18 @@ export declare function playerStory(page: Page): string;
|
|
|
74
69
|
export declare function knownPart(world: World, knowledge: Knowledge, page: Page, name: string): string | undefined;
|
|
75
70
|
/** Whether a page's own text, not its bases', tells the character something: its introduction, or a section or secret of it the character may read (VIEW-3). */
|
|
76
71
|
export declare function writesKnownText(knowledge: Knowledge, page: Page): boolean;
|
|
72
|
+
/** The links of a character's knows (REV-1), each with its page and the secret it names, as knownLink finds them. */
|
|
73
|
+
export declare function knownLinks(world: World, character: Page): KnownLink[];
|
|
74
|
+
/** A link of knows with its page and secret (REV-1), found as knownLinks finds them. */
|
|
75
|
+
export interface KnownLink {
|
|
76
|
+
name: string;
|
|
77
|
+
page?: Page;
|
|
78
|
+
secret?: string;
|
|
79
|
+
}
|
|
80
|
+
/** One link as knows means it: its page, by a name or an alias (D-417), and the secret it names; of two pages by one name, the one that writes the secret. */
|
|
81
|
+
export declare function knownLink(world: World, link: Link): KnownLink;
|
|
82
|
+
/** The texts of a field, one or a list, without what is not text. */
|
|
83
|
+
export declare function textList(value: unknown): string[];
|
|
77
84
|
/** The log and the open scene, read once for what several characters lived. */
|
|
78
85
|
interface LogRead {
|
|
79
86
|
log: LogEntry[];
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
// What a character knows, as the player's view and a character agent's read it (D-250, VIEW-2, VIEW-3, VIEW-10): the pages it knows and the text of each as it knows it;
|
|
2
2
|
// with more than one player character, what any of them knows, and who (VIEW-12).
|
|
3
|
-
import { readLog } from "
|
|
4
|
-
import { comparableText } from "
|
|
5
|
-
import { baseChain, inheritedByBase, introductionText, isPartyMember, isPlayerCharacter, links, locate, pagesWithNameOrAlias, parsePageReference, partContent, playerCharacters, readSection, secretNames, stacksOf, systemPageNamed, textParts, textsIn, withLinksAsWords, withoutComments, } from "
|
|
6
|
-
import { readOpenScene } from "./
|
|
3
|
+
import { readLog } from "../../core/log.js";
|
|
4
|
+
import { comparableText } from "../../core/text.js";
|
|
5
|
+
import { baseChain, inheritedByBase, introductionText, isPartyMember, isPlayerCharacter, links, locate, pagesWithNameOrAlias, parsePageReference, partContent, playerCharacters, readSection, secretNames, stacksOf, systemPageNamed, textParts, textsIn, withLinksAsWords, withoutComments, } from "../../pages/index.js";
|
|
6
|
+
import { readOpenScene } from "./scene.js";
|
|
7
7
|
/** The player character: the first living character with role pc, else the first dead one; undefined before there is one. */
|
|
8
8
|
export function playerCharacter(world) {
|
|
9
9
|
const players = playerCharacters(world);
|
|
10
10
|
return players.find((page) => page.fields.status !== "dead") ?? players[0];
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* The player character in the foreground (VIEW-12), whose place, map and squares the view shows: the one named; else, of the living, the one whose turn it is in
|
|
14
|
-
* the open scene, then one in the open scene, then the first; else the first. Undefined before there is one.
|
|
15
|
-
*/
|
|
16
|
-
export function foregroundCharacter(root, world, wanted) {
|
|
17
|
-
const players = playerCharacters(world);
|
|
18
|
-
if (wanted !== undefined && wanted.trim() !== "") {
|
|
19
|
-
const page = pagesWithNameOrAlias(world, parsePageReference(wanted).name).find(isPlayerCharacter);
|
|
20
|
-
if (page === undefined) {
|
|
21
|
-
throw new Error(`${wanted.trim()} is not a player character: give one of ${players.map((player) => player.name).join(", ") || "them, once there is one"}.`);
|
|
22
|
-
}
|
|
23
|
-
return page;
|
|
24
|
-
}
|
|
25
|
-
const living = players.filter((page) => page.fields.status !== "dead");
|
|
26
|
-
const { scene } = readOpenScene(root);
|
|
27
|
-
const named = (page, name) => name !== undefined && pagesWithNameOrAlias(world, parsePageReference(name).name)[0] === page;
|
|
28
|
-
return living.find((page) => named(page, scene?.turn)) ?? living.find((page) => (scene?.with ?? []).some((link) => named(page, link))) ?? living[0] ?? players[0];
|
|
29
|
-
}
|
|
30
12
|
/**
|
|
31
13
|
* What the player characters know (VIEW-12): with one, its knowledge; with more, what any of them knows, living or dead, with what each does, and the one in the
|
|
32
14
|
* foreground as whose it is. Undefined before there is one.
|
|
@@ -167,6 +149,44 @@ export function writesKnownText(knowledge, page) {
|
|
|
167
149
|
const said = (text) => withoutComments(text ?? "").trim() !== "";
|
|
168
150
|
return said(introductionText(page.body)) || partsOf(page).some((part) => isShown(knowledge, page, part) && said(partContent(page.body, part.name)?.content));
|
|
169
151
|
}
|
|
152
|
+
/** The links of a character's knows (REV-1), each with its page and the secret it names, as knownLink finds them. */
|
|
153
|
+
export function knownLinks(world, character) {
|
|
154
|
+
return textsIn(character.fields.knows).flatMap(links).map((link) => knownLink(world, link));
|
|
155
|
+
}
|
|
156
|
+
/** One link as knows means it: its page, by a name or an alias (D-417), and the secret it names; of two pages by one name, the one that writes the secret. */
|
|
157
|
+
export function knownLink(world, link) {
|
|
158
|
+
const pages = pagesWithNameOrAlias(world, parsePageReference(link.page).name);
|
|
159
|
+
const wanted = link.section === undefined || link.section === "" ? undefined : comparableText(link.section);
|
|
160
|
+
for (const page of wanted === undefined ? [] : pages) {
|
|
161
|
+
const secret = secretNames(page.body).find((name) => comparableText(name) === wanted);
|
|
162
|
+
if (secret !== undefined) {
|
|
163
|
+
return { name: page.name, page, secret };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return { name: pages[0]?.name ?? link.page, ...(pages[0] === undefined ? {} : { page: pages[0] }), ...(link.section === undefined ? {} : { secret: link.section }) };
|
|
167
|
+
}
|
|
168
|
+
/** The texts of a field, one or a list, without what is not text. */
|
|
169
|
+
export function textList(value) {
|
|
170
|
+
return (Array.isArray(value) ? value : [value]).filter((item) => typeof item === "string");
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The player character in the foreground (VIEW-12), whose place, map and squares the view shows: the one named; else, of the living, the one whose turn it is in
|
|
174
|
+
* the open scene, then one in the open scene, then the first; else the first. Undefined before there is one.
|
|
175
|
+
*/
|
|
176
|
+
function foregroundCharacter(root, world, wanted) {
|
|
177
|
+
const players = playerCharacters(world);
|
|
178
|
+
if (wanted !== undefined && wanted.trim() !== "") {
|
|
179
|
+
const page = pagesWithNameOrAlias(world, parsePageReference(wanted).name).find(isPlayerCharacter);
|
|
180
|
+
if (page === undefined) {
|
|
181
|
+
throw new Error(`${wanted.trim()} is not a player character: give one of ${players.map((player) => player.name).join(", ") || "them, once there is one"}.`);
|
|
182
|
+
}
|
|
183
|
+
return page;
|
|
184
|
+
}
|
|
185
|
+
const living = players.filter((page) => page.fields.status !== "dead");
|
|
186
|
+
const { scene } = readOpenScene(root);
|
|
187
|
+
const named = (page, name) => name !== undefined && pagesWithNameOrAlias(world, parsePageReference(name).name)[0] === page;
|
|
188
|
+
return living.find((page) => named(page, scene?.turn)) ?? living.find((page) => (scene?.with ?? []).some((link) => named(page, link))) ?? living[0] ?? players[0];
|
|
189
|
+
}
|
|
170
190
|
/** A text as the character may read it (VIEW-3): a link to a page it does not know, or to none, written as its words, so that no name tells the page exists. */
|
|
171
191
|
function inKnownWords(world, knowledge, text) {
|
|
172
192
|
return withLinksAsWords(text, (link) => [...pagesWithNameOrAlias(world, link.page), systemPageNamed(world, link.page)].some((page) => page !== undefined && knowsPage(knowledge, page)));
|
|
@@ -182,23 +202,6 @@ function partsOf(page) {
|
|
|
182
202
|
function isSecretText(text) {
|
|
183
203
|
return /^[ \t]{0,3}>[ \t]*\[!secret\]/i.test(text);
|
|
184
204
|
}
|
|
185
|
-
/**
|
|
186
|
-
* The links of a character's knows (REV-1), each with its page, found by a name or an old one among its aliases (D-417), and the secret it names, as that page
|
|
187
|
-
* writes it: of two pages by one name, the one that writes the secret.
|
|
188
|
-
*/
|
|
189
|
-
function knownLinks(world, character) {
|
|
190
|
-
return textsIn(character.fields.knows).flatMap(links).map((link) => {
|
|
191
|
-
const pages = pagesWithNameOrAlias(world, parsePageReference(link.page).name);
|
|
192
|
-
const wanted = link.section === undefined || link.section === "" ? undefined : comparableText(link.section);
|
|
193
|
-
for (const page of wanted === undefined ? [] : pages) {
|
|
194
|
-
const secret = secretNames(page.body).find((name) => comparableText(name) === wanted);
|
|
195
|
-
if (secret !== undefined) {
|
|
196
|
-
return { name: page.name, page, secret };
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return { name: pages[0]?.name ?? link.page, ...(pages[0] === undefined ? {} : { page: pages[0] }), ...(link.section === undefined ? {} : { secret: link.section }) };
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
205
|
/** The names of the player characters a test holds for, when more than one is played and not all of them pass it. */
|
|
203
206
|
function knownApart(knowledge, knows) {
|
|
204
207
|
const knowers = knowledge.each?.filter(knows).map((one) => one.pc.name);
|
|
@@ -244,6 +247,3 @@ function placesAtDeath(read, world, page) {
|
|
|
244
247
|
const holder = typeof from === "string" ? pagesWithNameOrAlias(world, parsePageReference(from).name)[0] : undefined;
|
|
245
248
|
return moved === undefined ? locate(world, page).chain : holder === undefined ? [] : [holder, ...locate(world, holder).chain];
|
|
246
249
|
}
|
|
247
|
-
function textList(value) {
|
|
248
|
-
return (Array.isArray(value) ? value : [value]).filter((item) => typeof item === "string");
|
|
249
|
-
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// The reading of the player's books apart from the chat (D-491, LIB-3): rules and config start a process of its own, `rpg --read-library`, which reads each
|
|
2
2
|
// book of this computer's library still to read, its PDF pages without readable text by the system's OCR, and writes its index; one at a time on a computer.
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { defaultContext } from "../../core/context.js";
|
|
5
|
+
import { readDocument, systemPageReader } from "../../documents/index.js";
|
|
6
|
+
import { claimLibrary, dropUnlisted, libraryFolders, readLibrary, releaseLibrary } from "../../library/index.js";
|
|
7
|
+
import { libraryScope } from "./library.js";
|
|
8
8
|
// The argument of the command line that reads the library, as cli.ts takes it: not a command, only what rules starts.
|
|
9
9
|
const readLibraryArgument = "--read-library";
|
|
10
10
|
/** Starts the reading of the library apart, by the command line this process runs, outliving the chat: what Context.readLibrary is where a player sits. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type LibraryScope, type LibraryState } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type LibraryScope, type LibraryState } from "../../library/index.ts";
|
|
3
3
|
/** What rules shows of the player's books (LIB-7). */
|
|
4
4
|
export interface LibraryAnswer {
|
|
5
5
|
/** The languages the books are in, by name, such as Italian. */
|
|
@@ -41,8 +41,11 @@ export declare function libraryAdditions(root: string, context: Context, given:
|
|
|
41
41
|
* their books' text, and only those the campaign holds are turned off. Refused for one neither holds.
|
|
42
42
|
*/
|
|
43
43
|
export declare function libraryRemovals(root: string, context: Context, given: string[], computer: boolean): string[];
|
|
44
|
-
/**
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The entries to turn off as full paths, before anything is written (LIB-1): refused for one the campaign does not hold, or with `computer` for one neither the
|
|
46
|
+
* campaign nor this computer's library holds.
|
|
47
|
+
*/
|
|
48
|
+
export declare function checkLibraryRemovals(root: string, context: Context, given: string[], computer: boolean): string[];
|
|
46
49
|
/**
|
|
47
50
|
* An entry of the library as config and the dashboard show it (LIB-5, D-491 (13)): its books read and those still being read, those skipped with why, whether
|
|
48
51
|
* it is there now and whether it holds more than a library takes; whether this campaign uses it, and whether it is in this computer's library.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// The player's library as the commands use it (D-491): the entries config adds, checked and allowed by the player; what config shows of each; and what rules
|
|
2
2
|
// finds in the books, after the game system's rules.
|
|
3
3
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
-
import { campaignFileName, findCampaign, readListSetting, readTextSetting } from "
|
|
5
|
-
import { comparableText } from "
|
|
6
|
-
import { documentAt, documentKinds } from "
|
|
7
|
-
import { dropUnlisted, foldersIn, isWithin, libraryFolders, libraryReader, libraryState, mostBooks, samePath, saveLibraryFolders } from "
|
|
8
|
-
import { bookHeadings, findPages, hasAllWords, pageExcerpt, pageTitle } from "
|
|
9
|
-
import { layeredSystemWords, systemContentFolders } from "
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { campaignFileName, findCampaign, readListSetting, readTextSetting } from "../../campaign/index.js";
|
|
5
|
+
import { comparableText } from "../../core/text.js";
|
|
6
|
+
import { documentAt, documentKinds } from "../../documents/index.js";
|
|
7
|
+
import { dropUnlisted, foldersIn, isWithin, libraryFolders, libraryReader, libraryState, mostBooks, samePath, saveLibraryFolders } from "../../library/index.js";
|
|
8
|
+
import { bookHeadings, findPages, hasAllWords, pageExcerpt, pageTitle } from "../../rules/index.js";
|
|
9
|
+
import { layeredSystemWords, systemContentFolders } from "../../systems/index.js";
|
|
10
|
+
import { YesRefused } from "../package.js";
|
|
11
|
+
import { languageName } from "./world.js";
|
|
12
12
|
/** What a library takes: the documents the engine reads, outside every campaign (LIB-2). */
|
|
13
13
|
export const libraryScope = { kinds: documentKinds, skipFoldersWith: campaignFileName };
|
|
14
14
|
// About how many words each excerpt shows: the first, the second, and the only one when the system has answered (LIB-7); the other pages named.
|
|
@@ -66,24 +66,37 @@ export async function libraryAdditions(root, context, given) {
|
|
|
66
66
|
*/
|
|
67
67
|
export function libraryRemovals(root, context, given, computer) {
|
|
68
68
|
const held = readListSetting(root, "library");
|
|
69
|
-
const entries =
|
|
69
|
+
const entries = checkLibraryRemovals(root, context, given, computer);
|
|
70
70
|
const index = context.bookIndex;
|
|
71
71
|
if (!computer || index === undefined) {
|
|
72
72
|
return entries.map((entry) => held.find((other) => samePath(other, entry)) ?? entry);
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
const unknown = entries.find((entry) => ![...folders, ...held].some((other) => samePath(other, entry)));
|
|
76
|
-
if (unknown !== undefined) {
|
|
77
|
-
throw new Error(`${unknown} is not in this computer's library, so nothing changed. It holds: ${folders.length > 0 ? folders.join("; ") : "nothing"}.`);
|
|
78
|
-
}
|
|
79
|
-
const remaining = folders.filter((other) => !entries.some((entry) => samePath(other, entry)));
|
|
74
|
+
const remaining = libraryFolders(index).filter((other) => !entries.some((entry) => samePath(other, entry)));
|
|
80
75
|
saveLibraryFolders(index, remaining);
|
|
81
76
|
dropUnlisted(index, remaining);
|
|
82
77
|
return held.filter((other) => entries.some((entry) => samePath(other, entry)));
|
|
83
78
|
}
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The entries to turn off as full paths, before anything is written (LIB-1): refused for one the campaign does not hold, or with `computer` for one neither the
|
|
81
|
+
* campaign nor this computer's library holds.
|
|
82
|
+
*/
|
|
83
|
+
export function checkLibraryRemovals(root, context, given, computer) {
|
|
84
|
+
const held = readListSetting(root, "library");
|
|
85
|
+
const entries = given.map((entry) => resolve(context.folder, unquoted(entry)));
|
|
86
|
+
const index = context.bookIndex;
|
|
87
|
+
if (computer && index !== undefined) {
|
|
88
|
+
const folders = libraryFolders(index);
|
|
89
|
+
const unknown = entries.find((entry) => ![...folders, ...held].some((other) => samePath(other, entry)));
|
|
90
|
+
if (unknown !== undefined) {
|
|
91
|
+
throw new Error(`${unknown} is not in this computer's library, so nothing changed. It holds: ${folders.length > 0 ? folders.join("; ") : "nothing"}.`);
|
|
92
|
+
}
|
|
93
|
+
return entries;
|
|
94
|
+
}
|
|
95
|
+
const missing = entries.find((entry) => !held.some((other) => samePath(other, entry)));
|
|
96
|
+
if (missing !== undefined) {
|
|
97
|
+
throw new Error(`"library" does not hold "${missing}", so nothing changed. It holds: ${held.length > 0 ? held.join("; ") : "nothing"}.`);
|
|
98
|
+
}
|
|
99
|
+
return entries;
|
|
87
100
|
}
|
|
88
101
|
/** The kind of why a book was skipped, from the engine's words without the book's name or path, which may hold any word. */
|
|
89
102
|
export function skippedKind(why) {
|
|
@@ -109,7 +122,10 @@ export function libraryEntries(root, context) {
|
|
|
109
122
|
path: entry,
|
|
110
123
|
books: state?.books.length ?? 0,
|
|
111
124
|
reading: state?.waiting.length ?? 0,
|
|
112
|
-
skipped: state?.skipped.map((one) =>
|
|
125
|
+
skipped: state?.skipped.map((one) => {
|
|
126
|
+
const why = skippedWhy(one.path, one.why);
|
|
127
|
+
return { name: relative(entry, one.path) || basename(one.path), why, kind: skippedKind(why) };
|
|
128
|
+
}) ?? [],
|
|
113
129
|
missing: state === undefined ? false : state.missing.length > 0,
|
|
114
130
|
crowded: state === undefined ? false : state.crowded.length > 0,
|
|
115
131
|
used: held.some((other) => samePath(other, entry)),
|
|
@@ -208,7 +224,7 @@ export function libraryAnswer(root, context, system, text, systemAnswered) {
|
|
|
208
224
|
books: state.books.map((book) => `${book.name} (${[book.language === undefined ? "" : languageName(book.language), partsOf(book)].filter((part) => part !== "").join(", ")})`),
|
|
209
225
|
...(system?.lengthUnit === undefined ? {} : { unit: system.lengthUnit }),
|
|
210
226
|
};
|
|
211
|
-
const page =
|
|
227
|
+
const page = bookPageNamed(state.books, text);
|
|
212
228
|
if (page !== undefined || text === "") {
|
|
213
229
|
return { ...base, ...(page === undefined ? {} : { page }) };
|
|
214
230
|
}
|
|
@@ -257,6 +273,39 @@ export function libraryLines(answer, text) {
|
|
|
257
273
|
const recognized = answer.shown.some((shown) => shown.recognized === true) ? recognizedRule : "";
|
|
258
274
|
return [`From the player's books${language}:`, ...excerpts, others, recognized, libraryRule(answer.unit), reading].filter((line) => line !== "");
|
|
259
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* The system's words that a search names, from the system's language into another or back (LIB-6, RUL-8): "grapple" gives Afferrato, the system's Italian, for
|
|
278
|
+
* an Italian book; "afferrato" gives Grappled, for the system. Only words of four letters or more find one; none in the system's own language, and none of the
|
|
279
|
+
* words a foe's hits are heard in. Each says whether its words are the whole search, as afferrato is, or only part of it, as tiro of tiro per colpire.
|
|
280
|
+
*/
|
|
281
|
+
export function systemWordsNamed(system, language, text, intoSystem) {
|
|
282
|
+
if (language.split("-")[0] === system.language.split("-")[0]) {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
const words = layeredSystemWords(systemContentFolders(system), language);
|
|
287
|
+
const heard = (system.combat?.inWords ?? []).map(comparableText);
|
|
288
|
+
// Not the names, which are of fields by their ids, as cha or str-save.
|
|
289
|
+
const pairs = Object.entries({ ...words?.groups, ...words?.words }).filter(([own]) => !heard.includes(comparableText(own)));
|
|
290
|
+
const found = pairs.map(([own, translated]) => (intoSystem ? [translated, own] : [own, translated])).filter(([searched]) => /\p{L}{4}/u.test(searched) && hasAllWords(text, searched));
|
|
291
|
+
// Grappled and grappled, a name and a word of the same, are one.
|
|
292
|
+
return found
|
|
293
|
+
.filter(([, named], at) => found.findIndex(([, other]) => comparableText(other) === comparableText(named)) === at)
|
|
294
|
+
.slice(0, mostTranslations)
|
|
295
|
+
.map(([searched, named]) => ({ named, whole: hasAllWords(searched, text) }));
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return [];
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/** A path as given, without the quotes of one copied from the file manager. */
|
|
302
|
+
export function unquoted(entry) {
|
|
303
|
+
return entry.trim().replace(/^"(.*)"$/, "$1").replace(/^'(.*)'$/, "$1").trim();
|
|
304
|
+
}
|
|
305
|
+
/** The campaign's library as it is used: the entries it turns on that are in this computer's library, which the player allowed (LIB-1). */
|
|
306
|
+
function campaignLibrary(root, context) {
|
|
307
|
+
return readListSetting(root, "library").filter((entry) => computerSpelling(context, entry) !== undefined);
|
|
308
|
+
}
|
|
260
309
|
/**
|
|
261
310
|
* The precedence of the books, and how their words may be used (LIB-7, D-491 (7), (9)): the sheets' numbers the system's, a variant through config, the books
|
|
262
311
|
* data quoted in the chat, the campaign's files the master's own words and numbers in the system's units.
|
|
@@ -283,7 +332,7 @@ function byBook(found, text, also) {
|
|
|
283
332
|
* The page a text names, read whole, or saying it has no readable text: "Book › p. 194", or as an excerpt cites it, "Book, PDF p. 194"; undefined when the text
|
|
284
333
|
* names no book's page. Refused for a page the book has not.
|
|
285
334
|
*/
|
|
286
|
-
function
|
|
335
|
+
function bookPageNamed(books, text) {
|
|
287
336
|
const match = /^(.+?)[\s›>,]+(?:pdf\s*)?(?:p|pp|pag|page|pagina|part|parte)\.?\s*(\d+)$/i.exec(text.trim());
|
|
288
337
|
const name = match?.[1].trim() ?? "";
|
|
289
338
|
const number = match?.[2];
|
|
@@ -306,31 +355,6 @@ function pageNamed(books, text) {
|
|
|
306
355
|
function translationsOf(system, languages, text) {
|
|
307
356
|
return [...new Set(languages.flatMap((language) => systemWordsNamed(system, language, text, false).map((one) => one.named)))].slice(0, mostTranslations);
|
|
308
357
|
}
|
|
309
|
-
/**
|
|
310
|
-
* The system's words that a search names, from the system's language into another or back (LIB-6, RUL-8): "grapple" gives Afferrato, the system's Italian, for
|
|
311
|
-
* an Italian book; "afferrato" gives Grappled, for the system. Only words of four letters or more find one; none in the system's own language, and none of the
|
|
312
|
-
* words a foe's hits are heard in. Each says whether its words are the whole search, as afferrato is, or only part of it, as tiro of tiro per colpire.
|
|
313
|
-
*/
|
|
314
|
-
export function systemWordsNamed(system, language, text, intoSystem) {
|
|
315
|
-
if (language.split("-")[0] === system.language.split("-")[0]) {
|
|
316
|
-
return [];
|
|
317
|
-
}
|
|
318
|
-
try {
|
|
319
|
-
const words = layeredSystemWords(systemContentFolders(system), language);
|
|
320
|
-
const heard = (system.combat?.inWords ?? []).map(comparableText);
|
|
321
|
-
// Not the names, which are of fields by their ids, as cha or str-save.
|
|
322
|
-
const pairs = Object.entries({ ...words?.groups, ...words?.words }).filter(([own]) => !heard.includes(comparableText(own)));
|
|
323
|
-
const found = pairs.map(([own, translated]) => (intoSystem ? [translated, own] : [own, translated])).filter(([searched]) => /\p{L}{4}/u.test(searched) && hasAllWords(text, searched));
|
|
324
|
-
// Grappled and grappled, a name and a word of the same, are one.
|
|
325
|
-
return found
|
|
326
|
-
.filter(([, named], at) => found.findIndex(([, other]) => comparableText(other) === comparableText(named)) === at)
|
|
327
|
-
.slice(0, mostTranslations)
|
|
328
|
-
.map(([searched, named]) => ({ named, whole: hasAllWords(searched, text) }));
|
|
329
|
-
}
|
|
330
|
-
catch {
|
|
331
|
-
return [];
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
358
|
/** How a part of a book is cited: "Book, PDF p. 194", or "Book, part 3" for a document without pages. */
|
|
335
359
|
function citeOf(book, part) {
|
|
336
360
|
return `${book.name}, ${book.pdf === true ? "PDF p." : "part"} ${part + 1}`;
|
|
@@ -370,10 +394,6 @@ function libraryPath(context, given) {
|
|
|
370
394
|
}
|
|
371
395
|
return resolve(context.folder, entry);
|
|
372
396
|
}
|
|
373
|
-
/** A path as given, without the quotes of one copied from the file manager. */
|
|
374
|
-
export function unquoted(entry) {
|
|
375
|
-
return entry.trim().replace(/^"(.*)"$/, "$1").replace(/^'(.*)'$/, "$1").trim();
|
|
376
|
-
}
|
|
377
397
|
/**
|
|
378
398
|
* The folders inside one too big for a library, a few by name, for the player to choose the game's books among: in their terminal or on the dashboard, never
|
|
379
399
|
* to the master, before the player allowed anything there.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Problem } from "
|
|
2
|
-
import { type FieldChange, type Page, type World } from "
|
|
3
|
-
import type { GameSystem } from "
|
|
1
|
+
import type { Problem } from "../../core/problem.ts";
|
|
2
|
+
import { type FieldChange, type Page, type World } from "../../pages/index.ts";
|
|
3
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
4
4
|
/** Refuses a change of a sheet that writes a number above its most, or makes a list longer than its most (LIM-1); before anything is written. */
|
|
5
5
|
export declare function checkLimits(world: World, system: GameSystem | undefined, page: Page | undefined, name: string, change: FieldChange): void;
|
|
6
6
|
/** Sheets written by hand above their most (LIM-2). */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The most a sheet holds (D-449, LIM-1, LIM-2): a number written no higher than the system's formula, as an ability score of 20, and a list no longer, as
|
|
2
2
|
// the spells prepared; what an item or an effect raises is no part of it.
|
|
3
|
-
import { numberOf } from "
|
|
4
|
-
import { comparableText, valueNamed } from "
|
|
5
|
-
import { textsIn } from "
|
|
3
|
+
import { numberOf } from "../../core/formula.js";
|
|
4
|
+
import { comparableText, valueNamed } from "../../core/text.js";
|
|
5
|
+
import { textsIn } from "../../pages/index.js";
|
|
6
6
|
import { effectiveFields } from "./effect-layer.js";
|
|
7
7
|
import { formulaValue, hasSheet, keepsSheet } from "./worked-out.js";
|
|
8
8
|
/** Refuses a change of a sheet that writes a number above its most, or makes a list longer than its most (LIM-1); before anything is written. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Page, type World } from "
|
|
2
|
-
import type { GameSystem } from "
|
|
1
|
+
import { type Page, type World } from "../../pages/index.ts";
|
|
2
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
3
3
|
/** What the master is told of what the fallen carry: there, for the player to take. */
|
|
4
4
|
export declare const lootAdvice = "tell what the party sees, and let the player say what is taken, and by whom.";
|
|
5
5
|
/** Whether a character or creature outside the party, a copy too, is dead or at the system's down value or below. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// What the fallen carry and what a container holds is there to be found, and what is taken is the player's to say (D-530, Elena's tests of 27 and 28 October,
|
|
2
2
|
// where the master put a fallen foe's coins in the character's pocket): text for the master where they read it, show of the page or the close of the scene.
|
|
3
|
-
import { valueNamed } from "
|
|
4
|
-
import { readCounter } from "
|
|
5
|
-
import { inheritedFields, isEmptyField, isPartyMember } from "
|
|
3
|
+
import { valueNamed } from "../../core/text.js";
|
|
4
|
+
import { readCounter } from "../../counters/index.js";
|
|
5
|
+
import { inheritedFields, isEmptyField, isPartyMember } from "../../pages/index.js";
|
|
6
6
|
/** What the master is told of what the fallen carry: there, for the player to take. */
|
|
7
7
|
export const lootAdvice = "tell what the party sees, and let the player say what is taken, and by whom.";
|
|
8
8
|
/** Whether a character or creature outside the party, a copy too, is dead or at the system's down value or below. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { LogEntry } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import type { LogEntry } from "../../core/log.ts";
|
|
3
3
|
/** What the master is told of a roll the setting hid. */
|
|
4
4
|
export declare const screenNote = "Behind the screen, as master-rolls says: tell only the outcome, in the story.";
|
|
5
5
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// The master's rolls for anyone outside the party (D-287): hidden behind the screen, as the master-rolls setting has them when unset too, or in view.
|
|
2
|
-
import { readTextSetting } from "
|
|
3
|
-
import { sameName } from "
|
|
4
|
-
import { createProof, fingerprint } from "
|
|
5
|
-
import { isPartyMember, pagesWithNameOrAlias } from "
|
|
6
|
-
import { readOpenScene } from "./
|
|
7
|
-
import { campaignWorld } from "./
|
|
2
|
+
import { readTextSetting } from "../../campaign/index.js";
|
|
3
|
+
import { sameName } from "../../core/text.js";
|
|
4
|
+
import { createProof, fingerprint } from "../../dice/index.js";
|
|
5
|
+
import { isPartyMember, pagesWithNameOrAlias } from "../../pages/index.js";
|
|
6
|
+
import { readOpenScene } from "./scene.js";
|
|
7
|
+
import { campaignWorld } from "./world.js";
|
|
8
8
|
/** What the master is told of a roll the setting hid. */
|
|
9
9
|
export const screenNote = "Behind the screen, as master-rolls says: tell only the outcome, in the story.";
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type World } from "
|
|
4
|
-
import type { GameSystem } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type World } from "../../pages/index.ts";
|
|
4
|
+
import type { GameSystem } from "../../systems/index.ts";
|
|
5
5
|
/** The modes, in their order (D-75, D-77). */
|
|
6
6
|
export declare const modes: readonly ["setup", "session zero", "play"];
|
|
7
7
|
export type Mode = (typeof modes)[number];
|
|
@@ -25,7 +25,5 @@ export declare function missingText(blocked: Blocked): string;
|
|
|
25
25
|
export declare function campaignNote(root: string, context: Context): string;
|
|
26
26
|
/** Before play, what the next mode still needs and the call that enters it once the player confirms (MOD-7); undefined in play. */
|
|
27
27
|
export declare function checklistLine(mode: Mode, root: string, context: Context, world: World): string | undefined;
|
|
28
|
-
/** The call that enters a mode, as outputs give it: mode, to "session zero". */
|
|
29
|
-
export declare function modeCall(mode: Mode): string;
|
|
30
28
|
/** The part of the instructions of a mode, the core's with the system's (MOD-5): the file setup, session-zero or play. */
|
|
31
29
|
export declare function modePart(mode: Mode, system: GameSystem | undefined): string | undefined;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// The mode of the campaign, the main state of the game (D-77): setup, session zero or play, each opened by the checklist of the one before (D-221, D-241; MOD-1–MOD-7).
|
|
2
2
|
import { basename } from "node:path";
|
|
3
|
-
import { companionWays, diceWays, difficulties, lethalities, masterRollWays, missingSettings, preparations, readSettings, readStateValues, rigors, saveModes, unansweredSettings, unitSystems } from "
|
|
4
|
-
import { readLog } from "
|
|
5
|
-
import { comparableText } from "
|
|
6
|
-
import { isInParty, playerCharacters } from "
|
|
7
|
-
import { missingWithSystems, offeredLabel } from "./game-offers.js";
|
|
8
|
-
import { campaignSystem, campaignWorld } from "./game-world.js";
|
|
3
|
+
import { companionWays, diceWays, difficulties, lethalities, masterRollWays, missingSettings, preparations, readSettings, readStateValues, rigors, saveModes, unansweredSettings, unitSystems, } from "../../campaign/index.js";
|
|
4
|
+
import { readLog } from "../../core/log.js";
|
|
5
|
+
import { comparableText } from "../../core/text.js";
|
|
6
|
+
import { isInParty, playerCharacters } from "../../pages/index.js";
|
|
9
7
|
import { missingSettingsNote } from "./notes.js";
|
|
8
|
+
import { missingWithSystems, offeredLabel } from "./offers.js";
|
|
10
9
|
import { partText } from "./parts.js";
|
|
11
10
|
import { missingSheetFields } from "./sheet.js";
|
|
11
|
+
import { campaignSystem, campaignWorld } from "./world.js";
|
|
12
12
|
/** The modes, in their order (D-75, D-77). */
|
|
13
13
|
export const modes = ["setup", "session zero", "play"];
|
|
14
14
|
// The settings the setup asks, with the values they take, so that the master offers them as they are (MOD-3).
|
|
@@ -95,14 +95,14 @@ export function checklistLine(mode, root, context, world) {
|
|
|
95
95
|
: "";
|
|
96
96
|
return `${missing.charAt(0).toUpperCase()}${missing.slice(1)}. When ${blocked === undefined ? "" : "none is left and "}the player confirms: ${modeCall(next)}.${name}${page}`;
|
|
97
97
|
}
|
|
98
|
-
/** The call that enters a mode, as outputs give it: mode, to "session zero". */
|
|
99
|
-
export function modeCall(mode) {
|
|
100
|
-
return `mode, to ${mode.includes(" ") ? `"${mode}"` : mode}`;
|
|
101
|
-
}
|
|
102
98
|
/** The part of the instructions of a mode, the core's with the system's (MOD-5): the file setup, session-zero or play. */
|
|
103
99
|
export function modePart(mode, system) {
|
|
104
100
|
return partText(mode.replace(" ", "-"), system);
|
|
105
101
|
}
|
|
102
|
+
/** The call that enters a mode, as outputs give it: mode, to "session zero". */
|
|
103
|
+
function modeCall(mode) {
|
|
104
|
+
return `mode, to ${mode.includes(" ") ? `"${mode}"` : mode}`;
|
|
105
|
+
}
|
|
106
106
|
/** The mode state.yaml writes; undefined when it writes none, or cannot be read, which status and validate say elsewhere: the other commands go on. */
|
|
107
107
|
function writtenMode(root) {
|
|
108
108
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import type { Problem } from "
|
|
3
|
-
import { type Coin } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import type { Problem } from "../../core/problem.ts";
|
|
3
|
+
import { type Coin } from "../../money/index.ts";
|
|
4
4
|
/**
|
|
5
5
|
* The coins of the campaign, or the problem that keeps campaign.yaml from giving them; neither when the game has no money (MON-1).
|
|
6
6
|
* They are read on their own, so that a mistake in another setting does not turn every purse into text. A campaign without coins of its own
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The coins of a campaign as several commands use them: from campaign.yaml, read on their own, or else from its game system (DAT-1); checked, and shown (D-126–D-129, D-182).
|
|
2
|
-
import {
|
|
3
|
-
import { coinList, coinsProblem, coinsText, readCoins } from "
|
|
4
|
-
import { campaignSystem } from "./
|
|
2
|
+
import { readOneSetting } from "../../campaign/index.js";
|
|
3
|
+
import { coinList, coinsProblem, coinsText, readCoins } from "../../money/index.js";
|
|
4
|
+
import { campaignSystem } from "./world.js";
|
|
5
5
|
/**
|
|
6
6
|
* The coins of the campaign, or the problem that keeps campaign.yaml from giving them; neither when the game has no money (MON-1).
|
|
7
7
|
* They are read on their own, so that a mistake in another setting does not turn every purse into text. A campaign without coins of its own
|
|
@@ -10,7 +10,7 @@ import { campaignSystem } from "./game-world.js";
|
|
|
10
10
|
export function campaignCoins(root, context) {
|
|
11
11
|
let value;
|
|
12
12
|
try {
|
|
13
|
-
value =
|
|
13
|
+
value = readOneSetting(root, "coins");
|
|
14
14
|
}
|
|
15
15
|
catch (error) {
|
|
16
16
|
return { problem: { path: "campaign.yaml", message: error instanceof Error ? error.message : String(error), fix: "fix campaign.yaml by hand" } };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { LogEntry } from "
|
|
2
|
-
import { type Mood } from "
|
|
3
|
-
import { type Page } from "
|
|
1
|
+
import type { LogEntry } from "../../core/log.ts";
|
|
2
|
+
import { type Mood } from "../../core/mood.ts";
|
|
3
|
+
import { type Page } from "../../pages/index.ts";
|
|
4
4
|
/** The key of state.yaml that keeps the master's mood. */
|
|
5
5
|
export declare const masterMoodKey = "master-mood";
|
|
6
6
|
/** The log's types: a mood that stays, and a moment of the master's, which the dashboard shows for a few seconds. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Where the moods are kept (MOOD-3, MOOD-4): the master's in state.yaml, a character's on its page, a moment of the master's only in the log.
|
|
2
|
-
import { readStateValues } from "
|
|
3
|
-
import { readMood } from "
|
|
4
|
-
import { ownField } from "
|
|
2
|
+
import { readStateValues } from "../../campaign/index.js";
|
|
3
|
+
import { readMood } from "../../core/mood.js";
|
|
4
|
+
import { ownField } from "../../pages/index.js";
|
|
5
5
|
/** The key of state.yaml that keeps the master's mood. */
|
|
6
6
|
export const masterMoodKey = "master-mood";
|
|
7
7
|
/** The log's types: a mood that stays, and a moment of the master's, which the dashboard shows for a few seconds. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "
|
|
2
|
-
import { type MovePlan, type Page, type World } from "
|
|
1
|
+
import type { Context } from "../../core/context.ts";
|
|
2
|
+
import { type MovePlan, type Page, type World } from "../../pages/index.ts";
|
|
3
3
|
/** What a move did: the pages that changed place, the world after it and after the events it set off, the events it made due, and what the master should know. */
|
|
4
4
|
export interface MoveDone {
|
|
5
5
|
moved: Page[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { appendLogEntry } from "
|
|
2
|
-
import { applyMove, concernsPlayer, isInParty, links, locate, planLeave, planMove } from "
|
|
3
|
-
import { fireEvents, heldNote, linkedStoryNotes, nowDueNote } from "./
|
|
4
|
-
import { withSquares } from "./
|
|
5
|
-
import { newDatedLogEntry, readPresent } from "./
|
|
1
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
2
|
+
import { applyMove, concernsPlayer, isInParty, links, locate, planLeave, planMove } from "../../pages/index.js";
|
|
3
|
+
import { fireEvents, heldNote, linkedStoryNotes, nowDueNote } from "./events.js";
|
|
4
|
+
import { withSquares } from "./grids.js";
|
|
5
|
+
import { newDatedLogEntry, readPresent } from "./time.js";
|
|
6
6
|
/**
|
|
7
7
|
* Moves pages into a container (CON-4), or out of every one, and does what follows: a line in the log for the pages that concern the player, public, and one for the others, hidden (CON-9);
|
|
8
8
|
* the events it sets off, judged once on the world before and after it; what links to the pages that moved, but the living members of the party (CON-5).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type SettingName } from "
|
|
2
|
-
import type { Context } from "
|
|
3
|
-
import { type SystemSetting } from "
|
|
1
|
+
import { type SettingName } from "../../campaign/index.ts";
|
|
2
|
+
import type { Context } from "../../core/context.ts";
|
|
3
|
+
import { type SystemSetting } from "../../systems/index.ts";
|
|
4
4
|
/** The settings of the system that hold in the campaign, in the system's order (DAT-17): those no value asks, and those a value it plays asks. */
|
|
5
5
|
export declare function heldSystemSettings(root: string, context: Context): SystemSetting[];
|
|
6
6
|
/** The values the game offers of an engine's setting (DAT-16): those the system and the values it plays share; undefined when none of them narrows it. */
|