rpg-engine 0.10.0 → 0.11.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 (119) hide show
  1. package/README.md +1 -1
  2. package/dist/adventures/placement.js +4 -0
  3. package/dist/campaign/find-campaign.js +18 -0
  4. package/dist/campaign/host-files.js +8 -6
  5. package/dist/campaign/index.d.ts +1 -1
  6. package/dist/campaign/index.js +1 -1
  7. package/dist/campaign/settings.d.ts +2 -0
  8. package/dist/campaign/settings.js +12 -5
  9. package/dist/commands/advance.js +1 -1
  10. package/dist/commands/ask.js +1 -1
  11. package/dist/commands/config.js +21 -32
  12. package/dist/commands/import/import.js +1 -1
  13. package/dist/commands/instructions.js +1 -1
  14. package/dist/commands/mode.js +1 -1
  15. package/dist/commands/mood.js +2 -3
  16. package/dist/commands/move.js +1 -1
  17. package/dist/commands/package.js +2 -2
  18. package/dist/commands/reveal.js +1 -1
  19. package/dist/commands/roll/roll.js +6 -12
  20. package/dist/commands/rules.js +0 -1
  21. package/dist/commands/scene.js +6 -8
  22. package/dist/commands/shared/adventures.js +1 -1
  23. package/dist/commands/shared/images.js +3 -1
  24. package/dist/commands/shared/knowledge.d.ts +8 -0
  25. package/dist/commands/shared/knowledge.js +41 -18
  26. package/dist/commands/shared/mode.d.ts +7 -4
  27. package/dist/commands/shared/mode.js +28 -15
  28. package/dist/commands/shared/packages/code.js +13 -2
  29. package/dist/commands/shared/page-words.d.ts +2 -0
  30. package/dist/commands/shared/page-words.js +13 -0
  31. package/dist/commands/shared/sheet.d.ts +3 -2
  32. package/dist/commands/shared/sheet.js +8 -5
  33. package/dist/commands/show.js +1 -1
  34. package/dist/commands/status.js +9 -5
  35. package/dist/commands/view/place.js +9 -3
  36. package/dist/commands/write/write.js +4 -3
  37. package/dist/core/archive-paths.js +1 -1
  38. package/dist/core/package-api.d.ts +1 -1
  39. package/dist/core/package-declarations.d.ts +3 -3
  40. package/dist/core/package-declarations.js +3 -3
  41. package/dist/core/store.d.ts +4 -0
  42. package/dist/core/store.js +20 -1
  43. package/dist/dashboard/guide/ar.md +13 -13
  44. package/dist/dashboard/guide/cs.md +11 -11
  45. package/dist/dashboard/guide/da.md +12 -12
  46. package/dist/dashboard/guide/de.md +11 -11
  47. package/dist/dashboard/guide/el.md +13 -13
  48. package/dist/dashboard/guide/en.md +2 -2
  49. package/dist/dashboard/guide/es.md +12 -12
  50. package/dist/dashboard/guide/fi.md +15 -15
  51. package/dist/dashboard/guide/fr.md +11 -11
  52. package/dist/dashboard/guide/he.md +10 -10
  53. package/dist/dashboard/guide/hi.md +15 -15
  54. package/dist/dashboard/guide/hu.md +12 -12
  55. package/dist/dashboard/guide/is.md +10 -10
  56. package/dist/dashboard/guide/it.md +3 -3
  57. package/dist/dashboard/guide/ja.md +11 -11
  58. package/dist/dashboard/guide/ko.md +14 -14
  59. package/dist/dashboard/guide/nb.md +12 -12
  60. package/dist/dashboard/guide/nl.md +13 -13
  61. package/dist/dashboard/guide/pl.md +12 -12
  62. package/dist/dashboard/guide/pt.md +9 -9
  63. package/dist/dashboard/guide/ro.md +12 -12
  64. package/dist/dashboard/guide/ru.md +11 -11
  65. package/dist/dashboard/guide/sv.md +11 -11
  66. package/dist/dashboard/guide/tr.md +14 -14
  67. package/dist/dashboard/guide/uk.md +11 -11
  68. package/dist/dashboard/guide/zh.md +13 -13
  69. package/dist/dashboard/i18n/ar.json +1 -0
  70. package/dist/dashboard/i18n/cs.json +1 -0
  71. package/dist/dashboard/i18n/da.json +1 -0
  72. package/dist/dashboard/i18n/de.json +1 -0
  73. package/dist/dashboard/i18n/el.json +1 -0
  74. package/dist/dashboard/i18n/es.json +1 -0
  75. package/dist/dashboard/i18n/fi.json +1 -0
  76. package/dist/dashboard/i18n/fr.json +1 -0
  77. package/dist/dashboard/i18n/he.json +1 -0
  78. package/dist/dashboard/i18n/hi.json +1 -0
  79. package/dist/dashboard/i18n/hu.json +1 -0
  80. package/dist/dashboard/i18n/is.json +1 -0
  81. package/dist/dashboard/i18n/it.json +1 -0
  82. package/dist/dashboard/i18n/ja.json +1 -0
  83. package/dist/dashboard/i18n/ko.json +1 -0
  84. package/dist/dashboard/i18n/nb.json +1 -0
  85. package/dist/dashboard/i18n/nl.json +1 -0
  86. package/dist/dashboard/i18n/pl.json +1 -0
  87. package/dist/dashboard/i18n/pt.json +1 -0
  88. package/dist/dashboard/i18n/ro.json +1 -0
  89. package/dist/dashboard/i18n/ru.json +1 -0
  90. package/dist/dashboard/i18n/sv.json +1 -0
  91. package/dist/dashboard/i18n/tr.json +1 -0
  92. package/dist/dashboard/i18n/uk.json +1 -0
  93. package/dist/dashboard/i18n/zh.json +1 -0
  94. package/dist/dice/index.d.ts +1 -1
  95. package/dist/dice/oracle.d.ts +5 -3
  96. package/dist/dice/oracle.js +7 -6
  97. package/dist/helpers/codex.js +1 -1
  98. package/dist/packages/npm.js +13 -2
  99. package/dist/pages/index.d.ts +1 -1
  100. package/dist/pages/index.js +1 -1
  101. package/dist/pages/markdown.d.ts +2 -0
  102. package/dist/pages/markdown.js +21 -0
  103. package/dist/pages/world.js +4 -0
  104. package/dist/server/dashboard/index.js +8 -4
  105. package/dist/server/mcp.d.ts +3 -1
  106. package/dist/server/mcp.js +20 -5
  107. package/dist/systems/game-system.d.ts +2 -0
  108. package/dist/systems/game-system.js +2 -0
  109. package/instructions/adventure.md +1 -1
  110. package/instructions/combat.md +1 -1
  111. package/instructions/core.md +2 -2
  112. package/instructions/import.md +1 -0
  113. package/instructions/session-zero.md +1 -1
  114. package/instructions/session.md +1 -1
  115. package/instructions/setup.md +1 -1
  116. package/package.json +2 -2
  117. package/systems/free/instructions/outcomes-rolled.md +1 -1
  118. package/systems/free/instructions/outcomes-tossed.md +1 -1
  119. package/systems/free/instructions/play.md +1 -2
@@ -18,12 +18,15 @@ export declare function campaignMode(root: string, world: World): Mode;
18
18
  /** A mode written by hand in state.yaml that is no mode: it counts as none (MOD-1), and validate says how to fix it. */
19
19
  export declare function modeProblems(root: string): Problem[];
20
20
  /** The first checklist the campaign must complete before entering `mode`: the setup's, then session zero's; undefined when nothing stops it (MOD-2). */
21
- export declare function blockingMode(mode: Mode, root: string, context: Context, world: World): Blocked | undefined;
21
+ export declare function blockingMode(mode: Mode, root: string, context: Context, world: World, brief?: boolean): Blocked | undefined;
22
22
  /** "still to agree with the player: lethality (…); set each with config", or what session zero still has to make: what a checklist lacks, as outputs say it. */
23
23
  export declare function missingText(blocked: Blocked): string;
24
- /** What the campaign still needs, as init, config and status say it: before play, the checklist and the call that moves on; in play, the settings still missing (MOD-7). */
25
- export declare function campaignNote(root: string, context: Context): string;
24
+ /**
25
+ * What the campaign still needs, as init, config and status say it: before play, the checklist and the call that moves on; in play, the settings still missing (MOD-7).
26
+ * Brief, as config says it, the setup's settings by their values alone: status gives what they mean (T-168).
27
+ */
28
+ export declare function campaignNote(root: string, context: Context, brief?: boolean): string;
26
29
  /** Before play, what the next mode still needs and the call that enters it once the player confirms (MOD-7); undefined in play. */
27
- export declare function checklistLine(mode: Mode, root: string, context: Context, world: World): string | undefined;
30
+ export declare function checklistLine(mode: Mode, root: string, context: Context, world: World, brief?: boolean): string | undefined;
28
31
  /** The part of the instructions of a mode, the core's with the system's (MOD-5): the file setup, session-zero or play. */
29
32
  export declare function modePart(mode: Mode, system: GameSystem | undefined): string | undefined;
@@ -16,12 +16,12 @@ const settingLabels = {
16
16
  language: "language (a code, such as it)",
17
17
  mentor: "mentor (ask how well the player knows the game: never played, tutorial; a little, hints; well, off)",
18
18
  premise: "premise (the genre, the tone, a few elements of the world and what the player enjoys most in a game, such as fights, mysteries, talk or exploring, in the player's words)",
19
- preparation: `preparation (${preparations.join(", ")})`,
20
- difficulty: `difficulty (${difficulties.join(", ")})`,
21
- lethality: `lethality (${lethalities.join(", ")})`,
22
- saves: `saves (${saveModes.join(", ")})`,
23
- rigor: `rigor (${rigors.join(", ")})`,
24
- dice: `dice (${diceWays.join(", ")})`,
19
+ preparation: "preparation (on the fly: the world made just before it is needed; all at the start)",
20
+ difficulty: `difficulty (how hard the world plays: ${difficulties.join(", ")})`,
21
+ lethality: "lethality (what a fall means: narrative, the character never dies; epic, only when it matters; dice, the dice decide)",
22
+ saves: "saves (when the game may go back: permadeath, never but to the start; checkpoint, to the last end of a scene once the player character dies; free, to any save)",
23
+ rigor: "rigor (how closely travel, fatigue, food and the like follow the rules: smooth, glossed over; rules, as written; simulation, beyond them)",
24
+ dice: "dice (who rolls the player character's dice: digital, rpg; physical, the player, who tells you the values)",
25
25
  "master-rolls": `master-rolls (your rolls for foes and NPCs: ${masterRollWays.join(", ")}; suggest behind the screen)`,
26
26
  units: `units (${unitSystems.join(", ")})`,
27
27
  companions: `companions (${companionWays.join(", ")})`,
@@ -29,6 +29,15 @@ const settingLabels = {
29
29
  lines: 'lines ("none" is an answer)',
30
30
  veils: 'veils ("none" is an answer)',
31
31
  };
32
+ // The same settings by their values alone, as config's results give them in the setup: status gives their meanings (T-168).
33
+ const valueLabels = {
34
+ preparation: `preparation (${preparations.join(", ")})`,
35
+ difficulty: `difficulty (${difficulties.join(", ")})`,
36
+ lethality: `lethality (${lethalities.join(", ")})`,
37
+ saves: `saves (${saveModes.join(", ")})`,
38
+ rigor: `rigor (${rigors.join(", ")})`,
39
+ dice: `dice (${diceWays.join(", ")})`,
40
+ };
32
41
  /**
33
42
  * The mode the campaign is in: the one state.yaml keeps; for a campaign made before modes, or one whose mode is written wrongly, play once it has had a scene,
34
43
  * session zero once it has a player character, setup before (MOD-1).
@@ -54,11 +63,11 @@ export function modeProblems(root) {
54
63
  return [{ path: "state.yaml", message: `The mode in state.yaml, "${String(written)}", is not a mode: ${modes.join(", ")}.`, fix: "call mode with the one the campaign is in" }];
55
64
  }
56
65
  /** The first checklist the campaign must complete before entering `mode`: the setup's, then session zero's; undefined when nothing stops it (MOD-2). */
57
- export function blockingMode(mode, root, context, world) {
66
+ export function blockingMode(mode, root, context, world, brief = false) {
58
67
  if (mode === "setup") {
59
68
  return undefined;
60
69
  }
61
- const setup = setupMissing(root, context, world);
70
+ const setup = setupMissing(root, context, world, brief);
62
71
  if (setup.length > 0) {
63
72
  return { mode: "setup", missing: setup };
64
73
  }
@@ -71,19 +80,22 @@ export function missingText(blocked) {
71
80
  ? `still to agree with the player: ${blocked.missing.join(", ")}; set each with config`
72
81
  : `still to make with the player: ${blocked.missing.join("; ")}`;
73
82
  }
74
- /** What the campaign still needs, as init, config and status say it: before play, the checklist and the call that moves on; in play, the settings still missing (MOD-7). */
75
- export function campaignNote(root, context) {
83
+ /**
84
+ * What the campaign still needs, as init, config and status say it: before play, the checklist and the call that moves on; in play, the settings still missing (MOD-7).
85
+ * Brief, as config says it, the setup's settings by their values alone: status gives what they mean (T-168).
86
+ */
87
+ export function campaignNote(root, context, brief = false) {
76
88
  const world = campaignWorld(root, context);
77
- return checklistLine(campaignMode(root, world), root, context, world)
89
+ return checklistLine(campaignMode(root, world), root, context, world, brief)
78
90
  ?? missingSettingsNote(missingWithSystems(root, missingSettings(readSettings(root)), context).map((name) => offeredLabel(root, context, name) ?? name));
79
91
  }
80
92
  /** Before play, what the next mode still needs and the call that enters it once the player confirms (MOD-7); undefined in play. */
81
- export function checklistLine(mode, root, context, world) {
93
+ export function checklistLine(mode, root, context, world, brief = false) {
82
94
  if (mode === "play") {
83
95
  return undefined;
84
96
  }
85
97
  const next = mode === "setup" ? "session zero" : "play";
86
- const blocked = blockingMode(next, root, context, world);
98
+ const blocked = blockingMode(next, root, context, world, brief);
87
99
  const missing = blocked === undefined ? "nothing is missing" : missingText(blocked);
88
100
  const settings = readSettings(root);
89
101
  const unnamed = mode === "setup" && settings.premise !== undefined && comparableText(settings.name) === comparableText(basename(root));
@@ -113,9 +125,10 @@ function writtenMode(root) {
113
125
  }
114
126
  }
115
127
  /** What the setup still has to agree with the player, each setting with the values it takes, the system's own too (MOD-3). */
116
- function setupMissing(root, context, world) {
128
+ function setupMissing(root, context, world, brief) {
117
129
  const unanswered = unansweredSettings(readSettings(root), world.pages.length > 0);
118
- return missingWithSystems(root, unanswered, context).map((name) => offeredLabel(root, context, name) ?? settingLabels[name] ?? name);
130
+ const label = (name) => (brief ? valueLabels[name] : undefined) ?? settingLabels[name];
131
+ return missingWithSystems(root, unanswered, context).map((name) => offeredLabel(root, context, name) ?? label(name) ?? name);
119
132
  }
120
133
  /** What session zero still has to make (MOD-4): a living player character, the companions the setup said are made in it, and the sheets they keep, whole. */
121
134
  function sessionZeroMissing(root, context, world) {
@@ -34,7 +34,7 @@ import { effectiveFields, effectsOf } from "../effect-layer.js";
34
34
  import { checkEffectsReadable, saveEffects } from "../effects.js";
35
35
  import { behindTheScreen, sealHiddenRoll } from "../master-rolls.js";
36
36
  import { keepingConditionNote } from "../reminders.js";
37
- import { readOpenScene } from "../scene.js";
37
+ import { copyName, copyPage, readOpenScene } from "../scene.js";
38
38
  import { calendarDayOf, newDatedLogEntry, presentDate } from "../time.js";
39
39
  import { formulaValue } from "../worked-out.js";
40
40
  import { campaignSystem, campaignSystemWords, campaignWorld } from "../world.js";
@@ -316,7 +316,8 @@ export function gameViewOf(root, context, code) {
316
316
  },
317
317
  page: (name) => {
318
318
  const world = campaignWorld(root, context);
319
- const found = pagesWithNameOrAlias(world, name);
319
+ const copy = sceneCopyOf(world, readOpenScene(root).scene, name);
320
+ const found = copy === undefined ? pagesWithNameOrAlias(world, name) : [copy];
320
321
  return found.length === 1 ? gamePage(world, found[0], campaignSystemWords(root, context)) : undefined;
321
322
  },
322
323
  scene: () => {
@@ -603,6 +604,16 @@ function gamePage(world, page, words) {
603
604
  },
604
605
  };
605
606
  }
607
+ /** The copy in the open scene a name gives, as a page that derives from its creature (INH-14); undefined for none, and for a copy a page shares its name with. */
608
+ function sceneCopyOf(world, scene, name) {
609
+ try {
610
+ const copy = copyName(world, scene, name);
611
+ return scene === undefined || copy === undefined ? undefined : copyPage(copy, scene.copies[copy]);
612
+ }
613
+ catch {
614
+ return undefined;
615
+ }
616
+ }
606
617
  /** A field's value as the API gives it: a number, text, or a list as text; undefined for anything else, as a map. */
607
618
  function plainValue(value) {
608
619
  if (typeof value === "number" || typeof value === "string") {
@@ -37,6 +37,8 @@ export interface ChatBatch {
37
37
  }
38
38
  /** Whether the built page in `page` ships a language: its own file, its base language's (pt-BR, pt), or English. */
39
39
  export declare function shipsLanguage(page: string, language: string): boolean;
40
+ /** A phrase of the page in a language: a language package's, then the page's own file, by its code or its base language, then this computer's; English when none has it. */
41
+ export declare function pagePhrase(context: Context, language: string | undefined, phrase: string): string;
40
42
  /** The next batch the master translates in the chat, the page's phrases first; undefined once the language lacks none. */
41
43
  export declare function chatBatch(home: string, page: string, language: string, system: WordsSystem | undefined): ChatBatch | undefined;
42
44
  /** Keeps what the master translated in the chat, by id, as the background work keeps its own; returns how many it kept, and the ids dropped for a lost {name}. */
@@ -77,6 +77,19 @@ export function shipsLanguage(page, language) {
77
77
  const base = language.toLowerCase().split("-")[0];
78
78
  return base === "en" || [language.toLowerCase(), base, base === "no" ? "nb" : ""].some((code) => code !== "" && existsSync(join(page, "i18n", `${code}.json`)));
79
79
  }
80
+ /** A phrase of the page in a language: a language package's, then the page's own file, by its code or its base language, then this computer's; English when none has it. */
81
+ export function pagePhrase(context, language, phrase) {
82
+ if (language === undefined || context.pageFolder === undefined) {
83
+ return phrase;
84
+ }
85
+ const page = context.pageFolder;
86
+ const code = language.toLowerCase();
87
+ const base = code.split("-")[0];
88
+ const pack = languagePackFor(context.extensionFolders ?? [], language);
89
+ const shipped = [code, base, base === "no" ? "nb" : ""].filter((candidate) => candidate !== "").map((candidate) => readJson(join(page, "i18n", `${candidate}.json`)));
90
+ const own = context.home === undefined ? {} : readJson(join(context.home, "i18n", `${language}.json`));
91
+ return [pack === undefined ? {} : packPhrases(pack), ...shipped, own].map((phrases) => phrases[phrase]).find((said) => typeof said === "string" && said !== "") ?? phrase;
92
+ }
80
93
  /** The next batch the master translates in the chat, the page's phrases first; undefined once the language lacks none. */
81
94
  export function chatBatch(home, page, language, system) {
82
95
  const pagePart = missingPhrases(home, page, language);
@@ -1,3 +1,4 @@
1
+ import type { Context } from "../../core/context.ts";
1
2
  import type { Problem } from "../../core/problem.ts";
2
3
  import { type Counter } from "../../counters/index.ts";
3
4
  import { type Page, type World } from "../../pages/index.ts";
@@ -20,9 +21,9 @@ export declare function sheetSummary(system: GameSystem): SheetSummary | undefin
20
21
  export declare function missingSheetFields(system: GameSystem | undefined, world: World, page: Page): string[];
21
22
  /**
22
23
  * What write says once when a character joins the party (DAT-2): the fields its sheet still lacks, then the system's notes on the groups of the sheet, such as
23
- * that the personality is the player's (D-206).
24
+ * that the personality is the player's (D-206); the notes once in a chat, the first character's to join (T-64).
24
25
  */
25
- export declare function joiningNotes(system: GameSystem | undefined, world: World, page: Page): string[];
26
+ export declare function joiningNotes(system: GameSystem | undefined, world: World, page: Page, context: Context): string[];
26
27
  /** A value of a character's sheet as data, which the dashboard draws (D-272), with the text the chat gives it. */
27
28
  export interface SheetValue {
28
29
  field: string;
@@ -1,4 +1,3 @@
1
- // The character sheet of the game system (D-204, D-207, DAT-2): its groups as show gives them, the fields a character still lacks, and the names a list takes (SYS-8).
2
1
  import { listItemNames, numberOf } from "../../core/formula.js";
3
2
  import { comparableText, valueNamed } from "../../core/text.js";
4
3
  import { readCounter } from "../../counters/index.js";
@@ -6,6 +5,7 @@ import { baseChain, carriedWeight, containerFieldOf, declaredKind, entryKind, en
6
5
  import { fieldName } from "../../progression/index.js";
7
6
  import { effectiveFields } from "./effect-layer.js";
8
7
  import { experienceOf, experienceText, levelNeed } from "./experience.js";
8
+ import { firstInChat } from "./parts.js";
9
9
  import { givenItems, progressionOf } from "./progression.js";
10
10
  import { carriedIn, counterLimits, formulaValue, hasSheet, isUse, itemLines, itemList, signedText, workedFields, workedLine, workedMaximum, workedParts } from "./worked-out.js";
11
11
  /** The sheet of the game system as status gives it before there is a player character (DAT-2); undefined when the system has none. */
@@ -46,15 +46,16 @@ export function missingSheetFields(system, world, page) {
46
46
  }
47
47
  /**
48
48
  * What write says once when a character joins the party (DAT-2): the fields its sheet still lacks, then the system's notes on the groups of the sheet, such as
49
- * that the personality is the player's (D-206).
49
+ * that the personality is the player's (D-206); the notes once in a chat, the first character's to join (T-64).
50
50
  */
51
- export function joiningNotes(system, world, page) {
51
+ export function joiningNotes(system, world, page, context) {
52
52
  if (system === undefined || !hasSheet(world, page)) {
53
53
  return [];
54
54
  }
55
55
  const missing = missingSheetFields(system, world, page);
56
56
  const lacks = missing.length === 0 ? [] : [`${page.name}'s sheet of the system ${system.name} still lacks, by these names: ${missing.join(", ")}.`];
57
- return [...lacks, ...system.sheet.flatMap((group) => (group.note === undefined ? [] : [`${group.name}: ${group.note}`]))];
57
+ const notes = context.told === undefined || firstInChat(context, "sheet-notes") ? system.sheet.flatMap((group) => (group.note === undefined ? [] : [`${group.name}: ${group.note}`])) : [];
58
+ return [...lacks, ...notes];
58
59
  }
59
60
  /**
60
61
  * The sheet of a player character or a companion as data, a group for each that has a value, as the character reads it, effects and formulas included (DAT-2).
@@ -264,7 +265,9 @@ export function checkListValues(system, lists, onSheet = false) {
264
265
  throw new Error(`${field} is a list in the system ${system.name}: give it as one, such as ${field}=[${example}]. Nothing changed.`);
265
266
  }
266
267
  if (system !== undefined && isOpenList(system, field) && isCommaText(value)) {
267
- throw new Error(`${field} is a list in the system ${system.name}: write its names apart, as ${field}=[${String(value)}]. Nothing changed.`);
268
+ // A name with a link quoted, so that it never reads as a list inside the list (T-167).
269
+ const names = String(value).split(",").map((name) => (name.includes("[[") ? JSON.stringify(name.trim()) : name.trim())).join(", ");
270
+ throw new Error(`${field} is a list in the system ${system.name}: write its names apart, as ${field}=[${names}]. Nothing changed.`);
268
271
  }
269
272
  const wrong = wrongValues(system, field, value, onSheet);
270
273
  const links = allowedValues(system, field, onSheet) === undefined ? [] : (Array.isArray(value) ? value : [value]).filter((item) => /\[\[/.test(String(item)));
@@ -19,7 +19,7 @@ const listedItems = 8;
19
19
  export const show = defineCommand({
20
20
  name: "show",
21
21
  description: "Show a page of the world, or one of its sections or secrets, with what it inherits from the pages it derives from. "
22
- + "It also says where the thing is and which pages link to it. Use it before describing anything that already exists, so that what you say matches what is written. "
22
+ + "It also says where the thing is and which pages link to it. "
23
23
  + "The player character and the companions show their sheet in groups, such as Abilities; Page#Group shows one group with how each number is made. "
24
24
  + 'Example: page "Old lighthouse#Cellar".',
25
25
  group: "game",
@@ -196,8 +196,7 @@ export const status = defineCommand({
196
196
  const companion = (member) => `${member.name}${member.with === undefined ? whereabouts(member) : `, with ${member.with}`}${memberCounters(member)}`;
197
197
  const state = [
198
198
  result.offerDashboard && result.dashboard !== undefined
199
- ? `Offer the player their dashboard in your first answer, with its link: ${result.dashboard}. Their sheet, their settings and the dice of the checks you ask `
200
- + "follow the game there, live; the link stays the same, and a page they keep open comes back by itself next time."
199
+ ? `Offer the player their dashboard's link in your first answer: ${result.dashboard}.`
201
200
  : "",
202
201
  result.campaign.join(" · "),
203
202
  ...result.meanings,
@@ -214,7 +213,7 @@ export const status = defineCommand({
214
213
  ...(result.players.length === 0 ? [`No player character yet.${sheetNote(result.sheet)}`] : result.players.map((member) => `PC: ${member.name}${whereabouts(member)}${memberCounters(member)}`)),
215
214
  ...result.around.map((one) => `Around ${one.who.join(" and ")}: ${one.text}`),
216
215
  namesLine("Companions", result.companions.map(companion), "find text companion, type character", "; "),
217
- result.dashboard === undefined || result.offerDashboard ? "" : `Dashboard: ${result.dashboard}, the player's sheet, their settings and the dice of the checks you ask, live.`,
216
+ result.dashboard === undefined || result.offerDashboard ? "" : `Dashboard: ${result.dashboard}.`,
218
217
  result.pictures ?? "",
219
218
  result.importing,
220
219
  result.translation ?? "",
@@ -232,10 +231,15 @@ export const status = defineCommand({
232
231
  result.clocks.length === 0 ? "" : `Clocks: ${result.clocks.join(" · ")}`,
233
232
  result.halfLoaded === undefined ? "" : `The load of save ${result.halfLoaded} stopped halfway: call save load to finish it, before anything else.`,
234
233
  ...result.contradictions,
235
- result.opening ? "Write nothing to the player until your message is ready: your first words are the opening itself." : "",
236
234
  result.problems === 0 ? "" : `${result.problems} ${result.problems === 1 ? "problem" : "problems"} in the campaign: validate lists them, with how to fix each.`,
237
235
  ];
238
- return [state.filter((line) => line !== "").join("\n"), ...result.sessionParts].join("\n\n");
236
+ // The opening's line last, after the session's parts, where the master reads it just before writing (T-64).
237
+ const opening = result.opening ? "Write nothing to the player until your message is ready: your first words are the opening itself." : "";
238
+ // At a session's opening with no planned event on a clock, the threats to set in motion, read before the opening's line (T-168).
239
+ const threats = result.sessionParts.length > 0 && result.clocks.length === 0
240
+ ? "No threat is in motion yet: before you open, write two or three, each a planned event with a clock and who makes it happen (by), the adventure's foe among them."
241
+ : "";
242
+ return [state.filter((line) => line !== "").join("\n"), ...result.sessionParts, threats, opening].filter((block) => block !== "").join("\n\n");
239
243
  },
240
244
  });
241
245
  /**
@@ -4,13 +4,13 @@ import { comparableText } from "../../core/text.js";
4
4
  import { readCounter } from "../../counters/index.js";
5
5
  import { reachable, squareName, squaresApart, withoutMapBlock } from "../../grid/index.js";
6
6
  import { hiddenImageName } from "../../images/index.js";
7
- import { environmentAt, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, placesAround } from "../../pages/index.js";
7
+ import { environmentAt, isPlayerCharacter, links, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, placesAround } from "../../pages/index.js";
8
8
  import { effectsOf } from "../shared/effect-layer.js";
9
9
  import { conditionMark, effectParts, keptEffects, systemNamed } from "../shared/effects.js";
10
10
  import { isTurnOf, movedThisTurn, sideOf, walkingSpeed } from "../shared/grid-moves.js";
11
11
  import { placeGrid, placeLook, standing } from "../shared/grids.js";
12
12
  import { imageFile, ownImage, shownImage } from "../shared/images.js";
13
- import { knownSecretsApart, knownText, knowsPage } from "../shared/knowledge.js";
13
+ import { inKnownWords, knownSecretsApart, knownText, knowsPage, readsLink } from "../shared/knowledge.js";
14
14
  import { pageCounters } from "../shared/page-counters.js";
15
15
  import { measuresOf } from "../shared/roads.js";
16
16
  import { copyPage, readOpenScene } from "../shared/scene.js";
@@ -28,7 +28,8 @@ export function shownPlace(sight) {
28
28
  const known = (holder) => (knowsPage(knowledge, holder) ? holder.name : undefined);
29
29
  const placed = (holder) => (known(holder) === undefined ? {} : { place: holder.name });
30
30
  const around = [
31
- ...environmentAt(world, place).map(({ entry, place: holder }) => ({ name: entry.name, value: entry.value, ...placed(holder) })),
31
+ ...environmentAt(world, place).filter(({ entry }) => !pointsToUnread(sight, entry.value))
32
+ .map(({ entry, place: holder }) => ({ name: entry.name, value: inKnownWords(world, knowledge, entry.value), ...placed(holder) })),
32
33
  ...placesAround(world, place).flatMap((holder) => effectsOf(holder).map((effect) => ({ effect: effect.name, ...(effect.end === undefined ? {} : { end: effect.end }), ...placed(holder) }))),
33
34
  ];
34
35
  const present = world.pages.filter((page) => page.type === "character" && page.fields.status !== "dead" && locate(world, page).chain[0] === place
@@ -343,6 +344,11 @@ function partyRole(sight, page) {
343
344
  function partyFirst(sight) {
344
345
  return [...sight.party.filter((page) => page === sight.knowledge.pc), ...sight.party.filter((page) => page !== sight.knowledge.pc)];
345
346
  }
347
+ /** Whether an entry of the environment is only a link to a section or secret the character cannot read, as the master's encounter table: it tells the player nothing. */
348
+ function pointsToUnread(sight, value) {
349
+ const pointed = links(value);
350
+ return /^\[\[[^\]]*\]\]$/.test(value.trim()) && pointed.length === 1 && pointed[0].section !== undefined && !readsLink(sight.world, sight.knowledge, pointed[0]);
351
+ }
346
352
  /** Someone the character knows, with their picture and their role. */
347
353
  function person(sight, page) {
348
354
  const role = partyRole(sight, page);
@@ -7,7 +7,7 @@ import { comparableText, sameName, valueNamed, withArticle } from "../../core/te
7
7
  import { formatCounter, readCounter } from "../../counters/index.js";
8
8
  import { readEffects } from "../../effects/index.js";
9
9
  import { formatAmount, namesCoins, readAmount } from "../../money/index.js";
10
- import { alwaysInList, baseFieldOf, baseValue, changedEnvironment, changedFields, checkFieldChange, concernsPlayer, containerFieldOf, countedText as countInText, declaredKind, derivedPages, environmentAt, equippedNotes, findPage, followersOf, formatEnvironmentEntry, goodsFieldProblems, hidingMessage, holdsField, inheritedFields, introductionFollowersOf, introductionText, isCounterField, isDeclaredUncounted, isEmptyField, isNeverInherited, isPartyMember, isPlayerCharacter, isStandardField, keepersOf, linksIn, listFieldNames, misspelledFieldProblem, misspelledStandardField, namesakes, newBaseProblem, newPageFields, ownFieldChange, pageNamed, pagesWithName, pageTypeNames, parsePageReference, readEntry, readEnvironment, readFieldValue, readOnlyMessage, removedFieldName, sameAsBase, sectionFollowersOf, systemKnowsReason, systemLabel, systemPageNamed, textParts, textsIn, withPage, writePage, writtenFieldName, } from "../../pages/index.js";
10
+ import { alwaysInList, baseFieldOf, baseValue, changedEnvironment, changedFields, checkFieldChange, concernsPlayer, containerFieldOf, countedText as countInText, declaredKind, derivedPages, environmentAt, equippedNotes, findPage, followersOf, formatEnvironmentEntry, goodsFieldProblems, hidingMessage, holdsField, inheritedFields, introductionFollowersOf, introductionText, isCounterField, isDeclaredUncounted, isEmptyField, isNeverInherited, isPartyMember, isPlayerCharacter, isStandardField, keepersOf, linkListItems, linksIn, listFieldNames, misspelledFieldProblem, misspelledStandardField, namesakes, newBaseProblem, newPageFields, ownFieldChange, pageNamed, pagesWithName, pageTypeNames, parsePageReference, readEntry, readEnvironment, readFieldValue, readOnlyMessage, removedFieldName, sameAsBase, sectionFollowersOf, systemKnowsReason, systemLabel, systemPageNamed, textParts, textsIn, withPage, writePage, writtenFieldName, } from "../../pages/index.js";
11
11
  import { featureParts, mergedFeatures } from "../../progression/index.js";
12
12
  import { bondNotes, checkBonds } from "../shared/bonds.js";
13
13
  import { effectiveFields, effectsField } from "../shared/effect-layer.js";
@@ -154,7 +154,7 @@ export const write = defineCommand({
154
154
  const result = { page: page.name, type: page.type, path: page.path, created, changed, ...writtenNames(world, existing, fields, page), section, mode, was };
155
155
  // Said when the character joins the party, here or by being created in it; then status says it until the sheet is whole (DAT-2).
156
156
  const joined = changed && (created || existing?.fields.role !== page.fields.role);
157
- const sheet = joined ? joiningNotes(system, now, page) : [];
157
+ const sheet = joined ? joiningNotes(system, now, page, context) : [];
158
158
  const gained = changed && existing !== undefined ? progressionNotes(context, system, world, now, existing, page, Object.keys(fields.set ?? {})) : [];
159
159
  const thresholds = changed && isPartyMember(page) ? writtenThresholdNotes(root, system, world, now, existing, page, fields.set ?? {}) : [];
160
160
  // Points that reach a level the classes have not, or fall short of the level's (PRO-6); a field the settings leave out (DAT-10).
@@ -1142,7 +1142,8 @@ function listFromText(name, value) {
1142
1142
  if (typeof value !== "string") {
1143
1143
  return value;
1144
1144
  }
1145
- const writtenAsList = /^\[(?!\[).*\]$/s.test(value.trim());
1145
+ // Links separated by commas are a list, as on the command line, for a list of the game system too, such as spells (T-167).
1146
+ const writtenAsList = /^\[(?!\[).*\]$/s.test(value.trim()) || linkListItems(value) !== undefined;
1146
1147
  return writtenAsList || listFieldNames.some((field) => comparableText(field) === comparableText(name)) ? readFieldValue(value) : value;
1147
1148
  }
1148
1149
  function readAssignment(assignment) {
@@ -2,7 +2,7 @@
2
2
  // when a file comes twice, so that what was read is what is written.
3
3
  import { resolve, sep } from "node:path";
4
4
  // Names Windows keeps for its devices, whatever their extension.
5
- const reserved = /^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i;
5
+ const reserved = /^(con|prn|aux|nul|com[\d¹²³]|lpt[\d¹²³])(\..*)?$/i;
6
6
  // What a file name on Windows cannot hold.
7
7
  const unwritable = /[<>:"|?*\u0000-\u001f]/;
8
8
  /** Whether a name is one Windows keeps for a device, as CON or nul.txt. */
@@ -123,7 +123,7 @@ export interface GameView {
123
123
  pc: boolean;
124
124
  }[];
125
125
  } | undefined;
126
- /** A page by its name or alias (D-505); undefined when no page, or more than one, has it. */
126
+ /** A page by its name or alias (D-505), or a copy in the open scene by its name, as a foe's; undefined when no page, or more than one, has it. */
127
127
  page(name: string): GamePage | undefined;
128
128
  /** The open scene: its title, when it opened, and in a fight its round and whose turn it is (D-505); undefined when none is open. */
129
129
  scene(): {
@@ -3,11 +3,11 @@ import { type CardPage, type FigureSize } from "./package-api.ts";
3
3
  export type { CardPage, FigureSize };
4
4
  /**
5
5
  * The version of the API a package is made for, which its package.json names as rpg-engine.api: the contract its code is given and what its extension.yaml or
6
- * system.yaml may declare. It goes up with every addition a package may use, and the engine reads a range (D-515): 2 added the widgets, 3 an extension's
6
+ * system.yaml may declare. It goes up with every addition an older engine would refuse or misread, and the engine reads a range (D-515, D-549): 2 added the widgets, 3 an extension's
7
7
  * additions to the game system and asking the player, 4 the code in the dashboard's page, 5 one contract for every kind of package, 6 the fields of
8
- * knowledge of a game system (sheet-knowledge), 7 what a page carries and the pictures of the dashboard's states.
8
+ * knowledge of a game system (sheet-knowledge), 7 what a page carries and the pictures of the dashboard's states, 8 where a game system's oracle says yes.
9
9
  */
10
- export declare const packageApi = 7;
10
+ export declare const packageApi = 8;
11
11
  /**
12
12
  * Our game systems (D-513): the name a campaign gives each, which package install takes alone, its package, and what it is; the setup offers them even when
13
13
  * npm does not answer. A list of names, as our scope is, never a game's code; Ironsworn joins it once it is playable.
@@ -4,11 +4,11 @@ import { z } from "zod";
4
4
  import { cardPages } from "./package-api.js";
5
5
  /**
6
6
  * The version of the API a package is made for, which its package.json names as rpg-engine.api: the contract its code is given and what its extension.yaml or
7
- * system.yaml may declare. It goes up with every addition a package may use, and the engine reads a range (D-515): 2 added the widgets, 3 an extension's
7
+ * system.yaml may declare. It goes up with every addition an older engine would refuse or misread, and the engine reads a range (D-515, D-549): 2 added the widgets, 3 an extension's
8
8
  * additions to the game system and asking the player, 4 the code in the dashboard's page, 5 one contract for every kind of package, 6 the fields of
9
- * knowledge of a game system (sheet-knowledge), 7 what a page carries and the pictures of the dashboard's states.
9
+ * knowledge of a game system (sheet-knowledge), 7 what a page carries and the pictures of the dashboard's states, 8 where a game system's oracle says yes.
10
10
  */
11
- export const packageApi = 7;
11
+ export const packageApi = 8;
12
12
  /**
13
13
  * Our game systems (D-513): the name a campaign gives each, which package install takes alone, its package, and what it is; the setup offers them even when
14
14
  * npm does not answer. A list of names, as our scope is, never a game's code; Ironsworn joins it once it is playable.
@@ -31,6 +31,10 @@ export declare class FileStore {
31
31
  name: string;
32
32
  isFolder: boolean;
33
33
  }[];
34
+ /** Whether `path` is a link as it is now: a symbolic link or a junction, or a file with another name elsewhere, a hard link. */
35
+ isLink(path: string): boolean;
36
+ /** The links right inside `folder`, as they are now, by name, which entries leaves out; none when there is no such folder. */
37
+ links(folder: string): string[];
34
38
  /** A file's bytes as they are now, as a save holds them; undefined when there is no file. */
35
39
  bytes(path: string): Uint8Array | undefined;
36
40
  /** The text of a file as it is now, for a command about to write it: in a call, the text the call reads; a session checks the disk (D-193). */
@@ -1,7 +1,7 @@
1
1
  // The files as a command sees them (D-137, D-194): each read at most once in a call, kept as its text and as what it reads as, frozen; what the command writes
2
2
  // updates what is kept. A command runs inside its store, and the modules reach it with files(): the MCP server will keep one for a whole session.
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
- import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
4
+ import { appendFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
5
5
  import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
6
6
  import { fileOrder, filesIn } from "./files.js";
7
7
  import { frozen } from "./frozen.js";
@@ -71,6 +71,15 @@ export class FileStore {
71
71
  ? readdirSync(folder, { withFileTypes: true }).filter((entry) => entry.isFile() || entry.isDirectory()).map((entry) => ({ name: entry.name, isFolder: entry.isDirectory() }))
72
72
  : [];
73
73
  }
74
+ /** Whether `path` is a link as it is now: a symbolic link or a junction, or a file with another name elsewhere, a hard link. */
75
+ isLink(path) {
76
+ const stats = lstatSync(path, { throwIfNoEntry: false });
77
+ return stats !== undefined && (stats.isSymbolicLink() || (stats.isFile() && stats.nlink > 1));
78
+ }
79
+ /** The links right inside `folder`, as they are now, by name, which entries leaves out; none when there is no such folder. */
80
+ links(folder) {
81
+ return existsSync(folder) && statSync(folder).isDirectory() ? readdirSync(folder, { withFileTypes: true }).filter((entry) => entry.isSymbolicLink()).map((entry) => entry.name) : [];
82
+ }
74
83
  /** A file's bytes as they are now, as a save holds them; undefined when there is no file. */
75
84
  bytes(path) {
76
85
  return existsSync(path) ? new Uint8Array(readFileSync(path)) : undefined;
@@ -100,6 +109,7 @@ export class FileStore {
100
109
  }
101
110
  /** Writes a file, with the folders it needs. */
102
111
  write(path, text) {
112
+ refuseLinked(path);
103
113
  mkdirSync(dirname(path), { recursive: true });
104
114
  writeFileSync(path, text, "utf8");
105
115
  this.changed(path, { text }, true);
@@ -107,6 +117,7 @@ export class FileStore {
107
117
  }
108
118
  /** Writes a file's bytes as they are, with the folders it needs, as a save gives them back: what the store kept of it is read again. */
109
119
  writeBytes(path, bytes) {
120
+ refuseLinked(path);
110
121
  mkdirSync(dirname(path), { recursive: true });
111
122
  writeFileSync(path, bytes);
112
123
  this.changed(path, undefined, true);
@@ -114,6 +125,7 @@ export class FileStore {
114
125
  }
115
126
  /** Adds text at the end of a file, as the log grows. */
116
127
  append(path, text) {
128
+ refuseLinked(path);
117
129
  const before = this.kept.get(resolve(path));
118
130
  appendFileSync(path, text, "utf8");
119
131
  // A file never read stays to be read: what is kept of it would be only its end.
@@ -251,3 +263,10 @@ function markWritten() {
251
263
  call.wrote = true;
252
264
  }
253
265
  }
266
+ /** Throws for a file that is a link, a symbolic one or a hard link: what is written there would land in a file somewhere else. */
267
+ function refuseLinked(path) {
268
+ const stats = lstatSync(path, { throwIfNoEntry: false });
269
+ if (stats !== undefined && (stats.isSymbolicLink() || (stats.isFile() && stats.nlink > 1))) {
270
+ throw new Error(`${path} is a link to a file somewhere else, and what is written there would land in that file: replace it with a copy of its own. Nothing was written to it.`);
271
+ }
272
+ }
@@ -1,4 +1,4 @@
1
- <!-- Translated from en.md, part by part, by npm run translate: c38df721 53ff5eaa 9f1774ef 4c5cd093 019e9516 8e136927 7da791ae 423af5fa 17577253 f699a840 2731ea0e 59c1a762. Change the English, then run it again. -->
1
+ <!-- Translated from en.md, part by part, by npm run translate: c38df721 53ff5eaa 9f1774ef 4c5cd093 019e9516 8e136927 95c609b6 423af5fa 17577253 4c3ea82e 2731ea0e 59c1a762. Change the English, then run it again. -->
2
2
  # RPG Engine: الدليل الكامل
3
3
 
4
4
  يتيح لك **RPG Engine** لعب لعبة أدوار على الطاولة مع **ذكاء اصطناعي في دور مدير اللعبة**. تتحدث مع مدير اللعبة في **محادثة**. أما RPG Engine فيعمل خلف الكواليس: **يتذكر العالم**، و**يرمي النرد**، و**يمسك الحسابات**. بجانب المحادثة تُبقي صفحة مفتوحة في المتصفح، هي **لوحة التحكم**، وفيها ورقة شخصيتك والنرد والخرائط وسجلك.
@@ -214,29 +214,29 @@ rpg init "The Salt Isles"
214
214
 
215
215
  ---
216
216
 
217
- ## 5. أنظمة اللعبة والقواعد المنزلية <!-- icon: dice -->
217
+ ## 5. أنظمة اللعب والقواعد المنزلية <!-- icon: dice -->
218
218
 
219
- ### 5.1 ما هو نظام اللعبة
219
+ ### 5.1 ما هو نظام اللعب
220
220
 
221
- هو بيانات لعبة واحدة: ورقة الشخصية وأرقامها ومخلوقاتها وأغراضها وتعاويذها ونصوص قواعدها. تلعب كل حملة نظامًا واحدًا. يحسب RPG Engine ورقة الشخصية وما يُصرف وما يعود. أما طريقة عمل كل ميزة، فيقرؤها مدير اللعبة في القواعد ويقرر فيها، كما على الطاولة.
221
+ هو بيانات لعبة واحدة: ورقة الشخصية، وأرقامها، ومخلوقاتها، وعناصرها، وتعويذاتها، ونصوص قواعدها. كل حملة تلعب بنظام واحد. يحسب RPG Engine ورقة الشخصية وما يُصرف وما يعود. أما طريقة عمل أي ميزة، فيقرأها مدير اللعبة في القواعد ويقرر فيها، كما يحدث على الطاولة.
222
222
 
223
223
  ### 5.2 الإصدار الخامس
224
224
 
225
- الأعراق والفئات والفئات الفرعية، وخلفية واحدة وموهبة واحدة من SRD 5.1؛ و319 تعويذة، والأسلحة والدروع والأغراض السحرية والوحوش؛ وفصول القواعد التي يقرؤها مدير اللعبة بنصها الدقيق؛ وورقة الشخصية الكاملة محسوبة.
225
+ يضم السباقات والفئات والفئات الفرعية، وخلفية واحدة وموهبة واحدة من SRD 5.1؛ و319 تعويذة، والأسلحة والدروع والعناصر السحرية والوحوش؛ وفصول القواعد، التي يقرأها مدير اللعبة بنصها الدقيق؛ وورقة الشخصية الكاملة، محسوبة.
226
226
 
227
- هو حزمة قائمة بذاتها: يعرضها مدير اللعبة عند إعداد الحملة ويثبّتها. والحملة التي تلعبه تثبّته من تلقاء نفسها عند أول فتح لها على حاسوب لا يحتويه، ويخبرك مدير اللعبة بذلك.
227
+ هو حزمة مستقلة: يعرضها مدير اللعبة عند إعداد الحملة ويثبّتها. والحملة التي تلعب به تثبّته بنفسها أول مرة تُفتح فيها على حاسوب لا يحتوي عليه، ويخبرك مدير اللعبة بذلك.
228
228
 
229
- يمكنك أيضًا لعب محتوى لا يتضمنه SRD، من كتاب تملكه: يكتبه مدير اللعبة صفحاتٍ في حملتك، ويعامله RPG Engine كأنه من صميمه. يضم RPG Engine المحتوى المفتوح فقط، أما ما يعرفه مدير اللعبة فلا حدّ له.
229
+ يمكنك أيضًا أن تلعب محتوى لا يوجد في SRD، من كتاب تملكه: يكتبه مدير اللعبة على هيئة صفحات في حملتك، ويعامله RPG Engine كأنه من صنعه. يضم RPG Engine المحتوى المفتوح فقط؛ أما ما يعرفه مدير اللعبة فلا حدّ له.
230
230
 
231
- يمكن أن تكون كتبك مكتبتك: أخبر مدير اللعبة بمكانها، *[كتبي في D:\Books\5e.]*، أو أضف مجلدها في الحزم ‹ المكتبة، ثم وافق في النافذة التي يعرضها حاسوبك، مرة واحدة. يقرؤها RPG Engine على هذا الحاسوب؛ وتستخدم كل حملة المجلدات التي تفعّلها هناك، ويبحث فيها مدير اللعبة عندما يقرر في قاعدة ما، بعد SRD، مع ذكر الكتاب والصفحة. تُقرأ أفضل ما تكون نصًا، أو ملفات PDF يمكن تحديد نصها؛ أما ملف PDF الممسوح ضوئيًا فيُقرأ من صور صفحاته، على Windows فقط، في بضع دقائق ومع بعض الأخطاء. لا يغيّر RPG Engine كتبك أبدًا، ولا يرسل نصها إلى أي مكان أبدًا، ولا ينسخه أبدًا إلى حملة.
231
+ يمكن أن تكون كتبك مكتبتك الخاصة: أخبر مدير اللعبة بمكانها، *[كتبي في D:\Books\5e.]*، أو أضف مجلدها في الحزم › المكتبة، ووافق مرة واحدة في النافذة التي يعرضها حاسوبك. يقرأ RPG Engine هذه الكتب على هذا الحاسوب. وتستخدم كل حملة المجلدات التي تفعّلها هناك. ويبحث فيها مدير اللعبة حين يقرر في قاعدة ما، بعد SRD، ويذكر الكتاب والصفحة. تُقرأ الكتب أفضل ما تكون نصًّا، أو ملفات PDF يمكن تحديد نصها. أما ملف PDF الممسوح ضوئيًا فيُقرأ من صور صفحاته، على Windows فقط، في بضع دقائق ومع بعض الأخطاء. لا يغيّر RPG Engine كتبك أبدًا، ولا يرسل نصها إلى أي جهة، ولا ينسخه إلى أي حملة.
232
232
 
233
233
  ### 5.3 القواعد المنزلية وإضافاتك الخاصة
234
234
 
235
- اطلب من مدير اللعبة: *[قاعدة منزلية: الرقم الطبيعي 1 في الهجوم يعني أن سلاحك يسقط منك.]* يحفظها اتفاقًا للطاولة، أو يكتب صفحة أو رقمًا في ورقة الشخصية عند الحاجة. أما القواعد المكتوبة جاهزةً فيمكن وضعها ملفات نصية في مجلد `rules` الخاص بالحملة.
235
+ اطلب من مدير اللعبة: *[قاعدة منزلية: إذا ظهر 1 طبيعي في هجوم، يسقط سلاحك من يدك.]* يحفظها مدير اللعبة اتفاقًا على الطاولة، أو يكتب صفحة أو رقمًا في ورقة الشخصية إذا لزم الأمر. أما القواعد المنزلية المكتوبة مسبقًا فيمكن وضعها ملفاتٍ نصية في مجلد `rules` الخاص بالحملة.
236
236
 
237
- ### 5.4 إضافة نظام لعبة خاص بك أو استيراده
237
+ ### 5.4 إضافة نظام لعب خاص بك أو استيراده
238
238
 
239
- نظام اللعبة حزمة: يثبّت مدير اللعبة واحدة من npm أو من مجلد أو من ملف، وإن لم تكن من حزمنا فلا يثبّتها إلا بموافقتك، في نافذة على حاسوبك. وإعداد حزمة عمل مطوّر، موصوف في وثائق RPG Engine على GitHub. أما تحويل كتاب تملكه إلى نظام لعبة فليس متاحًا بعد ([قريبًا](#9-coming-later)).
239
+ نظام اللعب حزمة: يثبّتها مدير اللعبة من npm، أو من مجلد، أو من ملف. وإذا لم تكن من حزمنا فلا يثبّتها إلا بموافقتك، في نموذج يعرضه وكيلك أو في نافذة يعرضها حاسوبك. صنع حزمة كهذه عمل مطوّر، وهو موصوف في وثائق RPG Engine على GitHub. أما تحويل كتاب تملكه إلى نظام لعب فغير متاح بعد ([قريبًا](#9-coming-later)).
240
240
 
241
241
  ---
242
242
 
@@ -264,9 +264,9 @@ rpg init "The Salt Isles"
264
264
 
265
265
  ## 8. للفضوليين: مجلد الحملة <!-- icon: list -->
266
266
 
267
- لا تحتاج إلى فتحه أبدًا، وفيه أسرار حملتك. فيه `campaign.yaml` (إعداداتك)، و`state.yaml` (حالة اللعبة)، و`world/` (صفحة markdown لكل شخصية ومكان ومهمة وغيرها)، و`rules/` (قواعدك الخاصة)، و`images/`، و`log.jsonl` (كل تغيير)، و`.saves/`، و`.player/` (ملاحظاتك)، والملفات الصغيرة التي تدل وكلاء الذكاء الاصطناعي على مكان RPG Engine. تستخدم الصفحات صيغة Obsidian. وإن غيّرتَ صفحة بيدك، يعلم مدير اللعبة بذلك عند ردّه التالي.
267
+ لا تحتاج إلى فتحه أبدًا، وهو يحوي أسرار حملتك. فيه `campaign.yaml` (إعداداتك)، و`state.yaml` (حالة اللعبة الآن)، و`world/` (صفحة markdown لكل شخصية ومكان ومهمة وغيرها)، و`rules/` (قواعدك المنزلية)، و`images/`، و`log.jsonl` (كل تغيير)، و`.saves/`، و`.player/` (ملاحظاتك)، والملفات الصغيرة التي تدلّ وكلاء الذكاء الاصطناعي على مكان RPG Engine. تستخدم الصفحات صيغة Obsidian. وإذا غيّرت صفحة بيدك، يعلم مدير اللعبة بذلك عند إجابته التالية.
268
268
 
269
- يبقى RPG Engine داخل هذا المجلد: لا يقرأ اللعبة ولا يكتبها إلا فيه، ولا يمس ملفاتك الأخرى. أما مجلدات كتبك فيقرؤها فقط. وخارجه لا يحتفظ إلا بمجلدات بيانات خاصة به (ترجمات لوحة المتابعة، والنص الذي قرأه من كتبك، وCodex أو Claude Code إن سمحتَ بتثبيتهما)، وبمجلدات مؤقتة أثناء رسم صورة. وأي شيء آخر يريد وكيلك فعله على حاسوبك، يسألك عنه أولًا.
269
+ يبقى RPG Engine داخل هذا المجلد: لا يقرأ اللعبة ولا يكتبها إلا فيه، ولا يمسّ ملفاتك الأخرى. أما مجلدات كتبك فيقرؤها فقط. وخارجه لا يحتفظ إلا بمجلدات بيانات خاصة به (ترجمات لوحة المتابعة، والنص الذي قرأه من كتبك، وCodex أو Claude Code إذا سمحت له بتثبيتهما)، ومجلدات مؤقتة أثناء رسم صورة. وأي شيء آخر يريد وكيلك فعله على حاسوبك، يسألك عنه أولًا. نظام اللعب أو الامتداد شيفرة برمجية، مثل أي حزمة npm: وما لم يكن من حزمنا فإنه يعمل على حاسوبك بصلاحياتك، ولا يثبّته RPG Engine إلا بموافقتك، في نموذج يعرضه وكيلك أو في نافذة يعرضها حاسوبك. لا توافق إلا على حزم تثق بمؤلفيها.
270
270
 
271
271
  يمكن أيضًا تشغيل كل أمر يستخدمه مدير اللعبة داخل مجلد الحملة: يعرضها `rpg --help`. وكثير منها يطبع أسرار الحملة.
272
272