rpg-engine 0.5.0 → 0.6.1

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 (218) hide show
  1. package/dist/campaign/settings.d.ts +1 -0
  2. package/dist/campaign/settings.js +6 -5
  3. package/dist/command-line.js +12 -5
  4. package/dist/commands/advance.js +1 -1
  5. package/dist/commands/ask.d.ts +1 -1
  6. package/dist/commands/ask.js +66 -24
  7. package/dist/commands/change.js +28 -17
  8. package/dist/commands/config.d.ts +1 -1
  9. package/dist/commands/config.js +67 -21
  10. package/dist/commands/effect.js +42 -23
  11. package/dist/commands/find.js +1 -1
  12. package/dist/commands/game-adventures.js +2 -2
  13. package/dist/commands/game-catalog.d.ts +13 -0
  14. package/dist/commands/game-catalog.js +26 -2
  15. package/dist/commands/game-checks.js +23 -21
  16. package/dist/commands/{game-hit-dice.d.ts → game-dice-pool.d.ts} +3 -3
  17. package/dist/commands/{game-hit-dice.js → game-dice-pool.js} +7 -7
  18. package/dist/commands/game-effects.d.ts +12 -4
  19. package/dist/commands/game-effects.js +21 -13
  20. package/dist/commands/game-examples.d.ts +22 -0
  21. package/dist/commands/game-examples.js +72 -0
  22. package/dist/commands/game-extension-list.d.ts +31 -3
  23. package/dist/commands/game-extension-list.js +83 -7
  24. package/dist/commands/game-images.d.ts +1 -1
  25. package/dist/commands/game-images.js +3 -2
  26. package/dist/commands/game-library.d.ts +3 -0
  27. package/dist/commands/game-library.js +2 -2
  28. package/dist/commands/game-mode.js +1 -1
  29. package/dist/commands/game-package-code.d.ts +87 -0
  30. package/dist/commands/game-package-code.js +648 -0
  31. package/dist/commands/game-package-hooks.d.ts +37 -0
  32. package/dist/commands/game-package-hooks.js +116 -0
  33. package/dist/commands/game-recipes.js +2 -2
  34. package/dist/commands/game-reminders.d.ts +5 -2
  35. package/dist/commands/game-reminders.js +7 -4
  36. package/dist/commands/game-rules.d.ts +4 -1
  37. package/dist/commands/game-rules.js +7 -1
  38. package/dist/commands/game-upkeep.js +3 -3
  39. package/dist/commands/game-view-place.d.ts +8 -20
  40. package/dist/commands/game-view-place.js +16 -35
  41. package/dist/commands/game-widgets.d.ts +39 -10
  42. package/dist/commands/game-widgets.js +138 -35
  43. package/dist/commands/game-world.d.ts +17 -0
  44. package/dist/commands/game-world.js +70 -12
  45. package/dist/commands/image.js +1 -1
  46. package/dist/commands/init.js +2 -2
  47. package/dist/commands/mode.d.ts +1 -1
  48. package/dist/commands/package.d.ts +8 -0
  49. package/dist/commands/package.js +81 -24
  50. package/dist/commands/progression.d.ts +2 -0
  51. package/dist/commands/progression.js +7 -2
  52. package/dist/commands/roll.d.ts +2 -0
  53. package/dist/commands/roll.js +50 -24
  54. package/dist/commands/rules.js +6 -4
  55. package/dist/commands/scene.d.ts +1 -1
  56. package/dist/commands/scene.js +13 -10
  57. package/dist/commands/sheet.js +10 -1
  58. package/dist/commands/status.d.ts +1 -0
  59. package/dist/commands/status.js +14 -4
  60. package/dist/commands/trade.js +6 -4
  61. package/dist/commands/translate.js +2 -2
  62. package/dist/commands/travel.js +1 -1
  63. package/dist/commands/validate.js +2 -2
  64. package/dist/commands/view.d.ts +8 -4
  65. package/dist/commands/view.js +7 -6
  66. package/dist/commands/worked-out.js +11 -5
  67. package/dist/commands/write.d.ts +8 -1
  68. package/dist/commands/write.js +84 -25
  69. package/dist/core/command-reference.js +3 -2
  70. package/dist/core/consents.d.ts +18 -0
  71. package/dist/core/consents.js +93 -0
  72. package/dist/core/context.d.ts +51 -29
  73. package/dist/core/context.js +3 -1
  74. package/dist/core/examples.d.ts +25 -0
  75. package/dist/core/examples.js +19 -0
  76. package/dist/{extensions/api.d.ts → core/package-api.d.ts} +134 -32
  77. package/dist/core/package-declarations.d.ts +102 -0
  78. package/dist/core/package-declarations.js +81 -0
  79. package/dist/core/registry.d.ts +2 -0
  80. package/dist/core/text.d.ts +5 -0
  81. package/dist/core/text.js +12 -0
  82. package/dist/dashboard/acts.js +31 -24
  83. package/dist/dashboard/address.js +4 -1
  84. package/dist/dashboard/api.js +54 -0
  85. package/dist/dashboard/app.js +140 -96
  86. package/dist/dashboard/ask-card.js +76 -25
  87. package/dist/dashboard/asked-dice.js +57 -0
  88. package/dist/dashboard/dice/tray.js +3 -3
  89. package/dist/dashboard/extension-widgets.js +104 -10
  90. package/dist/dashboard/i18n/ar.json +25 -29
  91. package/dist/dashboard/i18n/cs.json +25 -29
  92. package/dist/dashboard/i18n/da.json +25 -29
  93. package/dist/dashboard/i18n/de.json +25 -29
  94. package/dist/dashboard/i18n/el.json +25 -29
  95. package/dist/dashboard/i18n/es.json +25 -29
  96. package/dist/dashboard/i18n/fi.json +25 -29
  97. package/dist/dashboard/i18n/fr.json +25 -29
  98. package/dist/dashboard/i18n/he.json +25 -29
  99. package/dist/dashboard/i18n/hi.json +25 -29
  100. package/dist/dashboard/i18n/hu.json +25 -29
  101. package/dist/dashboard/i18n/is.json +25 -29
  102. package/dist/dashboard/i18n/it.json +25 -29
  103. package/dist/dashboard/i18n/ja.json +25 -29
  104. package/dist/dashboard/i18n/ko.json +25 -29
  105. package/dist/dashboard/i18n/nb.json +25 -29
  106. package/dist/dashboard/i18n/nl.json +25 -29
  107. package/dist/dashboard/i18n/pl.json +25 -29
  108. package/dist/dashboard/i18n/pt.json +25 -29
  109. package/dist/dashboard/i18n/ro.json +25 -29
  110. package/dist/dashboard/i18n/ru.json +25 -29
  111. package/dist/dashboard/i18n/sv.json +25 -29
  112. package/dist/dashboard/i18n/tr.json +25 -29
  113. package/dist/dashboard/i18n/uk.json +25 -29
  114. package/dist/dashboard/i18n/zh.json +25 -29
  115. package/dist/dashboard/icons.js +4 -1
  116. package/dist/dashboard/kit.js +35 -0
  117. package/dist/dashboard/labels.js +1 -0
  118. package/dist/dashboard/pack-card.js +7 -2
  119. package/dist/dashboard/package-page.js +50 -0
  120. package/dist/dashboard/packages.js +172 -23
  121. package/dist/dashboard/page-code.js +248 -0
  122. package/dist/dashboard/party.js +13 -14
  123. package/dist/dashboard/people.js +4 -0
  124. package/dist/dashboard/person-panel.js +110 -0
  125. package/dist/dashboard/place-map-view.js +11 -6
  126. package/dist/dashboard/scene.js +12 -9
  127. package/dist/dashboard/settings.js +55 -9
  128. package/dist/dashboard/sheet.js +21 -13
  129. package/dist/dashboard/status.js +69 -15
  130. package/dist/dashboard/style.css +592 -825
  131. package/dist/dashboard/top.js +75 -25
  132. package/dist/dashboard/turns.js +34 -13
  133. package/dist/dashboard/widgets.js +9 -2
  134. package/dist/dashboard-server.js +189 -10
  135. package/dist/dice/roll-dice.js +1 -1
  136. package/dist/effects/effect.d.ts +7 -4
  137. package/dist/effects/effect.js +12 -9
  138. package/dist/extensions/engine.d.ts +4 -0
  139. package/dist/extensions/engine.js +74 -0
  140. package/dist/extensions/extension.d.ts +25 -37
  141. package/dist/extensions/extension.js +26 -48
  142. package/dist/extensions/index.d.ts +3 -2
  143. package/dist/extensions/index.js +4 -1
  144. package/dist/extensions/packages.d.ts +6 -0
  145. package/dist/extensions/packages.js +100 -11
  146. package/dist/index.d.ts +1 -3
  147. package/dist/mcp-server.js +51 -14
  148. package/dist/page-words.d.ts +4 -0
  149. package/dist/page-words.js +4 -4
  150. package/dist/page.d.ts +218 -0
  151. package/dist/page.js +2 -0
  152. package/dist/pages/load.d.ts +7 -1
  153. package/dist/pages/load.js +10 -5
  154. package/dist/pages/page-file.js +1 -1
  155. package/dist/pages/stack-writes.js +5 -4
  156. package/dist/pages/world.d.ts +8 -0
  157. package/dist/pages/world.js +9 -2
  158. package/dist/systems/game-system.d.ts +52 -26
  159. package/dist/systems/game-system.js +141 -42
  160. package/dist/systems/index.d.ts +3 -3
  161. package/dist/systems/index.js +3 -3
  162. package/dist/systems/system-code.d.ts +29 -88
  163. package/dist/systems/system-code.js +68 -23
  164. package/dist/systems/words.d.ts +2 -0
  165. package/dist/systems/words.js +11 -0
  166. package/dist/testing.d.ts +20 -5
  167. package/dist/testing.js +49 -14
  168. package/instructions/combat.md +2 -2
  169. package/instructions/core.md +2 -2
  170. package/instructions/dashboard.md +2 -2
  171. package/instructions/mentor-tutorial.md +1 -1
  172. package/instructions/play.md +3 -3
  173. package/instructions/setup.md +1 -1
  174. package/package.json +10 -2
  175. package/systems/5e/LICENSE.md +13 -3
  176. package/systems/5e/dist/dying.js +83 -16
  177. package/systems/5e/dist/index.js +2 -2
  178. package/systems/5e/dist/page-style.js +634 -0
  179. package/systems/5e/dist/page.js +166 -0
  180. package/systems/5e/dist/shown.js +23 -0
  181. package/systems/5e/instructions/combat.md +1 -0
  182. package/systems/5e/package.json +4 -2
  183. package/systems/5e/system.yaml +37 -9
  184. package/systems/5e/versions/srd-5.1/system.yaml +2 -0
  185. package/systems/5e/words/ar.yaml +30 -0
  186. package/systems/5e/words/cs.yaml +30 -0
  187. package/systems/5e/words/da.yaml +30 -0
  188. package/systems/5e/words/de.yaml +30 -0
  189. package/systems/5e/words/el.yaml +30 -0
  190. package/systems/5e/words/es.yaml +30 -0
  191. package/systems/5e/words/fi.yaml +30 -0
  192. package/systems/5e/words/fr.yaml +30 -0
  193. package/systems/5e/words/he.yaml +30 -0
  194. package/systems/5e/words/hi.yaml +30 -0
  195. package/systems/5e/words/hu.yaml +30 -0
  196. package/systems/5e/words/is.yaml +30 -0
  197. package/systems/5e/words/it.yaml +30 -0
  198. package/systems/5e/words/ja.yaml +30 -0
  199. package/systems/5e/words/ko.yaml +30 -0
  200. package/systems/5e/words/nb.yaml +30 -0
  201. package/systems/5e/words/nl.yaml +30 -0
  202. package/systems/5e/words/pl.yaml +30 -0
  203. package/systems/5e/words/pt.yaml +30 -0
  204. package/systems/5e/words/ro.yaml +30 -0
  205. package/systems/5e/words/ru.yaml +30 -0
  206. package/systems/5e/words/sv.yaml +30 -0
  207. package/systems/5e/words/tr.yaml +30 -0
  208. package/systems/5e/words/uk.yaml +30 -0
  209. package/systems/5e/words/zh.yaml +30 -0
  210. package/dist/commands/game-extensions.d.ts +0 -34
  211. package/dist/commands/game-extensions.js +0 -407
  212. package/dist/commands/game-system-code.d.ts +0 -33
  213. package/dist/commands/game-system-code.js +0 -188
  214. package/dist/dashboard/death-save.js +0 -67
  215. package/dist/dashboard/dying.js +0 -46
  216. package/dist/dashboard/save-outcome.js +0 -42
  217. package/dist/dashboard/spend.js +0 -115
  218. /package/dist/{extensions/api.js → core/package-api.js} +0 -0
@@ -6,57 +6,102 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
6
6
  }
7
7
  return path;
8
8
  };
9
- // The code a game system brings where its data is not enough (D-448), as the 5e's dying point: hooks the engine calls after its own writes, given the game
10
- // they may read and change. A system's package.json says it has code, as an extension's does (D-439); the engine loads it once for the process, as it starts.
9
+ // The code a game system brings where its data is not enough (D-448, D-514), with the same contract as an extension's: the engine loads it once for the process,
10
+ // as it starts. A system's package.json says it has code and which API it is made for, as an extension's does (D-439); a folder without one is data alone.
11
11
  import { existsSync, readFileSync } from "node:fs";
12
- import { join } from "node:path";
12
+ import { join, resolve } from "node:path";
13
13
  import { pathToFileURL } from "node:url";
14
+ import { z } from "zod";
15
+ import { packageCodeMayRun } from "../core/consents.js";
16
+ import { realPath } from "../core/files.js";
17
+ import { apiProblem } from "../core/package-declarations.js";
18
+ import { isInside } from "../core/store.js";
14
19
  import { systemFolders } from "./system-folders.js";
20
+ /** A system's package.json of kind system; undefined for a folder without one, which is data alone. */
21
+ export function systemPackage(folder) {
22
+ const path = join(folder, "package.json");
23
+ if (!existsSync(path)) {
24
+ return undefined;
25
+ }
26
+ try {
27
+ const data = JSON.parse(readFileSync(path, "utf8"));
28
+ const marker = data["rpg-engine"];
29
+ if (marker?.kind !== "system") {
30
+ return undefined;
31
+ }
32
+ return {
33
+ package: typeof data.name === "string" ? data.name : "",
34
+ version: typeof data.version === "string" ? data.version : "0.0.0",
35
+ ...(typeof data.main === "string" ? { main: data.main } : {}),
36
+ ...(typeof marker.page === "string" ? { page: marker.page } : {}),
37
+ ...(typeof marker.api === "number" ? { api: marker.api } : {}),
38
+ };
39
+ }
40
+ catch {
41
+ return undefined;
42
+ }
43
+ }
44
+ /** What a package's default export gave, refused when it is not its code, an object, as null is not. */
45
+ export function givenCode(given, file) {
46
+ if (typeof given !== "object" || given === null || Array.isArray(given)) {
47
+ throw new Error(`${file}'s default export gave ${given === null ? "null" : Array.isArray(given) ? "a list" : typeof given}, not its code: give an object, such as { commands: [] }`);
48
+ }
49
+ return given;
50
+ }
15
51
  /** Whether a system's folder brings code: a package.json of kind system with a main (D-448). */
16
52
  export function systemHasCode(folder) {
17
- return systemPackage(folder) !== undefined;
53
+ return systemPackage(folder)?.main !== undefined;
54
+ }
55
+ /** Why this engine does not read the system in this folder, made for another API, with what to do; undefined when it does, or when it is data alone. */
56
+ export function systemApiProblem(folder) {
57
+ const own = systemPackage(folder);
58
+ return own === undefined ? undefined : apiProblem(own.api, "system");
59
+ }
60
+ /** A system's code for the dashboard's page, as its package.json declares it (D-511): its module's file, the package's name and version; undefined without one. */
61
+ export function systemPageModule(folder) {
62
+ const own = systemPackage(folder);
63
+ // Its page code is a file of its own, by real paths, links included (D-510).
64
+ const inside = own?.page !== undefined && isInside(realPath(folder), realPath(resolve(folder, own.page)));
65
+ return !inside || own?.page === undefined || own.package === "" ? undefined : { file: join(folder, own.page), package: own.package, version: own.version };
18
66
  }
19
67
  /**
20
68
  * The code of every system in these folders that brings some, by the system's name, loaded once: from its source where the engine runs from its own, as in
21
- * the tests, else from its built main. One that fails to load says why, for the command that needs it.
69
+ * the tests, else from its built main. One that fails to load, or is made for an API this engine does not read, says why, for the command that needs it.
22
70
  */
23
71
  export async function loadSystemCode(folders) {
24
72
  const loaded = {};
25
73
  // The nearest system by a name is the one played, as findSystem reads it: another of that name never brings its code.
26
74
  const seen = new Set();
27
75
  for (const { name, folder: own } of systemFolders(folders)) {
28
- const main = systemPackage(own);
76
+ const main = systemPackage(own)?.main;
77
+ const version = systemPackage(own)?.version ?? "0.0.0";
29
78
  const first = !seen.has(name.toLowerCase());
30
79
  seen.add(name.toLowerCase());
31
80
  if (main === undefined || !first) {
32
81
  continue;
33
82
  }
83
+ const unread = systemApiProblem(own);
84
+ if (unread !== undefined) {
85
+ loaded[name] = { refused: unread.replace(/^it /, ""), version };
86
+ continue;
87
+ }
88
+ // Another's code runs only after the player's yes, for this version and these files (D-478, D-511).
89
+ if (!packageCodeMayRun(own)) {
90
+ loaded[name] = { refused: `is not ours, and the player has not said yes to it as it is installed: install it again with package install, for their yes`, version };
91
+ continue;
92
+ }
34
93
  const source = join(own, "src", "index.ts");
35
94
  const file = import.meta.url.endsWith(".ts") && existsSync(source) ? source : join(own, main);
36
95
  try {
37
96
  const module = await import(__rewriteRelativeImportExtension(pathToFileURL(file).href));
38
97
  if (typeof module.default !== "function") {
39
- throw new Error(`${file} has no default export that gives its hooks`);
98
+ throw new Error(`${file} has no default export that gives its code`);
40
99
  }
41
- loaded[name] = { hooks: module.default() };
100
+ loaded[name] = { code: givenCode(module.default({ z }), file), version };
42
101
  }
43
102
  catch (error) {
44
- loaded[name] = { problem: error instanceof Error ? error.message : String(error) };
103
+ loaded[name] = { problem: error instanceof Error ? error.message : String(error), version };
45
104
  }
46
105
  }
47
106
  return loaded;
48
107
  }
49
- /** The main of a system's package.json of kind system; undefined when it has none. */
50
- function systemPackage(folder) {
51
- const path = join(folder, "package.json");
52
- if (!existsSync(path)) {
53
- return undefined;
54
- }
55
- try {
56
- const data = JSON.parse(readFileSync(path, "utf8"));
57
- return data["rpg-engine"]?.kind === "system" && typeof data.main === "string" ? data.main : undefined;
58
- }
59
- catch {
60
- return undefined;
61
- }
62
- }
@@ -9,3 +9,5 @@ export interface SystemWords {
9
9
  }
10
10
  /** The words of the system in this folder for a language, or for its base language (pt for pt-BR); undefined when the system has none in it. */
11
11
  export declare function systemWords(folder: string, language: string): SystemWords | undefined;
12
+ /** The words of a system for a language from its folders in order, its own then its version's (VER-3): a later folder's names win; undefined when none has any. */
13
+ export declare function layeredSystemWords(folders: string[], language: string): SystemWords | undefined;
@@ -21,3 +21,14 @@ export function systemWords(folder, language) {
21
21
  const { groups = {}, fields = {}, words = {}, names, headline } = parsed.data;
22
22
  return { groups, fields, words, ...(names === undefined ? {} : { names }), ...(headline === undefined ? {} : { headline }) };
23
23
  }
24
+ /** The words of a system for a language from its folders in order, its own then its version's (VER-3): a later folder's names win; undefined when none has any. */
25
+ export function layeredSystemWords(folders, language) {
26
+ const found = folders.map((folder) => systemWords(folder, language)).filter((words) => words !== undefined);
27
+ return found.length === 0 ? undefined : found.reduce((below, over) => ({
28
+ groups: { ...below.groups, ...over.groups },
29
+ fields: { ...below.fields, ...over.fields },
30
+ words: { ...below.words, ...over.words },
31
+ ...(below.names === undefined && over.names === undefined ? {} : { names: { ...below.names, ...over.names } }),
32
+ ...((over.headline ?? below.headline) === undefined ? {} : { headline: over.headline ?? below.headline }),
33
+ }));
34
+ }
package/dist/testing.d.ts CHANGED
@@ -19,19 +19,29 @@ export interface TestCampaign {
19
19
  run(...args: string[]): Promise<Ran>;
20
20
  /** Runs a command that must succeed, and gives what it printed; it throws with that when it fails. */
21
21
  ok(...args: string[]): Promise<string>;
22
+ /** Asks the player with the core's ask, as through MCP, since the command line asks in words: give the context a page or a player to answer it. */
23
+ ask(input: AskInput): Promise<Ran>;
22
24
  /** The dice show these faces in turn, each one die of any size; when they run out, a roll throws. */
23
25
  dice(...faces: number[]): void;
24
26
  /** The lines of the campaign's log, in order. */
25
27
  log(): LogEntry[];
26
28
  /** A file of the campaign, as text, by its path in it; undefined when there is none. */
27
29
  read(path: string): string | undefined;
28
- /** The widgets of the campaign's extensions, as the dashboard shows them. */
29
- widgets(): Promise<ShownWidget[]>;
30
+ /** The widgets of the campaign's extensions, as the dashboard shows them; given a package's name, that package's alone, its game system's too. */
31
+ widgets(of?: string): Promise<ShownWidget[]>;
30
32
  /** The dashboard of the campaign, served on a port of this computer, with a page open on it. */
31
33
  dashboard(): Promise<TestDashboard>;
32
34
  /** Takes the campaign's folder away, and anything it started. */
33
35
  close(): Promise<void>;
34
36
  }
37
+ /** What the core's ask takes, as its MCP tool does. */
38
+ export interface AskInput {
39
+ question: string;
40
+ options?: string | string[];
41
+ who?: string;
42
+ square?: boolean;
43
+ recipe?: string;
44
+ }
35
45
  /** A campaign's dashboard in a test: the player through its page, what it answers, and what it is sent. */
36
46
  export interface TestDashboard {
37
47
  /** The player through the page: give it as the campaign's context.page for the questions to reach the page. */
@@ -45,9 +55,14 @@ export interface TestDashboard {
45
55
  }>;
46
56
  close(): Promise<void>;
47
57
  }
48
- /** How a test campaign is made: its game system, the folders of the extensions it uses, its language, and whether its setup is done (by default it is). */
58
+ /**
59
+ * How a test campaign is made: its game system, the folders of the game systems beside the engine's, which win over them, the folders of the extensions it
60
+ * uses, its language, and whether its setup is done (by default it is).
61
+ */
49
62
  export interface TestCampaignOptions {
50
63
  system: string;
64
+ /** Folders of game systems, each with its system.yaml, linked as the player's own: a system's repository its own, as `systems: ["."]`. */
65
+ systems?: string[];
51
66
  extensions?: string[];
52
67
  language?: string;
53
68
  play?: boolean;
@@ -55,7 +70,7 @@ export interface TestCampaignOptions {
55
70
  settings?: Record<string, unknown>;
56
71
  }
57
72
  /**
58
- * A campaign in play for a test (D-506): made with init in a temporary folder, its setup done, using these extensions, each linked from its folder as the
59
- * player's own, never through npm, so that its code runs. Its dice show 4 until told otherwise, its time is a fixed day, its ids count up.
73
+ * A campaign in play for a test (D-506): made with init in a temporary folder, its setup done, using these extensions and game systems, each linked from its
74
+ * folder as the player's own, never through npm, so that its code runs. Its dice show 4 until told otherwise, its time is a fixed day, its ids count up.
60
75
  */
61
76
  export declare function testCampaign(options: TestCampaignOptions): Promise<TestCampaign>;
package/dist/testing.js CHANGED
@@ -1,5 +1,6 @@
1
- // The test kit for whoever writes an extension (D-506): a campaign of a game system in play, with the extension installed from its folder as the player's own,
2
- // its commands run as the command line runs them, with the dice and the time decided; its log, its widgets and the dashboard read as the page reads them.
1
+ // The test kit for whoever writes an extension or a game system (D-506, D-514): a campaign of a game system in play, the engine's or one from its folder, with
2
+ // the extensions installed from their folders as the player's own, its commands run as the command line runs them, with the dice and the time decided; its
3
+ // log, its widgets and the dashboard read as the page reads them.
3
4
  import { mkdirSync, mkdtempSync, readFileSync, rmdirSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
4
5
  import { request } from "node:http";
5
6
  import { tmpdir } from "node:os";
@@ -7,19 +8,33 @@ import { basename, join, resolve } from "node:path";
7
8
  import { fileURLToPath } from "node:url";
8
9
  import { stringify } from "yaml";
9
10
  import { runCommandLine } from "./command-line.js";
11
+ import { ask } from "./commands/ask.js";
10
12
  import { campaignWidgets } from "./commands/game-widgets.js";
13
+ import { campaignSystem } from "./commands/game-world.js";
11
14
  import { SessionStore } from "./core/session-store.js";
12
15
  import { startDashboard } from "./dashboard-server.js";
13
16
  import { loadSystemCode } from "./systems/index.js";
14
17
  /**
15
- * A campaign in play for a test (D-506): made with init in a temporary folder, its setup done, using these extensions, each linked from its folder as the
16
- * player's own, never through npm, so that its code runs. Its dice show 4 until told otherwise, its time is a fixed day, its ids count up.
18
+ * A campaign in play for a test (D-506): made with init in a temporary folder, its setup done, using these extensions and game systems, each linked from its
19
+ * folder as the player's own, never through npm, so that its code runs. Its dice show 4 until told otherwise, its time is a fixed day, its ids count up.
17
20
  */
18
21
  export async function testCampaign(options) {
19
22
  const base = mkdtempSync(join(tmpdir(), "rpg-extension-test-"));
20
23
  const folder = join(base, "campaign");
21
24
  const packages = join(base, "packages");
22
- const linked = (options.extensions ?? []).map((extension) => linkPackage(packages, resolve(extension)));
25
+ const systems = join(base, "systems");
26
+ const linked = [];
27
+ try {
28
+ (options.extensions ?? []).forEach((extension) => linked.push(linkPackage(packages, resolve(extension))));
29
+ (options.systems ?? []).forEach((system) => linked.push(linkPackage(systems, resolve(system), true)));
30
+ }
31
+ catch (error) {
32
+ // The links first, alone, as close takes them away.
33
+ linked.forEach((one) => unlink(one.link));
34
+ rmSync(base, { recursive: true, force: true });
35
+ throw error;
36
+ }
37
+ const systemFolders = [systems, enginePath("../systems/")];
23
38
  let ids = 0;
24
39
  let faces;
25
40
  const context = {
@@ -39,8 +54,8 @@ export async function testCampaign(options) {
39
54
  newSalt: () => "salt",
40
55
  actor: "master",
41
56
  platform: process.platform === "win32" || process.platform === "darwin" ? process.platform : "linux",
42
- systemFolders: [enginePath("../systems/")],
43
- systemCode: await loadSystemCode([enginePath("../systems/")]),
57
+ systemFolders,
58
+ systemCode: await loadSystemCode(systemFolders),
44
59
  extensionFolders: [packages],
45
60
  };
46
61
  const started = [];
@@ -56,10 +71,22 @@ export async function testCampaign(options) {
56
71
  }
57
72
  return ran.output;
58
73
  },
74
+ ask: async (input) => {
75
+ try {
76
+ return { output: ask.format(await ask.run(ask.input.parse(input), campaign.context)), exitCode: 0 };
77
+ }
78
+ catch (error) {
79
+ return { output: error instanceof Error ? error.message : String(error), exitCode: 1 };
80
+ }
81
+ },
59
82
  dice: (...given) => (faces = [...given]),
60
83
  log: () => (readText(join(folder, "log.jsonl")) ?? "").split("\n").filter((line) => line.trim() !== "").map((line) => JSON.parse(line)),
61
84
  read: (path) => readText(join(folder, path)),
62
- widgets: () => campaignWidgets(folder, campaign.context),
85
+ // The extensions' alone unless a package is named, as a game system may have widgets of its own, as the 5e's death saves (D-516).
86
+ widgets: async (of) => {
87
+ const system = campaignSystem(folder, campaign.context)?.name;
88
+ return (await campaignWidgets(folder, campaign.context)).filter((widget) => of === undefined ? widget.extension !== system : widget.extension === of);
89
+ },
63
90
  dashboard: async () => {
64
91
  const dashboard = await testDashboard(campaign.context);
65
92
  started.push(dashboard);
@@ -76,24 +103,32 @@ export async function testCampaign(options) {
76
103
  if (options.play !== false) {
77
104
  inPlay(folder);
78
105
  }
79
- const extensions = Object.fromEntries(linked.map((one) => [one.name, one.version]));
106
+ const extensions = Object.fromEntries(linked.filter((one) => !one.system).map((one) => [one.name, one.version]));
80
107
  const added = { ...options.settings, ...(linked.length === 0 ? {} : { extensions }) };
81
108
  const written = readFileSync(join(folder, "campaign.yaml"), "utf8");
82
109
  writeFileSync(join(folder, "campaign.yaml"), Object.keys(added).length === 0 ? written : `${written}${stringify(added)}`);
83
110
  return campaign;
84
111
  }
85
- /** An extension's folder linked into the packages a test campaign reads, as one the player installed from a folder: its name and version. */
86
- function linkPackage(packages, folder) {
87
- const manifest = JSON.parse(readFileSync(join(folder, "package.json"), "utf8"));
112
+ /**
113
+ * A package's folder linked into those a test campaign reads, as one the player installed from a folder: its name and version. A game system's by the name of
114
+ * its package, which gives it its name, as @rpgengine/system-5e is 5e; one of data alone, without a package.json, by its folder's.
115
+ */
116
+ function linkPackage(packages, folder, system = false) {
117
+ const manifest = (readText(join(folder, "package.json")) === undefined && system
118
+ ? { name: basename(folder), version: "0.0.0" }
119
+ : JSON.parse(readText(join(folder, "package.json")) ?? "{}"));
88
120
  if (manifest.name === undefined || manifest.version === undefined) {
89
- throw new Error(`${folder} has no package.json with a name and a version: give the folder of an extension.`);
121
+ throw new Error(`${folder} has no package.json with a name and a version: give the folder of ${system ? "a game system" : "an extension"}.`);
122
+ }
123
+ if (system && readText(join(folder, "system.yaml")) === undefined) {
124
+ throw new Error(`${folder} has no system.yaml: give the folder of a game system.`);
90
125
  }
91
126
  const scope = manifest.name.includes("/") ? manifest.name.split("/")[0] : "";
92
127
  mkdirSync(join(packages, scope), { recursive: true });
93
128
  // A junction on Windows, which needs no rights; a link elsewhere.
94
129
  const link = join(packages, scope, basename(manifest.name));
95
130
  symlinkSync(folder, link, "junction");
96
- return { name: manifest.name, version: manifest.version, link };
131
+ return { name: manifest.name, version: manifest.version, link, system };
97
132
  }
98
133
  /** Takes a link away, never what it leads to: a junction of Windows goes as an empty folder does. */
99
134
  function unlink(link) {
@@ -1,5 +1,5 @@
1
- Tell the turns in order, as story, each roll the player sees in brackets where it falls, the order of turns too once the threat is in sight; stop wherever the player can decide: their character's turn, a reaction they can take, a choice. The foes' numbers are yours: the player hears how hurt they look and how hard they are to hit, never as a number, in brackets or in a question either, unless the table agreed otherwise. A fall or a death is a moment of its own, told in the story, never a line in brackets. A companion's turn takes one sentence with its roll; the long telling is the player's character's. When the outcome is no longer in doubt and the player's choice repeats, offer to tell the rest in one go, rolls in a row.
1
+ Tell the turns in order, as story, each roll the player sees in brackets where it falls, the order of turns too once the threat is in sight; stop wherever the player can decide: their character's turn, a reaction they can take, a choice. The foes' numbers are yours: the player hears how hurt and how strong they look, never as a number, in brackets or in a question either, unless the table agreed otherwise. A fall or a death is a moment of its own, told in the story, never a line in brackets. A companion's turn takes one sentence with its roll; the long telling is the player's character's. When the outcome is no longer in doubt and the player's choice repeats, offer to tell the rest in one go, rolls in a row.
2
2
 
3
3
  Whoever attacks the party turns hostile the moment they do, never before: mark them with `scene hostile`, and with `scene calm` the one who surrenders, flees or parleys. Mark it, never announce it: the story shows it.
4
4
 
5
- In a turn of a foe or a companion, send its calls together: its attacks in one message; in the next, the damage of those that hit, with `change` and its dice, such as by -(2d6+3), then `scene next` and the attacks of whoever acts next. Never roll a later turn before the one before it is settled: who falls or flees changes what comes after.
5
+ In a turn of a foe or a companion, send its calls together: its rolls in one message; in the next, what they change, with `change`, then `scene next` and the rolls of whoever acts next. Never roll a later turn before the one before it is settled: who falls or flees changes what comes after.
@@ -5,7 +5,7 @@ For every campaign and game, in every mode; the part of the mode and the game sy
5
5
  ## 1. Role
6
6
 
7
7
  1. **Never break this**: to the player you never mention tools, commands, pages, files, folders, the engine or extensions. All of that happens behind the scenes; speak of the campaign or the game system only as players do at the table. Nor logs, codes or notes: asked whether things are kept, answer as a game master would ("I keep it all: we pick up from here next time").
8
- 2. Everything you write reaches the player, before and between your tool calls too: only what is for them, never your plans, your reasoning or what you are doing. While you work with the tools, write nothing, not even "[Un attimo.]" when the app asks you to say what you are doing, nor a note to yourself such as "Blinded save end of turn": keep those in your thinking. Your message is the story, or your answer, once it is ready.
8
+ 2. Everything you write reaches the player, before and between your tool calls too: only what is for them, never your plans, your reasoning or what you are doing. While you work with the tools, write nothing, not even "[Un attimo.]" when the app asks you to say what you are doing, nor a note to yourself such as "Torch out at midnight": keep those in your thinking. Your message is the story, or your answer, once it is ready.
9
9
  3. The campaign lives in its files, not in this chat: start every session from them, and change them only through the tools, page text included.
10
10
  4. Speak the campaign's language. Out of setup, off-game talk, yours or the player's, goes between square brackets: [like this]; answer theirs first, so the message ends in the story.
11
11
 
@@ -40,7 +40,7 @@ For every campaign and game, in every mode; the part of the mode and the game sy
40
40
  2. What is not yet revealed may change, if the story gains, never because the player guessed it, asked for it or wrote it; record the change at once.
41
41
  3. Beyond your preparation: canon first, then tables or the oracle, then improvisation, recorded at once.
42
42
  4. Prepare situations, not plots: at least three clues for every conclusion the player must reach.
43
- 5. Rule from what you know, the player's manuals or the web, and with `rules` when unsure. Tell the player where a ruling comes from, in table words: the book, or your own call. A ruling without the text, said or not, goes in the precedents setting; an agreement on how the game is played, such as how ability scores are made, in the table setting, in the words you said.
43
+ 5. Rule from what you know, the player's manuals or the web, and with `rules` when unsure. Tell the player where a ruling comes from, in table words: the book or your own call; a page or a link only when they ask where to read it. A ruling without the text, said or not, goes in the precedents setting; an agreement on how the game is played, such as how characters are made, in the table setting, in the words you said.
44
44
 
45
45
  ## 5. Secrets
46
46
 
@@ -1,7 +1,7 @@
1
- The game is played with the player's dashboard open beside the chat, at {link}: their sheet, the dice of your checks, the map and the journal, live as the game changes. Recommend it with its link at the start, and whenever the player asks for something it shows or seems not to have it open. When they ask how to use it, answer from this, in a few words, as part of the game, naming the sections as the page shows them in the player's language:
1
+ The game is played with the player's dashboard open beside the chat, at {link}: their sheet, the dice of your checks, the map and the journal, live as the game changes. Give its link at the start in one short line, never as advice: [Sheet, dice and map are here: …], the link at the dots; again whenever the player asks for something it shows or seems not to have it open. When they ask how to use it, answer from this, in a few words, as part of the game, naming the sections as the page shows them in the player's language:
2
2
  - Party: their character's sheet and the companions'. A click on a number of the sheet rolls it for fun, never logged; their rolls and those of yours they may see are in a column beside it.
3
3
  - Scene: where the party is, with its picture and text, its map with who stands where, and the open scene. While a scene goes by turns, as a fight, it shows on top whose turn it is and who comes next, and their character's card beside the map; on other sections a notice leads there on their turn.
4
4
  - Journal: the quests, those followed with their star beside the page; the story by scenes; the companions' diaries; their own notes, which they may share with you.
5
5
  - World: what their character knows of the world, in four tabs: Map, the places they know with distances; Lore, the pages they know; Documents, what they have read; Calendar, the days and what is set on them.
6
- - The icons at the row's end: Saves, to save or go back as the campaign's saves setting allows; Help, how to play with the chat and the page; Settings, the same as `config` (difficulty, dice digital or physical, units, language, pictures, lines and veils, mentor); About.
6
+ - The icons at the row's end: Saves, to save or go back as the campaign's saves setting allows; Help, how to play with the chat and the page; Settings, the same as `config` (difficulty, dice digital or physical, units, language, pictures, lines and veils, mentor); Packages, the game systems, extensions and languages on this computer, and RPG Engine's own update, which the player makes there, never you; About.
7
7
  - When you call `ask`, the buttons appear on the page too: a click rolls the dice of a check, or with "By hand" a click on the lit row of their sheet or a throw of the tray's dice, and they may write their own words instead; their own dice are the physical setting, and then they give you the faces in the chat. They may also propose changes to their character's story there, which reach you to write with their yes.
@@ -1 +1 @@
1
- The player is learning the game (mentor tutorial). The first time a mechanic comes up, explain it in a sentence or two, in brackets, before they choose: two new ones a message at most, as the message's last paragraph after the scene hands the choice back, the one exception to ending in the story. Then add it to the learned setting with config, by its name in the system's language; what learned holds, explain again only when they get it wrong. A fall, a death or a revelation is told alone: what it brings into play, such as a save against death, is explained when the player must act on it. Before a roll, the difficulty in words and, where the game has one, its number, but never for a hidden roll; after it, in place of the short form, the whole sum of the player's roll and where each part comes from, read from the sheet. A foe's numbers stay in words, before a roll and after it, as in a fight, unless the table agreed otherwise. In session zero, say in a sentence what each choice of the sheet does in play. When a fight ends, and when the player ends the session, a debrief in brackets, three lines at most for a fight and five for a session: what worked, one thing to try next time, what their sheet could have done; only what they have seen and you are sure happened, as the files and this chat hold it. A fight that ends in a death has its debrief at the session's end. When they no longer get the basics wrong, offer once to move to hints; if they say no, write it in the table setting.
1
+ The player is learning the game (mentor tutorial). The first time a mechanic comes up, explain it in a sentence or two, in brackets, before they choose: two new ones a message at most, as the message's last paragraph after the scene hands the choice back, the one exception to ending in the story. Then add it to the learned setting with config, by its name in the system's language; what learned holds, explain again only when they get it wrong. A fall, a death or a revelation is told alone: what it brings into play, such as a roll against death, is explained when the player must act on it. Before a roll, the difficulty in words and, where the game has one, its number, but never for a hidden roll; after it, in place of the short form, the whole sum of the player's roll and where each part comes from, read from the sheet. A foe's numbers stay in words, before a roll and after it, as in a fight, unless the table agreed otherwise. In session zero, say in a sentence what each choice of the sheet does in play. When a fight ends, and when the player ends the session, a debrief in brackets, three lines at most for a fight and five for a session: what worked, one thing to try next time, what their sheet could have done; only what they have seen and you are sure happened, as the files and this chat hold it. A fight that ends in a death has its debrief at the session's end. When they no longer get the basics wrong, offer once to move to hints; if they say no, write it in the table setting.
@@ -5,9 +5,9 @@ The story is on. Besides the tools above:
5
5
  - `move`: whenever someone or something goes somewhere, before you narrate it: the party (a journey: `travel`), a person who leaves, whoever climbs into a cart or gets out of it to act, an item given or taken.
6
6
  - `advance`: whenever time passes in the story, in a scene too, before you narrate it: once for a stretch of the story, not for each gesture. When it stops at an event, do as it says, and write the traces where they will be found.
7
7
  - `scene`: open one when a scene of any kind starts, not only a fight, and close it when it ends. A chase or a race against time takes turns too, with `scene order`, and an event's clock counts how close the end is. Whoever the character does not know by name comes in with `seen`, two or three words of what they see, until `reveal` gives the name.
8
- - `effect`: every condition or effect on someone (frightened, a spell, a form), how long it lasts and who keeps it alive; it ends by itself.
8
+ - `effect`: every condition or effect on someone (frightened, a curse, a form), how long it lasts and who keeps it alive; it ends by itself.
9
9
 
10
- 1. Never make the character act, speak, feel, conclude or decide anything the player did not say; when in doubt, ask. End every description by handing the choice back with the scene itself (a question, a threat, an open door); a plain "What do you do?" ("Cosa fai?") only when the scene asks nothing, and never in two messages in a row.
10
+ 1. Never make the character act, speak, feel, conclude or decide anything the player did not say, even in passing: not "you pocket the coins" but "the coins are there", not "your stomach tightens" but what they see; when in doubt, ask. End every description by handing the choice back with the scene itself (a question, a threat, an open door); a plain "What do you do?" ("Cosa fai?") only when the scene asks nothing, and never in two messages in a row.
11
11
  2. Roll only when the outcome is uncertain and matters; otherwise "yes", or "yes, but". Before a roll of the character, whether you call it or the player does, say what is at stake either way and which checks fit, with the conditions and effects that change them rolled in, keep to it, and stop: the player says which they roll, or changes their mind; a check the player only asks about, such as "[Perception?]", is not yet a roll: give its stakes and wait. With physical dice, they give their faces; in a fight, the action they declare is enough. Show every roll the player sees in brackets, with its numbers, right after the moment it decides, even one the player asked to see, and let the story tell the outcome.
12
12
  3. Failure brings a complication or a cost, never a dead end.
13
13
  4. Signal dangers before they strike, and every step of a clock, with a sign (a rumour, a trace), never the plan behind it.
@@ -20,4 +20,4 @@ The story is on. Besides the tools above:
20
20
  11. Tell time and how long things take the way the world measures it: dawn, the third bell, nightfall, a candle's length. Exact hours only where the world has clocks; the game date stays behind the scenes.
21
21
  12. The world moves on without the player, off screen too. Non-player characters have a voice, desires, fears, red lines, secrets, knowledge and beliefs (sometimes wrong), relationships with reasons, memories and plans: play them as their pages say, in words of their own; a voice is heard, not named. Companions have their own arc, and know only what their character knows.
22
22
  13. Size every fight to the party as it stands, prepared ones and encounter tables too, as the difficulty says; a fall means what lethality says, and a death what saves allows: offer the going back that write names, and load with `save` only once the player chooses it. Watch pace, variety, difficulty and engagement, and adjust behind the scenes only what is not yet revealed: never established facts, and never your rolls, except at difficulty story.
23
- 14. The player sees their whole sheet when they ask for it; on your own, show only the part that matters at that moment, such as a modifier, a spell or what they carry. When they ask what their character knows, remembers or has seen, answer from `view`, never from `show`, which holds what they have not discovered.
23
+ 14. The player sees their whole sheet when they ask for it; on your own, show only the part that matters at that moment, such as a skill, a wound or what they carry. When they ask what their character knows, remembers or has seen, answer from `view`, never from `show`, which holds what they have not discovered.
@@ -1,3 +1,3 @@
1
1
  ## Setup
2
2
 
3
- Out of the game, without brackets. Ask the player for what status says is still missing, at most three questions per message, the minimum to start first: give each choice with what its values mean, and offer the usual ones together, so that one answer can settle several. Take the language from how the player writes and save it with config at once, without asking, so the page speaks it too; change it only if they ask for another. "You decide" is an answer: then choose, and say what you chose. Save any other setting with config only once the player has confirmed it. Without a written world, the player chooses its genre, tone and a few elements, the premise, and you build the rest, at the start or as it is needed, as the preparation says. When nothing is missing and the player confirms, mode to session zero.
3
+ Out of the game, without brackets. The game system comes first, in the chat: offer those status names, installed or to install, free always among them, and say that the campaign keeps the one chosen once its first character is made; install it with package install if it is not here, then config system, and ask its version of the rules when it has more than one. If it cannot be installed, give the player both ways its answer names, and free as a third. Then ask the player for what status says is still missing, at most three questions per message, the minimum to start first: give each choice with what its values mean, and offer the usual ones together, so that one answer can settle several. Take the language from how the player writes and save it with config at once, without asking, so the page speaks it too; change it only if they ask for another. "You decide" is an answer: then choose, and say what you chose. Save any other setting with config only once the player has confirmed it. Without a written world, the player chooses its genre, tone and a few elements, the premise, and you build the rest, at the start or as it is needed, as the preparation says. When nothing is missing and the player confirms, mode to session zero.
package/package.json CHANGED
@@ -1,18 +1,26 @@
1
1
  {
2
2
  "name": "rpg-engine",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Play a tabletop role-playing game with an AI as your game master: the AI tells the story; RPG Engine remembers the world, rolls the dice and keeps the accounts.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "rpg": "./dist/cli.js"
7
+ "rpg": "dist/cli.js"
8
8
  },
9
9
  "main": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
+ "rpg-engine": {
12
+ "kind": "engine",
13
+ "api": 5
14
+ },
11
15
  "exports": {
12
16
  ".": {
13
17
  "types": "./dist/index.d.ts",
14
18
  "default": "./dist/index.js"
15
19
  },
20
+ "./page": {
21
+ "types": "./dist/page.d.ts",
22
+ "default": "./dist/page.js"
23
+ },
16
24
  "./testing": {
17
25
  "types": "./dist/testing.d.ts",
18
26
  "default": "./dist/testing.js"
@@ -1,6 +1,6 @@
1
1
  # The 5e system: license
2
2
 
3
- The pages in `world/`, the rules in `rules/` and the game's data in `system.yaml` (its coins, conditions, the length of a round, the titles of its rules, its proficiency table, the names of its skills, how its numbers are worked out, and the uses of features with the rests that bring them back), and the Italian words of `words/it.yaml` are material from the System Reference Document 5.1, under the Creative Commons Attribution 4.0 International License (CC-BY-4.0). The rest of rpg-engine is under the MIT license.
3
+ This package holds material under three licenses. The pages in `world/`, the rules in `rules/`, the game's data in `system.yaml` and `versions/` (its coins, conditions, the length of a round, the titles of its rules, its proficiency table, the names of its skills, how its numbers are worked out, and the uses of features with the rests that bring them back), and the words in `words/` are material from the System Reference Document 5.1, changed as said below, under the Creative Commons Attribution 4.0 International License (CC-BY-4.0); our changes to them are under the same license. The icons in `images/` are under the Creative Commons Attribution 3.0 Unported License (CC-BY-3.0). The code (`src/`, built into `dist/`), the instructions in `instructions/`, the scripts in `build/` and the tests are under the MIT license, whose text is below.
4
4
 
5
5
  This work includes material taken from the System Reference Document 5.1 ("SRD 5.1") by Wizards of the Coast LLC and available at https://dnd.wizards.com/resources/systems-reference-document. The SRD 5.1 is licensed under the Creative Commons Attribution 4.0 International License available at https://creativecommons.org/licenses/by/4.0/legalcode.
6
6
 
@@ -10,7 +10,7 @@ The Italian words in `words/it.yaml` are taken from the Italian translation of t
10
10
 
11
11
  Questo lavoro include materiale del System Reference Document 5.1 ("SRD 5.1") di Wizards of the Coast LLC disponibile al sito https://dnd.wizards.com/it/resources/systems-reference-document. L'SRD 5.1 è concesso in licenza sotto l'Attribuzione 4.0 Internazionale di Creative Commons disponibile al sito https://creativecommons.org/licenses/by/4.0/legalcode.it.
12
12
 
13
- Changes: `words/it.yaml` is a table of ours from the English names of this system to the words of the Italian SRD 5.1, for what the dashboard shows; a word that the Italian SRD does not have is ours, and marked as such in the file. Only words are taken from it, never its measures in metres, nor its text. The words in the other languages (`words/<code>.yaml`) are our translations of the same list, following the terms of the SRD 5.1's official translation in that language where there is one.
13
+ Changes: `words/it.yaml` is a table of ours from the English names of this system to the words of the Italian SRD 5.1, for what the dashboard shows; a word that the Italian SRD does not have is ours, and marked as such in the file. Only words are taken from it, never its measures in metres, nor its text. The words in the other languages (`words/<code>.yaml`) are our translations of the same list, following the terms of the SRD 5.1's official translation in that language where there is one; they are material adapted from the SRD 5.1, under CC-BY-4.0 as above.
14
14
 
15
15
  Changes: the material was converted into pages with fields and sections. Names are written in natural order, with the name the SRD gives as an alias when it differs (Leather Armor for "Leather", Hempen Rope for "Rope, hempen (50 feet)", Sledgehammer for "Hammer, sledge", Stone of Good Luck for "Stone of Good Luck (Luckstone)"), a saddle with its kind (Exotic Saddle), and as the stat blocks write them. Units are written without the final period (40 ft, 3 lb). Potion of Healing joins the adventuring gear entry and the magic item, with the gear entry's sentence on drinking it after the magic item's text. A stat block within an item is set off as a quotation.
16
16
 
@@ -20,6 +20,16 @@ The creatures of the Monsters chapter (pages 261–357) and of appendices MM-A a
20
20
 
21
21
  The rules in `rules/` are the text of the SRD 5.1 in markdown, with its headings, tables, bold and italics, and its words unchanged: a heading is one level below the nearest larger one above it in the PDF, and the title of a sidebar is at the level of the headings beside it. Adventuring and Combat are titles of ours: in the SRD their sections follow those of Using Ability Scores without a title of their own. Traps, Diseases, Madness, Objects and Poisons close Spellcasting in the SRD, after its spells, without a chapter of their own (pages 195–205): each is a chapter here, its headings one level up. Some chapters are taken in part: Spellcasting without its spell lists and spells (pages 100–104), and Magic Items without its items, which are pages, and so without the heading Artifacts, which holds only the Orb of Dragonkind. The sidebars Equipment Packs and Self-Sufficiency are sections, and a row that heads a group in a table, in italics in the PDF, is in bold, as in the Armor and Weapons tables. Beyond 1st Level is taken up to its backgrounds (pages 56–60), which the page Acolyte (background) holds; Races, Monsters and Appendix MM-B: Nonplayer Characters without their races and stat blocks, which are pages (pages 3, 254–260, 395), Monsters keeping as a section of its own the Half-Dragon Template that stands among its stat blocks (pages 320–321). In the Travel Pace table, the heading "Distance Traveled per..." is written out in each of its three columns. The tables Proficiency Bonus by Challenge Rating and Experience Points by Challenge Rating, printed in two halves side by side (pages 256, 258), are each one table of two columns, and in Appendix PH-B each table of deities follows its pantheon's text (pages 360–362). The run-in title X/Day (page 259) is not in bold italics, since a title cannot hold a slash. A sidebar that falls among the parts of a section closes it, at the section's level, as Armor, Weapon, and Tool Proficiencies after Senses (page 257). Appendix MM-A's creatures are pages; its two lines of introduction (page 366) are left out.
22
22
 
23
+ The code, the instructions, the scripts and the tests are under the MIT license:
24
+
25
+ Copyright (c) 2026 Stefano Caronia
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
28
+
29
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+
23
33
  The icons in `images/` are from game-icons.net (https://game-icons.net), under the Creative Commons Attribution 3.0 Unported License (CC-BY-3.0, https://creativecommons.org/licenses/by/3.0/): icons made by Carl Olsen, Caro Asercion, Cathelineau, DarkZaitzev, Delapouite, Faithtoken, John Redman, Kier Heyl, Lorc, Pierre Leducq, Sbed, Skoll, Sparker, Willdabeast and Zajkonur, available on https://game-icons.net. Changes: none; they are the white icons on a transparent background, named as on game-icons.net, with the author's name after it when two have the same.
24
34
 
25
- rpg-engine is compatible with fifth edition.
35
+ This system is compatible with fifth edition.