rpg-engine 0.15.0 → 0.17.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 (503) hide show
  1. package/dist/adventures/source.d.ts +3 -1
  2. package/dist/adventures/source.js +31 -1
  3. package/dist/campaign/find-campaign.js +8 -4
  4. package/dist/campaign/index.d.ts +1 -1
  5. package/dist/campaign/index.js +1 -1
  6. package/dist/campaign/settings.d.ts +6 -0
  7. package/dist/campaign/settings.js +22 -1
  8. package/dist/cli/cli.js +1 -1
  9. package/dist/cli/command-line.js +1 -1
  10. package/dist/commands/advance.d.ts +1 -1
  11. package/dist/commands/advance.js +6 -6
  12. package/dist/commands/ask.js +7 -7
  13. package/dist/commands/change/amounts.d.ts +32 -0
  14. package/dist/commands/change/amounts.js +150 -0
  15. package/dist/commands/change/change.d.ts +4 -54
  16. package/dist/commands/change/change.js +19 -749
  17. package/dist/commands/change/damage.d.ts +30 -0
  18. package/dist/commands/change/damage.js +73 -2
  19. package/dist/commands/change/dice.d.ts +34 -0
  20. package/dist/commands/change/dice.js +59 -0
  21. package/dist/commands/change/fields.d.ts +37 -0
  22. package/dist/commands/change/fields.js +156 -0
  23. package/dist/commands/change/holder.d.ts +48 -0
  24. package/dist/commands/change/holder.js +162 -0
  25. package/dist/commands/change/recipe-pace.js +1 -1
  26. package/dist/commands/change/recipe.d.ts +58 -0
  27. package/dist/commands/change/recipe.js +179 -0
  28. package/dist/commands/choices.js +3 -3
  29. package/dist/commands/config/config.d.ts +15 -0
  30. package/dist/commands/config/config.js +355 -0
  31. package/dist/commands/config/custom-levels.d.ts +7 -0
  32. package/dist/commands/config/custom-levels.js +32 -0
  33. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  34. package/dist/commands/config/dashboard.js +171 -0
  35. package/dist/commands/config/entries.d.ts +17 -0
  36. package/dist/commands/config/entries.js +76 -0
  37. package/dist/commands/config/news.d.ts +7 -0
  38. package/dist/commands/config/news.js +88 -0
  39. package/dist/commands/config/shown.d.ts +9 -0
  40. package/dist/commands/config/shown.js +80 -0
  41. package/dist/commands/config/words.d.ts +27 -0
  42. package/dist/commands/config/words.js +204 -0
  43. package/dist/commands/effect.js +9 -9
  44. package/dist/commands/find.js +1 -1
  45. package/dist/commands/image.js +6 -6
  46. package/dist/commands/import/import.d.ts +0 -2
  47. package/dist/commands/import/import.js +68 -45
  48. package/dist/commands/import/run.js +1 -1
  49. package/dist/commands/index.js +3 -3
  50. package/dist/commands/init.js +2 -2
  51. package/dist/commands/install.js +1 -1
  52. package/dist/commands/instructions.js +6 -6
  53. package/dist/commands/mode.d.ts +2 -2
  54. package/dist/commands/mode.js +8 -8
  55. package/dist/commands/mood.js +4 -4
  56. package/dist/commands/move.js +10 -10
  57. package/dist/commands/package/consent.d.ts +11 -0
  58. package/dist/commands/package/consent.js +52 -0
  59. package/dist/commands/package/here.d.ts +51 -0
  60. package/dist/commands/package/here.js +128 -0
  61. package/dist/commands/package/install.d.ts +10 -0
  62. package/dist/commands/package/install.js +337 -0
  63. package/dist/commands/package/package.d.ts +18 -0
  64. package/dist/commands/package/package.js +270 -0
  65. package/dist/commands/package/result.d.ts +89 -0
  66. package/dist/commands/package/result.js +1 -0
  67. package/dist/commands/package/uninstall.d.ts +6 -0
  68. package/dist/commands/package/uninstall.js +70 -0
  69. package/dist/commands/rename.js +3 -3
  70. package/dist/commands/reveal.js +5 -5
  71. package/dist/commands/roll/roll.js +11 -9
  72. package/dist/commands/roll/tables.js +1 -1
  73. package/dist/commands/rules.d.ts +2 -2
  74. package/dist/commands/rules.js +3 -3
  75. package/dist/commands/save.d.ts +2 -2
  76. package/dist/commands/save.js +2 -2
  77. package/dist/commands/scene/close.d.ts +18 -0
  78. package/dist/commands/scene/close.js +179 -0
  79. package/dist/commands/scene/members.d.ts +14 -0
  80. package/dist/commands/scene/members.js +32 -0
  81. package/dist/commands/scene/open.d.ts +6 -0
  82. package/dist/commands/scene/open.js +298 -0
  83. package/dist/commands/scene/result.d.ts +98 -0
  84. package/dist/commands/scene/result.js +2 -0
  85. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  86. package/dist/commands/scene/scene.js +210 -0
  87. package/dist/commands/scene/turns.d.ts +18 -0
  88. package/dist/commands/scene/turns.js +229 -0
  89. package/dist/commands/shared/books/adventure-layers.d.ts +89 -0
  90. package/dist/commands/shared/books/adventure-layers.js +201 -0
  91. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +28 -9
  92. package/dist/commands/shared/{adventures.js → books/adventures.js} +77 -35
  93. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  94. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  95. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  96. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  97. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  98. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  99. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  100. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  101. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  102. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  103. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  104. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  105. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  106. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  107. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  108. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  109. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  110. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  111. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  112. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  113. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  114. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  115. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  116. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  117. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  118. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  119. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  120. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  121. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  122. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  123. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  124. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  125. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  126. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  127. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  128. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  129. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  130. package/dist/commands/shared/characters/orders.d.ts +4 -0
  131. package/dist/commands/shared/characters/orders.js +10 -0
  132. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +9 -6
  133. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +17 -7
  134. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  135. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  136. package/dist/commands/shared/examples.js +2 -2
  137. package/dist/commands/shared/packages/catalog.js +2 -2
  138. package/dist/commands/shared/packages/code.d.ts +1 -1
  139. package/dist/commands/shared/packages/code.js +8 -8
  140. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  141. package/dist/commands/shared/packages/extensions.js +1 -1
  142. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  143. package/dist/commands/shared/packages/hooks.js +1 -1
  144. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  145. package/dist/commands/shared/packages/widgets.js +3 -3
  146. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  147. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  148. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  149. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  150. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  151. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  152. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  153. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  154. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  155. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  156. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  157. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  158. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  159. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  160. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  161. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  162. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  163. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  164. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  165. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  166. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  167. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  168. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  169. package/dist/commands/shared/{scene.js → scene/scene.js} +10 -8
  170. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  171. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  172. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  173. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  174. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  175. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  176. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  177. package/dist/commands/shared/sheet/effect-values.js +69 -0
  178. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  179. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  180. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  181. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  182. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  183. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  184. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  185. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  186. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  187. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  188. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +7 -5
  189. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  190. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  191. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  192. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  193. package/dist/commands/shared/sheet/system-fields.js +45 -0
  194. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  195. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  196. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  197. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  198. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  199. package/dist/commands/shared/sheet/worked-out.js +291 -0
  200. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  201. package/dist/commands/shared/sheet/worked-text.js +55 -0
  202. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  203. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  204. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  205. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  206. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  207. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  208. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  209. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  210. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  211. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  212. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  213. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  214. package/dist/commands/show.d.ts +9 -0
  215. package/dist/commands/show.js +43 -10
  216. package/dist/commands/status.d.ts +2 -1
  217. package/dist/commands/status.js +28 -22
  218. package/dist/commands/thoughts.d.ts +1 -0
  219. package/dist/commands/thoughts.js +26 -18
  220. package/dist/commands/trade.js +8 -8
  221. package/dist/commands/translate.d.ts +1 -1
  222. package/dist/commands/translate.js +3 -3
  223. package/dist/commands/travel/open.d.ts +1 -1
  224. package/dist/commands/travel/open.js +2 -2
  225. package/dist/commands/travel/route.js +7 -6
  226. package/dist/commands/travel/travel.d.ts +1 -1
  227. package/dist/commands/travel/travel.js +8 -8
  228. package/dist/commands/validate.js +3 -3
  229. package/dist/commands/view/journal.d.ts +2 -2
  230. package/dist/commands/view/journal.js +2 -2
  231. package/dist/commands/view/layers.d.ts +34 -0
  232. package/dist/commands/view/layers.js +44 -0
  233. package/dist/commands/view/map.d.ts +1 -1
  234. package/dist/commands/view/map.js +6 -6
  235. package/dist/commands/view/memory.d.ts +16 -0
  236. package/dist/commands/view/memory.js +96 -0
  237. package/dist/commands/view/page.d.ts +32 -0
  238. package/dist/commands/view/page.js +166 -0
  239. package/dist/commands/view/place.d.ts +7 -2
  240. package/dist/commands/view/place.js +30 -12
  241. package/dist/commands/view/result.d.ts +252 -0
  242. package/dist/commands/view/result.js +1 -0
  243. package/dist/commands/view/saves.d.ts +6 -0
  244. package/dist/commands/view/saves.js +53 -0
  245. package/dist/commands/view/story.d.ts +32 -0
  246. package/dist/commands/view/story.js +227 -0
  247. package/dist/commands/view/view.d.ts +29 -292
  248. package/dist/commands/view/view.js +31 -536
  249. package/dist/commands/view/world.d.ts +1 -1
  250. package/dist/commands/view/world.js +3 -3
  251. package/dist/commands/write/checks.d.ts +42 -0
  252. package/dist/commands/write/checks.js +291 -0
  253. package/dist/commands/write/here.d.ts +1 -1
  254. package/dist/commands/write/here.js +5 -5
  255. package/dist/commands/write/inheritance.d.ts +40 -0
  256. package/dist/commands/write/inheritance.js +185 -0
  257. package/dist/commands/write/input.d.ts +29 -0
  258. package/dist/commands/write/input.js +124 -0
  259. package/dist/commands/write/layer.d.ts +44 -0
  260. package/dist/commands/write/layer.js +68 -0
  261. package/dist/commands/write/notes.d.ts +22 -0
  262. package/dist/commands/write/notes.js +76 -0
  263. package/dist/commands/write/progression.d.ts +27 -0
  264. package/dist/commands/write/progression.js +175 -0
  265. package/dist/commands/write/write.d.ts +2 -0
  266. package/dist/commands/write/write.js +36 -816
  267. package/dist/core/files.d.ts +2 -0
  268. package/dist/core/files.js +7 -0
  269. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  270. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  271. package/dist/core/session-store.js +3 -3
  272. package/dist/core/store.d.ts +2 -2
  273. package/dist/core/store.js +18 -4
  274. package/dist/core/text.d.ts +2 -0
  275. package/dist/core/text.js +4 -0
  276. package/dist/dashboard/acts/acts.js +1 -1
  277. package/dist/dashboard/acts/sending.js +110 -0
  278. package/dist/dashboard/acts/sheet.js +2 -2
  279. package/dist/dashboard/acts/strip.js +1 -1
  280. package/dist/dashboard/address.js +6 -0
  281. package/dist/dashboard/api.js +19 -1
  282. package/dist/dashboard/app.js +51 -171
  283. package/dist/dashboard/dice/roller.js +1 -1
  284. package/dist/dashboard/dice/sets.js +2 -2
  285. package/dist/dashboard/dice/stage.js +1 -1
  286. package/dist/dashboard/dice/tray.js +6 -6
  287. package/dist/dashboard/guide/ar.md +7 -3
  288. package/dist/dashboard/guide/cs.md +9 -5
  289. package/dist/dashboard/guide/da.md +9 -5
  290. package/dist/dashboard/guide/de.md +7 -3
  291. package/dist/dashboard/guide/el.md +9 -5
  292. package/dist/dashboard/guide/en.md +4 -0
  293. package/dist/dashboard/guide/es.md +8 -4
  294. package/dist/dashboard/guide/fi.md +9 -5
  295. package/dist/dashboard/guide/fr.md +8 -4
  296. package/dist/dashboard/guide/he.md +7 -3
  297. package/dist/dashboard/guide/hi.md +10 -6
  298. package/dist/dashboard/guide/hu.md +8 -4
  299. package/dist/dashboard/guide/is.md +9 -5
  300. package/dist/dashboard/guide/it.md +5 -1
  301. package/dist/dashboard/guide/ja.md +9 -5
  302. package/dist/dashboard/guide/ko.md +8 -4
  303. package/dist/dashboard/guide/nb.md +8 -4
  304. package/dist/dashboard/guide/nl.md +8 -4
  305. package/dist/dashboard/guide/pl.md +8 -4
  306. package/dist/dashboard/guide/pt.md +7 -3
  307. package/dist/dashboard/guide/ro.md +9 -5
  308. package/dist/dashboard/guide/ru.md +8 -4
  309. package/dist/dashboard/guide/sv.md +9 -5
  310. package/dist/dashboard/guide/tr.md +9 -5
  311. package/dist/dashboard/guide/uk.md +8 -4
  312. package/dist/dashboard/guide/zh.md +8 -4
  313. package/dist/dashboard/help/help.js +3 -3
  314. package/dist/dashboard/i18n/ar.json +29 -0
  315. package/dist/dashboard/i18n/cs.json +29 -0
  316. package/dist/dashboard/i18n/da.json +29 -0
  317. package/dist/dashboard/i18n/de.json +29 -0
  318. package/dist/dashboard/i18n/el.json +29 -0
  319. package/dist/dashboard/i18n/es.json +29 -0
  320. package/dist/dashboard/i18n/fi.json +29 -0
  321. package/dist/dashboard/i18n/fr.json +29 -0
  322. package/dist/dashboard/i18n/he.json +29 -0
  323. package/dist/dashboard/i18n/hi.json +29 -0
  324. package/dist/dashboard/i18n/hu.json +29 -0
  325. package/dist/dashboard/i18n/is.json +29 -0
  326. package/dist/dashboard/i18n/it.json +29 -0
  327. package/dist/dashboard/i18n/ja.json +30 -1
  328. package/dist/dashboard/i18n/ko.json +29 -0
  329. package/dist/dashboard/i18n/nb.json +29 -0
  330. package/dist/dashboard/i18n/nl.json +29 -0
  331. package/dist/dashboard/i18n/pl.json +29 -0
  332. package/dist/dashboard/i18n/pt.json +29 -0
  333. package/dist/dashboard/i18n/ro.json +29 -0
  334. package/dist/dashboard/i18n/ru.json +29 -0
  335. package/dist/dashboard/i18n/sv.json +29 -0
  336. package/dist/dashboard/i18n/tr.json +29 -0
  337. package/dist/dashboard/i18n/uk.json +29 -0
  338. package/dist/dashboard/i18n/zh.json +29 -0
  339. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  340. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  341. package/dist/dashboard/kit.js +3 -3
  342. package/dist/dashboard/packages/ask-card.js +3 -3
  343. package/dist/dashboard/packages/catalog.js +196 -0
  344. package/dist/dashboard/packages/changes.js +111 -0
  345. package/dist/dashboard/packages/engine.js +87 -0
  346. package/dist/dashboard/packages/installed.js +53 -0
  347. package/dist/dashboard/packages/library.js +97 -0
  348. package/dist/dashboard/packages/outcomes.js +45 -0
  349. package/dist/dashboard/packages/packages.js +27 -578
  350. package/dist/dashboard/packages/page-code.js +15 -2
  351. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  352. package/dist/dashboard/packages/rows.js +84 -0
  353. package/dist/dashboard/packages/share.js +44 -0
  354. package/dist/dashboard/packages/widgets.js +3 -3
  355. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  356. package/dist/dashboard/parts/changed.js +37 -0
  357. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  358. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  359. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  360. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  361. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  362. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  363. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  364. package/dist/dashboard/{refusals.js → parts/refusals.js} +5 -1
  365. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  366. package/dist/dashboard/{widgets.js → parts/widgets.js} +5 -3
  367. package/dist/dashboard/place/key.js +24 -0
  368. package/dist/dashboard/place/paper.js +67 -0
  369. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  370. package/dist/dashboard/place/things.js +129 -0
  371. package/dist/dashboard/place/tokens.js +93 -0
  372. package/dist/dashboard/place/view.js +124 -0
  373. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  374. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  375. package/dist/dashboard/{choices.js → play/choices.js} +11 -10
  376. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  377. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  378. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  379. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  380. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  381. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  382. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  383. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  384. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  385. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  386. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  387. package/dist/dashboard/{sheet.js → sheet/sheet.js} +27 -24
  388. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  389. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  390. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  391. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  392. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  393. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  394. package/dist/dashboard/shell/shown.js +38 -0
  395. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  396. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  397. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  398. package/dist/dashboard/style.css +288 -4
  399. package/dist/dashboard/world/calendar.js +4 -4
  400. package/dist/dashboard/world/drawing.js +92 -0
  401. package/dist/dashboard/world/key.js +21 -0
  402. package/dist/dashboard/world/lore.js +10 -6
  403. package/dist/dashboard/world/map-card.js +186 -0
  404. package/dist/dashboard/world/place-card.js +39 -0
  405. package/dist/dashboard/world/places.js +29 -0
  406. package/dist/dashboard/world/world.js +9 -341
  407. package/dist/extensions/extension.d.ts +1 -1
  408. package/dist/extensions/extension.js +1 -1
  409. package/dist/images/images.js +12 -9
  410. package/dist/index.d.ts +1 -1
  411. package/dist/languages/index.d.ts +1 -1
  412. package/dist/languages/index.js +1 -1
  413. package/dist/packages/npm.js +1 -1
  414. package/dist/page.d.ts +2 -2
  415. package/dist/page.js +1 -1
  416. package/dist/pages/check.js +23 -1
  417. package/dist/pages/containers.d.ts +1 -1
  418. package/dist/pages/containers.js +1 -1
  419. package/dist/pages/index.d.ts +4 -2
  420. package/dist/pages/index.js +4 -2
  421. package/dist/pages/inheritance.d.ts +2 -2
  422. package/dist/pages/layers.d.ts +52 -0
  423. package/dist/pages/layers.js +105 -0
  424. package/dist/pages/markdown.d.ts +5 -1
  425. package/dist/pages/markdown.js +13 -1
  426. package/dist/pages/rename-page.js +1 -1
  427. package/dist/pages/stacks/writes.js +48 -22
  428. package/dist/pages/standard-fields.d.ts +1 -1
  429. package/dist/pages/system-pages.d.ts +5 -3
  430. package/dist/pages/system-pages.js +16 -7
  431. package/dist/pages/world.d.ts +8 -1
  432. package/dist/pages/world.js +16 -4
  433. package/dist/pages/write-layer.d.ts +23 -0
  434. package/dist/pages/write-layer.js +162 -0
  435. package/dist/pages/write-page.d.ts +2 -2
  436. package/dist/pages/write-page.js +2 -2
  437. package/dist/rules/index.d.ts +1 -1
  438. package/dist/rules/index.js +1 -1
  439. package/dist/rules/search.d.ts +1 -1
  440. package/dist/rules/shown.d.ts +1 -1
  441. package/dist/server/dashboard/choices.d.ts +2 -0
  442. package/dist/server/dashboard/choices.js +6 -4
  443. package/dist/server/dashboard/files.js +5 -5
  444. package/dist/server/dashboard/index.d.ts +2 -2
  445. package/dist/server/dashboard/index.js +7 -3
  446. package/dist/server/dashboard/news.js +4 -3
  447. package/dist/server/dashboard/player.js +1 -1
  448. package/dist/server/dashboard/writes.d.ts +7 -0
  449. package/dist/server/dashboard/writes.js +48 -7
  450. package/dist/server/mcp.js +28 -13
  451. package/dist/systems/campaign-data.d.ts +15 -0
  452. package/dist/systems/campaign-data.js +85 -0
  453. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  454. package/dist/systems/{system-code.js → code.js} +2 -2
  455. package/dist/systems/game-system.d.ts +7 -61
  456. package/dist/systems/game-system.js +1 -984
  457. package/dist/systems/index.d.ts +6 -3
  458. package/dist/systems/index.js +6 -3
  459. package/dist/systems/installed.d.ts +31 -0
  460. package/dist/systems/installed.js +89 -0
  461. package/dist/systems/maps.d.ts +3 -0
  462. package/dist/systems/maps.js +9 -0
  463. package/dist/systems/read.d.ts +3 -0
  464. package/dist/systems/read.js +471 -0
  465. package/dist/systems/schema.d.ts +289 -0
  466. package/dist/systems/schema.js +243 -0
  467. package/dist/systems/settings.d.ts +19 -0
  468. package/dist/systems/settings.js +78 -0
  469. package/dist/systems/versions.d.ts +12 -0
  470. package/dist/systems/versions.js +52 -0
  471. package/dist/testing/index.js +1 -1
  472. package/instructions/import.md +1 -1
  473. package/instructions/play.md +1 -1
  474. package/instructions/voices.md +1 -1
  475. package/package.json +1 -1
  476. package/dist/commands/config.js +0 -948
  477. package/dist/commands/package.d.ts +0 -143
  478. package/dist/commands/package.js +0 -785
  479. package/dist/commands/scene.js +0 -894
  480. package/dist/commands/shared/worked-out.js +0 -805
  481. package/dist/dashboard/place/map-view.js +0 -417
  482. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  483. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  484. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  485. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  486. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  487. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  488. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  489. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  490. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  491. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  492. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  493. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  494. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  495. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  496. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  497. /package/dist/pages/{page-file.js → file.js} +0 -0
  498. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  499. /package/dist/pages/{page-types.js → types.js} +0 -0
  500. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  501. /package/dist/rules/{rule-book.js → book.js} +0 -0
  502. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  503. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -0,0 +1,270 @@
1
+ // The package command: lists, asks npm, installs, removes, uninstalls and exports, and says what it did
2
+ import { z } from "zod";
3
+ import { requireCampaign } from "../../campaign/index.js";
4
+ import { readsApi } from "../../core/packages/declarations.js";
5
+ import { defineCommand } from "../../core/registry.js";
6
+ import { comparableText } from "../../core/text.js";
7
+ import { isNewerVersion } from "../../core/version.js";
8
+ import { installedExtensions, readExtension, shortName } from "../../extensions/index.js";
9
+ import { isVerified } from "../../packages/index.js";
10
+ import { exportAdventure, installAdventure, installedAdventures, isAdventureSpec, readAdventureSpec, removeAdventure, storyTouching, } from "../shared/books/adventures.js";
11
+ import { listedExtensions } from "../shared/packages/extensions.js";
12
+ import { issuesOf, languagesHere, systemsHere, usable } from "./here.js";
13
+ import { installed } from "./install.js";
14
+ import { removed, uninstalled } from "./uninstall.js";
15
+ export const packageCommand = defineCommand({
16
+ name: "package",
17
+ description: "The packages of the campaign: extensions such as weather, from npm, and adventures, as a .zip, a folder or a link with adventure.yaml. "
18
+ + "list says those on this computer and those the campaign uses; available, those npm has, and updates; RPG Engine itself is updated by the player on the dashboard's Packages page, never by you. install adds or updates one, on this computer and in the campaign, "
19
+ + "only once the player wants it; one not published by RPG Engine (@rpgengine/…) is someone else's: the player is asked in the host's form, or in a window of their computer. "
20
+ + "An adventure is installed when you bring its hook into the story, once the player wants it as the next. "
21
+ + "remove takes one out of the campaign; uninstall takes it off this computer; export writes the campaign's world, as it was at its start, as an adventure. "
22
+ + "Example: package install weather.",
23
+ group: "campaign",
24
+ positionals: ["action", "name"],
25
+ slow: true,
26
+ input: z.object({
27
+ action: z.enum(["list", "available", "install", "remove", "uninstall", "export"]).describe("list, available, install, remove, uninstall or export"),
28
+ name: z.string().optional().describe("the package: its name alone for one of ours, such as weather; another's npm name with its scope, or npm:name without one, its version if wanted; a folder or a .tgz "
29
+ + "file on this computer; an adventure's .zip, folder or https link; an adventure's title to remove it"),
30
+ author: z.string().min(1).optional().describe("export: who wrote the adventure, as the player wants it credited"),
31
+ license: z.string().min(1).optional().describe("export: the licence the player gives it, such as CC BY 4.0; without one, all rights are reserved"),
32
+ }),
33
+ async run(input, context) {
34
+ const root = requireCampaign(context.folder);
35
+ if (input.action === "list") {
36
+ return listed(root, context);
37
+ }
38
+ if (input.action === "available") {
39
+ return await available(context);
40
+ }
41
+ if (input.action === "export") {
42
+ return { kind: "exported", ...exportAdventure(root, context, { author: input.author, license: input.license }) };
43
+ }
44
+ const name = input.name?.trim();
45
+ if (name === undefined || name === "") {
46
+ throw new Error(`Give the package to ${input.action}, such as package ${input.action} weather.`);
47
+ }
48
+ if (input.action === "install") {
49
+ return isAdventureSpec(name) ? await adventureInstalled(root, context, name) : await installed(root, context, name);
50
+ }
51
+ const adventure = installedAdventures(root).find((one) => comparableText(one.title) === comparableText(name));
52
+ if (input.action === "remove" && adventure !== undefined) {
53
+ return { kind: "adventure-removed", ...removeAdventure(root, context, adventure) };
54
+ }
55
+ return input.action === "remove" ? removed(root, context, name) : await uninstalled(root, context, name);
56
+ },
57
+ format(result) {
58
+ if (result.kind === "adventure-installed") {
59
+ return adventureText(result);
60
+ }
61
+ if (result.kind === "adventure-removed") {
62
+ return removedText(result);
63
+ }
64
+ if (result.kind === "exported") {
65
+ return exportText(result);
66
+ }
67
+ if (result.kind === "language-installed") {
68
+ const { language } = result;
69
+ return [
70
+ `Installed ${language.name} (${language.code}) ${language.version}, the dashboard's words made by hand${language.verified ? "" : ", by someone else"}, for every campaign on this computer.`,
71
+ result.replaced === undefined ? "" : `It takes the place of ${result.replaced}.`,
72
+ result.missing === 0 ? "" : `The ${result.missing} phrases it lacks stay as the dashboard has them, its own or translated on the fly.`,
73
+ ].filter((line) => line !== "").join(" ");
74
+ }
75
+ if (result.kind === "system-installed") {
76
+ const { system } = result;
77
+ return [
78
+ `Installed the game system ${system.name}${system.version === undefined ? "" : ` ${system.version}`}, ${system.title}${system.verified ? "" : ", not verified: at the player's risk"}.`,
79
+ // In a setup with no system yet, the one just installed is chosen next (D-513 (1)).
80
+ system.used
81
+ ? "The campaign plays it."
82
+ : result.plays === undefined
83
+ ? `The campaign has no system yet: if the player chose this one, set it with config, setting system, value ${system.name}.`
84
+ : `It is for a new campaign, chosen in its setup: this one plays ${result.plays}.`,
85
+ !system.code ? "" : result.plays === undefined ? "Its code runs once config sets it." : codeText(result.loaded),
86
+ ].filter((line) => line !== "").join(" ");
87
+ }
88
+ if (result.kind === "removed") {
89
+ return `The campaign no longer uses ${result.name}: its commands and its parts of your instructions are gone; what it kept in the campaign stays, and comes back if it is installed again.`;
90
+ }
91
+ if (result.kind === "uninstalled") {
92
+ return result.extension
93
+ ? `${result.name} is off this computer${result.wasUsed ? ", and the campaign no longer uses it" : ""}: another campaign that lists it asks to install it again.`
94
+ : `${result.name} is off this computer.`;
95
+ }
96
+ if (result.kind === "installed") {
97
+ const { extension } = result;
98
+ const what = `${extension.name} ${extension.version}${result.verified ? ", verified" : ", not verified: at the player's risk"}`;
99
+ const said = [
100
+ `${result.already ? `The campaign already uses ${what}` : `Installed ${what}, and the campaign uses it`}: ${extension.about}.`,
101
+ result.codeLeftOut ? "Its code is not used: the player's yes holds for another version or other files; install it again for their yes." : "",
102
+ result.commands.length === 0 ? "" : `Its commands: ${result.commands.join(", ")}.${result.tools === "" ? "" : ` ${result.tools}`}`,
103
+ Object.keys(extension.parts).length === 0 ? "" : `Its parts of your instructions are given when they apply: ${Object.keys(extension.parts).join(", ")}.`,
104
+ ].filter((line) => line !== "").join(" ");
105
+ return result.part === undefined ? said : `${said}\n\nIts part for now:\n\n${result.part}`;
106
+ }
107
+ if (result.kind === "available") {
108
+ if (result.failed !== undefined) {
109
+ return `npm could not be asked: ${result.failed}.`;
110
+ }
111
+ const lines = result.packages.map((one) => {
112
+ const here = one.installed === undefined ? "" : one.update ? `, installed ${one.installed}: an update` : ", installed";
113
+ const by = one.author === undefined ? "" : ` by ${one.author}`;
114
+ const newer = one.newer === undefined ? "" : ` (its ${one.newer.version} needs ${one.newer.engine === undefined ? "a newer rpg-engine" : `rpg-engine ${one.newer.engine}`})`;
115
+ return `${one.name} ${one.version}${one.verified ? "" : " (not verified)"}${by}${here}${newer}${one.description === undefined ? "" : `: ${one.description.replace(/\.$/, "")}`}`;
116
+ });
117
+ return `On npm: ${lines.length === 0 ? "none" : lines.join("; ")}.`;
118
+ }
119
+ const installedLines = result.installed.map((one) => "broken" in one ? `${one.name} (broken: ${one.broken}; install it again)` : `${one.name} ${one.version}${one.verified ? "" : " (not verified)"}${one.used ? ", used by the campaign" : ""}`);
120
+ return [
121
+ `On this computer: ${installedLines.length === 0 ? "none" : installedLines.join("; ")}.`,
122
+ result.missing.length === 0 ? "" : `The campaign lists, not installed here: ${result.missing.join(", ")}; install each with package install.`,
123
+ result.adventures.length === 0 ? "" : `Its adventures: ${result.adventures.map((one) => `${one.title} ${one.version}${one.since === undefined ? "" : `, since ${one.since}`}`).join("; ")}.`,
124
+ "package available says those npm has, and updates.",
125
+ ].filter((line) => line !== "").join("\n");
126
+ },
127
+ });
128
+ /** What the master hears of an adventure installed (D-483 (5)): what it is in a few lines, then what to read and where it starts, never its text. */
129
+ export function adventureText(result) {
130
+ const { manifest } = result;
131
+ const by = manifest.author === undefined ? "" : ` by ${manifest.author}`;
132
+ const rights = manifest.license ?? "all rights reserved";
133
+ const counts = Object.entries(result.counts).map(([kind, count]) => `${count} ${kind}`).join(", ");
134
+ const levels = manifest.levels === undefined ? undefined : manifest.levels.from === manifest.levels.to ? `level ${manifest.levels.from}` : `levels ${manifest.levels.from}-${manifest.levels.to}`;
135
+ const start = result.start === undefined
136
+ ? ""
137
+ : result.start.placed
138
+ ? ` It starts in [[${result.start.name}]].`
139
+ : ` It starts in [[${result.start.name}]], in no place of the world yet: write it into the place that holds it, or give it a position, and a road from where it is reached.`;
140
+ const read = manifest.opening === undefined ? "Read its places and quests" : `Show [[${manifest.opening}]] and the pages it says to read first`;
141
+ return [
142
+ `${result.already ? "The campaign already has" : "Installed"} the adventure ${manifest.title} ${manifest.version}${by} (${rights}): ${manifest.about.replace(/\.$/, "")}. ${counts}.`,
143
+ levels === undefined ? "" : `It is written for ${levels}: adapt it to the party's.`,
144
+ manifest.content.length === 0 ? "" : `Its content: ${manifest.content.join(", ")}; keep to the player's lines and veils.`,
145
+ result.firstDate === undefined
146
+ ? ""
147
+ : result.shift === 0
148
+ ? `Its first date: [[${result.firstDate.page}]], on ${result.firstDate.date}.`
149
+ : `Its dates moved ${result.shift} days: the first, [[${result.firstDate.page}]], on ${result.firstDate.date}.`,
150
+ result.textDates === 0 ? "" : result.textDates === 1 ? "1 date in its text stays as written: count it from today." : `${result.textDates} dates in its text stay as written: count them from today.`,
151
+ result.shadows.length === 0 ? "" : `Its pages take the place of the game system's: ${result.shadows.join(", ")}.`,
152
+ result.covers.length === 0 ? "" : `Its rules take the place of the game system's: ${result.covers.join(", ")}.`,
153
+ result.ignored.length === 0 ? "" : `Left out, no part of an adventure: ${result.ignored.join(", ")}.`,
154
+ ...layersText(result.layers),
155
+ `${read} before you narrate.${start} Bring a hook into the story: the adventure begins when the player takes it.`,
156
+ ].filter((line) => line !== "").join(" ");
157
+ }
158
+ /** What the master hears of an adventure's layers (ADV-8): the pages of the game system they change, with their type, and those left out, with why. */
159
+ function layersText(layers) {
160
+ // With the values, so that the master can write any of them into the campaign's own layer.
161
+ const kept = layers.kept.map((one) => {
162
+ const sections = one.sections.length === 0 ? [] : [`the section${one.sections.length === 1 ? "" : "s"} ${one.sections.join(", ")}`];
163
+ const gave = [...Object.entries(one.fields).map(([field, value]) => `${field} ${value}`), ...sections, ...(one.introduction ? ["the introduction"] : [])];
164
+ return `The campaign's own layer over ${one.page} stays: the adventure's is left out (it gave ${gave.join(", ")}).`;
165
+ });
166
+ return [
167
+ layers.changed.length === 0 ? "" : `Its layers change pages of the game system for the whole campaign: ${typedPages(layers.changed)}; show says what each changes.`,
168
+ ...kept,
169
+ layers.stray.length === 0 ? "" : `Left out, as the rules the campaign plays have no such page: ${layers.stray.join(", ")}.`,
170
+ ];
171
+ }
172
+ /** What the master hears of an adventure taken out (ADV-6, ADV-8): its files gone, the pages of the game system its layers change no more, and the layers that stay. */
173
+ function removedText(result) {
174
+ return [
175
+ `${result.title} is out of the campaign, with the files it wrote.`,
176
+ result.layers.length === 0 ? "" : `Its layers are off ${typedPages(result.layers)}: each reads as the game system writes it again.`,
177
+ result.layersKept.length === 0 ? "" : `What it layered over ${result.layersKept.join(", ")} was changed since it came, and stays the campaign's: write the page with layer and reset takes it off.`,
178
+ ].filter((line) => line !== "").join(" ");
179
+ }
180
+ /** "Bog Hound (creature), Hardtack (item)": pages of the game system, each with its type. */
181
+ function typedPages(pages) {
182
+ return pages.map((one) => (one.type === undefined ? one.page : `${one.page} (${one.type})`)).join(", ");
183
+ }
184
+ /** The packages on this computer, and those the campaign lists and does not find there: at once, without npm (D-442). */
185
+ function listed(root, context) {
186
+ const used = Object.keys(listedExtensions(root));
187
+ const here = installedExtensions(context.extensionFolders ?? []).map((found) => {
188
+ const issues = issuesOf(found.folder);
189
+ try {
190
+ const extension = readExtension(found.folder);
191
+ return {
192
+ name: extension.name,
193
+ package: extension.package,
194
+ version: extension.version,
195
+ title: extension.title,
196
+ about: extension.about,
197
+ verified: isVerified(extension.package, extension.linked),
198
+ used: used.includes(extension.package),
199
+ ...issues,
200
+ };
201
+ }
202
+ catch (error) {
203
+ return { name: shortName(found.package), package: found.package, broken: error instanceof Error ? error.message : String(error), ...issues };
204
+ }
205
+ });
206
+ const adventures = installedAdventures(root).map((one) => ({ title: one.title, version: one.version, ...(one.since === undefined ? {} : { since: one.since }), removable: storyTouching(root, one) === undefined }));
207
+ return { kind: "list", installed: here, missing: used.filter((name) => !here.some((one) => one.package === name)), adventures, systems: systemsHere(root, context), languages: languagesHere(context) };
208
+ }
209
+ /** The extensions npm has for this rpg-engine's API, ours first, each with the version installed here and whether npm has a newer one (D-442). */
210
+ async function available(context) {
211
+ const searched = context.packages === undefined ? { failed: "only the game's server and the command line reach npm" } : await context.packages.search();
212
+ if ("failed" in searched) {
213
+ return { kind: "available", packages: [], failed: searched.failed };
214
+ }
215
+ const here = installedExtensions(context.extensionFolders ?? []);
216
+ const packages = searched.filter((one) => one.kind === "extension" && readsApi(one.api, "extension")).map((one) => {
217
+ const installed = here.find((found) => found.package === one.name);
218
+ const copy = installed === undefined ? undefined : usable(context, one.name);
219
+ const version = copy?.version;
220
+ return {
221
+ name: shortName(one.name),
222
+ package: one.name,
223
+ version: one.version,
224
+ ...(one.description === undefined ? {} : { description: one.description }),
225
+ ...(one.author === undefined ? {} : { author: one.author }),
226
+ // What npm has is ours by its scope; the copy here is not, when a file or a folder of this computer took its place (D-452).
227
+ verified: isVerified(one.name, copy?.linked ?? false),
228
+ ...(installed === undefined ? {} : { installed: version ?? "broken" }),
229
+ update: version !== undefined && isNewerVersion(one.version, version),
230
+ ...(one.newer === undefined ? {} : { newer: one.newer }),
231
+ };
232
+ });
233
+ return { kind: "available", packages: packages.sort((first, second) => Number(second.verified) - Number(first.verified) || first.name.localeCompare(second.name)) };
234
+ }
235
+ /** When the code of the system just installed runs, for the campaign that plays it. */
236
+ function codeText(loaded) {
237
+ return loaded === undefined ? "Its code runs from the next start of the game's server." : "runs" in loaded ? "Its code runs from now." : `Its code does not run: ${loaded.why.replace(/\.$/, "")}.`;
238
+ }
239
+ /** Installs an adventure from a .zip, a folder or a link (D-483): no npm, no code, and the same refusals wherever it comes from. */
240
+ async function adventureInstalled(root, context, spec) {
241
+ const adventure = await readAdventureSpec(spec, context);
242
+ return { kind: "adventure-installed", ...installAdventure(root, context, adventure, spec) };
243
+ }
244
+ /** What the master hears of an export (ADV-7, ADV-8): the file, what it came from, the layers it carries and what stayed out. */
245
+ function exportText(result) {
246
+ const layersOut = (why, what) => {
247
+ const names = result.leftOut.layers.filter((one) => one.why === why).map((one) => one.name);
248
+ return names.length === 0 ? "" : `${what} (${names.join(", ")})`;
249
+ };
250
+ const out = [
251
+ result.leftOut.characters.length === 0 ? "" : `the player characters (${result.leftOut.characters.join(", ")})`,
252
+ result.leftOut.adventures.length === 0 ? "" : `the adventures it installed (${result.leftOut.adventures.join(", ")})`,
253
+ layersOut("adventure", "the layers an installed adventure brought, not changed since"),
254
+ layersOut("no-page", "the layers over no page of the game system, which validate names"),
255
+ layersOut("forbidden", "the layers that write what a layer cannot change, which validate names with the fields to take out"),
256
+ layersOut("unread", "the layers that do not read, which validate names with what to fix"),
257
+ ].filter((part) => part !== "");
258
+ const kinds = result.layers.length === 0 ? "pages" : "pages or layers";
259
+ return [
260
+ `Wrote ${result.file}: ${result.pages} pages, from ${result.from}${out.length === 0 ? "" : `, without ${out.join(" and ")}`}.`,
261
+ result.layers.length === 0 ? "" : `It carries the campaign's layers over pages of the game system, as they are now: ${typedPages(result.layers)}.`,
262
+ result.opening === undefined
263
+ ? "It has no opening page: one tagged opening, with the situation, the hooks, what happens if no one steps in and the pages to read first, and its start, makes it ready."
264
+ : `Its opening is [[${result.opening}]].`,
265
+ result.sourced === undefined
266
+ ? "The player shares it as a file, and only what they have the right to share."
267
+ : `${result.sourced.length} of its ${kinds} come from the player's own documents (source:): ${result.sourced.slice(0, 5).join(", ")}${result.sourced.length > 5 ? "…" : ""}. `
268
+ + "So it says personal use only. Ask the player whether they may share it: only with the document's own license, or their rights to it; if so, export again with that license.",
269
+ ].filter((line) => line !== "").join(" ");
270
+ }
@@ -0,0 +1,89 @@
1
+ import type { Extension } from "../../extensions/index.ts";
2
+ import type { AdventureExported, AdventureInstalled, AdventureRemoved } from "../shared/books/adventures.ts";
3
+ import type { InstalledLanguage, InstalledSystem } from "./here.ts";
4
+ export type PackageResult = {
5
+ kind: "list";
6
+ installed: Installed[];
7
+ missing: string[];
8
+ adventures: {
9
+ title: string;
10
+ version: string;
11
+ since?: string;
12
+ removable: boolean;
13
+ }[];
14
+ systems: InstalledSystem[];
15
+ languages: InstalledLanguage[];
16
+ } | {
17
+ kind: "available";
18
+ packages: Available[];
19
+ failed?: string;
20
+ } | {
21
+ kind: "installed";
22
+ extension: Extension;
23
+ verified: boolean;
24
+ commands: string[];
25
+ codeLeftOut: boolean;
26
+ already: boolean;
27
+ part?: string;
28
+ tools: string;
29
+ } | {
30
+ kind: "removed";
31
+ name: string;
32
+ } | {
33
+ kind: "uninstalled";
34
+ name: string;
35
+ wasUsed: boolean;
36
+ extension: boolean;
37
+ } | {
38
+ kind: "system-installed";
39
+ system: InstalledSystem;
40
+ plays?: string;
41
+ loaded?: {
42
+ runs: true;
43
+ } | {
44
+ why: string;
45
+ };
46
+ } | {
47
+ kind: "language-installed";
48
+ language: InstalledLanguage;
49
+ replaced?: string;
50
+ missing: number;
51
+ } | ({
52
+ kind: "adventure-installed";
53
+ } & AdventureInstalled) | ({
54
+ kind: "adventure-removed";
55
+ } & AdventureRemoved) | ({
56
+ kind: "exported";
57
+ } & AdventureExported);
58
+ /** A package on this computer, as list gives it to the master and to the dashboard; broken when it does not read (D-442); with where its problems are reported. */
59
+ export type Installed = {
60
+ name: string;
61
+ package: string;
62
+ version: string;
63
+ title: string;
64
+ about: string;
65
+ verified: boolean;
66
+ used: boolean;
67
+ issues?: string;
68
+ } | {
69
+ name: string;
70
+ package: string;
71
+ broken: string;
72
+ issues?: string;
73
+ };
74
+ /** A package on npm for this rpg-engine, with the version installed here, if any, and whether it is newer (D-442). */
75
+ export interface Available {
76
+ name: string;
77
+ package: string;
78
+ version: string;
79
+ description?: string;
80
+ author?: string;
81
+ verified: boolean;
82
+ installed?: string;
83
+ update: boolean;
84
+ /** Its latest version, which needs a newer rpg-engine (D-515 (2)). */
85
+ newer?: {
86
+ version: string;
87
+ engine?: string;
88
+ };
89
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Context } from "../../core/context.ts";
2
+ import type { PackageResult } from "./result.ts";
3
+ /** Takes an extension out of the campaign; it stays on this computer, for other campaigns. */
4
+ export declare function removed(root: string, context: Context, name: string): PackageResult;
5
+ /** Takes a package off this computer with npm, and out of the campaign when it uses it (D-442); other campaigns that list it ask to install it again. */
6
+ export declare function uninstalled(root: string, context: Context, name: string): Promise<PackageResult>;
@@ -0,0 +1,70 @@
1
+ // Takes a package out of the campaign, or off this computer
2
+ import { join } from "node:path";
3
+ import { changeExtensions } from "../../campaign/index.js";
4
+ import { appendLogEntry } from "../../core/log.js";
5
+ import { Refusal } from "../../core/refusal.js";
6
+ import { files } from "../../core/store.js";
7
+ import { comparableText } from "../../core/text.js";
8
+ import { dropConsent, installedExtensions, shortName } from "../../extensions/index.js";
9
+ import { isPackageName } from "../../packages/index.js";
10
+ import { listedExtensions } from "../shared/packages/extensions.js";
11
+ import { newDatedLogEntry } from "../shared/time/time.js";
12
+ import { installedExtensionFolder, languagesHere, systemsHere } from "./here.js";
13
+ /** Takes an extension out of the campaign; it stays on this computer, for other campaigns. */
14
+ export function removed(root, context, name) {
15
+ const listed = listedExtensions(root);
16
+ const found = Object.keys(listed).find((candidate) => candidate === name || comparableText(shortName(candidate)) === comparableText(name));
17
+ if (found === undefined) {
18
+ const names = Object.keys(listed).map(shortName);
19
+ throw new Refusal(`The campaign does not use ${name}${names.length === 0 ? ": it uses no package" : `; it uses ${names.join(", ")}`}. Nothing changed.`, "not-used", { name });
20
+ }
21
+ const rest = Object.fromEntries(Object.entries(listed).filter(([candidate]) => candidate !== found));
22
+ changeExtensions(root, rest);
23
+ appendLogEntry(root, newDatedLogEntry(root, context, "package-removed", "public", { package: found }));
24
+ return { kind: "removed", name: shortName(found) };
25
+ }
26
+ /** Takes a package off this computer with npm, and out of the campaign when it uses it (D-442); other campaigns that list it ask to install it again. */
27
+ export async function uninstalled(root, context, name) {
28
+ const packages = context.packages;
29
+ const system = systemsHere(root, context).find((one) => one.package !== undefined && (one.package === name || comparableText(one.name) === comparableText(name)));
30
+ if (system?.used === true) {
31
+ throw new Refusal(`The campaign plays ${system.name}: it stays on this computer. Nothing changed.`, "system-played", { name: system.name });
32
+ }
33
+ const other = system?.package ?? languagesHere(context).find((one) => one.package === name || comparableText(one.code) === comparableText(name))?.package;
34
+ const found = other === undefined
35
+ ? installedExtensions(context.extensionFolders ?? []).find((one) => one.package === name || comparableText(shortName(one.package)) === comparableText(name))
36
+ : { package: other };
37
+ // A package that reads as nothing, as a system whose system.yaml is broken, is still npm's to take away by its folder, under its npm name.
38
+ const npmName = name.startsWith("npm:") ? name.slice(4) : name;
39
+ if (found === undefined && packages !== undefined && isPackageName(npmName) && (context.extensionFolders ?? []).some((folder) => files().entries(join(folder, ...npmName.split("/"))).length > 0)) {
40
+ const why = await packages.uninstall(npmName);
41
+ if (why !== undefined) {
42
+ throw new Refusal(`${npmName} could not be taken off this computer: ${why}. Nothing changed.`, "uninstall-failed", { name: npmName, why });
43
+ }
44
+ return { kind: "uninstalled", name: npmName, wasUsed: false, extension: false };
45
+ }
46
+ if (found === undefined) {
47
+ const here = installedExtensions(context.extensionFolders ?? []).map((one) => shortName(one.package));
48
+ throw new Refusal(`${name} is not on this computer${here.length === 0 ? ": no package is" : `; these are: ${here.join(", ")}`}. Nothing changed.`, "not-here", { name });
49
+ }
50
+ if (packages === undefined) {
51
+ throw new Error("Packages are uninstalled only by the game's server or the command line, which reach npm.");
52
+ }
53
+ const folder = installedExtensionFolder(context, found.package);
54
+ const why = await packages.uninstall(found.package);
55
+ if (why !== undefined) {
56
+ throw new Refusal(`${found.package} could not be uninstalled: ${why}. Nothing changed.`, "uninstall-failed", { name: found.package, why });
57
+ }
58
+ // Off this computer, its yes goes with it: installed again, it is asked again.
59
+ if (folder !== undefined) {
60
+ dropConsent(folder, found.package);
61
+ }
62
+ [...context.systemFolders, ...(context.extensionFolders ?? [])].forEach((folder) => files().refresh(folder));
63
+ const listed = listedExtensions(root);
64
+ const wasUsed = Object.hasOwn(listed, found.package);
65
+ if (wasUsed) {
66
+ changeExtensions(root, Object.fromEntries(Object.entries(listed).filter(([candidate]) => candidate !== found.package)));
67
+ }
68
+ appendLogEntry(root, newDatedLogEntry(root, context, "package-uninstalled", "public", { package: found.package }));
69
+ return { kind: "uninstalled", name: shortName(found.package), wasUsed, extension: other === undefined };
70
+ }
@@ -7,9 +7,9 @@ import { defineCommand } from "../core/registry.js";
7
7
  import { files } from "../core/store.js";
8
8
  import { comparableText } from "../core/text.js";
9
9
  import { applyRename, pageNamed, pageWithPath, planRename, renamedLinks } from "../pages/index.js";
10
- import { readOpenScene, updateScene } from "./shared/scene.js";
11
- import { newDatedLogEntry } from "./shared/time.js";
12
- import { campaignWorld } from "./shared/world.js";
10
+ import { campaignWorld } from "./shared/campaign/world.js";
11
+ import { readOpenScene, updateScene } from "./shared/scene/scene.js";
12
+ import { newDatedLogEntry } from "./shared/time/time.js";
13
13
  export const rename = defineCommand({
14
14
  name: "rename",
15
15
  description: "Give a page of the campaign a new name, as when the player names their wolf or the character learns a place's true name. "
@@ -4,12 +4,12 @@ import { appendLogEntry, readLog } from "../core/log.js";
4
4
  import { defineCommand } from "../core/registry.js";
5
5
  import { comparableText, withArticle } from "../core/text.js";
6
6
  import { baseChain, isEmptyField, isPartyMember, isPlayerCharacter, links, locate, pageNamed, parsePageReference, playerCharacters, secretNames, shownPart, systemLabel, withPage, writePage } from "../pages/index.js";
7
+ import { campaignWorld } from "./shared/campaign/world.js";
8
+ import { knownLink, knownLinks } from "./shared/characters/knowledge.js";
7
9
  import { textList, textsOf } from "./shared/inputs.js";
8
- import { knownLink, knownLinks } from "./shared/knowledge.js";
9
- import { placedPosition } from "./shared/positions.js";
10
- import { copyName, readOpenScene } from "./shared/scene.js";
11
- import { newDatedLogEntry } from "./shared/time.js";
12
- import { campaignWorld } from "./shared/world.js";
10
+ import { placedPosition } from "./shared/places/positions.js";
11
+ import { copyName, readOpenScene } from "./shared/scene/scene.js";
12
+ import { newDatedLogEntry } from "./shared/time/time.js";
13
13
  export const reveal = defineCommand({
14
14
  name: "reveal",
15
15
  description: "Record what characters learn: a secret, as Page#Secret, or a whole page they did not know. "
@@ -7,16 +7,18 @@ import { comparableText, sameName, valueNamed } from "../../core/text.js";
7
7
  import { readCounter } from "../../counters/index.js";
8
8
  import { askOracle, DiceError, rollDice, sha256, tossCoins } from "../../dice/index.js";
9
9
  import { declaredKind, findPage, isPlayerCharacter, pagesWithName, writePage } from "../../pages/index.js";
10
- import { effectiveFields, effectsOf } from "../shared/effect-layer.js";
11
- import { systemNamed } from "../shared/effects.js";
12
- import { behindTheScreen, namesNoOne, ofTheParty, screenNote, screenUp, sealHiddenRoll } from "../shared/master-rolls.js";
10
+ import { firstInChat } from "../shared/campaign/parts.js";
11
+ import { campaignSystem, campaignSystemWords, campaignWorld, missingSystemHint } from "../shared/campaign/world.js";
13
12
  import { packagesRolled } from "../shared/packages/hooks.js";
14
- import { firstInChat } from "../shared/parts.js";
15
- import { copyPage, readOpenScene } from "../shared/scene.js";
16
- import { knowledgeNote } from "../shared/sheet.js";
17
- import { newDatedLogEntry } from "../shared/time.js";
18
- import { itemList, signedText, workedFields } from "../shared/worked-out.js";
19
- import { campaignSystem, campaignSystemWords, campaignWorld, missingSystemHint } from "../shared/world.js";
13
+ import { systemNamed } from "../shared/scene/effects.js";
14
+ import { behindTheScreen, namesNoOne, ofTheParty, screenNote, screenUp, sealHiddenRoll } from "../shared/scene/master-rolls.js";
15
+ import { copyPage, readOpenScene } from "../shared/scene/scene.js";
16
+ import { effectiveFields, effectsOf } from "../shared/sheet/effect-layer.js";
17
+ import { knowledgeNote } from "../shared/sheet/sheet.js";
18
+ import { itemList } from "../shared/sheet/system-fields.js";
19
+ import { workedFields } from "../shared/sheet/worked-out.js";
20
+ import { signedText } from "../shared/sheet/worked-text.js";
21
+ import { newDatedLogEntry } from "../shared/time/time.js";
20
22
  import { rollPageTable } from "./tables.js";
21
23
  // Faces arrive as "14,7" or "14 7" from a shell (PowerShell turns 14,7 into "14 7"), or as an array.
22
24
  export const faceValues = z.preprocess((value) => (typeof value === "string" ? value.split(/[\s,;]+/).filter(Boolean).map(Number) : value), z.array(z.number()));
@@ -1,7 +1,7 @@
1
1
  import { comparableText } from "../../core/text.js";
2
2
  import { DiceError, readRandomTable, rollOnTable } from "../../dice/index.js";
3
3
  import { baseChain, findPage, firstTable, pageNamed, parsePageReference, readSection, secretNames, sectionTitles } from "../../pages/index.js";
4
- import { campaignWorld, missingSystemHint } from "../shared/world.js";
4
+ import { campaignWorld, missingSystemHint } from "../shared/campaign/world.js";
5
5
  /** A roll on the table of a page's section, given as Page#Section; refused, saying what to fix, before anything is rolled. */
6
6
  export function rollPageTable(root, context, reference, source) {
7
7
  const { name, section } = parsePageReference(reference);
@@ -22,7 +22,7 @@ export declare const rules: import("../core/registry.ts").Command<z.ZodObject<{
22
22
  house: undefined;
23
23
  found: undefined;
24
24
  precedents: string[];
25
- library: import("./shared/library.ts").LibraryAnswer | undefined;
25
+ library: import("./shared/books/library.ts").LibraryAnswer | undefined;
26
26
  text: string;
27
27
  system: string | undefined;
28
28
  missingSystem: string | undefined;
@@ -39,7 +39,7 @@ export declare const rules: import("../core/registry.ts").Command<z.ZodObject<{
39
39
  system?: string;
40
40
  } | undefined;
41
41
  pageSections: PageSection[];
42
- library: import("./shared/library.ts").LibraryAnswer | undefined;
42
+ library: import("./shared/books/library.ts").LibraryAnswer | undefined;
43
43
  systemNames: string[];
44
44
  text: string;
45
45
  system: string | undefined;
@@ -6,9 +6,9 @@ import { comparableText } from "../core/text.js";
6
6
  import { findPage, pageFileNamed, pageNamed as pageWithName, sectionTitles } from "../pages/index.js";
7
7
  import { bookTitles, findRules, hasAllWords, isTitled, readRuleBook, shownRules } from "../rules/index.js";
8
8
  import { systemContentFolders } from "../systems/index.js";
9
- import { libraryAnswer, libraryLines, systemWordsNamed } from "./shared/library.js";
10
- import { disagreementAdvice, hasTranslatedRules, houseRules, precedentRule, systemRuleBook } from "./shared/rules.js";
11
- import { campaignSystem, campaignSystemWords, campaignWorld, foreignLanguage } from "./shared/world.js";
9
+ import { libraryAnswer, libraryLines, systemWordsNamed } from "./shared/books/library.js";
10
+ import { disagreementAdvice, hasTranslatedRules, houseRules, precedentRule, systemRuleBook } from "./shared/books/rules.js";
11
+ import { campaignSystem, campaignSystemWords, campaignWorld, foreignLanguage } from "./shared/campaign/world.js";
12
12
  // About how many words an answer shows: a section of the system has about 80 words in the middle (D-178).
13
13
  const answerWords = 800;
14
14
  // What the rules add when the text is the name of a page, which holds the answer: a spell, an item (D-195).
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { Save } from "../saves/index.ts";
3
- import { type ResetPoint, type SaveMode } from "./shared/saves.ts";
3
+ import { type ResetPoint, type SaveMode } from "./shared/campaign/saves.ts";
4
4
  /** What save did: the list, a save made, or the game gone back to a save or to its start. */
5
5
  export type SaveResult = {
6
6
  action: "list";
@@ -30,8 +30,8 @@ export declare const save: import("../core/registry.ts").Command<z.ZodObject<{
30
30
  action: z.ZodDefault<z.ZodEnum<{
31
31
  load: "load";
32
32
  list: "list";
33
- make: "make";
34
33
  reset: "reset";
34
+ make: "make";
35
35
  "new chat": "new chat";
36
36
  }>>;
37
37
  label: z.ZodOptional<z.ZodString>;
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { requireCampaign } from "../campaign/index.js";
3
3
  import { defineCommand } from "../core/registry.js";
4
- import { campaignSaves, interruptedLoad, loadRefusal, loadRule, loadSave, makeSave, mayGoBack, newChatBegun, newChatText, resetPoints, resetSave, saveMode, savesWhy, saveText, wentBackTo, } from "./shared/saves.js";
5
- import { campaignWorld } from "./shared/world.js";
4
+ import { campaignSaves, interruptedLoad, loadRefusal, loadRule, loadSave, makeSave, mayGoBack, newChatBegun, newChatText, resetPoints, resetSave, saveMode, savesWhy, saveText, wentBackTo, } from "./shared/campaign/saves.js";
5
+ import { campaignWorld } from "./shared/campaign/world.js";
6
6
  const actions = ["list", "make", "load", "reset", "new chat"];
7
7
  export const save = defineCommand({
8
8
  name: "save",
@@ -0,0 +1,18 @@
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import type { Member, Saved, SceneResult } from "./result.ts";
4
+ /** Ends the scene; one that cannot be read is closed too, so that a scene written wrongly by hand never blocks the game. */
5
+ export declare function close(root: string, world: World, summary: string, context: Context): SceneResult;
6
+ export declare function closedText(result: {
7
+ title?: string;
8
+ rounds?: number;
9
+ copies: Member[];
10
+ gone?: Member[];
11
+ unreadable?: string;
12
+ ended: string[];
13
+ endless: string[];
14
+ rewards?: string[];
15
+ fallen?: string;
16
+ afterPeak?: string;
17
+ quests: string[];
18
+ } & Saved): string;