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
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
// The world map's card: the maps the character knows as tabs, the view that moves and zooms with the mouse, the wheel, touch and the keys, its tools.
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
4
|
+
import { Icon } from "../parts/icons.js";
|
|
5
|
+
import { t } from "../text.js";
|
|
6
|
+
import { Drawing } from "./drawing.js";
|
|
7
|
+
import { Key } from "./key.js";
|
|
8
|
+
import { clampScale, fitView, liftedOf, mapNameOf, trailCourse, waterOf, wayShapes, zoomedView } from "./map.js";
|
|
9
|
+
import { PlaceCard } from "./place-card.js";
|
|
10
|
+
// How wide the map shows around the party at first on a phone, in km; how much a step of the zoom and of the keys moves.
|
|
11
|
+
const phoneSpan = 46;
|
|
12
|
+
const zoomStep = 1.5;
|
|
13
|
+
const keyStep = 60;
|
|
14
|
+
// How far a pointer moves before a press is a drag, not a click, in pixels.
|
|
15
|
+
const dragFrom = 4;
|
|
16
|
+
/**
|
|
17
|
+
* The map's card: its head, with the maps the character knows as tabs; the map with its tools and the card of the chosen place; the key under it. `map` is what
|
|
18
|
+
* the current map draws, `full` the whole world map, for the ways that lead to other maps.
|
|
19
|
+
*/
|
|
20
|
+
export function MapCard({ map, full, part, layout, lead, chosen, focus, onChoose, onGo, readMore }) {
|
|
21
|
+
const box = useRef(null);
|
|
22
|
+
const [size, setSize] = useState();
|
|
23
|
+
const [view, setView] = useState();
|
|
24
|
+
// The ways drawn by hand and the trail along them, once for each map: the same at every drawing.
|
|
25
|
+
const ways = useMemo(() => wayShapes(map), [map]);
|
|
26
|
+
const trails = useMemo(() => part.trails.map((run) => trailCourse(run, ways, waterOf(map))), [part, ways, map]);
|
|
27
|
+
const lifted = useMemo(() => liftedOf(map, layout, ways, trails), [map, layout, ways, trails]);
|
|
28
|
+
// Under a map aligned with another, the other one as a ghost: its ways and its places, faint (D-320).
|
|
29
|
+
const ghost = useMemo(() => {
|
|
30
|
+
if (part.ghost === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const { places, roads } = part.ghost;
|
|
34
|
+
return { ways: wayShapes({ ...full, places, roads }), spots: places.filter((place) => place.x !== undefined && place.y !== undefined && place.radius === undefined) };
|
|
35
|
+
}, [part, full]);
|
|
36
|
+
const pointers = useRef(new Map());
|
|
37
|
+
const drag = useRef(undefined);
|
|
38
|
+
const narrow = size !== undefined && size.width < 600;
|
|
39
|
+
// The map's size, as the window changes it.
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const element = box.current;
|
|
42
|
+
if (element === null) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const observer = new ResizeObserver(() => setSize({ width: element.clientWidth, height: element.clientHeight }));
|
|
46
|
+
observer.observe(element);
|
|
47
|
+
return () => observer.disconnect();
|
|
48
|
+
}, []);
|
|
49
|
+
// The first view: all the character knows; on a phone, the land around the party; with a place already chosen, as from the Lore's Show on the map, that place.
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (size !== undefined && view === undefined) {
|
|
52
|
+
const spot = shownPoint(map, layout, focus.name);
|
|
53
|
+
const start = startView(map, lifted, size);
|
|
54
|
+
setView(spot === undefined ? start : roomFor(spot, start, size, size.width < 600));
|
|
55
|
+
}
|
|
56
|
+
}, [size]);
|
|
57
|
+
// A place chosen: the map brings it where the card leaves room, right of it on a wide screen, above it on a phone.
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const spot = shownPoint(map, layout, focus.name);
|
|
60
|
+
if (spot !== undefined && size !== undefined && view !== undefined) {
|
|
61
|
+
setView(roomFor(spot, view, size, narrow));
|
|
62
|
+
}
|
|
63
|
+
}, [focus.count]);
|
|
64
|
+
// The wheel zooms around the pointer; the page does not scroll under it.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const element = box.current;
|
|
67
|
+
if (element === null || size === undefined) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const wheel = (event) => {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
const bounds = element.getBoundingClientRect();
|
|
73
|
+
setView((before) => before === undefined ? before : zoomedView(before, event.deltaY < 0 ? 1.2 : 1 / 1.2, { x: event.clientX - bounds.left, y: event.clientY - bounds.top }, size.width, size.height));
|
|
74
|
+
};
|
|
75
|
+
element.addEventListener("wheel", wheel, { passive: false });
|
|
76
|
+
return () => element.removeEventListener("wheel", wheel);
|
|
77
|
+
}, [size]);
|
|
78
|
+
const zoom = (factor) => {
|
|
79
|
+
if (size !== undefined) {
|
|
80
|
+
setView((before) => before === undefined ? before : zoomedView(before, factor, { x: size.width / 2, y: size.height / 2 }, size.width, size.height));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
// One pointer moves the map, two pinch it: mouse, pen and touch alike. A press that hardly moves is a click.
|
|
84
|
+
const begin = (moved) => {
|
|
85
|
+
const points = [...pointers.current.values()];
|
|
86
|
+
const centre = middleOf(points);
|
|
87
|
+
drag.current = view === undefined ? undefined : { view, ...centre, spread: spreadOf(points), moved };
|
|
88
|
+
};
|
|
89
|
+
const onPointerDown = (event) => {
|
|
90
|
+
pointers.current.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
|
91
|
+
begin(false);
|
|
92
|
+
};
|
|
93
|
+
const onPointerMove = (event) => {
|
|
94
|
+
const start = drag.current;
|
|
95
|
+
if (start === undefined || !pointers.current.has(event.pointerId)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
pointers.current.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
|
99
|
+
const points = [...pointers.current.values()];
|
|
100
|
+
const centre = middleOf(points);
|
|
101
|
+
const spread = spreadOf(points);
|
|
102
|
+
if (!start.moved && Math.hypot(centre.x - start.x, centre.y - start.y) < dragFrom && points.length === 1) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!start.moved) {
|
|
106
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
107
|
+
start.moved = true;
|
|
108
|
+
}
|
|
109
|
+
const s = start.spread > 0 && spread > 0 ? clampScale(start.view.s * spread / start.spread) : start.view.s;
|
|
110
|
+
setView({ s, x: start.view.x - (centre.x - start.x) / s, y: start.view.y + (centre.y - start.y) / s });
|
|
111
|
+
};
|
|
112
|
+
const onPointerUp = (event) => {
|
|
113
|
+
pointers.current.delete(event.pointerId);
|
|
114
|
+
const moved = drag.current?.moved === true;
|
|
115
|
+
if (pointers.current.size > 0) {
|
|
116
|
+
begin(moved);
|
|
117
|
+
}
|
|
118
|
+
else if (!moved) {
|
|
119
|
+
// A click on a place opens its card; on the land, it closes it.
|
|
120
|
+
const name = event.target.closest("[data-place]")?.dataset.place;
|
|
121
|
+
onChoose(name);
|
|
122
|
+
drag.current = undefined;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
drag.current = undefined;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const onKeyDown = (event) => {
|
|
129
|
+
// Escape closes the card from anywhere in the map, and the map takes the keys again.
|
|
130
|
+
if (event.key === "Escape" && chosen !== undefined) {
|
|
131
|
+
onChoose(undefined);
|
|
132
|
+
box.current?.focus();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (event.target !== box.current || view === undefined) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const step = keyStep / view.s;
|
|
139
|
+
const moves = { ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, step], ArrowDown: [0, -step] };
|
|
140
|
+
const move = moves[event.key];
|
|
141
|
+
if (move !== undefined) {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
setView({ ...view, x: view.x + move[0], y: view.y + move[1] });
|
|
144
|
+
}
|
|
145
|
+
else if (event.key === "+" || event.key === "=") {
|
|
146
|
+
zoom(zoomStep);
|
|
147
|
+
}
|
|
148
|
+
else if (event.key === "-") {
|
|
149
|
+
zoom(1 / zoomStep);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const spot = layout.spots.find((one) => one.name === chosen);
|
|
153
|
+
const label = layout.partySpot === undefined ? t("World map") : t("World map, your party at {place}", { place: layout.partySpot.name });
|
|
154
|
+
const here = full.maps.find((known) => known.name === part.name);
|
|
155
|
+
const partyMap = full.party === undefined ? undefined : mapNameOf(full, full.party);
|
|
156
|
+
return (_jsxs("section", { class: "card map-card", "aria-labelledby": "map-title", children: [_jsxs("header", { class: "map-head", children: [_jsx("h3", { id: "map-title", children: t("Map") }), _jsx("span", { class: "map-sub", children: [
|
|
157
|
+
layout.spots.length === 1 ? t("1 place you know") : t("{count} places you know", { count: layout.spots.length }),
|
|
158
|
+
here?.under === undefined ? undefined : t("under {map}", { map: here.under }),
|
|
159
|
+
here?.mirror === undefined ? undefined : t("the mirror of {map}", { map: here.mirror }),
|
|
160
|
+
partyMap === undefined || partyMap === part.name ? undefined : t("your party is on {map}", { map: partyMap }),
|
|
161
|
+
].filter((text) => text !== undefined).join(" · ") }), _jsxs("button", { type: "button", class: "map-to-list", onClick: () => document.getElementById("places-title")?.scrollIntoView({ block: "start", behavior: "smooth" }), children: [_jsx(Icon, { name: "list" }), _jsx("span", { children: t("List") })] })] }), full.maps.length > 1 && (_jsx("nav", { class: "map-tabs", "aria-label": t("Maps"), children: full.maps.map((known) => (_jsxs("button", { type: "button", class: "map-tab", "aria-current": known.name === part.name ? "true" : undefined, onClick: () => onGo(known.name), children: [known.name, known.name === partyMap && _jsx("span", { class: "map-tab-party", "aria-label": t("your party is here") })] }, known.name))) })), _jsxs("div", { ref: box, class: "map", tabIndex: 0, role: "region", "aria-roledescription": "map", "aria-label": label, "aria-describedby": "map-help", onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, onKeyDown: onKeyDown, children: [size !== undefined && view !== undefined && (_jsx(Drawing, { map: map, layout: layout, ways: ways, trails: trails, lifted: lifted, ghost: ghost, passages: part.passages.map((passage) => passage.place), lead: lead, view: view, size: size, narrow: narrow, chosen: chosen })), _jsxs("div", { class: "map-tools", role: "toolbar", "aria-label": t("Map"), children: [_jsx(Tool, { name: "plus", label: t("Zoom in"), onClick: () => zoom(zoomStep) }), _jsx(Tool, { name: "minus", label: t("Zoom out"), onClick: () => zoom(1 / zoomStep) }), _jsx(Tool, { name: "locate", label: t("Your party"), onClick: () => (map.party !== undefined && view !== undefined ? setView({ ...view, x: map.party.x, y: map.party.y }) : partyMap !== undefined && onGo(partyMap)) }), _jsx(Tool, { name: "fit", label: t("All you know"), onClick: () => size !== undefined && setView(fitView(lifted, size.width, size.height)) })] }), _jsx("p", { id: "map-help", class: "visually-hidden", children: t("Arrows move the map, plus and minus zoom, Escape closes a place's card. The list of places below says the same.") }), spot !== undefined && _jsx(PlaceCard, { place: spot, map: full, layout: layout, narrow: narrow, onClose: () => onChoose(undefined), onGo: onGo, readMore: readMore(spot.name) })] }), _jsx(Key, { map: map, layout: layout, narrow: narrow, trail: trails.length > 0, passages: part.passages.length > 0 })] }));
|
|
162
|
+
}
|
|
163
|
+
function Tool({ name, label, onClick }) {
|
|
164
|
+
return (_jsx("button", { type: "button", class: "map-tool", "aria-label": label, "data-tip": label, onClick: onClick, onPointerDown: (event) => event.stopPropagation(), onPointerUp: (event) => event.stopPropagation(), children: _jsx(Icon, { name: name }) }));
|
|
165
|
+
}
|
|
166
|
+
/** The view at first: all the character knows; on a phone, the land around the party. */
|
|
167
|
+
function startView(map, lifted, size) {
|
|
168
|
+
return size.width < 600 && map.party !== undefined ? { x: map.party.x, y: map.party.y, s: clampScale(size.width / phoneSpan) } : fitView(lifted, size.width, size.height);
|
|
169
|
+
}
|
|
170
|
+
/** The view that brings a place where the card leaves room: right of it on a wide screen, in the upper part on a phone. */
|
|
171
|
+
function roomFor(spot, view, size, narrow) {
|
|
172
|
+
const freeX = narrow ? size.width / 2 : (340 + size.width - 60) / 2;
|
|
173
|
+
const freeY = narrow ? size.height * 0.2 : size.height / 2;
|
|
174
|
+
return { ...view, x: spot.x - (freeX - size.width / 2) / view.s, y: spot.y - (size.height / 2 - freeY) / view.s };
|
|
175
|
+
}
|
|
176
|
+
/** Where the map brings a name chosen: a place, the middle of a region, or the middle of a way; none for a name it does not draw. */
|
|
177
|
+
function shownPoint(map, layout, name) {
|
|
178
|
+
const points = map.roads.find((road) => road.name === name)?.points;
|
|
179
|
+
return layout.spots.find((one) => one.name === name) ?? layout.regions.find((one) => one.name === name) ?? points?.[Math.floor((points?.length ?? 0) / 2)];
|
|
180
|
+
}
|
|
181
|
+
function middleOf(points) {
|
|
182
|
+
return { x: points.reduce((sum, point) => sum + point.x, 0) / points.length, y: points.reduce((sum, point) => sum + point.y, 0) / points.length };
|
|
183
|
+
}
|
|
184
|
+
function spreadOf(points) {
|
|
185
|
+
return points.length > 1 ? Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y) : 0;
|
|
186
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
// The card of a place on the world map: its picture, what it is and where, its text as the character knows it, what it holds, its ways.
|
|
3
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
4
|
+
import { sectionAddress } from "../address.js";
|
|
5
|
+
import { pictureAddress, readView } from "../api.js";
|
|
6
|
+
import { fromLabel } from "../parts/game-words.js";
|
|
7
|
+
import { Icon } from "../parts/icons.js";
|
|
8
|
+
import { placeKindLabel } from "../parts/map-symbols.js";
|
|
9
|
+
import { plainLine } from "../parts/markdown.js";
|
|
10
|
+
import { t } from "../text.js";
|
|
11
|
+
import { lengthText, waysOf } from "./map.js";
|
|
12
|
+
/** The card of a place: its picture, what it is and where, its text as the character knows it, what it holds, its ways, the scene when the party is there. */
|
|
13
|
+
export function PlaceCard({ place, map, layout, narrow, onClose, onGo, readMore }) {
|
|
14
|
+
const [text, setText] = useState();
|
|
15
|
+
const here = place === layout.partySpot;
|
|
16
|
+
const region = layout.regions.find((one) => place.within.includes(one.name));
|
|
17
|
+
const inside = layout.inside(place.name);
|
|
18
|
+
const ways = waysOf(map, place.name);
|
|
19
|
+
const closer = useRef(null);
|
|
20
|
+
// Its text, read when the card opens: the first lines as the character knows them.
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
// Only this place's: an answer for the one opened before, which came late, is left.
|
|
23
|
+
let live = true;
|
|
24
|
+
setText(undefined);
|
|
25
|
+
readView(place.name).then((page) => live && setText(page.kind === "page" ? plainLine(page.text) : undefined), () => live && setText(undefined));
|
|
26
|
+
closer.current?.focus({ preventScroll: true });
|
|
27
|
+
return () => {
|
|
28
|
+
live = false;
|
|
29
|
+
};
|
|
30
|
+
}, [place.name]);
|
|
31
|
+
const eyebrow = [placeKindLabel(place.kind) ?? t("Place"), region?.name, here || place.from?.direction === undefined ? undefined : t("{distance} from you", { distance: fromLabel(place.from, (km) => lengthText(km, map.unit)) })].filter((part) => part !== undefined);
|
|
32
|
+
return (_jsxs("div", { class: narrow ? "place-card sheet" : "place-card", role: "dialog", "aria-labelledby": "place-card-title", onPointerDown: (event) => event.stopPropagation(), onPointerUp: (event) => event.stopPropagation(), children: [place.image !== undefined && _jsx("img", { class: "pc-image", src: pictureAddress(place.image), alt: "" }), _jsx("button", { ref: closer, type: "button", class: "pc-close icon-button", "aria-label": t("Close"), onClick: onClose, children: _jsx(Icon, { name: "close" }) }), _jsxs("div", { class: "pc-body", children: [_jsx("p", { class: "eyebrow pc-eyebrow", children: eyebrow.join(" · ") }), _jsx("h3", { id: "place-card-title", children: place.name }), here && (_jsxs("p", { class: "pc-here", children: [_jsx("span", { class: "here-dot", "aria-hidden": "true" }), t("Your party is here")] })), text !== undefined && _jsx("p", { class: "pc-text", children: text }), readMore !== undefined && _jsx("a", { class: "pc-more md-link", href: readMore, children: t("Read all you know") }), inside.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h4", { class: "eyebrow pc-sub", children: t("Inside") }), _jsx("ul", { class: "in-chips", children: inside.flatMap((child) => [
|
|
33
|
+
_jsx("li", { class: "in-chip", children: child.name }, child.name),
|
|
34
|
+
...layout.inside(child.name).map((grandchild) => (_jsxs("li", { class: "in-chip", children: [_jsx("span", { class: "in-path", children: "\u203A" }), " ", grandchild.name] }, grandchild.name))),
|
|
35
|
+
]) })] })), ways.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h4", { class: "eyebrow pc-sub", children: t("Ways") }), _jsx("ul", { class: "pc-ways", children: ways.map((way, index) => (_jsxs("li", { children: [_jsx(Icon, { name: wayIcon(way.kind) }), _jsxs("span", { children: [_jsx("b", { children: way.road }), ` ${t("to")} `, way.map === undefined || way.to === undefined ? way.to ?? t("somewhere you do not know") : (_jsx("button", { type: "button", class: "way-to-map", onClick: () => onGo(way.map, way.to), children: t("{place}, on {map}", { place: way.to, map: way.map }) })), way.km !== undefined && " · ", way.km !== undefined && _jsx("span", { class: "way-km num", children: lengthText(way.km, map.unit) })] })] }, index))) })] })), here && (_jsxs("a", { class: "pc-scene", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "scene" }), _jsx("span", { children: t("Scene") })] }))] })] }));
|
|
36
|
+
}
|
|
37
|
+
function wayIcon(kind) {
|
|
38
|
+
return kind === "river" ? "river" : kind === "path" ? "path" : "road";
|
|
39
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { fromLabel, terrainLabel } from "../parts/game-words.js";
|
|
3
|
+
import { biomeLabel, biomes, placeKindLabel } from "../parts/map-symbols.js";
|
|
4
|
+
import { t } from "../text.js";
|
|
5
|
+
import { BiomeSwatch, wayLabel } from "./key.js";
|
|
6
|
+
import { lengthText } from "./map.js";
|
|
7
|
+
/** The map's twin: every place the character knows, nearest the party first, with how far and which way; then the regions and the ways. */
|
|
8
|
+
export function PlacesList({ map, full, layout, onChoose }) {
|
|
9
|
+
const choose = (name) => {
|
|
10
|
+
onChoose(name);
|
|
11
|
+
document.querySelector(".map")?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
12
|
+
};
|
|
13
|
+
return (_jsxs("section", { class: "card map-list", "aria-labelledby": "places-title", children: [_jsxs("header", { class: "map-head", children: [_jsx("h3", { id: "places-title", children: t("Places you know") }), _jsx("span", { class: "map-sub", children: map.party === undefined ? t("on the map") : t("from your party, as the crow flies") })] }), _jsx("ol", { class: "places", children: layout.spots.map((spot) => (_jsx("li", { children: _jsxs("button", { type: "button", class: "place-row", onClick: () => choose(spot.name), children: [_jsx("span", { class: "pr-name", children: spot.name }), _jsx("span", { class: "pr-kind", children: [placeKindLabel(spot.kind) ?? t("Place"), ...(layout.inside(spot.name).length > 0 ? [t("{count} inside", { count: layout.inside(spot.name).length })] : [])].join(" · ") }), _jsx("span", { class: "pr-far num", dir: "auto", children: spot.from === undefined ? "" : fromLabel(spot.from, (km) => lengthText(km, map.unit)) })] }) }, spot.name))) }), (layout.regions.length > 0 || map.roads.length > 0) && _jsx("h4", { class: "eyebrow pc-sub", children: t("Regions and ways") }), _jsxs("ul", { class: "places", children: [layout.regions.map((region) => _jsx(RegionRow, { region: region, unit: map.unit }, region.name)), waysListed(map.roads, full.roads).map((road) => (_jsx("li", { children: _jsxs("span", { class: "place-row static", children: [_jsx("span", { class: "pr-name", children: road.name }), _jsx("span", { class: "pr-kind", children: wayLabel(road.kind) }), _jsx("span", { class: "pr-far num", children: lengthText(road.km, map.unit) })] }) }, road.name)))] })] }));
|
|
14
|
+
}
|
|
15
|
+
function RegionRow({ region, unit }) {
|
|
16
|
+
return (_jsx("li", { children: _jsxs("span", { class: "place-row static", children: [_jsx("span", { class: "pr-name", children: region.name }), _jsxs("span", { class: "pr-kind", children: [region.biome !== undefined && biomes[region.biome] !== undefined && _jsx(BiomeSwatch, { look: region.biome }), [t("Region"), biomeLabel(region.biome), region.terrain === undefined ? undefined : terrainLabel(region.terrain)].filter((part) => part !== undefined).join(" · ")] }), _jsx("span", { class: "pr-far num", dir: "auto", children: t("{length} across", { length: lengthText(region.radius * 2, unit) }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The ways of a map as its list names them: each once, with its whole length, on this map and the others it leads to, its pieces together; a portal, which
|
|
20
|
+
* has none, left out.
|
|
21
|
+
*/
|
|
22
|
+
function waysListed(roads, whole) {
|
|
23
|
+
const names = [...new Set(roads.filter((road) => road.kind !== "portal").map((road) => road.name))];
|
|
24
|
+
return names.map((name) => {
|
|
25
|
+
const pieces = whole.filter((road) => road.name === name);
|
|
26
|
+
const km = pieces.reduce((sum, road) => sum + road.points.slice(1).reduce((length, point) => length + point.km, 0), 0);
|
|
27
|
+
return { name, kind: pieces[0]?.kind ?? "other", km };
|
|
28
|
+
});
|
|
29
|
+
}
|