rpg-engine 0.15.0 → 0.16.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/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +6 -0
- package/dist/campaign/settings.js +22 -1
- package/dist/cli/cli.js +1 -1
- package/dist/cli/command-line.js +1 -1
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +6 -6
- package/dist/commands/ask.js +7 -7
- package/dist/commands/change/amounts.d.ts +32 -0
- package/dist/commands/change/amounts.js +150 -0
- package/dist/commands/change/change.d.ts +4 -54
- package/dist/commands/change/change.js +19 -749
- package/dist/commands/change/damage.d.ts +30 -0
- package/dist/commands/change/damage.js +73 -2
- package/dist/commands/change/dice.d.ts +34 -0
- package/dist/commands/change/dice.js +59 -0
- package/dist/commands/change/fields.d.ts +37 -0
- package/dist/commands/change/fields.js +156 -0
- package/dist/commands/change/holder.d.ts +48 -0
- package/dist/commands/change/holder.js +162 -0
- package/dist/commands/change/recipe-pace.js +1 -1
- package/dist/commands/change/recipe.d.ts +58 -0
- package/dist/commands/change/recipe.js +179 -0
- package/dist/commands/choices.js +3 -3
- package/dist/commands/config/config.d.ts +15 -0
- package/dist/commands/config/config.js +355 -0
- package/dist/commands/config/custom-levels.d.ts +7 -0
- package/dist/commands/config/custom-levels.js +32 -0
- package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
- package/dist/commands/config/dashboard.js +171 -0
- package/dist/commands/config/entries.d.ts +17 -0
- package/dist/commands/config/entries.js +76 -0
- package/dist/commands/config/news.d.ts +7 -0
- package/dist/commands/config/news.js +88 -0
- package/dist/commands/config/shown.d.ts +9 -0
- package/dist/commands/config/shown.js +80 -0
- package/dist/commands/config/words.d.ts +27 -0
- package/dist/commands/config/words.js +204 -0
- package/dist/commands/effect.js +9 -9
- package/dist/commands/find.js +1 -1
- package/dist/commands/image.js +6 -6
- package/dist/commands/import/import.d.ts +0 -2
- package/dist/commands/import/import.js +45 -44
- package/dist/commands/import/run.js +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/init.js +2 -2
- 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 +10 -10
- package/dist/commands/package/consent.d.ts +11 -0
- package/dist/commands/package/consent.js +52 -0
- package/dist/commands/package/here.d.ts +51 -0
- package/dist/commands/package/here.js +128 -0
- package/dist/commands/package/install.d.ts +10 -0
- package/dist/commands/package/install.js +337 -0
- package/dist/commands/package/package.d.ts +18 -0
- package/dist/commands/package/package.js +236 -0
- package/dist/commands/package/result.d.ts +90 -0
- package/dist/commands/package/result.js +1 -0
- package/dist/commands/package/uninstall.d.ts +6 -0
- package/dist/commands/package/uninstall.js +70 -0
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +5 -5
- package/dist/commands/roll/roll.js +11 -9
- package/dist/commands/roll/tables.js +1 -1
- 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 +2 -2
- package/dist/commands/scene/close.d.ts +18 -0
- package/dist/commands/scene/close.js +179 -0
- package/dist/commands/scene/members.d.ts +14 -0
- package/dist/commands/scene/members.js +32 -0
- package/dist/commands/scene/open.d.ts +6 -0
- package/dist/commands/scene/open.js +298 -0
- package/dist/commands/scene/result.d.ts +98 -0
- package/dist/commands/scene/result.js +2 -0
- package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
- package/dist/commands/scene/scene.js +210 -0
- package/dist/commands/scene/turns.d.ts +18 -0
- package/dist/commands/scene/turns.js +229 -0
- package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
- package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
- package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
- package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
- package/dist/commands/shared/{library.js → books/library.js} +9 -9
- package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
- package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
- package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
- package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
- package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
- package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
- package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
- package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
- package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
- package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
- package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
- package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
- package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
- package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
- package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
- package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
- package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
- package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
- package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
- package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
- package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
- package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
- package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
- package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
- package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
- package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
- package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
- package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
- package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
- package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
- package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
- package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
- package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
- package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
- package/dist/commands/shared/characters/orders.d.ts +4 -0
- package/dist/commands/shared/characters/orders.js +10 -0
- package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
- package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
- package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
- package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
- package/dist/commands/shared/examples.js +2 -2
- package/dist/commands/shared/packages/catalog.js +2 -2
- package/dist/commands/shared/packages/code.d.ts +1 -1
- package/dist/commands/shared/packages/code.js +8 -8
- package/dist/commands/shared/packages/extensions.d.ts +1 -1
- package/dist/commands/shared/packages/extensions.js +1 -1
- package/dist/commands/shared/packages/hooks.d.ts +1 -1
- package/dist/commands/shared/packages/hooks.js +1 -1
- package/dist/commands/shared/packages/widgets.d.ts +3 -3
- package/dist/commands/shared/packages/widgets.js +3 -3
- package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
- package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
- package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
- package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
- package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
- package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
- package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
- package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
- package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
- package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
- package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
- package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
- package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
- package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
- package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
- package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
- package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
- package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
- package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
- package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
- package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
- package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
- package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
- package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
- package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
- package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
- package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
- package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
- package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
- package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
- package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
- package/dist/commands/shared/sheet/effect-values.js +69 -0
- package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
- package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
- package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
- package/dist/commands/shared/sheet/formula-problems.js +140 -0
- package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
- package/dist/commands/shared/sheet/formula-scope.js +235 -0
- package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
- package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
- package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
- package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
- package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
- package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
- package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
- package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
- package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
- package/dist/commands/shared/sheet/system-fields.js +45 -0
- package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
- package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
- package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
- package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
- package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
- package/dist/commands/shared/sheet/worked-out.js +291 -0
- package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
- package/dist/commands/shared/sheet/worked-text.js +55 -0
- package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
- package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
- package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
- package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
- package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
- package/dist/commands/shared/{events.js → time/events.js} +10 -13
- package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
- package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
- package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
- package/dist/commands/shared/{time.js → time/time.js} +6 -6
- package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
- package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
- package/dist/commands/show.d.ts +3 -0
- package/dist/commands/show.js +28 -9
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +28 -22
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +8 -8
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/travel/open.d.ts +1 -1
- package/dist/commands/travel/open.js +2 -2
- package/dist/commands/travel/route.js +7 -6
- package/dist/commands/travel/travel.d.ts +1 -1
- package/dist/commands/travel/travel.js +8 -8
- package/dist/commands/validate.js +3 -3
- package/dist/commands/view/journal.d.ts +2 -2
- package/dist/commands/view/journal.js +2 -2
- package/dist/commands/view/map.d.ts +1 -1
- package/dist/commands/view/map.js +6 -6
- package/dist/commands/view/memory.d.ts +16 -0
- package/dist/commands/view/memory.js +90 -0
- package/dist/commands/view/page.d.ts +32 -0
- package/dist/commands/view/page.js +163 -0
- package/dist/commands/view/place.d.ts +7 -2
- package/dist/commands/view/place.js +30 -12
- package/dist/commands/view/result.d.ts +245 -0
- package/dist/commands/view/result.js +1 -0
- package/dist/commands/view/saves.d.ts +6 -0
- package/dist/commands/view/saves.js +53 -0
- package/dist/commands/view/story.d.ts +32 -0
- package/dist/commands/view/story.js +227 -0
- package/dist/commands/view/view.d.ts +26 -292
- package/dist/commands/view/view.js +26 -534
- package/dist/commands/view/world.d.ts +1 -1
- package/dist/commands/view/world.js +3 -3
- package/dist/commands/write/checks.d.ts +42 -0
- package/dist/commands/write/checks.js +291 -0
- package/dist/commands/write/here.d.ts +1 -1
- package/dist/commands/write/here.js +5 -5
- package/dist/commands/write/inheritance.d.ts +40 -0
- package/dist/commands/write/inheritance.js +189 -0
- package/dist/commands/write/input.d.ts +29 -0
- package/dist/commands/write/input.js +124 -0
- package/dist/commands/write/layer.d.ts +36 -0
- package/dist/commands/write/layer.js +48 -0
- package/dist/commands/write/notes.d.ts +22 -0
- package/dist/commands/write/notes.js +76 -0
- package/dist/commands/write/progression.d.ts +27 -0
- package/dist/commands/write/progression.js +175 -0
- package/dist/commands/write/write.d.ts +1 -0
- package/dist/commands/write/write.js +32 -816
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +7 -0
- package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
- package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
- package/dist/core/session-store.js +3 -3
- package/dist/core/store.d.ts +2 -2
- package/dist/core/store.js +18 -4
- package/dist/dashboard/acts/acts.js +1 -1
- package/dist/dashboard/acts/sending.js +110 -0
- package/dist/dashboard/acts/sheet.js +2 -2
- package/dist/dashboard/acts/strip.js +1 -1
- package/dist/dashboard/address.js +6 -0
- package/dist/dashboard/api.js +1 -1
- package/dist/dashboard/app.js +47 -171
- package/dist/dashboard/dice/roller.js +1 -1
- package/dist/dashboard/dice/sets.js +2 -2
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/dice/tray.js +6 -6
- package/dist/dashboard/guide/ar.md +5 -3
- package/dist/dashboard/guide/cs.md +5 -3
- package/dist/dashboard/guide/da.md +5 -3
- package/dist/dashboard/guide/de.md +5 -3
- package/dist/dashboard/guide/el.md +5 -3
- package/dist/dashboard/guide/en.md +2 -0
- package/dist/dashboard/guide/es.md +4 -2
- package/dist/dashboard/guide/fi.md +5 -3
- package/dist/dashboard/guide/fr.md +4 -2
- package/dist/dashboard/guide/he.md +4 -2
- package/dist/dashboard/guide/hi.md +6 -4
- package/dist/dashboard/guide/hu.md +4 -2
- package/dist/dashboard/guide/is.md +5 -3
- package/dist/dashboard/guide/it.md +3 -1
- package/dist/dashboard/guide/ja.md +7 -5
- package/dist/dashboard/guide/ko.md +6 -4
- package/dist/dashboard/guide/nb.md +4 -2
- package/dist/dashboard/guide/nl.md +5 -3
- package/dist/dashboard/guide/pl.md +4 -2
- package/dist/dashboard/guide/pt.md +4 -2
- package/dist/dashboard/guide/ro.md +5 -3
- package/dist/dashboard/guide/ru.md +5 -3
- package/dist/dashboard/guide/sv.md +5 -3
- package/dist/dashboard/guide/tr.md +6 -4
- package/dist/dashboard/guide/uk.md +4 -2
- package/dist/dashboard/guide/zh.md +5 -3
- package/dist/dashboard/help/help.js +3 -3
- package/dist/dashboard/i18n/ar.json +4 -0
- package/dist/dashboard/i18n/cs.json +4 -0
- package/dist/dashboard/i18n/da.json +4 -0
- package/dist/dashboard/i18n/de.json +4 -0
- package/dist/dashboard/i18n/el.json +4 -0
- package/dist/dashboard/i18n/es.json +4 -0
- package/dist/dashboard/i18n/fi.json +4 -0
- package/dist/dashboard/i18n/fr.json +4 -0
- package/dist/dashboard/i18n/he.json +4 -0
- package/dist/dashboard/i18n/hi.json +4 -0
- package/dist/dashboard/i18n/hu.json +4 -0
- package/dist/dashboard/i18n/is.json +4 -0
- package/dist/dashboard/i18n/it.json +4 -0
- package/dist/dashboard/i18n/ja.json +5 -1
- package/dist/dashboard/i18n/ko.json +4 -0
- package/dist/dashboard/i18n/nb.json +4 -0
- package/dist/dashboard/i18n/nl.json +4 -0
- package/dist/dashboard/i18n/pl.json +4 -0
- package/dist/dashboard/i18n/pt.json +4 -0
- package/dist/dashboard/i18n/ro.json +4 -0
- package/dist/dashboard/i18n/ru.json +4 -0
- package/dist/dashboard/i18n/sv.json +4 -0
- package/dist/dashboard/i18n/tr.json +4 -0
- package/dist/dashboard/i18n/uk.json +4 -0
- package/dist/dashboard/i18n/zh.json +4 -0
- package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
- package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
- package/dist/dashboard/kit.js +3 -3
- package/dist/dashboard/packages/ask-card.js +3 -3
- package/dist/dashboard/packages/catalog.js +196 -0
- package/dist/dashboard/packages/engine.js +87 -0
- package/dist/dashboard/packages/installed.js +53 -0
- package/dist/dashboard/packages/library.js +97 -0
- package/dist/dashboard/packages/outcomes.js +45 -0
- package/dist/dashboard/packages/packages.js +20 -576
- package/dist/dashboard/packages/page-code.js +15 -2
- package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
- package/dist/dashboard/packages/rows.js +84 -0
- package/dist/dashboard/packages/share.js +44 -0
- package/dist/dashboard/packages/widgets.js +3 -3
- package/dist/dashboard/{card.js → parts/card.js} +1 -1
- package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
- package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
- package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
- package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
- package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
- package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
- package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
- package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
- package/dist/dashboard/{status.js → parts/status.js} +4 -4
- package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
- package/dist/dashboard/place/key.js +24 -0
- package/dist/dashboard/place/paper.js +67 -0
- package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
- package/dist/dashboard/place/things.js +129 -0
- package/dist/dashboard/place/tokens.js +93 -0
- package/dist/dashboard/place/view.js +124 -0
- package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
- package/dist/dashboard/{asked.js → play/asked.js} +10 -10
- package/dist/dashboard/{choices.js → play/choices.js} +9 -9
- package/dist/dashboard/{requested.js → play/requested.js} +1 -1
- package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
- package/dist/dashboard/{scene.js → play/scene.js} +14 -14
- package/dist/dashboard/{turns.js → play/turns.js} +12 -12
- package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
- package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
- package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
- package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
- package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
- package/dist/dashboard/{party.js → sheet/party.js} +8 -8
- package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
- package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
- package/dist/dashboard/{story.js → sheet/story.js} +3 -3
- package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
- package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
- package/dist/dashboard/{master.js → shell/master.js} +2 -2
- package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
- package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
- package/dist/dashboard/shell/shown.js +37 -0
- package/dist/dashboard/{table.js → shell/table.js} +2 -2
- package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
- package/dist/dashboard/{top.js → shell/top.js} +7 -7
- package/dist/dashboard/style.css +74 -3
- package/dist/dashboard/world/calendar.js +4 -4
- package/dist/dashboard/world/drawing.js +92 -0
- package/dist/dashboard/world/key.js +21 -0
- package/dist/dashboard/world/lore.js +5 -5
- package/dist/dashboard/world/map-card.js +186 -0
- package/dist/dashboard/world/place-card.js +39 -0
- package/dist/dashboard/world/places.js +29 -0
- package/dist/dashboard/world/world.js +9 -341
- package/dist/extensions/extension.d.ts +1 -1
- package/dist/extensions/extension.js +1 -1
- package/dist/images/images.js +12 -9
- package/dist/index.d.ts +1 -1
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/packages/npm.js +1 -1
- package/dist/page.d.ts +2 -2
- package/dist/page.js +1 -1
- package/dist/pages/check.js +23 -1
- package/dist/pages/containers.d.ts +1 -1
- package/dist/pages/containers.js +1 -1
- package/dist/pages/index.d.ts +4 -2
- package/dist/pages/index.js +4 -2
- package/dist/pages/inheritance.d.ts +2 -2
- package/dist/pages/layers.d.ts +50 -0
- package/dist/pages/layers.js +97 -0
- package/dist/pages/rename-page.js +1 -1
- package/dist/pages/stacks/writes.js +48 -22
- package/dist/pages/standard-fields.d.ts +1 -1
- package/dist/pages/system-pages.d.ts +5 -3
- package/dist/pages/system-pages.js +16 -7
- package/dist/pages/world.d.ts +8 -1
- package/dist/pages/world.js +16 -4
- package/dist/pages/write-layer.d.ts +18 -0
- package/dist/pages/write-layer.js +108 -0
- package/dist/pages/write-page.d.ts +2 -2
- package/dist/pages/write-page.js +2 -2
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/rules/search.d.ts +1 -1
- package/dist/rules/shown.d.ts +1 -1
- package/dist/server/dashboard/choices.js +3 -3
- package/dist/server/dashboard/files.js +5 -5
- package/dist/server/dashboard/index.d.ts +2 -2
- package/dist/server/dashboard/index.js +2 -2
- package/dist/server/dashboard/news.js +4 -3
- package/dist/server/dashboard/player.js +1 -1
- package/dist/server/dashboard/writes.js +9 -7
- package/dist/server/mcp.js +28 -13
- package/dist/systems/campaign-data.d.ts +15 -0
- package/dist/systems/campaign-data.js +85 -0
- package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
- package/dist/systems/{system-code.js → code.js} +2 -2
- package/dist/systems/game-system.d.ts +7 -61
- package/dist/systems/game-system.js +1 -984
- package/dist/systems/index.d.ts +6 -3
- package/dist/systems/index.js +6 -3
- package/dist/systems/installed.d.ts +31 -0
- package/dist/systems/installed.js +89 -0
- package/dist/systems/maps.d.ts +3 -0
- package/dist/systems/maps.js +9 -0
- package/dist/systems/read.d.ts +3 -0
- package/dist/systems/read.js +471 -0
- package/dist/systems/schema.d.ts +289 -0
- package/dist/systems/schema.js +243 -0
- package/dist/systems/settings.d.ts +19 -0
- package/dist/systems/settings.js +78 -0
- package/dist/systems/versions.d.ts +12 -0
- package/dist/systems/versions.js +52 -0
- package/dist/testing/index.js +1 -1
- package/instructions/import.md +1 -1
- package/instructions/play.md +1 -1
- package/package.json +1 -1
- package/dist/commands/config.js +0 -948
- package/dist/commands/package.d.ts +0 -143
- package/dist/commands/package.js +0 -785
- package/dist/commands/scene.js +0 -894
- package/dist/commands/shared/worked-out.js +0 -805
- package/dist/dashboard/place/map-view.js +0 -417
- /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
- /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
- /package/dist/core/{package-api.js → packages/api.js} +0 -0
- /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
- /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
- /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
- /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
- /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
- /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
- /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
- /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
- /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
- /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
- /package/dist/languages/{language-pack.js → pack.js} +0 -0
- /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
- /package/dist/pages/{page-file.js → file.js} +0 -0
- /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
- /package/dist/pages/{page-types.js → types.js} +0 -0
- /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
- /package/dist/rules/{rule-book.js → book.js} +0 -0
- /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
- /package/dist/systems/{system-folders.js → folders.js} +0 -0
|
@@ -1,48 +1,40 @@
|
|
|
1
|
+
// The view command
|
|
1
2
|
import { basename } from "node:path";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { readSettings, requireCampaign } from "../../campaign/index.js";
|
|
4
|
-
import { lengthsInUnits } from "../../core/length.js";
|
|
5
5
|
import { readLog } from "../../core/log.js";
|
|
6
6
|
import { defineCommand } from "../../core/registry.js";
|
|
7
|
-
import { comparableText
|
|
8
|
-
import {
|
|
9
|
-
import { readEffect } from "../../effects/index.js";
|
|
10
|
-
import { readAmount } from "../../money/index.js";
|
|
11
|
-
import { declaredKind, entryPage, isPartyMember, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, playerCharacters, secretNames, systemPageNamed, textsIn, } from "../../pages/index.js";
|
|
7
|
+
import { comparableText } from "../../core/text.js";
|
|
8
|
+
import { isPartyMember, isPlayerCharacter, locate, parsePageReference, playerCharacters, secretNames } from "../../pages/index.js";
|
|
12
9
|
import { formatGameDate } from "../../time/index.js";
|
|
13
10
|
import { offeredPages } from "../choices.js";
|
|
14
|
-
import { setupQuestions, shownPlayerSettings } from "../config.js";
|
|
11
|
+
import { setupQuestions, shownPlayerSettings } from "../config/dashboard.js";
|
|
15
12
|
import { importShown } from "../import/import.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { lastMoment, livingMood, masterMood } from "../shared/moods.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { measuresOf } from "../shared/roads.js";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { fuelLeft } from "../shared/upkeep.js";
|
|
34
|
-
import { hasSheet } from "../shared/worked-out.js";
|
|
35
|
-
import { campaignSystem, campaignWorld, systemWordsOf } from "../shared/world.js";
|
|
13
|
+
import { translatingTexts, wantTexts } from "../shared/books/system-texts.js";
|
|
14
|
+
import { shownImage } from "../shared/campaign/images.js";
|
|
15
|
+
import { blockingMode, campaignMode, modes } from "../shared/campaign/mode.js";
|
|
16
|
+
import { campaignCoins } from "../shared/campaign/money.js";
|
|
17
|
+
import { campaignProblems } from "../shared/campaign/problems.js";
|
|
18
|
+
import { campaignSystem, campaignWorld, systemWordsOf } from "../shared/campaign/world.js";
|
|
19
|
+
import { knowledgeOf, knownPart, knowsPage, pageKnownBy, playerKnowledge, secretKnownBy, withPagesKnown } from "../shared/characters/knowledge.js";
|
|
20
|
+
import { lastMoment, livingMood, masterMood } from "../shared/characters/moods.js";
|
|
21
|
+
import { thoughtsIn } from "../shared/characters/thoughts.js";
|
|
22
|
+
import { readJourney } from "../shared/places/journey.js";
|
|
23
|
+
import { measuresOf } from "../shared/places/roads.js";
|
|
24
|
+
import { readOpenScene } from "../shared/scene/scene.js";
|
|
25
|
+
import { countersText, lineCounters } from "../shared/sheet/counters.js";
|
|
26
|
+
import { effectsOf } from "../shared/sheet/effect-layer.js";
|
|
27
|
+
import { sheetGroup, sheetHeadline, sheetText, tokenIcon } from "../shared/sheet/sheet.js";
|
|
28
|
+
import { calendarDayOf, readPresent } from "../shared/time/time.js";
|
|
29
|
+
import { fuelLeft } from "../shared/time/upkeep.js";
|
|
36
30
|
import { questText, shownJournal } from "./journal.js";
|
|
37
31
|
import { mapText, shownMap } from "./map.js";
|
|
38
|
-
import {
|
|
32
|
+
import { characterNamed, memoryOf, memoryText } from "./memory.js";
|
|
33
|
+
import { knownNamedPage, knownPage, lineValues, placeLook, shownName, shownPage, valueCoins } from "./page.js";
|
|
34
|
+
import { isDown, sceneLine, seenEffect, shownPlace, shownScene, strangerImage } from "./place.js";
|
|
35
|
+
import { shownSaves } from "./saves.js";
|
|
36
|
+
import { diaryCount, diaryLine, diaryLines, isCopyName, rollCount, rollsShown, seenByRoll, shownRoll, storyFact } from "./story.js";
|
|
39
37
|
import { knownDocuments, knownEntries, knownEntryText, shownCalendar } from "./world.js";
|
|
40
|
-
// How many lines of the diary the view gives when no number is asked.
|
|
41
|
-
const diaryLines = 10;
|
|
42
|
-
// How a player character is played while their player is away (D-480 (4)).
|
|
43
|
-
const awayRule = "You play while your player is away: no big decision, nothing precious spent, no needless risk.";
|
|
44
|
-
// How many rolls the view gives, the last ones.
|
|
45
|
-
const rollsShown = 20;
|
|
46
38
|
export const view = defineCommand({
|
|
47
39
|
name: "view",
|
|
48
40
|
description: "What the player may see, without spoilers: use it, not show, when the player asks what their character knows, remembers or carries. "
|
|
@@ -330,36 +322,6 @@ export const view = defineCommand({
|
|
|
330
322
|
}
|
|
331
323
|
},
|
|
332
324
|
});
|
|
333
|
-
/** A page as the one whose view it is knows it (VIEW-3): its text, and the whole sheet when it is theirs or of their party. */
|
|
334
|
-
function shownPage(root, context, world, knowledge, page, party) {
|
|
335
|
-
const system = campaignSystem(root, context);
|
|
336
|
-
// A companion who keeps no sheet shows the stat block of the creature it derives from (D-275).
|
|
337
|
-
const sheet = withItemImages(root, context, world, withCoins(speedInUnits(!party ? [] : hasSheet(world, page) ? sheetData(world, system, page) : statBlock(world, system, page), system, measuresOf(root, system)), campaignCoins(root, context).coins, system));
|
|
338
|
-
const language = readSettings(root).language;
|
|
339
|
-
const headline = party ? sheetHeadline(world, system, page, system === undefined || language === undefined ? undefined : systemWordsOf(root, system, language, context)) : undefined;
|
|
340
|
-
const cards = party && hasSheet(world, page) ? system?.sheetCards : undefined;
|
|
341
|
-
// Only the player's own characters act from the sheet: the others act as the master says (D-495). Talking to someone needs no game: a system without
|
|
342
|
-
// actions of its own still gives the player's characters theirs, none, so that the people around can be talked to.
|
|
343
|
-
const own = isPlayerCharacter(page) && (page === knowledge.pc || knowledge.each !== undefined);
|
|
344
|
-
const actions = own ? (system?.sheetActions ?? {}) : undefined;
|
|
345
|
-
const story = own ? playerStory(page) : undefined;
|
|
346
|
-
const secrets = knownSecretsApart(world, knowledge, page);
|
|
347
|
-
const whoKnows = pageKnownBy(knowledge, page);
|
|
348
|
-
const unaware = whoKnows === undefined ? [] : (knowledge.each ?? []).map((one) => one.pc).filter((pc) => pc.fields.status !== "dead" && !whoKnows.includes(pc.name)).map((pc) => pc.name);
|
|
349
|
-
return {
|
|
350
|
-
kind: "page",
|
|
351
|
-
title: `${page.name} (${page.type ?? "page"})`,
|
|
352
|
-
...(headline === undefined ? {} : { headline }),
|
|
353
|
-
sheet,
|
|
354
|
-
...(cards === undefined ? {} : { cards }),
|
|
355
|
-
...(actions === undefined ? {} : { actions }),
|
|
356
|
-
text: knownText(world, knowledge, page),
|
|
357
|
-
...(secrets.length === 0 ? {} : { knownBy: secrets }),
|
|
358
|
-
...(whoKnows === undefined ? {} : { whoKnows }),
|
|
359
|
-
...(unaware.length === 0 ? {} : { unaware }),
|
|
360
|
-
...(story === undefined ? {} : { story }),
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
325
|
/**
|
|
364
326
|
* The system's words for the page, with the names its translation gives its pages, as Palla di fuoco for Fireball, where its words do not name them (D-542):
|
|
365
327
|
* those translated on this computer too, where the system has no words in the language (D-539).
|
|
@@ -381,107 +343,6 @@ function knownByText(who) {
|
|
|
381
343
|
function knowerText(knowledge) {
|
|
382
344
|
return knowledge.each === undefined ? `${knowledge.pc.name} does not know` : "No player character knows";
|
|
383
345
|
}
|
|
384
|
-
/**
|
|
385
|
-
* What a character other than the player's knows and lived, for the character agent voicing them (VIEW-10): their page as they know it, with their sheet; now; the pages they know,
|
|
386
|
-
* each in a line; the secrets of other pages they discovered; the scenes they were in.
|
|
387
|
-
*/
|
|
388
|
-
function memoryOf(sight) {
|
|
389
|
-
const { root, context, world, knowledge } = sight;
|
|
390
|
-
const self = knowledge.pc;
|
|
391
|
-
const own = shownPage(root, context, world, knowledge, self, true);
|
|
392
|
-
const now = readPresent(root).date;
|
|
393
|
-
const { scene } = readOpenScene(root);
|
|
394
|
-
const inScene = scene !== undefined && scene.with.some((link) => pagesWithNameOrAlias(world, parsePageReference(link).name)[0] === self);
|
|
395
|
-
const line = inScene ? sceneLine(sight, (name) => shownName(world, knowledge, name), self) : undefined;
|
|
396
|
-
const known = [...knowledge.pages].filter((page) => page !== self && page.system === undefined).map((page) => {
|
|
397
|
-
const introduction = firstSentence(knownIntroduction(world, knowledge, page).split("\n")[0]);
|
|
398
|
-
return `${page.name} (${page.type ?? "page"})${introduction === "" ? "" : `: ${introduction}`}`;
|
|
399
|
-
});
|
|
400
|
-
return {
|
|
401
|
-
kind: "memory",
|
|
402
|
-
title: own.title,
|
|
403
|
-
sheet: own.sheet,
|
|
404
|
-
text: own.text,
|
|
405
|
-
...(now === undefined ? {} : { now: formatGameDate(now) }),
|
|
406
|
-
place: locate(world, self).chain.filter((holder) => knowsPage(knowledge, holder)).map((holder) => holder.name),
|
|
407
|
-
...(line === undefined ? {} : { scene: line }),
|
|
408
|
-
known,
|
|
409
|
-
discovered: discoveredSecrets(world, knowledge).map((secret) => `${secret.page}#${secret.name}: ${secret.text.replace(/\s*\n\s*/g, " ")}`),
|
|
410
|
-
lived: scenesLivedBy(root, world, self).map((one) => `${one.date === undefined ? "" : `${one.date} · `}${one.title}${one.summary === "" ? "" : `: ${one.summary}`}`),
|
|
411
|
-
...(self.fields.role === "companion" ? { thoughts: thoughtsIn(root, world, self).slice(-thoughtsShown).map((one) => `${one.date === undefined ? "" : `${one.date} · `}${one.text}`) } : {}),
|
|
412
|
-
// A lone player character's player is never away.
|
|
413
|
-
...(isPlayerCharacter(self) && self.fields.status !== "dead" && playerCharacters(world).filter((one) => one.fields.status !== "dead").length > 1 ? { away: awayRule } : {}),
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
/** What a character knows and lived, as the character agent voicing them reads it in the chat (VIEW-10). */
|
|
417
|
-
function memoryText(result) {
|
|
418
|
-
const list = (title, lines) => (lines.length === 0 ? "" : `${title}:\n${lines.map((line) => `- ${line}`).join("\n")}`);
|
|
419
|
-
const where = result.place.length === 0 ? "" : `in ${result.place.join(" › ")}`;
|
|
420
|
-
const now = [result.now ?? "", where].filter((part) => part !== "").join(", ");
|
|
421
|
-
return [
|
|
422
|
-
result.title,
|
|
423
|
-
sheetText(result.sheet).join("\n"),
|
|
424
|
-
result.text,
|
|
425
|
-
now === "" ? "" : `Now: ${now}`,
|
|
426
|
-
result.scene === undefined ? "" : `Scene: ${result.scene}`,
|
|
427
|
-
list("Known", result.known),
|
|
428
|
-
list("Discovered", result.discovered),
|
|
429
|
-
list("Lived", result.lived),
|
|
430
|
-
result.thoughts === undefined ? "" : thoughtsText(result.thoughts),
|
|
431
|
-
result.away ?? "",
|
|
432
|
-
].filter((block) => block !== "").join("\n\n");
|
|
433
|
-
}
|
|
434
|
-
/** A companion's last lines of their diary, and what to write in it (DIA-3). */
|
|
435
|
-
function thoughtsText(lines) {
|
|
436
|
-
const rule = `When you write in it: ${thoughtsRule}.`;
|
|
437
|
-
return lines.length === 0 ? `Your diary: nothing yet. ${rule}` : `Your diary, the last lines:\n${lines.map((line) => `- ${line}`).join("\n")}\n${rule}`;
|
|
438
|
-
}
|
|
439
|
-
/** The character a character agent's view is for (VIEW-10), by name or alias; stops the command for any other page. */
|
|
440
|
-
function characterNamed(world, name) {
|
|
441
|
-
if (name.trim() === "") {
|
|
442
|
-
throw new Error("Give as the name of a character's page, such as as Varro: whose view it is.");
|
|
443
|
-
}
|
|
444
|
-
const page = pagesWithNameOrAlias(world, parsePageReference(name).name)[0];
|
|
445
|
-
if (page?.type !== "character") {
|
|
446
|
-
throw new Error(page === undefined
|
|
447
|
-
? `There is no character named ${name.trim()}: give as the name of a character's page, such as as Varro.`
|
|
448
|
-
: `${page.name} is ${withArticle(page.type ?? "free page")}: as takes a character, whose view it is.`);
|
|
449
|
-
}
|
|
450
|
-
return page;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* A public roll of the log as the player sees it: who rolled, for whom as the character knows them, else as the scene it was rolled in named them (`seen`, D-421),
|
|
454
|
-
* the check, the dice; never the master's why (VIEW-4).
|
|
455
|
-
*/
|
|
456
|
-
function shownRoll(world, entry, named, picture, seen) {
|
|
457
|
-
const data = entry.data;
|
|
458
|
-
const known = data.who === undefined ? undefined : named(data.who);
|
|
459
|
-
const who = data.who === undefined ? undefined : known ?? strangerOfRoll(world, data.who, named, seen);
|
|
460
|
-
// A stranger the scene of the roll never named shows no face: it would tell who acted out of sight (D-421).
|
|
461
|
-
const image = data.who === undefined || who === "someone" ? undefined : picture(data.who);
|
|
462
|
-
const words = notationParts(String(data.notation ?? ""));
|
|
463
|
-
const toss = Array.isArray(data.toss) ? data.toss.filter((side) => coinSides.includes(side)) : undefined;
|
|
464
|
-
return {
|
|
465
|
-
id: entry.id,
|
|
466
|
-
...(entry.date === undefined ? {} : { date: entry.date }),
|
|
467
|
-
at: entry.at,
|
|
468
|
-
// Physical dice are the player's, though the master writes their values.
|
|
469
|
-
by: entry.by === "player" || data.physical === true ? "player" : "master",
|
|
470
|
-
...(who === undefined ? {} : { who }),
|
|
471
|
-
...(image === undefined ? {} : { image }),
|
|
472
|
-
...(who !== undefined && known === undefined ? { stranger: true } : {}),
|
|
473
|
-
...(typeof data.check === "string" ? { check: data.check } : {}),
|
|
474
|
-
notation: String(data.notation ?? ""),
|
|
475
|
-
...(words === undefined ? {} : { words }),
|
|
476
|
-
total: Number(data.total ?? 0),
|
|
477
|
-
...(typeof data.says === "string" && data.says.trim() !== "" ? { says: data.says } : {}),
|
|
478
|
-
...(Array.isArray(data.tones) ? { tones: data.tones.map((tone) => (tone === "good" || tone === "bad" ? tone : null)) } : {}),
|
|
479
|
-
...(toss === undefined ? {} : { toss }),
|
|
480
|
-
...(typeof data.tray === "boolean" ? { tray: data.tray } : {}),
|
|
481
|
-
text: String(data.result ?? ""),
|
|
482
|
-
dice: toss === undefined && Array.isArray(data.dice) ? data.dice : [],
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
346
|
/** "Lena (companion, worried), in Locanda: hp 9/15 · Poisoned until day 2, 14:20": someone of the party as the chat reads them. */
|
|
486
347
|
function memberLine(member, players) {
|
|
487
348
|
// A dead companion's line says so, and with more than one player character a dead one's (VIEW-12); a lone player character's never did.
|
|
@@ -492,376 +353,7 @@ function memberLine(member, players) {
|
|
|
492
353
|
const place = member.place === undefined ? "" : `, ${Array.isArray(member.place) ? `in ${member.place.join(" › ")}` : member.place === "open" ? "in the open" : "elsewhere"}`;
|
|
493
354
|
return `${member.name}${role}${place}${shown.length === 0 ? "" : `: ${shown.join(" · ")}`}`;
|
|
494
355
|
}
|
|
495
|
-
/** The values of someone's line as data (DAT-2): as the line writes them, with a counter's limits, and beside the experience what the next level needs (PRO-6). */
|
|
496
|
-
function lineValues(world, page, counters) {
|
|
497
|
-
const fields = effectiveFields(world, page);
|
|
498
|
-
const experience = lineExperience(world, page, counters);
|
|
499
|
-
return Object.entries(counters).map(([field, value]) => {
|
|
500
|
-
const kind = declaredKind(world, field);
|
|
501
|
-
const counter = counterOf(world, fields, field, value);
|
|
502
|
-
const progress = experienceProgress(world, fields, field);
|
|
503
|
-
const beside = field === experience?.field ? experience.text : undefined;
|
|
504
|
-
const need = beside === undefined ? undefined : experienceNeed(world, fields, field);
|
|
505
|
-
return {
|
|
506
|
-
field,
|
|
507
|
-
...(kind === undefined ? {} : { kind }),
|
|
508
|
-
text: String(value).trim(),
|
|
509
|
-
...(counter === undefined ? {} : { counter }),
|
|
510
|
-
marks: 0,
|
|
511
|
-
...(beside === undefined ? {} : { beside }),
|
|
512
|
-
...(progress === undefined ? {} : { progress }),
|
|
513
|
-
...(need === undefined ? {} : { levelNeed: need }),
|
|
514
|
-
};
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* The page the player character knows by this name, of the campaign or of the system, or by one of its aliases (VIEW-2): only one it knows, so that neither two
|
|
519
|
-
* pages of one name nor an alias tells that a page it does not know exists.
|
|
520
|
-
*/
|
|
521
|
-
function knownPage(world, knowledge, name) {
|
|
522
|
-
const one = (pages) => {
|
|
523
|
-
const known = pages.filter((page) => knowsPage(knowledge, page));
|
|
524
|
-
return known.length === 1 ? known[0] : undefined;
|
|
525
|
-
};
|
|
526
|
-
const system = systemPageNamed(world, name);
|
|
527
|
-
const named = pagesWithName(world, name);
|
|
528
|
-
const aliased = world.pages.filter((page) => textsIn(page.fields.aliases).some((alias) => comparableText(alias.trim()) === comparableText(name.trim())));
|
|
529
|
-
return one(named) ?? (named.length === 0 && system !== undefined ? one([system]) : undefined) ?? one(aliased);
|
|
530
|
-
}
|
|
531
|
-
/** A name as the view may write it: one of a page the player character knows; undefined for any other, which the view tells another way (D-254). */
|
|
532
|
-
function shownName(world, knowledge, name) {
|
|
533
|
-
return knownNamedPage(world, knowledge, name)?.name;
|
|
534
|
-
}
|
|
535
|
-
/** The page the player character knows by a name the log writes, of the campaign or of the system. */
|
|
536
|
-
function knownNamedPage(world, knowledge, name) {
|
|
537
|
-
if (typeof name !== "string") {
|
|
538
|
-
return undefined;
|
|
539
|
-
}
|
|
540
|
-
// The log keeps a renamed page by its old name, among its aliases (D-417).
|
|
541
|
-
const reference = parsePageReference(name).name;
|
|
542
|
-
const page = pagesWithNameOrAlias(world, reference)[0] ?? systemPageNamed(world, reference);
|
|
543
|
-
return page !== undefined && knowsPage(knowledge, page) ? page : undefined;
|
|
544
|
-
}
|
|
545
|
-
/** How many rolls the dashboard asks for: a whole number from 1. */
|
|
546
|
-
function rollCount(asked) {
|
|
547
|
-
const count = asked === undefined ? rollsShown : Number(asked.trim());
|
|
548
|
-
if (!Number.isInteger(count) || count < 1) {
|
|
549
|
-
throw new Error(`"${asked}" is not how many rolls: give a whole number from 1.`);
|
|
550
|
-
}
|
|
551
|
-
return count;
|
|
552
|
-
}
|
|
553
|
-
/** How many lines of the diary are asked: a whole number from 1. */
|
|
554
|
-
function diaryCount(asked) {
|
|
555
|
-
if (asked === undefined) {
|
|
556
|
-
return diaryLines;
|
|
557
|
-
}
|
|
558
|
-
const count = Number(asked.trim());
|
|
559
|
-
if (!Number.isInteger(count) || count < 1) {
|
|
560
|
-
throw new Error(`"${asked}" is not how many lines of the diary: give a whole number from 1, or all.`);
|
|
561
|
-
}
|
|
562
|
-
return count;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* "Scontro all'ossario (combat), at Ossario, with Ennio, Lena, uomo col coltello, brigante 1 and brigante 2": the open scene as the player sees it, with the words
|
|
566
|
-
* of the page (D-254, D-416): who the character does not know by what it sees of them, else someone, and two or more of them as others.
|
|
567
|
-
*/
|
|
568
|
-
function sceneLine(sight, named, self) {
|
|
569
|
-
const { scene } = readOpenScene(sight.root);
|
|
570
|
-
if (scene === undefined) {
|
|
571
|
-
return undefined;
|
|
572
|
-
}
|
|
573
|
-
// A character agent's view leaves out the one whose view it is (VIEW-10).
|
|
574
|
-
const names = sceneNames(sight, self);
|
|
575
|
-
const strangers = names.filter((name) => name === "someone").length;
|
|
576
|
-
// Who is someone, counted where the first of them stands.
|
|
577
|
-
const present = names.flatMap((name, index) => (name !== "someone" ? [name] : names.indexOf("someone") === index ? [strangers === 1 ? "someone" : `${strangers} others`] : []));
|
|
578
|
-
const place = named(scene.place);
|
|
579
|
-
const listed = present.length <= 1 ? present.join("") : `${present.slice(0, -1).join(", ")} and ${present.at(-1)}`;
|
|
580
|
-
return `${scene.title} (${scene.type})${place === undefined ? "" : `, at ${place}`}${present.length === 0 ? "" : `, with ${listed}`}`;
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* A public line of the log as the diary tells it (VIEW-4): the facts, with the game date, never the master's why; who and where the character does not know as
|
|
584
|
-
* someone and somewhere (D-254). Lines of no story, as a setting changed, are left out.
|
|
585
|
-
*/
|
|
586
|
-
function diaryLine(world, entry, named) {
|
|
587
|
-
const fact = storyFact(world, entry, named);
|
|
588
|
-
return fact === undefined ? [] : [fact.date === undefined ? factText(fact) : `${fact.date} · ${factText(fact)}`];
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* A public line of the log as a fact of the story (VIEW-4, VIEW-9), as data the dashboard writes in its language: who and where as the character knows them,
|
|
592
|
-
* someone, creature and somewhere for those it does not (D-254); undefined for a line of no story.
|
|
593
|
-
*/
|
|
594
|
-
function storyFact(world, entry, named) {
|
|
595
|
-
const data = entry.data;
|
|
596
|
-
const text = (value) => (Array.isArray(value) ? value.map(String).join(", ") : String(value ?? ""));
|
|
597
|
-
const who = (name) => named(name) ?? (isCopyName(world, name) ? "creature" : "someone");
|
|
598
|
-
const pages = Array.isArray(data.pages) ? data.pages.map((name) => named(name) ?? "someone") : [];
|
|
599
|
-
const fact = (() => {
|
|
600
|
-
switch (entry.type) {
|
|
601
|
-
case "scene-opened":
|
|
602
|
-
return { kind: "scene-opened", title: text(data.title), type: text(data.type) };
|
|
603
|
-
case "scene-closed":
|
|
604
|
-
return { kind: "scene-closed", title: text(data.title), type: text(data.type), summary: text(data.summary) };
|
|
605
|
-
case "roll":
|
|
606
|
-
return { kind: "roll", ...(data.who === undefined ? {} : { who: who(data.who) }), result: text(data.result) };
|
|
607
|
-
case "roll-revealed":
|
|
608
|
-
return { kind: "roll-revealed" };
|
|
609
|
-
case "counter-changed":
|
|
610
|
-
return {
|
|
611
|
-
kind: "counter",
|
|
612
|
-
who: who(data.page),
|
|
613
|
-
field: text(data.field),
|
|
614
|
-
before: text(data.before),
|
|
615
|
-
after: text(data.after),
|
|
616
|
-
...(data.stack === true ? { stack: true } : {}),
|
|
617
|
-
...(data.upkeep === true ? { upkeep: true } : {}),
|
|
618
|
-
};
|
|
619
|
-
case "time-advanced":
|
|
620
|
-
return { kind: "time", ...(data.from === undefined ? {} : { from: text(data.from) }), to: text(data.to) };
|
|
621
|
-
case "moved":
|
|
622
|
-
return pages.every((name) => name === "someone") && named(data.to) === undefined ? undefined : { kind: "moved", who: pages, ...(data.to === null ? {} : { to: named(data.to) ?? "somewhere" }) };
|
|
623
|
-
case "learned":
|
|
624
|
-
return { kind: "learned", who: text(data.page), what: textsIn(data.knows).map(learnedText) };
|
|
625
|
-
case "effect-added":
|
|
626
|
-
return { kind: "effect", who: who(data.page), ...seenEffectOf(world, text(data.effect), named) };
|
|
627
|
-
case "effect-ended":
|
|
628
|
-
return { kind: "effect-ended", who: who(data.page), effect: text(data.effect) };
|
|
629
|
-
case "saved":
|
|
630
|
-
return { kind: "saved", save: text(data.save), ...(data.label === undefined ? {} : { label: text(data.label) }) };
|
|
631
|
-
case "save-loaded":
|
|
632
|
-
return { kind: "back", save: text(data.save) };
|
|
633
|
-
case "mode-changed":
|
|
634
|
-
return { kind: "mode", to: text(data.to) };
|
|
635
|
-
case "quest-changed":
|
|
636
|
-
return { kind: "quest", status: data.status === "open" ? "open" : data.status === "done" ? "done" : "failed", quest: named(data.quest) ?? text(data.quest) };
|
|
637
|
-
default:
|
|
638
|
-
return undefined;
|
|
639
|
-
}
|
|
640
|
-
})();
|
|
641
|
-
return fact === undefined || entry.date === undefined ? fact : { ...fact, date: entry.date };
|
|
642
|
-
}
|
|
643
|
-
/** "Ettore: hp 14 → 12": a fact of the story in the chat's words. */
|
|
644
|
-
function factText(fact) {
|
|
645
|
-
const told = (() => {
|
|
646
|
-
switch (fact.kind) {
|
|
647
|
-
case "scene-opened":
|
|
648
|
-
return `Scene opened: ${fact.title} (${fact.type})`;
|
|
649
|
-
case "scene-closed":
|
|
650
|
-
return `Scene: ${fact.title} (${fact.type}): ${fact.summary}`;
|
|
651
|
-
case "roll":
|
|
652
|
-
return `${fact.who === undefined ? "Roll" : nameText(fact.who, true)}: ${fact.result}`;
|
|
653
|
-
case "roll-revealed":
|
|
654
|
-
return "A hidden roll was shown";
|
|
655
|
-
case "counter":
|
|
656
|
-
return `${nameText(fact.who, true)}: ${fact.field} ${fact.before} → ${fact.after}`;
|
|
657
|
-
case "time":
|
|
658
|
-
return fact.from === undefined ? `The story starts on ${fact.to}` : `Time passes: ${fact.from} → ${fact.to}`;
|
|
659
|
-
case "moved":
|
|
660
|
-
return `${fact.who.join(", ")} to ${fact.to ?? "the open"}`;
|
|
661
|
-
case "learned":
|
|
662
|
-
return `${fact.who} learned: ${fact.what.join(", ")}`;
|
|
663
|
-
case "effect":
|
|
664
|
-
return `${nameText(fact.who, true)}: ${fact.text}`;
|
|
665
|
-
case "effect-ended":
|
|
666
|
-
return `${nameText(fact.who, true)}: ${fact.effect} ended`;
|
|
667
|
-
case "saved":
|
|
668
|
-
return `Saved: ${fact.save}${fact.label === undefined ? "" : ` - ${fact.label}`}`;
|
|
669
|
-
case "back":
|
|
670
|
-
return `Back to save ${fact.save}: what came after it is gone`;
|
|
671
|
-
case "mode":
|
|
672
|
-
return `The campaign is now in ${fact.to}`;
|
|
673
|
-
case "quest":
|
|
674
|
-
return `${fact.status === "open" ? "Quest taken" : fact.status === "done" ? "Quest completed" : "Quest failed"}: ${fact.quest}`;
|
|
675
|
-
}
|
|
676
|
-
})();
|
|
677
|
-
return told;
|
|
678
|
-
}
|
|
679
|
-
/** A name of the story in the chat's words: a creature for creature, as the copies of one it does not know; Someone and A creature opening a line. */
|
|
680
|
-
function nameText(name, first = false) {
|
|
681
|
-
const said = name === "creature" ? "a creature" : name;
|
|
682
|
-
return first && (name === "creature" || name === "someone") ? `${said[0].toUpperCase()}${said.slice(1)}` : said;
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* What the character saw of those it did not know, in the scene each roll was rolled in, by the roll's id: the seen words the log kept since that scene opened,
|
|
686
|
-
* and for the scene still open its own, which a scene opened before the log kept them has alone.
|
|
687
|
-
*/
|
|
688
|
-
function seenByRoll(log, open) {
|
|
689
|
-
const byRoll = new Map();
|
|
690
|
-
let seen = {};
|
|
691
|
-
let inScene = [];
|
|
692
|
-
for (const entry of log) {
|
|
693
|
-
if (entry.type === "scene-opened" || entry.type === "scene-closed") {
|
|
694
|
-
seen = {};
|
|
695
|
-
inScene = [];
|
|
696
|
-
}
|
|
697
|
-
else if (entry.type === "scene-changed" && entry.data.seen !== null && typeof entry.data.seen === "object") {
|
|
698
|
-
seen = { ...seen, ...entry.data.seen };
|
|
699
|
-
}
|
|
700
|
-
else if (entry.type === "roll") {
|
|
701
|
-
byRoll.set(entry.id, seen);
|
|
702
|
-
inScene.push(entry.id);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
for (const id of open === undefined ? [] : inScene) {
|
|
706
|
-
byRoll.set(id, { ...byRoll.get(id), ...open });
|
|
707
|
-
}
|
|
708
|
-
return byRoll;
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Whom a roll is for when the character does not know them by name, as its scene named them (D-416, D-421): a copy by its name when the character knows its
|
|
712
|
-
* creature, else by what it saw of its kind and its number, else creature; anyone else by what it saw, else someone.
|
|
713
|
-
*/
|
|
714
|
-
function strangerOfRoll(world, who, named, seen) {
|
|
715
|
-
const name = String(who).trim();
|
|
716
|
-
const said = (key) => Object.entries(seen ?? {}).find(([seenName]) => comparableText(seenName) === comparableText(key))?.[1];
|
|
717
|
-
if (!isCopyName(world, name)) {
|
|
718
|
-
return said(name) ?? "someone";
|
|
719
|
-
}
|
|
720
|
-
const [, kind = "", number = ""] = /^(.+) (\d+)$/.exec(name) ?? [];
|
|
721
|
-
const kindSeen = said(kind);
|
|
722
|
-
return named(kind) !== undefined ? name : kindSeen === undefined ? "creature" : `${kindSeen} ${number}`;
|
|
723
|
-
}
|
|
724
|
-
/** Whether a name is a copy's in a scene, such as Lupo mannaro 1: a creature's name and a number, with no page of its own. */
|
|
725
|
-
function isCopyName(world, name) {
|
|
726
|
-
const match = typeof name === "string" ? /^(.+) \d+$/.exec(name.trim()) : null;
|
|
727
|
-
return match !== null && pagesWithName(world, match[0]).length === 0 && [...pagesWithName(world, match[1]), systemPageNamed(world, match[1])].some((page) => page?.type === "creature");
|
|
728
|
-
}
|
|
729
|
-
/** "Coppa#Veleno": what was learned, as a link names it. */
|
|
730
|
-
function learnedText(link) {
|
|
731
|
-
const reference = parsePageReference(link);
|
|
732
|
-
return reference.section === undefined ? reference.name : `${reference.name}#${reference.section}`;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* An effect as the player sees it, as a line of the log writes it: its name and its end, without who keeps it, which may be a secret; an end at someone's turn
|
|
736
|
-
* names them as the diary does.
|
|
737
|
-
*/
|
|
738
|
-
function seenEffectOf(world, line, named) {
|
|
739
|
-
const read = readEffect(line);
|
|
740
|
-
if (!("effect" in read)) {
|
|
741
|
-
return { name: line, text: line };
|
|
742
|
-
}
|
|
743
|
-
const end = read.effect.end;
|
|
744
|
-
const seen = end !== undefined && "turn" in end ? { ...end, turn: named(end.turn) ?? (isCopyName(world, end.turn) ? "creature" : "someone") } : end;
|
|
745
|
-
const told = seen !== undefined && "turn" in seen ? { ...seen, turn: nameText(seen.turn) } : seen;
|
|
746
|
-
return { name: read.effect.name, ...(seen === undefined ? {} : { end: seen }), text: effectShown(world, { ...read.effect, values: [], end: told }) };
|
|
747
|
-
}
|
|
748
|
-
/** A sheet with the speed told in the units of the story (D-328), as the maps tell their measures: 30 ft is 9 m in metric. */
|
|
749
|
-
function speedInUnits(groups, system, measures) {
|
|
750
|
-
const field = system?.grid?.speed;
|
|
751
|
-
// The load in kilograms for a player who counts in metric, with the system's pound (LOAD-2).
|
|
752
|
-
const pound = system?.pound;
|
|
753
|
-
const kilograms = (text) => text.replace(/[\d.]+/g, (number) => String(Math.round(Number(number) * (pound ?? 1) * 10) / 10)).replace(/\s*\p{L}[\p{L}.]*\s*$/u, " kg");
|
|
754
|
-
// The speeds the system works out are lengths too (SPD-1).
|
|
755
|
-
const declared = (name, wanted) => Object.entries(system?.fields ?? {}).some(([key, kind]) => kind === wanted && comparableText(key) === comparableText(name));
|
|
756
|
-
const inUnits = (text) => lengthsInUnits(text, measures.units, measures.imperial);
|
|
757
|
-
// What is beside a length is told in the same units, as the speed written beside the one worked out, and left out when it says the same.
|
|
758
|
-
const lengthTold = ({ beside, ...value }) => {
|
|
759
|
-
const text = inUnits(value.text);
|
|
760
|
-
const shownBeside = beside === undefined ? undefined : inUnits(beside);
|
|
761
|
-
return { ...value, text, ...(shownBeside === undefined || shownBeside === text ? {} : { beside: shownBeside }) };
|
|
762
|
-
};
|
|
763
|
-
const told = (value) => (field !== undefined && comparableText(value.field) === comparableText(field)) || declared(value.field, "length")
|
|
764
|
-
? lengthTold(value)
|
|
765
|
-
: (value.field === "load" || declared(value.field, "weight")) && measures.units === "metric" && pound !== undefined
|
|
766
|
-
? { ...value, text: kilograms(value.text), ...(value.load === undefined ? {} : { load: inKilograms(value.load, pound) }) }
|
|
767
|
-
: value;
|
|
768
|
-
return groups.map((group) => ({ ...group, values: group.values.map(told), ...(group.items === undefined ? {} : { items: group.items.map((item) => ({ ...item, values: item.values.map(told) })) }) }));
|
|
769
|
-
}
|
|
770
|
-
/** A load's numbers in kilograms, at the system's pound (LOAD-2). */
|
|
771
|
-
function inKilograms(load, pound) {
|
|
772
|
-
const kilograms = (weight) => Math.round(weight * pound * 10) / 10;
|
|
773
|
-
return { ...load, value: kilograms(load.value), ...(load.limit === undefined ? {} : { limit: kilograms(load.limit) }) };
|
|
774
|
-
}
|
|
775
|
-
/** The groups of a sheet with the icon of every thing carried, its page's or the kind's it derives from (D-431); the page's name is the engine's, not the page's to show. */
|
|
776
|
-
function withItemImages(root, context, world, groups) {
|
|
777
|
-
return groups.map((group) => ({
|
|
778
|
-
...group,
|
|
779
|
-
...(group.items === undefined ? {} : {
|
|
780
|
-
items: group.items.map(({ page, ...item }) => {
|
|
781
|
-
const found = page === undefined ? undefined : entryPage(world, page);
|
|
782
|
-
const image = found === undefined ? undefined : shownImage(root, context, world, found);
|
|
783
|
-
return image === undefined ? item : { ...item, image };
|
|
784
|
-
}),
|
|
785
|
-
}),
|
|
786
|
-
}));
|
|
787
|
-
}
|
|
788
|
-
/** The groups of a sheet with the coins of every value that is money, as the dashboard draws them (D-431). */
|
|
789
|
-
function withCoins(groups, coins, system) {
|
|
790
|
-
return groups.map((group) => ({ ...group, values: group.values.map((value) => valueCoins(value, coins, system)) }));
|
|
791
|
-
}
|
|
792
|
-
/** A value with its coins when it is money (MON-2), from the coin worth most, each with its metal when the game names it; as it was otherwise. */
|
|
793
|
-
function valueCoins(value, coins, system) {
|
|
794
|
-
const purse = coins === undefined || value.counter !== undefined ? undefined : readAmount(value.text, coins);
|
|
795
|
-
if (purse === undefined || coins === undefined) {
|
|
796
|
-
return value;
|
|
797
|
-
}
|
|
798
|
-
const metalOf = (coin) => coin.names.map((name) => system?.coinMetals[name]).find((metal) => metal !== undefined);
|
|
799
|
-
const shown = [...coins].sort((first, second) => second.value - first.value).filter((coin) => (purse[coin.name] ?? 0) > 0).map((coin) => {
|
|
800
|
-
const metal = metalOf(coin);
|
|
801
|
-
return { coin: coin.name, count: purse[coin.name] ?? 0, ...(metal === undefined ? {} : { metal }) };
|
|
802
|
-
});
|
|
803
|
-
return shown.length === 0 ? value : { ...value, coins: shown };
|
|
804
|
-
}
|
|
805
356
|
/** A setting of the player's in the chat: a list's items, none for an empty one, or its value; not chosen while it has none. */
|
|
806
357
|
function settingText(setting) {
|
|
807
358
|
return setting.items === undefined ? (setting.value ?? "(not chosen)") : setting.items.length === 0 ? "(none)" : setting.items.join(", ");
|
|
808
359
|
}
|
|
809
|
-
/** The saves, newest first, each with whether the mode lets the player go back to it; whether they may make one, and the points they may start over from (D-359). */
|
|
810
|
-
function shownSaves(root, context) {
|
|
811
|
-
const mode = saveMode(root);
|
|
812
|
-
const saves = campaignSaves(root);
|
|
813
|
-
const why = savesWhy(root);
|
|
814
|
-
const points = new Map(resetPoints.flatMap((point) => {
|
|
815
|
-
const save = resetSave(saves, why, point);
|
|
816
|
-
return save === undefined ? [] : [[save.number, point]];
|
|
817
|
-
}));
|
|
818
|
-
const world = campaignWorld(root, context);
|
|
819
|
-
const dead = mayGoBack(root, world);
|
|
820
|
-
const made = new Map(readLog(root).filter((entry) => entry.type === "saved").map((entry) => [Number(entry.data.save), entry]));
|
|
821
|
-
const madeOf = (number) => {
|
|
822
|
-
const entry = made.get(number);
|
|
823
|
-
const { label, place } = (entry?.data ?? {});
|
|
824
|
-
return {
|
|
825
|
-
...(typeof label === "string" ? { name: label } : {}),
|
|
826
|
-
...(entry?.date === undefined ? {} : { date: entry.date }),
|
|
827
|
-
...(entry === undefined ? {} : { at: entry.at }),
|
|
828
|
-
...(typeof place === "string" ? savedPlace(root, context, world, place) : {}),
|
|
829
|
-
};
|
|
830
|
-
};
|
|
831
|
-
return {
|
|
832
|
-
kind: "saves",
|
|
833
|
-
mode,
|
|
834
|
-
rule: loadRule(mode),
|
|
835
|
-
saves: saves.map((save) => ({
|
|
836
|
-
number: save.number,
|
|
837
|
-
label: save.label,
|
|
838
|
-
...madeOf(save.number),
|
|
839
|
-
...(points.has(save.number) ? { point: points.get(save.number) } : {}),
|
|
840
|
-
load: !points.has(save.number) && loadRefusal(mode, saves, save, dead) === undefined,
|
|
841
|
-
})).toReversed(),
|
|
842
|
-
make: mode === "free",
|
|
843
|
-
reset: resetPoints.filter((point) => [...points.values()].includes(point)),
|
|
844
|
-
// Until the player confirms a new chat with the master (D-362).
|
|
845
|
-
...(wentBackTo(root) === undefined ? {} : { wentBack: wentBackTo(root) }),
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
/** A place as a chapter of the story shows it (D-384): its kind and its picture, else that of the nearest place that holds it, as the player character knows them. */
|
|
849
|
-
function placeLook(root, context, world, knowledge, name) {
|
|
850
|
-
const page = knownNamedPage(world, knowledge, name);
|
|
851
|
-
if (page === undefined) {
|
|
852
|
-
return {};
|
|
853
|
-
}
|
|
854
|
-
const known = (base) => knowsPage(knowledge, base);
|
|
855
|
-
const kind = page.fields.kind;
|
|
856
|
-
const picture = [page, ...locate(world, page).chain.filter(known)].map((holder) => shownImage(root, context, world, holder, known)).find((image) => image !== undefined);
|
|
857
|
-
return { ...(typeof kind === "string" ? { kind } : {}), ...(picture === undefined ? {} : { picture }) };
|
|
858
|
-
}
|
|
859
|
-
/** The place a save was made in, with its picture, else that of the nearest place that holds it, as a room of the inn shows the inn. */
|
|
860
|
-
function savedPlace(root, context, world, name) {
|
|
861
|
-
const page = pagesWithNameOrAlias(world, name)[0];
|
|
862
|
-
const kind = page?.fields.kind;
|
|
863
|
-
const picture = page === undefined
|
|
864
|
-
? undefined
|
|
865
|
-
: [page, ...locate(world, page).chain].map((holder) => shownImage(root, context, world, holder)).find((image) => image !== undefined);
|
|
866
|
-
return { place: name, ...(typeof kind === "string" ? { kind } : {}), ...(picture === undefined ? {} : { picture }) };
|
|
867
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Context } from "../../core/context.ts";
|
|
2
2
|
import { type World } from "../../pages/index.ts";
|
|
3
3
|
import { type CalendarMonth } from "../../time/index.ts";
|
|
4
|
-
import { type Knowledge } from "../shared/knowledge.ts";
|
|
4
|
+
import { type Knowledge } from "../shared/characters/knowledge.ts";
|
|
5
5
|
/** A page the player character knows, as the World section lists it (VIEW-11): its name and type, a place's kind and the places that hold it, the opening of its text. */
|
|
6
6
|
export interface KnownEntry {
|
|
7
7
|
name: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { firstSentence } from "../../core/text.js";
|
|
2
2
|
import { isPartyMember, isPlayerCharacter, locate, withoutFencedBlocks } from "../../pages/index.js";
|
|
3
3
|
import { formatGameDate, readGameDate } from "../../time/index.js";
|
|
4
|
-
import { shownImage } from "../shared/images.js";
|
|
5
|
-
import { knownIntroduction, knownText, knowsPage, pageKnownBy, writesKnownText } from "../shared/knowledge.js";
|
|
6
|
-
import { calendarDayOf, campaignCalendar, readPresent } from "../shared/time.js";
|
|
4
|
+
import { shownImage } from "../shared/campaign/images.js";
|
|
5
|
+
import { knownIntroduction, knownText, knowsPage, pageKnownBy, writesKnownText } from "../shared/characters/knowledge.js";
|
|
6
|
+
import { calendarDayOf, campaignCalendar, readPresent } from "../shared/time/time.js";
|
|
7
7
|
import { placeKind } from "./map.js";
|
|
8
8
|
/**
|
|
9
9
|
* The pages the character knows, out of itself, its quests, which the journal has, its documents, which have their own list, and the game system's (VIEW-11);
|