rpg-engine 0.14.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/dist/campaign/index.d.ts +1 -1
  2. package/dist/campaign/index.js +1 -1
  3. package/dist/campaign/last-choices.js +1 -1
  4. package/dist/campaign/settings.d.ts +25 -5
  5. package/dist/campaign/settings.js +38 -9
  6. package/dist/cli/cli.js +1 -1
  7. package/dist/cli/command-line.js +1 -1
  8. package/dist/commands/advance.d.ts +1 -1
  9. package/dist/commands/advance.js +6 -6
  10. package/dist/commands/ask.js +7 -7
  11. package/dist/commands/change/amounts.d.ts +32 -0
  12. package/dist/commands/change/amounts.js +150 -0
  13. package/dist/commands/change/change.d.ts +4 -54
  14. package/dist/commands/change/change.js +19 -749
  15. package/dist/commands/change/damage.d.ts +30 -0
  16. package/dist/commands/change/damage.js +73 -2
  17. package/dist/commands/change/dice.d.ts +34 -0
  18. package/dist/commands/change/dice.js +59 -0
  19. package/dist/commands/change/fields.d.ts +37 -0
  20. package/dist/commands/change/fields.js +156 -0
  21. package/dist/commands/change/holder.d.ts +48 -0
  22. package/dist/commands/change/holder.js +162 -0
  23. package/dist/commands/change/recipe-pace.js +1 -1
  24. package/dist/commands/change/recipe.d.ts +58 -0
  25. package/dist/commands/change/recipe.js +179 -0
  26. package/dist/commands/choices.js +3 -3
  27. package/dist/commands/config/config.d.ts +15 -0
  28. package/dist/commands/config/config.js +355 -0
  29. package/dist/commands/config/custom-levels.d.ts +7 -0
  30. package/dist/commands/config/custom-levels.js +32 -0
  31. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +4 -26
  32. package/dist/commands/config/dashboard.js +171 -0
  33. package/dist/commands/config/entries.d.ts +17 -0
  34. package/dist/commands/config/entries.js +76 -0
  35. package/dist/commands/config/news.d.ts +7 -0
  36. package/dist/commands/config/news.js +88 -0
  37. package/dist/commands/config/shown.d.ts +9 -0
  38. package/dist/commands/config/shown.js +80 -0
  39. package/dist/commands/config/words.d.ts +27 -0
  40. package/dist/commands/config/words.js +204 -0
  41. package/dist/commands/effect.js +9 -9
  42. package/dist/commands/find.d.ts +4 -4
  43. package/dist/commands/find.js +1 -1
  44. package/dist/commands/image.js +6 -6
  45. package/dist/commands/import/import.d.ts +0 -2
  46. package/dist/commands/import/import.js +45 -44
  47. package/dist/commands/import/run.js +1 -1
  48. package/dist/commands/index.js +3 -3
  49. package/dist/commands/init.js +2 -2
  50. package/dist/commands/install.js +1 -1
  51. package/dist/commands/instructions.js +17 -6
  52. package/dist/commands/mode.d.ts +2 -2
  53. package/dist/commands/mode.js +17 -9
  54. package/dist/commands/mood.js +4 -4
  55. package/dist/commands/move.js +10 -10
  56. package/dist/commands/package/consent.d.ts +11 -0
  57. package/dist/commands/package/consent.js +52 -0
  58. package/dist/commands/package/here.d.ts +51 -0
  59. package/dist/commands/package/here.js +128 -0
  60. package/dist/commands/package/install.d.ts +10 -0
  61. package/dist/commands/package/install.js +337 -0
  62. package/dist/commands/package/package.d.ts +18 -0
  63. package/dist/commands/package/package.js +236 -0
  64. package/dist/commands/package/result.d.ts +90 -0
  65. package/dist/commands/package/result.js +1 -0
  66. package/dist/commands/package/uninstall.d.ts +6 -0
  67. package/dist/commands/package/uninstall.js +70 -0
  68. package/dist/commands/rename.js +3 -3
  69. package/dist/commands/reveal.js +5 -5
  70. package/dist/commands/roll/roll.js +11 -9
  71. package/dist/commands/roll/tables.js +1 -1
  72. package/dist/commands/rules.d.ts +2 -2
  73. package/dist/commands/rules.js +3 -3
  74. package/dist/commands/save.d.ts +1 -1
  75. package/dist/commands/save.js +2 -2
  76. package/dist/commands/scene/close.d.ts +18 -0
  77. package/dist/commands/scene/close.js +179 -0
  78. package/dist/commands/scene/members.d.ts +14 -0
  79. package/dist/commands/scene/members.js +32 -0
  80. package/dist/commands/scene/open.d.ts +6 -0
  81. package/dist/commands/scene/open.js +298 -0
  82. package/dist/commands/scene/result.d.ts +98 -0
  83. package/dist/commands/scene/result.js +2 -0
  84. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  85. package/dist/commands/scene/scene.js +210 -0
  86. package/dist/commands/scene/turns.d.ts +18 -0
  87. package/dist/commands/scene/turns.js +229 -0
  88. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
  89. package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
  90. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  91. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  92. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  93. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  94. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  95. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  96. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  97. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  98. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  99. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  100. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  101. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  102. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  103. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  104. package/dist/commands/shared/{mode.js → campaign/mode.js} +28 -13
  105. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  106. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  107. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  108. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  109. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  110. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  111. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +10 -3
  112. package/dist/commands/shared/{parts.js → campaign/parts.js} +26 -3
  113. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  114. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  115. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  116. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  117. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  118. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  119. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  120. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  121. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  122. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  123. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  124. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  125. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  126. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  127. package/dist/commands/shared/characters/orders.d.ts +4 -0
  128. package/dist/commands/shared/characters/orders.js +10 -0
  129. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
  130. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
  131. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  132. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  133. package/dist/commands/shared/examples.js +2 -2
  134. package/dist/commands/shared/packages/catalog.js +2 -2
  135. package/dist/commands/shared/packages/code.d.ts +1 -1
  136. package/dist/commands/shared/packages/code.js +8 -8
  137. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  138. package/dist/commands/shared/packages/extensions.js +1 -1
  139. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  140. package/dist/commands/shared/packages/hooks.js +1 -1
  141. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  142. package/dist/commands/shared/packages/widgets.js +3 -3
  143. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  144. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  145. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  146. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  147. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  148. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  149. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  150. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  151. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  152. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  153. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  154. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  155. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  156. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  157. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  158. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  159. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  160. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  161. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  162. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  163. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  164. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  165. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  166. package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
  167. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  168. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  169. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  170. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  171. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  172. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  173. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  174. package/dist/commands/shared/sheet/effect-values.js +69 -0
  175. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  176. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  177. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  178. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  179. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  180. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  181. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  182. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  183. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  184. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  185. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
  186. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  187. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  188. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  189. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  190. package/dist/commands/shared/sheet/system-fields.js +45 -0
  191. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  192. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  193. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  194. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  195. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  196. package/dist/commands/shared/sheet/worked-out.js +291 -0
  197. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  198. package/dist/commands/shared/sheet/worked-text.js +55 -0
  199. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  200. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  201. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  202. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  203. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  204. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  205. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  206. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  207. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  208. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  209. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  210. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  211. package/dist/commands/show.d.ts +4 -1
  212. package/dist/commands/show.js +28 -9
  213. package/dist/commands/status.d.ts +2 -1
  214. package/dist/commands/status.js +34 -23
  215. package/dist/commands/thoughts.js +3 -3
  216. package/dist/commands/trade.js +8 -8
  217. package/dist/commands/translate.d.ts +1 -1
  218. package/dist/commands/translate.js +3 -3
  219. package/dist/commands/travel/open.d.ts +1 -1
  220. package/dist/commands/travel/open.js +2 -2
  221. package/dist/commands/travel/route.js +7 -6
  222. package/dist/commands/travel/travel.d.ts +1 -1
  223. package/dist/commands/travel/travel.js +8 -8
  224. package/dist/commands/validate.js +3 -3
  225. package/dist/commands/view/journal.d.ts +2 -2
  226. package/dist/commands/view/journal.js +2 -2
  227. package/dist/commands/view/map.d.ts +1 -1
  228. package/dist/commands/view/map.js +6 -6
  229. package/dist/commands/view/memory.d.ts +16 -0
  230. package/dist/commands/view/memory.js +90 -0
  231. package/dist/commands/view/page.d.ts +32 -0
  232. package/dist/commands/view/page.js +163 -0
  233. package/dist/commands/view/place.d.ts +7 -2
  234. package/dist/commands/view/place.js +30 -12
  235. package/dist/commands/view/result.d.ts +245 -0
  236. package/dist/commands/view/result.js +1 -0
  237. package/dist/commands/view/saves.d.ts +6 -0
  238. package/dist/commands/view/saves.js +53 -0
  239. package/dist/commands/view/story.d.ts +32 -0
  240. package/dist/commands/view/story.js +227 -0
  241. package/dist/commands/view/view.d.ts +26 -292
  242. package/dist/commands/view/view.js +26 -534
  243. package/dist/commands/view/world.d.ts +1 -1
  244. package/dist/commands/view/world.js +3 -3
  245. package/dist/commands/write/checks.d.ts +42 -0
  246. package/dist/commands/write/checks.js +291 -0
  247. package/dist/commands/write/here.d.ts +1 -1
  248. package/dist/commands/write/here.js +5 -5
  249. package/dist/commands/write/inheritance.d.ts +40 -0
  250. package/dist/commands/write/inheritance.js +189 -0
  251. package/dist/commands/write/input.d.ts +29 -0
  252. package/dist/commands/write/input.js +124 -0
  253. package/dist/commands/write/layer.d.ts +36 -0
  254. package/dist/commands/write/layer.js +48 -0
  255. package/dist/commands/write/notes.d.ts +22 -0
  256. package/dist/commands/write/notes.js +76 -0
  257. package/dist/commands/write/progression.d.ts +27 -0
  258. package/dist/commands/write/progression.js +175 -0
  259. package/dist/commands/write/write.d.ts +2 -1
  260. package/dist/commands/write/write.js +33 -817
  261. package/dist/core/files.d.ts +2 -0
  262. package/dist/core/files.js +7 -0
  263. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  264. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  265. package/dist/core/session-store.js +3 -3
  266. package/dist/core/store.d.ts +2 -2
  267. package/dist/core/store.js +18 -4
  268. package/dist/dashboard/acts/acts.js +1 -1
  269. package/dist/dashboard/acts/sending.js +110 -0
  270. package/dist/dashboard/acts/sheet.js +2 -2
  271. package/dist/dashboard/acts/strip.js +1 -1
  272. package/dist/dashboard/address.js +6 -0
  273. package/dist/dashboard/api.js +1 -1
  274. package/dist/dashboard/app.js +47 -171
  275. package/dist/dashboard/dice/roller.js +1 -1
  276. package/dist/dashboard/dice/sets.js +2 -2
  277. package/dist/dashboard/dice/stage.js +1 -1
  278. package/dist/dashboard/dice/tray.js +6 -6
  279. package/dist/dashboard/guide/ar.md +9 -4
  280. package/dist/dashboard/guide/cs.md +10 -5
  281. package/dist/dashboard/guide/da.md +9 -4
  282. package/dist/dashboard/guide/de.md +9 -4
  283. package/dist/dashboard/guide/el.md +10 -5
  284. package/dist/dashboard/guide/en.md +7 -2
  285. package/dist/dashboard/guide/es.md +9 -4
  286. package/dist/dashboard/guide/fi.md +9 -4
  287. package/dist/dashboard/guide/fr.md +9 -4
  288. package/dist/dashboard/guide/he.md +9 -4
  289. package/dist/dashboard/guide/hi.md +10 -5
  290. package/dist/dashboard/guide/hu.md +10 -5
  291. package/dist/dashboard/guide/is.md +9 -4
  292. package/dist/dashboard/guide/it.md +9 -4
  293. package/dist/dashboard/guide/ja.md +12 -7
  294. package/dist/dashboard/guide/ko.md +11 -6
  295. package/dist/dashboard/guide/nb.md +9 -4
  296. package/dist/dashboard/guide/nl.md +10 -5
  297. package/dist/dashboard/guide/pl.md +9 -4
  298. package/dist/dashboard/guide/pt.md +9 -4
  299. package/dist/dashboard/guide/ro.md +9 -4
  300. package/dist/dashboard/guide/ru.md +9 -4
  301. package/dist/dashboard/guide/sv.md +9 -4
  302. package/dist/dashboard/guide/tr.md +11 -6
  303. package/dist/dashboard/guide/uk.md +9 -4
  304. package/dist/dashboard/guide/zh.md +9 -4
  305. package/dist/dashboard/help/help.js +3 -3
  306. package/dist/dashboard/i18n/ar.json +20 -0
  307. package/dist/dashboard/i18n/cs.json +20 -0
  308. package/dist/dashboard/i18n/da.json +20 -0
  309. package/dist/dashboard/i18n/de.json +20 -0
  310. package/dist/dashboard/i18n/el.json +20 -0
  311. package/dist/dashboard/i18n/es.json +20 -0
  312. package/dist/dashboard/i18n/fi.json +20 -0
  313. package/dist/dashboard/i18n/fr.json +20 -0
  314. package/dist/dashboard/i18n/he.json +20 -0
  315. package/dist/dashboard/i18n/hi.json +20 -0
  316. package/dist/dashboard/i18n/hu.json +20 -0
  317. package/dist/dashboard/i18n/is.json +20 -0
  318. package/dist/dashboard/i18n/it.json +20 -0
  319. package/dist/dashboard/i18n/ja.json +21 -1
  320. package/dist/dashboard/i18n/ko.json +20 -0
  321. package/dist/dashboard/i18n/nb.json +20 -0
  322. package/dist/dashboard/i18n/nl.json +20 -0
  323. package/dist/dashboard/i18n/pl.json +20 -0
  324. package/dist/dashboard/i18n/pt.json +20 -0
  325. package/dist/dashboard/i18n/ro.json +20 -0
  326. package/dist/dashboard/i18n/ru.json +20 -0
  327. package/dist/dashboard/i18n/sv.json +20 -0
  328. package/dist/dashboard/i18n/tr.json +20 -0
  329. package/dist/dashboard/i18n/uk.json +20 -0
  330. package/dist/dashboard/i18n/zh.json +20 -0
  331. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  332. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  333. package/dist/dashboard/kit.js +3 -3
  334. package/dist/dashboard/packages/ask-card.js +3 -3
  335. package/dist/dashboard/packages/catalog.js +196 -0
  336. package/dist/dashboard/packages/engine.js +87 -0
  337. package/dist/dashboard/packages/installed.js +53 -0
  338. package/dist/dashboard/packages/library.js +97 -0
  339. package/dist/dashboard/packages/outcomes.js +45 -0
  340. package/dist/dashboard/packages/packages.js +20 -576
  341. package/dist/dashboard/packages/page-code.js +15 -2
  342. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  343. package/dist/dashboard/packages/rows.js +84 -0
  344. package/dist/dashboard/packages/share.js +44 -0
  345. package/dist/dashboard/packages/widgets.js +3 -3
  346. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  347. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  348. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  349. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  350. package/dist/dashboard/{labels.js → parts/labels.js} +8 -1
  351. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  352. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  353. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  354. package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
  355. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  356. package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
  357. package/dist/dashboard/place/key.js +24 -0
  358. package/dist/dashboard/place/paper.js +67 -0
  359. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  360. package/dist/dashboard/place/things.js +129 -0
  361. package/dist/dashboard/place/tokens.js +93 -0
  362. package/dist/dashboard/place/view.js +124 -0
  363. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  364. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  365. package/dist/dashboard/{choices.js → play/choices.js} +9 -9
  366. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  367. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  368. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  369. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  370. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  371. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  372. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  373. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  374. package/dist/dashboard/{setup.js → settings/setup.js} +6 -6
  375. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  376. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  377. package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
  378. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  379. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  380. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  381. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  382. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  383. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  384. package/dist/dashboard/shell/shown.js +37 -0
  385. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  386. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  387. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  388. package/dist/dashboard/style.css +90 -9
  389. package/dist/dashboard/world/calendar.js +4 -4
  390. package/dist/dashboard/world/drawing.js +92 -0
  391. package/dist/dashboard/world/key.js +21 -0
  392. package/dist/dashboard/world/lore.js +5 -5
  393. package/dist/dashboard/world/map-card.js +186 -0
  394. package/dist/dashboard/world/place-card.js +39 -0
  395. package/dist/dashboard/world/places.js +29 -0
  396. package/dist/dashboard/world/world.js +9 -341
  397. package/dist/extensions/extension.d.ts +1 -1
  398. package/dist/extensions/extension.js +1 -1
  399. package/dist/images/images.js +12 -9
  400. package/dist/index.d.ts +1 -1
  401. package/dist/languages/index.d.ts +1 -1
  402. package/dist/languages/index.js +1 -1
  403. package/dist/library/books.js +2 -0
  404. package/dist/packages/npm.js +1 -1
  405. package/dist/page.d.ts +2 -2
  406. package/dist/page.js +1 -1
  407. package/dist/pages/check.js +23 -1
  408. package/dist/pages/containers.d.ts +1 -1
  409. package/dist/pages/containers.js +1 -1
  410. package/dist/pages/index.d.ts +4 -2
  411. package/dist/pages/index.js +4 -2
  412. package/dist/pages/inheritance.d.ts +2 -2
  413. package/dist/pages/layers.d.ts +50 -0
  414. package/dist/pages/layers.js +97 -0
  415. package/dist/pages/rename-page.js +1 -1
  416. package/dist/pages/stacks/writes.js +48 -22
  417. package/dist/pages/standard-fields.d.ts +1 -1
  418. package/dist/pages/system-pages.d.ts +5 -3
  419. package/dist/pages/system-pages.js +16 -7
  420. package/dist/pages/world.d.ts +8 -1
  421. package/dist/pages/world.js +16 -4
  422. package/dist/pages/write-layer.d.ts +18 -0
  423. package/dist/pages/write-layer.js +108 -0
  424. package/dist/pages/write-page.d.ts +2 -2
  425. package/dist/pages/write-page.js +2 -2
  426. package/dist/rules/index.d.ts +1 -1
  427. package/dist/rules/index.js +1 -1
  428. package/dist/rules/search.d.ts +1 -1
  429. package/dist/rules/shown.d.ts +1 -1
  430. package/dist/server/dashboard/choices.js +3 -3
  431. package/dist/server/dashboard/files.js +5 -5
  432. package/dist/server/dashboard/index.d.ts +2 -2
  433. package/dist/server/dashboard/index.js +2 -2
  434. package/dist/server/dashboard/news.js +4 -3
  435. package/dist/server/dashboard/player.js +1 -1
  436. package/dist/server/dashboard/writes.js +10 -8
  437. package/dist/server/mcp.js +28 -13
  438. package/dist/systems/campaign-data.d.ts +15 -0
  439. package/dist/systems/campaign-data.js +85 -0
  440. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  441. package/dist/systems/{system-code.js → code.js} +2 -2
  442. package/dist/systems/game-system.d.ts +7 -61
  443. package/dist/systems/game-system.js +1 -984
  444. package/dist/systems/index.d.ts +6 -3
  445. package/dist/systems/index.js +6 -3
  446. package/dist/systems/installed.d.ts +31 -0
  447. package/dist/systems/installed.js +89 -0
  448. package/dist/systems/maps.d.ts +3 -0
  449. package/dist/systems/maps.js +9 -0
  450. package/dist/systems/read.d.ts +3 -0
  451. package/dist/systems/read.js +471 -0
  452. package/dist/systems/schema.d.ts +289 -0
  453. package/dist/systems/schema.js +243 -0
  454. package/dist/systems/settings.d.ts +19 -0
  455. package/dist/systems/settings.js +78 -0
  456. package/dist/systems/versions.d.ts +12 -0
  457. package/dist/systems/versions.js +52 -0
  458. package/dist/testing/index.js +1 -1
  459. package/instructions/import.md +1 -1
  460. package/instructions/length-a-few-sessions.md +1 -0
  461. package/instructions/length-one-evening.md +1 -0
  462. package/instructions/play.md +1 -1
  463. package/instructions/session-zero.md +1 -1
  464. package/instructions/setup.md +1 -1
  465. package/package.json +1 -1
  466. package/dist/commands/config.js +0 -917
  467. package/dist/commands/package.d.ts +0 -143
  468. package/dist/commands/package.js +0 -785
  469. package/dist/commands/scene.js +0 -894
  470. package/dist/commands/shared/worked-out.js +0 -805
  471. package/dist/dashboard/place/map-view.js +0 -417
  472. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  473. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  474. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  475. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  476. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  477. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  478. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  479. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  480. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  481. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  482. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  483. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  484. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  485. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  486. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  487. /package/dist/pages/{page-file.js → file.js} +0 -0
  488. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  489. /package/dist/pages/{page-types.js → types.js} +0 -0
  490. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  491. /package/dist/rules/{rule-book.js → book.js} +0 -0
  492. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  493. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -0,0 +1,163 @@
1
+ // A page as the viewer knows it: found by a name they know, its text, its sheet as the dashboard draws it, a place's look
2
+ import { readSettings } from "../../campaign/index.js";
3
+ import { lengthsInUnits } from "../../core/length.js";
4
+ import { comparableText } from "../../core/text.js";
5
+ import { readAmount } from "../../money/index.js";
6
+ import { declaredKind, entryPage, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, systemPageNamed, textsIn } from "../../pages/index.js";
7
+ import { shownImage } from "../shared/campaign/images.js";
8
+ import { campaignCoins } from "../shared/campaign/money.js";
9
+ import { campaignSystem, systemWordsOf } from "../shared/campaign/world.js";
10
+ import { knownSecretsApart, knownText, knowsPage, pageKnownBy, playerStory } from "../shared/characters/knowledge.js";
11
+ import { measuresOf } from "../shared/places/roads.js";
12
+ import { lineExperience } from "../shared/sheet/counters.js";
13
+ import { effectiveFields } from "../shared/sheet/effect-layer.js";
14
+ import { counterOf, experienceNeed, experienceProgress, sheetData, sheetHeadline, statBlock } from "../shared/sheet/sheet.js";
15
+ import { hasSheet } from "../shared/sheet/system-fields.js";
16
+ /** A page as the one whose view it is knows it (VIEW-3): its text, and the whole sheet when it is theirs or of their party. */
17
+ export function shownPage(root, context, world, knowledge, page, party) {
18
+ const system = campaignSystem(root, context);
19
+ // A companion who keeps no sheet shows the stat block of the creature it derives from (D-275).
20
+ const sheet = withItemImages(root, context, world, withCoins(speedInUnits(!party ? [] : hasSheet(world, page) ? sheetData(world, system, page) : statBlock(world, system, page), system, measuresOf(root, system)), campaignCoins(root, context).coins, system));
21
+ const language = readSettings(root).language;
22
+ const headline = party ? sheetHeadline(world, system, page, system === undefined || language === undefined ? undefined : systemWordsOf(root, system, language, context)) : undefined;
23
+ const cards = party && hasSheet(world, page) ? system?.sheetCards : undefined;
24
+ // Only the player's own characters act from the sheet: the others act as the master says (D-495). Talking to someone needs no game: a system without
25
+ // actions of its own still gives the player's characters theirs, none, so that the people around can be talked to.
26
+ const own = isPlayerCharacter(page) && (page === knowledge.pc || knowledge.each !== undefined);
27
+ const actions = own ? (system?.sheetActions ?? {}) : undefined;
28
+ const story = own ? playerStory(page) : undefined;
29
+ const secrets = knownSecretsApart(world, knowledge, page);
30
+ const whoKnows = pageKnownBy(knowledge, page);
31
+ const unaware = whoKnows === undefined ? [] : (knowledge.each ?? []).map((one) => one.pc).filter((pc) => pc.fields.status !== "dead" && !whoKnows.includes(pc.name)).map((pc) => pc.name);
32
+ return {
33
+ kind: "page",
34
+ title: `${page.name} (${page.type ?? "page"})`,
35
+ ...(headline === undefined ? {} : { headline }),
36
+ sheet,
37
+ ...(cards === undefined ? {} : { cards }),
38
+ ...(actions === undefined ? {} : { actions }),
39
+ text: knownText(world, knowledge, page),
40
+ ...(secrets.length === 0 ? {} : { knownBy: secrets }),
41
+ ...(whoKnows === undefined ? {} : { whoKnows }),
42
+ ...(unaware.length === 0 ? {} : { unaware }),
43
+ ...(story === undefined ? {} : { story }),
44
+ };
45
+ }
46
+ /**
47
+ * The page the player character knows by this name, of the campaign or of the system, or by one of its aliases (VIEW-2): only one it knows, so that neither two
48
+ * pages of one name nor an alias tells that a page it does not know exists.
49
+ */
50
+ export function knownPage(world, knowledge, name) {
51
+ const one = (pages) => {
52
+ const known = pages.filter((page) => knowsPage(knowledge, page));
53
+ return known.length === 1 ? known[0] : undefined;
54
+ };
55
+ const system = systemPageNamed(world, name);
56
+ const named = pagesWithName(world, name);
57
+ const aliased = world.pages.filter((page) => textsIn(page.fields.aliases).some((alias) => comparableText(alias.trim()) === comparableText(name.trim())));
58
+ return one(named) ?? (named.length === 0 && system !== undefined ? one([system]) : undefined) ?? one(aliased);
59
+ }
60
+ /** A name as the view may write it: one of a page the player character knows; undefined for any other, which the view tells another way (D-254). */
61
+ export function shownName(world, knowledge, name) {
62
+ return knownNamedPage(world, knowledge, name)?.name;
63
+ }
64
+ /** The page the player character knows by a name the log writes, of the campaign or of the system. */
65
+ export function knownNamedPage(world, knowledge, name) {
66
+ if (typeof name !== "string") {
67
+ return undefined;
68
+ }
69
+ // The log keeps a renamed page by its old name, among its aliases (D-417).
70
+ const reference = parsePageReference(name).name;
71
+ const page = pagesWithNameOrAlias(world, reference)[0] ?? systemPageNamed(world, reference);
72
+ return page !== undefined && knowsPage(knowledge, page) ? page : undefined;
73
+ }
74
+ /** A place as a chapter of the story shows it (D-384): its kind and its picture, else that of the nearest place that holds it, as the player character knows them. */
75
+ export function placeLook(root, context, world, knowledge, name) {
76
+ const page = knownNamedPage(world, knowledge, name);
77
+ if (page === undefined) {
78
+ return {};
79
+ }
80
+ const known = (base) => knowsPage(knowledge, base);
81
+ const kind = page.fields.kind;
82
+ const picture = [page, ...locate(world, page).chain.filter(known)].map((holder) => shownImage(root, context, world, holder, known)).find((image) => image !== undefined);
83
+ return { ...(typeof kind === "string" ? { kind } : {}), ...(picture === undefined ? {} : { picture }) };
84
+ }
85
+ /** The values of someone's line as data (DAT-2): as the line writes them, with a counter's limits, and beside the experience what the next level needs (PRO-6). */
86
+ export function lineValues(world, page, counters) {
87
+ const fields = effectiveFields(world, page);
88
+ const experience = lineExperience(world, page, counters);
89
+ return Object.entries(counters).map(([field, value]) => {
90
+ const kind = declaredKind(world, field);
91
+ const counter = counterOf(world, fields, field, value);
92
+ const progress = experienceProgress(world, fields, field);
93
+ const beside = field === experience?.field ? experience.text : undefined;
94
+ const need = beside === undefined ? undefined : experienceNeed(world, fields, field);
95
+ return {
96
+ field,
97
+ ...(kind === undefined ? {} : { kind }),
98
+ text: String(value).trim(),
99
+ ...(counter === undefined ? {} : { counter }),
100
+ marks: 0,
101
+ ...(beside === undefined ? {} : { beside }),
102
+ ...(progress === undefined ? {} : { progress }),
103
+ ...(need === undefined ? {} : { levelNeed: need }),
104
+ };
105
+ });
106
+ }
107
+ /** A sheet with the speed told in the units of the story (D-328), as the maps tell their measures: 30 ft is 9 m in metric. */
108
+ function speedInUnits(groups, system, measures) {
109
+ const field = system?.grid?.speed;
110
+ // The load in kilograms for a player who counts in metric, with the system's pound (LOAD-2).
111
+ const pound = system?.pound;
112
+ const kilograms = (text) => text.replace(/[\d.]+/g, (number) => String(Math.round(Number(number) * (pound ?? 1) * 10) / 10)).replace(/\s*\p{L}[\p{L}.]*\s*$/u, " kg");
113
+ // The speeds the system works out are lengths too (SPD-1).
114
+ const declared = (name, wanted) => Object.entries(system?.fields ?? {}).some(([key, kind]) => kind === wanted && comparableText(key) === comparableText(name));
115
+ const inUnits = (text) => lengthsInUnits(text, measures.units, measures.imperial);
116
+ // What is beside a length is told in the same units, as the speed written beside the one worked out, and left out when it says the same.
117
+ const lengthTold = ({ beside, ...value }) => {
118
+ const text = inUnits(value.text);
119
+ const shownBeside = beside === undefined ? undefined : inUnits(beside);
120
+ return { ...value, text, ...(shownBeside === undefined || shownBeside === text ? {} : { beside: shownBeside }) };
121
+ };
122
+ const told = (value) => (field !== undefined && comparableText(value.field) === comparableText(field)) || declared(value.field, "length")
123
+ ? lengthTold(value)
124
+ : (value.field === "load" || declared(value.field, "weight")) && measures.units === "metric" && pound !== undefined
125
+ ? { ...value, text: kilograms(value.text), ...(value.load === undefined ? {} : { load: inKilograms(value.load, pound) }) }
126
+ : value;
127
+ return groups.map((group) => ({ ...group, values: group.values.map(told), ...(group.items === undefined ? {} : { items: group.items.map((item) => ({ ...item, values: item.values.map(told) })) }) }));
128
+ }
129
+ /** A load's numbers in kilograms, at the system's pound (LOAD-2). */
130
+ function inKilograms(load, pound) {
131
+ const kilograms = (weight) => Math.round(weight * pound * 10) / 10;
132
+ return { ...load, value: kilograms(load.value), ...(load.limit === undefined ? {} : { limit: kilograms(load.limit) }) };
133
+ }
134
+ /** The groups of a sheet with the icon of every thing carried, its page's or the kind's it derives from (D-431); the page's name is the engine's, not the page's to show. */
135
+ function withItemImages(root, context, world, groups) {
136
+ return groups.map((group) => ({
137
+ ...group,
138
+ ...(group.items === undefined ? {} : {
139
+ items: group.items.map(({ page, ...item }) => {
140
+ const found = page === undefined ? undefined : entryPage(world, page);
141
+ const image = found === undefined ? undefined : shownImage(root, context, world, found);
142
+ return image === undefined ? item : { ...item, image };
143
+ }),
144
+ }),
145
+ }));
146
+ }
147
+ /** The groups of a sheet with the coins of every value that is money, as the dashboard draws them (D-431). */
148
+ function withCoins(groups, coins, system) {
149
+ return groups.map((group) => ({ ...group, values: group.values.map((value) => valueCoins(value, coins, system)) }));
150
+ }
151
+ /** A value with its coins when it is money (MON-2), from the coin worth most, each with its metal when the game names it; as it was otherwise. */
152
+ export function valueCoins(value, coins, system) {
153
+ const purse = coins === undefined || value.counter !== undefined ? undefined : readAmount(value.text, coins);
154
+ if (purse === undefined || coins === undefined) {
155
+ return value;
156
+ }
157
+ const metalOf = (coin) => coin.names.map((name) => system?.coinMetals[name]).find((metal) => metal !== undefined);
158
+ const shown = [...coins].sort((first, second) => second.value - first.value).filter((coin) => (purse[coin.name] ?? 0) > 0).map((coin) => {
159
+ const metal = metalOf(coin);
160
+ return { coin: coin.name, count: purse[coin.name] ?? 0, ...(metal === undefined ? {} : { metal }) };
161
+ });
162
+ return shown.length === 0 ? value : { ...value, coins: shown };
163
+ }
@@ -2,8 +2,8 @@ import type { Context } from "../../core/context.ts";
2
2
  import type { Effect, EffectEnd } from "../../effects/index.ts";
3
3
  import { type Page, type World } from "../../pages/index.ts";
4
4
  import type { GameSystem } from "../../systems/index.ts";
5
- import { type SeenEffect } from "../shared/effects.ts";
6
- import { type Knowledge } from "../shared/knowledge.ts";
5
+ import { type Knowledge } from "../shared/characters/knowledge.ts";
6
+ import { type SeenEffect } from "../shared/scene/effects.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;
@@ -167,3 +167,8 @@ export declare function strangerImage(root: string, context: Context, world: Wor
167
167
  file: string;
168
168
  version: number;
169
169
  } | undefined;
170
+ /**
171
+ * "Scontro all'ossario (combat), at Ossario, with Ennio, Lena, uomo col coltello, brigante 1 and brigante 2": the open scene as the player sees it, with the words
172
+ * of the page (D-254, D-416): who the character does not know by what it sees of them, else someone, and two or more of them as others.
173
+ */
174
+ export declare function sceneLine(sight: PlaceSight, named: (name: unknown) => string | undefined, self?: Page): string | undefined;
@@ -5,18 +5,18 @@ import { readCounter } from "../../counters/index.js";
5
5
  import { reachable, squareName, squaresApart, withoutMapBlock } from "../../grid/index.js";
6
6
  import { hiddenImageName } from "../../images/index.js";
7
7
  import { environmentAt, isPlayerCharacter, links, 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 { inKnownWords, knownSecretsApart, knownText, knowsPage, readsLink } 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";
8
+ import { imageFile, ownImage, shownImage } from "../shared/campaign/images.js";
9
+ import { campaignSystem } from "../shared/campaign/world.js";
10
+ import { inKnownWords, knownSecretsApart, knownText, knowsPage, readsLink } from "../shared/characters/knowledge.js";
11
+ import { isTurnOf, movedThisTurn, sideOf, walkingSpeed } from "../shared/places/grid-moves.js";
12
+ import { placeGrid, placeLook, standing } from "../shared/places/grids.js";
13
+ import { measuresOf } from "../shared/places/roads.js";
14
+ import { conditionMark, effectParts, keptEffects, systemNamed } from "../shared/scene/effects.js";
15
+ import { copyPage, readOpenScene } from "../shared/scene/scene.js";
16
+ import { pageCounters } from "../shared/sheet/counters.js";
17
+ import { effectsOf } from "../shared/sheet/effect-layer.js";
18
+ import { tokenIcon } from "../shared/sheet/sheet.js";
19
+ import { turnMarks } from "../shared/sheet/turn-uses.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;
@@ -416,3 +416,21 @@ function seenName(scene, name) {
416
416
  function seenOf(scene, name) {
417
417
  return Object.entries(scene.seen ?? {}).find(([key]) => comparableText(key) === comparableText(parsePageReference(name).name))?.[1];
418
418
  }
419
+ /**
420
+ * "Scontro all'ossario (combat), at Ossario, with Ennio, Lena, uomo col coltello, brigante 1 and brigante 2": the open scene as the player sees it, with the words
421
+ * of the page (D-254, D-416): who the character does not know by what it sees of them, else someone, and two or more of them as others.
422
+ */
423
+ export function sceneLine(sight, named, self) {
424
+ const { scene } = readOpenScene(sight.root);
425
+ if (scene === undefined) {
426
+ return undefined;
427
+ }
428
+ // A character agent's view leaves out the one whose view it is (VIEW-10).
429
+ const names = sceneNames(sight, self);
430
+ const strangers = names.filter((name) => name === "someone").length;
431
+ // Who is someone, counted where the first of them stands.
432
+ const present = names.flatMap((name, index) => (name !== "someone" ? [name] : names.indexOf("someone") === index ? [strangers === 1 ? "someone" : `${strangers} others`] : []));
433
+ const place = named(scene.place);
434
+ const listed = present.length <= 1 ? present.join("") : `${present.slice(0, -1).join(", ")} and ${present.at(-1)}`;
435
+ return `${scene.title} (${scene.type})${place === undefined ? "" : `, at ${place}`}${present.length === 0 ? "" : `, with ${listed}`}`;
436
+ }
@@ -0,0 +1,245 @@
1
+ import type { Mood } from "../../core/mood.ts";
2
+ import type { CoinSide, NotationPart, ThrownDie } from "../../dice/index.ts";
3
+ import type { ActVerb, SheetVerb, SystemWords } from "../../systems/index.ts";
4
+ import type { CalendarDay } from "../../time/index.ts";
5
+ import type { PlayerSetting } from "../config/dashboard.ts";
6
+ import type { ShownImport } from "../import/import.ts";
7
+ import type { Mode } from "../shared/campaign/mode.ts";
8
+ import type { ResetPoint, SaveMode } from "../shared/campaign/saves.ts";
9
+ import type { MoodMoment } from "../shared/characters/moods.ts";
10
+ import type { SeenEffect } from "../shared/scene/effects.ts";
11
+ import type { SheetGroupData, SheetValue } from "../shared/sheet/sheet.ts";
12
+ import type { ShownChapter, ShownQuest, ShownThought } from "./journal.ts";
13
+ import type { ShownMap } from "./map.ts";
14
+ import type { ShownPlace, ShownScene } from "./place.ts";
15
+ import type { KnownEntry, ShownCalendar, ShownDocument } from "./world.ts";
16
+ /** What the player may see: the party, the open quests and scene and the diary; a page as the player character knows it, whole or one section; or nothing. */
17
+ export type ViewResult = {
18
+ kind: "none";
19
+ language?: string;
20
+ importing?: ShownImport;
21
+ } | {
22
+ kind: "overview";
23
+ campaign: string;
24
+ /** The campaign's language, in which the dashboard writes its own words (D-394). */
25
+ language?: string;
26
+ /** The game system's words in the campaign's language, when it has them (D-403). */
27
+ words?: SystemWords;
28
+ /** The game system's own verbs of the sheet, beside the engine's, which its words translate (D-514). */
29
+ verbs?: Record<string, SheetVerb>;
30
+ /** The game system the campaign plays, for the dashboard: its name, what it is, and what its source asks a work that uses it to say (D-284). */
31
+ system?: {
32
+ name: string;
33
+ title: string;
34
+ attribution?: string;
35
+ };
36
+ now?: string;
37
+ /** The day of the calendar it is now, when the campaign has one (TIM-8). */
38
+ calendar?: CalendarDay;
39
+ /** The master's mood, which the robot shows, and their last moment, which the dashboard shows for a few seconds when it is new (MOOD-4, MOOD-6). */
40
+ master: {
41
+ mood: Mood;
42
+ moment?: MoodMoment;
43
+ };
44
+ party: PartyMember[];
45
+ /** With more than one living player character, the one in the foreground, whose place the view gives (VIEW-12). */
46
+ foreground?: string;
47
+ /** Where the player character is, and the open scene, as data for the dashboard (VIEW-6). */
48
+ place?: ShownPlace;
49
+ openScene?: ShownScene;
50
+ quests: string[];
51
+ scene?: string;
52
+ diary: string[];
53
+ total: number;
54
+ rolls: ShownRoll[];
55
+ /** How many public rolls the log has, for the dashboard to offer more (D-302). */
56
+ rollsTotal: number;
57
+ /** How many problems the campaign's files have, which the dashboard tells the player the master fixes (validate). */
58
+ problems: number;
59
+ /** An import under way, which the dashboard tells the player (D-491 (11)). */
60
+ importing?: ShownImport;
61
+ /** The campaign's language, when this computer is translating the game system's pages into it, which the dashboard tells the player (D-539). */
62
+ textsTranslating?: string;
63
+ } | {
64
+ kind: "page";
65
+ title: string;
66
+ /** The line under the character's name on the dashboard (D-288). */
67
+ headline?: string;
68
+ sheet: SheetGroupData[];
69
+ /** Where the dashboard puts the groups of the sheet, as the system says (D-295), and those at hand in a fight (D-315). */
70
+ cards?: {
71
+ rail: string[];
72
+ order: string[];
73
+ atHand: string[];
74
+ };
75
+ /** The fields whose items the player acts with, each with its verbs, as the system says (D-495). */
76
+ actions?: Record<string, ActVerb[]>;
77
+ text: string;
78
+ /** With more than one player character, the secrets the text shows that only some of them discovered, by the name the text gives them, and who (VIEW-12). */
79
+ knownBy?: {
80
+ secret: string;
81
+ who: string[];
82
+ }[];
83
+ /** With more than one player character, who knows the page, when not all of them do (VIEW-12). */
84
+ whoKnows?: string[];
85
+ /** With who knows, the living player characters who do not, played as not knowing it. */
86
+ unaware?: string[];
87
+ /** The player character's opening text, which the player may propose on the dashboard (D-373, D-386); left out on other pages. */
88
+ story?: string;
89
+ } | {
90
+ kind: "section";
91
+ title: string;
92
+ lines: string[];
93
+ text: string;
94
+ /** With more than one player character, who knows it, when not all of them do (VIEW-12). */
95
+ knownBy?: string[];
96
+ }
97
+ /** What another character knows and lived, for the character agent voicing them (VIEW-10): their own page as they know it, now, the pages they know, the secrets, the scenes. */
98
+ | {
99
+ kind: "memory";
100
+ title: string;
101
+ sheet: SheetGroupData[];
102
+ text: string;
103
+ now?: string;
104
+ /** The places that hold them, the nearest first, those they know. */
105
+ place: string[];
106
+ /** The open scene, when they are in it, as they see it. */
107
+ scene?: string;
108
+ /** "Marta (character): A shepherd's widow of Whitecrag.": each page they know, in a line. */
109
+ known: string[];
110
+ /** "Piet#Fate: Killed by orcs.": the secrets of other pages they discovered. */
111
+ discovered: string[];
112
+ /** "day 3, 19:05 · Ambush at Mill Ford: Four orcs ambushed the party.": the scenes they were in. */
113
+ lived: string[];
114
+ /** A companion's last lines of their diary, with their dates (DIA-3); none for anyone else. */
115
+ thoughts?: string[];
116
+ /** For a living player character played while their player is away (D-480 (4)), the prudence it is played with. */
117
+ away?: string;
118
+ /** For a living companion, or a player character played while its player is away, the player's standing orders to the companions (D-563). */
119
+ orders?: string[];
120
+ }
121
+ /** The world map as the player character knows it (VIEW-7). */
122
+ | ({
123
+ kind: "map";
124
+ } & ShownMap)
125
+ /** The player's settings, which the dashboard changes (D-341). */
126
+ | {
127
+ kind: "settings";
128
+ settings: PlayerSetting[];
129
+ }
130
+ /** The setup (D-370): the mode, the campaign's name and whether it is still its folder's, what the next mode still needs, and the setup's questions. */
131
+ | {
132
+ kind: "setup";
133
+ mode: Mode;
134
+ name: string;
135
+ folderName: boolean;
136
+ missing: string[];
137
+ questions: PlayerSetting[];
138
+ }
139
+ /** The journal (D-367): the quests the player character knows, and the story by scenes. */
140
+ | {
141
+ kind: "journal";
142
+ now?: string;
143
+ quests: ShownQuest[];
144
+ chapters: ShownChapter[];
145
+ thoughts: ShownThought[];
146
+ }
147
+ /** The World section but the map (VIEW-11): the pages the character knows, each as it knows it, the documents it has or read, and the calendar. */
148
+ | {
149
+ kind: "world";
150
+ known: KnownEntry[];
151
+ documents: ShownDocument[];
152
+ calendar: ShownCalendar;
153
+ }
154
+ /** The saves and what the mode allows (D-359): make one, go back to some, start over from the first. */
155
+ | {
156
+ kind: "saves";
157
+ mode: SaveMode;
158
+ rule: string;
159
+ saves: ShownSave[];
160
+ make: boolean;
161
+ reset: ResetPoint[];
162
+ wentBack?: string;
163
+ } | {
164
+ kind: "unknown";
165
+ text: string;
166
+ };
167
+ /** Someone of the party as the player sees them (VIEW-1): the dashboard draws them (D-272), the chat reads them as a line. */
168
+ export interface PartyMember {
169
+ name: string;
170
+ role: "pc" | "companion";
171
+ dead: boolean;
172
+ /** Their picture, their own or from a base the player character knows (D-267, D-277): its file, and when it last changed. */
173
+ image?: {
174
+ file: string;
175
+ version: number;
176
+ };
177
+ /** The icon on their token, as their class, when the system gives one (D-414). */
178
+ icon?: string;
179
+ /** Where they are, as far as the player character knows the places: the places that hold them, the nearest first; elsewhere, or in the open (D-254, TRV-13). */
180
+ place?: string[] | "elsewhere" | "open";
181
+ /** The numbers of their line, in its order (DAT-2). */
182
+ counters: SheetValue[];
183
+ /** Their effects, each with its end when it has one, and as the line writes it. */
184
+ effects: SeenEffect[];
185
+ /** Their mood (MOOD-6); none when neutral, or dead. */
186
+ mood?: Mood;
187
+ /** What they are, as the line under a sheet's name says it in the campaign's language: Level 3 Cleric (D-288, D-409). */
188
+ headline?: string;
189
+ /** At the system's down point, as hp 0 (D-516). */
190
+ down?: true;
191
+ }
192
+ /** A roll the player may see (D-279): theirs, or one the master showed; never a hidden one. */
193
+ export interface ShownRoll {
194
+ id: string;
195
+ /** The game date, when there is one. */
196
+ date?: string;
197
+ /** When it was rolled, in real time: ISO 8601 (D-299). */
198
+ at: string;
199
+ /** Who rolled it: the player, or the master. */
200
+ by: "player" | "master";
201
+ /** For whom, as the player character knows them: Ettore, Lupa; creature or someone for one it does not know. */
202
+ who?: string;
203
+ /** What the roll is, as the player sees it: the check the master asked, or what the master names a roll of theirs, such as Bite (D-292). */
204
+ check?: string;
205
+ /** The picture of whom it is for, when the player character knows them and they have one (D-286). */
206
+ image?: {
207
+ file: string;
208
+ version: number;
209
+ };
210
+ /** Whom it is for is someone the player character does not know by name: a creature, someone (D-286). */
211
+ stranger?: true;
212
+ /** The notation in parts, for the dashboard to say in words when it does more than add its dice, as 2d20 keeping the highest, +5 (D-292). */
213
+ words?: NotationPart[];
214
+ notation: string;
215
+ total: number;
216
+ /** What the faces mean, in place of the total, when an extension's roll says it: 4 pins, no 1 (D-505). */
217
+ says?: string;
218
+ /** How each die turned out, by its face in order, when an extension's roll says it: good, bad or none (D-507). */
219
+ tones?: ("good" | "bad" | null)[];
220
+ /** The coins of a toss, each face in order, which the page says in its language in place of the total; a toss shows no dice (COIN-3). */
221
+ toss?: CoinSide[];
222
+ /** Whether the page throws it in its tray too, or keeps it in the list alone, when the master says so (VIEW-13). */
223
+ tray?: boolean;
224
+ text: string;
225
+ dice: ThrownDie[];
226
+ }
227
+ /**
228
+ * A save as the dashboard shows it (D-359): its number and label, the words that name it and the game date, when it was made in real time, the place the party
229
+ * was in with its kind and picture, the point of a reset it is, and whether the player may go back to it, never to such a point, which is a reset's (D-361).
230
+ */
231
+ export interface ShownSave {
232
+ number: number;
233
+ label: string;
234
+ name?: string;
235
+ date?: string;
236
+ at?: string;
237
+ place?: string;
238
+ kind?: string;
239
+ picture?: {
240
+ file: string;
241
+ version: number;
242
+ };
243
+ point?: ResetPoint;
244
+ load: boolean;
245
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Context } from "../../core/context.ts";
2
+ import type { ViewResult } from "./result.ts";
3
+ /** The saves, newest first, each with whether the mode lets the player go back to it; whether they may make one, and the points they may start over from (D-359). */
4
+ export declare function shownSaves(root: string, context: Context): Extract<ViewResult, {
5
+ kind: "saves";
6
+ }>;
@@ -0,0 +1,53 @@
1
+ import { readLog } from "../../core/log.js";
2
+ import { locate, pagesWithNameOrAlias } from "../../pages/index.js";
3
+ import { shownImage } from "../shared/campaign/images.js";
4
+ import { campaignSaves, loadRefusal, loadRule, mayGoBack, resetPoints, resetSave, saveMode, savesWhy, wentBackTo } from "../shared/campaign/saves.js";
5
+ import { campaignWorld } from "../shared/campaign/world.js";
6
+ /** The saves, newest first, each with whether the mode lets the player go back to it; whether they may make one, and the points they may start over from (D-359). */
7
+ export function shownSaves(root, context) {
8
+ const mode = saveMode(root);
9
+ const saves = campaignSaves(root);
10
+ const why = savesWhy(root);
11
+ const points = new Map(resetPoints.flatMap((point) => {
12
+ const save = resetSave(saves, why, point);
13
+ return save === undefined ? [] : [[save.number, point]];
14
+ }));
15
+ const world = campaignWorld(root, context);
16
+ const dead = mayGoBack(root, world);
17
+ const made = new Map(readLog(root).filter((entry) => entry.type === "saved").map((entry) => [Number(entry.data.save), entry]));
18
+ const madeOf = (number) => {
19
+ const entry = made.get(number);
20
+ const { label, place } = (entry?.data ?? {});
21
+ return {
22
+ ...(typeof label === "string" ? { name: label } : {}),
23
+ ...(entry?.date === undefined ? {} : { date: entry.date }),
24
+ ...(entry === undefined ? {} : { at: entry.at }),
25
+ ...(typeof place === "string" ? savedPlace(root, context, world, place) : {}),
26
+ };
27
+ };
28
+ return {
29
+ kind: "saves",
30
+ mode,
31
+ rule: loadRule(mode),
32
+ saves: saves.map((save) => ({
33
+ number: save.number,
34
+ label: save.label,
35
+ ...madeOf(save.number),
36
+ ...(points.has(save.number) ? { point: points.get(save.number) } : {}),
37
+ load: !points.has(save.number) && loadRefusal(mode, saves, save, dead) === undefined,
38
+ })).toReversed(),
39
+ make: mode === "free",
40
+ reset: resetPoints.filter((point) => [...points.values()].includes(point)),
41
+ // Until the player confirms a new chat with the master (D-362).
42
+ ...(wentBackTo(root) === undefined ? {} : { wentBack: wentBackTo(root) }),
43
+ };
44
+ }
45
+ /** The place a save was made in, with its picture, else that of the nearest place that holds it, as a room of the inn shows the inn. */
46
+ function savedPlace(root, context, world, name) {
47
+ const page = pagesWithNameOrAlias(world, name)[0];
48
+ const kind = page?.fields.kind;
49
+ const picture = page === undefined
50
+ ? undefined
51
+ : [page, ...locate(world, page).chain].map((holder) => shownImage(root, context, world, holder)).find((image) => image !== undefined);
52
+ return { place: name, ...(typeof kind === "string" ? { kind } : {}), ...(picture === undefined ? {} : { picture }) };
53
+ }
@@ -0,0 +1,32 @@
1
+ import type { LogEntry } from "../../core/log.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import type { StoryFact } from "./journal.ts";
4
+ import type { ShownRoll } from "./result.ts";
5
+ export declare const diaryLines = 10;
6
+ export declare const rollsShown = 20;
7
+ /**
8
+ * A public roll of the log as the player sees it: who rolled, for whom as the character knows them, else as the scene it was rolled in named them (`seen`, D-421),
9
+ * the check, the dice; never the master's why (VIEW-4).
10
+ */
11
+ export declare function shownRoll(world: World, entry: LogEntry, named: (name: unknown) => string | undefined, picture: (name: unknown) => ShownRoll["image"], seen: Record<string, string> | undefined): ShownRoll;
12
+ /** How many rolls the dashboard asks for: a whole number from 1. */
13
+ export declare function rollCount(asked: string | undefined): number;
14
+ /** How many lines of the diary are asked: a whole number from 1. */
15
+ export declare function diaryCount(asked: string | undefined): number;
16
+ /**
17
+ * A public line of the log as the diary tells it (VIEW-4): the facts, with the game date, never the master's why; who and where the character does not know as
18
+ * someone and somewhere (D-254). Lines of no story, as a setting changed, are left out.
19
+ */
20
+ export declare function diaryLine(world: World, entry: LogEntry, named: (name: unknown) => string | undefined): string[];
21
+ /**
22
+ * A public line of the log as a fact of the story (VIEW-4, VIEW-9), as data the dashboard writes in its language: who and where as the character knows them,
23
+ * someone, creature and somewhere for those it does not (D-254); undefined for a line of no story.
24
+ */
25
+ export declare function storyFact(world: World, entry: LogEntry, named: (name: unknown) => string | undefined): StoryFact | undefined;
26
+ /**
27
+ * What the character saw of those it did not know, in the scene each roll was rolled in, by the roll's id: the seen words the log kept since that scene opened,
28
+ * and for the scene still open its own, which a scene opened before the log kept them has alone.
29
+ */
30
+ export declare function seenByRoll(log: LogEntry[], open: Record<string, string> | undefined): Map<string, Record<string, string>>;
31
+ /** Whether a name is a copy's in a scene, such as Lupo mannaro 1: a creature's name and a number, with no page of its own. */
32
+ export declare function isCopyName(world: World, name: unknown): boolean;