rpg-engine 0.7.0 → 0.9.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 (397) 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 +17 -9
  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} +56 -44
  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} +13 -5
  143. package/dist/commands/shared/rules.js +66 -0
  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 +4 -1
  171. package/dist/commands/show.js +36 -18
  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} +41 -36
  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 +8 -1
  207. package/dist/core/files.js +53 -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/game-words.js +4 -4
  237. package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
  238. package/dist/dashboard/{help.js → help/help.js} +6 -6
  239. package/dist/dashboard/journal.js +1 -1
  240. package/dist/dashboard/kit.js +6 -5
  241. package/dist/dashboard/labels.js +7 -3
  242. package/dist/dashboard/markdown.js +1 -1
  243. package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
  244. package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
  245. package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
  246. package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
  247. package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
  248. package/dist/dashboard/party.js +1 -1
  249. package/dist/dashboard/person-panel.js +2 -13
  250. package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
  251. package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
  252. package/dist/dashboard/scene.js +4 -4
  253. package/dist/dashboard/settings.js +1 -1
  254. package/dist/dashboard/sheet.js +4 -4
  255. package/dist/dashboard/text.js +6 -0
  256. package/dist/dashboard/top.js +2 -2
  257. package/dist/dashboard/turns.js +2 -2
  258. package/dist/dashboard/widgets.js +1 -1
  259. package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
  260. package/dist/dashboard/{lore.js → world/known.js} +1 -1
  261. package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
  262. package/dist/dashboard/{world-map.js → world/map.js} +1 -1
  263. package/dist/dashboard/{world.js → world/world.js} +14 -14
  264. package/dist/dice/evaluate.js +1 -1
  265. package/dist/dice/index.d.ts +2 -2
  266. package/dist/dice/index.js +2 -2
  267. package/dist/dice/notation.d.ts +2 -0
  268. package/dist/dice/notation.js +22 -4
  269. package/dist/documents/markup.js +2 -2
  270. package/dist/documents/read.js +29 -13
  271. package/dist/effects/effect.js +2 -5
  272. package/dist/extensions/extension.js +6 -8
  273. package/dist/extensions/index.d.ts +1 -4
  274. package/dist/extensions/index.js +1 -4
  275. package/dist/extensions/words.js +2 -1
  276. package/dist/{pictures → helpers}/briefs.js +17 -14
  277. package/dist/{pictures → helpers}/claude.js +8 -18
  278. package/dist/{pictures → helpers}/codex.js +3 -15
  279. package/dist/helpers/index.d.ts +7 -0
  280. package/dist/helpers/index.js +9 -0
  281. package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
  282. package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
  283. package/dist/images/images.js +7 -5
  284. package/dist/images/index.d.ts +1 -1
  285. package/dist/images/index.js +1 -1
  286. package/dist/importer/index.d.ts +1 -1
  287. package/dist/importer/index.js +1 -1
  288. package/dist/importer/work.d.ts +0 -2
  289. package/dist/importer/work.js +9 -30
  290. package/dist/instructions/index.d.ts +2 -0
  291. package/dist/instructions/index.js +10 -0
  292. package/dist/languages/index.d.ts +1 -1
  293. package/dist/languages/index.js +1 -1
  294. package/dist/languages/language-pack.js +15 -3
  295. package/dist/library/books.js +29 -83
  296. package/dist/{extensions → packages}/engine.d.ts +1 -1
  297. package/dist/{extensions → packages}/engine.js +1 -1
  298. package/dist/packages/index.d.ts +3 -0
  299. package/dist/packages/index.js +4 -0
  300. package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
  301. package/dist/{extensions/packages.js → packages/npm.js} +74 -45
  302. package/dist/page.d.ts +9 -11
  303. package/dist/page.js +1 -2
  304. package/dist/pages/check.js +31 -40
  305. package/dist/pages/containers.js +20 -20
  306. package/dist/pages/environment.js +15 -15
  307. package/dist/pages/index.d.ts +9 -9
  308. package/dist/pages/index.js +9 -9
  309. package/dist/pages/inheritance.d.ts +2 -1
  310. package/dist/pages/inheritance.js +24 -24
  311. package/dist/pages/load.js +7 -7
  312. package/dist/pages/maps.d.ts +20 -0
  313. package/dist/pages/maps.js +51 -1
  314. package/dist/pages/markdown.d.ts +2 -0
  315. package/dist/pages/markdown.js +110 -79
  316. package/dist/pages/page-file.d.ts +2 -1
  317. package/dist/pages/page-file.js +31 -29
  318. package/dist/pages/rename-page.d.ts +4 -1
  319. package/dist/pages/rename-page.js +7 -3
  320. package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
  321. package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
  322. package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
  323. package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
  324. package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
  325. package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
  326. package/dist/pages/system-pages.js +15 -15
  327. package/dist/pages/world.d.ts +4 -0
  328. package/dist/pages/world.js +52 -20
  329. package/dist/pages/write-page.js +35 -34
  330. package/dist/player-notes/index.d.ts +1 -1
  331. package/dist/player-notes/index.js +1 -1
  332. package/dist/rules/page-search.js +3 -4
  333. package/dist/rules/rule-book.js +1 -1
  334. package/dist/rules/search.js +21 -21
  335. package/dist/rules/shown.js +1 -3
  336. package/dist/saves/saves.d.ts +2 -2
  337. package/dist/saves/saves.js +15 -3
  338. package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
  339. package/dist/server/dashboard/files.d.ts +59 -0
  340. package/dist/server/dashboard/files.js +326 -0
  341. package/dist/server/dashboard/index.d.ts +114 -0
  342. package/dist/server/dashboard/index.js +419 -0
  343. package/dist/server/dashboard/news.d.ts +39 -0
  344. package/dist/server/dashboard/news.js +390 -0
  345. package/dist/server/dashboard/player.d.ts +48 -0
  346. package/dist/server/dashboard/player.js +242 -0
  347. package/dist/server/dashboard/ports.d.ts +10 -0
  348. package/dist/server/dashboard/ports.js +15 -0
  349. package/dist/server/dashboard/writes.d.ts +58 -0
  350. package/dist/server/dashboard/writes.js +492 -0
  351. package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
  352. package/dist/{mcp-server.js → server/mcp.js} +57 -42
  353. package/dist/systems/game-system.d.ts +5 -3
  354. package/dist/systems/game-system.js +178 -149
  355. package/dist/systems/index.d.ts +1 -1
  356. package/dist/systems/index.js +1 -1
  357. package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
  358. package/dist/{testing.js → testing/index.js} +32 -18
  359. package/dist/{system-checks.js → testing/system-checks.js} +18 -12
  360. package/dist/themes/theme.d.ts +3 -3
  361. package/dist/themes/theme.js +14 -14
  362. package/dist/time/calendar.js +5 -2
  363. package/dist/triggers/trigger.js +5 -8
  364. package/instructions/dashboard-guide.md +2 -1
  365. package/instructions/play.md +1 -1
  366. package/package.json +5 -5
  367. package/dist/commands/game-maps.d.ts +0 -20
  368. package/dist/commands/game-maps.js +0 -51
  369. package/dist/commands/game-rules.js +0 -36
  370. package/dist/dashboard-server.d.ts +0 -47
  371. package/dist/dashboard-server.js +0 -1830
  372. package/dist/pictures/index.d.ts +0 -7
  373. package/dist/pictures/index.js +0 -9
  374. /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
  375. /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
  376. /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
  377. /package/dist/commands/{notes.js → shared/notes.js} +0 -0
  378. /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
  379. /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
  380. /package/dist/dashboard/{people.js → packages/people.js} +0 -0
  381. /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
  382. /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
  383. /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
  384. /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
  385. /package/dist/{pictures → helpers}/chosen.js +0 -0
  386. /package/dist/{pictures → helpers}/claude.d.ts +0 -0
  387. /package/dist/{pictures → helpers}/codex.d.ts +0 -0
  388. /package/dist/{pictures → helpers}/stop.d.ts +0 -0
  389. /package/dist/{pictures → helpers}/stop.js +0 -0
  390. /package/dist/{pictures → helpers}/svg.d.ts +0 -0
  391. /package/dist/{pictures → helpers}/svg.js +0 -0
  392. /package/dist/{extensions → packages}/tarball.d.ts +0 -0
  393. /package/dist/{extensions → packages}/tarball.js +0 -0
  394. /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
  395. /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
  396. /package/dist/{player-acts.js → server/player-acts.js} +0 -0
  397. /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { comparableText } from "../core/text.js";
2
- import { DiceError, readRandomTable, rollOnTable } from "../dice/index.js";
3
- import { baseChain, findPage, firstTable, pageNamed, parsePageReference, readSection, secretNames, sectionTitles } from "../pages/index.js";
4
- import { campaignWorld, missingSystemHint } from "./game-world.js";
1
+ import { comparableText } from "../../core/text.js";
2
+ import { DiceError, readRandomTable, rollOnTable } from "../../dice/index.js";
3
+ import { baseChain, findPage, firstTable, pageNamed, parsePageReference, readSection, secretNames, sectionTitles } from "../../pages/index.js";
4
+ import { campaignWorld, missingSystemHint } from "../shared/world.js";
5
5
  /** A roll on the table of a page's section, given as Page#Section; refused, saying what to fix, before anything is rolled. */
6
6
  export function rollPageTable(root, context, reference, source) {
7
7
  const { name, section } = parsePageReference(reference);
@@ -22,7 +22,7 @@ export declare const rules: import("../core/registry.ts").Command<z.ZodObject<{
22
22
  house: undefined;
23
23
  found: undefined;
24
24
  precedents: string[];
25
- library: import("./game-library.ts").LibraryAnswer | undefined;
25
+ library: import("./shared/library.ts").LibraryAnswer | undefined;
26
26
  text: string;
27
27
  system: string | undefined;
28
28
  missingSystem: string | undefined;
@@ -39,7 +39,7 @@ export declare const rules: import("../core/registry.ts").Command<z.ZodObject<{
39
39
  system?: string;
40
40
  } | undefined;
41
41
  pageSections: PageSection[];
42
- library: import("./game-library.ts").LibraryAnswer | undefined;
42
+ library: import("./shared/library.ts").LibraryAnswer | undefined;
43
43
  systemNames: string[];
44
44
  text: string;
45
45
  system: string | undefined;
@@ -6,9 +6,9 @@ import { comparableText } from "../core/text.js";
6
6
  import { findPage, pageFileNamed, pageNamed as pageWithName, sectionTitles } from "../pages/index.js";
7
7
  import { bookTitles, findRules, hasAllWords, readRuleBook, shownRules } from "../rules/index.js";
8
8
  import { systemContentFolders } from "../systems/index.js";
9
- import { libraryAnswer, libraryLines, systemWordsNamed } from "./game-library.js";
10
- import { disagreementAdvice, houseRules, precedentRule, systemRuleBook } from "./game-rules.js";
11
- import { campaignSystem, campaignWorld, foreignLanguage } from "./game-world.js";
9
+ import { libraryAnswer, libraryLines, systemWordsNamed } from "./shared/library.js";
10
+ import { disagreementAdvice, hasTranslatedRules, houseRules, precedentRule, systemRuleBook } from "./shared/rules.js";
11
+ import { campaignSystem, campaignSystemWords, campaignWorld, foreignLanguage } from "./shared/world.js";
12
12
  // About how many words an answer shows: a section of the system has about 80 words in the middle (D-178).
13
13
  const answerWords = 800;
14
14
  // What the rules add when the text is the name of a page, which holds the answer: a spell, an item (D-195).
@@ -34,13 +34,16 @@ export const rules = defineCommand({
34
34
  // Read one by one, as the system is (SYS-1): a mistake elsewhere in campaign.yaml does not stop the rules.
35
35
  const precedents = readListSetting(root, "precedents");
36
36
  const house = readRuleBook(join(root, houseRulesFolderName), houseRules);
37
- const book = system === undefined ? [] : systemRuleBook(system);
37
+ const campaignLanguage = readTextSetting(root, "language");
38
+ // In the campaign's language where the system has its rules in it (D-542).
39
+ const translated = system !== undefined && hasTranslatedRules(system, campaignLanguage);
40
+ const book = system === undefined ? [] : systemRuleBook(system, campaignLanguage);
38
41
  const text = input.text?.trim() ?? "";
39
42
  const common = {
40
43
  text,
41
44
  system: system?.name,
42
45
  missingSystem: named !== undefined && system === undefined ? named : undefined,
43
- language: system === undefined ? undefined : foreignLanguage(system.language, readTextSetting(root, "language")),
46
+ language: system === undefined || translated ? undefined : foreignLanguage(system.language, campaignLanguage),
44
47
  houseRules: bookTitles(house),
45
48
  chapters: chaptersOf(book),
46
49
  };
@@ -53,16 +56,16 @@ export const rules = defineCommand({
53
56
  // Or the sections of pages it names, as a class's features: Cleric › Domain Spells, or Domain Spells alone (RUL-6).
54
57
  const pageSections = page === undefined ? sectionsNamed(root, context, text) : [];
55
58
  const budget = page === undefined && pageSections.length === 0 ? answerWords : answerWordsBesidePage;
56
- // Searched in the campaign's language, the system is searched by its own names too, as its words in that language give them (RUL-8): afferrato, Grappled.
57
- const campaignLanguage = readTextSetting(root, "language");
58
- const ownNames = system === undefined || campaignLanguage === undefined || /[›>/]/.test(text) ? [] : systemWordsNamed(system, campaignLanguage, text, true).filter((one) => !hasAllWords(text, one.named));
59
+ // Searched in the campaign's language, the system is searched by its own names too, as its words in that language give them (RUL-8): afferrato, Grappled;
60
+ // its rules in that language, by the campaign's words for the system's: grappled, Afferrato (D-542).
61
+ const ownNames = system === undefined || campaignLanguage === undefined || /[›>/]/.test(text) ? [] : systemWordsNamed(system, campaignLanguage, text, !translated).filter((one) => !hasAllWords(text, one.named));
59
62
  const systemNames = ownNames.map((one) => one.named);
60
63
  // A name answers for the system only when its words are the whole search: tiro per colpire is no question about Archery, Tiro.
61
64
  const answering = ownNames.filter((one) => one.whole).map((one) => one.named);
62
65
  const found = findRules([...house, ...book], [text, ...systemNames].join(" "));
63
66
  const houseAnswer = answerOf(found.filter((finding) => finding.section.source === houseRules), budget);
64
67
  const systemAnswer = answerOf(found.filter((finding) => finding.section.source !== houseRules), budget - houseAnswer.used);
65
- const shownTitles = [...houseAnswer.shown, ...systemAnswer.shown].map((shown) => shown.path.at(-1) ?? "");
68
+ const shownTitles = withEnglishTitles([...houseAnswer.shown, ...systemAnswer.shown].map((shown) => shown.path.at(-1) ?? ""), translated ? campaignSystemWords(root, context) : undefined);
66
69
  // Then the player's books, fewer of them when the rules have answered: a section shown holds every word searched, or a name the system gave them (LIB-6, LIB-7).
67
70
  const answered = [...houseAnswer.shown, ...systemAnswer.shown].some((shown) => [text, ...answering].some((searched) => hasAllWords(`${shown.path.join(" ")} ${shown.text}`, searched)));
68
71
  const library = libraryAnswer(root, context, system, text, answered);
@@ -110,6 +113,11 @@ function isAboutAny(precedent, text, titles) {
110
113
  const rule = precedentRule(precedent);
111
114
  return rule !== undefined && (hasAllWords(text, rule) || titles.some((title) => comparableText(rule) === comparableText(title)));
112
115
  }
116
+ /** The titles of the sections shown with the system's names of those in the campaign's language, so that "Poisoned: …" goes with Avvelenato too (D-542). */
117
+ function withEnglishTitles(titles, words) {
118
+ const english = Object.entries(words ?? {}).filter(([, own]) => titles.some((title) => comparableText(title) === comparableText(own))).map(([name]) => name);
119
+ return [...titles, ...english];
120
+ }
113
121
  /**
114
122
  * The page of the campaign, or else of the game system, whose name or alias is the text: it holds rules too, such as a spell or how long a potion takes to drink.
115
123
  */
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { Save } from "../saves/index.ts";
3
- import { type ResetPoint, type SaveMode } from "./game-saves.ts";
3
+ import { type ResetPoint, type SaveMode } from "./shared/saves.ts";
4
4
  /** What save did: the list, a save made, or the game gone back to a save or to its start. */
5
5
  export type SaveResult = {
6
6
  action: "list";
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { requireCampaign } from "../campaign/index.js";
3
3
  import { defineCommand } from "../core/registry.js";
4
- import { campaignSaves, interruptedLoad, loadRefusal, loadRule, loadSave, makeSave, mayGoBack, newChatBegun, newChatText, resetPoints, resetSave, saveMode, savesWhy, saveText, wentBackTo, } from "./game-saves.js";
5
- import { campaignWorld } from "./game-world.js";
4
+ import { campaignSaves, interruptedLoad, loadRefusal, loadRule, loadSave, makeSave, mayGoBack, newChatBegun, newChatText, resetPoints, resetSave, saveMode, savesWhy, saveText, wentBackTo, } from "./shared/saves.js";
5
+ import { campaignWorld } from "./shared/world.js";
6
6
  const actions = ["list", "make", "load", "reset", "new chat"];
7
7
  export const save = defineCommand({
8
8
  name: "save",
@@ -91,6 +91,22 @@ export const save = defineCommand({
91
91
  return `${listed}\n${loadRule(result.mode)}`;
92
92
  },
93
93
  });
94
+ /** What the master hears of what the player did with the saves on the dashboard, at the head of their next call (D-359). */
95
+ export function playerSaveNews(result) {
96
+ switch (result.action) {
97
+ case "make":
98
+ return `The player saved on the dashboard: ${saveText(result.save)}.`;
99
+ case "load":
100
+ return `The player went back on the dashboard to save ${saveText(result.save)}: the campaign's files are as they were then, and what happened since is gone from the game, `
101
+ + `the later saves too. ${newChatText}`;
102
+ case "reset":
103
+ return `The player started the campaign over on the dashboard. ${resetText(result.to, result.save)}, what happened since gone from the game, every later save too. ${newChatText}`;
104
+ case "new chat":
105
+ return `The player opened a new chat after going back to save ${result.save}, and confirmed it on the dashboard: the game goes on in it, from that save.`;
106
+ default:
107
+ return "";
108
+ }
109
+ }
94
110
  /** The save asked for, by its number or last. */
95
111
  function chosenSave(saves, asked) {
96
112
  if (saves.length === 0) {
@@ -117,22 +133,6 @@ function checkParameters(input) {
117
133
  throw new Error(`save ${input.action} does not take to: only reset does.`);
118
134
  }
119
135
  }
120
- /** What the master hears of what the player did with the saves on the dashboard, at the head of their next call (D-359). */
121
- export function playerSaveNews(result) {
122
- switch (result.action) {
123
- case "make":
124
- return `The player saved on the dashboard: ${saveText(result.save)}.`;
125
- case "load":
126
- return `The player went back on the dashboard to save ${saveText(result.save)}: the campaign's files are as they were then, and what happened since is gone from the game, `
127
- + `the later saves too. ${newChatText}`;
128
- case "reset":
129
- return `The player started the campaign over on the dashboard. ${resetText(result.to, result.save)}, what happened since gone from the game, every later save too. ${newChatText}`;
130
- case "new chat":
131
- return `The player opened a new chat after going back to save ${result.save}, and confirmed it on the dashboard: the game goes on in it, from that save.`;
132
- default:
133
- return "";
134
- }
135
- }
136
136
  /** "Back to the start, 1 - start: the campaign starts over from there with the same character": where a reset went. */
137
137
  function resetText(to, save) {
138
138
  return to === "start"
@@ -31,18 +31,18 @@ export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
31
31
  open: "open";
32
32
  hostile: "hostile";
33
33
  add: "add";
34
- close: "close";
34
+ now: "now";
35
35
  order: "order";
36
36
  use: "use";
37
- now: "now";
37
+ close: "close";
38
38
  leave: "leave";
39
39
  calm: "calm";
40
40
  }>;
41
41
  title: z.ZodOptional<z.ZodString>;
42
42
  type: z.ZodOptional<z.ZodEnum<{
43
- travel: "travel";
44
- rest: "rest";
45
43
  other: "other";
44
+ rest: "rest";
45
+ travel: "travel";
46
46
  combat: "combat";
47
47
  social: "social";
48
48
  exploration: "exploration";
@@ -5,31 +5,32 @@ import { appendLogEntry } from "../core/log.js";
5
5
  import { defineCommand } from "../core/registry.js";
6
6
  import { comparableText, sameName, valueNamed, withArticle } from "../core/text.js";
7
7
  import { readCounter } from "../counters/index.js";
8
- import { findPage, isEmptyField, isInParty, isPartyMember, isPlayerCharacter, linkListItems, linksIn, locate, pageNamed, pagesWithName, pageWithPath, parsePageReference, playerCharacters, writePage, } from "../pages/index.js";
8
+ import { concernsPlayer, findPage, isEmptyField, isInParty, isPartyMember, isPlayerCharacter, linkListItems, linksIn, locate, pageNamed, pagesWithName, pageWithPath, parsePageReference, playerCharacters, writePage, } from "../pages/index.js";
9
9
  import { copyNames, nextTurn, sceneTypes } from "../scene/index.js";
10
10
  import { formatGameDate } from "../time/index.js";
11
- import { effectiveFields, effectsOf } from "./effect-layer.js";
12
- import { newStateChecks } from "./game-checks.js";
13
- import { effectShown, endedByTurn, endEffects, endsWithScene, keptBy, systemNamed } from "./game-effects.js";
14
- import { surroundings, surroundingsText } from "./game-environment.js";
15
- import { clearCopies, offMapNote, placeGrid, standing } from "./game-grids.js";
16
- import { metPictureNote, picturesNote } from "./game-images.js";
17
- import { readJourney } from "./game-journey.js";
18
- import { fallenLine, isFallen } from "./game-loot.js";
19
- import { campaignMode, checklistLine } from "./game-mode.js";
20
- import { movePages } from "./game-moves.js";
21
- import { packagesTurnStarted } from "./game-package-hooks.js";
22
- import { isTickedOpenQuest, tickedQuestNote } from "./game-quests.js";
23
- import { turnEffectsNote } from "./game-reminders.js";
24
- import { partyLead, playersApart } from "./game-roads.js";
25
- import { isPlayerDead, makeSave, saveText } from "./game-saves.js";
26
- import { copyCounters, copyPage, openScene, rawScene, readOpenScene, saveScene, updateScene } from "./game-scene.js";
27
- import { newDatedLogEntry, readPresent } from "./game-time.js";
28
- import { turnUsesOf, useInTurn, usesAtTurn } from "./game-turn-uses.js";
29
- import { campaignSystem, campaignSystemWords, campaignWorld, missingSystemHint, systemPagesHint } from "./game-world.js";
30
- import { countersText, pageCounters, partyCounters } from "./page-counters.js";
31
- import { firstInChat, situationPart } from "./parts.js";
32
- import { hasSheet, startingAtZero } from "./worked-out.js";
11
+ import { newStateChecks } from "./shared/checks.js";
12
+ import { effectiveFields, effectsOf } from "./shared/effect-layer.js";
13
+ import { effectShown, endedByTurn, endEffects, endsWithScene, keptBy, systemNamed } from "./shared/effects.js";
14
+ import { surroundings, surroundingsText } from "./shared/environment.js";
15
+ import { clearCopies, offMapNote, placeGrid, standing } from "./shared/grids.js";
16
+ import { metPictureNote, picturesNote } from "./shared/images.js";
17
+ import { textList } from "./shared/inputs.js";
18
+ import { readJourney } from "./shared/journey.js";
19
+ import { fallenLine, isFallen } from "./shared/loot.js";
20
+ import { campaignMode, checklistLine } from "./shared/mode.js";
21
+ import { movePages } from "./shared/moves.js";
22
+ import { packagesTurnStarted } from "./shared/packages/hooks.js";
23
+ import { countersText, pageCounters, partyCounters } from "./shared/page-counters.js";
24
+ import { firstInChat, situationPart } from "./shared/parts.js";
25
+ import { isTickedOpenQuest, tickedQuestNote } from "./shared/quests.js";
26
+ import { turnEffectsNote } from "./shared/reminders.js";
27
+ import { partyLead, playersApart } from "./shared/roads.js";
28
+ import { isPlayerDead, makeSave, saveText } from "./shared/saves.js";
29
+ import { copyCounters, copyPage, openScene, rawScene, readOpenScene, saveScene, scenePlace, updateScene } from "./shared/scene.js";
30
+ import { newDatedLogEntry, readPresent } from "./shared/time.js";
31
+ import { turnUsesOf, useInTurn, usesAtTurn } from "./shared/turn-uses.js";
32
+ import { hasSheet, startingAtZero } from "./shared/worked-out.js";
33
+ import { campaignSystem, campaignSystemWords, campaignWorld, missingSystemHint, systemPagesHint } from "./shared/world.js";
33
34
  const actions = ["open", "add", "leave", "order", "next", "use", "now", "hostile", "calm", "close"];
34
35
  // The parameters each action takes; any other is refused, so that nothing given is silently ignored.
35
36
  const actionParameters = {
@@ -46,8 +47,6 @@ const actionParameters = {
46
47
  };
47
48
  // The most copies of one creature a scene takes.
48
49
  const mostCopies = 50;
49
- // A list, or one text, as an MCP client may send it; run turns one text into a list of one.
50
- const textList = z.union([z.string(), z.array(z.string())]);
51
50
  export const scene = defineCommand({
52
51
  name: "scene",
53
52
  description: "Open, run and close a scene of the story. "
@@ -412,10 +411,13 @@ function keptTurn(current, named) {
412
411
  }
413
412
  /** One use of a turn by one in the scene (TRN-1–TRN-3), kept in the scene, with its line in the log. */
414
413
  function useOfTurn(root, world, input, context, current) {
415
- const [who] = input.who ?? [];
414
+ const [who, ...others] = input.who ?? [];
416
415
  if (who === undefined || input.uses === undefined || input.uses.trim() === "") {
417
416
  throw new Error("Give who and what they use, such as who Ettore, uses attack.");
418
417
  }
418
+ if (others.length > 0) {
419
+ throw new Error(`One at a time: give who as one name, then use again for ${others.join(", ")}. Nothing changed.`);
420
+ }
419
421
  if (current.order === undefined) {
420
422
  throw new Error("The scene has no order of turns, so no turn to use: set it with scene order first, after rolling for it if the game does.");
421
423
  }
@@ -453,7 +455,8 @@ function spendOne(root, context, world, who, spends, why) {
453
455
  else {
454
456
  writePage(world, who.page.name, undefined, { set: { [spends.field]: value } });
455
457
  }
456
- const visibility = who.copy ? "hidden" : "public";
458
+ // Seen where the player sees the page, as change writes it: never a foe's count.
459
+ const visibility = who.copy || !concernsPlayer(world, who.page) ? "hidden" : "public";
457
460
  appendLogEntry(root, newDatedLogEntry(root, context, "counter-changed", visibility, { page: who.name, field: spends.field, before: String(spends.before), after: String(after), why }));
458
461
  }
459
462
  function passTurn(root, world, context, current) {
@@ -679,7 +682,7 @@ function withActing(root, context, before, result) {
679
682
  }
680
683
  /** Who acts and stands on no square of the scene's map, when its place has one (GRD-3, playtest 07): where it stands decides reach, cover and the way. */
681
684
  function offTheMap(world, scene, name) {
682
- const place = scene?.place === undefined ? undefined : pagesWithName(world, parsePageReference(scene.place).name)[0];
685
+ const place = scenePlace(world, scene);
683
686
  if (place === undefined || placeGrid(place) === undefined || standing(world, place, scene).some((one) => sameName([one.name], name) !== undefined && one.square !== undefined)) {
684
687
  return "";
685
688
  }
@@ -1,7 +1,7 @@
1
- import type { Context } from "../core/context.ts";
2
- import { type World } from "../pages/index.ts";
3
- import { type GameDate } from "../time/index.ts";
4
- import { type DatedEvent } from "./game-events.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import { type GameDate } from "../../time/index.ts";
4
+ import { type DatedEvent } from "./events.ts";
5
5
  /** What time passing did, as outputs tell it. */
6
6
  export interface TimePassed {
7
7
  /** Undefined when an advance set the date the game starts on. */
@@ -1,18 +1,18 @@
1
1
  // Time passing in the story (TIM-5, TIM-6, EFF-8, EVT-8), as advance and travel do it: up to the first planned event that comes due, with what ends and what comes.
2
- import { changeState } from "../campaign/index.js";
3
- import { appendLogEntry } from "../core/log.js";
4
- import { isEmptyField, locate, playerCharacters } from "../pages/index.js";
5
- import { addDuration, formatCalendarDay, formatGameDate, minutesBetween } from "../time/index.js";
6
- import { endedByDate, endEffects } from "./game-effects.js";
7
- import { surroundings, surroundingsText } from "./game-environment.js";
8
- import { clocksToMove, dueAdvice, dueEvents, dueText, isDated, plannedEvents, plannedText } from "./game-events.js";
9
- import { readOpenScene } from "./game-scene.js";
10
- import { diaryDueLine } from "./game-thoughts.js";
11
- import { calendarDayOf, newDatedLogEntry } from "./game-time.js";
12
- import { dailyUpkeep } from "./game-upkeep.js";
13
- import { campaignSystem, campaignWorld } from "./game-world.js";
2
+ import { changeState } from "../../campaign/index.js";
3
+ import { appendLogEntry } from "../../core/log.js";
4
+ import { isEmptyField, locate, playerCharacters } from "../../pages/index.js";
5
+ import { addDuration, formatCalendarDay, formatGameDate, minutesBetween } from "../../time/index.js";
6
+ import { endedByDate, endEffects } from "./effects.js";
7
+ import { surroundings, surroundingsText } from "./environment.js";
8
+ import { clocksToMove, dueAdvice, dueEvents, dueText, isDated, plannedEvents, plannedText } from "./events.js";
14
9
  import { shortList, skippedPagesNote } from "./notes.js";
15
10
  import { situationPart } from "./parts.js";
11
+ import { readOpenScene } from "./scene.js";
12
+ import { diaryDueLine } from "./thoughts.js";
13
+ import { calendarDayOf, newDatedLogEntry } from "./time.js";
14
+ import { dailyUpkeep } from "./upkeep.js";
15
+ import { campaignSystem, campaignWorld } from "./world.js";
16
16
  // An hour or more passing usually ends a scene: then advance reminds that one is still open.
17
17
  const sceneReminderMinutes = 60;
18
18
  /**
@@ -88,6 +88,21 @@ export function nextAfter(events, date) {
88
88
  const next = events.find((event) => minutesBetween(date, event.date) > 0);
89
89
  return next === undefined ? undefined : events.filter((event) => minutesBetween(next.date, event.date) === 0).map((event) => plannedText(event, date)).join(" · ");
90
90
  }
91
+ /**
92
+ * "Ettore: light: dark (Cripta)": what holds around the player characters, once for each place of the living (VIEW-12), for rules that count the hours spent
93
+ * there (ENV-5); undefined when nothing does.
94
+ */
95
+ export function aroundLead(world) {
96
+ const players = playerCharacters(world);
97
+ const living = players.filter((page) => page.fields.status !== "dead");
98
+ const placeOf = (page) => locate(world, page).chain.find((holder) => holder.type === "place");
99
+ const groups = living.length === 0 ? players.slice(0, 1).map((page) => [page]) : [...new Set(living.map(placeOf))].map((place) => living.filter((page) => placeOf(page) === place));
100
+ const lines = groups.flatMap((group) => {
101
+ const around = surroundingsText(surroundings(world, group[0]));
102
+ return around === "" ? [] : [`${group.map((page) => page.name).join(" and ")}: ${around}`];
103
+ });
104
+ return lines.length === 0 ? undefined : lines.join("; ");
105
+ }
91
106
  /** A new day is the world's turn (EVT-8): the clocks to move as the time moved them, which they never do by themselves; how, the part new-day says (D-134). */
92
107
  function clocksLine(newDays, to, clocks) {
93
108
  if (clocks.length === 0) {
@@ -108,18 +123,3 @@ function openSceneText(root) {
108
123
  const { scene } = readOpenScene(root);
109
124
  return scene === undefined ? undefined : `${scene.title}${scene.opened === undefined ? "" : ` (since ${scene.opened})`}`;
110
125
  }
111
- /**
112
- * "Ettore: light: dark (Cripta)": what holds around the player characters, once for each place of the living (VIEW-12), for rules that count the hours spent
113
- * there (ENV-5); undefined when nothing does.
114
- */
115
- export function aroundLead(world) {
116
- const players = playerCharacters(world);
117
- const living = players.filter((page) => page.fields.status !== "dead");
118
- const placeOf = (page) => locate(world, page).chain.find((holder) => holder.type === "place");
119
- const groups = living.length === 0 ? players.slice(0, 1).map((page) => [page]) : [...new Set(living.map(placeOf))].map((place) => living.filter((page) => placeOf(page) === place));
120
- const lines = groups.flatMap((group) => {
121
- const around = surroundingsText(surroundings(world, group[0]));
122
- return around === "" ? [] : [`${group.map((page) => page.name).join(" and ")}: ${around}`];
123
- });
124
- return lines.length === 0 ? undefined : lines.join("; ");
125
- }
@@ -1,6 +1,6 @@
1
- import { type AdventureFiles, type AdventureManifest } from "../adventures/index.ts";
2
- import type { Context } from "../core/context.ts";
3
- import { type LogEntry } from "../core/log.ts";
1
+ import { type AdventureFiles, type AdventureManifest } from "../../adventures/index.ts";
2
+ import type { Context } from "../../core/context.ts";
3
+ import { type LogEntry } from "../../core/log.ts";
4
4
  /** An adventure the campaign has installed and not taken out (ADV-6). */
5
5
  export interface InstalledAdventure {
6
6
  title: string;
@@ -2,24 +2,24 @@
2
2
  // they were at the start (ADV-1–ADV-7).
3
3
  import { basename, join, relative, resolve, sep } from "node:path";
4
4
  import { parse, parseDocument, stringify, visit } from "yaml";
5
- import { adventureFolderName, adventureTarget, isAdventureFolder, largestAdventure, manifestLine, packAdventure, readAdventureFolder, readAdventureZip } from "../adventures/index.js";
6
- import { houseRulesFolderName, readSettings } from "../campaign/index.js";
7
- import { appendLogEntry, readLog } from "../core/log.js";
8
- import { files } from "../core/store.js";
9
- import { comparableText, linkTargetName } from "../core/text.js";
10
- import { isNewerVersion } from "../core/version.js";
11
- import { shortName } from "../extensions/index.js";
12
- import { findImage, imageFileName, largestImage } from "../images/index.js";
13
- import { locate, pageNamed, readFields, splitPageFile, textsIn, worldFolderName } from "../pages/index.js";
14
- import { readRuleBook, ruleSections } from "../rules/index.js";
15
- import { unpackFiles } from "../saves/index.js";
16
- import { formatGameDate, readGameDate } from "../time/index.js";
17
- import { listedExtensions } from "./game-extension-list.js";
18
- import { campaignMode } from "./game-mode.js";
19
- import { houseRules, systemRuleBook } from "./game-rules.js";
20
- import { campaignSaves, exportsFolderName, resetSave, savesFolderName, savesWhy } from "./game-saves.js";
21
- import { newDatedLogEntry, readPresent } from "./game-time.js";
22
- import { campaignSystem, campaignWorld } from "./game-world.js";
5
+ import { adventureFolderName, adventureTarget, isAdventureFolder, largestAdventure, manifestLine, packAdventure, readAdventureFolder, readAdventureZip } from "../../adventures/index.js";
6
+ import { houseRulesFolderName, readSettings } from "../../campaign/index.js";
7
+ import { appendLogEntry, readLog } from "../../core/log.js";
8
+ import { files } from "../../core/store.js";
9
+ import { comparableText, linkTargetName } from "../../core/text.js";
10
+ import { isNewerVersion } from "../../core/version.js";
11
+ import { shortName } from "../../extensions/index.js";
12
+ import { findImage, imageFileName, largestImage } from "../../images/index.js";
13
+ import { locate, pageNamed, pageNamedQuietly, readFields, splitPageFile, textsIn, worldFolderName } from "../../pages/index.js";
14
+ import { readRuleBook, ruleSections } from "../../rules/index.js";
15
+ import { unpackFiles } from "../../saves/index.js";
16
+ import { formatGameDate, readGameDate } from "../../time/index.js";
17
+ import { campaignMode } from "./mode.js";
18
+ import { listedExtensions } from "./packages/extensions.js";
19
+ import { houseRules, systemRuleBook } from "./rules.js";
20
+ import { campaignSaves, exportsFolderName, resetSave, savesFolderName, savesWhy } from "./saves.js";
21
+ import { newDatedLogEntry, readPresent } from "./time.js";
22
+ import { campaignSystem, campaignWorld } from "./world.js";
23
23
  // The mark of an install under way, with its title and the days it moves dates by: while it is there, installing the same adventure finishes it (ADV-5).
24
24
  const installMarkName = ".adventure-install.yaml";
25
25
  // The documents a master imports, never a package: their pages are written by the master (D-483 (10)).
@@ -104,7 +104,7 @@ export function storyTouching(root, adventure) {
104
104
  const log = readLog(root);
105
105
  const names = new Set(adventure.files.filter((path) => path.startsWith(`${worldFolderName}/`)).flatMap((path) => pageNames(root, path)).map(comparableText));
106
106
  const after = log.slice(log.findIndex((entry) => entry.id === adventure.entry) + 1);
107
- return after.find((entry) => textsOf(entry.data).some((text) => names.has(comparableText(linkTargetName(unlinked(text))))));
107
+ return after.find((entry) => textsIn(entry.data).some((text) => names.has(comparableText(linkTargetName(unlinked(text))))));
108
108
  }
109
109
  /**
110
110
  * Exports the campaign's world as an adventure (ADV-7), as it was at its start: the save before session zero, else that of the start, else the world now while no
@@ -167,7 +167,7 @@ function systemUsed(kept, world, fields) {
167
167
  return false;
168
168
  }
169
169
  const text = new TextDecoder().decode(bytes);
170
- const linked = [...text.matchAll(/\[\[([^\]]+)\]\]/g)].some((link) => pageNamed(world, linkTargetName(link[1] ?? ""))?.system !== undefined);
170
+ const linked = [...text.matchAll(/\[\[([^\]]+)\]\]/g)].some((link) => pageNamedQuietly(world, linkTargetName(link[1] ?? ""))?.system !== undefined);
171
171
  return linked || Object.entries(fieldsOf(path, bytes)).some(([key, value]) => declared.has(comparableText(key)) && /\d/.test(String(value)));
172
172
  });
173
173
  }
@@ -401,13 +401,6 @@ function pageNames(root, path) {
401
401
  }
402
402
  return [basename(path, ".md"), ...aliases];
403
403
  }
404
- /** Every text a log line's data holds, in lists and objects too. */
405
- function textsOf(value) {
406
- if (typeof value === "string") {
407
- return [value];
408
- }
409
- return Array.isArray(value) ? value.flatMap(textsOf) : value !== null && typeof value === "object" ? Object.values(value).flatMap(textsOf) : [];
410
- }
411
404
  /** A text as the page it may name: [[Oste#Segreto|lui]] as Oste. */
412
405
  function unlinked(text) {
413
406
  const match = /^\s*\[\[([^\]#|]*)[^\]]*\]\]\s*$/.exec(text);
@@ -1,6 +1,6 @@
1
- import type { Problem } from "../core/problem.ts";
2
- import { type FieldChange, type Page, type World } from "../pages/index.ts";
3
- import type { GameSystem } from "../systems/index.ts";
1
+ import type { Problem } from "../../core/problem.ts";
2
+ import { type FieldChange, type Page, type World } from "../../pages/index.ts";
3
+ import type { GameSystem } from "../../systems/index.ts";
4
4
  /** Refuses a change that binds more items than the system allows, or an item that asks for no bond (BND-1, BND-2); before anything is written. */
5
5
  export declare function checkBonds(world: World, system: GameSystem | undefined, page: Page | undefined, name: string, change: FieldChange): void;
6
6
  /** What a write says of the items it bound (BND-3): how many of the most, and what an item asks, as by a paladin, which the master checks. */
@@ -1,5 +1,5 @@
1
- import { comparableText, valueNamed } from "../core/text.js";
2
- import { findPage, inheritedFields, linksIn, textsIn } from "../pages/index.js";
1
+ import { comparableText, valueNamed } from "../../core/text.js";
2
+ import { findPage, inheritedFields, linksIn, textsIn } from "../../pages/index.js";
3
3
  /** Refuses a change that binds more items than the system allows, or an item that asks for no bond (BND-1, BND-2); before anything is written. */
4
4
  export function checkBonds(world, system, page, name, change) {
5
5
  for (const [field, bond] of Object.entries(system?.bonds ?? {})) {
@@ -1,6 +1,6 @@
1
- import type { Context } from "../core/context.ts";
2
- import type { Problem } from "../core/problem.ts";
3
- import { type Page } from "../pages/index.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import type { Problem } from "../../core/problem.ts";
3
+ import { type Page } from "../../pages/index.ts";
4
4
  /** A contradiction in the state: the rule that found it, the page it is on, and the line for the master. */
5
5
  export interface Contradiction {
6
6
  rule: string;
@@ -1,11 +1,11 @@
1
- import { comparableText, sameWord, valueNamed } from "../core/text.js";
2
- import { formatCounter, readCounter } from "../counters/index.js";
3
- import { keeperOf } from "../effects/index.js";
4
- import { inheritedFields, isPartyMember, pagesWithName, parsePageReference } from "../pages/index.js";
1
+ import { comparableText, sameWord, valueNamed } from "../../core/text.js";
2
+ import { formatCounter, readCounter } from "../../counters/index.js";
3
+ import { keeperOf } from "../../effects/index.js";
4
+ import { inheritedFields, isPartyMember, pagesWithName, parsePageReference } from "../../pages/index.js";
5
5
  import { effectsOf } from "./effect-layer.js";
6
- import { keptEffects, systemNamed } from "./game-effects.js";
7
- import { readOpenScene } from "./game-scene.js";
8
- import { campaignSystem, campaignSystemWords, campaignWorld } from "./game-world.js";
6
+ import { keptEffects, systemNamed } from "./effects.js";
7
+ import { readOpenScene } from "./scene.js";
8
+ import { campaignSystem, campaignSystemWords, campaignWorld } from "./world.js";
9
9
  /** Every contradiction now (CHK-3), for status and validate. */
10
10
  export function allStateChecks(root, context) {
11
11
  const system = campaignSystem(root, context);
@@ -1,6 +1,6 @@
1
- import type { Context } from "../core/context.ts";
2
- import { type Page, type World } from "../pages/index.ts";
3
- import type { GameSystem, Recipe } from "../systems/index.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type Page, type World } from "../../pages/index.ts";
3
+ import type { GameSystem, Recipe } from "../../systems/index.ts";
4
4
  /** Dice spent: the line that says it, with the rules they touched; the faces, what each die adds and what they gave, and the id of the roll's line in the log. */
5
5
  export interface DiceSpent {
6
6
  text: string;
@@ -1,13 +1,14 @@
1
- import { appendLogEntry } from "../core/log.js";
2
- import { comparableText, valueNamed } from "../core/text.js";
3
- import { formatCounter, readCounter } from "../counters/index.js";
4
- import { rollDice } from "../dice/index.js";
5
- import { findPage, isPartyMember, withPage, writePage } from "../pages/index.js";
1
+ import { appendLogEntry } from "../../core/log.js";
2
+ import { comparableText, valueNamed } from "../../core/text.js";
3
+ import { formatCounter, readCounter } from "../../counters/index.js";
4
+ import { rollDice } from "../../dice/index.js";
5
+ import { concernsPlayer, findPage, isPartyMember, withPage, writePage } from "../../pages/index.js";
6
6
  import { effectGiving, effectiveFields, effectsOf, withValue } from "./effect-layer.js";
7
- import { saveEffects } from "./game-effects.js";
8
- import { allSaid, packagesCounterChanged } from "./game-package-hooks.js";
9
- import { thresholdNotes } from "./game-thresholds.js";
10
- import { newDatedLogEntry } from "./game-time.js";
7
+ import { saveEffects } from "./effects.js";
8
+ import { behindTheScreen, screenNote, sealHiddenRoll } from "./master-rolls.js";
9
+ import { allSaid, packagesCounterChanged } from "./packages/hooks.js";
10
+ import { thresholdNotes } from "./thresholds.js";
11
+ import { newDatedLogEntry } from "./time.js";
11
12
  import { formulaValue } from "./worked-out.js";
12
13
  /**
13
14
  * Spends dice of a counter named after its die, as stamina-d6, in a recipe that lets one (D-449): each die rolled with what the recipe adds, at least 0, the
@@ -48,7 +49,10 @@ export function spendDice(root, context, world, spending, name, field, amount, h
48
49
  const added = adds * count;
49
50
  const notation = added === 0 ? roll.notation : `${roll.notation}${added > 0 ? "+" : "-"}${Math.abs(added)}`;
50
51
  const result = `${notation} = [${roll.faces.join(", ")}]${added === 0 ? "" : ` ${added > 0 ? "+" : "-"} ${Math.abs(added)}`}, ${healed}`;
51
- const entry = newDatedLogEntry(root, context, "roll", "public", {
52
+ // Dice of someone the party does not hold stay behind the screen, as master-rolls says (D-287); their counters are seen where the player sees them.
53
+ const hidden = values === undefined && behindTheScreen(root, context, page.name);
54
+ const counters = concernsPlayer(world, page) ? "public" : "hidden";
55
+ const entry = newDatedLogEntry(root, context, "roll", hidden ? "hidden" : "public", {
52
56
  notation,
53
57
  total: healed,
54
58
  result,
@@ -58,10 +62,13 @@ export function spendDice(root, context, world, spending, name, field, amount, h
58
62
  physical: values !== undefined,
59
63
  dice: roll.dice,
60
64
  });
65
+ if (hidden) {
66
+ sealHiddenRoll(entry, result, context);
67
+ }
61
68
  appendLogEntry(root, entry);
62
69
  for (const [changed, before, now] of [[field, dice.value, dice.value - count], [rule.gives, target.value, after]]) {
63
70
  const data = { page: page.name, field: changed, effect: layers.get(changed), before: String(before), after: String(now), why };
64
- appendLogEntry(root, newDatedLogEntry(root, context, "counter-changed", "public", data));
71
+ appendLogEntry(root, newDatedLogEntry(root, context, "counter-changed", counters, data));
65
72
  }
66
73
  const max = (counter) => (counter.max === undefined ? "" : `/${counter.max}`);
67
74
  const notes = isPartyMember(page)
@@ -71,7 +78,7 @@ export function spendDice(root, context, world, spending, name, field, amount, h
71
78
  const hooked = allSaid(packagesCounterChanged(root, context, { page: page.name, field: rule.gives, before: target.value, after, lost: 0, ...(target.max === undefined ? {} : { max: target.max }) }));
72
79
  const within = (changed) => (layers.get(changed) === undefined ? "" : ` in ${layers.get(changed)}`);
73
80
  const line = `${page.name} spends ${count} ${field}: ${result}; ${rule.gives} ${target.value}${max(target)} → ${after}${max(target)}${within(rule.gives)}; ${field} ${dice.value}${max(dice)} → ${dice.value - count}${max(dice)}${within(field)}.`;
74
- return { text: [line, ...notes, ...hooked].join("\n"), notes: [...notes, ...hooked], faces: roll.faces, adds, total: healed, id: entry.id };
81
+ return { text: [hidden ? `${line} ${screenNote}` : line, ...notes, ...hooked].join("\n"), notes: [...notes, ...hooked], faces: roll.faces, adds, total: healed, id: entry.id };
75
82
  }
76
83
  /** The counters of dice a recipe lets this page spend, as the page reads them, with a maximum above 0: those at 0 too, as a page shows them spent. */
77
84
  export function restDice(world, recipe, page) {
@@ -1,5 +1,5 @@
1
- import { type Effect } from "../effects/index.ts";
2
- import { type Page, type World } from "../pages/index.ts";
1
+ import { type Effect } from "../../effects/index.ts";
2
+ import { type Page, type World } from "../../pages/index.ts";
3
3
  /** The effects field of a page or copy, written in any case (EFF-1). */
4
4
  export declare function effectsField(page: Page): unknown;
5
5
  /** The effects a page or copy holds; none when its field cannot be read, which validate reports and effect refuses to touch (EFF-12). */