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,289 @@
1
+ import { z } from "zod";
2
+ export declare const sheetEntryPattern: RegExp;
3
+ export declare const checkFieldPattern: RegExp;
4
+ export declare const travelSchema: z.ZodObject<{
5
+ paces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
6
+ pace: z.ZodOptional<z.ZodString>;
7
+ hours: z.ZodOptional<z.ZodNumber>;
8
+ rule: z.ZodOptional<z.ZodString>;
9
+ beyond: z.ZodOptional<z.ZodString>;
10
+ terrain: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
11
+ vehicles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
12
+ kinds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
13
+ vehicle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14
+ speed: z.ZodOptional<z.ZodString>;
15
+ hours: z.ZodOptional<z.ZodNumber>;
16
+ current: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strict>>>;
18
+ }, z.core.$strict>;
19
+ export declare const gridSchema: z.ZodObject<{
20
+ square: z.ZodString;
21
+ diagonal: z.ZodNumber;
22
+ difficult: z.ZodNumber;
23
+ speed: z.ZodString;
24
+ walking: z.ZodOptional<z.ZodString>;
25
+ size: z.ZodOptional<z.ZodString>;
26
+ footprints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
27
+ leaving: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strict>;
29
+ export declare const systemSchema: z.ZodObject<{
30
+ icons: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
31
+ widgets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
32
+ title: z.ZodString;
33
+ icon: z.ZodOptional<z.ZodString>;
34
+ place: z.ZodEnum<{
35
+ top: "top";
36
+ side: "side";
37
+ page: "page";
38
+ person: "person";
39
+ card: "card";
40
+ }>;
41
+ page: z.ZodOptional<z.ZodEnum<{
42
+ scene: "scene";
43
+ sheet: "sheet";
44
+ world: "world";
45
+ journal: "journal";
46
+ }>>;
47
+ order: z.ZodOptional<z.ZodInt>;
48
+ }, z.core.$strict>>>;
49
+ figures: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
50
+ width: z.ZodInt;
51
+ height: z.ZodInt;
52
+ mirror: z.ZodOptional<z.ZodBoolean>;
53
+ }, z.core.$strict>>>;
54
+ title: z.ZodString;
55
+ language: z.ZodString;
56
+ attribution: z.ZodOptional<z.ZodString>;
57
+ theme: z.ZodOptional<z.ZodString>;
58
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
59
+ number: "number";
60
+ length: "length";
61
+ text: "text";
62
+ counter: "counter";
63
+ "at-least": "at-least";
64
+ modifier: "modifier";
65
+ bonus: "bonus";
66
+ factor: "factor";
67
+ weight: "weight";
68
+ duration: "duration";
69
+ list: "list";
70
+ rolls: "rolls";
71
+ }>>>;
72
+ coins: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
73
+ "coin-metals": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
74
+ round: z.ZodOptional<z.ZodString>;
75
+ imperial: z.ZodOptional<z.ZodObject<{
76
+ mile: z.ZodString;
77
+ foot: z.ZodString;
78
+ pound: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strict>>;
80
+ "length-unit": z.ZodOptional<z.ZodString>;
81
+ "bonus-lists": z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ load: z.ZodOptional<z.ZodObject<{
83
+ field: z.ZodString;
84
+ limit: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
85
+ coins: z.ZodOptional<z.ZodNumber>;
86
+ weightless: z.ZodOptional<z.ZodString>;
87
+ bundle: z.ZodOptional<z.ZodString>;
88
+ stages: z.ZodOptional<z.ZodArray<z.ZodObject<{
89
+ name: z.ZodString;
90
+ when: z.ZodString;
91
+ }, z.core.$strict>>>;
92
+ }, z.core.$strict>>;
93
+ travel: z.ZodOptional<z.ZodObject<{
94
+ paces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
95
+ pace: z.ZodOptional<z.ZodString>;
96
+ hours: z.ZodOptional<z.ZodNumber>;
97
+ rule: z.ZodOptional<z.ZodString>;
98
+ beyond: z.ZodOptional<z.ZodString>;
99
+ terrain: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
100
+ vehicles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
101
+ kinds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
102
+ vehicle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
103
+ speed: z.ZodOptional<z.ZodString>;
104
+ hours: z.ZodOptional<z.ZodNumber>;
105
+ current: z.ZodOptional<z.ZodString>;
106
+ }, z.core.$strict>>>;
107
+ }, z.core.$strict>>;
108
+ grid: z.ZodOptional<z.ZodObject<{
109
+ square: z.ZodString;
110
+ diagonal: z.ZodNumber;
111
+ difficult: z.ZodNumber;
112
+ speed: z.ZodString;
113
+ walking: z.ZodOptional<z.ZodString>;
114
+ size: z.ZodOptional<z.ZodString>;
115
+ footprints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
116
+ leaving: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strict>>;
118
+ sheet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
119
+ "sheet-notes": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
120
+ "sheet-cards": z.ZodOptional<z.ZodObject<{
121
+ rail: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ order: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
+ "at-hand": z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ }, z.core.$strict>>;
125
+ "sheet-actions": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
126
+ "sheet-verbs": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
127
+ label: z.ZodString;
128
+ title: z.ZodString;
129
+ says: z.ZodString;
130
+ "says-on": z.ZodOptional<z.ZodString>;
131
+ "says-at": z.ZodOptional<z.ZodString>;
132
+ "says-self": z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strict>>>;
134
+ "sheet-headline": z.ZodOptional<z.ZodString>;
135
+ "sheet-icons": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
136
+ "token-icons": z.ZodOptional<z.ZodObject<{
137
+ field: z.ZodString;
138
+ icons: z.ZodRecord<z.ZodString, z.ZodString>;
139
+ }, z.core.$strict>>;
140
+ "sheet-dice": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
141
+ "sheet-knowledge": z.ZodOptional<z.ZodArray<z.ZodString>>;
142
+ "sheet-odds": z.ZodOptional<z.ZodObject<{
143
+ better: z.ZodString;
144
+ worse: z.ZodString;
145
+ when: z.ZodArray<z.ZodObject<{
146
+ fields: z.ZodArray<z.ZodString>;
147
+ better: z.ZodOptional<z.ZodString>;
148
+ worse: z.ZodOptional<z.ZodString>;
149
+ why: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strict>>;
151
+ }, z.core.$strict>>;
152
+ "roll-names": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
153
+ values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
154
+ "sheet-values": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
155
+ marks: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ "status-line": z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ thresholds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
158
+ recipes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
159
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"max">, z.ZodNumber]>>>;
160
+ regain: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
161
+ lower: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
162
+ needs: z.ZodOptional<z.ZodString>;
163
+ "once-per": z.ZodOptional<z.ZodString>;
164
+ lasts: z.ZodOptional<z.ZodString>;
165
+ spend: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
166
+ gives: z.ZodString;
167
+ adds: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
168
+ }, z.core.$strict>>>;
169
+ ends: z.ZodOptional<z.ZodArray<z.ZodString>>;
170
+ rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
171
+ }, z.core.$strict>>>;
172
+ conditions: z.ZodOptional<z.ZodArray<z.ZodString>>;
173
+ "condition-icons": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
174
+ upkeep: z.ZodOptional<z.ZodObject<{
175
+ daily: z.ZodString;
176
+ short: z.ZodString;
177
+ grace: z.ZodString;
178
+ worsens: z.ZodString;
179
+ water: z.ZodOptional<z.ZodString>;
180
+ lifestyle: z.ZodOptional<z.ZodObject<{
181
+ field: z.ZodString;
182
+ costs: z.ZodRecord<z.ZodString, z.ZodString>;
183
+ rules: z.ZodString;
184
+ }, z.core.$strict>>;
185
+ rules: z.ZodString;
186
+ }, z.core.$strict>>;
187
+ burning: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
188
+ lasts: z.ZodString;
189
+ spends: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$strict>>>;
191
+ bonds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
192
+ most: z.ZodNumber;
193
+ needs: z.ZodString;
194
+ while: z.ZodOptional<z.ZodString>;
195
+ rules: z.ZodString;
196
+ }, z.core.$strict>>>;
197
+ immune: z.ZodOptional<z.ZodString>;
198
+ oracle: z.ZodOptional<z.ZodObject<{
199
+ yes: z.ZodEnum<{
200
+ low: "low";
201
+ high: "high";
202
+ }>;
203
+ }, z.core.$strict>>;
204
+ "turn-uses": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
205
+ most: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
206
+ within: z.ZodOptional<z.ZodString>;
207
+ needs: z.ZodOptional<z.ZodString>;
208
+ "any-turn": z.ZodOptional<z.ZodBoolean>;
209
+ resets: z.ZodOptional<z.ZodEnum<{
210
+ "own turn": "own turn";
211
+ "each turn": "each turn";
212
+ }>>;
213
+ note: z.ZodOptional<z.ZodString>;
214
+ "note-when": z.ZodOptional<z.ZodString>;
215
+ }, z.core.$strict>>>;
216
+ "at-most": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
217
+ damage: z.ZodOptional<z.ZodObject<{
218
+ counter: z.ZodString;
219
+ halves: z.ZodString;
220
+ ignores: z.ZodString;
221
+ doubles: z.ZodString;
222
+ rules: z.ZodString;
223
+ }, z.core.$strict>>;
224
+ keeping: z.ZodOptional<z.ZodObject<{
225
+ counter: z.ZodString;
226
+ conditions: z.ZodOptional<z.ZodArray<z.ZodString>>;
227
+ rules: z.ZodString;
228
+ }, z.core.$strict>>;
229
+ combat: z.ZodOptional<z.ZodObject<{
230
+ track: z.ZodString;
231
+ "in-words": z.ZodOptional<z.ZodArray<z.ZodString>>;
232
+ inactive: z.ZodOptional<z.ZodArray<z.ZodString>>;
233
+ }, z.core.$strict>>;
234
+ down: z.ZodOptional<z.ZodObject<{
235
+ at: z.ZodString;
236
+ }, z.core.$strict>>;
237
+ checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
238
+ when: z.ZodString;
239
+ needs: z.ZodString;
240
+ say: z.ZodString;
241
+ }, z.core.$strict>>>;
242
+ tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
243
+ progression: z.ZodOptional<z.ZodObject<{
244
+ list: z.ZodString;
245
+ level: z.ZodOptional<z.ZodString>;
246
+ features: z.ZodString;
247
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
248
+ parts: z.ZodOptional<z.ZodObject<{
249
+ list: z.ZodString;
250
+ field: z.ZodString;
251
+ lists: z.ZodOptional<z.ZodArray<z.ZodString>>;
252
+ }, z.core.$strict>>;
253
+ experience: z.ZodOptional<z.ZodObject<{
254
+ field: z.ZodString;
255
+ table: z.ZodString;
256
+ rules: z.ZodOptional<z.ZodString>;
257
+ }, z.core.$strict>>;
258
+ }, z.core.$strict>>;
259
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
260
+ means: z.ZodString;
261
+ player: z.ZodOptional<z.ZodString>;
262
+ without: z.ZodOptional<z.ZodArray<z.ZodString>>;
263
+ "engine-settings": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
264
+ asks: z.ZodOptional<z.ZodArray<z.ZodString>>;
265
+ suggested: z.ZodOptional<z.ZodLiteral<true>>;
266
+ }, z.core.$strict>]>>>>;
267
+ versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
268
+ means: z.ZodString;
269
+ player: z.ZodOptional<z.ZodString>;
270
+ without: z.ZodOptional<z.ZodArray<z.ZodString>>;
271
+ "engine-settings": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
272
+ asks: z.ZodOptional<z.ZodArray<z.ZodString>>;
273
+ suggested: z.ZodOptional<z.ZodLiteral<true>>;
274
+ }, z.core.$strict>]>>>;
275
+ "engine-settings": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
276
+ rewards: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
277
+ from: z.ZodString;
278
+ overcome: z.ZodString;
279
+ }, z.core.$strict>>>;
280
+ "item-formulas": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
281
+ "always-in": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
282
+ computed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>>;
283
+ counters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
284
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
285
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
286
+ refill: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>;
287
+ shields: z.ZodOptional<z.ZodString>;
288
+ }, z.core.$strict>>>;
289
+ }, z.core.$strict>;
@@ -0,0 +1,243 @@
1
+ // The zod shape of system.yaml
2
+ import { isAbsolute } from "node:path";
3
+ import { z } from "zod";
4
+ import { fieldKinds } from "../core/field-kind.js";
5
+ import { lengthHelp, readLength, readSpeed, speedHelp } from "../core/length.js";
6
+ import { packagePartsShape } from "../core/packages/declarations.js";
7
+ import { comparableText } from "../core/text.js";
8
+ import { actVerbs, rulesetSetting } from "./game-system.js";
9
+ // An entry of the sheet: a field, ? when it is written only when it applies, and a field shown beside it in parentheses.
10
+ export const sheetEntryPattern = /^([^\s()?]+)(\?)?(?: \(([^\s()?]+)\))?$/;
11
+ // The dice a number of the sheet is rolled with: dice alone, as 1d20 or 2d6+1d4 (D-280).
12
+ const sheetDicePattern = /^\d*d\d+(?:\+\d*d\d+)*$/;
13
+ // A roll the game has a name for: dice of one kind, with the highest or the lowest kept or dropped, as 2d20kh1 (D-399).
14
+ const rollNamePattern = /^\d*d(?:\d+|%)(?:[kd][hl]\d*)?$/i;
15
+ // A group's icon on the dashboard: the d of an SVG path, its letters and numbers alone (D-284).
16
+ const iconPattern = /^[Mm][MmLlHhVvCcSsQqTtAaZz\d.,\s+-]*$/;
17
+ // What a state check reads (CHK-2): an effect by its name, or a field against a number, as hp <= 0.
18
+ export const checkFieldPattern = /^([\p{L}][\p{L}\p{M}\p{N}_-]*)\s*(<=|>=|!=|=|<|>)\s*(-?\d+)$/u;
19
+ /** A sentence of a system's verb, with the {names} the page fills (D-514). */
20
+ function phraseWith(names) {
21
+ const shown = names.map((name) => `{${name}}`).join(" and ");
22
+ return z.string().min(1).refine((text) => names.every((name) => text.includes(`{${name}}`)), `write it with ${shown}, which the page fills`);
23
+ }
24
+ const recipeSchema = z.object({
25
+ set: z.record(z.string(), z.union([z.literal("max"), z.number().int()])).optional(),
26
+ regain: z.record(z.string(), z.union([z.number(), z.string().min(1)])).optional(),
27
+ lower: z.record(z.string(), z.union([z.number().int().positive(), z.string().min(1)])).optional(),
28
+ needs: z.string().min(1).optional(),
29
+ "once-per": z.string().regex(/^(\d+d)?\s*(\d+h)?\s*(\d+m)?$/, "write it as a duration, such as 24h").optional(),
30
+ lasts: z.string().regex(/^(\d+d)?\s*(\d+h)?\s*(\d+m)?$/, "write it as a duration, such as 8h").optional(),
31
+ spend: z.record(z.string(), z.object({ gives: z.string().min(1), adds: z.union([z.string().min(1), z.number()]).optional() }).strict()).optional(),
32
+ ends: z.array(z.string().min(1)).optional(),
33
+ rules: z.array(z.string().min(1)).optional(),
34
+ }).strict();
35
+ const lengthSchema = z.string().refine((text) => readLength(text) !== undefined, `write it ${lengthHelp}`);
36
+ const speedSchema = z.string().refine((text) => readSpeed(text) !== undefined, `write ${speedHelp}`);
37
+ // A factor of speed, such as 1/2 for difficult terrain, or 0.5.
38
+ const factorSchema = z.union([z.number().positive(), z.string().regex(/^\d+\/[1-9]\d*$/, "write it as 1/2, or as a number such as 0.5")]);
39
+ const hoursSchema = z.number().positive().max(24);
40
+ const checkAtomSchema = z.string().trim().min(1, "give an effect's name, or a field against a number, such as hp <= 0");
41
+ const inWordsHelp = "give the words a foe's counter is heard in, from full to 0, such as [unhurt, hurt, badly hurt, down]";
42
+ const inWordsSchema = z.array(z.string().min(1), { error: inWordsHelp }).min(2, inWordsHelp);
43
+ export const travelSchema = z.object({
44
+ paces: z.record(z.string().min(1), speedSchema).optional(),
45
+ pace: z.string().min(1).optional(),
46
+ hours: hoursSchema.optional(),
47
+ rule: z.string().min(1).optional(),
48
+ beyond: z.string().min(1).optional(),
49
+ terrain: z.record(z.string().min(1), factorSchema).optional(),
50
+ vehicles: z.record(z.string().min(1), z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]), {
51
+ error: "give a field and the values of what is a vehicle, such as {category: drawn vehicle}",
52
+ }).optional(),
53
+ kinds: z.record(z.string().min(1), z.object({
54
+ vehicle: z.record(z.string().min(1), z.string().min(1)).refine((match) => Object.keys(match).length === 1, "give one field and its value, such as {category: waterborne vehicle}").optional(),
55
+ speed: z.string().min(1).optional(),
56
+ hours: hoursSchema.optional(),
57
+ current: speedSchema.optional(),
58
+ }).strict().refine((kind) => (kind.vehicle === undefined) === (kind.speed === undefined), "give vehicle and speed together: what carries one on it, and its field that holds its speed")).optional(),
59
+ }).strict().refine((travel) => travel.pace === undefined || Object.keys(travel.paces ?? {}).some((pace) => comparableText(pace) === comparableText(travel.pace ?? "")), {
60
+ message: "pace must be one of paces",
61
+ path: ["pace"],
62
+ });
63
+ export const gridSchema = z.object({
64
+ square: lengthSchema,
65
+ diagonal: z.number().positive(),
66
+ difficult: z.number().positive(),
67
+ speed: z.string().min(1),
68
+ walking: z.string().min(1).optional(),
69
+ size: z.string().min(1).optional(),
70
+ footprints: z.record(z.string().min(1), z.number().int().min(1)).optional(),
71
+ leaving: z.string().min(1).optional(),
72
+ }, { error: "write it as a square's length, a diagonal step's cost in squares, the factor of difficult ground and the field of the speed, such as {square: 1.5 m, diagonal: 1, difficult: 2, speed: speed}" }).strict();
73
+ // A setting the setup asks (DAT-10), or the versions of the rules (VER-1): what it is to the player, then its values, each with what it means: a setting at
74
+ // least two, the versions at least one.
75
+ // The values of the engine's settings a game offers, or one of its values (DAT-16): one alone is no choice.
76
+ const engineSettingsSchema = z.record(z.string().min(1), z.array(z.string().min(1)).min(1), {
77
+ error: "write it as the engine's settings, each with the values the game offers, such as {rigor: [smooth]}",
78
+ });
79
+ function settingSchema(fewest) {
80
+ return z.record(z.string().min(1), z.union([
81
+ z.string().min(1),
82
+ z.object({
83
+ means: z.string().min(1),
84
+ player: z.string().min(1).optional(),
85
+ without: z.array(z.string().min(1)).optional(),
86
+ "engine-settings": engineSettingsSchema.optional(),
87
+ asks: z.array(z.string().min(1)).optional(),
88
+ suggested: z.literal(true).optional(),
89
+ }).strict(),
90
+ ])).refine((values) => Object.entries(values).every(([key, value]) => (key === "about") === (typeof value === "string")), "give about as what the setting is to the player, in a few words, and each value with what it means, such as {about: how your character levels up, xp: {means: ...}}").refine((values) => Object.keys(values).filter((key) => key !== "about").length >= fewest, fewest === 1 ? "give at least one version, with what it means, such as {srd-5.1: {means: ...}}" : "give at least two values, each with what it means, such as {xp: {means: ...}, milestones: {means: ...}}");
91
+ }
92
+ export const systemSchema = z.object({
93
+ title: z.string().min(1),
94
+ language: z.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/),
95
+ attribution: z.string().min(1).optional(),
96
+ // Its theme of the dashboard (D-528): a folder of its own, written from it, as theme.
97
+ theme: z.string().min(1).refine((folder) => !isAbsolute(folder) && !folder.split(/[\\/]/).includes(".."), { error: "write it as a folder of the system, such as theme" }).optional(),
98
+ fields: z.record(z.string(), z.enum(fieldKinds)).optional(),
99
+ coins: z.union([z.string().min(1), z.record(z.string(), z.unknown())]).optional(),
100
+ "coin-metals": z.record(z.string().min(1), z.string().min(1), { error: "write it as a map, each coin with its metal, such as {gp: gold, sp: silver}" }).optional(),
101
+ round: z.string().regex(/^[1-9]\d* seconds?$/, 'write it as "6 seconds"').optional(),
102
+ imperial: z.object({ mile: lengthSchema, foot: lengthSchema, pound: z.string().regex(/^\d+(\.\d+)? kg$/, { error: "write it in kilograms, such as 0.5 kg" }).optional() }).strict().optional(),
103
+ "length-unit": z.string().min(1).optional(),
104
+ "bonus-lists": z.array(z.string().min(1)).optional(),
105
+ load: z.object({
106
+ field: z.string().min(1),
107
+ limit: z.union([z.string().min(1), z.array(z.union([z.string().min(1), z.number()])).min(1)]),
108
+ coins: z.number().int().positive().optional(),
109
+ weightless: z.string().min(1).optional(),
110
+ bundle: z.string().min(1).optional(),
111
+ stages: z.array(z.object({ name: z.string().min(1), when: z.string().min(1) }).strict()).optional(),
112
+ }, {
113
+ error: "write it as the field of an item's weight, the formula of the limit, and how many coins weigh one unit, such as {field: weight, limit: str * 15, coins: 50}; weightless names the field of an item whose contents weigh nothing, bundle the field of how many pieces one of a kind sold by the bundle holds; "
114
+ + "stages lists what a load makes a character, the heaviest last, each with when, the formula that says so above 0, such as [{name: Encumbered, when: ceil(load - 5 * str)}]",
115
+ }).strict().optional(),
116
+ travel: travelSchema.optional(),
117
+ grid: gridSchema.optional(),
118
+ sheet: z.record(z.string().min(1), z.array(z.string().regex(sheetEntryPattern, 'write it as "str", "str (str-mod)" for a field shown beside it, or "flaw?" for one written only when it applies')).min(1), {
119
+ error: "write the sheet as groups, each with its fields, such as Abilities: [str (str-mod), dex (dex-mod)]",
120
+ }).optional(),
121
+ "sheet-notes": z.record(z.string().min(1), z.string().min(1)).optional(),
122
+ "sheet-cards": z.object({ rail: z.array(z.string().min(1)).optional(), order: z.array(z.string().min(1)).optional(), "at-hand": z.array(z.string().min(1)).optional() }, {
123
+ error: "write it as the groups the dashboard puts in its rail, the order of the others, and the fields and groups at hand in a fight, such as {rail: [Abilities], order: [Skills, Combat], at-hand: [ac, hp, Attacks]}",
124
+ }).strict().optional(),
125
+ "sheet-actions": z.record(z.string().min(1), z.array(z.string().min(1)).min(1), {
126
+ error: `write it as the fields whose items the player acts with on the dashboard, each with its verbs, among ${actVerbs.join(", ")} and those of sheet-verbs, such as {inventory: [use, equip]}`,
127
+ }).optional(),
128
+ "sheet-verbs": z.record(z.string().regex(/^[a-z][a-z-]*$/, "write a verb's name in lowercase, such as invoke"), z.object({
129
+ label: z.string().min(1),
130
+ title: phraseWith(["item"]),
131
+ says: phraseWith(["item"]),
132
+ "says-on": phraseWith(["item", "target"]).optional(),
133
+ "says-at": phraseWith(["item", "square"]).optional(),
134
+ "says-self": phraseWith(["item"]).optional(),
135
+ }).strict().refine((verb) => [verb["says-on"], verb["says-at"], verb["says-self"]].every((said, _index, all) => (said === undefined) === (all[0] === undefined)), {
136
+ message: "give says-on, says-at and says-self together, for a verb that lets the player choose on whom, or none of them",
137
+ }), { error: 'write it as the system\'s own verbs, each with its words, such as {invoke: {label: Invoke, title: "Invoke {item}", says: "I invoke {item}."}}' }).optional(),
138
+ "sheet-headline": z.string().min(1).regex(/\{[^{}\s]+\}/, "write it as words with fields in braces, such as Level {level} {classes}").optional(),
139
+ "sheet-icons": z.record(z.string().min(1), z.string().max(2000).regex(iconPattern, "write it as the d of an SVG path on a grid of 24, its letters and numbers alone, such as M4 12h16")).optional(),
140
+ "token-icons": z.object({
141
+ field: z.string().min(1),
142
+ icons: z.record(z.string().min(1), z.string().max(2000).regex(iconPattern, "write it as the d of an SVG path on a grid of 24, its letters and numbers alone, such as M4 12h16")),
143
+ }).strict().optional(),
144
+ "sheet-dice": z.record(z.string().regex(sheetDicePattern), z.array(z.string().min(1)).min(1), {
145
+ error: "write it as dice alone, as 1d20 or 2d6+1d4, and the fields of the sheet rolled with them, such as 1d20: [athletics, stealth]",
146
+ }).optional(),
147
+ "sheet-knowledge": z.array(z.string().min(1)).min(1).optional(),
148
+ "sheet-odds": z.object({
149
+ better: z.string().regex(rollNamePattern),
150
+ worse: z.string().regex(rollNamePattern),
151
+ when: z.array(z.object({ fields: z.array(z.string().min(1)).min(1), better: z.string().min(1).optional(), worse: z.string().min(1).optional(), why: z.string().min(1).optional() }).strict()),
152
+ }, {
153
+ error: "write it as the dice of a better and a worse roll, and when: fields of the sheet with the formulas that make them better or worse above 0, and why in a word of the system, "
154
+ + "such as {better: 2d20kh1, worse: 2d20kl1, when: [{fields: [stealth], worse: count(equipped, stealth-disadvantage = true), why: Armor}]}",
155
+ }).strict().optional(),
156
+ "roll-names": z.record(z.string().regex(rollNamePattern), z.union([z.string().min(1), z.record(z.string().min(2), z.string().min(1))]), {
157
+ error: "write it as dice with the highest or the lowest kept or dropped, and the name the game gives such a roll, by language, such as 2d20kh1: {en: with advantage, it: con vantaggio}",
158
+ }).optional(),
159
+ values: z.record(z.string().min(1), z.array(z.string().min(1)).min(1)).optional(),
160
+ "sheet-values": z.record(z.string().min(1), z.array(z.string().min(1)).min(1)).optional(),
161
+ marks: z.array(z.string().min(1)).optional(),
162
+ "status-line": z.array(z.string().min(1)).optional(),
163
+ thresholds: z.record(z.string().regex(/^[^\s]+( -?\d+)?$/, 'write it as "hp 0", or the field alone'), z.string().min(1)).optional(),
164
+ recipes: z.record(z.string(), recipeSchema).optional(),
165
+ conditions: z.array(z.string().min(1)).optional(),
166
+ "condition-icons": z.record(z.string().min(1), z.string().max(2000).regex(iconPattern, "write it as the d of an SVG path on a grid of 24, its letters and numbers alone, such as M4 12h16")).optional(),
167
+ upkeep: z.object({
168
+ daily: z.string().min(1),
169
+ short: z.string().min(1),
170
+ grace: z.string().min(1),
171
+ worsens: z.string().min(1),
172
+ water: z.string().min(1).optional(),
173
+ lifestyle: z.object({ field: z.string().min(1), costs: z.record(z.string().min(1), z.string().min(1)), rules: z.string().min(1) }).strict().optional(),
174
+ rules: z.string().min(1),
175
+ }, {
176
+ error: "write it as the kind spent each day, the field that counts the days without it, the formula of the days one goes without, the counter they then raise, "
177
+ + "a word on water, what a day in a settlement costs by the lifestyle chosen, and the rules, such as {daily: Rations, short: days-without-food, grace: 3 + con-mod, "
178
+ + "worsens: exhaustion, lifestyle: {field: lifestyle, costs: {modest: 1 gp}, rules: Lifestyle Expenses}, rules: Food and Water}",
179
+ }).strict().optional(),
180
+ burning: z.record(z.string().min(1), z.object({ lasts: z.string().min(1), spends: z.string().min(1).optional() }).strict(), {
181
+ error: "write each thing that burns with how long it lasts, and what it spends when not itself, such as Lamp: {lasts: 6 hours, spends: Oil}",
182
+ }).optional(),
183
+ bonds: z.record(z.string().min(1), z.object({ most: z.number().int().positive(), needs: z.string().min(1), while: z.string().min(1).optional(), rules: z.string().min(1) }).strict(), {
184
+ error: "write each list with the most items it holds, the field an item that asks for it has, the list it gives its bonuses only while in, and the rules to read, "
185
+ + "such as attuned: {most: 3, needs: attunement, while: equipped, rules: Attunement}",
186
+ }).optional(),
187
+ immune: z.string().min(1).optional(),
188
+ oracle: z.object({ yes: z.enum(["low", "high"]) }, { error: "write it as where the oracle's d100 says yes, low up to the odds or high above 100 less them, such as {yes: high}" }).strict().optional(),
189
+ "turn-uses": z.record(z.string().min(1).refine((name) => !/ (by|for) /i.test(` ${name} `), "a use's name takes no word by or for, which the engine reads in what it keeps"), z.object({
190
+ most: z.union([z.string().min(1), z.number()]).optional(),
191
+ within: z.string().min(1).optional(),
192
+ needs: z.string().min(1).optional(),
193
+ "any-turn": z.boolean().optional(),
194
+ resets: z.enum(["own turn", "each turn"]).optional(),
195
+ note: z.string().min(1).optional(),
196
+ "note-when": z.string().min(1).optional(),
197
+ }).strict(), { error: "write each use of a turn with its most, the use it goes within, what it needs, whether it goes in any turn and when it comes back, such as attack: {within: action, most: 1 + extra-attacks}" }).optional(),
198
+ "at-most": z.record(z.string().min(1), z.union([z.string().min(1), z.number()]), {
199
+ error: "write each field of a sheet with the most it holds, a number or a formula, such as str: 20 + 4 * has(features, Primal Champion), or prepared: max-prepared",
200
+ }).optional(),
201
+ damage: z.object({ counter: z.string().min(1), halves: z.string().min(1), ignores: z.string().min(1), doubles: z.string().min(1), rules: z.string().min(1) }, {
202
+ error: "write it as the counter damage takes from and the lists of a page that halve, ignore and double a type, such as "
203
+ + "{counter: hp, halves: damage-resistances, ignores: damage-immunities, doubles: damage-vulnerabilities, rules: Damage Resistance and Vulnerability}",
204
+ }).strict().optional(),
205
+ keeping: z.object({ counter: z.string().min(1), conditions: z.array(z.string().min(1)).optional(), rules: z.string().min(1) }, {
206
+ error: "write it as what can break what someone keeps alive, such as {counter: hp, conditions: [Unconscious], rules: Concentration}",
207
+ }).strict().optional(),
208
+ combat: z.object({ track: z.string().min(1), "in-words": inWordsSchema.optional(), inactive: z.array(z.string().min(1)).optional() }, {
209
+ error: "write it as the counter a fight follows, the words the player hears a foe's in, from full to 0, and the conditions that keep from acting, "
210
+ + "such as {track: hp, in-words: [unhurt, hurt, badly hurt, down], inactive: [Stunned]}",
211
+ }).strict().optional(),
212
+ down: z.object({ at: z.string().regex(/^[^\s]+ -?\d+$/, 'write it as "hp 0"') }, {
213
+ error: "write it as when one of the party is down, such as {at: hp 0}; what being down does, and how the dashboard draws it, is the system's code (D-448, D-516)",
214
+ }).strict().optional(),
215
+ checks: z.array(z.object({ when: checkAtomSchema, needs: checkAtomSchema, say: z.string().min(1) }, {
216
+ error: 'write each as what holds, what must hold with it, and the line for the master, such as {when: Stable, needs: hp <= 0, say: "{page} is Stable with {hp}: effect end {page} Stable."}',
217
+ }).strict()).optional(),
218
+ tables: z.record(z.string(), z.record(z.string(), z.number())).optional(),
219
+ progression: z.object({
220
+ list: z.string().min(1),
221
+ level: z.string().min(1).optional(),
222
+ features: z.string().min(1),
223
+ skip: z.array(z.string().min(1)).optional(),
224
+ parts: z.object({ list: z.string().min(1), field: z.string().min(1), lists: z.array(z.string().min(1)).optional() }).strict().optional(),
225
+ experience: z.object({ field: z.string().min(1), table: z.string().min(1), rules: z.string().min(1).optional() }).strict().optional(),
226
+ }).strict().optional(),
227
+ settings: z.record(z.string().min(1).refine((name) => comparableText(name) !== rulesetSetting, `${rulesetSetting} is the engine's setting of the versions: give this one another name`), settingSchema(2))
228
+ .optional(),
229
+ // Its versions of the rules, each a folder in versions/ (VER-1): a setting of their own, ruleset.
230
+ versions: settingSchema(1).optional(),
231
+ "engine-settings": engineSettingsSchema.optional(),
232
+ rewards: z.record(z.string().min(1), z.object({ from: z.string().min(1), overcome: z.string().regex(/^[^\s]+ -?\d+$/, 'write it as "hp 0"') }).strict()).optional(),
233
+ "item-formulas": z.record(z.string().min(1), z.array(z.string().min(1)).min(1)).optional(),
234
+ "always-in": z.record(z.string().min(1), z.array(z.string().min(1)).min(1), { error: "write it as lists, each with the names of the pages in it, such as equipped: [Unarmed Strike]" }).optional(),
235
+ computed: z.record(z.string(), z.union([z.number(), z.string().min(1), z.array(z.union([z.number(), z.string().min(1)]))])).optional(),
236
+ counters: z.record(z.string(), z.object({
237
+ min: z.union([z.number(), z.string().min(1)]).optional(),
238
+ max: z.union([z.number(), z.string().min(1)]).optional(),
239
+ refill: z.union([z.string().min(1), z.record(z.string().min(1), z.union([z.number(), z.string().min(1)]))]).optional(),
240
+ shields: z.string().min(1).optional(),
241
+ }).strict()).optional(),
242
+ ...packagePartsShape,
243
+ }).strict();
@@ -0,0 +1,19 @@
1
+ import type { GameSystem, SystemSetting } from "./game-system.ts";
2
+ /** The settings of a system that hold, in its order (DAT-17): those no value asks, and those a value played asks; `valueOf` gives the value played. */
3
+ export declare function heldSettings(system: GameSystem, valueOf: (setting: SystemSetting) => string | undefined): SystemSetting[];
4
+ /** The value of a system's setting played, with what it offers and asks; undefined while it is to be chosen. */
5
+ export declare function playedValueOf(setting: SystemSetting, valueOf: (setting: SystemSetting) => string | undefined): SystemSetting["values"][number] | undefined;
6
+ /** What narrows the engine's settings (DAT-16): the system, then each value played, with whom to name. */
7
+ export declare function engineOfferings(system: GameSystem, valueOf: (setting: SystemSetting) => string | undefined): {
8
+ from: string;
9
+ offers: Record<string, string[]>;
10
+ }[];
11
+ /** The values a game offers of an engine's setting (DAT-16): those the system and the values played share; undefined when none of them narrows it. */
12
+ export declare function offeredEngineValues(system: GameSystem | undefined, valueOf: (setting: SystemSetting) => string | undefined, name: string): string[] | undefined;
13
+ /** An engine's setting as a game plays it (DAT-16): the one value it offers, else the written one when it offers it; undefined while it is to be asked. */
14
+ export declare function engineSettingValue(system: GameSystem | undefined, valueOf: (setting: SystemSetting) => string | undefined, name: string, written: unknown): unknown;
15
+ /**
16
+ * The system as a campaign plays it, with the values its settings have (DAT-10): the fields a value leaves out are gone from the sheet, the line, the experience
17
+ * and the rewards. A setting without a value, or with one the system lacks, leaves out nothing.
18
+ */
19
+ export declare function withSettings(system: GameSystem, valueOf: (setting: string) => string | undefined): GameSystem;
@@ -0,0 +1,78 @@
1
+ // The system as a campaign's settings play it (DAT-10, DAT-16, DAT-17)
2
+ import { frozen } from "../core/frozen.js";
3
+ import { comparableText } from "../core/text.js";
4
+ /** The settings of a system that hold, in its order (DAT-17): those no value asks, and those a value played asks; `valueOf` gives the value played. */
5
+ export function heldSettings(system, valueOf) {
6
+ const asked = (setting) => system.settings.some((other) => other.values.some((value) => value.asks.some((name) => comparableText(name) === comparableText(setting.name))));
7
+ const held = system.settings.filter((setting) => !asked(setting));
8
+ for (let index = 0; index < held.length; index++) {
9
+ for (const name of playedValueOf(held[index], valueOf)?.asks ?? []) {
10
+ const found = system.settings.find((setting) => comparableText(setting.name) === comparableText(name));
11
+ if (found !== undefined && !held.includes(found)) {
12
+ held.push(found);
13
+ }
14
+ }
15
+ }
16
+ return system.settings.filter((setting) => held.includes(setting));
17
+ }
18
+ /** The value of a system's setting played, with what it offers and asks; undefined while it is to be chosen. */
19
+ export function playedValueOf(setting, valueOf) {
20
+ const value = valueOf(setting);
21
+ return setting.values.find((one) => value !== undefined && comparableText(one.value) === comparableText(value));
22
+ }
23
+ /** What narrows the engine's settings (DAT-16): the system, then each value played, with whom to name. */
24
+ export function engineOfferings(system, valueOf) {
25
+ return [
26
+ { from: `the game system ${system.name}`, offers: system.engineSettings },
27
+ ...heldSettings(system, valueOf).flatMap((setting) => {
28
+ const value = playedValueOf(setting, valueOf);
29
+ return value === undefined ? [] : [{ from: `${setting.name} ${value.value}`, offers: value.engineSettings }];
30
+ }),
31
+ ];
32
+ }
33
+ /** The values a game offers of an engine's setting (DAT-16): those the system and the values played share; undefined when none of them narrows it. */
34
+ export function offeredEngineValues(system, valueOf, name) {
35
+ const lists = (system === undefined ? [] : engineOfferings(system, valueOf)).flatMap((offering) => Object.entries(offering.offers).filter(([setting]) => comparableText(setting) === comparableText(name)).map(([, values]) => values));
36
+ return lists.length === 0 ? undefined : lists.reduce((shared, list) => shared.filter((value) => list.some((other) => comparableText(other) === comparableText(value))));
37
+ }
38
+ /** An engine's setting as a game plays it (DAT-16): the one value it offers, else the written one when it offers it; undefined while it is to be asked. */
39
+ export function engineSettingValue(system, valueOf, name, written) {
40
+ const offered = offeredEngineValues(system, valueOf, name);
41
+ if (offered === undefined) {
42
+ return written;
43
+ }
44
+ return offered.length === 1 ? offered[0] : offered.find((value) => typeof written === "string" && comparableText(value) === comparableText(written));
45
+ }
46
+ /**
47
+ * The system as a campaign plays it, with the values its settings have (DAT-10): the fields a value leaves out are gone from the sheet, the line, the experience
48
+ * and the rewards. A setting without a value, or with one the system lacks, leaves out nothing.
49
+ */
50
+ export function withSettings(system, valueOf) {
51
+ // A setting asked by a value the campaign does not play does not hold, nor what its value leaves out (DAT-17).
52
+ const leftOut = heldSettings(system, (setting) => valueOf(setting.name)).flatMap((setting) => {
53
+ const chosen = valueOf(setting.name);
54
+ return setting.values.find((value) => chosen !== undefined && comparableText(value.value) === comparableText(chosen))?.without ?? [];
55
+ });
56
+ if (leftOut.length === 0) {
57
+ return system;
58
+ }
59
+ const kept = (field) => !leftOut.some((name) => comparableText(name) === comparableText(field));
60
+ const progression = system.progression === undefined ? undefined : withoutExperience(system.progression, kept);
61
+ return frozen({
62
+ ...system,
63
+ sheet: system.sheet.map((group) => ({ ...group, entries: group.entries.filter((entry) => kept(entry.field)) })).filter((group) => group.entries.length > 0),
64
+ statusLine: system.statusLine.filter((entry) => kept(entry.field)),
65
+ ...(progression === undefined ? {} : { progression }),
66
+ rewards: system.rewards.filter((reward) => kept(reward.field)),
67
+ leftOut,
68
+ });
69
+ }
70
+ /** The progression without its experience, when a setting leaves its field out (DAT-10). */
71
+ function withoutExperience(progression, kept) {
72
+ if (progression.experience === undefined || kept(progression.experience.field)) {
73
+ return progression;
74
+ }
75
+ const rest = { ...progression };
76
+ delete rest.experience;
77
+ return rest;
78
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The version of its rules a system is read with (VER-1, VER-2): the one asked, by any case, else the first it lists; none for a system without versions.
3
+ * Each version it lists has its folder in versions/, with a system.yaml of what it changes, if any, and a title of its own.
4
+ */
5
+ export declare function chosenVersion(own: unknown, file: string, name: string, asked: string | undefined): {
6
+ name: string;
7
+ title?: string;
8
+ folder: string;
9
+ data: Record<string, unknown>;
10
+ } | undefined;
11
+ /** A system's data with its version's over it (VER-3): a map by its names, at every depth, the version's winning; a list or a value in the place of the common one. */
12
+ export declare function withVersion(below: Record<string, unknown>, over: Record<string, unknown>): Record<string, unknown>;