rpg-engine 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (486) hide show
  1. package/dist/campaign/index.d.ts +1 -1
  2. package/dist/campaign/index.js +1 -1
  3. package/dist/campaign/settings.d.ts +6 -0
  4. package/dist/campaign/settings.js +22 -1
  5. package/dist/cli/cli.js +1 -1
  6. package/dist/cli/command-line.js +1 -1
  7. package/dist/commands/advance.d.ts +1 -1
  8. package/dist/commands/advance.js +6 -6
  9. package/dist/commands/ask.js +7 -7
  10. package/dist/commands/change/amounts.d.ts +32 -0
  11. package/dist/commands/change/amounts.js +150 -0
  12. package/dist/commands/change/change.d.ts +4 -54
  13. package/dist/commands/change/change.js +19 -749
  14. package/dist/commands/change/damage.d.ts +30 -0
  15. package/dist/commands/change/damage.js +73 -2
  16. package/dist/commands/change/dice.d.ts +34 -0
  17. package/dist/commands/change/dice.js +59 -0
  18. package/dist/commands/change/fields.d.ts +37 -0
  19. package/dist/commands/change/fields.js +156 -0
  20. package/dist/commands/change/holder.d.ts +48 -0
  21. package/dist/commands/change/holder.js +162 -0
  22. package/dist/commands/change/recipe-pace.js +1 -1
  23. package/dist/commands/change/recipe.d.ts +58 -0
  24. package/dist/commands/change/recipe.js +179 -0
  25. package/dist/commands/choices.js +3 -3
  26. package/dist/commands/config/config.d.ts +15 -0
  27. package/dist/commands/config/config.js +355 -0
  28. package/dist/commands/config/custom-levels.d.ts +7 -0
  29. package/dist/commands/config/custom-levels.js +32 -0
  30. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  31. package/dist/commands/config/dashboard.js +171 -0
  32. package/dist/commands/config/entries.d.ts +17 -0
  33. package/dist/commands/config/entries.js +76 -0
  34. package/dist/commands/config/news.d.ts +7 -0
  35. package/dist/commands/config/news.js +88 -0
  36. package/dist/commands/config/shown.d.ts +9 -0
  37. package/dist/commands/config/shown.js +80 -0
  38. package/dist/commands/config/words.d.ts +27 -0
  39. package/dist/commands/config/words.js +204 -0
  40. package/dist/commands/effect.js +9 -9
  41. package/dist/commands/find.js +1 -1
  42. package/dist/commands/image.js +6 -6
  43. package/dist/commands/import/import.d.ts +0 -2
  44. package/dist/commands/import/import.js +45 -44
  45. package/dist/commands/import/run.js +1 -1
  46. package/dist/commands/index.js +3 -3
  47. package/dist/commands/init.js +2 -2
  48. package/dist/commands/install.js +1 -1
  49. package/dist/commands/instructions.js +6 -6
  50. package/dist/commands/mode.d.ts +2 -2
  51. package/dist/commands/mode.js +8 -8
  52. package/dist/commands/mood.js +4 -4
  53. package/dist/commands/move.js +10 -10
  54. package/dist/commands/package/consent.d.ts +11 -0
  55. package/dist/commands/package/consent.js +52 -0
  56. package/dist/commands/package/here.d.ts +51 -0
  57. package/dist/commands/package/here.js +128 -0
  58. package/dist/commands/package/install.d.ts +10 -0
  59. package/dist/commands/package/install.js +337 -0
  60. package/dist/commands/package/package.d.ts +18 -0
  61. package/dist/commands/package/package.js +236 -0
  62. package/dist/commands/package/result.d.ts +90 -0
  63. package/dist/commands/package/result.js +1 -0
  64. package/dist/commands/package/uninstall.d.ts +6 -0
  65. package/dist/commands/package/uninstall.js +70 -0
  66. package/dist/commands/rename.js +3 -3
  67. package/dist/commands/reveal.js +5 -5
  68. package/dist/commands/roll/roll.js +11 -9
  69. package/dist/commands/roll/tables.js +1 -1
  70. package/dist/commands/rules.d.ts +2 -2
  71. package/dist/commands/rules.js +3 -3
  72. package/dist/commands/save.d.ts +1 -1
  73. package/dist/commands/save.js +2 -2
  74. package/dist/commands/scene/close.d.ts +18 -0
  75. package/dist/commands/scene/close.js +179 -0
  76. package/dist/commands/scene/members.d.ts +14 -0
  77. package/dist/commands/scene/members.js +32 -0
  78. package/dist/commands/scene/open.d.ts +6 -0
  79. package/dist/commands/scene/open.js +298 -0
  80. package/dist/commands/scene/result.d.ts +98 -0
  81. package/dist/commands/scene/result.js +2 -0
  82. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  83. package/dist/commands/scene/scene.js +210 -0
  84. package/dist/commands/scene/turns.d.ts +18 -0
  85. package/dist/commands/scene/turns.js +229 -0
  86. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
  87. package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
  88. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  89. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  90. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  91. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  92. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  93. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  94. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  95. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  96. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  97. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  98. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  99. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  100. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  101. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  102. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  103. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  104. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  105. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  106. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  107. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  108. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  109. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  110. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  111. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  112. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  113. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  114. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  115. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  116. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  117. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  118. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  119. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  120. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  121. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  122. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  123. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  124. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  125. package/dist/commands/shared/characters/orders.d.ts +4 -0
  126. package/dist/commands/shared/characters/orders.js +10 -0
  127. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
  128. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
  129. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  130. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  131. package/dist/commands/shared/examples.js +2 -2
  132. package/dist/commands/shared/packages/catalog.js +2 -2
  133. package/dist/commands/shared/packages/code.d.ts +1 -1
  134. package/dist/commands/shared/packages/code.js +8 -8
  135. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  136. package/dist/commands/shared/packages/extensions.js +1 -1
  137. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  138. package/dist/commands/shared/packages/hooks.js +1 -1
  139. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  140. package/dist/commands/shared/packages/widgets.js +3 -3
  141. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  142. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  143. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  144. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  145. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  146. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  147. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  148. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  149. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  150. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  151. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  152. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  153. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  154. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  155. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  156. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  157. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  158. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  159. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  160. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  161. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  162. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  163. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  164. package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
  165. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  166. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  167. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  168. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  169. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  170. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  171. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  172. package/dist/commands/shared/sheet/effect-values.js +69 -0
  173. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  174. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  175. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  176. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  177. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  178. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  179. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  180. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  181. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  182. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  183. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
  184. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  185. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  186. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  187. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  188. package/dist/commands/shared/sheet/system-fields.js +45 -0
  189. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  190. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  191. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  192. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  193. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  194. package/dist/commands/shared/sheet/worked-out.js +291 -0
  195. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  196. package/dist/commands/shared/sheet/worked-text.js +55 -0
  197. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  198. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  199. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  200. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  201. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  202. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  203. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  204. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  205. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  206. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  207. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  208. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  209. package/dist/commands/show.d.ts +3 -0
  210. package/dist/commands/show.js +28 -9
  211. package/dist/commands/status.d.ts +2 -1
  212. package/dist/commands/status.js +28 -22
  213. package/dist/commands/thoughts.js +3 -3
  214. package/dist/commands/trade.js +8 -8
  215. package/dist/commands/translate.d.ts +1 -1
  216. package/dist/commands/translate.js +3 -3
  217. package/dist/commands/travel/open.d.ts +1 -1
  218. package/dist/commands/travel/open.js +2 -2
  219. package/dist/commands/travel/route.js +7 -6
  220. package/dist/commands/travel/travel.d.ts +1 -1
  221. package/dist/commands/travel/travel.js +8 -8
  222. package/dist/commands/validate.js +3 -3
  223. package/dist/commands/view/journal.d.ts +2 -2
  224. package/dist/commands/view/journal.js +2 -2
  225. package/dist/commands/view/map.d.ts +1 -1
  226. package/dist/commands/view/map.js +6 -6
  227. package/dist/commands/view/memory.d.ts +16 -0
  228. package/dist/commands/view/memory.js +90 -0
  229. package/dist/commands/view/page.d.ts +32 -0
  230. package/dist/commands/view/page.js +163 -0
  231. package/dist/commands/view/place.d.ts +7 -2
  232. package/dist/commands/view/place.js +30 -12
  233. package/dist/commands/view/result.d.ts +245 -0
  234. package/dist/commands/view/result.js +1 -0
  235. package/dist/commands/view/saves.d.ts +6 -0
  236. package/dist/commands/view/saves.js +53 -0
  237. package/dist/commands/view/story.d.ts +32 -0
  238. package/dist/commands/view/story.js +227 -0
  239. package/dist/commands/view/view.d.ts +26 -292
  240. package/dist/commands/view/view.js +26 -534
  241. package/dist/commands/view/world.d.ts +1 -1
  242. package/dist/commands/view/world.js +3 -3
  243. package/dist/commands/write/checks.d.ts +42 -0
  244. package/dist/commands/write/checks.js +291 -0
  245. package/dist/commands/write/here.d.ts +1 -1
  246. package/dist/commands/write/here.js +5 -5
  247. package/dist/commands/write/inheritance.d.ts +40 -0
  248. package/dist/commands/write/inheritance.js +189 -0
  249. package/dist/commands/write/input.d.ts +29 -0
  250. package/dist/commands/write/input.js +124 -0
  251. package/dist/commands/write/layer.d.ts +36 -0
  252. package/dist/commands/write/layer.js +48 -0
  253. package/dist/commands/write/notes.d.ts +22 -0
  254. package/dist/commands/write/notes.js +76 -0
  255. package/dist/commands/write/progression.d.ts +27 -0
  256. package/dist/commands/write/progression.js +175 -0
  257. package/dist/commands/write/write.d.ts +1 -0
  258. package/dist/commands/write/write.js +32 -816
  259. package/dist/core/files.d.ts +2 -0
  260. package/dist/core/files.js +7 -0
  261. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  262. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  263. package/dist/core/session-store.js +3 -3
  264. package/dist/core/store.d.ts +2 -2
  265. package/dist/core/store.js +18 -4
  266. package/dist/dashboard/acts/acts.js +1 -1
  267. package/dist/dashboard/acts/sending.js +110 -0
  268. package/dist/dashboard/acts/sheet.js +2 -2
  269. package/dist/dashboard/acts/strip.js +1 -1
  270. package/dist/dashboard/address.js +6 -0
  271. package/dist/dashboard/api.js +1 -1
  272. package/dist/dashboard/app.js +47 -171
  273. package/dist/dashboard/dice/roller.js +1 -1
  274. package/dist/dashboard/dice/sets.js +2 -2
  275. package/dist/dashboard/dice/stage.js +1 -1
  276. package/dist/dashboard/dice/tray.js +6 -6
  277. package/dist/dashboard/guide/ar.md +5 -3
  278. package/dist/dashboard/guide/cs.md +5 -3
  279. package/dist/dashboard/guide/da.md +5 -3
  280. package/dist/dashboard/guide/de.md +5 -3
  281. package/dist/dashboard/guide/el.md +5 -3
  282. package/dist/dashboard/guide/en.md +2 -0
  283. package/dist/dashboard/guide/es.md +4 -2
  284. package/dist/dashboard/guide/fi.md +5 -3
  285. package/dist/dashboard/guide/fr.md +4 -2
  286. package/dist/dashboard/guide/he.md +4 -2
  287. package/dist/dashboard/guide/hi.md +6 -4
  288. package/dist/dashboard/guide/hu.md +4 -2
  289. package/dist/dashboard/guide/is.md +5 -3
  290. package/dist/dashboard/guide/it.md +3 -1
  291. package/dist/dashboard/guide/ja.md +7 -5
  292. package/dist/dashboard/guide/ko.md +6 -4
  293. package/dist/dashboard/guide/nb.md +4 -2
  294. package/dist/dashboard/guide/nl.md +5 -3
  295. package/dist/dashboard/guide/pl.md +4 -2
  296. package/dist/dashboard/guide/pt.md +4 -2
  297. package/dist/dashboard/guide/ro.md +5 -3
  298. package/dist/dashboard/guide/ru.md +5 -3
  299. package/dist/dashboard/guide/sv.md +5 -3
  300. package/dist/dashboard/guide/tr.md +6 -4
  301. package/dist/dashboard/guide/uk.md +4 -2
  302. package/dist/dashboard/guide/zh.md +5 -3
  303. package/dist/dashboard/help/help.js +3 -3
  304. package/dist/dashboard/i18n/ar.json +4 -0
  305. package/dist/dashboard/i18n/cs.json +4 -0
  306. package/dist/dashboard/i18n/da.json +4 -0
  307. package/dist/dashboard/i18n/de.json +4 -0
  308. package/dist/dashboard/i18n/el.json +4 -0
  309. package/dist/dashboard/i18n/es.json +4 -0
  310. package/dist/dashboard/i18n/fi.json +4 -0
  311. package/dist/dashboard/i18n/fr.json +4 -0
  312. package/dist/dashboard/i18n/he.json +4 -0
  313. package/dist/dashboard/i18n/hi.json +4 -0
  314. package/dist/dashboard/i18n/hu.json +4 -0
  315. package/dist/dashboard/i18n/is.json +4 -0
  316. package/dist/dashboard/i18n/it.json +4 -0
  317. package/dist/dashboard/i18n/ja.json +5 -1
  318. package/dist/dashboard/i18n/ko.json +4 -0
  319. package/dist/dashboard/i18n/nb.json +4 -0
  320. package/dist/dashboard/i18n/nl.json +4 -0
  321. package/dist/dashboard/i18n/pl.json +4 -0
  322. package/dist/dashboard/i18n/pt.json +4 -0
  323. package/dist/dashboard/i18n/ro.json +4 -0
  324. package/dist/dashboard/i18n/ru.json +4 -0
  325. package/dist/dashboard/i18n/sv.json +4 -0
  326. package/dist/dashboard/i18n/tr.json +4 -0
  327. package/dist/dashboard/i18n/uk.json +4 -0
  328. package/dist/dashboard/i18n/zh.json +4 -0
  329. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  330. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  331. package/dist/dashboard/kit.js +3 -3
  332. package/dist/dashboard/packages/ask-card.js +3 -3
  333. package/dist/dashboard/packages/catalog.js +196 -0
  334. package/dist/dashboard/packages/engine.js +87 -0
  335. package/dist/dashboard/packages/installed.js +53 -0
  336. package/dist/dashboard/packages/library.js +97 -0
  337. package/dist/dashboard/packages/outcomes.js +45 -0
  338. package/dist/dashboard/packages/packages.js +20 -576
  339. package/dist/dashboard/packages/page-code.js +15 -2
  340. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  341. package/dist/dashboard/packages/rows.js +84 -0
  342. package/dist/dashboard/packages/share.js +44 -0
  343. package/dist/dashboard/packages/widgets.js +3 -3
  344. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  345. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  346. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  347. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  348. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  349. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  350. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  351. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  352. package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
  353. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  354. package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
  355. package/dist/dashboard/place/key.js +24 -0
  356. package/dist/dashboard/place/paper.js +67 -0
  357. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  358. package/dist/dashboard/place/things.js +129 -0
  359. package/dist/dashboard/place/tokens.js +93 -0
  360. package/dist/dashboard/place/view.js +124 -0
  361. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  362. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  363. package/dist/dashboard/{choices.js → play/choices.js} +9 -9
  364. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  365. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  366. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  367. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  368. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  369. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  370. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  371. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  372. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  373. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  374. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  375. package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
  376. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  377. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  378. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  379. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  380. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  381. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  382. package/dist/dashboard/shell/shown.js +37 -0
  383. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  384. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  385. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  386. package/dist/dashboard/style.css +74 -3
  387. package/dist/dashboard/world/calendar.js +4 -4
  388. package/dist/dashboard/world/drawing.js +92 -0
  389. package/dist/dashboard/world/key.js +21 -0
  390. package/dist/dashboard/world/lore.js +5 -5
  391. package/dist/dashboard/world/map-card.js +186 -0
  392. package/dist/dashboard/world/place-card.js +39 -0
  393. package/dist/dashboard/world/places.js +29 -0
  394. package/dist/dashboard/world/world.js +9 -341
  395. package/dist/extensions/extension.d.ts +1 -1
  396. package/dist/extensions/extension.js +1 -1
  397. package/dist/images/images.js +12 -9
  398. package/dist/index.d.ts +1 -1
  399. package/dist/languages/index.d.ts +1 -1
  400. package/dist/languages/index.js +1 -1
  401. package/dist/packages/npm.js +1 -1
  402. package/dist/page.d.ts +2 -2
  403. package/dist/page.js +1 -1
  404. package/dist/pages/check.js +23 -1
  405. package/dist/pages/containers.d.ts +1 -1
  406. package/dist/pages/containers.js +1 -1
  407. package/dist/pages/index.d.ts +4 -2
  408. package/dist/pages/index.js +4 -2
  409. package/dist/pages/inheritance.d.ts +2 -2
  410. package/dist/pages/layers.d.ts +50 -0
  411. package/dist/pages/layers.js +97 -0
  412. package/dist/pages/rename-page.js +1 -1
  413. package/dist/pages/stacks/writes.js +48 -22
  414. package/dist/pages/standard-fields.d.ts +1 -1
  415. package/dist/pages/system-pages.d.ts +5 -3
  416. package/dist/pages/system-pages.js +16 -7
  417. package/dist/pages/world.d.ts +8 -1
  418. package/dist/pages/world.js +16 -4
  419. package/dist/pages/write-layer.d.ts +18 -0
  420. package/dist/pages/write-layer.js +108 -0
  421. package/dist/pages/write-page.d.ts +2 -2
  422. package/dist/pages/write-page.js +2 -2
  423. package/dist/rules/index.d.ts +1 -1
  424. package/dist/rules/index.js +1 -1
  425. package/dist/rules/search.d.ts +1 -1
  426. package/dist/rules/shown.d.ts +1 -1
  427. package/dist/server/dashboard/choices.js +3 -3
  428. package/dist/server/dashboard/files.js +5 -5
  429. package/dist/server/dashboard/index.d.ts +2 -2
  430. package/dist/server/dashboard/index.js +2 -2
  431. package/dist/server/dashboard/news.js +4 -3
  432. package/dist/server/dashboard/player.js +1 -1
  433. package/dist/server/dashboard/writes.js +9 -7
  434. package/dist/server/mcp.js +28 -13
  435. package/dist/systems/campaign-data.d.ts +15 -0
  436. package/dist/systems/campaign-data.js +85 -0
  437. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  438. package/dist/systems/{system-code.js → code.js} +2 -2
  439. package/dist/systems/game-system.d.ts +7 -61
  440. package/dist/systems/game-system.js +1 -984
  441. package/dist/systems/index.d.ts +6 -3
  442. package/dist/systems/index.js +6 -3
  443. package/dist/systems/installed.d.ts +31 -0
  444. package/dist/systems/installed.js +89 -0
  445. package/dist/systems/maps.d.ts +3 -0
  446. package/dist/systems/maps.js +9 -0
  447. package/dist/systems/read.d.ts +3 -0
  448. package/dist/systems/read.js +471 -0
  449. package/dist/systems/schema.d.ts +289 -0
  450. package/dist/systems/schema.js +243 -0
  451. package/dist/systems/settings.d.ts +19 -0
  452. package/dist/systems/settings.js +78 -0
  453. package/dist/systems/versions.d.ts +12 -0
  454. package/dist/systems/versions.js +52 -0
  455. package/dist/testing/index.js +1 -1
  456. package/instructions/import.md +1 -1
  457. package/instructions/play.md +1 -1
  458. package/package.json +1 -1
  459. package/dist/commands/config.js +0 -948
  460. package/dist/commands/package.d.ts +0 -143
  461. package/dist/commands/package.js +0 -785
  462. package/dist/commands/scene.js +0 -894
  463. package/dist/commands/shared/worked-out.js +0 -805
  464. package/dist/dashboard/place/map-view.js +0 -417
  465. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  466. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  467. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  468. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  469. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  470. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  471. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  472. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  473. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  474. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  475. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  476. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  477. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  478. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  479. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  480. /package/dist/pages/{page-file.js → file.js} +0 -0
  481. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  482. /package/dist/pages/{page-types.js → types.js} +0 -0
  483. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  484. /package/dist/rules/{rule-book.js → book.js} +0 -0
  485. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  486. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -1,417 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
- // The map of the place where the party is (GRD-6, D-323, D-325), in ink and washes on light paper in both themes: walls hatched in bundles with a
3
- // shade along them, the floor's outline rounded where it meets rock, the ground by the place's look and its kinds, the things of the legend drawn by kind, by
4
- // square or by piece, doors and where squares lead, the squares' names; who stands where as coins, the one acting raised off the paper, a foe the master marked glowing (D-415); then the key, and who
5
- // is where in words, the map's twin.
6
- import { Fragment } from "preact";
7
- import { useContext, useEffect, useRef, useState } from "preact/hooks";
8
- import { TalkName, usePlayerActs } from "../acts/names.js";
9
- import { CardHead } from "../card.js";
10
- import { Glass, GlassDefs } from "../glass.js";
11
- import { iconPath } from "../icons.js";
12
- import { shownText, strangerLabel } from "../labels.js";
13
- import { WidgetsContext } from "../packages/widgets.js";
14
- import { sideIcons, sideOf } from "../party.js";
15
- import { conditionsPref, tokenSymbolsPref, useChoice, usePref } from "../prefs.js";
16
- import { personState, statusMarks, statusWords } from "../status.js";
17
- import { pageDirection, t } from "../text.js";
18
- import { columnName, exitSide, floorLoops, groundKinds, isSolid, isStandable, isWalled, kindAt, nextTo, piecesOf, squareName, squareOf, symbolAt, tracedLoop } from "./map.js";
19
- // How wide a square is drawn, in pixels.
20
- const size = 40;
21
- // The order of who is where under the map.
22
- const roles = ["pc", "companion", "other"];
23
- export function PlaceMap({ map, place, acting, picking, choosing, bare = false, self: selfName }) {
24
- const svg = useRef(null);
25
- const where = useRef(null);
26
- const acts = usePlayerActs();
27
- const widgets = useContext(WidgetsContext);
28
- // On the page, a token touched starts talking to them, the focus coming back to their line of who is where (D-495).
29
- const talking = acts === undefined || picking !== undefined ? undefined : {
30
- onChoose: (name) => {
31
- const line = [...(where.current?.querySelectorAll("button.talk") ?? [])].find((button) => button.dataset.name === name);
32
- return name !== undefined && acts.start({ talk: name }, line ?? svg.current ?? document.body);
33
- },
34
- };
35
- const tokens = choosing ?? talking;
36
- const scale = useScale(svg);
37
- const sides = map.exits.map((exit) => exitSide(map, squareOf(exit.square) ?? { column: 0, row: 0 }));
38
- const [left, top] = [30 + (sides.includes("left") ? 30 : 0), 30 + (sides.includes("top") ? 36 : 0)];
39
- const [right, bottom] = [14 + (sides.includes("right") ? 30 : 0), 14 + (sides.includes("bottom") ? 34 : 0)];
40
- const X = (column) => left + column * size;
41
- const Y = (row) => top + row * size;
42
- const [width, height] = [left + map.columns * size + right, top + map.rows * size + bottom];
43
- const squares = Array.from({ length: map.rows }, (_, row) => Array.from({ length: map.columns }, (_, column) => ({ column, row }))).flat();
44
- const open = squares.filter((square) => !isSolid(map, square));
45
- const loops = floorLoops(map, X, Y);
46
- const walled = isWalled(map);
47
- const floor = loops.map((loop) => tracedLoop(loop, false, size * 0.5)).join("");
48
- const outline = walled ? loops.map((loop) => tracedLoop(loop, true, size * 0.5)).join("") : "";
49
- const featureAt = (square) => map.legend.find((feature) => feature.symbol === symbolAt(map, square));
50
- // Hatching only next to the rooms: farther the rock or the masonry is left as paper.
51
- const nearRoom = (square) => [-1, 0, 1].some((dc) => [-1, 0, 1].some((dr) => !isSolid(map, { column: square.column + dc, row: square.row + dr })));
52
- const things = map.legend.filter((feature) => !["wall", "rock", "floor", "door", "open-door", "secret-door", "opening", ...groundKinds].includes(feature.kind));
53
- const standing = map.at.flatMap((one) => {
54
- const square = squareOf(one.square);
55
- return square === undefined ? [] : [{ ...one, at: square }];
56
- });
57
- const self = standing.find((one) => one.role === "pc" && (selfName === undefined || one.name === selfName));
58
- // What one fills, in squares a side: a large creature stands on the square at the top left of its own (GRD-4).
59
- const middle = (one) => [X(one.at.column) + (size * (one.side ?? 1)) / 2, Y(one.at.row) + (size * (one.side ?? 1)) / 2];
60
- // The squares the character can still reach, and those it stands on, which are never out of its reach (D-328).
61
- const reach = [
62
- ...(map.reach ?? []).flatMap((name) => {
63
- const square = squareOf(name);
64
- return square === undefined ? [] : [square];
65
- }),
66
- ...(map.reach === undefined || self === undefined
67
- ? []
68
- : Array.from({ length: (self.side ?? 1) ** 2 }, (_, index) => ({ column: self.at.column + (index % (self.side ?? 1)), row: self.at.row + Math.floor(index / (self.side ?? 1)) }))),
69
- ];
70
- const letters = Math.max(11, 11 / scale);
71
- const frame = useRef(null);
72
- // On a phone the map keeps squares a finger can read and scrolls aside (D-547): it opens with the player's character in the middle.
73
- useEffect(() => {
74
- const box = frame.current;
75
- if (box === null || self === undefined || box.scrollWidth <= box.clientWidth) {
76
- return;
77
- }
78
- const [x] = middle(self);
79
- const shown = box.scrollWidth / width;
80
- // The frame keeps its squares left to right in every language, so its scroll does too.
81
- box.scrollLeft = Math.max(0, x * shown - box.clientWidth / 2);
82
- }, [map.columns, map.rows, self?.at.column, self?.at.row]);
83
- const drawn = (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-floor-fill", d: floor, "fill-rule": "evenodd" }), _jsx("g", { class: "lm-ground", "clip-path": "url(#lm-open)", children: open.filter((square) => groundKinds.includes(kindAt(map, square))).map((square) => _jsx(Ground, { kind: kindAt(map, square), x: X(square.column), y: Y(square.row), side: size, seed: square }, squareName(square))) }), _jsx("path", { class: "lm-grid", d: open.map((square) => `M${X(square.column)} ${Y(square.row)}h${size}v${size}h${-size}z`).join(""), "clip-path": "url(#lm-open)" }), open.filter((square) => featureAt(square)?.difficult).map((square) => _jsx(Corner, { x: X(square.column), y: Y(square.row), side: size }, squareName(square))), things.map((feature) => piecesOf(map, feature.symbol, feature.kind).map((piece) => (_jsxs("g", { class: `lm-thing ${feature.kind}`, children: [_jsx("title", { children: [featureName(feature), feature.blocks ? t("blocks") : "", feature.difficult ? t("difficult") : ""].filter((part) => part !== "").join(", ") }), _jsx(Thing, { kind: feature.kind, symbol: feature.symbol, x: X(piece.left), y: Y(piece.top), w: (piece.right - piece.left) * size, h: (piece.bottom - piece.top) * size, cells: piece.squares.map((square) => [X(square.column), Y(square.row)]) })] }, `${feature.symbol} ${piece.left} ${piece.top}`)))), _jsx("path", { class: "lm-shade", d: outline, "clip-path": "url(#lm-open)", filter: "url(#lm-blur)" })] }));
84
- return (_jsxs("section", { class: "lm", "aria-labelledby": "lm-title", children: [_jsx(CardHead, { icon: iconPath("world"), title: _jsx("h3", { id: "lm-title", children: t("Map") }), note: place }), _jsx("div", { ref: frame, class: picking === undefined && choosing === undefined ? "lm-frame" : "lm-frame panned", style: { "--map-width": String(width) }, children: _jsxs("svg", { ref: svg, class: `lm-svg lm-look-${map.ground}`, viewBox: `0 0 ${width} ${height}`, ...(picking === undefined && choosing === undefined ? {} : { width: width * 1.2 }), role: "img", "aria-label": t("Map of {place}", { place }), children: [_jsxs("defs", { children: [_jsx(Patterns, {}), _jsx(GlassDefs, { prefix: "lm" }), _jsxs("radialGradient", { id: "lm-hostile-glow", children: [_jsx("stop", { offset: "0.75", "stop-color": "#c8321f", "stop-opacity": "0.3" }), _jsx("stop", { offset: "1", "stop-color": "#c8321f", "stop-opacity": "0" })] }), _jsx("clipPath", { id: "lm-open", children: _jsx("path", { d: floor, "clip-rule": "evenodd" }) }), !walled && (_jsx("mask", { id: "lm-fade", maskUnits: "userSpaceOnUse", x: 0, y: 0, width: width, height: height, children: _jsx("rect", { x: X(0) + size * 0.35, y: Y(0) + size * 0.35, width: map.columns * size - size * 0.7, height: map.rows * size - size * 0.7, fill: "#fff", filter: "url(#lm-soft)" }) })), standing.map((one, index) => (_jsx("clipPath", { id: `lm-token-${index}`, children: _jsx("circle", { cx: middle(one)[0], cy: middle(one)[1], r: size * (one.side ?? 1) * 0.43 }) }, index)))] }), _jsx("rect", { class: "lm-paper", width: width, height: height }), _jsx("g", { class: "lm-walls", children: squares.filter((square) => ["wall", "rock", "window"].includes(kindAt(map, square)) && nearRoom(square)).map((square) => (_jsxs(Fragment, { children: [_jsx("rect", { class: "lm-wall-under", x: X(square.column), y: Y(square.row), width: size, height: size }), _jsx("rect", { class: `lm-wall ${kindAt(map, square)}`, x: X(square.column), y: Y(square.row), width: size, height: size })] }, squareName(square)))) }), walled ? drawn : _jsx("g", { mask: "url(#lm-fade)", children: drawn }), reach.length > 0 && (_jsx("g", { class: "lm-out", "aria-hidden": "true", "clip-path": "url(#lm-open)", children: open.filter((square) => !reach.some((near) => near.column === square.column && near.row === square.row)).map((square) => (_jsx("rect", { x: X(square.column), y: Y(square.row), width: size, height: size }, squareName(square)))) })), _jsx("path", { class: "lm-outline", d: outline, filter: "url(#lm-ink)" }), squares.filter((square) => ["door", "open-door", "secret-door"].includes(kindAt(map, square))).map((square) => (_jsx(Door, { kind: kindAt(map, square), name: featureAt(square)?.name ?? "door", square: square, map: map, x: X(square.column), y: Y(square.row) }, squareName(square)))), map.exits.map((exit, index) => {
85
- const square = squareOf(exit.square);
86
- return square === undefined ? null : _jsx(Exit, { side: sides[index], to: exit.to, x: X(square.column) + size / 2, y: Y(square.row) + size / 2, letters: Math.max(13, 12 / scale) }, exit.square);
87
- }), _jsxs("g", { class: "lm-coordinates", "font-size": letters, children: [Array.from({ length: map.columns }, (_, column) => _jsx("text", { x: X(column) + size / 2, y: top - 10, "text-anchor": "middle", children: columnName(column) }, `c${column}`)), Array.from({ length: map.rows }, (_, row) => _jsx("text", { x: left - 10, y: Y(row) + size / 2, "text-anchor": "end", "dominant-baseline": "middle", children: row + 1 }, `r${row}`))] }), _jsx("g", { class: "lm-tokens", children: standing.map((one, index) => {
88
- // Talking needs someone else, never one of the player characters; choosing for an action takes the one acting too, as themselves, and
89
- // with more than one the others by name.
90
- const other = one.role !== "pc" || (choosing !== undefined && selfName !== undefined && one !== self);
91
- const shown = !other ? undefined : one.stranger ? strangerLabel(one.name) : one.name;
92
- const choice = tokens === undefined || (shown === undefined && choosing === undefined) ? undefined : {
93
- chosen: choosing !== undefined && choosing.selected === shown && shown !== undefined,
94
- onChoose: () => tokens.onChoose(shown),
95
- };
96
- return (_jsx(Token, { one: standingOf(one, one.role === "other" ? undefined : personState(widgets, one.name)), index: index, acting: one.name === acting, hostile: one.hostile === true, x: middle(one)[0], y: middle(one)[1], scale: scale, ...(choice === undefined ? {} : { choice }) }, index));
97
- }) }), picking !== undefined && (_jsx("g", { class: "lm-picks", children: squares.filter((square) => isStandable(map, square)).map((square) => (_jsx("rect", { class: picking.selected === squareName(square) ? "lm-pick selected" : "lm-pick", x: X(square.column) + 1, y: Y(square.row) + 1, width: size - 2, height: size - 2, rx: 4, onClick: () => picking.onSelect(squareName(square)), children: _jsx("title", { children: squareName(square) }) }, squareName(square)))) }))] }) }), !bare && _jsx(MapKey, { map: map, reach: reach.length > 0, self: selfName }), !bare && standing.length > 0 && (_jsx("ul", { ref: where, class: "lm-where", "aria-label": t("Who is where"), children: standing.toSorted((first, second) => measuredFirst(first, second, selfName === undefined ? undefined : self) || roles.indexOf(first.role) - roles.indexOf(second.role)).map((one, index) => (_jsxs("li", { class: `lm-where-${one.role}${one.hostile === true ? " hostile" : ""}`, children: [one.role === "pc"
98
- ? _jsx("span", { class: "lm-where-name", children: one.name })
99
- : (_jsx(TalkName, { name: one.stranger ? strangerLabel(one.name) : one.name, children: _jsx("span", { class: "lm-where-name", children: one.stranger ? strangerLabel(one.name) : one.name }) })), _jsx("span", { class: "lm-key-square", children: one.square }), selfName !== undefined && one === self
100
- ? _jsx("span", { class: "lm-where-far", children: t("from here") })
101
- : one.distance !== undefined
102
- ? _jsx("span", { class: "lm-where-far", children: shownText(one.distance) })
103
- : self !== undefined && one !== self && (nextTo(one.at, self.at) || one.square === self.square) && (_jsx("span", { class: "lm-where-far", children: selfName === undefined ? t("next to you") : t("next to {name}", { name: selfName }) }))] }, index))) }))] }));
104
- }
105
- /** The one the distances are from before anyone else, when named: a negative number puts the first before the second. */
106
- function measuredFirst(first, second, from) {
107
- return from === undefined ? 0 : first === from ? -1 : second === from ? 1 : 0;
108
- }
109
- /** The map's key: the veil of the player's turn, named with more than one player character, the things of the legend, where the squares lead. */
110
- function MapKey({ map, reach, self }) {
111
- return (_jsxs("ul", { class: "lm-key", "aria-label": t("Legend"), children: [reach && (_jsxs("li", { children: [_jsxs("svg", { class: `lm-swatch lm-look-${map.ground}`, viewBox: "0 0 40 40", "aria-hidden": "true", children: [_jsx("rect", { class: "lm-floor-fill", width: 40, height: 40 }), _jsx("g", { class: "lm-out", children: _jsx("rect", { width: 40, height: 40 }) })] }), _jsx("span", { class: "lm-key-name", children: self === undefined ? t("out of your move this turn") : t("out of {name}'s move this turn", { name: self }) })] })), map.legend.filter((feature) => !["floor", "ground"].includes(feature.kind)).map((feature) => (_jsxs("li", { children: [_jsx(Swatch, { feature: feature, ground: map.ground }), _jsx("span", { class: "lm-key-name", children: featureName(feature) }), feature.blocks && !["wall", "rock"].includes(feature.kind) && _jsx("span", { class: "lm-key-note", children: t("blocks") }), feature.difficult && _jsx("span", { class: "lm-key-note", children: t("difficult") })] }, feature.symbol))), map.exits.map((exit) => (_jsxs("li", { class: "lm-key-exit", children: [_jsx("span", { class: "lm-key-square", children: exit.square }), _jsx("span", { children: `${pageDirection() === "rtl" ? "←" : "→"} ${exit.to ?? t("somewhere")}` })] }, exit.square)))] }));
112
- }
113
- /** How much the map is scaled on the screen, from its drawn width to its shown one: the letters around it keep a readable size on a phone. */
114
- function useScale(svg) {
115
- const [scale, setScale] = useState(1);
116
- useEffect(() => {
117
- const element = svg.current;
118
- if (element === null || typeof ResizeObserver === "undefined") {
119
- return;
120
- }
121
- const measure = () => setScale(element.getBoundingClientRect().width / (element.viewBox.baseVal?.width || 1));
122
- const observer = new ResizeObserver(measure);
123
- observer.observe(element);
124
- measure();
125
- return () => observer.disconnect();
126
- }, []);
127
- return scale;
128
- }
129
- /** The patterns and filters of the map: Dyson's hatching in bundles, the grounds' textures, the ink's tremble, the washes, the soft edge. */
130
- function Patterns() {
131
- let seed = 11;
132
- const random = () => {
133
- seed = (seed * 16807) % 2147483647;
134
- return seed / 2147483647;
135
- };
136
- const bundles = Array.from({ length: 36 }, (_, index) => ({ x: (index % 6) * 16 + 8 + (random() - 0.5) * 5, y: Math.floor(index / 6) * 16 + 8 + (random() - 0.5) * 5, turn: Math.round(random() * 180), lengths: [0, 1, 2, 3].map(() => 6 + random() * 2.5) }));
137
- return (_jsxs(_Fragment, { children: [_jsx("pattern", { id: "lm-hatch", width: 96, height: 96, patternUnits: "userSpaceOnUse", children: bundles.map((bundle, index) => (_jsx("g", { transform: `translate(${bundle.x.toFixed(1)} ${bundle.y.toFixed(1)}) rotate(${bundle.turn})`, children: [-3.6, -1.2, 1.2, 3.6].map((offset, line) => _jsx("line", { class: "lm-hatch-line", x1: -bundle.lengths[line], y1: offset, x2: bundle.lengths[line], y2: offset }, line)) }, index))) }), _jsxs("pattern", { id: "lm-cobbles", width: 20, height: 20, patternUnits: "userSpaceOnUse", children: [_jsx("rect", { class: "lm-paving", width: 20, height: 20 }), [[1, 1, 8], [10, 1, 9], [1, 11, 5], [7, 11, 7], [15, 11, 4]].map(([x, y, w], index) => _jsx("rect", { class: "lm-cobble", x: x, y: y, width: w, height: 8, rx: 2.5 }, index))] }), _jsxs("pattern", { id: "lm-grass", width: 46, height: 46, patternUnits: "userSpaceOnUse", children: [_jsx("rect", { class: "lm-meadow", width: 46, height: 46 }), [[8, 12], [30, 6], [20, 30], [40, 36], [4, 40]].map(([x, y], index) => _jsx("path", { class: "lm-tuft", d: `M${x - 3} ${y}l1.5 -4M${x} ${y}v-5M${x + 3} ${y}l-1.5 -4` }, index))] }), _jsxs("pattern", { id: "lm-speckle", width: 30, height: 30, patternUnits: "userSpaceOnUse", children: [_jsx("rect", { class: "lm-rockfloor", width: 30, height: 30 }), [[5, 7, 1.1], [19, 4, 0.8], [12, 18, 1.3], [26, 22, 0.9], [4, 26, 0.7], [22, 13, 0.6]].map(([x, y, r], index) => _jsx("circle", { class: "lm-dot", cx: x, cy: y, r: r }, index))] }), _jsxs("filter", { id: "lm-ink", x: "-5%", y: "-5%", width: "110%", height: "110%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.05", numOctaves: 2, seed: 7 }), _jsx("feDisplacementMap", { in: "SourceGraphic", scale: 2.6 })] }), _jsxs("filter", { id: "lm-wash", x: "-20%", y: "-20%", width: "140%", height: "140%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.09", numOctaves: 2, seed: 3, result: "noise" }), _jsx("feDisplacementMap", { in: "SourceGraphic", in2: "noise", scale: 9, result: "moved" }), _jsx("feGaussianBlur", { in: "moved", stdDeviation: 1.6 })] }), _jsx("filter", { id: "lm-blur", x: "-10%", y: "-10%", width: "120%", height: "120%", children: _jsx("feGaussianBlur", { stdDeviation: 4 }) }), _jsx("filter", { id: "lm-soft", x: "-20%", y: "-20%", width: "140%", height: "140%", children: _jsx("feGaussianBlur", { stdDeviation: size * 0.45 }) })] }));
138
- }
139
- /** The mark of difficult ground: a fold in the square's corner, so that colour is never the only sign (D-325). */
140
- function Corner({ x, y, side }) {
141
- return _jsx("path", { class: "lm-corner", d: `M${x + 1} ${y + 1}h${side * 0.3}l${-side * 0.3} ${side * 0.3}z` });
142
- }
143
- /** Ground drawn on its square, under the things: water, rubble, mud, brush, open ground, a road. */
144
- function Ground({ kind, x, y, side, seed }) {
145
- const turn = (seed.column * 7 + seed.row * 13) % 5;
146
- const at = (share) => share * side / 40;
147
- let marks = null;
148
- if (kind.endsWith("water")) {
149
- marks = _jsx("path", { class: "lm-wave", d: `M${x + at(8)} ${y + at(14 + turn)}q4 -4 8 0t8 0M${x + at(18)} ${y + at(28 - turn)}q4 -4 8 0t8 0` });
150
- }
151
- else if (kind === "rubble") {
152
- marks = [[10, 12, 4], [24, 9, 3], [30, 24, 5], [14, 28, 3.5], [22, 19, 2.5]].map(([px, py, r], index) => _jsx("path", { class: "lm-pebble", d: pebble(x + at((px + turn * 3) % 34 + 3), y + at(py), at(r)) }, index));
153
- }
154
- else if (kind === "brush" || kind === "ground") {
155
- marks = (kind === "brush" ? [[10, 14], [26, 10], [18, 28], [31, 27]] : [[12, 16], [28, 30]]).map(([px, py], index) => (_jsx("path", { class: "lm-tuft", d: `M${x + at(px) - 4} ${y + at(py)}l2 -5M${x + at(px)} ${y + at(py)}v-6M${x + at(px) + 4} ${y + at(py)}l-2 -5` }, index)));
156
- }
157
- else if (kind === "road") {
158
- marks = _jsx("path", { class: "lm-rut", d: `M${x} ${y + side * 0.3}h${side}M${x} ${y + side * 0.7}h${side}M${x + side * 0.3} ${y}v${side}M${x + side * 0.7} ${y}v${side}` });
159
- }
160
- else if (kind === "mud") {
161
- marks = _jsx("path", { class: "lm-wave", d: `M${x + at(8)} ${y + at(16)}q3 3 6 0t6 0M${x + at(18)} ${y + at(28)}q3 3 6 0t6 0` });
162
- }
163
- return (_jsxs("g", { class: `lm-ground-${kind}`, children: [_jsx("rect", { class: "lm-ground-fill", x: x, y: y, width: side, height: side, filter: "url(#lm-wash)" }), marks] }));
164
- }
165
- /** A thing of the legend, by its kind (D-325), in its box; the kinds drawn one a square draw each of their squares. Any other is a box with its symbol. */
166
- function Thing({ kind, symbol, x, y, w, h, cells }) {
167
- const inset = (share) => ({ x: x + size * share, y: y + size * share, width: w - size * share * 2, height: h - size * share * 2 });
168
- const [cx, cy, small] = [x + w / 2, y + h / 2, Math.min(w, h)];
169
- const along = w >= h;
170
- switch (kind) {
171
- case "table":
172
- return _jsx("rect", { ...inset(0.14), rx: 5, class: "lm-wood" });
173
- case "counter":
174
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.12), rx: 2, class: "lm-wood dark" }), _jsx("line", { x1: x + size * 0.2, y1: y + h - size * 0.32, x2: x + w - size * 0.2, y2: y + h - size * 0.32, class: "lm-detail" })] }));
175
- case "seat":
176
- return _jsx("rect", { ...inset(0.3), rx: 3, class: "lm-wood" });
177
- case "bed": {
178
- const box = inset(0.1);
179
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, rx: 3, class: "lm-cloth" }), _jsx("rect", { x: box.x + 4, y: box.y + 4, width: box.width - 8, height: Math.min(10, box.height / 4), rx: 3, class: "lm-paper-fill" })] }));
180
- }
181
- case "shelf": {
182
- const box = inset(0.1);
183
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-wood dark" }), [0.25, 0.5, 0.75].map((share) => (along
184
- ? _jsx("line", { x1: box.x + box.width * share, y1: box.y, x2: box.x + box.width * share, y2: box.y + box.height, class: "lm-detail" }, share)
185
- : _jsx("line", { x1: box.x, y1: box.y + box.height * share, x2: box.x + box.width, y2: box.y + box.height * share, class: "lm-detail" }, share)))] }));
186
- }
187
- case "hearth":
188
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.06), rx: 3, class: "lm-stone" }), _jsx("path", { class: "lm-flame", d: flame(cx, cy + small * 0.24, small * 0.42) })] }));
189
- case "fire":
190
- return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.34, class: "lm-stone ring" }), _jsx("path", { class: "lm-flame", d: flame(cx, cy + small * 0.17, small * 0.36) })] }));
191
- case "barrel":
192
- return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.33, class: "lm-wood" }), _jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.19, class: "lm-detail" })] }, `${cellX} ${cellY}`))) }));
193
- case "crate":
194
- return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("rect", { x: cellX + 6, y: cellY + 6, width: size - 12, height: size - 12, class: "lm-wood" }), _jsx("path", { d: `M${cellX + 6} ${cellY + 6}L${cellX + size - 6} ${cellY + size - 6}M${cellX + size - 6} ${cellY + 6}L${cellX + 6} ${cellY + size - 6}`, class: "lm-detail" })] }, `${cellX} ${cellY}`))) }));
195
- case "stairs": {
196
- const box = inset(0.05);
197
- const steps = Math.max(4, Math.round((along ? box.width : box.height) / 8));
198
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-paper-fill" }), Array.from({ length: steps - 1 }, (_, step) => {
199
- const share = (step + 1) / steps;
200
- return along
201
- ? _jsx("line", { x1: box.x + box.width * share, y1: box.y, x2: box.x + box.width * share, y2: box.y + box.height, class: "lm-detail" }, step)
202
- : _jsx("line", { x1: box.x, y1: box.y + box.height * share, x2: box.x + box.width, y2: box.y + box.height * share, class: "lm-detail" }, step);
203
- })] }));
204
- }
205
- case "ladder":
206
- return (_jsx("path", { class: "lm-detail strong", d: `M${cx - 7} ${y + 5}V${y + h - 5}M${cx + 7} ${y + 5}V${y + h - 5}${Array.from({ length: Math.max(1, Math.round(h / 8) - 1) }, (_, rung) => `M${cx - 7} ${y + 8 + rung * 8}h14`).join("")}` }));
207
- case "trapdoor": {
208
- const box = inset(0.12);
209
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-wood" }), _jsx("path", { class: "lm-detail", d: `M${box.x} ${box.y + box.height / 3}h${box.width}M${box.x} ${box.y + box.height * 2 / 3}h${box.width}` })] }));
210
- }
211
- case "pit": {
212
- const box = inset(0.06);
213
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-pit" }), _jsx("rect", { x: box.x + 6, y: box.y + 6, width: Math.max(0, box.width - 12), height: Math.max(0, box.height - 12), class: "lm-pit deep" })] }));
214
- }
215
- case "pillar":
216
- return _jsx(_Fragment, { children: cells.map(([cellX, cellY]) => _jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.3, class: "lm-ink-fill" }, `${cellX} ${cellY}`)) });
217
- case "statue":
218
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.14), class: "lm-stone" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.2, class: "lm-ink-fill" })] }));
219
- case "altar":
220
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.16), rx: 1, class: "lm-stone" }), _jsx("path", { class: "lm-detail", d: `M${x + size * 0.24} ${y + size * 0.3}h${w - size * 0.48}` })] }));
221
- case "well":
222
- return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.36, class: "lm-stone" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.22, class: "lm-pit deep" })] }));
223
- case "tree":
224
- // A tree a square, the crowns overlapping: a wood, not a blob.
225
- return (_jsxs(_Fragment, { children: [cells.map(([cellX, cellY]) => {
226
- const jitter = ((cellX * 7 + cellY * 3) / size) % 5 - 2;
227
- return _jsx("path", { class: "lm-canopy", d: canopy(cellX + size / 2 + jitter, cellY + size / 2 - jitter, size * 0.56) }, `${cellX} ${cellY}`);
228
- }), cells.map(([cellX, cellY]) => _jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.07, class: "lm-ink-fill" }, `t${cellX} ${cellY}`))] }));
229
- case "rocks":
230
- return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("path", { class: "lm-stone", d: `M${cellX + 8} ${cellY + 26}l5 -13l9 -5l8 6l3 12l-9 8z` }), _jsx("path", { class: "lm-detail", d: `M${cellX + 22} ${cellY + 8}l-3 10l11 4` })] }, `${cellX} ${cellY}`))) }));
231
- case "low-wall":
232
- return (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-low-wall", d: along ? `M${x + 2} ${cy}H${x + w - 2}` : `M${cx} ${y + 2}V${y + h - 2}` }), cells.map(([cellX, cellY]) => _jsx("rect", { x: cellX + size / 2 - 3, y: cellY + size / 2 - 3, width: 6, height: 6, class: "lm-ink-fill" }, `${cellX} ${cellY}`))] }));
233
- case "bridge":
234
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.1), class: "lm-wood" }), _jsx("path", { class: "lm-detail", d: Array.from({ length: Math.round((along ? w : h) / 8) }, (_, plank) => (along ? `M${x + size * 0.1 + plank * 8} ${y + size * 0.1}v${h - size * 0.2}` : `M${x + size * 0.1} ${y + size * 0.1 + plank * 8}h${w - size * 0.2}`)).join("") })] }));
235
- case "machine":
236
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.12), rx: 3, class: "lm-metal" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.16, class: "lm-detail" })] }));
237
- case "vehicle":
238
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.16), rx: 4, class: "lm-wood" }), _jsx("path", { class: "lm-detail strong", d: `M${x + size * 0.1} ${y + size * 0.3}v8M${x + w - size * 0.1} ${y + size * 0.3}v8M${x + size * 0.1} ${y + h - size * 0.3}v-8M${x + w - size * 0.1} ${y + h - size * 0.3}v-8` })] }));
239
- case "tent":
240
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.08), class: "lm-cloth" }), _jsx("path", { class: "lm-detail", d: `M${x + size * 0.08} ${y + size * 0.08}L${x + w - size * 0.08} ${y + h - size * 0.08}M${x + w - size * 0.08} ${y + size * 0.08}L${x + size * 0.08} ${y + h - size * 0.08}` })] }));
241
- case "building":
242
- return _jsx(Roof, { x: x, y: y, w: w, h: h, cells: cells });
243
- case "stall":
244
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.1), class: "lm-awning" }), _jsx("path", { class: "lm-detail", d: Array.from({ length: Math.max(1, Math.round(w / 10) - 1) }, (_, stripe) => `M${x + size * 0.1 + (stripe + 1) * 9} ${y + size * 0.1}v${h - size * 0.2}`).join("") })] }));
245
- case "fountain":
246
- return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.44, class: "lm-stone" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.36, class: "lm-basin" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.1, class: "lm-stone" }), _jsx("path", { class: "lm-wave", d: `M${cx - small * 0.26} ${cy + small * 0.18}q4 -4 8 0t8 0` })] }));
247
- case "cliff":
248
- // The drop: a line along the top, teeth falling from it.
249
- return (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-detail strong", d: `M${x} ${y + 4}H${x + w}` }), _jsx("path", { class: "lm-cliff", d: Array.from({ length: Math.round(w / 8) }, (_, tooth) => `M${x + 2 + tooth * 8} ${y + 5}l3 ${h * 0.55}l3 ${-h * 0.55}`).join("") })] }));
250
- case "hedge":
251
- return _jsx("path", { class: "lm-canopy", d: along ? `M${x + 6} ${cy - 7}h${w - 12}a7 7 0 0 1 0 14h${-(w - 12)}a7 7 0 0 1 0 -14z` : `M${cx - 7} ${y + 6}v${h - 12}a7 7 0 0 0 14 0v${-(h - 12)}a7 7 0 0 0 -14 0z` });
252
- case "hazard":
253
- return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("path", { class: "lm-hazard", d: `M${cellX + size / 2} ${cellY + size / 2 - 12}l12 21h-24z` }), _jsx("text", { class: "lm-hazard-mark", x: cellX + size / 2, y: cellY + size / 2 + 6, "text-anchor": "middle", children: "!" })] }, `${cellX} ${cellY}`))) }));
254
- case "mark":
255
- return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.38, class: "lm-mark" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.24, class: "lm-mark" })] }));
256
- default:
257
- return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.2), rx: 6, class: "lm-thing-any" }), _jsx("text", { class: "lm-thing-symbol", x: cx, y: cy + 1, "text-anchor": "middle", "dominant-baseline": "middle", children: symbol })] }));
258
- }
259
- }
260
- /** Roofs: the piece's squares in tiles, its outline, the ridge along its longer side. */
261
- function Roof({ x, y, w, h, cells }) {
262
- const inPiece = (cellX, cellY) => cells.some(([px, py]) => px === cellX && py === cellY);
263
- const edges = cells.flatMap(([cellX, cellY]) => [[cellX, cellY - size, `M${cellX} ${cellY}h${size}`], [cellX + size, cellY, `M${cellX + size} ${cellY}v${size}`], [cellX, cellY + size, `M${cellX} ${cellY + size}h${size}`], [
264
- cellX - size,
265
- cellY,
266
- `M${cellX} ${cellY}v${size}`,
267
- ]]
268
- .filter(([nx, ny]) => !inPiece(nx, ny))
269
- .map(([, , path]) => path));
270
- const along = w >= h;
271
- const middle = along ? y + Math.floor(h / size / 2) * size + (h / size % 2 === 1 ? size / 2 : 0) : x + Math.floor(w / size / 2) * size + (w / size % 2 === 1 ? size / 2 : 0);
272
- const ridge = cells.filter(([cellX, cellY]) => (along ? cellY <= middle && cellY + size >= middle : cellX <= middle && cellX + size >= middle))
273
- .map(([cellX, cellY]) => (along ? `M${cellX} ${middle}h${size}` : `M${middle} ${cellY}v${size}`)).join("");
274
- return (_jsxs("g", { class: `lm-roof tone-${Math.round((x + y) / size) % 3}`, children: [cells.map(([cellX, cellY]) => _jsx("rect", { class: "lm-roof-tiles", x: cellX, y: cellY, width: size, height: size }, `${cellX} ${cellY}`)), _jsx("path", { class: "lm-roof-edge", d: edges.join("") }), _jsx("path", { class: "lm-ridge", d: ridge })] }));
275
- }
276
- /** A door: its leaf across the gap in the wall, along the wall it is in; open, swung; secret and found, dashed. */
277
- function Door({ kind, name, square, map, x, y }) {
278
- const closed = (column, row) => isSolid(map, { column, row }) || kindAt(map, { column, row }) === "building";
279
- const across = closed(square.column - 1, square.row) && closed(square.column + 1, square.row);
280
- const leaf = across ? { x: x + 2, y: y + size * 0.38, width: size - 4, height: size * 0.24 } : { x: x + size * 0.38, y: y + 2, width: size * 0.24, height: size - 4 };
281
- return (_jsxs("g", { class: `lm-door ${kind}`, children: [_jsx("title", { children: `${name}, ${squareName(square)}` }), kind === "open-door"
282
- ? (_jsx("path", { class: "lm-door-swing", d: across ? `M${x + 2} ${y + size / 2}A${size - 4} ${size - 4} 0 0 1 ${x + size - 2} ${y - size / 2 + 4}` : `M${x + size / 2} ${y + 2}A${size - 4} ${size - 4} 0 0 0 ${x + size + size / 2 - 4} ${y + size - 2}` }))
283
- : _jsx("rect", { ...leaf, class: kind === "secret-door" ? "lm-door-leaf secret" : "lm-door-leaf" })] }));
284
- }
285
- /** Where a square leads: on the map's edge an arrow out of it and the place's name, as the world goes on there; inside, the name over the door. */
286
- function Exit({ side, to, x, y, letters }) {
287
- if (side === "inside") {
288
- return to === undefined ? null : _jsx("text", { class: "lm-exit-name inside", x: x, y: y - size / 2 - 8, "text-anchor": "middle", children: to });
289
- }
290
- const [dx, dy] = side === "bottom" ? [0, 1] : side === "top" ? [0, -1] : side === "left" ? [-1, 0] : [1, 0];
291
- // Past the squares' names on the top and the left.
292
- const skip = side === "top" || side === "left" ? 22 : 0;
293
- const [sx, sy] = [x + dx * (size * 0.5 + skip), y + dy * (size * 0.5 + skip)];
294
- const [ex, ey] = [sx + dx * 16, sy + dy * 16];
295
- return (_jsxs("g", { class: "lm-exit", children: [_jsx("path", { d: `M${sx} ${sy}L${ex} ${ey}M${ex - dy * 5 - dx * 5} ${ey - dx * 5 - dy * 5}L${ex} ${ey}L${ex + dy * 5 - dx * 5} ${ey + dx * 5 - dy * 5}` }), to !== undefined && (dx === 0
296
- ? _jsx("text", { class: "lm-exit-name", x: ex, y: ey + dy * 15, "text-anchor": "middle", "dominant-baseline": "middle", "font-size": letters, children: to })
297
- : _jsx("text", { class: "lm-exit-name", x: ex + dx * 12, y: ey, "text-anchor": "middle", "dominant-baseline": "middle", "font-size": letters, transform: `rotate(${dx < 0 ? -90 : 90} ${ex + dx * 12} ${ey})`, children: to }))] }));
298
- }
299
- /**
300
- * Someone on the map, as a coin (D-409): their picture to its edge, or a stranger's number, as Creature 2's, or the hood, under glass, its edge bevelled, lit
301
- * above and shaded below, its shadow low on the paper; no ring of a side. Whoever acts is raised off the paper, a little larger, its shadow wide and soft (D-419); a foe the master marked glows
302
- * red a little (D-415); one of the party has the pip of their side at the lower left, with their class's symbol or the side's (D-414); anyone the pip of
303
- * their state at the lower right, and its words in the token's title (D-419).
304
- */
305
- function Token({ one, index, acting, hostile, x, y, scale, choice }) {
306
- const [symbols] = usePref(tokenSymbolsPref);
307
- const side = one.side ?? 1;
308
- const r = size * side * 0.43;
309
- const number = one.stranger ? /[A-Z]?\d+$/.exec(one.name)?.[0] : undefined;
310
- const pip = symbols ? sideOf(one.role) : undefined;
311
- // On a map shown small, as on a phone, the marks grow to stay readable, each toward the token's middle by as much as it grows, its paper too, so that the
312
- // box round it keeps its outer edges and two tokens side by side keep their marks apart as at full size.
313
- const grow = Math.min(1.4, Math.max(1, 0.65 / scale));
314
- // The two pips below share the square's width with their neighbours' on either side: past 1.12 the player's character's, gold-ringed, would touch the
315
- // state's pip, on the token or the next one; the number, alone above, grows on.
316
- const below = Math.min(grow, 1.12);
317
- const inward = (radius, paper, by = below) => (by - 1) * (radius + paper);
318
- const pipPaper = pip === "you" ? 3 : 1.5;
319
- return (_jsxs("g", { class: ["lm-token", one.role, acting ? "acting" : "", fallenOf(one), choice === undefined ? "" : "choosable", choice?.chosen === true ? "chosen" : ""].filter((name) => name !== "").join(" "), style: acting ? { transformOrigin: `${x}px ${y}px` } : undefined, onClick: choice?.onChoose, children: [_jsx("title", { children: [`${one.stranger ? strangerLabel(one.name) : one.name}, ${one.square}`, ...statusWords(one)].join(" · ") }), hostile && (_jsxs(_Fragment, { children: [_jsx("circle", { class: "lm-hostile-glow", cx: x, cy: y, r: r + 7, fill: "url(#lm-hostile-glow)" }), _jsx("circle", { class: "lm-hostile", cx: x, cy: y, r: r + 2.4 })] })), choice !== undefined && _jsx("circle", { class: "lm-choice", cx: x, cy: y, r: r + 4 }), _jsxs("g", { filter: "url(#lm-drop)", children: [_jsx("circle", { class: "lm-disc", cx: x, cy: y, r: r }), _jsx("circle", { class: "lm-ring", cx: x, cy: y, r: r - 0.5 }), one.image
320
- ? _jsx("image", { href: `/images/${encodeURIComponent(one.image.file)}?v=${one.image.version}`, x: x - r, y: y - r, width: r * 2, height: r * 2, "clip-path": `url(#lm-token-${index})` })
321
- : (_jsx("g", { transform: `translate(${x} ${y}) scale(${side})`, children: number !== undefined
322
- ? _jsx("text", { class: "lm-number", y: 1, "text-anchor": "middle", "dominant-baseline": "middle", children: number })
323
- : one.stranger
324
- ? _jsx("path", { class: "lm-stranger", d: "M12 3c-4 0-6.5 3.5-6.5 8v3.5L4 20.5h16l-1.5-6V11c0-4.5-2.5-8-6.5-8Z", transform: "translate(-10.8 -11) scale(0.9)" })
325
- : _jsx("text", { class: "lm-number", y: 1, "text-anchor": "middle", "dominant-baseline": "middle", children: one.name.slice(0, 1).toUpperCase() }) })), _jsx(Glass, { x: x, y: y, r: r, prefix: "lm" }), _jsx("path", { class: "lm-bevel-lit", d: crescent(x, y, r, 1.5) }), _jsx("path", { class: "lm-bevel-shade", d: crescent(x, y, r, -1.5) })] }), pip !== undefined && _jsx(MapPip, { side: pip, icon: one.stranger ? undefined : one.icon, x: x - r * 0.725 + inward(pipRadius, pipPaper), y: y + r * 0.725 - inward(pipRadius, pipPaper), grow: below }), one.image !== undefined && number !== undefined && _jsx(MapNumber, { number: number, x: x + r * 0.725 - inward(numberRadius, 1.5, grow), y: y - r * 0.725 + inward(numberRadius, 1.5, grow), grow: grow }), _jsx(MapStatus, { one: one, x: x + r * 0.56 - inward(statusRadius, 1.5), y: y + r * 0.56 - inward(statusRadius, 1.5), grow: below })] }));
326
- }
327
- /** Someone on the map with what a widget on them says: dead by its rules too. */
328
- function standingOf(one, person) {
329
- return { ...one, party: one.role !== "other", person, ...(person?.dead === true ? { dead: true } : {}) };
330
- }
331
- /** At 0 a token greyed, until its counter rises again; dead, greyer and faded, as in the party's strip (D-461). */
332
- function fallenOf(one) {
333
- return one.dead === true ? "dead" : one.down === true ? "fallen" : "";
334
- }
335
- // The marks on a token as on one of 40 pixels on the page: the side's pip of 17, the state's of 12, a number's coin 13 high.
336
- const pipRadius = size * 0.43 * (17 / 40);
337
- const statusRadius = size * 0.43 * (12 / 40);
338
- const numberRadius = size * 0.43 * (13 / 40);
339
- /**
340
- * A token's pip on the map (D-414): as on the page, a disc of the side's colour with its symbol, ringed in the paper's colour; the same size for any creature,
341
- * larger by `grow` on a map shown small.
342
- */
343
- function MapPip({ side, icon, x, y, grow }) {
344
- const radius = pipRadius * grow;
345
- // A symbol of 12 in the pip of 17.
346
- const scale = (radius * 2 * (12 / 17)) / 24;
347
- return (_jsxs("g", { class: `lm-pip ${side}`, "aria-hidden": "true", children: [_jsx("circle", { class: "lm-pip-paper", cx: x, cy: y, r: radius + (side === "you" ? 3 : 1.5) * grow }), side === "you" && _jsx("circle", { class: "lm-pip-gold", cx: x, cy: y, r: radius + 1.5 * grow }), _jsx("circle", { class: "lm-pip-disc", cx: x, cy: y, r: radius }), _jsx("path", { class: "lm-pip-symbol", d: icon ?? sideIcons[side], transform: `translate(${x - 12 * scale} ${y - 12 * scale}) scale(${scale})` })] }));
348
- }
349
- /**
350
- * A stranger's number over their picture (D-420): as on the page, a small dark coin at the token's upper right, ringed in the paper's colour; wider for two
351
- * letters; larger by `grow` on a map shown small.
352
- */
353
- function MapNumber({ number, x, y, grow }) {
354
- // Figures of 8.5 on the coin.
355
- const height = numberRadius * 2 * grow;
356
- const width = Math.max(height, (number.length * 6 + 4) * grow);
357
- return (_jsxs("g", { class: "lm-number-pip", "aria-hidden": "true", "font-size": 8.5 * grow, children: [_jsx("rect", { class: "lm-pip-paper", x: x - width / 2 - 1.5 * grow, y: y - height / 2 - 1.5 * grow, width: width + 3 * grow, height: height + 3 * grow, rx: height / 2 + 1.5 * grow }), _jsx("rect", { class: "lm-number-disc", x: x - width / 2, y: y - height / 2, width: width, height: height, rx: height / 2 }), _jsx("text", { class: "lm-number-small", x: x, y: y + 0.5 * grow, "text-anchor": "middle", "dominant-baseline": "middle", children: number })] }));
358
- }
359
- /**
360
- * The pip of someone's state on the map (D-419): as on the page, smaller than the side's, a second coin behind when there are more; the same size for any
361
- * creature, larger by `grow` on a map shown small.
362
- */
363
- function MapStatus({ one, x, y, grow }) {
364
- const [shown] = useChoice(conditionsPref);
365
- const marks = statusMarks(one);
366
- if (shown === "never" || marks.length === 0) {
367
- return null;
368
- }
369
- const radius = statusRadius * grow;
370
- const paper = 1.5 * grow;
371
- // A symbol of 9.6 in the pip of 12.
372
- const scale = (radius * 2 * (24 / 30)) / 24;
373
- // The second coin up more than out, within the token's square: a crescent of about 3 of the token's 40 past the paper round the first (D-420).
374
- const behind = { x: radius * 0.3, y: radius * 0.85 };
375
- const strong = marks[0].kind === "state";
376
- return (_jsxs("g", { class: ["lm-status", strong ? "strong" : "", marks[0].tone ?? "", shown === "hover" ? "on-hover" : ""].filter((name) => name !== "").join(" "), "aria-hidden": "true", children: [marks.length > 1 && (_jsxs(_Fragment, { children: [_jsx("circle", { class: "lm-pip-paper", cx: x + behind.x, cy: y - behind.y, r: radius + paper }), _jsx("circle", { class: "lm-status-back", cx: x + behind.x, cy: y - behind.y, r: radius })] })), _jsx("circle", { class: "lm-pip-paper", cx: x, cy: y, r: radius + paper }), _jsx("circle", { class: "lm-status-disc", cx: x, cy: y, r: radius }), _jsx("path", { class: marks[0].filled ? "lm-status-symbol filled" : "lm-status-symbol", d: marks[0].icon, transform: `translate(${x - 12 * scale} ${y - 12 * scale}) scale(${scale})` })] }));
377
- }
378
- /** The thin crescent a coin's bevel lights, from its top when `offset` is positive or shades at its bottom when negative: the circle less itself moved by it. */
379
- function crescent(x, y, r, offset) {
380
- const half = Math.sqrt(r * r - (offset / 2) ** 2);
381
- const middle = y + offset / 2;
382
- const [outer, inner] = offset > 0 ? [1, 0] : [0, 1];
383
- return `M${x - half} ${middle}A${r} ${r} 0 1 ${outer} ${x + half} ${middle}A${r} ${r} 0 0 ${inner} ${x - half} ${middle}Z`;
384
- }
385
- /** A thing of the legend drawn small, as on the map, for the key. */
386
- function Swatch({ feature, ground }) {
387
- return (_jsxs("svg", { class: `lm-swatch lm-look-${ground}`, viewBox: "0 0 40 40", "aria-hidden": "true", children: [_jsx("rect", { class: "lm-paper", width: 40, height: 40 }), ["wall", "rock", "window"].includes(feature.kind)
388
- ? _jsx("rect", { class: `lm-wall ${feature.kind}`, width: 40, height: 40 })
389
- : (_jsxs(_Fragment, { children: [_jsx("rect", { class: "lm-floor-fill", width: 40, height: 40 }), ["door", "open-door", "secret-door", "opening"].includes(feature.kind)
390
- ? (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-outline", d: "M0 0V40M40 0V40" }), feature.kind !== "opening" && _jsx("rect", { class: feature.kind === "secret-door" ? "lm-door-leaf secret" : "lm-door-leaf", x: 14, y: 2, width: 12, height: 36 })] }))
391
- : groundKinds.includes(feature.kind)
392
- ? _jsx(Ground, { kind: feature.kind, x: 0, y: 0, side: 40, seed: { column: 0, row: 0 } })
393
- : _jsx(Thing, { kind: feature.kind, symbol: feature.symbol, x: 0, y: 0, w: 40, h: 40, cells: [[0, 0]] }), feature.difficult && _jsx(Corner, { x: 0, y: 0, side: 40 })] }))] }));
394
- }
395
- /** A flame, from its foot. */
396
- function flame(x, y, height) {
397
- return `M${x} ${y}c${-height * 0.45} ${-height * 0.25} ${-height * 0.3} ${-height * 0.7} 0 ${-height}c${height * 0.05} ${height * 0.3} ${height * 0.35} ${height * 0.35} ${height * 0.3} ${height * 0.65}`
398
- + `c${-height * 0.02} ${height * 0.2} ${-height * 0.15} ${height * 0.33} ${-height * 0.3} ${height * 0.35}z`;
399
- }
400
- /** A pebble of rubble. */
401
- function pebble(x, y, r) {
402
- return `M${x - r} ${y}l${r * 0.6} ${-r * 0.9}l${r} ${r * 0.2}l${r * 0.4} ${r}l${-r * 0.9} ${r * 0.6}z`;
403
- }
404
- /** A tree's crown: a circle of lobes. */
405
- function canopy(x, y, r) {
406
- const bumps = 9;
407
- return Array.from({ length: bumps + 1 }, (_, index) => {
408
- const angle = (index / bumps) * Math.PI * 2;
409
- const [px, py] = [x + Math.cos(angle) * r, y + Math.sin(angle) * r];
410
- return index === 0 ? `M${px} ${py}` : `A${r * 0.36} ${r * 0.36} 0 0 1 ${px} ${py}`;
411
- }).join("") + "z";
412
- }
413
- /** A symbol of the map by its name: those every map has (GRD-1), a wall, the floor, a door, in the page's language; the others as the master named them. */
414
- function featureName(feature) {
415
- const builtIn = { wall: t("wall"), floor: t("floor"), door: t("door") };
416
- return feature.name === feature.kind ? builtIn[feature.kind] ?? feature.name : feature.name;
417
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes