rpg-engine 0.1.2 → 0.2.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 +3 -1
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +5 -1
- package/dist/campaign/settings.js +18 -3
- package/dist/command-line.js +26 -8
- package/dist/commands/advance.js +26 -7
- package/dist/commands/ask.d.ts +6 -0
- package/dist/commands/ask.js +3 -3
- package/dist/commands/config.js +40 -10
- package/dist/commands/game-advance.d.ts +6 -0
- package/dist/commands/game-advance.js +9 -2
- package/dist/commands/game-extension-list.d.ts +27 -0
- package/dist/commands/game-extension-list.js +92 -0
- package/dist/commands/game-extensions.d.ts +27 -0
- package/dist/commands/game-extensions.js +177 -0
- package/dist/commands/game-mode.js +2 -1
- package/dist/commands/game-time.d.ts +15 -3
- package/dist/commands/game-time.js +76 -6
- package/dist/commands/game-world.js +6 -3
- package/dist/commands/index.js +2 -0
- package/dist/commands/package.d.ts +42 -0
- package/dist/commands/package.js +220 -0
- package/dist/commands/problems.js +3 -1
- package/dist/commands/scene.d.ts +3 -3
- package/dist/commands/sheet.js +7 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +10 -5
- package/dist/commands/travel.js +4 -2
- package/dist/commands/validate.js +4 -2
- package/dist/commands/view.d.ts +5 -0
- package/dist/commands/view.js +3 -1
- package/dist/core/context.d.ts +34 -0
- package/dist/core/context.js +11 -0
- package/dist/core/instruction-parts.d.ts +10 -0
- package/dist/core/instruction-parts.js +32 -0
- package/dist/core/store.d.ts +2 -0
- package/dist/core/store.js +8 -0
- package/dist/dashboard/app.js +2 -1
- package/dist/dashboard/game-words.js +21 -0
- package/dist/dashboard/i18n/ar.json +7 -0
- package/dist/dashboard/i18n/cs.json +7 -0
- package/dist/dashboard/i18n/da.json +7 -0
- package/dist/dashboard/i18n/de.json +7 -0
- package/dist/dashboard/i18n/el.json +7 -0
- package/dist/dashboard/i18n/es.json +7 -0
- package/dist/dashboard/i18n/fi.json +7 -0
- package/dist/dashboard/i18n/fr.json +7 -0
- package/dist/dashboard/i18n/he.json +7 -0
- package/dist/dashboard/i18n/hi.json +7 -0
- package/dist/dashboard/i18n/hu.json +7 -0
- package/dist/dashboard/i18n/is.json +7 -0
- package/dist/dashboard/i18n/it.json +7 -0
- package/dist/dashboard/i18n/ja.json +7 -0
- package/dist/dashboard/i18n/ko.json +7 -0
- package/dist/dashboard/i18n/nb.json +7 -0
- package/dist/dashboard/i18n/nl.json +7 -0
- package/dist/dashboard/i18n/pl.json +7 -0
- package/dist/dashboard/i18n/pt.json +7 -0
- package/dist/dashboard/i18n/ro.json +7 -0
- package/dist/dashboard/i18n/ru.json +7 -0
- package/dist/dashboard/i18n/sv.json +7 -0
- package/dist/dashboard/i18n/tr.json +7 -0
- package/dist/dashboard/i18n/uk.json +7 -0
- package/dist/dashboard/i18n/zh.json +7 -0
- package/dist/dashboard/icons.js +1 -0
- package/dist/dashboard/top.js +5 -5
- package/dist/extensions/api.d.ts +73 -0
- package/dist/extensions/api.js +1 -0
- package/dist/extensions/extension.d.ts +43 -0
- package/dist/extensions/extension.js +113 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/packages.d.ts +11 -0
- package/dist/extensions/packages.js +141 -0
- package/dist/index.d.ts +1 -0
- package/dist/mcp-server.js +50 -4
- package/dist/systems/game-system.d.ts +1 -5
- package/dist/systems/game-system.js +6 -31
- package/dist/systems/index.d.ts +1 -1
- package/dist/time/calendar.d.ts +36 -0
- package/dist/time/calendar.js +84 -0
- package/dist/time/index.d.ts +1 -0
- package/dist/time/index.js +2 -1
- package/package.json +2 -3
- package/systems/5e/instructions/play.md +1 -0
- package/systems/5e/system.yaml +2 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { changeExtensions, readTextSetting, requireCampaign } from "../campaign/index.js";
|
|
3
|
+
import { appendLogEntry } from "../core/log.js";
|
|
4
|
+
import { defineCommand } from "../core/registry.js";
|
|
5
|
+
import { files } from "../core/store.js";
|
|
6
|
+
import { comparableText } from "../core/text.js";
|
|
7
|
+
import { extensionApi, findExtension, installedExtensions, isFolderSpec, isVerified, readExtension, shortName, verifiedScope } from "../extensions/index.js";
|
|
8
|
+
import { chooseAnswer } from "./ask.js";
|
|
9
|
+
import { listedExtensions, runsCode } from "./game-extension-list.js";
|
|
10
|
+
import { extensionCommandNames, packagesInstalled } from "./game-extensions.js";
|
|
11
|
+
import { campaignMode } from "./game-mode.js";
|
|
12
|
+
import { newDatedLogEntry } from "./game-time.js";
|
|
13
|
+
import { campaignWorld } from "./game-world.js";
|
|
14
|
+
export const packageCommand = defineCommand({
|
|
15
|
+
name: "package",
|
|
16
|
+
description: "Install, list or remove the packages of the campaign: extensions such as weather, from npm. "
|
|
17
|
+
+ "list says those on this computer, those the campaign uses and those npm has. install adds one to this computer and to the campaign, only once the player wants it; "
|
|
18
|
+
+ "one not published by RPG Engine (@rpgengine/…) is someone else's: the player is asked on their dashboard or in a form, or installs it from their terminal. "
|
|
19
|
+
+ "remove takes one out of the campaign. Example: package install weather.",
|
|
20
|
+
group: "campaign",
|
|
21
|
+
positionals: ["action", "name"],
|
|
22
|
+
slow: true,
|
|
23
|
+
input: z.object({
|
|
24
|
+
action: z.enum(["list", "install", "remove"]).describe("list, install or remove"),
|
|
25
|
+
name: z.string().optional().describe("the package: its name alone for one of ours, such as weather; another's npm name with its scope, or npm:name without one, its version if wanted; or a folder on this computer"),
|
|
26
|
+
"accept-risk": z.boolean().optional().describe("on the command line only: the player's own yes to a package not published by RPG Engine, at their own risk"),
|
|
27
|
+
}),
|
|
28
|
+
async run(input, context) {
|
|
29
|
+
const root = requireCampaign(context.folder);
|
|
30
|
+
if (input.action === "list") {
|
|
31
|
+
return await listed(root, context);
|
|
32
|
+
}
|
|
33
|
+
const name = input.name?.trim();
|
|
34
|
+
if (name === undefined || name === "") {
|
|
35
|
+
throw new Error(`Give the package to ${input.action}, such as package ${input.action} weather.`);
|
|
36
|
+
}
|
|
37
|
+
return input.action === "install" ? await installed(root, context, name, context.terminal === true && input["accept-risk"] === true) : removed(root, context, name);
|
|
38
|
+
},
|
|
39
|
+
format(result) {
|
|
40
|
+
if (result.kind === "removed") {
|
|
41
|
+
return `The campaign no longer uses ${result.name}: its commands and its parts of your instructions are gone; what it kept in the campaign stays, and comes back if it is installed again.`;
|
|
42
|
+
}
|
|
43
|
+
if (result.kind === "installed") {
|
|
44
|
+
const { extension } = result;
|
|
45
|
+
const what = `${extension.name} ${extension.version}${result.verified ? ", verified" : ", not verified: at the player's risk"}`;
|
|
46
|
+
const said = [
|
|
47
|
+
`${result.already ? `The campaign already uses ${what}` : `Installed ${what}, and the campaign uses it`}: ${extension.about}.`,
|
|
48
|
+
result.codeLeftOut ? "Its code is not used: for now RPG Engine runs only its own packages' code, and its texts bring the rest." : "",
|
|
49
|
+
result.commands.length === 0 ? "" : `Its commands: ${result.commands.join(", ")}.${result.tools === "" ? "" : ` ${result.tools}`}`,
|
|
50
|
+
Object.keys(extension.parts).length === 0 ? "" : `Its parts of your instructions are given when they apply: ${Object.keys(extension.parts).join(", ")}.`,
|
|
51
|
+
].filter((line) => line !== "").join(" ");
|
|
52
|
+
return result.part === undefined ? said : `${said}\n\nIts part for now:\n\n${result.part}`;
|
|
53
|
+
}
|
|
54
|
+
const installedLines = result.installed.map((one) => "broken" in one ? `${one.name} (broken: ${one.broken}; install it again)` : `${one.name} ${one.version}${one.verified ? "" : " (not verified)"}${one.used ? ", used by the campaign" : ""}`);
|
|
55
|
+
const available = result.available.map((one) => `${shortName(one.name)} ${one.version}${one.name.startsWith(verifiedScope) ? "" : " (not verified)"}${one.description === undefined ? "" : `: ${one.description}`}`);
|
|
56
|
+
return [
|
|
57
|
+
`On this computer: ${installedLines.length === 0 ? "none" : installedLines.join("; ")}.`,
|
|
58
|
+
result.listedMissing.length === 0 ? "" : `The campaign lists, not installed here: ${result.listedMissing.join(", ")}; install each with package install.`,
|
|
59
|
+
result.searchFailed === undefined ? `On npm: ${available.length === 0 ? "none more" : available.join("; ")}.` : `npm could not be asked: ${result.searchFailed}.`,
|
|
60
|
+
].filter((line) => line !== "").join("\n");
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
/** The packages on this computer, those the campaign lists and does not find, and those npm has besides, for this rpg-engine. */
|
|
64
|
+
async function listed(root, context) {
|
|
65
|
+
const used = Object.keys(listedExtensions(root));
|
|
66
|
+
const here = installedExtensions(context.extensionFolders ?? []).map((found) => {
|
|
67
|
+
try {
|
|
68
|
+
const extension = readExtension(found.folder);
|
|
69
|
+
return { name: extension.name, version: extension.version, verified: isVerified(extension.package, extension.linked), used: used.includes(extension.package) };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return { name: shortName(found.package), broken: error instanceof Error ? error.message : String(error) };
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const searched = context.packages === undefined ? { failed: "only the game's server and the command line reach npm" } : await context.packages.search();
|
|
76
|
+
const isHere = (name) => here.some((one) => one.name === shortName(name));
|
|
77
|
+
return {
|
|
78
|
+
kind: "list",
|
|
79
|
+
installed: here,
|
|
80
|
+
listedMissing: used.filter((name) => !isHere(name)),
|
|
81
|
+
available: "failed" in searched ? [] : searched.filter((one) => !isHere(one.name) && one.kind === "extension" && one.api === extensionApi),
|
|
82
|
+
...("failed" in searched ? { searchFailed: searched.failed } : {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Installs a package on this computer and adds it to the campaign (D-27, D-428, D-441): ours, or another once the player wants it; an extension, for this game. */
|
|
86
|
+
async function installed(root, context, name, acceptRisk) {
|
|
87
|
+
const packages = context.packages;
|
|
88
|
+
if (packages === undefined) {
|
|
89
|
+
throw new Error("Packages are installed only by the game's server or the command line, which reach npm.");
|
|
90
|
+
}
|
|
91
|
+
// A name alone is one of ours: weather is @rpgengine/weather, never a stranger's of that name, which is given as npm:weather.
|
|
92
|
+
const spec = name.startsWith("npm:") ? name.slice(4) : isFolderSpec(name) || name.startsWith("@") ? name : `${verifiedScope}${name}`;
|
|
93
|
+
const described = await packages.describe(spec);
|
|
94
|
+
if ("failed" in described) {
|
|
95
|
+
throw new Error(`${described.failed}. Nothing changed${spec === name ? "" : `: ${name} alone means ${spec}, one of RPG Engine's; another's is named with its scope, or as npm:${name} without one`}.`);
|
|
96
|
+
}
|
|
97
|
+
if (described.kind !== "extension") {
|
|
98
|
+
throw new Error(described.kind === undefined
|
|
99
|
+
? `${described.name} is not a package for RPG Engine: its package.json does not say "rpg-engine": {"kind": "extension"}. Nothing changed.`
|
|
100
|
+
: `${described.name} is a package of kind ${described.kind}: for now only extensions are installed this way. Nothing changed.`);
|
|
101
|
+
}
|
|
102
|
+
if (described.api !== extensionApi) {
|
|
103
|
+
throw new Error(`${described.name} ${described.version} is made for the extension API ${described.api ?? "none"}, and this RPG Engine reads the API ${extensionApi}: install a version made for it. Nothing changed.`);
|
|
104
|
+
}
|
|
105
|
+
const folderSpec = isFolderSpec(spec);
|
|
106
|
+
if (!isVerified(described.name, folderSpec)) {
|
|
107
|
+
await playerYes(context, folderSpec ? name : described.name, acceptRisk, folderSpec);
|
|
108
|
+
}
|
|
109
|
+
const before = usable(context, described.name);
|
|
110
|
+
const reinstall = before === undefined || before.version !== described.version || folderSpec;
|
|
111
|
+
if (reinstall) {
|
|
112
|
+
const why = await packages.install(spec);
|
|
113
|
+
if (why !== undefined) {
|
|
114
|
+
throw new Error(`${described.name} could not be installed: ${why}. Nothing changed in the campaign.`);
|
|
115
|
+
}
|
|
116
|
+
// npm wrote there: what the call read of those folders is read again, and the code anew.
|
|
117
|
+
(context.extensionFolders ?? []).forEach((folder) => files().refresh(folder));
|
|
118
|
+
packagesInstalled();
|
|
119
|
+
}
|
|
120
|
+
const extension = usable(context, described.name);
|
|
121
|
+
if (extension === undefined) {
|
|
122
|
+
throw new Error(`${described.name} was installed, but RPG Engine cannot use it as an extension. Nothing changed in the campaign.`);
|
|
123
|
+
}
|
|
124
|
+
const system = readTextSetting(root, "system");
|
|
125
|
+
if (extension.needs.system !== undefined && comparableText(extension.needs.system) !== comparableText(system ?? "")) {
|
|
126
|
+
throw new Error(`${extension.name} is installed on this computer, but it is for the game system ${extension.needs.system}, and the campaign plays ${system ?? "none"}: the campaign does not use it.`);
|
|
127
|
+
}
|
|
128
|
+
const others = Object.keys(listedExtensions(root)).filter((other) => other !== extension.package && shortName(other) === extension.name);
|
|
129
|
+
if (others.length > 0) {
|
|
130
|
+
throw new Error(`The campaign uses ${others[0]}, with the same name, ${extension.name}: take it away with package remove ${others[0]} first. Nothing changed in the campaign.`);
|
|
131
|
+
}
|
|
132
|
+
// Its code is checked before the campaign lists it: a package that would not work is never added.
|
|
133
|
+
const commands = runsCode(extension)
|
|
134
|
+
? await extensionCommandNames(extension, []).catch((error) => {
|
|
135
|
+
throw new Error(`The code of ${extension.package} cannot be used: ${error instanceof Error ? error.message : String(error)}. Nothing changed in the campaign.`);
|
|
136
|
+
})
|
|
137
|
+
: [];
|
|
138
|
+
const listedBefore = listedExtensions(root);
|
|
139
|
+
const already = listedBefore[extension.package] === extension.version && !reinstall;
|
|
140
|
+
const verified = isVerified(extension.package, extension.linked);
|
|
141
|
+
if (listedBefore[extension.package] !== extension.version) {
|
|
142
|
+
changeExtensions(root, { ...listedBefore, [extension.package]: extension.version });
|
|
143
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-installed", "public", { package: extension.package, version: extension.version, verified }));
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
kind: "installed",
|
|
147
|
+
extension,
|
|
148
|
+
verified,
|
|
149
|
+
commands,
|
|
150
|
+
codeLeftOut: extension.code !== undefined && !runsCode(extension),
|
|
151
|
+
already,
|
|
152
|
+
...modePart(root, context, extension),
|
|
153
|
+
tools: toolsNote(context),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The player's own yes to a package not ours (D-441): on the command line, --accept-risk they typed; in a chat, a button on their dashboard or in the host's
|
|
158
|
+
* form, never the master's word. It throws when there is none.
|
|
159
|
+
*/
|
|
160
|
+
async function playerYes(context, name, acceptRisk, fromFolder) {
|
|
161
|
+
const warning = fromFolder
|
|
162
|
+
? `${name} is a folder of this computer, not a package published by RPG Engine: it is never verified, and RPG Engine takes no responsibility for it.`
|
|
163
|
+
: `${name} is not published by RPG Engine: its texts are someone else's, and RPG Engine takes no responsibility for it.`;
|
|
164
|
+
if (context.terminal === true) {
|
|
165
|
+
if (!acceptRisk) {
|
|
166
|
+
throw new Error(`${warning} To install it at your own risk: package install ${name} --accept-risk. Nothing changed.`);
|
|
167
|
+
}
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const answer = await chooseAnswer(context, `Install ${name}? ${warning}`, "A package not ours", ["Install it, at my risk", "Do not install it"]);
|
|
171
|
+
if (answer === 0) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (answer === 1 || (typeof answer === "object" && answer !== null)) {
|
|
175
|
+
throw new Error(`The player did not want ${name}. Nothing changed.`);
|
|
176
|
+
}
|
|
177
|
+
throw new Error(`${warning} Only the player can say yes to it, and they cannot be asked here: tell them to install it from their terminal, in the campaign's folder, with rpg package install ${name} --accept-risk. Nothing changed.`);
|
|
178
|
+
}
|
|
179
|
+
/** The installed extension of this package, when it reads; undefined when it is missing or broken. */
|
|
180
|
+
function usable(context, name) {
|
|
181
|
+
try {
|
|
182
|
+
return findExtension(context.extensionFolders ?? [], name);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** The extension's part of the instructions for the mode the campaign is in, which the chat going on has not been given. */
|
|
189
|
+
function modePart(root, context, extension) {
|
|
190
|
+
const mode = campaignMode(root, campaignWorld(root, context)).replace(" ", "-");
|
|
191
|
+
const part = extension.parts[mode]?.text;
|
|
192
|
+
return part === undefined ? {} : { part };
|
|
193
|
+
}
|
|
194
|
+
/** When the master can call the new commands: on the command line at once; in a chat, as the app in use hears new tools. */
|
|
195
|
+
function toolsNote(context) {
|
|
196
|
+
const host = context.host?.() ?? "";
|
|
197
|
+
if (context.host === undefined) {
|
|
198
|
+
return "";
|
|
199
|
+
}
|
|
200
|
+
if (/codex/i.test(host)) {
|
|
201
|
+
return "Codex sees them only once it is closed and opened again: tell the player.";
|
|
202
|
+
}
|
|
203
|
+
if (/claude-ai|claude desktop/i.test(host)) {
|
|
204
|
+
return "This app sees them only once it is closed and opened again: tell the player.";
|
|
205
|
+
}
|
|
206
|
+
return "They are yours from the player's next message.";
|
|
207
|
+
}
|
|
208
|
+
/** Takes an extension out of the campaign; it stays on this computer, for other campaigns. */
|
|
209
|
+
function removed(root, context, name) {
|
|
210
|
+
const listed = listedExtensions(root);
|
|
211
|
+
const found = Object.keys(listed).find((candidate) => candidate === name || comparableText(shortName(candidate)) === comparableText(name));
|
|
212
|
+
if (found === undefined) {
|
|
213
|
+
const names = Object.keys(listed).map(shortName);
|
|
214
|
+
throw new Error(`The campaign does not use ${name}${names.length === 0 ? ": it uses no package" : `; it uses ${names.join(", ")}`}. Nothing changed.`);
|
|
215
|
+
}
|
|
216
|
+
const rest = Object.fromEntries(Object.entries(listed).filter(([candidate]) => candidate !== found));
|
|
217
|
+
changeExtensions(root, rest);
|
|
218
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-removed", "public", { package: found }));
|
|
219
|
+
return { kind: "removed", name: shortName(found) };
|
|
220
|
+
}
|
|
@@ -4,6 +4,7 @@ import { checkWorld } from "../pages/index.js";
|
|
|
4
4
|
import { effectProblems } from "./game-effects.js";
|
|
5
5
|
import { eventProblems } from "./game-events.js";
|
|
6
6
|
import { experienceProblems } from "./game-experience.js";
|
|
7
|
+
import { campaignExtensions } from "./game-extension-list.js";
|
|
7
8
|
import { gridProblems } from "./game-grids.js";
|
|
8
9
|
import { imageProblems } from "./game-images.js";
|
|
9
10
|
import { mapProblems } from "./game-maps.js";
|
|
@@ -37,7 +38,8 @@ export function campaignProblems(root, world, context) {
|
|
|
37
38
|
...mapProblems(world),
|
|
38
39
|
...gridProblems(world, readOpenScene(root).scene),
|
|
39
40
|
...shortRoadProblems(world),
|
|
40
|
-
...timeProblems(root),
|
|
41
|
+
...timeProblems(root, context),
|
|
42
|
+
...campaignExtensions(root, context).problems,
|
|
41
43
|
...modeProblems(root),
|
|
42
44
|
...eventProblems(world),
|
|
43
45
|
...questProblems(world),
|
package/dist/commands/scene.d.ts
CHANGED
|
@@ -26,12 +26,12 @@ interface Saved {
|
|
|
26
26
|
export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
27
27
|
action: z.ZodEnum<{
|
|
28
28
|
next: "next";
|
|
29
|
-
open: "open";
|
|
30
29
|
add: "add";
|
|
31
|
-
|
|
30
|
+
close: "close";
|
|
31
|
+
open: "open";
|
|
32
32
|
order: "order";
|
|
33
|
+
now: "now";
|
|
33
34
|
hostile: "hostile";
|
|
34
|
-
close: "close";
|
|
35
35
|
leave: "leave";
|
|
36
36
|
calm: "calm";
|
|
37
37
|
}>;
|
package/dist/commands/sheet.js
CHANGED
|
@@ -430,7 +430,13 @@ function linkText(text) {
|
|
|
430
430
|
/** The items of a list that the game system does not take, by the names they are read as (SYS-8); none for a field without values. */
|
|
431
431
|
function wrongValues(system, field, value) {
|
|
432
432
|
const allowed = allowedValues(system, field);
|
|
433
|
-
|
|
433
|
+
// A text with closed names, as an alignment, is one name whole, commas and all.
|
|
434
|
+
const names = isTextField(system, field) ? (isEmptyField(value) ? [] : [String(value).trim()]) : listItemNames(value);
|
|
435
|
+
return allowed === undefined ? [] : names.filter((name) => !allowed.some((item) => comparableText(item) === comparableText(name)));
|
|
436
|
+
}
|
|
437
|
+
/** A field the system declares as text, such as alignment. */
|
|
438
|
+
function isTextField(system, field) {
|
|
439
|
+
return Object.entries(system?.fields ?? {}).some(([name, kind]) => kind === "text" && comparableText(name) === comparableText(field));
|
|
434
440
|
}
|
|
435
441
|
/** The names a list field takes in the game system (SYS-8); undefined for a field without values. */
|
|
436
442
|
function allowedValues(system, field) {
|
package/dist/commands/status.js
CHANGED
|
@@ -5,12 +5,13 @@ import { defineCommand } from "../core/registry.js";
|
|
|
5
5
|
import { isInParty, isPartyMember, locate, pagesWithName, parsePageReference } from "../pages/index.js";
|
|
6
6
|
import { bookTitles, readRuleBook } from "../rules/index.js";
|
|
7
7
|
import { sceneTypes } from "../scene/index.js";
|
|
8
|
-
import { formatGameDate } from "../time/index.js";
|
|
9
8
|
import { effectiveFields, effectsOf } from "./effect-layer.js";
|
|
10
9
|
import { effectShown, keptEffects } from "./game-effects.js";
|
|
11
10
|
import { surroundings, surroundingsText } from "./game-environment.js";
|
|
12
11
|
import { clocksToMove, dueAdvice, dueText, isDated, isDue, plannedEvents, plannedText, worldFacts } from "./game-events.js";
|
|
13
12
|
import { experienceOf, levelDueNote } from "./game-experience.js";
|
|
13
|
+
import { extensionsLine } from "./game-extension-list.js";
|
|
14
|
+
import { extensionCodeProblems } from "./game-extensions.js";
|
|
14
15
|
import { picturesNote } from "./game-images.js";
|
|
15
16
|
import { journeyText, readJourney } from "./game-journey.js";
|
|
16
17
|
import { campaignMode, campaignNote } from "./game-mode.js";
|
|
@@ -20,7 +21,7 @@ import { isTickedOpenQuest, openQuestText } from "./game-quests.js";
|
|
|
20
21
|
import { measuresOf, roadsOf } from "./game-roads.js";
|
|
21
22
|
import { interruptedLoad } from "./game-saves.js";
|
|
22
23
|
import { closedScenes, copyCounters, copyPage, partyAwayText, readOpenScene } from "./game-scene.js";
|
|
23
|
-
import { problemText, readPresent } from "./game-time.js";
|
|
24
|
+
import { datedText, problemText, readPresent } from "./game-time.js";
|
|
24
25
|
import { campaignSystem, campaignWorld, systemInStatus, systemSettingValue } from "./game-world.js";
|
|
25
26
|
import { countersText, pageCounters, partyCounters } from "./page-counters.js";
|
|
26
27
|
import { campaignProblems } from "./problems.js";
|
|
@@ -39,8 +40,9 @@ export const status = defineCommand({
|
|
|
39
40
|
readOnly: true,
|
|
40
41
|
alwaysLoad: true,
|
|
41
42
|
input: z.object({}),
|
|
42
|
-
run(input, context) {
|
|
43
|
+
async run(input, context) {
|
|
43
44
|
const root = requireCampaign(context.folder);
|
|
45
|
+
const codeProblems = await extensionCodeProblems(root, context, []);
|
|
44
46
|
const settings = readSettings(root);
|
|
45
47
|
const world = campaignWorld(root, context);
|
|
46
48
|
const characters = world.pages.filter((page) => page.type === "character");
|
|
@@ -105,6 +107,8 @@ export const status = defineCommand({
|
|
|
105
107
|
veils: settings.veils ?? [],
|
|
106
108
|
table: settings.table ?? [],
|
|
107
109
|
precedents: settings.precedents ?? [],
|
|
110
|
+
// The extensions it uses, each with what it brings (D-28).
|
|
111
|
+
extensions: extensionsLine(root, context),
|
|
108
112
|
houseRules: bookTitles(readRuleBook(join(root, houseRulesFolderName), "house rules")),
|
|
109
113
|
players: players.map(member),
|
|
110
114
|
companions: characters.filter((page) => page.fields.role === "companion").map(member),
|
|
@@ -124,13 +128,13 @@ export const status = defineCommand({
|
|
|
124
128
|
lastScenes: closed.slice(0, shownNames).map((scene) => `${scene.title} (${scene.type}): ${scene.summary}`),
|
|
125
129
|
sceneCounts: sceneCounts(closed),
|
|
126
130
|
openQuests: openQuests(world, now),
|
|
127
|
-
now: now === undefined ? undefined :
|
|
131
|
+
now: now === undefined ? undefined : datedText(root, context, now),
|
|
128
132
|
dateProblem: present.problem === undefined ? undefined : problemText(present.problem),
|
|
129
133
|
datedEvents: events.some(isDated),
|
|
130
134
|
dueEvents: due.map(dueText),
|
|
131
135
|
plannedEvents: events.filter((event) => !due.includes(event)).map((event) => plannedText(event, now)),
|
|
132
136
|
clocks: clocksToMove(world, now, facts),
|
|
133
|
-
problems: campaignProblems(root, world, context).length,
|
|
137
|
+
problems: campaignProblems(root, world, context).length + codeProblems.length,
|
|
134
138
|
// A load that stopped halfway leaves the campaign between two times (SAV-5).
|
|
135
139
|
halfLoaded: interruptedLoad(root)?.number,
|
|
136
140
|
sheet: system === undefined ? undefined : sheetSummary(system),
|
|
@@ -159,6 +163,7 @@ export const status = defineCommand({
|
|
|
159
163
|
boundariesLine(result.lines, result.veils),
|
|
160
164
|
result.table.length === 0 ? "" : `Table: ${result.table.join("; ")}`,
|
|
161
165
|
result.precedents.length === 0 ? "" : `Precedents: ${result.precedents.join("; ")}`,
|
|
166
|
+
result.extensions,
|
|
162
167
|
result.houseRules.length === 0 ? "" : `House rules (rules): ${result.houseRules.join(", ")}`,
|
|
163
168
|
timeLine(result),
|
|
164
169
|
...(result.players.length === 0 ? [`No player character yet.${sheetNote(result.sheet)}`] : result.players.map((member) => `PC: ${member.name}${whereabouts(member)}${memberCounters(member)}`)),
|
package/dist/commands/travel.js
CHANGED
|
@@ -6,6 +6,7 @@ import { directionHelp, directionName, distanceBetween, pointAlong, pointFrom, r
|
|
|
6
6
|
import { environmentAt, locate, pageNamed, parsePageReference } from "../pages/index.js";
|
|
7
7
|
import { addDuration, formatGameDate, minutesBetween } from "../time/index.js";
|
|
8
8
|
import { aroundLead, passedLines, passTime } from "./game-advance.js";
|
|
9
|
+
import { timePassedLines } from "./game-extensions.js";
|
|
9
10
|
import { journeyPoint, journeyStart, moversMap, moversNamed, moversPosition, readJourney, sameMovers, saveJourney, travelledSinceRest } from "./game-journey.js";
|
|
10
11
|
import { playerCharacter } from "./game-knowledge.js";
|
|
11
12
|
import { mapKey, mapOf } from "./game-maps.js";
|
|
@@ -36,7 +37,7 @@ export const travel = defineCommand({
|
|
|
36
37
|
pace: z.string().optional().describe("one of the game's paces, such as fast or slow, or a speed, such as 4.5 km; if left out, the game's usual pace, or the one the journey had"),
|
|
37
38
|
hours: z.union([z.number(), z.string()]).optional().describe("the hours of travel today, when they differ from the game's: more for a forced march, 24 for a ship with its crew, 8 for a boat the party rows"),
|
|
38
39
|
}),
|
|
39
|
-
run(input, context) {
|
|
40
|
+
async run(input, context) {
|
|
40
41
|
const root = requireCampaign(context.folder);
|
|
41
42
|
let world = campaignWorld(root, context);
|
|
42
43
|
const system = campaignSystem(root, context);
|
|
@@ -87,7 +88,8 @@ export const travel = defineCommand({
|
|
|
87
88
|
const around = point === undefined || plan.from === undefined ? [] : aroundLines(world, roads, plan.from, point, measures, plan.map?.path);
|
|
88
89
|
const merged = mergedTimes(walked.times);
|
|
89
90
|
// What holds around the player character where the journey ended, not where the last hour passed (ENV-5).
|
|
90
|
-
const
|
|
91
|
+
const extensionLines = merged === undefined ? [] : await timePassedLines(root, context, now, addDuration(now, merged.passed));
|
|
92
|
+
const time = merged === undefined ? undefined : { ...merged, around: merged.passed >= 60 ? aroundLead(world) : undefined, extensionLines };
|
|
91
93
|
// A passage's conditions are its page's text, the master's to judge (ROA-8).
|
|
92
94
|
const passages = (plan.passages ?? []).map((name) => `The way goes through ${name}, a passage to another map: read its page for when and how it opens.`);
|
|
93
95
|
return { ...told, reached: walked.reached, date: formatGameDate(date), travelled, hoursLeft: Math.max(0, plan.hours * 60 - travelled), ending, around, time, notes: [...passages, ...walked.notes] };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { requireCampaign } from "../campaign/index.js";
|
|
3
3
|
import { defineCommand } from "../core/registry.js";
|
|
4
|
+
import { extensionCodeProblems } from "./game-extensions.js";
|
|
4
5
|
import { campaignWorld } from "./game-world.js";
|
|
5
6
|
import { campaignProblems } from "./problems.js";
|
|
6
7
|
export const validate = defineCommand({
|
|
@@ -11,9 +12,10 @@ export const validate = defineCommand({
|
|
|
11
12
|
group: "game",
|
|
12
13
|
readOnly: true,
|
|
13
14
|
input: z.object({}),
|
|
14
|
-
run(input, context) {
|
|
15
|
+
async run(input, context) {
|
|
15
16
|
const root = requireCampaign(context.folder);
|
|
16
|
-
|
|
17
|
+
// And what keeps an extension's code from being used, which only loading it tells (D-441).
|
|
18
|
+
return { problems: [...campaignProblems(root, campaignWorld(root, context), context), ...await extensionCodeProblems(root, context, [])] };
|
|
17
19
|
},
|
|
18
20
|
format(result) {
|
|
19
21
|
if (result.problems.length === 0) {
|
package/dist/commands/view.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import type { Mood } from "../core/mood.ts";
|
|
3
3
|
import { type NotationPart, type ThrownDie } from "../dice/index.ts";
|
|
4
4
|
import { type SystemWords } from "../systems/index.ts";
|
|
5
|
+
import { type CalendarDay } from "../time/index.ts";
|
|
5
6
|
import { type PlayerSetting } from "./config.ts";
|
|
6
7
|
import { type SeenEffect } from "./game-effects.ts";
|
|
7
8
|
import { type Mode } from "./game-mode.ts";
|
|
@@ -81,6 +82,8 @@ export type ViewResult = {
|
|
|
81
82
|
attribution?: string;
|
|
82
83
|
};
|
|
83
84
|
now?: string;
|
|
85
|
+
/** The day of the calendar it is now, when the campaign has one (TIM-8). */
|
|
86
|
+
calendar?: CalendarDay;
|
|
84
87
|
/** The master's mood, which the robot shows, and their last moment, which the dashboard shows for a few seconds when it is new (MOOD-4, MOOD-6). */
|
|
85
88
|
master: {
|
|
86
89
|
mood: Mood;
|
|
@@ -184,6 +187,8 @@ export declare const view: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
184
187
|
attribution?: string;
|
|
185
188
|
};
|
|
186
189
|
now?: string;
|
|
190
|
+
/** The day of the calendar it is now, when the campaign has one (TIM-8). */
|
|
191
|
+
calendar?: CalendarDay;
|
|
187
192
|
/** The master's mood, which the robot shows, and their last moment, which the dashboard shows for a few seconds when it is new (MOOD-4, MOOD-6). */
|
|
188
193
|
master: {
|
|
189
194
|
mood: Mood;
|
package/dist/commands/view.js
CHANGED
|
@@ -23,7 +23,7 @@ import { lastMoment, livingMood, masterMood } from "./game-moods.js";
|
|
|
23
23
|
import { measuresOf } from "./game-roads.js";
|
|
24
24
|
import { campaignSaves, isPlayerDead, loadRefusal, loadRule, resetPoints, resetSave, saveMode, savesWhy, wentBackTo } from "./game-saves.js";
|
|
25
25
|
import { readOpenScene } from "./game-scene.js";
|
|
26
|
-
import { readPresent } from "./game-time.js";
|
|
26
|
+
import { calendarDayOf, readPresent } from "./game-time.js";
|
|
27
27
|
import { questText, shownJournal } from "./game-view-journal.js";
|
|
28
28
|
import { mapText, shownMap } from "./game-view-map.js";
|
|
29
29
|
import { dyingOf, sceneNames, seenEffect, shownPlace, shownScene, strangerImage } from "./game-view-place.js";
|
|
@@ -204,6 +204,7 @@ export const view = defineCommand({
|
|
|
204
204
|
const place = shownPlace(sight);
|
|
205
205
|
const openScene = shownScene(sight);
|
|
206
206
|
const settings = readSettings(root);
|
|
207
|
+
const today = now === undefined ? undefined : calendarDayOf(root, context, now.day);
|
|
207
208
|
const words = system === undefined || settings.language === undefined ? undefined : wordsOf(system, settings.language, context);
|
|
208
209
|
return {
|
|
209
210
|
kind: "overview",
|
|
@@ -212,6 +213,7 @@ export const view = defineCommand({
|
|
|
212
213
|
...(words === undefined ? {} : { words }),
|
|
213
214
|
...(system === undefined ? {} : { system: { name: system.name, title: system.title, ...(system.attribution === undefined ? {} : { attribution: system.attribution }) } }),
|
|
214
215
|
...(now === undefined ? {} : { now: formatGameDate(now) }),
|
|
216
|
+
...(today === undefined ? {} : { calendar: today }),
|
|
215
217
|
master: { mood: masterMood(root), ...(moment === undefined ? {} : { moment }) },
|
|
216
218
|
party: [pc, ...companions].map(member),
|
|
217
219
|
...(place === undefined ? {} : { place }),
|
package/dist/core/context.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ export interface Context {
|
|
|
22
22
|
signal?: AbortSignal;
|
|
23
23
|
/** The folders that hold the installed game systems, nearest first (SYS-1). */
|
|
24
24
|
systemFolders: string[];
|
|
25
|
+
/** The folders that hold the installed extensions, each a package folder or npm's node_modules (D-436); none where missing. */
|
|
26
|
+
extensionFolders?: string[];
|
|
27
|
+
/** The AI app the MCP server serves, by the name it gives itself, such as claude-code; missing on the command line. */
|
|
28
|
+
host?: () => string | undefined;
|
|
29
|
+
/** The command was typed by the player in their own terminal: their own hands, as the yes to a package not ours needs (D-441). */
|
|
30
|
+
terminal?: boolean;
|
|
31
|
+
/** npm on this computer, which installs the packages in the engine's own folder (D-436); missing where nothing installs, as in most tests. */
|
|
32
|
+
packages?: PackageManager;
|
|
25
33
|
/** The files as the MCP server keeps them for a whole session (D-137, D-193); without it, each call reads them afresh. */
|
|
26
34
|
files?: FileStore;
|
|
27
35
|
/** The parts of the instructions already given in this chat, which the MCP server keeps until instructions starts over (D-97); without it, every call gives them. */
|
|
@@ -49,6 +57,30 @@ export interface Context {
|
|
|
49
57
|
/** Codex and Claude Code on this computer, installed and signed in with the player's yes (D-424); missing outside the MCP server, as in tests. */
|
|
50
58
|
helpers?: Helpers;
|
|
51
59
|
}
|
|
60
|
+
/** A package for rpg-engine as npm or its folder describes it (D-439): its name, version and kind, and what it is. */
|
|
61
|
+
export interface PackageInfo {
|
|
62
|
+
name: string;
|
|
63
|
+
version: string;
|
|
64
|
+
/** What its package.json says it is for rpg-engine: extension, system…; undefined for a package that is not one. */
|
|
65
|
+
kind?: string;
|
|
66
|
+
/** The version of the extensions' API it is made for (D-441). */
|
|
67
|
+
api?: number;
|
|
68
|
+
description?: string;
|
|
69
|
+
}
|
|
70
|
+
/** npm for the packages (D-436): what one is before it is installed, installing it in the engine's folder without running its scripts, and the search. */
|
|
71
|
+
export interface PackageManager {
|
|
72
|
+
/** A package by its npm name, with a version or not, or by its folder; why not when there is none. */
|
|
73
|
+
describe(spec: string): Promise<PackageInfo | {
|
|
74
|
+
failed: string;
|
|
75
|
+
missing?: true;
|
|
76
|
+
}>;
|
|
77
|
+
/** Installs it: undefined once it is installed, else why not. */
|
|
78
|
+
install(spec: string): Promise<string | undefined>;
|
|
79
|
+
/** The packages for rpg-engine npm has, by their keyword and what their package.json says. */
|
|
80
|
+
search(): Promise<PackageInfo[] | {
|
|
81
|
+
failed: string;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
52
84
|
/** A program of this computer that writes and draws outside the chat, with the player's own login (D-424). */
|
|
53
85
|
export type HelperName = "codex" | "claude";
|
|
54
86
|
/** How a helper program stands: not on this computer, there without the player's login, signed in with an API key, which the engine never uses, or ready. */
|
|
@@ -138,3 +170,5 @@ export interface Player {
|
|
|
138
170
|
asking?(): boolean;
|
|
139
171
|
}
|
|
140
172
|
export declare function defaultContext(folder?: string): Context;
|
|
173
|
+
/** Where the engine installs the packages, with npm, on this computer (D-436): the player's local data, beside the programs it installs (D-425). */
|
|
174
|
+
export declare function packagesFolder(): string;
|
package/dist/core/context.js
CHANGED
|
@@ -13,11 +13,22 @@ export function defaultContext(folder = process.cwd()) {
|
|
|
13
13
|
platform: process.platform,
|
|
14
14
|
// From src/core/ and from dist/core/ alike, the package's systems/ folder is two levels up.
|
|
15
15
|
systemFolders: [fileURLToPath(new URL("../../systems/", import.meta.url))],
|
|
16
|
+
extensionFolders: [join(packagesFolder(), "node_modules")],
|
|
16
17
|
home: userDataFolder(),
|
|
17
18
|
// The built page is in dist/dashboard, two levels up from src/core/ and from dist/core/ alike.
|
|
18
19
|
pageFolder: fileURLToPath(new URL("../../dist/dashboard/", import.meta.url)),
|
|
19
20
|
};
|
|
20
21
|
}
|
|
22
|
+
/** Where the engine installs the packages, with npm, on this computer (D-436): the player's local data, beside the programs it installs (D-425). */
|
|
23
|
+
export function packagesFolder() {
|
|
24
|
+
const home = homedir();
|
|
25
|
+
if (process.platform === "win32") {
|
|
26
|
+
return join(process.env.LOCALAPPDATA || join(home, "AppData", "Local"), "rpg-engine", "packages");
|
|
27
|
+
}
|
|
28
|
+
return process.platform === "darwin"
|
|
29
|
+
? join(home, "Library", "Application Support", "rpg-engine", "packages")
|
|
30
|
+
: join(process.env.XDG_DATA_HOME || join(home, ".local", "share"), "rpg-engine", "packages");
|
|
31
|
+
}
|
|
21
32
|
/** Where this player's data is kept on this computer (D-406): the folder the system gives a program's data. */
|
|
22
33
|
function userDataFolder() {
|
|
23
34
|
const home = homedir();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A part of the master's instructions as a layer gives it: its text, and whether it takes the place of the layers below instead of adding to them (D-121). */
|
|
2
|
+
export interface InstructionPart {
|
|
3
|
+
text: string;
|
|
4
|
+
replace: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The parts of the master's instructions a package gives, a game system or an extension, from the files of its instructions folder: a part is named after its
|
|
8
|
+
* file (D-121). `owner` names the package in the error of a part that does not read, such as "The game system 5e".
|
|
9
|
+
*/
|
|
10
|
+
export declare function readParts(folder: string, owner: string): Record<string, InstructionPart>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { basename, join } from "node:path";
|
|
2
|
+
import { parse } from "yaml";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { files } from "./store.js";
|
|
5
|
+
/**
|
|
6
|
+
* The parts of the master's instructions a package gives, a game system or an extension, from the files of its instructions folder: a part is named after its
|
|
7
|
+
* file (D-121). `owner` names the package in the error of a part that does not read, such as "The game system 5e".
|
|
8
|
+
*/
|
|
9
|
+
export function readParts(folder, owner) {
|
|
10
|
+
const parts = {};
|
|
11
|
+
for (const path of files().files(join(folder, "instructions"), (file) => file.endsWith(".md"))) {
|
|
12
|
+
parts[basename(path, ".md")] = partOf(files().text(path) ?? "", owner, path);
|
|
13
|
+
}
|
|
14
|
+
return parts;
|
|
15
|
+
}
|
|
16
|
+
/** A part from its file: the text after its frontmatter, which says only whether it takes the place of the core's part, replace: true (D-121). */
|
|
17
|
+
function partOf(file, owner, path) {
|
|
18
|
+
const text = file.replace(/^/, "").replace(/\r\n/g, "\n");
|
|
19
|
+
const frontmatter = text.match(/^---\n([\s\S]*?)\n---(?:\n|$)/);
|
|
20
|
+
let settings;
|
|
21
|
+
try {
|
|
22
|
+
settings = frontmatter === null ? {} : (parse(frontmatter[1]) ?? {});
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
settings = undefined;
|
|
26
|
+
}
|
|
27
|
+
const parsed = z.object({ replace: z.boolean().optional() }).strict().safeParse(settings);
|
|
28
|
+
if (!parsed.success) {
|
|
29
|
+
throw new Error(`${owner} cannot be read, because ${path} is not valid: a part's frontmatter says only replace: true, for a part that takes the place of the core's.`);
|
|
30
|
+
}
|
|
31
|
+
return { text: (frontmatter === null ? text : text.slice(frontmatter[0].length)).trim(), replace: parsed.data.replace === true };
|
|
32
|
+
}
|
package/dist/core/store.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export declare class FileStore {
|
|
|
69
69
|
protected changed(path: string, now: {
|
|
70
70
|
text: string | undefined;
|
|
71
71
|
} | undefined, exists: boolean): void;
|
|
72
|
+
/** Forgets what it keeps of a folder's files and listings, and the values remembered from them, as after another program wrote there, npm installing a package (D-436). */
|
|
73
|
+
refresh(folder: string): void;
|
|
72
74
|
/** Forgets the values remembered from a file. */
|
|
73
75
|
protected forgetBuiltFrom(path: string): void;
|
|
74
76
|
}
|
package/dist/core/store.js
CHANGED
|
@@ -182,6 +182,14 @@ export class FileStore {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
+
/** Forgets what it keeps of a folder's files and listings, and the values remembered from them, as after another program wrote there, npm installing a package (D-436). */
|
|
186
|
+
refresh(folder) {
|
|
187
|
+
const root = resolve(folder);
|
|
188
|
+
const within = (path) => path === root || isInside(root, path);
|
|
189
|
+
[...this.kept.keys()].filter(within).forEach((path) => this.kept.delete(path));
|
|
190
|
+
[...this.listings.keys()].filter((path) => within(path) || isInside(path, root)).forEach((path) => this.listings.delete(path));
|
|
191
|
+
this.forgetBuiltFrom(root);
|
|
192
|
+
}
|
|
185
193
|
/** Forgets the values remembered from a file. */
|
|
186
194
|
forgetBuiltFrom(path) {
|
|
187
195
|
for (const [key, value] of this.remembered) {
|
package/dist/dashboard/app.js
CHANGED
|
@@ -96,6 +96,7 @@ function App() {
|
|
|
96
96
|
campaign: overview.kind === "overview" ? overview.campaign : undefined,
|
|
97
97
|
system: overview.kind === "overview" ? overview.system : undefined,
|
|
98
98
|
now: overview.kind === "overview" ? overview.now : undefined,
|
|
99
|
+
calendar: overview.kind === "overview" ? overview.calendar : undefined,
|
|
99
100
|
party,
|
|
100
101
|
chosen: member?.name,
|
|
101
102
|
headline: page?.kind === "page" ? page.headline : undefined,
|
|
@@ -188,7 +189,7 @@ function App() {
|
|
|
188
189
|
...(shown.noCharacter && !inSetup ? [{ kind: "info", text: t("There is no player character yet: the sheet comes when the master writes one.") }] : []),
|
|
189
190
|
...gameNotices(shown.problems),
|
|
190
191
|
];
|
|
191
|
-
return (_jsx(RequestedRoll.Provider, { value: requested, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system?.name, now: shown.now, path: shown.place === undefined ? undefined : [...shown.place.within, shown.place.name], live: live, mood: shown.masterMood, moment: moment, asleep: !live && shown.readAt !== undefined, section: address.section, fight: fight, yourTurn: yourTurn })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && shown.asked && _jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() }), inSetup ? _jsx(SetupView, { setup: setup }) : (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "combat" && shown.asked === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("combat"), children: [_jsx(Icon, { name: "combat" }), _jsx("span", { children: shown.openScene?.round === undefined ? t("Your turn") : `${t("Your turn")} · ${t("Round {round}", { round: shown.openScene.round })}` }), _jsx("span", { class: "turn-notice-go", children: t("Go to Combat") })] })), address.section === "party" && _jsx(PartyStrip, { party: shown.party, chosen: shown.chosen, scene: shown.openScene }), _jsxs("div", { class: "body", children: [_jsxs("main", { children: [address.section === "about" && _jsx(About, { product: productName, system: shown.system }), address.section === "help" && _jsx(Help, {}), (address.section === "scene" || address.section === "combat") && _jsx(FollowedQuest, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && _jsx(SceneView, { place: shown.place, scene: shown.openScene }), address.section === "combat" && (_jsx(CombatView, { scene: shown.openScene, map: shown.place?.map, place: shown.place?.name, lead: lead, party: shown.party, own: {
|
|
192
|
+
return (_jsx(RequestedRoll.Provider, { value: requested, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system?.name, now: shown.now, calendar: shown.calendar, path: shown.place === undefined ? undefined : [...shown.place.within, shown.place.name], live: live, mood: shown.masterMood, moment: moment, asleep: !live && shown.readAt !== undefined, section: address.section, fight: fight, yourTurn: yourTurn })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && shown.asked && _jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() }), inSetup ? _jsx(SetupView, { setup: setup }) : (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "combat" && shown.asked === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("combat"), children: [_jsx(Icon, { name: "combat" }), _jsx("span", { children: shown.openScene?.round === undefined ? t("Your turn") : `${t("Your turn")} · ${t("Round {round}", { round: shown.openScene.round })}` }), _jsx("span", { class: "turn-notice-go", children: t("Go to Combat") })] })), address.section === "party" && _jsx(PartyStrip, { party: shown.party, chosen: shown.chosen, scene: shown.openScene }), _jsxs("div", { class: "body", children: [_jsxs("main", { children: [address.section === "about" && _jsx(About, { product: productName, system: shown.system }), address.section === "help" && _jsx(Help, {}), (address.section === "scene" || address.section === "combat") && _jsx(FollowedQuest, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && _jsx(SceneView, { place: shown.place, scene: shown.openScene }), address.section === "combat" && (_jsx(CombatView, { scene: shown.openScene, map: shown.place?.map, place: shown.place?.name, lead: lead, party: shown.party, own: {
|
|
192
193
|
sheet: shown.chosen === lead?.name ? shown.sheet : [],
|
|
193
194
|
cards: shown.cards,
|
|
194
195
|
version: shown.version,
|