rpg-engine 0.15.0 → 0.17.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/source.d.ts +3 -1
- package/dist/adventures/source.js +31 -1
- package/dist/campaign/find-campaign.js +8 -4
- 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 +68 -45
- 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 +270 -0
- package/dist/commands/package/result.d.ts +89 -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 +2 -2
- 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/books/adventure-layers.d.ts +89 -0
- package/dist/commands/shared/books/adventure-layers.js +201 -0
- package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +28 -9
- package/dist/commands/shared/{adventures.js → books/adventures.js} +77 -35
- 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} +9 -6
- package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +17 -7
- 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} +10 -8
- 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} +7 -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 +9 -0
- package/dist/commands/show.js +43 -10
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +28 -22
- package/dist/commands/thoughts.d.ts +1 -0
- package/dist/commands/thoughts.js +26 -18
- 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/layers.d.ts +34 -0
- package/dist/commands/view/layers.js +44 -0
- 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 +96 -0
- package/dist/commands/view/page.d.ts +32 -0
- package/dist/commands/view/page.js +166 -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 +252 -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 +29 -292
- package/dist/commands/view/view.js +31 -536
- 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 +185 -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 +44 -0
- package/dist/commands/write/layer.js +68 -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 +2 -0
- package/dist/commands/write/write.js +36 -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/core/text.d.ts +2 -0
- package/dist/core/text.js +4 -0
- 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 +19 -1
- package/dist/dashboard/app.js +51 -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 +7 -3
- package/dist/dashboard/guide/cs.md +9 -5
- package/dist/dashboard/guide/da.md +9 -5
- package/dist/dashboard/guide/de.md +7 -3
- package/dist/dashboard/guide/el.md +9 -5
- package/dist/dashboard/guide/en.md +4 -0
- package/dist/dashboard/guide/es.md +8 -4
- package/dist/dashboard/guide/fi.md +9 -5
- package/dist/dashboard/guide/fr.md +8 -4
- package/dist/dashboard/guide/he.md +7 -3
- package/dist/dashboard/guide/hi.md +10 -6
- package/dist/dashboard/guide/hu.md +8 -4
- package/dist/dashboard/guide/is.md +9 -5
- package/dist/dashboard/guide/it.md +5 -1
- package/dist/dashboard/guide/ja.md +9 -5
- package/dist/dashboard/guide/ko.md +8 -4
- package/dist/dashboard/guide/nb.md +8 -4
- package/dist/dashboard/guide/nl.md +8 -4
- package/dist/dashboard/guide/pl.md +8 -4
- package/dist/dashboard/guide/pt.md +7 -3
- package/dist/dashboard/guide/ro.md +9 -5
- package/dist/dashboard/guide/ru.md +8 -4
- package/dist/dashboard/guide/sv.md +9 -5
- package/dist/dashboard/guide/tr.md +9 -5
- package/dist/dashboard/guide/uk.md +8 -4
- package/dist/dashboard/guide/zh.md +8 -4
- package/dist/dashboard/help/help.js +3 -3
- package/dist/dashboard/i18n/ar.json +29 -0
- package/dist/dashboard/i18n/cs.json +29 -0
- package/dist/dashboard/i18n/da.json +29 -0
- package/dist/dashboard/i18n/de.json +29 -0
- package/dist/dashboard/i18n/el.json +29 -0
- package/dist/dashboard/i18n/es.json +29 -0
- package/dist/dashboard/i18n/fi.json +29 -0
- package/dist/dashboard/i18n/fr.json +29 -0
- package/dist/dashboard/i18n/he.json +29 -0
- package/dist/dashboard/i18n/hi.json +29 -0
- package/dist/dashboard/i18n/hu.json +29 -0
- package/dist/dashboard/i18n/is.json +29 -0
- package/dist/dashboard/i18n/it.json +29 -0
- package/dist/dashboard/i18n/ja.json +30 -1
- package/dist/dashboard/i18n/ko.json +29 -0
- package/dist/dashboard/i18n/nb.json +29 -0
- package/dist/dashboard/i18n/nl.json +29 -0
- package/dist/dashboard/i18n/pl.json +29 -0
- package/dist/dashboard/i18n/pt.json +29 -0
- package/dist/dashboard/i18n/ro.json +29 -0
- package/dist/dashboard/i18n/ru.json +29 -0
- package/dist/dashboard/i18n/sv.json +29 -0
- package/dist/dashboard/i18n/tr.json +29 -0
- package/dist/dashboard/i18n/uk.json +29 -0
- package/dist/dashboard/i18n/zh.json +29 -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/changes.js +111 -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 +27 -578
- 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/parts/changed.js +37 -0
- 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} +5 -1
- package/dist/dashboard/{status.js → parts/status.js} +4 -4
- package/dist/dashboard/{widgets.js → parts/widgets.js} +5 -3
- 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} +11 -10
- 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} +27 -24
- 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 +38 -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 +288 -4
- 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 +10 -6
- 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 +52 -0
- package/dist/pages/layers.js +105 -0
- package/dist/pages/markdown.d.ts +5 -1
- package/dist/pages/markdown.js +13 -1
- 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 +23 -0
- package/dist/pages/write-layer.js +162 -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.d.ts +2 -0
- package/dist/server/dashboard/choices.js +6 -4
- package/dist/server/dashboard/files.js +5 -5
- package/dist/server/dashboard/index.d.ts +2 -2
- package/dist/server/dashboard/index.js +7 -3
- package/dist/server/dashboard/news.js +4 -3
- package/dist/server/dashboard/player.js +1 -1
- package/dist/server/dashboard/writes.d.ts +7 -0
- package/dist/server/dashboard/writes.js +48 -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/instructions/voices.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
package/dist/commands/config.js
DELETED
|
@@ -1,948 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { parse, stringify } from "yaml";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, characterWays, checkSettingName, clearSetting, companionWays, customLevel, customLevels, customSettings, diceWays, difficulties, efforts, entrySettingNames, itemMeaning, lastChoices, lengths, lethalities, leveled, listSettingNames, mapSettingNames, masterRollWays, mentorWays, pictureWays, preparations, proseWays, readCampaignData, readOneSetting, readSettings, readTextSetting, refreshHostFiles, rememberChoice, requireCampaign, rigors, saveModes, settingDescription, settingMeaning, settingNames, setupSettingNames, startingLevels, storyWays, styleTextLengths, unitSystems, voiceWays, writeEffortFiles, } from "../campaign/index.js";
|
|
5
|
-
import { engineSystemsFolder } from "../core/context.js";
|
|
6
|
-
import { appendLogEntry } from "../core/log.js";
|
|
7
|
-
import { defineCommand } from "../core/registry.js";
|
|
8
|
-
import { files, isInside } from "../core/store.js";
|
|
9
|
-
import { comparableText } from "../core/text.js";
|
|
10
|
-
import { getVersion } from "../core/version.js";
|
|
11
|
-
import { readYamlValues } from "../core/yaml-file.js";
|
|
12
|
-
import { claudeSays, codexSays } from "../helpers/index.js";
|
|
13
|
-
import { hostInstructions } from "../instructions/index.js";
|
|
14
|
-
import { coinList, readAmount, readCoins } from "../money/index.js";
|
|
15
|
-
import { declaredKind } from "../pages/index.js";
|
|
16
|
-
import { campaignDataNames, findCampaignSystem, findSystem, readableSystems, rulesetSetting, systemFileName, systemPackage } from "../systems/index.js";
|
|
17
|
-
import { formatDuration, readBetweenSessions, readCalendar, readCalendarStart } from "../time/index.js";
|
|
18
|
-
import { checkLibraryRemovals, libraryAdditions, libraryRemovals, libraryShown, startLibraryReading } from "./shared/library.js";
|
|
19
|
-
import { campaignMode, campaignNote } from "./shared/mode.js";
|
|
20
|
-
import { campaignCoins, coinsShown } from "./shared/money.js";
|
|
21
|
-
import { askedBy, heldSystemSettings, isFixedSetting, isLeading, offeredValues, offerRefusal, playedEngineSetting, unofferedLines, valuePart } from "./shared/offers.js";
|
|
22
|
-
import { loadNewSystemCode } from "./shared/packages/code.js";
|
|
23
|
-
import { checkWidgetSpots } from "./shared/packages/widgets.js";
|
|
24
|
-
import { lengthPart, mentorPart, stylePart } from "./shared/parts.js";
|
|
25
|
-
import { readOpenScene } from "./shared/scene.js";
|
|
26
|
-
import { campaignCalendar, newDatedLogEntry } from "./shared/time.js";
|
|
27
|
-
import { campaignSystem, campaignWorld, countedByGame, installedSystemName, playedRules, playedSettingValue, playersOfTheGame, systemLayers, systemSetting, valuesText } from "./shared/world.js";
|
|
28
|
-
// A use whose maximum reads what gives it, in quotes for its commas (CAM-1).
|
|
29
|
-
const counterExample = 'bulwark-dice: {max: "4 * has(features, Bulwark)", refill: {{rest}}}';
|
|
30
|
-
// The same in a message, which no system's names fill: its maximum alone.
|
|
31
|
-
const counterShape = 'bulwark-dice: {max: "4 * has(features, Bulwark)"}';
|
|
32
|
-
export const config = defineCommand({
|
|
33
|
-
name: "config",
|
|
34
|
-
description: "Show or change the campaign settings. "
|
|
35
|
-
+ "Without a setting it shows them all and which are missing; with a setting alone, that one with what it is and its values; with a value it changes it. "
|
|
36
|
-
+ "Use it in the setup, for each setting status says is missing, and whenever the player changes one. "
|
|
37
|
-
+ "system is fixed once there is a player character. lines and veils change with add and remove, or value none when the player wants none. "
|
|
38
|
-
+ "effort and ruleset are the player's: change them only when they ask. "
|
|
39
|
-
+ "library: the player's own books, folders or files by their full path, added once to this computer with the player's yes in a window of their computer, "
|
|
40
|
-
+ "then turned on in each campaign with add and off with remove; remove with computer takes one off this computer. "
|
|
41
|
-
+ "precedents: each ruling you made without the text, the rule's name in the system's language first, such as 'Poisoned: …'. learned: the mechanics you explained, by name. "
|
|
42
|
-
+ "table: what you promised the player about how you play, in the words you said. "
|
|
43
|
-
+ 'coins, when the system gives none: each coin with its value in the smallest coin, other names after a slash, "rare" for one never given as change. '
|
|
44
|
-
+ "widgets: where the dashboard shows an extension's widget, such as value 'weather.today: side'; remove gives it back its place. "
|
|
45
|
-
+ "difficulty and rigor custom: each item at its own level, which custom-difficulty and custom-rigor take by item, such as value 'food: rules, load: smooth'; "
|
|
46
|
-
+ "custom starts from the level played until then, and remove gives an item the default. "
|
|
47
|
-
+ "fields, tables, computed, counters and recipes add to the game system what it lacks, or change it as a house rule: entries by name, written as in system.yaml, "
|
|
48
|
-
+ "each replacing the system's one of that name (a recipe adds to the system's); remove takes their names. status-line adds fields to the player character's line. "
|
|
49
|
-
+ "A formula with commas goes in quotes; a use's max reads what gives it, so that only who has it has it. "
|
|
50
|
-
+ `Example: setting language, value it; or setting lines, add "spiders"; or setting counters, value '${counterExample}'.`,
|
|
51
|
-
group: "campaign",
|
|
52
|
-
positionals: ["setting", "value"],
|
|
53
|
-
input: z.object({
|
|
54
|
-
setting: z.string().optional().describe(`setting to show or change: ${settingNames.join(", ")}, or one the game system adds`),
|
|
55
|
-
value: z.string().optional().describe("new value of the setting"),
|
|
56
|
-
add: z.array(z.string()).optional().describe(`items to add to a list setting (${listSettingNames.join(", ")}), repeatable`),
|
|
57
|
-
remove: z.array(z.string()).optional().describe(`items to remove from a list setting (${listSettingNames.join(", ")}), repeatable`),
|
|
58
|
-
computer: z.boolean().optional().describe("with library and remove: off this computer too, out of every campaign, its books' text deleted"),
|
|
59
|
-
}),
|
|
60
|
-
run(given, context) {
|
|
61
|
-
const input = { ...given, setting: given.setting?.trim() };
|
|
62
|
-
if (input.computer !== undefined && (input.setting !== "library" || input.remove === undefined)) {
|
|
63
|
-
throw new Error("computer goes only with setting library and remove: it takes those folders off this computer. Nothing changed.");
|
|
64
|
-
}
|
|
65
|
-
// What the library holds is checked, and an addition allowed by the player, before it is written (LIB-1).
|
|
66
|
-
if (input.setting === "library" && (input.add !== undefined || input.remove !== undefined)) {
|
|
67
|
-
return changeLibrary(input, context);
|
|
68
|
-
}
|
|
69
|
-
const result = configure(input, context);
|
|
70
|
-
// A system installed in this chat, as in the setup, brings its code once the campaign plays it (D-513 (1)).
|
|
71
|
-
return input.setting === "system" && input.value !== undefined ? loadNewSystemCode(context).then(() => result) : result;
|
|
72
|
-
},
|
|
73
|
-
format(result) {
|
|
74
|
-
const lines = Object.entries(result.settings).map(([name, value]) => `${name}: ${formatValue(value)}`);
|
|
75
|
-
return [[...lines, ...result.replaced].join("\n"), result.note, result.part ?? ""].filter((block) => block !== "").join("\n\n");
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
/**
|
|
79
|
-
* The setup's questions as the dashboard asks them (D-370), each with its value or items, if answered, and its values with what each means: the player's
|
|
80
|
-
* settings of the setup, how the character and the companions come, the preparation and length of a world not written, those the game system adds, then the lines and veils.
|
|
81
|
-
*/
|
|
82
|
-
export function setupQuestions(root, context, writtenWorld) {
|
|
83
|
-
const own = playerSettings(root, context);
|
|
84
|
-
const named = (name) => {
|
|
85
|
-
const setting = own.find((one) => one.name === name) ?? setupSettingNamed(root, name);
|
|
86
|
-
return setting === undefined ? [] : [setting];
|
|
87
|
-
};
|
|
88
|
-
const held = heldSystemSettings(root, context);
|
|
89
|
-
const system = held.map((setting) => setting.name);
|
|
90
|
-
const settings = readSettings(root);
|
|
91
|
-
const difficulty = settings.difficulty;
|
|
92
|
-
// The value a system's setting suggests (DAT-17).
|
|
93
|
-
const systemSuggests = Object.fromEntries(held.flatMap((setting) => setting.values.filter((value) => value.suggested === true).map((value) => [setting.name, value.value])));
|
|
94
|
-
// The player's last choices first: how they like to play, from their last campaign on this computer (T-134).
|
|
95
|
-
const last = lastChoices(context.home);
|
|
96
|
-
const suggested = { ...suggestedValues, ...(difficulty === undefined ? {} : { lethality: suggestedLethality[difficulty] ?? "dice" }), ...systemSuggests, ...last };
|
|
97
|
-
// The system's settings others depend on right after the mentor, before what they change (DAT-16, DAT-17).
|
|
98
|
-
const leading = held.filter(isLeading).map((setting) => setting.name);
|
|
99
|
-
const order = setupOrder.filter((name) => !writtenWorld || !worldSettingNames.includes(name));
|
|
100
|
-
const others = system.filter((name) => !leading.includes(name));
|
|
101
|
-
return [...order.slice(0, 1), ...leading, ...order.slice(1), ...others, "lines", "veils"].flatMap(named).map((question) => {
|
|
102
|
-
const suggestion = suggested[question.name];
|
|
103
|
-
// A suggestion the game does not offer is none (DAT-16).
|
|
104
|
-
const offered = suggestion !== undefined && (question.choices === undefined || question.choices.some((choice) => choice.value === suggestion));
|
|
105
|
-
const asked = { ...question, ...(question.choices === undefined ? {} : { choices: question.choices.filter((choice) => choice.value !== customLevel) }) };
|
|
106
|
-
const lastOne = offered && last[question.name] === suggestion ? { last: suggestion } : {};
|
|
107
|
-
return { ...(question.name === "mentor" ? mentorQuestion(asked) : unsetUnanswered(asked, settings)), ...(offered ? { suggested: suggestion } : {}), ...lastOne };
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
/** A setting only the setup lets the dashboard change (D-370): how the character and the companions come, the preparation, the length, the name; undefined for any other. */
|
|
111
|
-
export function setupSettingNamed(root, name) {
|
|
112
|
-
const key = Object.keys(setupWords).find((one) => comparableText(one) === comparableText(name));
|
|
113
|
-
if (key === undefined) {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
const words = setupWords[key];
|
|
117
|
-
const value = readSettings(root)[key];
|
|
118
|
-
return {
|
|
119
|
-
name: key,
|
|
120
|
-
about: words.about,
|
|
121
|
-
...(typeof value === "string" ? { value } : {}),
|
|
122
|
-
...(words.values === undefined ? {} : {
|
|
123
|
-
choices: words.values.map((one) => ({
|
|
124
|
-
value: one,
|
|
125
|
-
...(words.means?.[one] === undefined ? {} : { means: words.means[one] }),
|
|
126
|
-
...(words.labels?.[one] === undefined ? {} : { label: words.labels[one] }),
|
|
127
|
-
})),
|
|
128
|
-
}),
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/** The player's settings as the dashboard shows them (D-341): with what this computer lacks, as pictures without Codex, asked again. */
|
|
132
|
-
export function shownPlayerSettings(root, context) {
|
|
133
|
-
return playerSettings(root, context).map((setting) => (setting.name === "pictures" ? { ...setting, ...picturesReadyNote(context) } : setting));
|
|
134
|
-
}
|
|
135
|
-
/** The player's settings with their values, then those the game system adds (D-341). */
|
|
136
|
-
export function playerSettings(root, context) {
|
|
137
|
-
const settings = readSettings(root);
|
|
138
|
-
const own = heldSystemSettings(root, context).map((setting) => {
|
|
139
|
-
const value = playedSettingValue(root, context, setting);
|
|
140
|
-
const choices = setting.values.map((one) => ({ value: one.value, ...(one.player === undefined ? {} : { means: one.player }) }));
|
|
141
|
-
return { name: setting.name, about: setting.about ?? "a setting of the game system", ...(value === undefined ? {} : { value }), choices };
|
|
142
|
-
});
|
|
143
|
-
return [
|
|
144
|
-
...playerSettingNames.flatMap((name) => {
|
|
145
|
-
const words = playerWords[name];
|
|
146
|
-
const custom = customOf(name);
|
|
147
|
-
if (custom !== undefined) {
|
|
148
|
-
return customItems(root, context, custom, words);
|
|
149
|
-
}
|
|
150
|
-
const written = settings[name] ?? words.unset;
|
|
151
|
-
const value = name === "between-sessions" && typeof written === "string" ? shownBetweenSessions(written) : written;
|
|
152
|
-
const choices = words.values?.map((one) => ({ value: one, ...(words.means?.[one] === undefined ? {} : { means: words.means[one] }) }));
|
|
153
|
-
return [{
|
|
154
|
-
name,
|
|
155
|
-
about: words.about,
|
|
156
|
-
...(Array.isArray(value) ? { items: value.map(String) } : value === undefined || value === null ? {} : { value: String(value) }),
|
|
157
|
-
...(choices === undefined ? {} : { choices }),
|
|
158
|
-
...(words.most === undefined ? {} : { most: words.most }),
|
|
159
|
-
}];
|
|
160
|
-
}).flatMap((setting) => offeredSetting(root, context, setting)),
|
|
161
|
-
...own,
|
|
162
|
-
];
|
|
163
|
-
}
|
|
164
|
-
/** One of the player's settings by its name, in any case, as the dashboard changes them (D-341); undefined for a setting of the master's or none. */
|
|
165
|
-
export function playerSettingNamed(root, context, name) {
|
|
166
|
-
return playerSettings(root, context).find((setting) => comparableText(setting.name) === comparableText(name));
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* What the master hears, at the head of their next call, of a setting the player changed on the dashboard (D-341): how it is now against how it was before the
|
|
170
|
-
* player's first change since their last call, a value with what it means to the master; nothing for one that came back as it was.
|
|
171
|
-
*/
|
|
172
|
-
export function playerChangeNews(root, context, before, after) {
|
|
173
|
-
if (before.entries !== undefined || after.entries !== undefined) {
|
|
174
|
-
return customNews(root, context, before, after);
|
|
175
|
-
}
|
|
176
|
-
if (before.items !== undefined || after.items !== undefined) {
|
|
177
|
-
const added = (after.items ?? []).filter((item) => !(before.items ?? []).includes(item));
|
|
178
|
-
const removed = (before.items ?? []).filter((item) => !(after.items ?? []).includes(item));
|
|
179
|
-
return [
|
|
180
|
-
...(added.length === 0 ? [] : [`The player added ${quotedItems(added)} to ${after.name} on the dashboard: ${addedText(after)}.`]),
|
|
181
|
-
...(removed.length === 0 ? [] : [`The player took ${quotedItems(removed)} off ${after.name} on the dashboard${takenOffText(after.name)}.`]),
|
|
182
|
-
];
|
|
183
|
-
}
|
|
184
|
-
if (after.value === before.value) {
|
|
185
|
-
return [];
|
|
186
|
-
}
|
|
187
|
-
// The master's effort is no rule of play: it changes how the next chat thinks, never this one (D-462).
|
|
188
|
-
if (after.name === "effort") {
|
|
189
|
-
return [`The player set how much you think to ${after.value ?? "their app's own"} on the dashboard: it applies from their next chat; nothing to do now.`];
|
|
190
|
-
}
|
|
191
|
-
// How the master writes comes with its parts as they are now, on a line of their own: the same for each of them the player changed (D-395).
|
|
192
|
-
const style = styleSettingNames.includes(after.name) ? stylePart(root, context) : "";
|
|
193
|
-
if (after.value === undefined) {
|
|
194
|
-
const cleared = wordsOf(after.name)?.cleared;
|
|
195
|
-
return cleared === undefined ? [] : [`The player took ${after.name} away on the dashboard: ${cleared}. Play by it from now on.`, ...(style === "" ? [] : [style])];
|
|
196
|
-
}
|
|
197
|
-
const meaning = settingMeaning(after.name, after.value, countedByGame(campaignSystem(root, context)), customWritten(root, after.name))
|
|
198
|
-
?? (after.name === "between-sessions" ? betweenSessionsMeaning(after.value) : undefined)
|
|
199
|
-
?? systemSetting(root, context, after.name)?.values.find((one) => one.value === after.value)?.means;
|
|
200
|
-
const value = after.most === undefined ? after.value : `"${after.value}"`;
|
|
201
|
-
const author = after.name === "prose" && readSettings(root).author !== undefined ? " An author is written: theirs takes its place until the player takes it away." : "";
|
|
202
|
-
// The mentor's new part comes with it, once in the chat (D-347); in play, a value of the system's with its own part (DAT-18).
|
|
203
|
-
const own = systemSetting(root, context, after.name) === undefined || campaignMode(root, campaignWorld(root, context)) !== "play" ? undefined : valuePart(root, context, after.name, after.value);
|
|
204
|
-
const part = after.name === "mentor" ? mentorPart(root, context, after.value) : (own ?? "");
|
|
205
|
-
return [
|
|
206
|
-
`The player set ${after.name} to ${value} on the dashboard${meaning === undefined ? "" : `: ${meaning}`}. Play by it from now on.${author}${part === "" ? "" : `\n\n${part}`}`,
|
|
207
|
-
...unofferedLines(root, context),
|
|
208
|
-
...(style === "" ? [] : [style]),
|
|
209
|
-
];
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* The library changed (LIB-1, LIB-3): additions as full paths, added to this computer first, from the chat with the player's yes; removals by any spelling of
|
|
213
|
-
* their path, off this computer too with computer; then the new books read apart.
|
|
214
|
-
*/
|
|
215
|
-
async function changeLibrary(input, context) {
|
|
216
|
-
const root = requireCampaign(context.folder);
|
|
217
|
-
// A removal refused writes nothing: checked before an addition reaches this computer's library.
|
|
218
|
-
if (input.remove !== undefined) {
|
|
219
|
-
checkLibraryRemovals(root, context, input.remove, input.computer === true);
|
|
220
|
-
}
|
|
221
|
-
const add = input.add === undefined ? undefined : await libraryAdditions(root, context, input.add);
|
|
222
|
-
const remove = input.remove === undefined ? undefined : libraryRemovals(root, context, input.remove, input.computer === true);
|
|
223
|
-
// Taken off the computer only: the campaign did not use it.
|
|
224
|
-
const result = configure(add === undefined && remove?.length === 0 ? { setting: "library" } : { ...input, add, remove }, context);
|
|
225
|
-
startLibraryReading(context);
|
|
226
|
-
return result;
|
|
227
|
-
}
|
|
228
|
-
function configure(input, context) {
|
|
229
|
-
const root = requireCampaign(context.folder);
|
|
230
|
-
const listChange = input.add !== undefined || input.remove !== undefined;
|
|
231
|
-
const own = input.setting === undefined ? undefined : systemSetting(root, context, input.setting);
|
|
232
|
-
// One a value asks holds only with that value (DAT-17).
|
|
233
|
-
if (own !== undefined && !heldSystemSettings(root, context).some((setting) => setting.name === own.name)) {
|
|
234
|
-
throw new Error(`${own.name} holds only with ${askedBy(root, context, own.name)}: change that first, if the player wants it. Nothing changed.`);
|
|
235
|
-
}
|
|
236
|
-
// A setting the game system adds, with one of its values (DAT-10).
|
|
237
|
-
if (own !== undefined) {
|
|
238
|
-
return systemSettingResult(root, context, own, input);
|
|
239
|
-
}
|
|
240
|
-
if (input.setting !== undefined && !settingNames.includes(input.setting.trim())) {
|
|
241
|
-
const added = (campaignSystem(root, context)?.settings ?? []).map((setting) => setting.name);
|
|
242
|
-
throw new Error(`There is no setting "${input.setting}". The settings are: ${[...settingNames, ...added].join(", ")}.`);
|
|
243
|
-
}
|
|
244
|
-
if (input.add !== undefined && input.setting !== undefined && entrySettingNames.includes(checkSettingName(input.setting))) {
|
|
245
|
-
throw new Error(`"${input.setting}" takes entries by name as the value, such as setting counters, value '${counterShape}'; remove takes their names.`);
|
|
246
|
-
}
|
|
247
|
-
if (listChange && (input.setting === undefined || (input.value !== undefined && !entrySettingNames.includes(checkSettingName(input.setting))))) {
|
|
248
|
-
throw new Error('Give add or remove with a list setting and no value, such as setting lines, add "spiders".');
|
|
249
|
-
}
|
|
250
|
-
// The master's effort is the player's to choose, in their terminal or on the dashboard, never the master's own (D-462).
|
|
251
|
-
if (input.setting?.trim() === "effort" && input.value !== undefined && context.terminal !== true && context.actor !== "player") {
|
|
252
|
-
throw new Error("effort is the player's to choose, never yours: tell them they can set it on the dashboard's Settings, or in their terminal with rpg config effort and low, medium, high or app. Nothing changed.");
|
|
253
|
-
}
|
|
254
|
-
// app, or none, takes the effort away: each app keeps its own again (D-462).
|
|
255
|
-
if (input.setting?.trim() === "effort" && ["app", "none"].includes(input.value?.trim().toLowerCase() ?? "")) {
|
|
256
|
-
if (clearSetting(root, "effort")) {
|
|
257
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: "effort", value: "app" }));
|
|
258
|
-
}
|
|
259
|
-
const unwritten = writeEffortFiles(root, context.platform, true);
|
|
260
|
-
return { settings: { effort: shownValue(root, context, readSettings(root), "effort") }, note: "", replaced: ["Taken away for Claude Code and Codex: from the next chat each keeps its own.", ...unwritten], part: "" };
|
|
261
|
-
}
|
|
262
|
-
if (input.setting?.trim() === "system" && input.value !== undefined) {
|
|
263
|
-
checkSystemOpen(root, context, input.value);
|
|
264
|
-
}
|
|
265
|
-
// An engine's setting the game offers only some values of (DAT-16).
|
|
266
|
-
const refused = input.setting === undefined || input.value === undefined ? undefined : offerRefusal(root, context, input.setting.trim(), input.value);
|
|
267
|
-
if (refused !== undefined) {
|
|
268
|
-
throw new Error(refused);
|
|
269
|
-
}
|
|
270
|
-
const shown = input.setting === undefined ? settingNames : [checkSettingName(input.setting)];
|
|
271
|
-
const mapped = input.setting !== undefined && mapSettingNames.includes(checkSettingName(input.setting));
|
|
272
|
-
let replaced = [];
|
|
273
|
-
// A custom difficulty or rigor starts from the preset played until then, each item not yet written at its level (T-132).
|
|
274
|
-
const leveledName = input.setting === "difficulty" || input.setting === "rigor" ? input.setting : undefined;
|
|
275
|
-
const startsCustom = leveledName !== undefined && input.value?.trim().toLowerCase() === customLevel;
|
|
276
|
-
const preset = leveledName === undefined ? undefined : readSettings(root)[leveledName];
|
|
277
|
-
const custom = customOf(input.setting ?? "");
|
|
278
|
-
// The items of a custom difficulty or rigor, each at a level it takes (T-132).
|
|
279
|
-
if (custom !== undefined && (input.value !== undefined || input.remove !== undefined)) {
|
|
280
|
-
const name = customSettings[custom];
|
|
281
|
-
if (changeMapSetting(root, name, { set: input.value === undefined ? undefined : customEntries(custom, input.value), remove: input.remove })) {
|
|
282
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: name, value: input.value, remove: input.remove }));
|
|
283
|
-
}
|
|
284
|
-
// Kept for when it is chosen, but played only then.
|
|
285
|
-
if (playedEngineSetting(root, context, custom) !== customLevel) {
|
|
286
|
-
replaced = [...replaced, `${name} plays only while ${custom} is custom.`];
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
else if (input.setting?.trim() === "widgets" && (input.value !== undefined || input.remove !== undefined)) {
|
|
290
|
-
const set = input.value === undefined ? undefined : entriesOf("widgets", input.value);
|
|
291
|
-
checkWidgetSpots(root, context, set ?? {});
|
|
292
|
-
if (changeMapSetting(root, "widgets", { set, remove: input.remove })) {
|
|
293
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: "widgets", value: input.value, remove: input.remove }));
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
else if (mapped && input.setting !== undefined && (input.value !== undefined || input.remove !== undefined)) {
|
|
297
|
-
// What the campaign adds to its game system, checked with the system before it is written (CAM-1, CAM-3).
|
|
298
|
-
const change = { set: input.value === undefined ? undefined : entriesOf(input.setting, input.value), remove: input.remove };
|
|
299
|
-
checkAdditions(root, context, input.setting, change);
|
|
300
|
-
replaced = replacedEntries(root, context, input.setting, Object.keys(change.set ?? {}));
|
|
301
|
-
if (changeMapSetting(root, input.setting, change)) {
|
|
302
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: input.setting, value: input.value, remove: input.remove }));
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
else if (input.setting !== undefined && listChange && changeListSetting(root, input.setting, { add: input.add, remove: input.remove })) {
|
|
306
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: input.setting, add: input.add, remove: input.remove }));
|
|
307
|
-
}
|
|
308
|
-
else if (input.setting !== undefined && input.value?.trim().toLowerCase() === "none" && listSettingNames.includes(checkSettingName(input.setting))) {
|
|
309
|
-
// A list answered with none still answers the setup (MOD-3).
|
|
310
|
-
if (changeListSettingToNone(root, input.setting)) {
|
|
311
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: input.setting, value: "none" }));
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
else if (input.setting !== undefined && input.value?.trim().toLowerCase() === "none" && freeSettingNames.includes(checkSettingName(input.setting))) {
|
|
315
|
-
if (clearSetting(root, input.setting)) {
|
|
316
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: input.setting, value: "none" }));
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
else if (input.setting !== undefined && input.value !== undefined && changeSetting(root, input.setting, settingValue(root, input.setting, input.value, context))) {
|
|
320
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: input.setting, value: input.value }));
|
|
321
|
-
// What the next campaign's setup suggests; a custom difficulty or rigor is this campaign's own (T-134).
|
|
322
|
-
const chosen = readSettings(root)[input.setting];
|
|
323
|
-
if (chosen !== customLevel) {
|
|
324
|
-
rememberChoice(context.home, input.setting, chosen);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
if (startsCustom && leveledName !== undefined && readSettings(root)[leveledName] === customLevel) {
|
|
328
|
-
const written = readSettings(root)[customSettings[leveledName]] ?? {};
|
|
329
|
-
const unwritten = Object.entries(startingLevels(leveledName, preset)).filter(([item]) => !Object.hasOwn(written, item));
|
|
330
|
-
if (unwritten.length > 0) {
|
|
331
|
-
changeMapSetting(root, customSettings[leveledName], { set: Object.fromEntries(unwritten) });
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
// The effort written where each app reads it in the campaign's folder (D-462).
|
|
335
|
-
if (input.setting?.trim() === "effort" && input.value !== undefined) {
|
|
336
|
-
const unwritten = writeEffortFiles(root, context.platform);
|
|
337
|
-
const written = "Written for Claude Code and Codex: it applies from the next chat; in Codex only in a folder it trusts; an effort picked in the app for one chat wins there.";
|
|
338
|
-
replaced = [...replaced, ...(unwritten.length === 0 ? [written] : unwritten)];
|
|
339
|
-
}
|
|
340
|
-
// The character agent written or taken away at once, not when the server starts again (D-490).
|
|
341
|
-
if (input.setting?.trim() === "voices" && input.value !== undefined) {
|
|
342
|
-
refreshHostFiles(root, hostInstructions(), context.platform);
|
|
343
|
-
replaced = [...replaced, "Claude Code finds the character agent, or finds it gone, from the next chat."];
|
|
344
|
-
}
|
|
345
|
-
// New months may leave the day the story starts on without its month (TIM-8): said at once, not at the next date.
|
|
346
|
-
if (input.setting?.trim() === "calendar" && input.value !== undefined) {
|
|
347
|
-
replaced = [...replaced, ...campaignCalendar(root, context).problems.map((problem) => `${problem.message.replace(/\.$/, "")}: ${problem.fix ?? "fix it"}.`)];
|
|
348
|
-
}
|
|
349
|
-
// A setting asked alone comes with what it is and its values, which the description leaves to it (T-64).
|
|
350
|
-
const about = input.setting !== undefined && input.value === undefined && !listChange ? settingDescription(checkSettingName(input.setting)) : undefined;
|
|
351
|
-
if (about !== undefined) {
|
|
352
|
-
replaced = [...replaced, `${checkSettingName(input.setting ?? "")}: ${about}.`];
|
|
353
|
-
}
|
|
354
|
-
const settings = readSettings(root);
|
|
355
|
-
// Listed all together, what the campaign adds to its system only when it adds something.
|
|
356
|
-
const added = (name) => campaignDataNames.includes(name);
|
|
357
|
-
const listed = input.setting === undefined ? shown.filter((name) => !(added(name) || name === "calendar" || name === "widgets" || customOf(name) !== undefined) || settings[name] !== undefined) : shown;
|
|
358
|
-
const system = input.setting === undefined ? heldSystemSettings(root, context) : [];
|
|
359
|
-
// The master's own change of the mentor brings its part, once in the chat; the player's comes with the news of the dashboard (D-347).
|
|
360
|
-
const changed = input.value !== undefined && context.actor !== "player" ? input.setting?.trim() : undefined;
|
|
361
|
-
// And of how the master writes, the parts as they are now (D-395).
|
|
362
|
-
const style = styleSettingNames.includes(changed ?? "") ? stylePart(root, context) : "";
|
|
363
|
-
// And of the length, past the setup, how to size the adventures now (D-558); entering play gives it otherwise.
|
|
364
|
-
const sized = changed === "length" && campaignMode(root, campaignWorld(root, context)) !== "setup";
|
|
365
|
-
const length = !sized ? "" : settings.length === "open" ? "The campaign is open now: the adventures take the size the story asks, one after another." : lengthPart(root, context);
|
|
366
|
-
// An author or the player's words taken away: what holds now, as the dashboard's news says it.
|
|
367
|
-
const cleared = changed !== undefined && input.value?.trim().toLowerCase() === "none" ? wordsOf(changed)?.cleared : undefined;
|
|
368
|
-
const part = changed === "mentor"
|
|
369
|
-
? mentorPart(root, context, settings.mentor)
|
|
370
|
-
: [cleared === undefined ? "" : `${cleared.charAt(0).toUpperCase()}${cleared.slice(1)}.`, style, length].filter((text) => text !== "").join("\n\n");
|
|
371
|
-
return {
|
|
372
|
-
settings: {
|
|
373
|
-
...Object.fromEntries(listed.map((name) => [name, offeredShown(root, context, name, shownValue(root, context, settings, name))])),
|
|
374
|
-
...Object.fromEntries(system.map((setting) => [setting.name, systemShownValue(root, context, setting)])),
|
|
375
|
-
},
|
|
376
|
-
note: campaignNote(root, context, true),
|
|
377
|
-
replaced,
|
|
378
|
-
part,
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
// The settings of free words the player may leave unset again, with the value none, and all those of how the master writes (D-395).
|
|
382
|
-
const freeSettingNames = ["author", "style", "calendar"];
|
|
383
|
-
const styleSettingNames = ["prose", "story", "author", "style"];
|
|
384
|
-
// The game time between sessions the dashboard offers (D-133): stopped, a day of the game for each real week, or as real time.
|
|
385
|
-
const betweenSessionsWays = ["stops", "1d per 7d", "1d per 1d"];
|
|
386
|
-
/** The settings the player changes on the dashboard (D-341): how the game plays for them; the master's own, as house rules, coins and precedents, stay in the chat. */
|
|
387
|
-
export const playerSettingNames = [
|
|
388
|
-
"difficulty",
|
|
389
|
-
"custom-difficulty",
|
|
390
|
-
"lethality",
|
|
391
|
-
"saves",
|
|
392
|
-
"rigor",
|
|
393
|
-
"custom-rigor",
|
|
394
|
-
"between-sessions",
|
|
395
|
-
"mentor",
|
|
396
|
-
"learned",
|
|
397
|
-
"prose",
|
|
398
|
-
"story",
|
|
399
|
-
"author",
|
|
400
|
-
"style",
|
|
401
|
-
"dice",
|
|
402
|
-
"master-rolls",
|
|
403
|
-
"units",
|
|
404
|
-
"voices",
|
|
405
|
-
"pictures",
|
|
406
|
-
"effort",
|
|
407
|
-
"lines",
|
|
408
|
-
"veils",
|
|
409
|
-
"language",
|
|
410
|
-
];
|
|
411
|
-
// What each of the player's settings is, and what its values mean to the player, in their words rather than the master's.
|
|
412
|
-
const playerWords = {
|
|
413
|
-
difficulty: {
|
|
414
|
-
about: "how hard the world plays",
|
|
415
|
-
values: [...difficulties, customLevel],
|
|
416
|
-
means: {
|
|
417
|
-
story: "fights low, foes naive, clues obvious, resources plentiful",
|
|
418
|
-
easy: "fights low to moderate, simple foes, resources generous",
|
|
419
|
-
normal: "fights moderate to high, sensible foes, resources standard",
|
|
420
|
-
hard: "fights high, smart and tenacious foes, resources scarce",
|
|
421
|
-
brutal: "fights far beyond, optimized and fanatical foes, resources very scarce",
|
|
422
|
-
custom: "each part at its own level, chosen below",
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
"custom-difficulty": { about: "how hard each part of the world plays", values: difficulties },
|
|
426
|
-
lethality: { about: "what a fall means", values: lethalities, means: { narrative: "your character never dies", epic: "your character dies only when it matters", dice: "the dice decide" } },
|
|
427
|
-
saves: {
|
|
428
|
-
about: "when the game may go back",
|
|
429
|
-
values: saveModes,
|
|
430
|
-
means: { permadeath: "never: what happens stays; only starting the campaign over", checkpoint: "if your character dies: back to the end of the last scene", free: "back to any save, and a save whenever you ask" },
|
|
431
|
-
},
|
|
432
|
-
rigor: {
|
|
433
|
-
about: "how closely food, light, fatigue and the like follow the rules",
|
|
434
|
-
values: [...rigors, customLevel],
|
|
435
|
-
means: {
|
|
436
|
-
smooth: "only when the story turns on them",
|
|
437
|
-
rules: "as written: food and water each day, light as it burns, fatigue and encumbrance",
|
|
438
|
-
simulation: "as written, and beyond: wear, spoilage, weather",
|
|
439
|
-
custom: "each part at its own level, chosen below",
|
|
440
|
-
},
|
|
441
|
-
},
|
|
442
|
-
"custom-rigor": { about: "how closely each part follows the rules", values: rigors },
|
|
443
|
-
// The few rates the dashboard offers (D-133); one written in the chat or by hand shows as it is, beside them.
|
|
444
|
-
"between-sessions": {
|
|
445
|
-
about: "whether the story's time runs while you are away, from one session to the next",
|
|
446
|
-
values: betweenSessionsWays,
|
|
447
|
-
means: {
|
|
448
|
-
stops: "the world waits for you: the story picks up at the moment you left it",
|
|
449
|
-
"1d per 7d": "a day of the story for each week you are away: when you come back, at your first move the master lets it pass and tells what the world did meanwhile",
|
|
450
|
-
"1d per 1d": "a day of the story for each day you are away: when you come back, at your first move the master lets it pass and tells what the world did meanwhile",
|
|
451
|
-
},
|
|
452
|
-
unset: "stops",
|
|
453
|
-
},
|
|
454
|
-
mentor: {
|
|
455
|
-
about: "how much the master teaches the game, out of the story",
|
|
456
|
-
values: mentorWays,
|
|
457
|
-
means: {
|
|
458
|
-
off: "only the story; ask in brackets whenever you want",
|
|
459
|
-
hints: "a short note before big choices and when a rule slips by",
|
|
460
|
-
tutorial: "each rule explained the first time, the numbers shown, a short review after fights",
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
learned: {
|
|
464
|
-
about: "what the master has explained: take one off to have it explained again",
|
|
465
|
-
added: "they know it already: no need to explain it",
|
|
466
|
-
takenOff: "explain it again the next time it comes up",
|
|
467
|
-
},
|
|
468
|
-
prose: {
|
|
469
|
-
about: "how the master writes",
|
|
470
|
-
values: proseWays,
|
|
471
|
-
unset: "plain",
|
|
472
|
-
means: {
|
|
473
|
-
plain: "short sentences, one concrete detail at a time",
|
|
474
|
-
literary: "more room at the high points, images and subtext",
|
|
475
|
-
pulp: "tense action, strong colours, each message ending on a threat or a hook",
|
|
476
|
-
wry: "a narrator with a half smile at the world, never at your character",
|
|
477
|
-
},
|
|
478
|
-
},
|
|
479
|
-
story: {
|
|
480
|
-
about: "how the master builds the stories they invent; a written adventure keeps its own",
|
|
481
|
-
values: storyWays,
|
|
482
|
-
unset: "situations",
|
|
483
|
-
means: {
|
|
484
|
-
situations: "factions, threats and places with secrets, no main plot: you choose where to go",
|
|
485
|
-
arcs: "a central threat that advances by stages, your character's own story woven in",
|
|
486
|
-
episodes: "a story that closes each session, with a thread that comes back",
|
|
487
|
-
mystery: "every story an investigation, its truth decided before you start",
|
|
488
|
-
},
|
|
489
|
-
},
|
|
490
|
-
author: {
|
|
491
|
-
about: "an author the master writes like: their way of telling, never their sentences, names or places",
|
|
492
|
-
most: styleTextLengths.author,
|
|
493
|
-
cleared: "write as the prose setting says again",
|
|
494
|
-
},
|
|
495
|
-
style: {
|
|
496
|
-
about: "your own wishes for how the master writes, in a few words, such as third person, past tense",
|
|
497
|
-
most: styleTextLengths.style,
|
|
498
|
-
cleared: "their own words on how you write no longer hold",
|
|
499
|
-
},
|
|
500
|
-
dice: { about: "who rolls your character's dice", values: diceWays, means: { digital: "the engine rolls them", physical: "you roll your own and tell the values" } },
|
|
501
|
-
"master-rolls": {
|
|
502
|
-
about: "the master's rolls for foes and the characters you meet; yours and your companions' are always in view",
|
|
503
|
-
values: masterRollWays,
|
|
504
|
-
means: { "behind the screen": "hidden: the master tells you only what comes of them", "in view": "shown among the rolls, beside yours" },
|
|
505
|
-
unset: "behind the screen",
|
|
506
|
-
},
|
|
507
|
-
units: { about: "the units of the story", values: unitSystems, means: { metric: "metres and kilometres", imperial: "feet and miles" } },
|
|
508
|
-
voices: {
|
|
509
|
-
about: "who speaks for the characters you meet",
|
|
510
|
-
values: voiceWays,
|
|
511
|
-
means: {
|
|
512
|
-
master: "the master, always",
|
|
513
|
-
auto: "at key moments, as the master chooses, the character themselves, knowing only what they know, where your AI app can",
|
|
514
|
-
important: "always the character themselves for your companions and the main characters, the others only at key moments: slower answers, and more of your plan",
|
|
515
|
-
always: "always the character themselves, for everyone: much slower answers, and much more of your plan",
|
|
516
|
-
},
|
|
517
|
-
unset: "auto",
|
|
518
|
-
},
|
|
519
|
-
pictures: {
|
|
520
|
-
about: "the pictures of places, quests and those you meet, made on this computer",
|
|
521
|
-
values: pictureWays,
|
|
522
|
-
means: { none: "no pictures", "on request": "those you ask for", "new elements": "one for each new place and quest, and for each one you meet" },
|
|
523
|
-
},
|
|
524
|
-
effort: {
|
|
525
|
-
about: "how much the master thinks before each answer, from the next chat",
|
|
526
|
-
values: [...efforts, "app"],
|
|
527
|
-
means: { low: "quicker answers, a little less thought", medium: "the usual balance", high: "slower answers, more thought", app: "your AI app decides, as it does in any chat" },
|
|
528
|
-
unset: "app",
|
|
529
|
-
},
|
|
530
|
-
lines: { about: "what never appears in the game" },
|
|
531
|
-
veils: { about: "what happens only off screen, without details" },
|
|
532
|
-
language: { about: "the language the master plays in, and the page's too when it is translated" },
|
|
533
|
-
};
|
|
534
|
-
// What the setup asks besides the player's settings (D-370): how the player character and the companions come, how far ahead a world is made and how long it
|
|
535
|
-
// plays, the campaign's name.
|
|
536
|
-
const setupWords = {
|
|
537
|
-
companions: {
|
|
538
|
-
about: "how companions come to your side",
|
|
539
|
-
values: companionWays,
|
|
540
|
-
means: {
|
|
541
|
-
none: "you play alone",
|
|
542
|
-
"made with the player": "you make them with the master in session zero",
|
|
543
|
-
"made by the master": "the master makes them in session zero",
|
|
544
|
-
"met in play": "you meet them in the story",
|
|
545
|
-
},
|
|
546
|
-
},
|
|
547
|
-
preparation: {
|
|
548
|
-
about: "how far ahead the master makes the world",
|
|
549
|
-
values: preparations,
|
|
550
|
-
means: { "on the fly": "just before it is needed, so the story can go anywhere", "all at the start": "all of it before the first scene" },
|
|
551
|
-
},
|
|
552
|
-
length: {
|
|
553
|
-
about: "how long the story you play lasts; at its end you can always go on",
|
|
554
|
-
values: lengths,
|
|
555
|
-
means: {
|
|
556
|
-
"one evening": "one adventure that begins and ends in an evening",
|
|
557
|
-
"a few sessions": "an adventure of three to five evenings",
|
|
558
|
-
open: "a campaign with no set end, one adventure after another",
|
|
559
|
-
},
|
|
560
|
-
},
|
|
561
|
-
character: {
|
|
562
|
-
about: "how your character is made in session zero",
|
|
563
|
-
values: characterWays,
|
|
564
|
-
means: {
|
|
565
|
-
"made with the player": "you make it with the master, choice by choice",
|
|
566
|
-
"made by the master": "the master makes it from a few words of yours",
|
|
567
|
-
"the player's own": "you bring one you already have, as a sheet, a file or a description, at its level",
|
|
568
|
-
},
|
|
569
|
-
labels: { "made with the player": "With the master", "made by the master": "The master makes it", "the player's own": "I already have one" },
|
|
570
|
-
},
|
|
571
|
-
name: { about: "the campaign's name" },
|
|
572
|
-
};
|
|
573
|
-
// The setup's questions, in the order the player meets them on the dashboard: how well they know the game, how it plays, how it is rolled, who comes along,
|
|
574
|
-
// the world and how long it plays, then the limits.
|
|
575
|
-
const setupOrder = ["mentor", "difficulty", "lethality", "saves", "rigor", "dice", "master-rolls", "units", "character", "companions", "preparation", "length"];
|
|
576
|
-
// The mentor as the setup asks it (D-347): how well the player knows the game, each answer a way of the mentor, from the newest player's.
|
|
577
|
-
const mentorAnswers = { tutorial: "never played it", hints: "a little", off: "I know it" };
|
|
578
|
-
// What the setup asks only of a world not written (D-80, D-558): a written one has its own.
|
|
579
|
-
const worldSettingNames = ["preparation", "length"];
|
|
580
|
-
// The values the game suggests in the setup, as the design has them by default (D-370): never chosen for the player.
|
|
581
|
-
const suggestedValues = { saves: "checkpoint", rigor: "smooth", "master-rolls": "behind the screen", character: "made with the player", preparation: "on the fly", length: "one evening" };
|
|
582
|
-
// The lethality the difficulty suggests (D-141).
|
|
583
|
-
const suggestedLethality = { story: "narrative", easy: "epic" };
|
|
584
|
-
/** A question whose value is only the one shown while it is unset, as master-rolls behind the screen (D-287): still unanswered in the setup. */
|
|
585
|
-
function unsetUnanswered(question, settings) {
|
|
586
|
-
const { value, ...unanswered } = question;
|
|
587
|
-
return value !== undefined && wordsOf(question.name)?.unset === value && settings[question.name] === undefined ? unanswered : question;
|
|
588
|
-
}
|
|
589
|
-
/** The mentor as the setup asks it (D-347): how well the player knows the game, never played it first. */
|
|
590
|
-
function mentorQuestion(question) {
|
|
591
|
-
const order = Object.keys(mentorAnswers);
|
|
592
|
-
const choices = (question.choices ?? []).map((choice) => ({ ...choice, label: mentorAnswers[choice.value] })).sort((one, other) => order.indexOf(one.value) - order.indexOf(other.value));
|
|
593
|
-
return { ...question, question: "How well do you know this game?", about: "the master teaches it as much as you need", choices };
|
|
594
|
-
}
|
|
595
|
-
/** A player's setting as the game offers it (DAT-16): none where it plays one value alone; only the values it offers, and no value written that it does not. */
|
|
596
|
-
function offeredSetting(root, context, setting) {
|
|
597
|
-
const offered = offeredValues(root, context, setting.name);
|
|
598
|
-
if (offered === undefined) {
|
|
599
|
-
return [setting];
|
|
600
|
-
}
|
|
601
|
-
if (offered.length === 1) {
|
|
602
|
-
return [];
|
|
603
|
-
}
|
|
604
|
-
const { value, ...rest } = setting;
|
|
605
|
-
const kept = offered.some((one) => comparableText(one) === comparableText(value ?? "")) ? { value } : {};
|
|
606
|
-
return [{ ...rest, ...kept, ...(setting.choices === undefined ? {} : { choices: setting.choices.filter((choice) => offered.some((one) => comparableText(one) === comparableText(choice.value))) }) }];
|
|
607
|
-
}
|
|
608
|
-
// Who makes the pictures on this computer, in the player's words (D-390).
|
|
609
|
-
const madeBy = { Codex: "Codex makes them on this computer, from your ChatGPT plan.", Claude: "Claude draws them on this computer, as vector pictures, from your Claude plan." };
|
|
610
|
-
/** Every note the pictures' setting may have, which the dashboard writes in its language (D-394). */
|
|
611
|
-
export const picturesNotes = [...Object.values(madeBy), ...[...Object.values(codexSays), ...Object.values(claudeSays)].map(notReadyText)];
|
|
612
|
-
/** Whether this computer makes pictures, and with whose plan, in the player's words (D-308, D-390); why not and how to have them; nothing where no maker is asked. */
|
|
613
|
-
function picturesReadyNote(context) {
|
|
614
|
-
const ready = context.pictures?.ready(true);
|
|
615
|
-
return ready === undefined ? {} : { note: ready.ready ? { text: madeBy[ready.maker ?? "Codex"] } : { text: notReadyText(ready), fix: true } };
|
|
616
|
-
}
|
|
617
|
-
/** How the player has pictures, or else why there are none. */
|
|
618
|
-
function notReadyText(said) {
|
|
619
|
-
return said.fix ?? `${said.why}.`;
|
|
620
|
-
}
|
|
621
|
-
/** What an item the player added to a list means to the master: what the list holds, or what to do, as for learned. */
|
|
622
|
-
function addedText(setting) {
|
|
623
|
-
return wordsOf(setting.name)?.added ?? setting.about;
|
|
624
|
-
}
|
|
625
|
-
/** What the master does when the player takes an item off a list, as for learned: explain it again. */
|
|
626
|
-
function takenOffText(name) {
|
|
627
|
-
const taken = wordsOf(name)?.takenOff;
|
|
628
|
-
return taken === undefined ? "" : `: ${taken}`;
|
|
629
|
-
}
|
|
630
|
-
/** Items in quotes, one after another: "spiders", "drowning". */
|
|
631
|
-
function quotedItems(items) {
|
|
632
|
-
return items.map((item) => `"${item}"`).join(", ");
|
|
633
|
-
}
|
|
634
|
-
/** A setting the game system adds, shown, or changed to one of its values (DAT-10); refused with them for any other. */
|
|
635
|
-
function systemSettingResult(root, context, setting, input) {
|
|
636
|
-
if (input.add !== undefined || input.remove !== undefined) {
|
|
637
|
-
throw new Error(`${setting.name} takes one value, ${valuesText(setting)}, such as setting ${setting.name}, value ${setting.values[0].value}. Nothing changed.`);
|
|
638
|
-
}
|
|
639
|
-
if (input.value !== undefined) {
|
|
640
|
-
const given = input.value.trim();
|
|
641
|
-
const value = setting.values.find((candidate) => comparableText(candidate.value) === comparableText(given));
|
|
642
|
-
if (value === undefined) {
|
|
643
|
-
throw new Error(`"${given}" is not a value of ${setting.name}, which takes ${setting.values.map((candidate) => `${candidate.value} (${candidate.means})`).join("; or ")}. Nothing changed.`);
|
|
644
|
-
}
|
|
645
|
-
const before = campaignSystem(root, context)?.version?.name;
|
|
646
|
-
if (changeOtherSetting(root, setting.name, value.value)) {
|
|
647
|
-
appendLogEntry(root, newDatedLogEntry(root, context, "config-changed", "public", { setting: setting.name, value: value.value }));
|
|
648
|
-
}
|
|
649
|
-
// Another version of the rules holds from the next read; what is written stays (VER-4).
|
|
650
|
-
if (setting.name === rulesetSetting && before !== undefined && comparableText(before) !== comparableText(value.value)) {
|
|
651
|
-
return {
|
|
652
|
-
settings: { [setting.name]: systemShownValue(root, context, setting) },
|
|
653
|
-
note: campaignNote(root, context, true),
|
|
654
|
-
replaced: [`From now on the campaign plays the rules ${value.value}, in place of ${before}: the pages already written stay as they are.`, ...unofferedLines(root, context)],
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
// The master's own change of a value brings its part, as the player's does with the dashboard's news (DAT-18).
|
|
658
|
-
const part = context.actor === "player" || campaignMode(root, campaignWorld(root, context)) !== "play" ? undefined : valuePart(root, context, setting.name, value.value);
|
|
659
|
-
return {
|
|
660
|
-
settings: { [setting.name]: systemShownValue(root, context, setting) },
|
|
661
|
-
note: campaignNote(root, context, true),
|
|
662
|
-
replaced: unofferedLines(root, context),
|
|
663
|
-
...(part === undefined ? {} : { part }),
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
return { settings: { [setting.name]: systemShownValue(root, context, setting) }, note: campaignNote(root, context, true), replaced: [] };
|
|
667
|
-
}
|
|
668
|
-
/** An engine's setting as config shows it where the game offers only some of its values (DAT-16): the one it plays alone, or missing with those it offers. */
|
|
669
|
-
function offeredShown(root, context, name, shown) {
|
|
670
|
-
const offered = offeredValues(root, context, name);
|
|
671
|
-
if (offered === undefined) {
|
|
672
|
-
return shown;
|
|
673
|
-
}
|
|
674
|
-
if (isFixedSetting(root, context, name)) {
|
|
675
|
-
return `${offered[0]} (the only one this game plays: no choice)`;
|
|
676
|
-
}
|
|
677
|
-
return playedEngineSetting(root, context, name) === undefined ? `(missing; ${offered.join(", ")})` : shown;
|
|
678
|
-
}
|
|
679
|
-
/** A setting of the system as config shows it: its value with what it means, or missing with every value and what it means (DAT-10). */
|
|
680
|
-
function systemShownValue(root, context, setting) {
|
|
681
|
-
const value = playedSettingValue(root, context, setting);
|
|
682
|
-
const chosen = setting.values.find((candidate) => candidate.value === value);
|
|
683
|
-
return chosen === undefined ? `(missing; ${setting.values.map((candidate) => `${candidate.value}: ${candidate.means}`).join("; ")})` : `${chosen.value}: ${chosen.means}`;
|
|
684
|
-
}
|
|
685
|
-
/** A setting as config shows it: a list or entries by name, none when missing; the coins and the system as they read (MON-7, D-173); difficulty and rigor with what they mean (D-263). */
|
|
686
|
-
function shownValue(root, context, settings, name) {
|
|
687
|
-
const meaning = settingMeaning(name, settings[name], countedByGame(campaignSystem(root, context)), customWritten(root, name));
|
|
688
|
-
if (meaning !== undefined) {
|
|
689
|
-
return `${String(settings[name])}: ${meaning}`;
|
|
690
|
-
}
|
|
691
|
-
// The library with what is read of each entry, and what is skipped (LIB-5).
|
|
692
|
-
if (name === "library") {
|
|
693
|
-
return libraryShown(root, context);
|
|
694
|
-
}
|
|
695
|
-
// Lines and veils not yet answered are missing: [] is the answer none (MOD-3).
|
|
696
|
-
if (listSettingNames.includes(name)) {
|
|
697
|
-
return settings[name] ?? (setupSettingNames.includes(name) ? undefined : []);
|
|
698
|
-
}
|
|
699
|
-
if (entrySettingNames.includes(name)) {
|
|
700
|
-
return settings[name] ?? {};
|
|
701
|
-
}
|
|
702
|
-
// How the master writes, unset: the core's own ways, never missing (D-395).
|
|
703
|
-
// And the master's effort, unset: each app's own, the player's to choose (D-462); who voices the characters, unset: auto (D-490); the master's rolls, behind the screen (D-287); the game time between sessions, stopped (D-133).
|
|
704
|
-
const own = {
|
|
705
|
-
prose: "plain (as your instructions write)",
|
|
706
|
-
story: "situations (as your instructions write)",
|
|
707
|
-
author: "(none)",
|
|
708
|
-
style: "(none)",
|
|
709
|
-
effort: "(the app's own: the player's to choose)",
|
|
710
|
-
voices: "auto (a subagent at key moments, as you choose, where the app has them)",
|
|
711
|
-
"master-rolls": "behind the screen (unset: roll hides your rolls for foes and NPCs)",
|
|
712
|
-
"between-sessions": "stops (unset: no game time passes between sessions)",
|
|
713
|
-
};
|
|
714
|
-
if (settings[name] === undefined && Object.hasOwn(own, name)) {
|
|
715
|
-
return own[name];
|
|
716
|
-
}
|
|
717
|
-
return name === "coins" ? coinsShown(root, context) : name === "system" ? systemShown(root, settings.system, context) : settings[name];
|
|
718
|
-
}
|
|
719
|
-
/** A setting's value as config writes it: an installed system by the name it is installed under (D-167), the coins read and checked (MON-1), anything else as given. */
|
|
720
|
-
function settingValue(root, setting, value, context) {
|
|
721
|
-
if (setting === "calendar") {
|
|
722
|
-
const read = yamlValue(value, "the calendar", "months: [{name: January, days: 31, season: winter}, ...]");
|
|
723
|
-
try {
|
|
724
|
-
return readCalendar(read);
|
|
725
|
-
}
|
|
726
|
-
catch (error) {
|
|
727
|
-
throw new Error(`${error instanceof Error ? error.message : String(error)} Nothing changed.`);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
if (setting === "calendar-start") {
|
|
731
|
-
return calendarStartValue(root, context, value);
|
|
732
|
-
}
|
|
733
|
-
// The game time between sessions (D-133): it stops, or runs at a rate of game time to real time.
|
|
734
|
-
if (setting === "between-sessions") {
|
|
735
|
-
if (readBetweenSessions(value) === undefined) {
|
|
736
|
-
throw new Error(`"${value}" is no between-sessions: give stops, or the game time that passes for a real time, such as 1d per 7d. Nothing changed.`);
|
|
737
|
-
}
|
|
738
|
-
return value.trim().replace(/\s+/g, " ");
|
|
739
|
-
}
|
|
740
|
-
return setting === "coins" ? newCoins(root, value, context) : setting === "system" ? installedSystemName(value, context, "config") : value;
|
|
741
|
-
}
|
|
742
|
-
/**
|
|
743
|
-
* The system stays once the campaign has a player character, whose sheet is written in it, whatever the mode (D-519): another installed one, or none, is
|
|
744
|
-
* refused, with a new campaign as the way; the same one, by any case, is no change.
|
|
745
|
-
*/
|
|
746
|
-
function checkSystemOpen(root, context, value) {
|
|
747
|
-
const current = readTextSetting(root, "system");
|
|
748
|
-
// A name that is no installed system is said as such first; none takes the system away.
|
|
749
|
-
const asked = value.trim().toLowerCase() === "none" ? value : installedSystemName(value, context, "config");
|
|
750
|
-
if (current === undefined || comparableText(current) === comparableText(asked)) {
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
const players = playersOfTheGame(root, context);
|
|
754
|
-
if (players.length > 0) {
|
|
755
|
-
const name = readSettings(root).name;
|
|
756
|
-
throw new Error(`The system of ${name} is ${current}, and the game has begun with ${players.join(", ")}: a campaign keeps its system. To play another, start a new campaign with init. Nothing changed.`);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
/** When the story starts, day 1 or a day of the campaign's calendar (TIM-8), checked and written as given. */
|
|
760
|
-
function calendarStartValue(root, context, value) {
|
|
761
|
-
try {
|
|
762
|
-
readCalendarStart(value, campaignCalendar(root, context).calendar);
|
|
763
|
-
}
|
|
764
|
-
catch (error) {
|
|
765
|
-
throw new Error(`${error instanceof Error ? error.message : String(error)} Nothing changed.`);
|
|
766
|
-
}
|
|
767
|
-
return value.trim().replace(/\s+/g, " ");
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* The system as config shows it (D-173): what it is, the version of its rules it is played with (VER-1), and the package that brings it with its version, or the
|
|
771
|
-
* engine for one it ships without a package; missing or not installed, with those that are (D-167).
|
|
772
|
-
*/
|
|
773
|
-
function systemShown(root, system, context) {
|
|
774
|
-
const installed = `installed: ${readableSystems(context.systemFolders).map((installedSystem) => installedSystem.name).join(", ") || "none"}`;
|
|
775
|
-
if (system === undefined) {
|
|
776
|
-
return `(missing; ${installed})`;
|
|
777
|
-
}
|
|
778
|
-
const found = findSystem(context.systemFolders, system, readTextSetting(root, rulesetSetting));
|
|
779
|
-
if (found === undefined) {
|
|
780
|
-
return `${system} (not installed; ${installed})`;
|
|
781
|
-
}
|
|
782
|
-
const own = systemPackage(found.folder);
|
|
783
|
-
const shipped = isInside(engineSystemsFolder, found.folder);
|
|
784
|
-
const from = own !== undefined ? ` (${own.package} ${own.version})` : shipped ? ` (rpg-engine ${getVersion()})` : "";
|
|
785
|
-
return `${found.name}, ${found.title}${playedRules(root, context, found)}${from}`;
|
|
786
|
-
}
|
|
787
|
-
/** The coins given to config, refused when money already written in the world would no longer read as money with them (MON-1). */
|
|
788
|
-
function newCoins(root, text, context) {
|
|
789
|
-
const coins = readCoins(text);
|
|
790
|
-
const before = campaignCoins(root, context).coins;
|
|
791
|
-
if (before === undefined) {
|
|
792
|
-
return coins;
|
|
793
|
-
}
|
|
794
|
-
const after = coinList(coins);
|
|
795
|
-
const scene = readOpenScene(root).scene;
|
|
796
|
-
const world = campaignWorld(root, context);
|
|
797
|
-
const holders = [...world.pages.map((page) => ({ name: page.name, fields: page.fields })), ...Object.entries(scene?.copies ?? {}).map(([name, copy]) => ({ name, fields: copy }))];
|
|
798
|
-
// A field the game system declares is never money (SYS-8).
|
|
799
|
-
const lost = holders.flatMap((holder) => Object.entries(holder.fields).filter(([field, value]) => declaredKind(world, field) === undefined && readAmount(value, before) !== undefined && readAmount(value, after) === undefined)
|
|
800
|
-
.map(([field, value]) => `${holder.name}: ${field} ${String(value)}`));
|
|
801
|
-
if (lost.length > 0) {
|
|
802
|
-
const more = lost.length > 5 ? `, and ${lost.length - 5} more` : "";
|
|
803
|
-
throw new Error(`With these coins, money already written would no longer be money: ${lost.slice(0, 5).join("; ")}${more}. Keep their coins in the list (another name works too, such as gp/mo), or change those first. Nothing changed.`);
|
|
804
|
-
}
|
|
805
|
-
return coins;
|
|
806
|
-
}
|
|
807
|
-
function formatValue(value) {
|
|
808
|
-
if (Array.isArray(value)) {
|
|
809
|
-
return value.length > 0 ? value.join("; ") : "(none)";
|
|
810
|
-
}
|
|
811
|
-
// Entries by name, as campaign.yaml writes them, on one line.
|
|
812
|
-
if (value !== null && typeof value === "object") {
|
|
813
|
-
return Object.keys(value).length === 0 ? "(none)" : stringify(value, { collectionStyle: "flow", lineWidth: 0 }).trim();
|
|
814
|
-
}
|
|
815
|
-
return value === undefined ? "(missing)" : String(value);
|
|
816
|
-
}
|
|
817
|
-
/** The entries given to a setting that holds them, read as YAML, such as "bulwark-dice: {max: 4, refill: short rest}" (CAM-1). */
|
|
818
|
-
function entriesOf(setting, text) {
|
|
819
|
-
const value = yamlValue(text, "the entries", "name: value");
|
|
820
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
821
|
-
throw new Error(`${setting} takes entries by name, written as in system.yaml, such as ${setting === "counters" ? `'${counterShape}'` : '"name: value"'}. Nothing changed.`);
|
|
822
|
-
}
|
|
823
|
-
return value;
|
|
824
|
-
}
|
|
825
|
-
/** A value given as YAML text, read; what does not read says how to write it. */
|
|
826
|
-
function yamlValue(text, what, example) {
|
|
827
|
-
try {
|
|
828
|
-
return parse(text);
|
|
829
|
-
}
|
|
830
|
-
catch (error) {
|
|
831
|
-
throw new Error(`"${text}" does not read: ${error instanceof Error ? error.message.split("\n")[0] : String(error)}. Write ${what} as in system.yaml, such as ${example}. Nothing changed.`);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* "counters channel-divinity takes the place of the system 5e's {max: …, refill: short rest}": what an entry given in place of one of the system's leaves out,
|
|
836
|
-
* said so that nothing is lost unseen (CAM-2). A recipe adds to the system's and replaces nothing.
|
|
837
|
-
*/
|
|
838
|
-
function replacedEntries(root, context, setting, names) {
|
|
839
|
-
const system = findSystem(context.systemFolders, readTextSetting(root, "system") ?? "");
|
|
840
|
-
if (system === undefined || setting === "recipes") {
|
|
841
|
-
return [];
|
|
842
|
-
}
|
|
843
|
-
// Its version's entries over its own (VER-3).
|
|
844
|
-
const version = campaignSystem(root, context)?.version?.folder;
|
|
845
|
-
const entries = [system.folder, ...(version === undefined ? [] : [version])].flatMap((folder) => {
|
|
846
|
-
const data = files().exists(join(folder, systemFileName)) ? readYamlValues(join(folder, systemFileName), "what the system is") : undefined;
|
|
847
|
-
const own = data !== null && typeof data === "object" ? data[setting] : undefined;
|
|
848
|
-
return own !== null && typeof own === "object" && !Array.isArray(own) ? Object.entries(own) : [];
|
|
849
|
-
}).reverse();
|
|
850
|
-
return names.flatMap((name) => {
|
|
851
|
-
const [found, value] = entries.find(([other]) => comparableText(other) === comparableText(name)) ?? [];
|
|
852
|
-
return found === undefined ? [] : [`${setting} ${name} takes the place of the system ${system.name}'s ${found}, ${formatValue(value)}: what this one leaves out of it is gone.`];
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
/** Refuses what the campaign would add to its game system when the system would not read with it (CAM-3), saying where and why; and when it has no system yet. */
|
|
856
|
-
function checkAdditions(root, context, setting, change) {
|
|
857
|
-
const system = readTextSetting(root, "system");
|
|
858
|
-
if (system === undefined || findSystem(context.systemFolders, system) === undefined) {
|
|
859
|
-
throw new Error(`The campaign has no installed game system to add ${setting} to: set its system first. Nothing changed.`);
|
|
860
|
-
}
|
|
861
|
-
const data = readCampaignData(root);
|
|
862
|
-
const held = data[setting] !== null && typeof data[setting] === "object" && !Array.isArray(data[setting]) ? data[setting] : {};
|
|
863
|
-
const dropped = [...(change.remove ?? []), ...Object.keys(change.set ?? {})];
|
|
864
|
-
const entries = { ...Object.fromEntries(Object.entries(held).filter(([name]) => !dropped.some((other) => comparableText(other) === comparableText(name)))), ...change.set };
|
|
865
|
-
// Over what the campaign's extensions add, as the campaign plays it (CAM-2).
|
|
866
|
-
const layers = systemLayers(root, context, { ...data, [setting]: entries });
|
|
867
|
-
const problem = findCampaignSystem(context.systemFolders, system, layers, readTextSetting(root, rulesetSetting)).refused.find((layer) => layer.from === layers.at(-1)?.from)?.problem;
|
|
868
|
-
if (problem !== undefined) {
|
|
869
|
-
throw new Error(`With this, the system ${system} would not read: ${problem} Nothing changed.`);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
/** The game time between sessions as the dashboard shows it (D-133): by the words of a way it offers that plays the same, as STOPS or 2d per 14d; any other as written. */
|
|
873
|
-
function shownBetweenSessions(written) {
|
|
874
|
-
const read = readBetweenSessions(written);
|
|
875
|
-
const same = (way) => {
|
|
876
|
-
const offered = readBetweenSessions(way);
|
|
877
|
-
return read === "stops" || offered === "stops" ? read === offered : read !== undefined && offered !== undefined && read.game * offered.real === offered.game * read.real;
|
|
878
|
-
};
|
|
879
|
-
return betweenSessionsWays.find(same) ?? written;
|
|
880
|
-
}
|
|
881
|
-
/** What the game time between sessions means to the master (D-133): stopped, or a rate with what status asks of them after a pause; undefined for what does not read. */
|
|
882
|
-
function betweenSessionsMeaning(value) {
|
|
883
|
-
const read = readBetweenSessions(value);
|
|
884
|
-
if (read === "stops") {
|
|
885
|
-
return "no game time passes between sessions: the next one opens at the moment this one ends";
|
|
886
|
-
}
|
|
887
|
-
return read === undefined
|
|
888
|
-
? undefined
|
|
889
|
-
: `the game time runs ${formatDuration(read.game)} for each ${formatDuration(read.real)} of real time between sessions: after a pause, status says how much to let pass with advance `
|
|
890
|
-
+ "before you open the new session, and the opening tells what the world did meanwhile";
|
|
891
|
-
}
|
|
892
|
-
/** The difficulty or rigor whose items a setting holds: difficulty for custom-difficulty; undefined for any other (T-132). */
|
|
893
|
-
function customOf(name) {
|
|
894
|
-
return name.trim() === customSettings.difficulty ? "difficulty" : name.trim() === customSettings.rigor ? "rigor" : undefined;
|
|
895
|
-
}
|
|
896
|
-
/** The items of a custom difficulty or rigor as campaign.yaml writes them, for its meaning; undefined for another setting. */
|
|
897
|
-
function customWritten(root, name) {
|
|
898
|
-
return name === "difficulty" || name === "rigor" ? readOneSetting(root, customSettings[name]) : undefined;
|
|
899
|
-
}
|
|
900
|
-
/** The items of a custom difficulty or rigor as config takes them, food: rules, each checked and named as the engine names it (T-132). */
|
|
901
|
-
function customEntries(setting, text) {
|
|
902
|
-
const { items, levels } = leveled[setting];
|
|
903
|
-
// food: rules, load: smooth as the master says it, and as YAML writes it, {food: rules, load: smooth}.
|
|
904
|
-
const written = text.trim().startsWith("{") ? text : `{${text}}`;
|
|
905
|
-
const entries = Object.entries(entriesOf(customSettings[setting], written)).map(([item, level]) => {
|
|
906
|
-
const known = items.find((one) => comparableText(one) === comparableText(item));
|
|
907
|
-
const at = levels.find((one) => typeof level === "string" && comparableText(one) === comparableText(level));
|
|
908
|
-
if (known === undefined) {
|
|
909
|
-
throw new Error(`${item} is no item of the custom ${setting}: they are ${items.join(", ")}. Nothing changed.`);
|
|
910
|
-
}
|
|
911
|
-
if (at === undefined) {
|
|
912
|
-
throw new Error(level === null
|
|
913
|
-
? `${known} needs its level, ${levels.join(", ")}: write it as ${known}: ${levels[1]}. Nothing changed.`
|
|
914
|
-
: `${known} takes ${levels.join(", ")}, not ${String(level)}. Nothing changed.`);
|
|
915
|
-
}
|
|
916
|
-
return [known, at];
|
|
917
|
-
});
|
|
918
|
-
return Object.fromEntries(entries);
|
|
919
|
-
}
|
|
920
|
-
/** The items of a custom difficulty or rigor as the dashboard shows them, each with its level, only while the campaign plays it custom (T-132). */
|
|
921
|
-
function customItems(root, context, setting, words) {
|
|
922
|
-
if (playedEngineSetting(root, context, setting) !== customLevel) {
|
|
923
|
-
return [];
|
|
924
|
-
}
|
|
925
|
-
const levels = customLevels(setting, readOneSetting(root, customSettings[setting]));
|
|
926
|
-
return [{
|
|
927
|
-
name: customSettings[setting],
|
|
928
|
-
about: words.about,
|
|
929
|
-
entries: Object.entries(levels).map(([name, value]) => ({ name, value })),
|
|
930
|
-
choices: (words.values ?? []).map((value) => ({ value })),
|
|
931
|
-
}];
|
|
932
|
-
}
|
|
933
|
-
/** What the master hears of the items of a custom difficulty or rigor the player changed on the dashboard: those changed, then the whole as it plays now. */
|
|
934
|
-
function customNews(root, context, before, after) {
|
|
935
|
-
const setting = customOf(after.name);
|
|
936
|
-
const changed = (after.entries ?? []).filter((entry) => before.entries?.find((one) => one.name === entry.name)?.value !== entry.value);
|
|
937
|
-
if (setting === undefined || changed.length === 0) {
|
|
938
|
-
return [];
|
|
939
|
-
}
|
|
940
|
-
// Each item changed with what it means now: the whole custom one is in status, and comes with the news when the player chose it.
|
|
941
|
-
const counted = countedByGame(campaignSystem(root, context));
|
|
942
|
-
const set = changed.map((entry) => `${entry.name} to ${entry.value} (${itemMeaning(setting, entry.name, entry.value, counted) ?? entry.value})`).join("; ");
|
|
943
|
-
return [`The player set in the custom ${setting} on the dashboard ${set}. Play by it from now on.`];
|
|
944
|
-
}
|
|
945
|
-
/** What a setting of the player's is to them and to the master, by its name; undefined for one of the game system. */
|
|
946
|
-
function wordsOf(name) {
|
|
947
|
-
return Object.hasOwn(playerWords, name) ? playerWords[name] : undefined;
|
|
948
|
-
}
|