rpg-engine 0.4.1 → 0.6.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.
- package/README.md +1 -1
- package/dist/campaign/settings.d.ts +1 -0
- package/dist/campaign/settings.js +6 -5
- package/dist/command-line.js +12 -5
- package/dist/commands/advance.js +1 -1
- package/dist/commands/ask.d.ts +37 -2
- package/dist/commands/ask.js +106 -35
- package/dist/commands/change.js +28 -17
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/config.js +69 -21
- package/dist/commands/effect.js +42 -23
- package/dist/commands/find.js +1 -1
- package/dist/commands/game-adventures.js +2 -2
- package/dist/commands/game-catalog.d.ts +13 -0
- package/dist/commands/game-catalog.js +26 -2
- package/dist/commands/game-checks.js +23 -21
- package/dist/commands/{game-hit-dice.d.ts → game-dice-pool.d.ts} +3 -3
- package/dist/commands/{game-hit-dice.js → game-dice-pool.js} +7 -7
- package/dist/commands/game-effects.d.ts +12 -4
- package/dist/commands/game-effects.js +21 -13
- package/dist/commands/game-examples.d.ts +22 -0
- package/dist/commands/game-examples.js +72 -0
- package/dist/commands/game-extension-list.d.ts +31 -3
- package/dist/commands/game-extension-list.js +94 -6
- package/dist/commands/game-images.d.ts +1 -1
- package/dist/commands/game-images.js +3 -2
- package/dist/commands/game-library.d.ts +3 -0
- package/dist/commands/game-library.js +2 -2
- package/dist/commands/game-mode.js +1 -1
- package/dist/commands/game-package-code.d.ts +87 -0
- package/dist/commands/game-package-code.js +648 -0
- package/dist/commands/game-package-hooks.d.ts +37 -0
- package/dist/commands/game-package-hooks.js +116 -0
- package/dist/commands/game-recipes.js +2 -2
- package/dist/commands/game-reminders.d.ts +5 -2
- package/dist/commands/game-reminders.js +7 -4
- package/dist/commands/game-rules.d.ts +4 -1
- package/dist/commands/game-rules.js +7 -1
- package/dist/commands/game-upkeep.js +3 -3
- package/dist/commands/game-view-place.d.ts +8 -20
- package/dist/commands/game-view-place.js +16 -35
- package/dist/commands/game-widgets.d.ts +42 -8
- package/dist/commands/game-widgets.js +182 -31
- package/dist/commands/game-world.d.ts +32 -3
- package/dist/commands/game-world.js +113 -24
- package/dist/commands/image.js +1 -1
- package/dist/commands/init.js +2 -2
- package/dist/commands/mode.d.ts +1 -1
- package/dist/commands/package.d.ts +15 -1
- package/dist/commands/package.js +96 -24
- package/dist/commands/progression.d.ts +2 -0
- package/dist/commands/progression.js +7 -2
- package/dist/commands/roll.d.ts +2 -0
- package/dist/commands/roll.js +50 -24
- package/dist/commands/rules.js +6 -4
- package/dist/commands/scene.d.ts +2 -2
- package/dist/commands/scene.js +13 -10
- package/dist/commands/sheet.js +10 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +14 -4
- package/dist/commands/trade.js +6 -4
- package/dist/commands/translate.js +2 -2
- package/dist/commands/travel.js +1 -1
- package/dist/commands/validate.js +2 -2
- package/dist/commands/view.d.ts +12 -4
- package/dist/commands/view.js +11 -8
- package/dist/commands/worked-out.js +11 -5
- package/dist/commands/write.d.ts +8 -1
- package/dist/commands/write.js +84 -25
- package/dist/core/command-reference.js +3 -2
- package/dist/core/consents.d.ts +18 -0
- package/dist/core/consents.js +93 -0
- package/dist/core/context.d.ts +68 -27
- package/dist/core/context.js +3 -1
- package/dist/core/examples.d.ts +25 -0
- package/dist/core/examples.js +19 -0
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +10 -1
- package/dist/core/package-api.d.ts +388 -0
- package/dist/core/package-declarations.d.ts +102 -0
- package/dist/core/package-declarations.js +81 -0
- package/dist/core/registry.d.ts +4 -0
- package/dist/core/text.d.ts +5 -0
- package/dist/core/text.js +12 -0
- package/dist/dashboard/acts.js +31 -24
- package/dist/dashboard/address.js +4 -1
- package/dist/dashboard/api.js +65 -3
- package/dist/dashboard/app.js +222 -98
- package/dist/dashboard/ask-card.js +169 -0
- package/dist/dashboard/asked-dice.js +57 -0
- package/dist/dashboard/dice/tray.js +6 -4
- package/dist/dashboard/extension-widgets.js +136 -16
- package/dist/dashboard/faces.js +6 -4
- package/dist/dashboard/help.js +10 -3
- package/dist/dashboard/i18n/ar.json +34 -29
- package/dist/dashboard/i18n/cs.json +34 -29
- package/dist/dashboard/i18n/da.json +34 -29
- package/dist/dashboard/i18n/de.json +34 -29
- package/dist/dashboard/i18n/el.json +34 -29
- package/dist/dashboard/i18n/es.json +34 -29
- package/dist/dashboard/i18n/fi.json +34 -29
- package/dist/dashboard/i18n/fr.json +34 -29
- package/dist/dashboard/i18n/he.json +34 -29
- package/dist/dashboard/i18n/hi.json +34 -29
- package/dist/dashboard/i18n/hu.json +34 -29
- package/dist/dashboard/i18n/is.json +34 -29
- package/dist/dashboard/i18n/it.json +34 -29
- package/dist/dashboard/i18n/ja.json +34 -29
- package/dist/dashboard/i18n/ko.json +34 -29
- package/dist/dashboard/i18n/nb.json +34 -29
- package/dist/dashboard/i18n/nl.json +34 -29
- package/dist/dashboard/i18n/pl.json +34 -29
- package/dist/dashboard/i18n/pt.json +34 -29
- package/dist/dashboard/i18n/ro.json +34 -29
- package/dist/dashboard/i18n/ru.json +34 -29
- package/dist/dashboard/i18n/sv.json +34 -29
- package/dist/dashboard/i18n/tr.json +34 -29
- package/dist/dashboard/i18n/uk.json +34 -29
- package/dist/dashboard/i18n/zh.json +34 -29
- package/dist/dashboard/icons.js +4 -1
- package/dist/dashboard/kit.js +35 -0
- package/dist/dashboard/labels.js +1 -0
- package/dist/dashboard/pack-card.js +97 -0
- package/dist/dashboard/package-page.js +50 -0
- package/dist/dashboard/packages.js +180 -24
- package/dist/dashboard/page-code.js +248 -0
- package/dist/dashboard/party.js +13 -14
- package/dist/dashboard/people.js +4 -0
- package/dist/dashboard/person-panel.js +110 -0
- package/dist/dashboard/place-map-view.js +11 -6
- package/dist/dashboard/rolls.js +2 -2
- package/dist/dashboard/scene.js +12 -9
- package/dist/dashboard/settings.js +55 -9
- package/dist/dashboard/sheet.js +21 -13
- package/dist/dashboard/status.js +69 -15
- package/dist/dashboard/style.css +859 -574
- package/dist/dashboard/top.js +75 -25
- package/dist/dashboard/turns.js +34 -13
- package/dist/dashboard/widgets.js +9 -2
- package/dist/dashboard-server.js +246 -11
- package/dist/dice/roll-dice.js +1 -1
- package/dist/effects/effect.d.ts +7 -4
- package/dist/effects/effect.js +12 -9
- package/dist/extensions/engine.d.ts +4 -0
- package/dist/extensions/engine.js +74 -0
- package/dist/extensions/extension.d.ts +28 -33
- package/dist/extensions/extension.js +37 -46
- package/dist/extensions/index.d.ts +4 -3
- package/dist/extensions/index.js +5 -2
- package/dist/extensions/packages.d.ts +14 -0
- package/dist/extensions/packages.js +148 -12
- package/dist/extensions/words.d.ts +2 -1
- package/dist/extensions/words.js +5 -4
- package/dist/index.d.ts +1 -3
- package/dist/mcp-server.js +52 -15
- package/dist/page-words.d.ts +4 -0
- package/dist/page-words.js +4 -4
- package/dist/page.d.ts +218 -0
- package/dist/page.js +2 -0
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/pages/load.d.ts +7 -1
- package/dist/pages/load.js +10 -5
- package/dist/pages/page-file.js +1 -1
- package/dist/pages/stack-writes.js +5 -4
- package/dist/pages/standard-fields.d.ts +2 -0
- package/dist/pages/standard-fields.js +8 -1
- package/dist/pages/world.d.ts +8 -0
- package/dist/pages/world.js +9 -2
- package/dist/systems/game-system.d.ts +61 -30
- package/dist/systems/game-system.js +159 -50
- package/dist/systems/index.d.ts +3 -3
- package/dist/systems/index.js +3 -3
- package/dist/systems/system-code.d.ts +29 -88
- package/dist/systems/system-code.js +68 -23
- package/dist/systems/words.d.ts +2 -0
- package/dist/systems/words.js +11 -0
- package/dist/testing.d.ts +76 -0
- package/dist/testing.js +197 -0
- package/instructions/combat.md +2 -2
- package/instructions/core.md +2 -2
- package/instructions/dashboard.md +1 -1
- package/instructions/mentor-tutorial.md +1 -1
- package/instructions/play.md +2 -2
- package/instructions/setup.md +1 -1
- package/package.json +15 -2
- package/systems/5e/LICENSE.md +13 -3
- package/systems/5e/dist/dying.js +83 -16
- package/systems/5e/dist/index.js +2 -2
- package/systems/5e/dist/page-style.js +634 -0
- package/systems/5e/dist/page.js +166 -0
- package/systems/5e/dist/shown.js +23 -0
- package/systems/5e/instructions/combat.md +1 -0
- package/systems/5e/package.json +4 -2
- package/systems/5e/system.yaml +35 -7
- package/systems/5e/versions/srd-5.1/system.yaml +2 -0
- package/systems/5e/words/ar.yaml +30 -0
- package/systems/5e/words/cs.yaml +30 -0
- package/systems/5e/words/da.yaml +30 -0
- package/systems/5e/words/de.yaml +30 -0
- package/systems/5e/words/el.yaml +30 -0
- package/systems/5e/words/es.yaml +30 -0
- package/systems/5e/words/fi.yaml +30 -0
- package/systems/5e/words/fr.yaml +30 -0
- package/systems/5e/words/he.yaml +30 -0
- package/systems/5e/words/hi.yaml +30 -0
- package/systems/5e/words/hu.yaml +30 -0
- package/systems/5e/words/is.yaml +30 -0
- package/systems/5e/words/it.yaml +30 -0
- package/systems/5e/words/ja.yaml +30 -0
- package/systems/5e/words/ko.yaml +30 -0
- package/systems/5e/words/nb.yaml +30 -0
- package/systems/5e/words/nl.yaml +30 -0
- package/systems/5e/words/pl.yaml +30 -0
- package/systems/5e/words/pt.yaml +30 -0
- package/systems/5e/words/ro.yaml +30 -0
- package/systems/5e/words/ru.yaml +30 -0
- package/systems/5e/words/sv.yaml +30 -0
- package/systems/5e/words/tr.yaml +30 -0
- package/systems/5e/words/uk.yaml +30 -0
- package/systems/5e/words/zh.yaml +30 -0
- package/dist/commands/game-extensions.d.ts +0 -34
- package/dist/commands/game-extensions.js +0 -182
- package/dist/commands/game-system-code.d.ts +0 -25
- package/dist/commands/game-system-code.js +0 -172
- package/dist/dashboard/death-save.js +0 -67
- package/dist/dashboard/dying.js +0 -46
- package/dist/dashboard/save-outcome.js +0 -42
- package/dist/dashboard/spend.js +0 -115
- package/dist/extensions/api.d.ts +0 -155
- /package/dist/{extensions/api.js → core/package-api.js} +0 -0
|
@@ -1,97 +1,38 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/** A
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
value: number;
|
|
6
|
-
dropped?: boolean;
|
|
7
|
-
}
|
|
8
|
-
/** A counter a command changed on a page: before and after, its maximum, and what damage took of it past what shields it. */
|
|
9
|
-
export interface CounterChange {
|
|
10
|
-
page: string;
|
|
11
|
-
field: string;
|
|
12
|
-
before: number;
|
|
13
|
-
after: number;
|
|
14
|
-
max?: number;
|
|
15
|
-
lost: number;
|
|
16
|
-
}
|
|
17
|
-
/** A roll made for someone with a page, as the player's check or the master's roll with who: never a hidden one. */
|
|
18
|
-
export interface RollMade {
|
|
19
|
-
who: string;
|
|
20
|
-
notation: string;
|
|
21
|
-
total: number;
|
|
22
|
-
dice: ThrownDie[];
|
|
23
|
-
}
|
|
24
|
-
/** A page as a system's code reads it: in the party or not, the player's character or not, its counters with what its effects give, its effects. */
|
|
25
|
-
export interface SystemPage {
|
|
26
|
-
name: string;
|
|
27
|
-
party: boolean;
|
|
28
|
-
pc: boolean;
|
|
29
|
-
counter(field: string): {
|
|
30
|
-
value: number;
|
|
31
|
-
max?: number;
|
|
32
|
-
} | undefined;
|
|
33
|
-
has(effect: string): boolean;
|
|
34
|
-
}
|
|
35
|
-
/** What a system's code may read of the game. */
|
|
36
|
-
export interface SystemReader {
|
|
37
|
-
/** A page by its name; undefined when no page, or more than one, has it. */
|
|
38
|
-
page(name: string): SystemPage | undefined;
|
|
39
|
-
/** A setting of the campaign, as mentor. */
|
|
40
|
-
setting(name: string): string | undefined;
|
|
41
|
-
/** Whether two names are the same, as the engine compares them: case and accents aside. */
|
|
42
|
-
sameName(one: string, other: string): boolean;
|
|
43
|
-
}
|
|
44
|
-
/** What a system's code may do to the game: each write with its line in the log, public or hidden as the engine shows that page to the player. */
|
|
45
|
-
export interface SystemGame extends SystemReader {
|
|
46
|
-
/** Sets numbers on a page: a counter keeps its maximum. */
|
|
47
|
-
set(page: string, values: Record<string, number>, why: string): void;
|
|
48
|
-
/** Adds an effect without end; the engine's notes on what it breaks of what one keeps, or undefined when the page has it already. */
|
|
49
|
-
addEffect(page: string, name: string, why: string): string[] | undefined;
|
|
50
|
-
/** Ends an effect; whether the page had it. */
|
|
51
|
-
endEffect(page: string, name: string, why: string): boolean;
|
|
52
|
-
/** Rolls with the engine's dice, as a roll in the log for who: public, or hidden for anyone outside the party as the master-rolls setting says (D-287). */
|
|
53
|
-
roll(notation: string, by: {
|
|
54
|
-
who: string;
|
|
55
|
-
why: string;
|
|
56
|
-
}): {
|
|
57
|
-
total: number;
|
|
58
|
-
dice: ThrownDie[];
|
|
59
|
-
text: string;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/** The hooks of a system's code, each optional, each giving lines for the command's output. Writes made through the game call no hook. */
|
|
63
|
-
export interface SystemHooks {
|
|
64
|
-
/** After change, or the hit dice, wrote a counter of a page. */
|
|
65
|
-
counterChanged?(change: CounterChange, game: SystemGame): string[];
|
|
66
|
-
/** As someone's turn starts in a scene. */
|
|
67
|
-
turnStarted?(turn: {
|
|
68
|
-
who: string;
|
|
69
|
-
}, game: SystemGame): string[];
|
|
70
|
-
/** After a roll for someone was logged. */
|
|
71
|
-
rolled?(roll: RollMade, game: SystemGame): string[];
|
|
72
|
-
/** After an effect was added to a page. */
|
|
73
|
-
effectAdded?(added: {
|
|
74
|
-
page: string;
|
|
75
|
-
effect: string;
|
|
76
|
-
}, game: SystemGame): string[];
|
|
77
|
-
/** Before ask shows its buttons: what the page draws of the question, as a death save; it only reads. */
|
|
78
|
-
asking?(question: {
|
|
79
|
-
who: string;
|
|
80
|
-
notations: string[];
|
|
81
|
-
}, game: SystemReader): SaveAsked | undefined;
|
|
82
|
-
}
|
|
83
|
-
/** The default export of a system's code. */
|
|
84
|
-
export type SystemEntry = () => SystemHooks;
|
|
85
|
-
/** A system's code as loaded: its hooks, or what kept it from loading. */
|
|
86
|
-
export type LoadedSystemCode = {
|
|
87
|
-
hooks: SystemHooks;
|
|
1
|
+
import type { PackageCode } from "../core/package-api.ts";
|
|
2
|
+
/** A system's code as loaded: what it gives, or what kept it from loading; the version of its package, as it was loaded. */
|
|
3
|
+
export type LoadedSystemCode = ({
|
|
4
|
+
code: PackageCode;
|
|
88
5
|
} | {
|
|
89
6
|
problem: string;
|
|
7
|
+
} | {
|
|
8
|
+
refused: string;
|
|
9
|
+
}) & {
|
|
10
|
+
version: string;
|
|
90
11
|
};
|
|
12
|
+
/** A system's package.json of kind system (D-448, D-511): its name and version, the main of its code and its page module, the API it is made for. */
|
|
13
|
+
export interface SystemPackage {
|
|
14
|
+
package: string;
|
|
15
|
+
version: string;
|
|
16
|
+
main?: string;
|
|
17
|
+
page?: string;
|
|
18
|
+
api?: number;
|
|
19
|
+
}
|
|
20
|
+
/** A system's package.json of kind system; undefined for a folder without one, which is data alone. */
|
|
21
|
+
export declare function systemPackage(folder: string): SystemPackage | undefined;
|
|
22
|
+
/** What a package's default export gave, refused when it is not its code, an object, as null is not. */
|
|
23
|
+
export declare function givenCode(given: unknown, file: string): PackageCode;
|
|
91
24
|
/** Whether a system's folder brings code: a package.json of kind system with a main (D-448). */
|
|
92
25
|
export declare function systemHasCode(folder: string): boolean;
|
|
26
|
+
/** 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. */
|
|
27
|
+
export declare function systemApiProblem(folder: string): string | undefined;
|
|
28
|
+
/** 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. */
|
|
29
|
+
export declare function systemPageModule(folder: string): {
|
|
30
|
+
file: string;
|
|
31
|
+
package: string;
|
|
32
|
+
version: string;
|
|
33
|
+
} | undefined;
|
|
93
34
|
/**
|
|
94
35
|
* 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
|
|
95
|
-
* the tests, else from its built main. One that fails to load says why, for the command that needs it.
|
|
36
|
+
* 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.
|
|
96
37
|
*/
|
|
97
38
|
export declare function loadSystemCode(folders: string[]): Promise<Record<string, LoadedSystemCode>>;
|
|
@@ -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),
|
|
10
|
-
//
|
|
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
|
|
98
|
+
throw new Error(`${file} has no default export that gives its code`);
|
|
40
99
|
}
|
|
41
|
-
loaded[name] = {
|
|
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
|
-
}
|
package/dist/systems/words.d.ts
CHANGED
|
@@ -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;
|
package/dist/systems/words.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ShownWidget } from "./commands/game-widgets.ts";
|
|
2
|
+
import type { Context, Player } from "./core/context.ts";
|
|
3
|
+
import type { LogEntry } from "./core/log.ts";
|
|
4
|
+
export type { ShownWidget } from "./commands/game-widgets.ts";
|
|
5
|
+
export type { CardAsked, Context, Player, Rows, Said } from "./core/context.ts";
|
|
6
|
+
export type { LogEntry } from "./core/log.ts";
|
|
7
|
+
/** What a command printed, and its exit code: 0 when it did what it was asked. */
|
|
8
|
+
export interface Ran {
|
|
9
|
+
output: string;
|
|
10
|
+
exitCode: number;
|
|
11
|
+
}
|
|
12
|
+
/** A campaign for an extension's tests, made by testCampaign. */
|
|
13
|
+
export interface TestCampaign {
|
|
14
|
+
/** Its folder, a temporary one of its own. */
|
|
15
|
+
folder: string;
|
|
16
|
+
/** What its commands run with: change its `page` to answer the player's questions, its `signal` to stop a call. */
|
|
17
|
+
context: Context;
|
|
18
|
+
/** Runs a command as the command line does, as `run("lockpicking", "Crypt door", "--who", "Kira")`. */
|
|
19
|
+
run(...args: string[]): Promise<Ran>;
|
|
20
|
+
/** Runs a command that must succeed, and gives what it printed; it throws with that when it fails. */
|
|
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>;
|
|
24
|
+
/** The dice show these faces in turn, each one die of any size; when they run out, a roll throws. */
|
|
25
|
+
dice(...faces: number[]): void;
|
|
26
|
+
/** The lines of the campaign's log, in order. */
|
|
27
|
+
log(): LogEntry[];
|
|
28
|
+
/** A file of the campaign, as text, by its path in it; undefined when there is none. */
|
|
29
|
+
read(path: string): string | undefined;
|
|
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[]>;
|
|
32
|
+
/** The dashboard of the campaign, served on a port of this computer, with a page open on it. */
|
|
33
|
+
dashboard(): Promise<TestDashboard>;
|
|
34
|
+
/** Takes the campaign's folder away, and anything it started. */
|
|
35
|
+
close(): Promise<void>;
|
|
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
|
+
}
|
|
45
|
+
/** A campaign's dashboard in a test: the player through its page, what it answers, and what it is sent. */
|
|
46
|
+
export interface TestDashboard {
|
|
47
|
+
/** The player through the page: give it as the campaign's context.page for the questions to reach the page. */
|
|
48
|
+
player: Player;
|
|
49
|
+
/** What the dashboard answers at an address, as JSON, as /api/asked. */
|
|
50
|
+
get(path: string): Promise<any>;
|
|
51
|
+
/** Sends the dashboard what the page sends, as an answer to /api/answer; its status and what it answered. */
|
|
52
|
+
post(path: string, body: unknown): Promise<{
|
|
53
|
+
status: number;
|
|
54
|
+
body: any;
|
|
55
|
+
}>;
|
|
56
|
+
close(): Promise<void>;
|
|
57
|
+
}
|
|
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
|
+
*/
|
|
62
|
+
export interface TestCampaignOptions {
|
|
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[];
|
|
66
|
+
extensions?: string[];
|
|
67
|
+
language?: string;
|
|
68
|
+
play?: boolean;
|
|
69
|
+
/** Settings written in campaign.yaml as by hand, as {"calendar-start": "14 April"}. */
|
|
70
|
+
settings?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
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.
|
|
75
|
+
*/
|
|
76
|
+
export declare function testCampaign(options: TestCampaignOptions): Promise<TestCampaign>;
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
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.
|
|
4
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmdirSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { request } from "node:http";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { basename, join, resolve } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { stringify } from "yaml";
|
|
10
|
+
import { runCommandLine } from "./command-line.js";
|
|
11
|
+
import { ask } from "./commands/ask.js";
|
|
12
|
+
import { campaignWidgets } from "./commands/game-widgets.js";
|
|
13
|
+
import { campaignSystem } from "./commands/game-world.js";
|
|
14
|
+
import { SessionStore } from "./core/session-store.js";
|
|
15
|
+
import { startDashboard } from "./dashboard-server.js";
|
|
16
|
+
import { loadSystemCode } from "./systems/index.js";
|
|
17
|
+
/**
|
|
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.
|
|
20
|
+
*/
|
|
21
|
+
export async function testCampaign(options) {
|
|
22
|
+
const base = mkdtempSync(join(tmpdir(), "rpg-extension-test-"));
|
|
23
|
+
const folder = join(base, "campaign");
|
|
24
|
+
const packages = join(base, "packages");
|
|
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/")];
|
|
38
|
+
let ids = 0;
|
|
39
|
+
let faces;
|
|
40
|
+
const context = {
|
|
41
|
+
folder,
|
|
42
|
+
random: (sides) => {
|
|
43
|
+
if (faces === undefined) {
|
|
44
|
+
return Math.min(4, sides);
|
|
45
|
+
}
|
|
46
|
+
const face = faces.shift();
|
|
47
|
+
if (face === undefined) {
|
|
48
|
+
throw new Error("The test ran out of dice: give more faces with dice().");
|
|
49
|
+
}
|
|
50
|
+
return face;
|
|
51
|
+
},
|
|
52
|
+
now: () => new Date("2026-10-02T10:00:00Z"),
|
|
53
|
+
newId: () => `id${++ids}`,
|
|
54
|
+
newSalt: () => "salt",
|
|
55
|
+
actor: "master",
|
|
56
|
+
platform: process.platform === "win32" || process.platform === "darwin" ? process.platform : "linux",
|
|
57
|
+
systemFolders,
|
|
58
|
+
systemCode: await loadSystemCode(systemFolders),
|
|
59
|
+
extensionFolders: [packages],
|
|
60
|
+
};
|
|
61
|
+
const started = [];
|
|
62
|
+
// Each call reads the campaign's context as the test left it, a page or a signal of its own included.
|
|
63
|
+
const campaign = {
|
|
64
|
+
folder,
|
|
65
|
+
context,
|
|
66
|
+
run: (...args) => runCommandLine(args, campaign.context),
|
|
67
|
+
ok: async (...args) => {
|
|
68
|
+
const ran = await campaign.run(...args);
|
|
69
|
+
if (ran.exitCode !== 0) {
|
|
70
|
+
throw new Error(`${args.join(" ")} failed: ${ran.output}`);
|
|
71
|
+
}
|
|
72
|
+
return ran.output;
|
|
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
|
+
},
|
|
82
|
+
dice: (...given) => (faces = [...given]),
|
|
83
|
+
log: () => (readText(join(folder, "log.jsonl")) ?? "").split("\n").filter((line) => line.trim() !== "").map((line) => JSON.parse(line)),
|
|
84
|
+
read: (path) => readText(join(folder, path)),
|
|
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
|
+
},
|
|
90
|
+
dashboard: async () => {
|
|
91
|
+
const dashboard = await testDashboard(campaign.context);
|
|
92
|
+
started.push(dashboard);
|
|
93
|
+
return dashboard;
|
|
94
|
+
},
|
|
95
|
+
close: async () => {
|
|
96
|
+
await Promise.all(started.map((dashboard) => dashboard.close()));
|
|
97
|
+
// The links first, alone: never through them, into the extension's own folder.
|
|
98
|
+
linked.forEach((one) => unlink(one.link));
|
|
99
|
+
rmSync(base, { recursive: true, force: true });
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
await campaign.ok("init", "--name", "Test", "--language", options.language ?? "en", "--system", options.system, "--difficulty", "normal", "--lethality", "dice");
|
|
103
|
+
if (options.play !== false) {
|
|
104
|
+
inPlay(folder);
|
|
105
|
+
}
|
|
106
|
+
const extensions = Object.fromEntries(linked.filter((one) => !one.system).map((one) => [one.name, one.version]));
|
|
107
|
+
const added = { ...options.settings, ...(linked.length === 0 ? {} : { extensions }) };
|
|
108
|
+
const written = readFileSync(join(folder, "campaign.yaml"), "utf8");
|
|
109
|
+
writeFileSync(join(folder, "campaign.yaml"), Object.keys(added).length === 0 ? written : `${written}${stringify(added)}`);
|
|
110
|
+
return campaign;
|
|
111
|
+
}
|
|
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")) ?? "{}"));
|
|
120
|
+
if (manifest.name === undefined || manifest.version === undefined) {
|
|
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.`);
|
|
125
|
+
}
|
|
126
|
+
const scope = manifest.name.includes("/") ? manifest.name.split("/")[0] : "";
|
|
127
|
+
mkdirSync(join(packages, scope), { recursive: true });
|
|
128
|
+
// A junction on Windows, which needs no rights; a link elsewhere.
|
|
129
|
+
const link = join(packages, scope, basename(manifest.name));
|
|
130
|
+
symlinkSync(folder, link, "junction");
|
|
131
|
+
return { name: manifest.name, version: manifest.version, link, system };
|
|
132
|
+
}
|
|
133
|
+
/** Takes a link away, never what it leads to: a junction of Windows goes as an empty folder does. */
|
|
134
|
+
function unlink(link) {
|
|
135
|
+
try {
|
|
136
|
+
unlinkSync(link);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
rmdirSync(link);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** A campaign that init made in play, as after its setup (MOD-1): the settings of play that are not there take their usual values. */
|
|
143
|
+
function inPlay(folder) {
|
|
144
|
+
const state = join(folder, "state.yaml");
|
|
145
|
+
writeFileSync(state, readFileSync(state, "utf8").replace(/^mode: setup$/m, "mode: play"));
|
|
146
|
+
const settings = join(folder, "campaign.yaml");
|
|
147
|
+
const written = readFileSync(settings, "utf8");
|
|
148
|
+
const usual = ["saves: checkpoint", "rigor: smooth", "dice: digital", "units: metric"].filter((line) => !new RegExp(`^${line.split(":")[0]}:`, "m").test(written));
|
|
149
|
+
writeFileSync(settings, `${written}${usual.map((line) => `${line}\n`).join("")}`);
|
|
150
|
+
}
|
|
151
|
+
/** The dashboard of a test campaign, with a page open on it that the server has heard from, so that questions go to the page. */
|
|
152
|
+
async function testDashboard(context) {
|
|
153
|
+
const session = new SessionStore({ systemFolders: context.systemFolders, watchFolder: () => ({ close: () => undefined }) });
|
|
154
|
+
const dashboard = await startDashboard({ ...context, files: session }, session, { ports: [0], page: context.folder });
|
|
155
|
+
if (dashboard === undefined) {
|
|
156
|
+
session.close();
|
|
157
|
+
throw new Error("The test's dashboard did not start.");
|
|
158
|
+
}
|
|
159
|
+
const port = Number(new URL(dashboard.url).port);
|
|
160
|
+
const call = (method, path, body) => new Promise((done, fail) => {
|
|
161
|
+
const headers = body === undefined ? {} : { "origin": `http://127.0.0.1:${port}`, "content-type": "application/json" };
|
|
162
|
+
const sent = request({ host: "127.0.0.1", port, path, method, headers }, (response) => {
|
|
163
|
+
let text = "";
|
|
164
|
+
response.setEncoding("utf8");
|
|
165
|
+
response.on("data", (chunk) => (text += chunk));
|
|
166
|
+
response.on("end", () => done({ status: response.statusCode ?? 0, body: text.trim() === "" ? {} : JSON.parse(text) }));
|
|
167
|
+
});
|
|
168
|
+
sent.on("error", fail);
|
|
169
|
+
sent.end(body === undefined ? undefined : JSON.stringify(body));
|
|
170
|
+
});
|
|
171
|
+
const page = request({ host: "127.0.0.1", port, path: "/events" });
|
|
172
|
+
const opened = new Promise((done) => page.on("response", (response) => response.once("data", done)));
|
|
173
|
+
page.end();
|
|
174
|
+
await opened;
|
|
175
|
+
return {
|
|
176
|
+
player: dashboard.player,
|
|
177
|
+
get: async (path) => (await call("GET", path)).body,
|
|
178
|
+
post: (path, body) => call("POST", path, body),
|
|
179
|
+
close: async () => {
|
|
180
|
+
page.destroy();
|
|
181
|
+
await dashboard.close();
|
|
182
|
+
session.close();
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/** A path of the engine's package, from this file in src/ or dist/ alike. */
|
|
187
|
+
function enginePath(relative) {
|
|
188
|
+
return fileURLToPath(new URL(relative, import.meta.url));
|
|
189
|
+
}
|
|
190
|
+
function readText(path) {
|
|
191
|
+
try {
|
|
192
|
+
return readFileSync(path, "utf8");
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
}
|
package/instructions/combat.md
CHANGED
|
@@ -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
|
|
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
|
|
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.
|
package/instructions/core.md
CHANGED
|
@@ -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 "
|
|
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
|
|
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 characters are made, in the table setting, in the words you said.
|
|
44
44
|
|
|
45
45
|
## 5. Secrets
|
|
46
46
|
|
|
@@ -3,5 +3,5 @@ The game is played with the player's dashboard open beside the chat, at {link}:
|
|
|
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
|
|
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.
|
package/instructions/play.md
CHANGED
|
@@ -5,7 +5,7 @@ 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
|
|
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
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.
|
|
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.
|
|
@@ -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
|
|
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.
|
package/instructions/setup.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
## Setup
|
|
2
2
|
|
|
3
|
-
Out of the game, without brackets.
|
|
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.
|