rpg-engine 0.15.0 → 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 (486) hide show
  1. package/dist/campaign/index.d.ts +1 -1
  2. package/dist/campaign/index.js +1 -1
  3. package/dist/campaign/settings.d.ts +6 -0
  4. package/dist/campaign/settings.js +22 -1
  5. package/dist/cli/cli.js +1 -1
  6. package/dist/cli/command-line.js +1 -1
  7. package/dist/commands/advance.d.ts +1 -1
  8. package/dist/commands/advance.js +6 -6
  9. package/dist/commands/ask.js +7 -7
  10. package/dist/commands/change/amounts.d.ts +32 -0
  11. package/dist/commands/change/amounts.js +150 -0
  12. package/dist/commands/change/change.d.ts +4 -54
  13. package/dist/commands/change/change.js +19 -749
  14. package/dist/commands/change/damage.d.ts +30 -0
  15. package/dist/commands/change/damage.js +73 -2
  16. package/dist/commands/change/dice.d.ts +34 -0
  17. package/dist/commands/change/dice.js +59 -0
  18. package/dist/commands/change/fields.d.ts +37 -0
  19. package/dist/commands/change/fields.js +156 -0
  20. package/dist/commands/change/holder.d.ts +48 -0
  21. package/dist/commands/change/holder.js +162 -0
  22. package/dist/commands/change/recipe-pace.js +1 -1
  23. package/dist/commands/change/recipe.d.ts +58 -0
  24. package/dist/commands/change/recipe.js +179 -0
  25. package/dist/commands/choices.js +3 -3
  26. package/dist/commands/config/config.d.ts +15 -0
  27. package/dist/commands/config/config.js +355 -0
  28. package/dist/commands/config/custom-levels.d.ts +7 -0
  29. package/dist/commands/config/custom-levels.js +32 -0
  30. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  31. package/dist/commands/config/dashboard.js +171 -0
  32. package/dist/commands/config/entries.d.ts +17 -0
  33. package/dist/commands/config/entries.js +76 -0
  34. package/dist/commands/config/news.d.ts +7 -0
  35. package/dist/commands/config/news.js +88 -0
  36. package/dist/commands/config/shown.d.ts +9 -0
  37. package/dist/commands/config/shown.js +80 -0
  38. package/dist/commands/config/words.d.ts +27 -0
  39. package/dist/commands/config/words.js +204 -0
  40. package/dist/commands/effect.js +9 -9
  41. package/dist/commands/find.js +1 -1
  42. package/dist/commands/image.js +6 -6
  43. package/dist/commands/import/import.d.ts +0 -2
  44. package/dist/commands/import/import.js +45 -44
  45. package/dist/commands/import/run.js +1 -1
  46. package/dist/commands/index.js +3 -3
  47. package/dist/commands/init.js +2 -2
  48. package/dist/commands/install.js +1 -1
  49. package/dist/commands/instructions.js +6 -6
  50. package/dist/commands/mode.d.ts +2 -2
  51. package/dist/commands/mode.js +8 -8
  52. package/dist/commands/mood.js +4 -4
  53. package/dist/commands/move.js +10 -10
  54. package/dist/commands/package/consent.d.ts +11 -0
  55. package/dist/commands/package/consent.js +52 -0
  56. package/dist/commands/package/here.d.ts +51 -0
  57. package/dist/commands/package/here.js +128 -0
  58. package/dist/commands/package/install.d.ts +10 -0
  59. package/dist/commands/package/install.js +337 -0
  60. package/dist/commands/package/package.d.ts +18 -0
  61. package/dist/commands/package/package.js +236 -0
  62. package/dist/commands/package/result.d.ts +90 -0
  63. package/dist/commands/package/result.js +1 -0
  64. package/dist/commands/package/uninstall.d.ts +6 -0
  65. package/dist/commands/package/uninstall.js +70 -0
  66. package/dist/commands/rename.js +3 -3
  67. package/dist/commands/reveal.js +5 -5
  68. package/dist/commands/roll/roll.js +11 -9
  69. package/dist/commands/roll/tables.js +1 -1
  70. package/dist/commands/rules.d.ts +2 -2
  71. package/dist/commands/rules.js +3 -3
  72. package/dist/commands/save.d.ts +1 -1
  73. package/dist/commands/save.js +2 -2
  74. package/dist/commands/scene/close.d.ts +18 -0
  75. package/dist/commands/scene/close.js +179 -0
  76. package/dist/commands/scene/members.d.ts +14 -0
  77. package/dist/commands/scene/members.js +32 -0
  78. package/dist/commands/scene/open.d.ts +6 -0
  79. package/dist/commands/scene/open.js +298 -0
  80. package/dist/commands/scene/result.d.ts +98 -0
  81. package/dist/commands/scene/result.js +2 -0
  82. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  83. package/dist/commands/scene/scene.js +210 -0
  84. package/dist/commands/scene/turns.d.ts +18 -0
  85. package/dist/commands/scene/turns.js +229 -0
  86. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
  87. package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
  88. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  89. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  90. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  91. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  92. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  93. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  94. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  95. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  96. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  97. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  98. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  99. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  100. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  101. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  102. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  103. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  104. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  105. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  106. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  107. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  108. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  109. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  110. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  111. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  112. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  113. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  114. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  115. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  116. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  117. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  118. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  119. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  120. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  121. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  122. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  123. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  124. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  125. package/dist/commands/shared/characters/orders.d.ts +4 -0
  126. package/dist/commands/shared/characters/orders.js +10 -0
  127. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
  128. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
  129. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  130. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  131. package/dist/commands/shared/examples.js +2 -2
  132. package/dist/commands/shared/packages/catalog.js +2 -2
  133. package/dist/commands/shared/packages/code.d.ts +1 -1
  134. package/dist/commands/shared/packages/code.js +8 -8
  135. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  136. package/dist/commands/shared/packages/extensions.js +1 -1
  137. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  138. package/dist/commands/shared/packages/hooks.js +1 -1
  139. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  140. package/dist/commands/shared/packages/widgets.js +3 -3
  141. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  142. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  143. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  144. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  145. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  146. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  147. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  148. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  149. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  150. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  151. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  152. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  153. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  154. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  155. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  156. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  157. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  158. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  159. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  160. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  161. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  162. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  163. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  164. package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
  165. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  166. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  167. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  168. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  169. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  170. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  171. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  172. package/dist/commands/shared/sheet/effect-values.js +69 -0
  173. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  174. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  175. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  176. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  177. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  178. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  179. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  180. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  181. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  182. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  183. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
  184. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  185. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  186. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  187. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  188. package/dist/commands/shared/sheet/system-fields.js +45 -0
  189. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  190. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  191. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  192. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  193. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  194. package/dist/commands/shared/sheet/worked-out.js +291 -0
  195. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  196. package/dist/commands/shared/sheet/worked-text.js +55 -0
  197. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  198. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  199. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  200. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  201. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  202. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  203. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  204. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  205. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  206. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  207. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  208. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  209. package/dist/commands/show.d.ts +3 -0
  210. package/dist/commands/show.js +28 -9
  211. package/dist/commands/status.d.ts +2 -1
  212. package/dist/commands/status.js +28 -22
  213. package/dist/commands/thoughts.js +3 -3
  214. package/dist/commands/trade.js +8 -8
  215. package/dist/commands/translate.d.ts +1 -1
  216. package/dist/commands/translate.js +3 -3
  217. package/dist/commands/travel/open.d.ts +1 -1
  218. package/dist/commands/travel/open.js +2 -2
  219. package/dist/commands/travel/route.js +7 -6
  220. package/dist/commands/travel/travel.d.ts +1 -1
  221. package/dist/commands/travel/travel.js +8 -8
  222. package/dist/commands/validate.js +3 -3
  223. package/dist/commands/view/journal.d.ts +2 -2
  224. package/dist/commands/view/journal.js +2 -2
  225. package/dist/commands/view/map.d.ts +1 -1
  226. package/dist/commands/view/map.js +6 -6
  227. package/dist/commands/view/memory.d.ts +16 -0
  228. package/dist/commands/view/memory.js +90 -0
  229. package/dist/commands/view/page.d.ts +32 -0
  230. package/dist/commands/view/page.js +163 -0
  231. package/dist/commands/view/place.d.ts +7 -2
  232. package/dist/commands/view/place.js +30 -12
  233. package/dist/commands/view/result.d.ts +245 -0
  234. package/dist/commands/view/result.js +1 -0
  235. package/dist/commands/view/saves.d.ts +6 -0
  236. package/dist/commands/view/saves.js +53 -0
  237. package/dist/commands/view/story.d.ts +32 -0
  238. package/dist/commands/view/story.js +227 -0
  239. package/dist/commands/view/view.d.ts +26 -292
  240. package/dist/commands/view/view.js +26 -534
  241. package/dist/commands/view/world.d.ts +1 -1
  242. package/dist/commands/view/world.js +3 -3
  243. package/dist/commands/write/checks.d.ts +42 -0
  244. package/dist/commands/write/checks.js +291 -0
  245. package/dist/commands/write/here.d.ts +1 -1
  246. package/dist/commands/write/here.js +5 -5
  247. package/dist/commands/write/inheritance.d.ts +40 -0
  248. package/dist/commands/write/inheritance.js +189 -0
  249. package/dist/commands/write/input.d.ts +29 -0
  250. package/dist/commands/write/input.js +124 -0
  251. package/dist/commands/write/layer.d.ts +36 -0
  252. package/dist/commands/write/layer.js +48 -0
  253. package/dist/commands/write/notes.d.ts +22 -0
  254. package/dist/commands/write/notes.js +76 -0
  255. package/dist/commands/write/progression.d.ts +27 -0
  256. package/dist/commands/write/progression.js +175 -0
  257. package/dist/commands/write/write.d.ts +1 -0
  258. package/dist/commands/write/write.js +32 -816
  259. package/dist/core/files.d.ts +2 -0
  260. package/dist/core/files.js +7 -0
  261. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  262. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  263. package/dist/core/session-store.js +3 -3
  264. package/dist/core/store.d.ts +2 -2
  265. package/dist/core/store.js +18 -4
  266. package/dist/dashboard/acts/acts.js +1 -1
  267. package/dist/dashboard/acts/sending.js +110 -0
  268. package/dist/dashboard/acts/sheet.js +2 -2
  269. package/dist/dashboard/acts/strip.js +1 -1
  270. package/dist/dashboard/address.js +6 -0
  271. package/dist/dashboard/api.js +1 -1
  272. package/dist/dashboard/app.js +47 -171
  273. package/dist/dashboard/dice/roller.js +1 -1
  274. package/dist/dashboard/dice/sets.js +2 -2
  275. package/dist/dashboard/dice/stage.js +1 -1
  276. package/dist/dashboard/dice/tray.js +6 -6
  277. package/dist/dashboard/guide/ar.md +5 -3
  278. package/dist/dashboard/guide/cs.md +5 -3
  279. package/dist/dashboard/guide/da.md +5 -3
  280. package/dist/dashboard/guide/de.md +5 -3
  281. package/dist/dashboard/guide/el.md +5 -3
  282. package/dist/dashboard/guide/en.md +2 -0
  283. package/dist/dashboard/guide/es.md +4 -2
  284. package/dist/dashboard/guide/fi.md +5 -3
  285. package/dist/dashboard/guide/fr.md +4 -2
  286. package/dist/dashboard/guide/he.md +4 -2
  287. package/dist/dashboard/guide/hi.md +6 -4
  288. package/dist/dashboard/guide/hu.md +4 -2
  289. package/dist/dashboard/guide/is.md +5 -3
  290. package/dist/dashboard/guide/it.md +3 -1
  291. package/dist/dashboard/guide/ja.md +7 -5
  292. package/dist/dashboard/guide/ko.md +6 -4
  293. package/dist/dashboard/guide/nb.md +4 -2
  294. package/dist/dashboard/guide/nl.md +5 -3
  295. package/dist/dashboard/guide/pl.md +4 -2
  296. package/dist/dashboard/guide/pt.md +4 -2
  297. package/dist/dashboard/guide/ro.md +5 -3
  298. package/dist/dashboard/guide/ru.md +5 -3
  299. package/dist/dashboard/guide/sv.md +5 -3
  300. package/dist/dashboard/guide/tr.md +6 -4
  301. package/dist/dashboard/guide/uk.md +4 -2
  302. package/dist/dashboard/guide/zh.md +5 -3
  303. package/dist/dashboard/help/help.js +3 -3
  304. package/dist/dashboard/i18n/ar.json +4 -0
  305. package/dist/dashboard/i18n/cs.json +4 -0
  306. package/dist/dashboard/i18n/da.json +4 -0
  307. package/dist/dashboard/i18n/de.json +4 -0
  308. package/dist/dashboard/i18n/el.json +4 -0
  309. package/dist/dashboard/i18n/es.json +4 -0
  310. package/dist/dashboard/i18n/fi.json +4 -0
  311. package/dist/dashboard/i18n/fr.json +4 -0
  312. package/dist/dashboard/i18n/he.json +4 -0
  313. package/dist/dashboard/i18n/hi.json +4 -0
  314. package/dist/dashboard/i18n/hu.json +4 -0
  315. package/dist/dashboard/i18n/is.json +4 -0
  316. package/dist/dashboard/i18n/it.json +4 -0
  317. package/dist/dashboard/i18n/ja.json +5 -1
  318. package/dist/dashboard/i18n/ko.json +4 -0
  319. package/dist/dashboard/i18n/nb.json +4 -0
  320. package/dist/dashboard/i18n/nl.json +4 -0
  321. package/dist/dashboard/i18n/pl.json +4 -0
  322. package/dist/dashboard/i18n/pt.json +4 -0
  323. package/dist/dashboard/i18n/ro.json +4 -0
  324. package/dist/dashboard/i18n/ru.json +4 -0
  325. package/dist/dashboard/i18n/sv.json +4 -0
  326. package/dist/dashboard/i18n/tr.json +4 -0
  327. package/dist/dashboard/i18n/uk.json +4 -0
  328. package/dist/dashboard/i18n/zh.json +4 -0
  329. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  330. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  331. package/dist/dashboard/kit.js +3 -3
  332. package/dist/dashboard/packages/ask-card.js +3 -3
  333. package/dist/dashboard/packages/catalog.js +196 -0
  334. package/dist/dashboard/packages/engine.js +87 -0
  335. package/dist/dashboard/packages/installed.js +53 -0
  336. package/dist/dashboard/packages/library.js +97 -0
  337. package/dist/dashboard/packages/outcomes.js +45 -0
  338. package/dist/dashboard/packages/packages.js +20 -576
  339. package/dist/dashboard/packages/page-code.js +15 -2
  340. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  341. package/dist/dashboard/packages/rows.js +84 -0
  342. package/dist/dashboard/packages/share.js +44 -0
  343. package/dist/dashboard/packages/widgets.js +3 -3
  344. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  345. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  346. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  347. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  348. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  349. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  350. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  351. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  352. package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
  353. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  354. package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
  355. package/dist/dashboard/place/key.js +24 -0
  356. package/dist/dashboard/place/paper.js +67 -0
  357. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  358. package/dist/dashboard/place/things.js +129 -0
  359. package/dist/dashboard/place/tokens.js +93 -0
  360. package/dist/dashboard/place/view.js +124 -0
  361. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  362. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  363. package/dist/dashboard/{choices.js → play/choices.js} +9 -9
  364. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  365. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  366. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  367. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  368. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  369. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  370. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  371. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  372. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  373. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  374. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  375. package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
  376. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  377. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  378. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  379. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  380. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  381. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  382. package/dist/dashboard/shell/shown.js +37 -0
  383. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  384. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  385. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  386. package/dist/dashboard/style.css +74 -3
  387. package/dist/dashboard/world/calendar.js +4 -4
  388. package/dist/dashboard/world/drawing.js +92 -0
  389. package/dist/dashboard/world/key.js +21 -0
  390. package/dist/dashboard/world/lore.js +5 -5
  391. package/dist/dashboard/world/map-card.js +186 -0
  392. package/dist/dashboard/world/place-card.js +39 -0
  393. package/dist/dashboard/world/places.js +29 -0
  394. package/dist/dashboard/world/world.js +9 -341
  395. package/dist/extensions/extension.d.ts +1 -1
  396. package/dist/extensions/extension.js +1 -1
  397. package/dist/images/images.js +12 -9
  398. package/dist/index.d.ts +1 -1
  399. package/dist/languages/index.d.ts +1 -1
  400. package/dist/languages/index.js +1 -1
  401. package/dist/packages/npm.js +1 -1
  402. package/dist/page.d.ts +2 -2
  403. package/dist/page.js +1 -1
  404. package/dist/pages/check.js +23 -1
  405. package/dist/pages/containers.d.ts +1 -1
  406. package/dist/pages/containers.js +1 -1
  407. package/dist/pages/index.d.ts +4 -2
  408. package/dist/pages/index.js +4 -2
  409. package/dist/pages/inheritance.d.ts +2 -2
  410. package/dist/pages/layers.d.ts +50 -0
  411. package/dist/pages/layers.js +97 -0
  412. package/dist/pages/rename-page.js +1 -1
  413. package/dist/pages/stacks/writes.js +48 -22
  414. package/dist/pages/standard-fields.d.ts +1 -1
  415. package/dist/pages/system-pages.d.ts +5 -3
  416. package/dist/pages/system-pages.js +16 -7
  417. package/dist/pages/world.d.ts +8 -1
  418. package/dist/pages/world.js +16 -4
  419. package/dist/pages/write-layer.d.ts +18 -0
  420. package/dist/pages/write-layer.js +108 -0
  421. package/dist/pages/write-page.d.ts +2 -2
  422. package/dist/pages/write-page.js +2 -2
  423. package/dist/rules/index.d.ts +1 -1
  424. package/dist/rules/index.js +1 -1
  425. package/dist/rules/search.d.ts +1 -1
  426. package/dist/rules/shown.d.ts +1 -1
  427. package/dist/server/dashboard/choices.js +3 -3
  428. package/dist/server/dashboard/files.js +5 -5
  429. package/dist/server/dashboard/index.d.ts +2 -2
  430. package/dist/server/dashboard/index.js +2 -2
  431. package/dist/server/dashboard/news.js +4 -3
  432. package/dist/server/dashboard/player.js +1 -1
  433. package/dist/server/dashboard/writes.js +9 -7
  434. package/dist/server/mcp.js +28 -13
  435. package/dist/systems/campaign-data.d.ts +15 -0
  436. package/dist/systems/campaign-data.js +85 -0
  437. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  438. package/dist/systems/{system-code.js → code.js} +2 -2
  439. package/dist/systems/game-system.d.ts +7 -61
  440. package/dist/systems/game-system.js +1 -984
  441. package/dist/systems/index.d.ts +6 -3
  442. package/dist/systems/index.js +6 -3
  443. package/dist/systems/installed.d.ts +31 -0
  444. package/dist/systems/installed.js +89 -0
  445. package/dist/systems/maps.d.ts +3 -0
  446. package/dist/systems/maps.js +9 -0
  447. package/dist/systems/read.d.ts +3 -0
  448. package/dist/systems/read.js +471 -0
  449. package/dist/systems/schema.d.ts +289 -0
  450. package/dist/systems/schema.js +243 -0
  451. package/dist/systems/settings.d.ts +19 -0
  452. package/dist/systems/settings.js +78 -0
  453. package/dist/systems/versions.d.ts +12 -0
  454. package/dist/systems/versions.js +52 -0
  455. package/dist/testing/index.js +1 -1
  456. package/instructions/import.md +1 -1
  457. package/instructions/play.md +1 -1
  458. package/package.json +1 -1
  459. package/dist/commands/config.js +0 -948
  460. package/dist/commands/package.d.ts +0 -143
  461. package/dist/commands/package.js +0 -785
  462. package/dist/commands/scene.js +0 -894
  463. package/dist/commands/shared/worked-out.js +0 -805
  464. package/dist/dashboard/place/map-view.js +0 -417
  465. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  466. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  467. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  468. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  469. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  470. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  471. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  472. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  473. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  474. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  475. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  476. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  477. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  478. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  479. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  480. /package/dist/pages/{page-file.js → file.js} +0 -0
  481. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  482. /package/dist/pages/{page-types.js → types.js} +0 -0
  483. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  484. /package/dist/rules/{rule-book.js → book.js} +0 -0
  485. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  486. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -4,5 +4,5 @@ export { campaignFileName, findCampaign, houseRulesFolderName, requireCampaign }
4
4
  export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.ts";
5
5
  export { lastChoices, rememberChoice, rememberedSettings } from "./last-choices.ts";
6
6
  export { type CountedByGame, customLevel, customLevels, customSettings, difficulties, difficultyItems, itemMeaning, leveled, type LeveledSetting, rigorItems, rigors, startingLevels } from "./levels.ts";
7
- export { type CampaignSettings, changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, characterWays, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, diceWays, efforts, entrySettingNames, lengths, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, saveModes, settingDescription, settingMeaning, type SettingName, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.ts";
7
+ export { type CampaignSettings, changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, characterWays, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, diceWays, efforts, entrySettingNames, lengths, lethalities, listLimits, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, saveModes, settingDescription, settingMeaning, type SettingName, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.ts";
8
8
  export { type CampaignState, changeState, changeStateAt, readState, readStateValues } from "./state.ts";
@@ -5,5 +5,5 @@ export { campaignFileName, findCampaign, houseRulesFolderName, requireCampaign }
5
5
  export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.js";
6
6
  export { lastChoices, rememberChoice, rememberedSettings } from "./last-choices.js";
7
7
  export { customLevel, customLevels, customSettings, difficulties, difficultyItems, itemMeaning, leveled, rigorItems, rigors, startingLevels } from "./levels.js";
8
- export { changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, characterWays, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, diceWays, efforts, entrySettingNames, lengths, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, saveModes, settingDescription, settingMeaning, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.js";
8
+ export { changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, characterWays, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, diceWays, efforts, entrySettingNames, lengths, lethalities, listLimits, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, saveModes, settingDescription, settingMeaning, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.js";
9
9
  export { changeState, changeStateAt, readState, readStateValues } from "./state.js";
@@ -229,6 +229,7 @@ export declare const settingsSchema: z.ZodObject<{
229
229
  }>>;
230
230
  lines: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodArray<z.ZodPreprocess<z.ZodString, unknown>>, unknown>>>;
231
231
  veils: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodArray<z.ZodPreprocess<z.ZodString, unknown>>, unknown>>>;
232
+ orders: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodArray<z.ZodPreprocess<z.ZodString, unknown>>, unknown>>>;
232
233
  table: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodArray<z.ZodPreprocess<z.ZodString, unknown>>, unknown>>>;
233
234
  precedents: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodArray<z.ZodPreprocess<z.ZodString, unknown>>, unknown>>>;
234
235
  learned: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodArray<z.ZodPreprocess<z.ZodString, unknown>>, unknown>>>;
@@ -250,6 +251,11 @@ export declare const settingsSchema: z.ZodObject<{
250
251
  export declare const settingNames: SettingName[];
251
252
  /** The settings that hold a list, changed one item at a time; none of them is ever missing in play. */
252
253
  export declare const listSettingNames: SettingName[];
254
+ /** The most items a list setting takes, and the longest each may be, where it has a limit: the player's standing orders, always before the master (D-563). */
255
+ export declare const listLimits: Partial<Record<SettingName, {
256
+ items: number;
257
+ length: number;
258
+ }>>;
253
259
  /** The settings that hold entries by name, what the campaign adds to its game system (CAM-1): given or removed one entry at a time. */
254
260
  export declare const mapSettingNames: SettingName[];
255
261
  /** The settings that hold entries by name: what the campaign adds to its game system, where the dashboard shows the extensions' widgets (D-502), and the items of a custom difficulty or rigor (T-132). */
@@ -134,6 +134,7 @@ export function changeListSetting(root, name, change) {
134
134
  list.add(document.createNode(item.trim().normalize("NFC")));
135
135
  }
136
136
  }
137
+ checkListLimits(setting, change.add ?? [], held.length, list.items.length);
137
138
  // A list emptied stays, as []: it still answers the setup (MOD-3).
138
139
  if (JSON.stringify(list.toJSON()) === before) {
139
140
  return false;
@@ -374,6 +375,7 @@ export const settingsSchema = z.object({
374
375
  + "unset, each app keeps its own"),
375
376
  lines: listSetting.describe("what never appears in the game"),
376
377
  veils: listSetting.describe("what happens only off screen, without details"),
378
+ orders: listSetting.describe("the player's standing orders to the companions, in their words, kept until they lift one"),
377
379
  table: listSetting.describe("the table's agreements: what the master promised about how the game is played"),
378
380
  precedents: listSetting.describe("the rulings made without the text, each starting with the name of the rule in the system's language: Poisoned: …"),
379
381
  learned: listSetting.describe("the game's mechanics the master has explained, by their names in the system's language: explained again only when the player gets one wrong"),
@@ -399,7 +401,9 @@ export const settingsSchema = z.object({
399
401
  /** The settings that the config command shows and changes. */
400
402
  export const settingNames = Object.keys(settingsSchema.shape);
401
403
  /** The settings that hold a list, changed one item at a time; none of them is ever missing in play. */
402
- export const listSettingNames = ["lines", "veils", "table", "precedents", "learned", "library", "status-line"];
404
+ export const listSettingNames = ["lines", "veils", "orders", "table", "precedents", "learned", "library", "status-line"];
405
+ /** The most items a list setting takes, and the longest each may be, where it has a limit: the player's standing orders, always before the master (D-563). */
406
+ export const listLimits = { orders: { items: 6, length: 120 } };
403
407
  /** The settings that hold entries by name, what the campaign adds to its game system (CAM-1): given or removed one entry at a time. */
404
408
  export const mapSettingNames = ["fields", "tables", "computed", "counters", "recipes", "travel", "values", "condition-icons"];
405
409
  /** The settings that hold entries by name: what the campaign adds to its game system, where the dashboard shows the extensions' widgets (D-502), and the items of a custom difficulty or rigor (T-132). */
@@ -433,6 +437,23 @@ function listNode(document, setting) {
433
437
  }
434
438
  return node;
435
439
  }
440
+ /**
441
+ * Refuses an item longer than its list takes, or a list grown past its most items (D-563); one written longer by hand still reads, and still loses items.
442
+ * Characters are counted as a reader counts them.
443
+ */
444
+ function checkListLimits(setting, added, before, after) {
445
+ const limits = listLimits[setting];
446
+ if (limits === undefined) {
447
+ return;
448
+ }
449
+ const long = added.map((item) => [...item.trim().normalize("NFC")].length).find((length) => length > limits.length);
450
+ if (long !== undefined) {
451
+ throw new Error(`"${setting}" takes items of at most ${limits.length} characters, and this one has ${long}: ask the player for a shorter one. Nothing changed.`);
452
+ }
453
+ if (after > limits.items && after > before) {
454
+ throw new Error(`"${setting}" holds at most ${limits.items} items, and has ${before}: remove one the player lifted first, or ask which to drop. Nothing changed.`);
455
+ }
456
+ }
436
457
  /** Writes campaign.yaml, if the settings are still valid; long values stay on one line. */
437
458
  function saveSettings(root, document) {
438
459
  validateSettings(document.toJS());
package/dist/cli/cli.js CHANGED
@@ -9,7 +9,7 @@ if (args.length === 1 && args[0] === "mcp") {
9
9
  await startMcpServer();
10
10
  }
11
11
  else if (args[0] === "--read-library") {
12
- const { readLibraryHere } = await import("../commands/shared/library-reader.js");
12
+ const { readLibraryHere } = await import("../commands/shared/books/library-reader.js");
13
13
  await readLibraryHere();
14
14
  }
15
15
  else if (args.length === 1 && args[0] === "--listen") {
@@ -2,7 +2,7 @@ import { parseArgs } from "node:util";
2
2
  import { z } from "zod";
3
3
  import { findCampaign } from "../campaign/index.js";
4
4
  import { commands } from "../commands/index.js";
5
- import { libraryRunner } from "../commands/shared/library-reader.js";
5
+ import { libraryRunner } from "../commands/shared/books/library-reader.js";
6
6
  import { loadCampaignCode, packageCommands } from "../commands/shared/packages/code.js";
7
7
  import { systemConfirm } from "../confirm/index.js";
8
8
  import { defaultContext, packagesFolder } from "../core/context.js";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { type TimePassed } from "./shared/advance.ts";
2
+ import { type TimePassed } from "./shared/time/advance.ts";
3
3
  export declare const advance: import("../core/registry.ts").Command<z.ZodObject<{
4
4
  by: z.ZodOptional<z.ZodString>;
5
5
  to: z.ZodOptional<z.ZodString>;
@@ -3,13 +3,13 @@ import { changeState, requireCampaign } from "../campaign/index.js";
3
3
  import { appendLogEntry } from "../core/log.js";
4
4
  import { defineCommand } from "../core/registry.js";
5
5
  import { addDuration, formatDuration, formatGameDate, lastGameDay, minutesBetween, readDuration, readGameDate } from "../time/index.js";
6
- import { calendarText, nextAfter, passedLines, passTime, unreadNotes } from "./shared/advance.js";
7
- import { newStateChecks } from "./shared/checks.js";
8
- import { dueEvents, dueText, isDated, plannedEvents } from "./shared/events.js";
6
+ import { newStateChecks } from "./shared/campaign/checks.js";
7
+ import { firstInChat } from "./shared/campaign/parts.js";
8
+ import { campaignWorld } from "./shared/campaign/world.js";
9
9
  import { timePassedLines } from "./shared/packages/code.js";
10
- import { firstInChat } from "./shared/parts.js";
11
- import { newDatedLogEntry, presentDate } from "./shared/time.js";
12
- import { campaignWorld } from "./shared/world.js";
10
+ import { calendarText, nextAfter, passedLines, passTime, unreadNotes } from "./shared/time/advance.js";
11
+ import { dueEvents, dueText, isDated, plannedEvents } from "./shared/time/events.js";
12
+ import { newDatedLogEntry, presentDate } from "./shared/time/time.js";
13
13
  export const advance = defineCommand({
14
14
  name: "advance",
15
15
  description: "Let time pass in the story: by a duration or to a later game date. "
@@ -10,15 +10,15 @@ import { findPage, loadWorld, locate, playerCharacters } from "../pages/index.js
10
10
  import { rollName } from "../systems/index.js";
11
11
  import { placeOnMap } from "./move.js";
12
12
  import { hasNames, namesAsZero, rollerOf, sheetDiceOf, withSheetValues } from "./roll/roll.js";
13
- import { restDice, spendDice } from "./shared/dice-pool.js";
14
- import { effectiveFields } from "./shared/effect-layer.js";
15
- import { placeGrid } from "./shared/grids.js";
13
+ import { campaignSystem, campaignWorld, systemWordsOf } from "./shared/campaign/world.js";
16
14
  import { textList } from "./shared/inputs.js";
17
15
  import { allSaid, packagesAsking, packagesRolled } from "./shared/packages/hooks.js";
18
- import { recipeNamed } from "./shared/recipes.js";
19
- import { knowledgeNote } from "./shared/sheet.js";
20
- import { newDatedLogEntry } from "./shared/time.js";
21
- import { campaignSystem, campaignWorld, systemWordsOf } from "./shared/world.js";
16
+ import { placeGrid } from "./shared/places/grids.js";
17
+ import { effectiveFields } from "./shared/sheet/effect-layer.js";
18
+ import { knowledgeNote } from "./shared/sheet/sheet.js";
19
+ import { restDice, spendDice } from "./shared/time/dice-pool.js";
20
+ import { recipeNamed } from "./shared/time/recipes.js";
21
+ import { newDatedLogEntry } from "./shared/time/time.js";
22
22
  // The words of the buttons, in the campaign's language, as the dashboard's languages (playtest 15); English for the others (ASK-7). A toss's for one coin and for
23
23
  // more (ASK-15).
24
24
  const buttonWords = {
@@ -0,0 +1,32 @@
1
+ import { type Coin, type Purse } from "../../money/index.ts";
2
+ /** One change worked out on a counter or on money, before it is written (D-92, MON-4). */
3
+ export interface Step {
4
+ before: number | string;
5
+ after: number | string;
6
+ /** How it was asked, for the log: by, spend or to, and how far it went beyond a limit. */
7
+ amount: Record<string, unknown>;
8
+ note: string;
9
+ /** For money: what the purse is worth in the first coin, when it holds other coins. */
10
+ total?: string;
11
+ /** Whether a base's value is the one the change leads to (INH-9). */
12
+ same(value: unknown): boolean;
13
+ }
14
+ /** A change to a counter: by, spend or to, within its limits (D-92). */
15
+ export declare function counterStep(input: {
16
+ by?: number | string;
17
+ spend?: number | string;
18
+ to?: number | string;
19
+ }, value: unknown, page: string, field: string, coins: Coin[] | undefined, limits?: {
20
+ min?: number;
21
+ max?: number;
22
+ hint?: {
23
+ made: string;
24
+ raise?: string;
25
+ };
26
+ }): Step;
27
+ /** A change to money (MON-4, MON-5): coins received with by, paid with spend or a negative by, the purse set with to. */
28
+ export declare function moneyStep(input: {
29
+ by?: number | string;
30
+ spend?: number | string;
31
+ to?: number | string;
32
+ }, purse: Purse, coins: Coin[], page: string, field: string): Step;
@@ -0,0 +1,150 @@
1
+ // Works out a change of a counter or money from by, spend or to, before anything is written
2
+ import { canSpend, changeCounter, counterLimit, formatCounter, isSafeCounter, readCounter, readCounterText } from "../../counters/index.js";
3
+ import { addCoins, formatAmount, formatTotal, isSafePurse, namesCoins, payCoins, readAmount, readSignedAmount, totalOf } from "../../money/index.js";
4
+ import { coinExamples } from "../shared/examples.js";
5
+ /** A change to a counter: by, spend or to, within its limits (D-92). */
6
+ export function counterStep(input, value, page, field, coins, limits = {}) {
7
+ const read = readCounter(value);
8
+ if (read === undefined) {
9
+ throw new Error(notCounterMessage(page, field, value, coins));
10
+ }
11
+ const before = limits.min === undefined ? read : { ...read, min: limits.min };
12
+ const counterChange = readChange(input, before, page, field, coins);
13
+ // How to change a maximum the game system works out, said when a value goes past it.
14
+ const raise = limits.hint?.raise === undefined ? "" : `; to raise the maximum, write ${limits.hint.raise}; to change it for a while, as a drain, give an effect that sets ${limits.hint.raise}`;
15
+ // A maximum the game system works out is given only as it works it out (FOR-7).
16
+ if ("to" in counterChange && limits.max !== undefined && counterChange.to.max !== undefined && counterChange.to.max !== limits.max) {
17
+ throw new Error(`The maximum of ${field} on ${page} is worked out by the game system: ${limits.hint?.made ?? limits.max}. Give the current value alone, such as to ${Math.min(counterChange.to.value, limits.max)}${raise}. Nothing changed.`);
18
+ }
19
+ // A value given with to keeps the minimum the system gives, for where it stands: 0 is no limit of a counter that goes below it.
20
+ const { counter: after, beyond } = changeCounter(before, counterChange);
21
+ // Above a maximum the game system works out, a value reads as the maximum (FOR-6): what change says it wrote would not be what is read.
22
+ if ("to" in counterChange && limits.max !== undefined && after.value > limits.max) {
23
+ throw new Error(`${field} on ${page} goes no higher than its maximum, which the game system works out: ${limits.hint?.made ?? limits.max}. Give to ${limits.max} or less${raise}. Nothing changed.`);
24
+ }
25
+ if (!isSafeCounter(after)) {
26
+ throw new Error(`${field} on ${page} would be too large to count exactly. Nothing changed.`);
27
+ }
28
+ const same = (base) => {
29
+ const counter = readCounter(base);
30
+ return counter !== undefined && formatCounter(counter) === formatCounter(after);
31
+ };
32
+ return { before: formatCounter(before), after: formatCounter(after), amount: { ...amountOf(counterChange), beyond: beyond === 0 ? undefined : beyond }, note: limitNote({ ...after, min: after.min ?? before.min }, beyond), same };
33
+ }
34
+ /** A change to money (MON-4, MON-5): coins received with by, paid with spend or a negative by, the purse set with to. */
35
+ export function moneyStep(input, purse, coins, page, field) {
36
+ const given = [input.by, input.spend, input.to].filter((part) => part !== undefined);
37
+ if (given.length !== 1) {
38
+ throw new Error(`Give one of by (coins received, or paid with a minus), spend (what is paid) or to (what the purse holds), such as spend "5 ${coinExamples(coins).smallCoin}".`);
39
+ }
40
+ // Coins in quotes, as a model may send "\"5 sp\"", are the coins.
41
+ const asked = typeof given[0] === "string" ? given[0].trim().replace(/^"(.*)"$/s, "$1") : given[0];
42
+ const parameter = input.by !== undefined ? "by" : input.spend !== undefined ? "spend" : "to";
43
+ const signed = typeof asked === "string" ? readSignedAmount(asked, coins) : undefined;
44
+ if (signed === undefined || (parameter !== "by" && String(asked).trim().startsWith("-"))) {
45
+ const example = `${parameter === "by" ? "+" : ""}${Math.abs(Number(String(asked).trim())) || 5} ${coins[0].name}`;
46
+ const what = parameter === "by" ? "coins to add or, with a minus, to pay" : "coins";
47
+ throw new Error(`"${String(asked)}" is not ${what} for ${field} on ${page}: give coins of the campaign (${coinNames(coins)}), such as ${parameter} "${example}".`);
48
+ }
49
+ const paying = parameter === "spend" || (parameter === "by" && signed.sign === -1);
50
+ if (paying && totalOf(signed.purse, coins) === 0) {
51
+ throw new Error(`Give ${parameter} the coins paid, such as ${parameter} "${parameter === "by" ? "-" : ""}5 ${coins[0].name}".`);
52
+ }
53
+ const payment = paying ? payCoins(purse, signed.purse, coins) : undefined;
54
+ if (paying && payment === undefined) {
55
+ throw new Error(`${page} has ${field} ${formatAmount(purse, coins)} (${formatTotal(purse, coins)}): cannot pay ${formatAmount(signed.purse, coins)} (${formatTotal(signed.purse, coins)}). Nothing changed.`);
56
+ }
57
+ const after = payment?.purse ?? (parameter === "to" ? signed.purse : addCoins(purse, signed.purse));
58
+ if (!isSafePurse(after, coins)) {
59
+ throw new Error(`${field} on ${page} would be too large to count exactly. Nothing changed.`);
60
+ }
61
+ const text = (coinsGiven) => (coinsGiven === undefined || Object.keys(coinsGiven).length === 0 ? undefined : formatAmount(coinsGiven, coins));
62
+ const handed = text(payment?.given);
63
+ const back = text(payment?.back);
64
+ const amount = formatAmount(signed.purse, coins);
65
+ const request = parameter === "to" ? { to: amount } : parameter === "spend" ? { spend: amount } : { by: `${signed.sign === -1 ? "-" : "+"}${amount}` };
66
+ const others = Object.keys(after).some((name) => name !== coins[0].name);
67
+ const same = (base) => {
68
+ const basePurse = readAmount(base, coins);
69
+ return basePurse !== undefined && formatAmount(basePurse, coins) === formatAmount(after, coins);
70
+ };
71
+ return {
72
+ before: formatAmount(purse, coins),
73
+ after: formatAmount(after, coins),
74
+ amount: { ...request, given: handed, back },
75
+ note: back !== undefined ? `${handed} given, ${back} back` : handed === undefined ? "" : `paid with ${handed}`,
76
+ total: others ? formatTotal(after, coins) : undefined,
77
+ same,
78
+ };
79
+ }
80
+ function readChange(input, counter, page, field, coins) {
81
+ const given = [input.by, input.spend, input.to].filter((part) => part !== undefined);
82
+ if (given.length !== 1) {
83
+ throw new Error("Give one of by (damage, healing), spend (what is paid or used up) or to (a value, max, or current/max).");
84
+ }
85
+ if (typeof input.by === "string" || typeof input.spend === "string") {
86
+ const parameter = typeof input.by === "string" ? "by" : "spend";
87
+ // A plain number given coins may be money written without them; a current/max counter is no purse.
88
+ const coinsAsked = counter.max === undefined && coins !== undefined && readSignedAmount(String(input.by ?? input.spend), coins) !== undefined;
89
+ const money = coinsAsked && coins !== undefined
90
+ ? `${field} on ${page} is a number, not money: to count it in coins, set it with its coins, such as set ${field}=${counter.value} ${coins[0].name}; or give ${parameter} a whole number.`
91
+ : undefined;
92
+ throw new Error(money ?? `${field} on ${page} is a counter: give ${parameter} a whole number, such as ${parameter === "by" ? "by -7" : "spend 1"}.`);
93
+ }
94
+ if (input.by !== undefined) {
95
+ return { by: input.by };
96
+ }
97
+ if (input.spend !== undefined) {
98
+ if (!canSpend(counter, input.spend)) {
99
+ const floor = (counter.min ?? 0) > 0 ? `, which goes no lower than ${counter.min}` : "";
100
+ throw new Error(input.spend > 0 ? `${page} has ${field} ${formatCounter(counter)}${floor}: cannot spend ${input.spend}. Nothing changed.` : "Give spend a number above 0.");
101
+ }
102
+ return { spend: input.spend };
103
+ }
104
+ return { to: readTarget(String(input.to).trim(), counter, page, field) };
105
+ }
106
+ /** The value given to `to`: max, a whole number, or current/max. */
107
+ function readTarget(target, counter, page, field) {
108
+ if (target.toLowerCase() === "max") {
109
+ if (counter.max === undefined) {
110
+ throw new Error(`${field} on ${page} has no maximum: give to a number, or write the field as current/max with write.`);
111
+ }
112
+ return { ...counter, value: counter.max };
113
+ }
114
+ const given = readCounterText(target);
115
+ if (given === undefined) {
116
+ throw new Error(`"${target}" is not a value for to: give a whole number, max, or current/max such as 15/15.`);
117
+ }
118
+ return given.max === undefined ? { ...counter, value: given.value } : given;
119
+ }
120
+ function amountOf(change) {
121
+ return "to" in change ? { to: formatCounter(change.to) } : change;
122
+ }
123
+ /** Where the counter stands, when it matters: at 0 or at its maximum, how far a change went beyond, or outside the limits. */
124
+ function limitNote(counter, beyond) {
125
+ const limit = counterLimit(counter);
126
+ const lowest = counter.min ?? 0;
127
+ const where = limit === "outside" ? (counter.max === undefined ? `below ${lowest}` : `outside ${lowest}–${counter.max}`) : limit ?? "";
128
+ return [where, beyond === 0 ? "" : `${Math.abs(beyond)} beyond`].filter((part) => part !== "").join(", ");
129
+ }
130
+ function notCounterMessage(page, field, value, coins) {
131
+ if (typeof value === "string" && readCounterText(value) !== undefined) {
132
+ return `${field} on ${page} is the text "${value}": write it without quotes, such as ${field}: ${value}, to make it a counter.`;
133
+ }
134
+ // Coins of the campaign after a number, such as "34 mo e 4 ma", meant money that does not read as an amount (MON-2).
135
+ if (typeof value === "string" && coins !== undefined && namesCoins(value, coins)) {
136
+ return `${field} on ${page} is "${value}", not money: write the coins one after the other, such as set ${field}=12 ${coins[0].name}.`;
137
+ }
138
+ const notCounter = `${field} on ${page} is ${JSON.stringify(value)}, not a counter: write a counter as a number (20) or as current/max (12/12).`;
139
+ const word = typeof value === "string" ? /\d+\s*(\p{L}[\p{L}\p{M}]*)/u.exec(value)?.[1] : undefined;
140
+ if (word === undefined) {
141
+ return notCounter;
142
+ }
143
+ return coins === undefined
144
+ ? `${notCounter} If it is money, the campaign needs its coins: set them with config, naming them as written here (${word}), each with its value in the smallest.`
145
+ : `${notCounter} If it is money, ${word} is not a coin of the campaign (${coinNames(coins)}): write it with those, or give a coin that name too with config, such as ${coins[0].name}/${word}.`;
146
+ }
147
+ /** "gp/mo, pp, sp, cp": the coins of the campaign, by all their names. */
148
+ function coinNames(coins) {
149
+ return coins.map((coin) => coin.names.join("/")).join(", ");
150
+ }
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- import { fireEvents } from "../shared/events.ts";
3
2
  export declare const change: import("../../core/registry.ts").Command<z.ZodObject<{
4
3
  page: z.ZodOptional<z.ZodString>;
5
4
  field: z.ZodOptional<z.ZodString>;
@@ -13,7 +12,7 @@ export declare const change: import("../../core/registry.ts").Command<z.ZodObjec
13
12
  }, z.core.$strip>, {
14
13
  recipe: string;
15
14
  system: string;
16
- outcomes: RecipeOutcome[];
15
+ outcomes: import("./recipe.ts").RecipeOutcome[];
17
16
  rules: string[];
18
17
  lasts?: string;
19
18
  buttons?: boolean;
@@ -26,19 +25,17 @@ export declare const change: import("../../core/registry.ts").Command<z.ZodObjec
26
25
  before: string;
27
26
  after: string;
28
27
  total?: string;
29
- /** "in Forma d'orso; at max; again as Lupo": the effect it changed on, the limit it reached, the base whose value the page reads again. */
30
28
  note: string;
31
29
  effect?: string;
32
30
  again?: string;
33
31
  changed: boolean;
34
- due: ReturnType<typeof fireEvents>["due"];
32
+ due: ReturnType<typeof import("../shared/time/events.ts").fireEvents>["due"];
35
33
  followers: string[];
36
34
  keepers: string[];
37
35
  thresholds: string[];
38
- /** What the change may break that someone keeps alive, and what shields the counter it lowered (EFF-14, DAT-14). */
39
36
  reminders: string[];
40
37
  } | {
41
- hiddenRoll?: HiddenDice | undefined;
38
+ hiddenRoll?: import("./dice.ts").HiddenDice | undefined;
42
39
  rolled: string;
43
40
  problems: string[];
44
41
  page: string;
@@ -46,60 +43,13 @@ export declare const change: import("../../core/registry.ts").Command<z.ZodObjec
46
43
  before: string;
47
44
  after: string;
48
45
  total?: string;
49
- /** "in Forma d'orso; at max; again as Lupo": the effect it changed on, the limit it reached, the base whose value the page reads again. */
50
46
  note: string;
51
47
  effect?: string;
52
48
  again?: string;
53
49
  changed: boolean;
54
- due: ReturnType<typeof fireEvents>["due"];
50
+ due: ReturnType<typeof import("../shared/time/events.ts").fireEvents>["due"];
55
51
  followers: string[];
56
52
  keepers: string[];
57
53
  thresholds: string[];
58
- /** What the change may break that someone keeps alive, and what shields the counter it lowered (EFF-14, DAT-14). */
59
54
  reminders: string[];
60
55
  }>;
61
- /** The dice in by, hidden: the roll's id, the fingerprint the player may ask for, and whether master-rolls hid them. */
62
- interface HiddenDice {
63
- id: string;
64
- fingerprint: string;
65
- screened: boolean;
66
- }
67
- /** What a step did to a counter or to money. */
68
- interface StepOutcome {
69
- page: string;
70
- field: string;
71
- before: string;
72
- after: string;
73
- total?: string;
74
- /** "in Forma d'orso; at max; again as Lupo": the effect it changed on, the limit it reached, the base whose value the page reads again. */
75
- note: string;
76
- effect?: string;
77
- again?: string;
78
- changed: boolean;
79
- due: ReturnType<typeof fireEvents>["due"];
80
- followers: string[];
81
- keepers: string[];
82
- thresholds: string[];
83
- /** What the change may break that someone keeps alive, and what shields the counter it lowered (EFF-14, DAT-14). */
84
- reminders: string[];
85
- }
86
- /**
87
- * What a recipe did to a page: the effects it ended, the steps it wrote, what it leaves to the player or, for a companion, to the master (D-206), and the
88
- * counters it leaves to the master.
89
- */
90
- interface RecipeOutcome {
91
- page: string;
92
- pc: boolean;
93
- ended: string[];
94
- steps: StepOutcome[];
95
- choices: string[];
96
- /** The dice the recipe lets the page spend that would give something, as hit-dice-d8 2/3, which the player chooses for the player character (ASK-14). */
97
- spendable: string[];
98
- notBroughtBack: string[];
99
- kept: string[];
100
- /** The effects without an end still on the page, which a rest may ask something of (EFF-15). */
101
- resting: string;
102
- /** Whether the recipe gave the page nothing, at 0 of what it needs or too soon after the last (RST-1). */
103
- barred: boolean;
104
- }
105
- export {};