rpg-engine 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/dist/adventures/index.d.ts +1 -1
  2. package/dist/adventures/index.js +1 -1
  3. package/dist/adventures/source.js +13 -13
  4. package/dist/campaign/create-campaign.js +10 -1
  5. package/dist/campaign/host-files.d.ts +2 -1
  6. package/dist/campaign/host-files.js +11 -11
  7. package/dist/campaign/index.d.ts +1 -1
  8. package/dist/campaign/index.js +1 -1
  9. package/dist/campaign/settings.d.ts +55 -64
  10. package/dist/campaign/settings.js +171 -174
  11. package/dist/{cli.js → cli/cli.js} +3 -3
  12. package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
  13. package/dist/{command-line.js → cli/command-line.js} +21 -20
  14. package/dist/commands/advance.d.ts +1 -1
  15. package/dist/commands/advance.js +7 -7
  16. package/dist/commands/ask.d.ts +1 -8
  17. package/dist/commands/ask.js +16 -29
  18. package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
  19. package/dist/commands/{change.js → change/change.js} +46 -52
  20. package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
  21. package/dist/commands/{game-damage.js → change/damage.js} +3 -3
  22. package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
  23. package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
  24. package/dist/commands/config.d.ts +4 -4
  25. package/dist/commands/config.js +142 -138
  26. package/dist/commands/effect.d.ts +1 -1
  27. package/dist/commands/effect.js +11 -12
  28. package/dist/commands/find.d.ts +4 -4
  29. package/dist/commands/find.js +2 -2
  30. package/dist/commands/image.js +6 -6
  31. package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
  32. package/dist/commands/{import.js → import/import.js} +101 -101
  33. package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
  34. package/dist/commands/{game-import.js → import/run.js} +13 -12
  35. package/dist/commands/index.js +7 -7
  36. package/dist/commands/init.js +3 -3
  37. package/dist/commands/install.js +1 -1
  38. package/dist/commands/instructions.js +6 -6
  39. package/dist/commands/mode.d.ts +2 -2
  40. package/dist/commands/mode.js +8 -8
  41. package/dist/commands/mood.js +4 -4
  42. package/dist/commands/move.js +13 -20
  43. package/dist/commands/package.d.ts +2 -2
  44. package/dist/commands/package.js +138 -93
  45. package/dist/commands/rename.js +3 -3
  46. package/dist/commands/reveal.js +29 -18
  47. package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
  48. package/dist/commands/{roll.js → roll/roll.js} +69 -69
  49. package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
  50. package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
  51. package/dist/commands/rules.d.ts +2 -2
  52. package/dist/commands/rules.js +3 -3
  53. package/dist/commands/save.d.ts +1 -1
  54. package/dist/commands/save.js +18 -18
  55. package/dist/commands/scene.d.ts +4 -4
  56. package/dist/commands/scene.js +31 -28
  57. package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
  58. package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
  59. package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
  60. package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
  61. package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
  62. package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
  63. package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
  64. package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
  65. package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
  66. package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
  67. package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
  68. package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
  69. package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
  70. package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
  71. package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
  72. package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
  73. package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
  74. package/dist/commands/{game-events.js → shared/events.js} +20 -22
  75. package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
  76. package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
  77. package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
  78. package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
  79. package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
  80. package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
  81. package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
  82. package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
  83. package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
  84. package/dist/commands/{game-images.js → shared/images.js} +7 -6
  85. package/dist/commands/shared/inputs.d.ts +9 -0
  86. package/dist/commands/shared/inputs.js +12 -0
  87. package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
  88. package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
  89. package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
  90. package/dist/commands/{game-knowledge.js → shared/knowledge.js} +42 -42
  91. package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
  92. package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
  93. package/dist/commands/{game-library.js → shared/library.js} +70 -50
  94. package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
  95. package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
  96. package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
  97. package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
  98. package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
  99. package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
  100. package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
  101. package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
  102. package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
  103. package/dist/commands/{game-money.js → shared/money.js} +4 -4
  104. package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
  105. package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
  106. package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
  107. package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
  108. package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
  109. package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
  110. package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
  111. package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
  112. package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
  113. package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
  114. package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
  115. package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
  116. package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
  117. package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
  118. package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
  119. package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
  120. package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
  121. package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
  122. package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
  123. package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
  124. package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
  125. package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
  126. package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
  127. package/dist/commands/{parts.js → shared/parts.js} +4 -4
  128. package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
  129. package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
  130. package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
  131. package/dist/commands/{problems.js → shared/problems.js} +21 -22
  132. package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
  133. package/dist/commands/{progression.js → shared/progression.js} +4 -4
  134. package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
  135. package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
  136. package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
  137. package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
  138. package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
  139. package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
  140. package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
  141. package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
  142. package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +2 -2
  143. package/dist/commands/{game-rules.js → shared/rules.js} +4 -4
  144. package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
  145. package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
  146. package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
  147. package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
  148. package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
  149. package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
  150. package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
  151. package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
  152. package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
  153. package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
  154. package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
  155. package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
  156. package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
  157. package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
  158. package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
  159. package/dist/commands/{game-time.js → shared/time.js} +6 -6
  160. package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
  161. package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
  162. package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
  163. package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
  164. package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
  165. package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
  166. package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
  167. package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
  168. package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
  169. package/dist/commands/{game-world.js → shared/world.js} +72 -76
  170. package/dist/commands/show.d.ts +1 -1
  171. package/dist/commands/show.js +32 -17
  172. package/dist/commands/status.d.ts +1 -1
  173. package/dist/commands/status.js +28 -28
  174. package/dist/commands/thoughts.js +3 -3
  175. package/dist/commands/trade.js +9 -10
  176. package/dist/commands/translate.d.ts +1 -1
  177. package/dist/commands/translate.js +3 -3
  178. package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
  179. package/dist/commands/{game-open.js → travel/open.js} +4 -5
  180. package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
  181. package/dist/commands/{route.js → travel/route.js} +9 -10
  182. package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
  183. package/dist/commands/{travel.js → travel/travel.js} +19 -21
  184. package/dist/commands/validate.js +5 -5
  185. package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
  186. package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
  187. package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
  188. package/dist/commands/{game-view-map.js → view/map.js} +15 -16
  189. package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
  190. package/dist/commands/{game-view-place.js → view/place.js} +108 -108
  191. package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
  192. package/dist/commands/{view.js → view/view.js} +35 -35
  193. package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
  194. package/dist/commands/{game-view-world.js → view/world.js} +7 -7
  195. package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
  196. package/dist/commands/{game-here.js → write/here.js} +18 -12
  197. package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
  198. package/dist/commands/{write.js → write/write.js} +44 -41
  199. package/dist/confirm/confirm.d.ts +2 -0
  200. package/dist/confirm/confirm.js +15 -5
  201. package/dist/core/consents.d.ts +3 -2
  202. package/dist/core/consents.js +43 -4
  203. package/dist/core/context.d.ts +8 -6
  204. package/dist/core/context.js +4 -2
  205. package/dist/core/download.js +16 -5
  206. package/dist/core/files.d.ts +6 -1
  207. package/dist/core/files.js +47 -21
  208. package/dist/core/formula.d.ts +7 -2
  209. package/dist/core/formula.js +63 -66
  210. package/dist/core/instruction-parts.js +1 -1
  211. package/dist/core/mood.d.ts +0 -1
  212. package/dist/core/mood.js +3 -3
  213. package/dist/core/package-api.d.ts +11 -0
  214. package/dist/core/package-api.js +2 -1
  215. package/dist/core/package-declarations.d.ts +9 -9
  216. package/dist/core/package-declarations.js +3 -3
  217. package/dist/core/process-mark.d.ts +8 -0
  218. package/dist/core/process-mark.js +72 -0
  219. package/dist/core/registry.d.ts +5 -0
  220. package/dist/core/registry.js +10 -0
  221. package/dist/core/session-store.d.ts +0 -1
  222. package/dist/core/session-store.js +11 -14
  223. package/dist/core/store.d.ts +4 -0
  224. package/dist/core/store.js +29 -8
  225. package/dist/core/text.d.ts +4 -0
  226. package/dist/core/text.js +11 -2
  227. package/dist/core/yaml-file.js +2 -2
  228. package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
  229. package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
  230. package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
  231. package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
  232. package/dist/dashboard/app.js +13 -13
  233. package/dist/dashboard/asked.js +1 -1
  234. package/dist/dashboard/dice/burn.js +1 -1
  235. package/dist/dashboard/dice/stage.js +1 -1
  236. package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
  237. package/dist/dashboard/{help.js → help/help.js} +6 -6
  238. package/dist/dashboard/journal.js +1 -1
  239. package/dist/dashboard/kit.js +6 -5
  240. package/dist/dashboard/labels.js +7 -3
  241. package/dist/dashboard/markdown.js +1 -1
  242. package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
  243. package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
  244. package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
  245. package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
  246. package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
  247. package/dist/dashboard/party.js +1 -1
  248. package/dist/dashboard/person-panel.js +2 -13
  249. package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
  250. package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
  251. package/dist/dashboard/scene.js +4 -4
  252. package/dist/dashboard/settings.js +1 -1
  253. package/dist/dashboard/sheet.js +3 -3
  254. package/dist/dashboard/top.js +2 -2
  255. package/dist/dashboard/turns.js +2 -2
  256. package/dist/dashboard/widgets.js +1 -1
  257. package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
  258. package/dist/dashboard/{lore.js → world/known.js} +1 -1
  259. package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
  260. package/dist/dashboard/{world-map.js → world/map.js} +1 -1
  261. package/dist/dashboard/{world.js → world/world.js} +14 -14
  262. package/dist/dice/evaluate.js +1 -1
  263. package/dist/dice/index.d.ts +2 -2
  264. package/dist/dice/index.js +2 -2
  265. package/dist/dice/notation.d.ts +2 -0
  266. package/dist/dice/notation.js +22 -4
  267. package/dist/documents/markup.js +2 -2
  268. package/dist/documents/read.js +29 -13
  269. package/dist/effects/effect.js +2 -5
  270. package/dist/extensions/extension.js +6 -8
  271. package/dist/extensions/index.d.ts +1 -4
  272. package/dist/extensions/index.js +1 -4
  273. package/dist/extensions/words.js +2 -1
  274. package/dist/{pictures → helpers}/briefs.js +17 -14
  275. package/dist/{pictures → helpers}/claude.js +8 -18
  276. package/dist/{pictures → helpers}/codex.js +3 -15
  277. package/dist/helpers/index.d.ts +7 -0
  278. package/dist/helpers/index.js +9 -0
  279. package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
  280. package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
  281. package/dist/images/images.js +7 -5
  282. package/dist/images/index.d.ts +1 -1
  283. package/dist/images/index.js +1 -1
  284. package/dist/importer/index.d.ts +1 -1
  285. package/dist/importer/index.js +1 -1
  286. package/dist/importer/work.d.ts +0 -2
  287. package/dist/importer/work.js +9 -30
  288. package/dist/instructions/index.d.ts +2 -0
  289. package/dist/instructions/index.js +10 -0
  290. package/dist/languages/index.d.ts +1 -1
  291. package/dist/languages/index.js +1 -1
  292. package/dist/languages/language-pack.js +15 -3
  293. package/dist/library/books.js +29 -83
  294. package/dist/{extensions → packages}/engine.d.ts +1 -1
  295. package/dist/{extensions → packages}/engine.js +1 -1
  296. package/dist/packages/index.d.ts +3 -0
  297. package/dist/packages/index.js +4 -0
  298. package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
  299. package/dist/{extensions/packages.js → packages/npm.js} +74 -45
  300. package/dist/page.d.ts +9 -11
  301. package/dist/page.js +1 -2
  302. package/dist/pages/check.js +31 -40
  303. package/dist/pages/containers.js +20 -20
  304. package/dist/pages/environment.js +15 -15
  305. package/dist/pages/index.d.ts +9 -9
  306. package/dist/pages/index.js +9 -9
  307. package/dist/pages/inheritance.d.ts +2 -1
  308. package/dist/pages/inheritance.js +24 -24
  309. package/dist/pages/load.js +7 -7
  310. package/dist/pages/maps.d.ts +20 -0
  311. package/dist/pages/maps.js +51 -1
  312. package/dist/pages/markdown.d.ts +2 -0
  313. package/dist/pages/markdown.js +110 -79
  314. package/dist/pages/page-file.d.ts +2 -1
  315. package/dist/pages/page-file.js +31 -29
  316. package/dist/pages/rename-page.d.ts +4 -1
  317. package/dist/pages/rename-page.js +7 -3
  318. package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
  319. package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
  320. package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
  321. package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
  322. package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
  323. package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
  324. package/dist/pages/system-pages.js +15 -15
  325. package/dist/pages/world.js +25 -19
  326. package/dist/pages/write-page.js +35 -34
  327. package/dist/player-notes/index.d.ts +1 -1
  328. package/dist/player-notes/index.js +1 -1
  329. package/dist/rules/page-search.js +3 -4
  330. package/dist/rules/rule-book.js +1 -1
  331. package/dist/rules/search.js +21 -21
  332. package/dist/rules/shown.js +1 -3
  333. package/dist/saves/saves.d.ts +2 -2
  334. package/dist/saves/saves.js +15 -3
  335. package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
  336. package/dist/server/dashboard/files.d.ts +59 -0
  337. package/dist/server/dashboard/files.js +326 -0
  338. package/dist/server/dashboard/index.d.ts +114 -0
  339. package/dist/server/dashboard/index.js +419 -0
  340. package/dist/server/dashboard/news.d.ts +39 -0
  341. package/dist/server/dashboard/news.js +390 -0
  342. package/dist/server/dashboard/player.d.ts +48 -0
  343. package/dist/server/dashboard/player.js +242 -0
  344. package/dist/server/dashboard/ports.d.ts +10 -0
  345. package/dist/server/dashboard/ports.js +15 -0
  346. package/dist/server/dashboard/writes.d.ts +58 -0
  347. package/dist/server/dashboard/writes.js +492 -0
  348. package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
  349. package/dist/{mcp-server.js → server/mcp.js} +57 -42
  350. package/dist/systems/game-system.d.ts +5 -3
  351. package/dist/systems/game-system.js +178 -149
  352. package/dist/systems/index.d.ts +1 -1
  353. package/dist/systems/index.js +1 -1
  354. package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
  355. package/dist/{testing.js → testing/index.js} +32 -18
  356. package/dist/{system-checks.js → testing/system-checks.js} +18 -12
  357. package/dist/themes/theme.d.ts +3 -3
  358. package/dist/themes/theme.js +14 -14
  359. package/dist/time/calendar.js +5 -2
  360. package/dist/triggers/trigger.js +5 -8
  361. package/instructions/dashboard-guide.md +2 -1
  362. package/instructions/play.md +1 -1
  363. package/package.json +5 -5
  364. package/dist/commands/game-maps.d.ts +0 -20
  365. package/dist/commands/game-maps.js +0 -51
  366. package/dist/dashboard-server.d.ts +0 -47
  367. package/dist/dashboard-server.js +0 -1830
  368. package/dist/pictures/index.d.ts +0 -7
  369. package/dist/pictures/index.js +0 -9
  370. /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
  371. /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
  372. /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
  373. /package/dist/commands/{notes.js → shared/notes.js} +0 -0
  374. /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
  375. /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
  376. /package/dist/dashboard/{people.js → packages/people.js} +0 -0
  377. /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
  378. /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
  379. /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
  380. /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
  381. /package/dist/{pictures → helpers}/chosen.js +0 -0
  382. /package/dist/{pictures → helpers}/claude.d.ts +0 -0
  383. /package/dist/{pictures → helpers}/codex.d.ts +0 -0
  384. /package/dist/{pictures → helpers}/stop.d.ts +0 -0
  385. /package/dist/{pictures → helpers}/stop.js +0 -0
  386. /package/dist/{pictures → helpers}/svg.d.ts +0 -0
  387. /package/dist/{pictures → helpers}/svg.js +0 -0
  388. /package/dist/{extensions → packages}/tarball.d.ts +0 -0
  389. /package/dist/{extensions → packages}/tarball.js +0 -0
  390. /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
  391. /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
  392. /package/dist/{player-acts.js → server/player-acts.js} +0 -0
  393. /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import { requireCampaign } from "../campaign/index.js";
3
3
  import { defineCommand } from "../core/registry.js";
4
- import { stateCheckProblems } from "./game-checks.js";
5
- import { packageCodeProblems } from "./game-package-code.js";
6
- import { campaignWorld } from "./game-world.js";
7
- import { campaignProblems } from "./problems.js";
4
+ import { stateCheckProblems } from "./shared/checks.js";
5
+ import { packageCodeProblems } from "./shared/packages/code.js";
6
+ import { campaignProblems } from "./shared/problems.js";
7
+ import { campaignWorld } from "./shared/world.js";
8
8
  export const validate = defineCommand({
9
9
  name: "validate",
10
10
  description: "Check the whole campaign and say how to fix each problem. "
@@ -16,7 +16,7 @@ export const validate = defineCommand({
16
16
  async run(input, context) {
17
17
  const root = requireCampaign(context.folder);
18
18
  // And what keeps an extension's code from being used, which only loading it tells (D-441).
19
- return { problems: [...campaignProblems(root, campaignWorld(root, context), context), ...await packageCodeProblems(root, context, []), ...stateCheckProblems(root, context)] };
19
+ return { problems: [...campaignProblems(root, campaignWorld(root, context), context), ...await packageCodeProblems(root, context), ...stateCheckProblems(root, context)] };
20
20
  },
21
21
  format(result) {
22
22
  if (result.problems.length === 0) {
@@ -1,8 +1,8 @@
1
- import { type LogEntry } from "../core/log.ts";
2
- import { type World } from "../pages/index.ts";
3
- import type { GameDate } from "../time/index.ts";
4
- import type { SeenEffect } from "./game-effects.ts";
5
- import { type Knowledge } from "./game-knowledge.ts";
1
+ import { type LogEntry } from "../../core/log.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import type { GameDate } from "../../time/index.ts";
4
+ import type { SeenEffect } from "../shared/effects.ts";
5
+ import { type Knowledge } from "../shared/knowledge.ts";
6
6
  /** A quest as the journal shows it (VIEW-8). */
7
7
  export interface ShownQuest {
8
8
  name: string;
@@ -1,10 +1,10 @@
1
1
  // The player's journal (D-367, VIEW-8, VIEW-9): the quests the player character knows, as a video game's quest log, with their goals, counters, clock and
2
2
  // deadline; and the story by its scenes, as chapters, each with what the diary tells of it.
3
- import { readLog } from "../core/log.js";
4
- import { comparableText } from "../core/text.js";
5
- import { goalsIn, links, textsIn } from "../pages/index.js";
6
- import { knownSecretsApart, knownText } from "./game-knowledge.js";
7
- import { measuresText, questMeasures } from "./game-quests.js";
3
+ import { readLog } from "../../core/log.js";
4
+ import { comparableText } from "../../core/text.js";
5
+ import { goalsIn, links, textsIn } from "../../pages/index.js";
6
+ import { knownSecretsApart, knownText } from "../shared/knowledge.js";
7
+ import { measuresText, questMeasures } from "../shared/quests.js";
8
8
  // The story tells what happened at its hour; time passing is no fact of it, the hours of the facts show it.
9
9
  const storyKinds = ["counter", "moved", "learned", "effect", "effect-ended", "back", "quest"];
10
10
  const statuses = ["open", "done", "failed"];
@@ -1,6 +1,6 @@
1
- import { type Page } from "../pages/index.ts";
2
- import { type Measures } from "./game-roads.ts";
3
- import type { PlaceSight } from "./game-view-place.ts";
1
+ import { type Page } from "../../pages/index.ts";
2
+ import { type Measures } from "../shared/roads.ts";
3
+ import type { PlaceSight } from "./place.ts";
4
4
  /** A point of a map, in km east and north of its centre; with the map it is on, by the place that holds it, none for the main map (POS-8). */
5
5
  export interface MapPoint {
6
6
  x: number;
@@ -1,18 +1,17 @@
1
1
  // The world map as the player character knows it, for the dashboard (VIEW-7, D-316, D-318, D-320): the maps it knows; on each, the places it knows with their
2
2
  // kind and where they are, the regions with their biome, the roads as far as it knows their stops, the party and its trail. Never a place it does not know,
3
3
  // neither its name nor its point.
4
- import { formatLength, trueImperialUnits } from "../core/length.js";
5
- import { readLog } from "../core/log.js";
6
- import { comparableText } from "../core/text.js";
7
- import { directionName, directionTo, distanceBetween } from "../map/index.js";
8
- import { environmentAt, locate, pagesWithName, parsePageReference, readStops } from "../pages/index.js";
9
- import { shownImage } from "./game-images.js";
10
- import { moversMap, moversNamed, moversPosition, readJourney } from "./game-journey.js";
11
- import { knowsPage } from "./game-knowledge.js";
12
- import { mapKey, mapOf } from "./game-maps.js";
13
- import { placedPosition, positionOf, regionsOf } from "./game-positions.js";
14
- import { kindOf, roadsOf, travellingParty } from "./game-roads.js";
15
- import { campaignSystem } from "./game-world.js";
4
+ import { formatLength, trueImperialUnits } from "../../core/length.js";
5
+ import { readLog } from "../../core/log.js";
6
+ import { comparableText } from "../../core/text.js";
7
+ import { directionName, directionTo, distanceBetween } from "../../map/index.js";
8
+ import { environmentAt, locate, mapKey, mapOf, pagesWithName, parsePageReference, readStops } from "../../pages/index.js";
9
+ import { shownImage } from "../shared/images.js";
10
+ import { moversMap, moversNamed, moversPosition, readJourney } from "../shared/journey.js";
11
+ import { knowsPage } from "../shared/knowledge.js";
12
+ import { placedPosition, positionOf, regionsOf } from "../shared/positions.js";
13
+ import { kindOf, roadsOf, travellingParty } from "../shared/roads.js";
14
+ import { campaignSystem } from "../shared/world.js";
16
15
  // How far a road toward a stop the character does not know is drawn, at most: a beginning, never where the stop is.
17
16
  const stubMetres = 3000;
18
17
  // How many places the chat lists.
@@ -67,6 +66,10 @@ export function mapText(map) {
67
66
  ...others,
68
67
  ].filter((block) => block !== "").join("\n");
69
68
  }
69
+ /** A place's kind as the page writes it (POS-7), such as village; undefined when it has none, or an empty one (D-107). */
70
+ export function placeKind(page) {
71
+ return typeof page.fields.kind === "string" && page.fields.kind.trim() !== "" ? page.fields.kind.trim() : undefined;
72
+ }
70
73
  /** A place as the map shows it; none for one neither drawn nor held by a place that is. Its distance from the party only on the party's map. */
71
74
  function mapPlace(sight, roads, page, known, party) {
72
75
  const { world } = sight;
@@ -264,7 +267,3 @@ function fromText(from, unit) {
264
267
  function km(metres) {
265
268
  return Math.round(metres / 10) / 100;
266
269
  }
267
- /** A place's kind as the page writes it (POS-7), such as village; undefined when it has none, or an empty one (D-107). */
268
- export function placeKind(page) {
269
- return typeof page.fields.kind === "string" && page.fields.kind.trim() !== "" ? page.fields.kind.trim() : undefined;
270
- }
@@ -1,9 +1,9 @@
1
- import type { Context } from "../core/context.ts";
2
- import type { Effect, EffectEnd } from "../effects/index.ts";
3
- import { type Page, type World } from "../pages/index.ts";
4
- import type { GameSystem } from "../systems/index.ts";
5
- import { type SeenEffect } from "./game-effects.ts";
6
- import { type Knowledge } from "./game-knowledge.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import type { Effect, EffectEnd } from "../../effects/index.ts";
3
+ import { type Page, type World } from "../../pages/index.ts";
4
+ import type { GameSystem } from "../../systems/index.ts";
5
+ import { type SeenEffect } from "../shared/effects.ts";
6
+ import { type Knowledge } from "../shared/knowledge.ts";
7
7
  /** Someone at the place or in the scene as the player sees them: a name, or someone; their role and picture; for copies of a creature, how many. */
8
8
  export interface ShownPerson {
9
9
  name: string;
@@ -1,22 +1,22 @@
1
- import { formatStep } from "../core/length.js";
2
- import { files } from "../core/store.js";
3
- import { comparableText } from "../core/text.js";
4
- import { readCounter } from "../counters/index.js";
5
- import { reachable, squareName, squaresApart, withoutMapBlock } from "../grid/index.js";
6
- import { hiddenImageName } from "../images/index.js";
7
- import { environmentAt, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, placesAround } from "../pages/index.js";
8
- import { effectsOf } from "./effect-layer.js";
9
- import { conditionMark, effectParts, keptEffects, systemNamed } from "./game-effects.js";
10
- import { isTurnOf, movedThisTurn, sideOf, walkingSpeed } from "./game-grid-moves.js";
11
- import { placeGrid, placeLook, standing } from "./game-grids.js";
12
- import { imageFile, ownImage, shownImage } from "./game-images.js";
13
- import { knownSecretsApart, knownText, knowsPage } from "./game-knowledge.js";
14
- import { measuresOf } from "./game-roads.js";
15
- import { copyPage, readOpenScene } from "./game-scene.js";
16
- import { turnMarks } from "./game-turn-uses.js";
17
- import { campaignSystem } from "./game-world.js";
18
- import { pageCounters } from "./page-counters.js";
19
- import { tokenIcon } from "./sheet.js";
1
+ import { formatStep } from "../../core/length.js";
2
+ import { files } from "../../core/store.js";
3
+ import { comparableText } from "../../core/text.js";
4
+ import { readCounter } from "../../counters/index.js";
5
+ import { reachable, squareName, squaresApart, withoutMapBlock } from "../../grid/index.js";
6
+ import { hiddenImageName } from "../../images/index.js";
7
+ import { environmentAt, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, placesAround } from "../../pages/index.js";
8
+ import { effectsOf } from "../shared/effect-layer.js";
9
+ import { conditionMark, effectParts, keptEffects, systemNamed } from "../shared/effects.js";
10
+ import { isTurnOf, movedThisTurn, sideOf, walkingSpeed } from "../shared/grid-moves.js";
11
+ import { placeGrid, placeLook, standing } from "../shared/grids.js";
12
+ import { imageFile, ownImage, shownImage } from "../shared/images.js";
13
+ import { knownSecretsApart, knownText, knowsPage } from "../shared/knowledge.js";
14
+ import { pageCounters } from "../shared/page-counters.js";
15
+ import { measuresOf } from "../shared/roads.js";
16
+ import { copyPage, readOpenScene } from "../shared/scene.js";
17
+ import { tokenIcon } from "../shared/sheet.js";
18
+ import { turnMarks } from "../shared/turn-uses.js";
19
+ import { campaignSystem } from "../shared/world.js";
20
20
  /** Where the player character is, as it knows it; none when it is in no place it knows, as in the open on a journey. */
21
21
  export function shownPlace(sight) {
22
22
  const { world, knowledge } = sight;
@@ -54,6 +54,95 @@ export function shownPlace(sight) {
54
54
  ...(grid === undefined ? {} : { map: shownGrid(sight, place, grid) }),
55
55
  };
56
56
  }
57
+ /** The open scene as the player sees it; none when no scene is open, or it cannot be read. */
58
+ export function shownScene(sight) {
59
+ const { scene } = readOpenScene(sight.root);
60
+ if (scene === undefined) {
61
+ return undefined;
62
+ }
63
+ const place = knownPage(sight, scene.place);
64
+ const characters = scene.with.map((link) => {
65
+ const name = parsePageReference(link).name;
66
+ const page = knownPage(sight, link);
67
+ const hostile = hostileMark(scene, name);
68
+ const written = pagesWithName(sight.world, name)[0];
69
+ const state = written === undefined ? {} : strangerState(sight, scene, written);
70
+ const image = strangerPicture(sight, name);
71
+ return page === undefined
72
+ ? { name: seenName(scene, name), role: "other", stranger: true, ...(image === undefined ? {} : { image }), ...hostile, ...state }
73
+ : { ...person(sight, page), ...hostile, ...stateOf(sight, page) };
74
+ });
75
+ const creatures = [...new Set(Object.values(scene.copies).map((copy) => copy.creature))].map((creature) => {
76
+ const count = Object.values(scene.copies).filter((copy) => copy.creature === creature).length;
77
+ const page = knownPage(sight, creature);
78
+ // A kind the character does not know by the letter its copies have in the scene, as creature B, with more kinds (D-331).
79
+ const first = Object.keys(scene.copies).find((copy) => scene.copies[copy].creature === creature);
80
+ const name = first === undefined ? "creature" : strangerName(scene, first).replace(/\s*\d+$/, "");
81
+ // A kind is hostile when one of its copies is.
82
+ const hostile = Object.keys(scene.copies).some((copy) => scene.copies[copy].creature === creature && hostileMark(scene, copy).hostile === true) ? { hostile: true } : {};
83
+ // A kind of one copy shows its state; of more, each shows its own on the map and in Combat.
84
+ const state = count === 1 && first !== undefined ? stateOf(sight, copyPage(first, scene.copies[first])) : {};
85
+ const image = strangerPicture(sight, creature);
86
+ return page === undefined
87
+ ? { name, role: "other", stranger: true, ...(image === undefined ? {} : { image }), count, ...hostile, ...state }
88
+ : { ...person(sight, page), count, ...hostile, ...state };
89
+ });
90
+ const turnName = (name) => shownTurn(sight, scene, name);
91
+ // What who acts has used of the turn, as marks beside them, for the party alone: a foe's are the master's to tell (TRN-4, D-453).
92
+ const acting = scene.turn;
93
+ const ours = acting !== undefined && sight.party.some((page) => comparableText(page.name) === comparableText(acting));
94
+ const marks = ours ? turnMarks(campaignSystem(sight.root, sight.context), scene, acting) : [];
95
+ return {
96
+ title: scene.title,
97
+ type: scene.type,
98
+ ...(scene.opened === undefined ? {} : { since: scene.opened }),
99
+ ...(scene.now === undefined ? {} : { now: scene.now }),
100
+ ...(place === undefined ? {} : { place: place.name }),
101
+ who: [...characters, ...creatures],
102
+ ...(scene.order === undefined ? {} : { order: scene.order.map(turnName) }),
103
+ ...(scene.turn === undefined ? {} : { turn: turnName(scene.turn) }),
104
+ // The round only where the game has rounds (D-314 (3)): Ironsworn has none.
105
+ ...(scene.round === undefined || campaignSystem(sight.root, sight.context)?.roundSeconds === undefined ? {} : { round: scene.round }),
106
+ ...(marks.length === 0 ? {} : { marks }),
107
+ ...(scene.type === "combat" ? { fighters: fightersOf(sight, scene) } : {}),
108
+ };
109
+ }
110
+ /**
111
+ * Who is in the open scene, by the words the page gives them (D-416): a character by name when the character knows them, else by what it sees of them, else
112
+ * someone; a copy by its name when it knows its creature, else by what it sees of its kind and its number, else creature 1. Without the one left out, as whose view
113
+ * a character agent's is (VIEW-10).
114
+ */
115
+ export function sceneNames(sight, leftOut) {
116
+ const { scene } = readOpenScene(sight.root);
117
+ const characters = scene === undefined ? [] : scene.with.map((link) => parsePageReference(link).name).filter((name) => leftOut === undefined || pagesWithName(sight.world, name)[0] !== leftOut);
118
+ const names = scene === undefined ? [] : [...characters, ...Object.keys(scene.copies)];
119
+ return scene === undefined ? [] : names.map((name) => shownTurn(sight, scene, name));
120
+ }
121
+ /** Whether someone of the party is down (D-516): at the value of the counter the system names, as hp 0, or below it; never the dead. */
122
+ export function isDown(world, system, page) {
123
+ const down = system?.down;
124
+ const value = readCounter(pageCounters(world, page)[down?.field ?? ""])?.value;
125
+ return down !== undefined && page.fields.status !== "dead" && value !== undefined && value <= down.value;
126
+ }
127
+ /** An effect on someone of the party as the player sees it: an end at someone's turn names them as the character knows them (VIEW-4), as creature 2. */
128
+ export function seenEffect(sight, effect) {
129
+ const end = effect.end;
130
+ const system = campaignSystem(sight.root, sight.context);
131
+ if (end === undefined || !("turn" in end)) {
132
+ return effectParts(sight.world, system, effect, sight.words);
133
+ }
134
+ const scene = readOpenScene(sight.root).scene ?? { copies: {} };
135
+ return effectParts(sight.world, system, { ...effect, end: { ...end, turn: shownTurn(sight, scene, end.turn) } }, sight.words);
136
+ }
137
+ /** The picture of one the character does not know, as strangerPicture gives it, for the scene and for the rolls (D-420, D-421). */
138
+ export function strangerImage(root, context, world, name) {
139
+ // A roll keeps a renamed page by its old name, among its aliases (D-417).
140
+ const page = name === undefined ? undefined : pagesWithNameOrAlias(world, parsePageReference(name).name)[0];
141
+ const file = page === undefined || page.system !== undefined ? undefined : imageFile(root, context, ownImage(page));
142
+ // By a name of its bytes: the file's own is the page's, which the character does not know.
143
+ const hidden = file === undefined ? undefined : hiddenImageName(file);
144
+ return file === undefined || hidden === undefined ? undefined : { file: hidden, version: Math.trunc(files().modified(file) ?? 0) };
145
+ }
57
146
  /**
58
147
  * A place's map as the player sees it (GRD-6): who stands where, the party and the characters the character knows by name, the others of the open scene as
59
148
  * someone, its copies as the scene names them; a character it does not know outside the scene is not shown, as in VIEW-6.
@@ -139,70 +228,6 @@ function reachOf(sight, rules, measures, scene, self, grid) {
139
228
  const left = speed === undefined ? 0 : speed / rules.square - movedThisTurn(scene);
140
229
  return left <= 0 ? [] : reachable(grid, self.square, left + 1e-9, rules).filter((one) => one.cost > 0).map((one) => squareName(one.square));
141
230
  }
142
- /** The open scene as the player sees it; none when no scene is open, or it cannot be read. */
143
- export function shownScene(sight) {
144
- const { scene } = readOpenScene(sight.root);
145
- if (scene === undefined) {
146
- return undefined;
147
- }
148
- const place = knownPage(sight, scene.place);
149
- const characters = scene.with.map((link) => {
150
- const name = parsePageReference(link).name;
151
- const page = knownPage(sight, link);
152
- const hostile = hostileMark(scene, name);
153
- const written = pagesWithName(sight.world, name)[0];
154
- const state = written === undefined ? {} : strangerState(sight, scene, written);
155
- const image = strangerPicture(sight, name);
156
- return page === undefined
157
- ? { name: seenName(scene, name), role: "other", stranger: true, ...(image === undefined ? {} : { image }), ...hostile, ...state }
158
- : { ...person(sight, page), ...hostile, ...stateOf(sight, page) };
159
- });
160
- const creatures = [...new Set(Object.values(scene.copies).map((copy) => copy.creature))].map((creature) => {
161
- const count = Object.values(scene.copies).filter((copy) => copy.creature === creature).length;
162
- const page = knownPage(sight, creature);
163
- // A kind the character does not know by the letter its copies have in the scene, as creature B, with more kinds (D-331).
164
- const first = Object.keys(scene.copies).find((copy) => scene.copies[copy].creature === creature);
165
- const name = first === undefined ? "creature" : strangerName(scene, first).replace(/\s*\d+$/, "");
166
- // A kind is hostile when one of its copies is.
167
- const hostile = Object.keys(scene.copies).some((copy) => scene.copies[copy].creature === creature && hostileMark(scene, copy).hostile === true) ? { hostile: true } : {};
168
- // A kind of one copy shows its state; of more, each shows its own on the map and in Combat.
169
- const state = count === 1 && first !== undefined ? stateOf(sight, copyPage(first, scene.copies[first])) : {};
170
- const image = strangerPicture(sight, creature);
171
- return page === undefined
172
- ? { name, role: "other", stranger: true, ...(image === undefined ? {} : { image }), count, ...hostile, ...state }
173
- : { ...person(sight, page), count, ...hostile, ...state };
174
- });
175
- const turnName = (name) => shownTurn(sight, scene, name);
176
- // What who acts has used of the turn, as marks beside them, for the party alone: a foe's are the master's to tell (TRN-4, D-453).
177
- const acting = scene.turn;
178
- const ours = acting !== undefined && sight.party.some((page) => comparableText(page.name) === comparableText(acting));
179
- const marks = ours ? turnMarks(campaignSystem(sight.root, sight.context), scene, acting) : [];
180
- return {
181
- title: scene.title,
182
- type: scene.type,
183
- ...(scene.opened === undefined ? {} : { since: scene.opened }),
184
- ...(scene.now === undefined ? {} : { now: scene.now }),
185
- ...(place === undefined ? {} : { place: place.name }),
186
- who: [...characters, ...creatures],
187
- ...(scene.order === undefined ? {} : { order: scene.order.map(turnName) }),
188
- ...(scene.turn === undefined ? {} : { turn: turnName(scene.turn) }),
189
- // The round only where the game has rounds (D-314 (3)): Ironsworn has none.
190
- ...(scene.round === undefined || campaignSystem(sight.root, sight.context)?.roundSeconds === undefined ? {} : { round: scene.round }),
191
- ...(marks.length === 0 ? {} : { marks }),
192
- ...(scene.type === "combat" ? { fighters: fightersOf(sight, scene) } : {}),
193
- };
194
- }
195
- /**
196
- * Who is in the open scene, by the words the page gives them (D-416): a character by name when the character knows them, else by what it sees of them, else
197
- * someone; a copy by its name when it knows its creature, else by what it sees of its kind and its number, else creature 1. Without the one left out, as whose view
198
- * a character agent's is (VIEW-10).
199
- */
200
- export function sceneNames(sight, leftOut) {
201
- const { scene } = readOpenScene(sight.root);
202
- const characters = scene === undefined ? [] : scene.with.map((link) => parsePageReference(link).name).filter((name) => leftOut === undefined || pagesWithName(sight.world, name)[0] !== leftOut);
203
- const names = scene === undefined ? [] : [...characters, ...Object.keys(scene.copies)];
204
- return scene === undefined ? [] : names.map((name) => shownTurn(sight, scene, name));
205
- }
206
231
  /** Everyone in a fight, in the order of the turns when there is one, else the characters then the copies; those the view cannot name are left out. */
207
232
  function fightersOf(sight, scene) {
208
233
  const names = scene.order ?? [...scene.with.map((link) => parsePageReference(link).name), ...Object.keys(scene.copies)];
@@ -245,22 +270,6 @@ function fighterOf(sight, scene, name) {
245
270
  ...(down ? { down: true } : {}),
246
271
  };
247
272
  }
248
- /** Whether someone of the party is down (D-516): at the value of the counter the system names, as hp 0, or below it; never the dead. */
249
- export function isDown(world, system, page) {
250
- const down = system?.down;
251
- const value = readCounter(pageCounters(world, page)[down?.field ?? ""])?.value;
252
- return down !== undefined && page.fields.status !== "dead" && value !== undefined && value <= down.value;
253
- }
254
- /** An effect on someone of the party as the player sees it: an end at someone's turn names them as the character knows them (VIEW-4), as creature 2. */
255
- export function seenEffect(sight, effect) {
256
- const end = effect.end;
257
- const system = campaignSystem(sight.root, sight.context);
258
- if (end === undefined || !("turn" in end)) {
259
- return effectParts(sight.world, system, effect, sight.words);
260
- }
261
- const scene = readOpenScene(sight.root).scene ?? { copies: {} };
262
- return effectParts(sight.world, system, { ...effect, end: { ...end, turn: shownTurn(sight, scene, end.turn) } }, sight.words);
263
- }
264
273
  /**
265
274
  * The state a token shows (D-419): what is on them, whether a condition keeps them from acting, whether they are at 0 as Combat tells it, or dead; the party in
266
275
  * full, the others by what anyone sees (D-314).
@@ -353,15 +362,6 @@ function picture(sight, page) {
353
362
  function strangerPicture(sight, name) {
354
363
  return strangerImage(sight.root, sight.context, sight.world, name);
355
364
  }
356
- /** The picture of one the character does not know, as strangerPicture gives it, for the scene and for the rolls (D-420, D-421). */
357
- export function strangerImage(root, context, world, name) {
358
- // A roll keeps a renamed page by its old name, among its aliases (D-417).
359
- const page = name === undefined ? undefined : pagesWithNameOrAlias(world, parsePageReference(name).name)[0];
360
- const file = page === undefined || page.system !== undefined ? undefined : imageFile(root, context, ownImage(page));
361
- // By a name of its bytes: the file's own is the page's, which the character does not know.
362
- const hidden = file === undefined ? undefined : hiddenImageName(file);
363
- return file === undefined || hidden === undefined ? undefined : { file: hidden, version: Math.trunc(files().modified(file) ?? 0) };
364
- }
365
365
  /** The page the character knows by a link or a name, of the campaign or of the system. */
366
366
  function knownPage(sight, name) {
367
367
  if (name === undefined) {
@@ -1,19 +1,19 @@
1
1
  import { z } from "zod";
2
- import type { Mood } from "../core/mood.ts";
3
- import { type CoinSide, type NotationPart, type ThrownDie } from "../dice/index.ts";
4
- import type { ActVerb, SheetVerb, SystemWords } from "../systems/index.ts";
5
- import { type CalendarDay } from "../time/index.ts";
6
- import { type PlayerSetting } from "./config.ts";
7
- import { type SeenEffect } from "./game-effects.ts";
8
- import { type Mode } from "./game-mode.ts";
9
- import { type MoodMoment } from "./game-moods.ts";
10
- import { type ResetPoint, type SaveMode } from "./game-saves.ts";
11
- import { type ShownChapter, type ShownQuest, type ShownThought } from "./game-view-journal.ts";
12
- import { type ShownMap } from "./game-view-map.ts";
13
- import { type ShownPlace, type ShownScene } from "./game-view-place.ts";
14
- import { type KnownEntry, type ShownCalendar, type ShownDocument } from "./game-view-world.ts";
15
- import { type ShownImport } from "./import.ts";
16
- import { type SheetGroupData, type SheetValue } from "./sheet.ts";
2
+ import type { Mood } from "../../core/mood.ts";
3
+ import { type CoinSide, type NotationPart, type ThrownDie } from "../../dice/index.ts";
4
+ import type { ActVerb, SheetVerb, SystemWords } from "../../systems/index.ts";
5
+ import { type CalendarDay } from "../../time/index.ts";
6
+ import { type PlayerSetting } from "../config.ts";
7
+ import { type ShownImport } from "../import/import.ts";
8
+ import { type SeenEffect } from "../shared/effects.ts";
9
+ import { type Mode } from "../shared/mode.ts";
10
+ import { type MoodMoment } from "../shared/moods.ts";
11
+ import { type ResetPoint, type SaveMode } from "../shared/saves.ts";
12
+ import { type SheetGroupData, type SheetValue } from "../shared/sheet.ts";
13
+ import { type ShownChapter, type ShownQuest, type ShownThought } from "./journal.ts";
14
+ import { type ShownMap } from "./map.ts";
15
+ import { type ShownPlace, type ShownScene } from "./place.ts";
16
+ import { type KnownEntry, type ShownCalendar, type ShownDocument } from "./world.ts";
17
17
  /** A roll the player may see (D-279): theirs, or one the master showed; never a hidden one. */
18
18
  export interface ShownRoll {
19
19
  id: string;
@@ -221,7 +221,7 @@ export type ViewResult = {
221
221
  kind: "unknown";
222
222
  text: string;
223
223
  };
224
- export declare const view: import("../core/registry.ts").Command<z.ZodObject<{
224
+ export declare const view: import("../../core/registry.ts").Command<z.ZodObject<{
225
225
  page: z.ZodOptional<z.ZodString>;
226
226
  diary: z.ZodOptional<z.ZodString>;
227
227
  rolls: z.ZodOptional<z.ZodString>;
@@ -1,40 +1,40 @@
1
1
  import { basename } from "node:path";
2
2
  import { z } from "zod";
3
- import { readSettings, requireCampaign } from "../campaign/index.js";
4
- import { lengthsInUnits } from "../core/length.js";
5
- import { readLog } from "../core/log.js";
6
- import { defineCommand } from "../core/registry.js";
7
- import { comparableText, firstSentence, withArticle } from "../core/text.js";
8
- import { coinSides, notationParts } from "../dice/index.js";
9
- import { readEffect } from "../effects/index.js";
10
- import { readAmount } from "../money/index.js";
11
- import { declaredKind, entryPage, isPartyMember, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, playerCharacters, secretNames, systemPageNamed, textsIn } from "../pages/index.js";
12
- import { formatGameDate } from "../time/index.js";
13
- import { setupQuestions, shownPlayerSettings } from "./config.js";
14
- import { effectiveFields, effectsOf } from "./effect-layer.js";
15
- import { effectShown } from "./game-effects.js";
16
- import { shownImage } from "./game-images.js";
17
- import { readJourney } from "./game-journey.js";
18
- import { discoveredSecrets, knowledgeOf, knownIntroduction, knownPart, knownSecretsApart, knownText, knowsPage, pageKnownBy, playerKnowledge, playerStory, scenesLivedBy, secretKnownBy } from "./game-knowledge.js";
19
- import { blockingMode, campaignMode, modes } from "./game-mode.js";
20
- import { campaignCoins } from "./game-money.js";
21
- import { lastMoment, livingMood, masterMood } from "./game-moods.js";
22
- import { measuresOf } from "./game-roads.js";
23
- import { campaignSaves, loadRefusal, loadRule, mayGoBack, resetPoints, resetSave, saveMode, savesWhy, wentBackTo } from "./game-saves.js";
24
- import { readOpenScene } from "./game-scene.js";
25
- import { thoughtsIn, thoughtsRule, thoughtsShown } from "./game-thoughts.js";
26
- import { calendarDayOf, readPresent } from "./game-time.js";
27
- import { fuelLeft } from "./game-upkeep.js";
28
- import { questText, shownJournal } from "./game-view-journal.js";
29
- import { mapText, shownMap } from "./game-view-map.js";
30
- import { isDown, sceneNames, seenEffect, shownPlace, shownScene, strangerImage } from "./game-view-place.js";
31
- import { knownDocuments, knownEntries, knownEntryText, shownCalendar } from "./game-view-world.js";
32
- import { campaignSystem, campaignWorld, systemWordsOf } from "./game-world.js";
33
- import { importShown } from "./import.js";
34
- import { countersText, lineCounters, lineExperience } from "./page-counters.js";
35
- import { campaignProblems } from "./problems.js";
36
- import { counterOf, experienceNeed, experienceProgress, sheetData, sheetGroup, sheetHeadline, sheetText, statBlock, tokenIcon } from "./sheet.js";
37
- import { hasSheet } from "./worked-out.js";
3
+ import { readSettings, requireCampaign } from "../../campaign/index.js";
4
+ import { lengthsInUnits } from "../../core/length.js";
5
+ import { readLog } from "../../core/log.js";
6
+ import { defineCommand } from "../../core/registry.js";
7
+ import { comparableText, firstSentence, withArticle } from "../../core/text.js";
8
+ import { coinSides, notationParts } from "../../dice/index.js";
9
+ import { readEffect } from "../../effects/index.js";
10
+ import { readAmount } from "../../money/index.js";
11
+ import { declaredKind, entryPage, isPartyMember, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, playerCharacters, secretNames, systemPageNamed, textsIn, } from "../../pages/index.js";
12
+ import { formatGameDate } from "../../time/index.js";
13
+ import { setupQuestions, shownPlayerSettings } from "../config.js";
14
+ import { importShown } from "../import/import.js";
15
+ import { effectiveFields, effectsOf } from "../shared/effect-layer.js";
16
+ import { effectShown } from "../shared/effects.js";
17
+ import { shownImage } from "../shared/images.js";
18
+ import { readJourney } from "../shared/journey.js";
19
+ import { discoveredSecrets, knowledgeOf, knownIntroduction, knownPart, knownSecretsApart, knownText, knowsPage, pageKnownBy, playerKnowledge, playerStory, scenesLivedBy, secretKnownBy } from "../shared/knowledge.js";
20
+ import { blockingMode, campaignMode, modes } from "../shared/mode.js";
21
+ import { campaignCoins } from "../shared/money.js";
22
+ import { lastMoment, livingMood, masterMood } from "../shared/moods.js";
23
+ import { countersText, lineCounters, lineExperience } from "../shared/page-counters.js";
24
+ import { campaignProblems } from "../shared/problems.js";
25
+ import { measuresOf } from "../shared/roads.js";
26
+ import { campaignSaves, loadRefusal, loadRule, mayGoBack, resetPoints, resetSave, saveMode, savesWhy, wentBackTo } from "../shared/saves.js";
27
+ import { readOpenScene } from "../shared/scene.js";
28
+ import { counterOf, experienceNeed, experienceProgress, sheetData, sheetGroup, sheetHeadline, sheetText, statBlock, tokenIcon } from "../shared/sheet.js";
29
+ import { thoughtsIn, thoughtsRule, thoughtsShown } from "../shared/thoughts.js";
30
+ import { calendarDayOf, readPresent } from "../shared/time.js";
31
+ import { fuelLeft } from "../shared/upkeep.js";
32
+ import { hasSheet } from "../shared/worked-out.js";
33
+ import { campaignSystem, campaignWorld, systemWordsOf } from "../shared/world.js";
34
+ import { questText, shownJournal } from "./journal.js";
35
+ import { mapText, shownMap } from "./map.js";
36
+ import { isDown, sceneNames, seenEffect, shownPlace, shownScene, strangerImage } from "./place.js";
37
+ import { knownDocuments, knownEntries, knownEntryText, shownCalendar } from "./world.js";
38
38
  // How many lines of the diary the view gives when no number is asked.
39
39
  const diaryLines = 10;
40
40
  // How a player character is played while their player is away (D-480 (4)).
@@ -1,7 +1,7 @@
1
- import type { Context } from "../core/context.ts";
2
- import { type World } from "../pages/index.ts";
3
- import { type CalendarMonth } from "../time/index.ts";
4
- import { type Knowledge } from "./game-knowledge.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import { type CalendarMonth } from "../../time/index.ts";
4
+ import { type Knowledge } from "../shared/knowledge.ts";
5
5
  /** A page the player character knows, as the World section lists it (VIEW-11): its name and type, a place's kind and the places that hold it, the opening of its text. */
6
6
  export interface KnownEntry {
7
7
  name: string;
@@ -1,10 +1,10 @@
1
- import { firstSentence } from "../core/text.js";
2
- import { isPartyMember, isPlayerCharacter, locate, withoutFencedBlocks } from "../pages/index.js";
3
- import { formatGameDate, readGameDate } from "../time/index.js";
4
- import { shownImage } from "./game-images.js";
5
- import { knownIntroduction, knownText, knowsPage, pageKnownBy, writesKnownText } from "./game-knowledge.js";
6
- import { calendarDayOf, campaignCalendar, readPresent } from "./game-time.js";
7
- import { placeKind } from "./game-view-map.js";
1
+ import { firstSentence } from "../../core/text.js";
2
+ import { isPartyMember, isPlayerCharacter, locate, withoutFencedBlocks } from "../../pages/index.js";
3
+ import { formatGameDate, readGameDate } from "../../time/index.js";
4
+ import { shownImage } from "../shared/images.js";
5
+ import { knownIntroduction, knownText, knowsPage, pageKnownBy, writesKnownText } from "../shared/knowledge.js";
6
+ import { calendarDayOf, campaignCalendar, readPresent } from "../shared/time.js";
7
+ import { placeKind } from "./map.js";
8
8
  /**
9
9
  * The pages the character knows, out of itself, its quests, which the journal has, its documents, which have their own list, and the game system's (VIEW-11);
10
10
  * an item only when its own text tells something.
@@ -1,11 +1,13 @@
1
- import type { Context } from "../core/context.ts";
2
- import { type FieldChange, type Page, type Position, type World } from "../pages/index.ts";
3
- import { type Journey, type OnRoad } from "./game-journey.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type FieldChange, type Page, type Position, type World } from "../../pages/index.ts";
3
+ import { type Journey, type OnRoad } from "../shared/journey.ts";
4
4
  /** Where a place written `here` goes (TRV-14): on a road at the point its journey stopped, or at a point in the open; with the journey and who travels. */
5
5
  export interface Here {
6
6
  journey: Journey;
7
7
  movers: Page[];
8
8
  on?: OnRoad;
9
+ /** On a road, its stops with the new place between the two of the stretch, worked out before anything is written. */
10
+ stops?: string[];
9
11
  at?: Position;
10
12
  }
11
13
  /** What a position written for a place does besides (POS-2): the place that becomes the map's centre, and what write says. */