rpg-engine 0.20.0 → 0.21.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/dist/adventures/index.d.ts +1 -1
- package/dist/adventures/index.js +1 -1
- package/dist/adventures/source.d.ts +3 -0
- package/dist/adventures/source.js +11 -49
- package/dist/campaign/create-campaign.d.ts +1 -1
- package/dist/campaign/create-campaign.js +3 -2
- package/dist/campaign/find-campaign.d.ts +2 -0
- package/dist/campaign/find-campaign.js +2 -0
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.js +2 -2
- package/dist/commands/book.d.ts +16 -35
- package/dist/commands/book.js +86 -62
- package/dist/commands/config/config.js +1 -1
- package/dist/commands/config/dashboard.d.ts +2 -2
- package/dist/commands/config/dashboard.js +9 -3
- package/dist/commands/config/words.js +1 -1
- package/dist/commands/image.d.ts +5 -0
- package/dist/commands/image.js +6 -3
- package/dist/commands/package/data.d.ts +35 -0
- package/dist/commands/package/data.js +117 -0
- package/dist/commands/package/here.d.ts +7 -2
- package/dist/commands/package/here.js +23 -11
- package/dist/commands/package/install.js +14 -15
- package/dist/commands/package/language.d.ts +15 -0
- package/dist/commands/package/language.js +109 -0
- package/dist/commands/package/package.js +20 -10
- package/dist/commands/package/result.d.ts +19 -0
- package/dist/commands/package/theme.d.ts +13 -0
- package/dist/commands/package/theme.js +66 -0
- package/dist/commands/package/uninstall.d.ts +4 -1
- package/dist/commands/package/uninstall.js +29 -9
- package/dist/commands/scene/close.d.ts +1 -1
- package/dist/commands/scene/close.js +15 -8
- package/dist/commands/shared/books/adventures.d.ts +0 -4
- package/dist/commands/shared/books/adventures.js +2 -31
- package/dist/commands/shared/books/words.js +3 -2
- package/dist/commands/shared/campaign/book.d.ts +21 -8
- package/dist/commands/shared/campaign/book.js +65 -42
- package/dist/commands/shared/campaign/saves.js +2 -2
- package/dist/commands/shared/campaign/world.js +2 -1
- package/dist/commands/shared/packages/catalog.d.ts +3 -3
- package/dist/commands/shared/packages/catalog.js +98 -42
- package/dist/commands/shared/packages/unpacked.d.ts +50 -0
- package/dist/commands/shared/packages/unpacked.js +146 -0
- package/dist/core/archive.d.ts +13 -0
- package/dist/core/archive.js +76 -0
- package/dist/core/context.d.ts +2 -0
- package/dist/core/context.js +1 -0
- package/dist/core/store.d.ts +5 -1
- package/dist/core/store.js +15 -2
- package/dist/dashboard/api.js +24 -1
- package/dist/dashboard/app.js +7 -2
- package/dist/dashboard/guide/ar.md +8 -8
- package/dist/dashboard/guide/cs.md +8 -8
- package/dist/dashboard/guide/da.md +9 -9
- package/dist/dashboard/guide/de.md +8 -8
- package/dist/dashboard/guide/el.md +8 -8
- package/dist/dashboard/guide/en.md +7 -7
- package/dist/dashboard/guide/es.md +8 -8
- package/dist/dashboard/guide/fi.md +8 -8
- package/dist/dashboard/guide/fr.md +8 -8
- package/dist/dashboard/guide/he.md +8 -8
- package/dist/dashboard/guide/hi.md +8 -8
- package/dist/dashboard/guide/hu.md +8 -8
- package/dist/dashboard/guide/is.md +8 -8
- package/dist/dashboard/guide/it.md +8 -8
- package/dist/dashboard/guide/ja.md +8 -8
- package/dist/dashboard/guide/ko.md +8 -8
- package/dist/dashboard/guide/nb.md +9 -9
- package/dist/dashboard/guide/nl.md +8 -8
- package/dist/dashboard/guide/pl.md +8 -8
- package/dist/dashboard/guide/pt.md +8 -8
- package/dist/dashboard/guide/ro.md +8 -8
- package/dist/dashboard/guide/ru.md +9 -9
- package/dist/dashboard/guide/sv.md +8 -8
- package/dist/dashboard/guide/tr.md +8 -8
- package/dist/dashboard/guide/uk.md +9 -9
- package/dist/dashboard/guide/zh.md +8 -8
- package/dist/dashboard/i18n/ar.json +33 -5
- package/dist/dashboard/i18n/cs.json +33 -5
- package/dist/dashboard/i18n/da.json +33 -5
- package/dist/dashboard/i18n/de.json +33 -5
- package/dist/dashboard/i18n/el.json +33 -5
- package/dist/dashboard/i18n/es.json +33 -5
- package/dist/dashboard/i18n/fi.json +33 -5
- package/dist/dashboard/i18n/fr.json +33 -5
- package/dist/dashboard/i18n/he.json +33 -5
- package/dist/dashboard/i18n/hi.json +33 -5
- package/dist/dashboard/i18n/hu.json +33 -5
- package/dist/dashboard/i18n/is.json +33 -5
- package/dist/dashboard/i18n/it.json +33 -5
- package/dist/dashboard/i18n/ja.json +33 -5
- package/dist/dashboard/i18n/ko.json +33 -5
- package/dist/dashboard/i18n/nb.json +33 -5
- package/dist/dashboard/i18n/nl.json +33 -5
- package/dist/dashboard/i18n/pl.json +33 -5
- package/dist/dashboard/i18n/pt.json +33 -5
- package/dist/dashboard/i18n/ro.json +33 -5
- package/dist/dashboard/i18n/ru.json +33 -5
- package/dist/dashboard/i18n/sv.json +33 -5
- package/dist/dashboard/i18n/tr.json +33 -5
- package/dist/dashboard/i18n/uk.json +33 -5
- package/dist/dashboard/i18n/zh.json +33 -5
- package/dist/dashboard/journal/book.js +3 -2
- package/dist/dashboard/journal/journal.js +8 -5
- package/dist/dashboard/kit.js +1 -1
- package/dist/dashboard/packages/catalog.js +31 -14
- package/dist/dashboard/packages/engine.js +46 -2
- package/dist/dashboard/packages/installed.js +13 -0
- package/dist/dashboard/packages/outcomes.js +21 -0
- package/dist/dashboard/packages/packages.js +41 -18
- package/dist/dashboard/packages/rows.js +3 -1
- package/dist/dashboard/parts/icons.js +3 -0
- package/dist/dashboard/parts/picture.js +89 -0
- package/dist/dashboard/parts/refusals.js +8 -1
- package/dist/dashboard/parts/widgets.js +2 -1
- package/dist/dashboard/play/scene.js +8 -5
- package/dist/dashboard/settings/settings.js +23 -13
- package/dist/dashboard/sheet/party.js +5 -2
- package/dist/dashboard/sheet/sheet.js +2 -1
- package/dist/dashboard/shell/notices.js +2 -2
- package/dist/dashboard/shell/system-style.js +45 -12
- package/dist/dashboard/shell/tooltip.js +223 -0
- package/dist/dashboard/style.css +283 -132
- package/dist/dashboard/world/lore.js +4 -3
- package/dist/dashboard/world/place-card.js +2 -1
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/languages/pack.d.ts +4 -1
- package/dist/languages/pack.js +16 -5
- package/dist/packages/engine.d.ts +7 -0
- package/dist/packages/engine.js +32 -1
- package/dist/packages/index.d.ts +1 -1
- package/dist/packages/index.js +1 -1
- package/dist/server/dashboard/engine.d.ts +18 -0
- package/dist/server/dashboard/engine.js +31 -0
- package/dist/server/dashboard/files.d.ts +8 -1
- package/dist/server/dashboard/files.js +30 -10
- package/dist/server/dashboard/index.d.ts +3 -0
- package/dist/server/dashboard/index.js +10 -1
- package/dist/server/dashboard/pictures.d.ts +7 -0
- package/dist/server/dashboard/pictures.js +62 -0
- package/dist/server/dashboard/writes.d.ts +5 -3
- package/dist/server/dashboard/writes.js +45 -14
- package/dist/testing/index.js +1 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +4 -2
- package/dist/themes/installed.d.ts +14 -0
- package/dist/themes/installed.js +28 -0
- package/dist/themes/theme.d.ts +7 -0
- package/dist/themes/theme.js +22 -0
- package/instructions/core.md +3 -3
- package/instructions/dashboard-guide.md +1 -0
- package/instructions/mentor-hints.md +1 -1
- package/instructions/mentor-tutorial.md +1 -1
- package/instructions/party.md +1 -1
- package/instructions/play.md +2 -2
- package/package.json +1 -1
- package/systems/free/instructions/outcomes-told.md +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// A theme of the dashboard as a package of its own: unpacked for every campaign on this computer, checked as a game system's theme is, listed and taken away
|
|
2
|
+
// by its name or its id. Data alone, so no player's yes.
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { topFile } from "../../core/archive.js";
|
|
5
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
6
|
+
import { Refusal } from "../../core/refusal.js";
|
|
7
|
+
import { files } from "../../core/store.js";
|
|
8
|
+
import { readTheme, themeFileName, themeFilesNamed, themeId } from "../../themes/index.js";
|
|
9
|
+
import { keptFiles, placeTrial, themesFolder, themesHere, writeTrial } from "../shared/packages/unpacked.js";
|
|
10
|
+
import { newDatedLogEntry } from "../shared/time/time.js";
|
|
11
|
+
// A licence at a theme's top, beside the files its theme.yaml names.
|
|
12
|
+
const licence = /^(licen[cs]e|copying)(\.(md|txt))?$/i;
|
|
13
|
+
/**
|
|
14
|
+
* Installs a theme for every campaign on this computer, in the folder of its id, taking the place of one with the same; refused whole when it fails a check.
|
|
15
|
+
* It keeps its theme.yaml, the files that names and a licence at its top: nothing else a repository holds.
|
|
16
|
+
*/
|
|
17
|
+
export function themeInstalled(root, context, data) {
|
|
18
|
+
const folder = themesFolder(context);
|
|
19
|
+
if (folder === undefined) {
|
|
20
|
+
throw new Error("Themes are installed only by the game's server or the command line, which keep them for every campaign on this computer.");
|
|
21
|
+
}
|
|
22
|
+
const named = new Set(themeFilesNamed(new TextDecoder().decode(topFile(data.entries, themeFileName)?.[1] ?? new Uint8Array())));
|
|
23
|
+
const keep = (parts) => isThemeYaml(parts) || named.has(parts.join("/")) || (parts.length === 1 && licence.test(parts[0]));
|
|
24
|
+
const kept = keptFiles(data.label, data.entries, keep, "theme-refused", "a theme").map(([parts, bytes]) => [isThemeYaml(parts) ? [themeFileName] : parts, bytes]);
|
|
25
|
+
// Checked where it is written, in a folder of its own that no list reads, then put where its id puts it.
|
|
26
|
+
const trial = writeTrial(folder, context, kept, data.source);
|
|
27
|
+
try {
|
|
28
|
+
const reading = readTheme(trial);
|
|
29
|
+
if (reading.theme === undefined) {
|
|
30
|
+
const why = reading.problems.map((problem) => problem.replaceAll(trial, data.label)).join("; ");
|
|
31
|
+
throw new Refusal(`${data.label} is no theme the dashboard can use: ${why}. Nothing changed.`, "theme-refused", { name: data.label, why });
|
|
32
|
+
}
|
|
33
|
+
const theme = reading.theme;
|
|
34
|
+
const id = themeId(theme.name);
|
|
35
|
+
const before = themesHere(context).find((one) => one.id === id);
|
|
36
|
+
placeTrial(trial, join(folder, id), context);
|
|
37
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-installed", "public", { package: id, version: theme.version ?? "", verified: false, kind: "theme" }));
|
|
38
|
+
return {
|
|
39
|
+
kind: "theme-installed",
|
|
40
|
+
theme: { id, name: theme.name, ...(theme.version === undefined ? {} : { version: theme.version }) },
|
|
41
|
+
...(before === undefined ? {} : { replaced: { name: before.theme?.name ?? before.id, ...(before.theme?.version === undefined ? {} : { version: before.theme.version }) } }),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
files().removeFolder(trial);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Takes an installed theme off this computer. */
|
|
49
|
+
export function themeUninstalled(root, context, found) {
|
|
50
|
+
files().removeFolder(found.folder);
|
|
51
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-uninstalled", "public", { package: found.id, kind: "theme" }));
|
|
52
|
+
return { kind: "uninstalled", name: found.theme?.name ?? found.id, wasUsed: false, extension: false };
|
|
53
|
+
}
|
|
54
|
+
/** The themes on this computer as list gives them: each with its id, and why one is not offered while it fails a check. */
|
|
55
|
+
export function themesListed(context) {
|
|
56
|
+
return themesHere(context).map((one) => ({
|
|
57
|
+
id: one.id,
|
|
58
|
+
name: one.theme?.name ?? one.id,
|
|
59
|
+
...(one.theme?.version === undefined ? {} : { version: one.theme.version }),
|
|
60
|
+
...(one.problems.length === 0 ? {} : { problems: one.problems }),
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
/** Whether a path of a package is its theme.yaml, at its top, in any case. */
|
|
64
|
+
function isThemeYaml(parts) {
|
|
65
|
+
return parts.length === 1 && parts[0].toLowerCase() === themeFileName;
|
|
66
|
+
}
|
|
@@ -2,5 +2,8 @@ import type { Context } from "../../core/context.ts";
|
|
|
2
2
|
import type { PackageResult } from "./result.ts";
|
|
3
3
|
/** Takes an extension out of the campaign; it stays on this computer, for other campaigns. */
|
|
4
4
|
export declare function removed(root: string, context: Context, name: string): PackageResult;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Takes a package off this computer with npm, and out of the campaign when it uses it (D-442); other campaigns that list it ask to install it again. A theme
|
|
7
|
+
* or a language of data alone goes by its folder, when no npm package has its name: theme:<id> and language:<code> name them alone.
|
|
8
|
+
*/
|
|
6
9
|
export declare function uninstalled(root: string, context: Context, name: string): Promise<PackageResult>;
|
|
@@ -8,8 +8,11 @@ import { comparableText } from "../../core/text.js";
|
|
|
8
8
|
import { dropConsent, installedExtensions, shortName } from "../../extensions/index.js";
|
|
9
9
|
import { isPackageName } from "../../packages/index.js";
|
|
10
10
|
import { listedExtensions } from "../shared/packages/extensions.js";
|
|
11
|
+
import { findUnpacked, unpackedName } from "../shared/packages/unpacked.js";
|
|
11
12
|
import { newDatedLogEntry } from "../shared/time/time.js";
|
|
12
13
|
import { installedExtensionFolder, languagesHere, systemsHere } from "./here.js";
|
|
14
|
+
import { dataLanguageUninstalled } from "./language.js";
|
|
15
|
+
import { themeUninstalled } from "./theme.js";
|
|
13
16
|
/** Takes an extension out of the campaign; it stays on this computer, for other campaigns. */
|
|
14
17
|
export function removed(root, context, name) {
|
|
15
18
|
const listed = listedExtensions(root);
|
|
@@ -23,20 +26,37 @@ export function removed(root, context, name) {
|
|
|
23
26
|
appendLogEntry(root, newDatedLogEntry(root, context, "package-removed", "public", { package: found }));
|
|
24
27
|
return { kind: "removed", name: shortName(found) };
|
|
25
28
|
}
|
|
26
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Takes a package off this computer with npm, and out of the campaign when it uses it (D-442); other campaigns that list it ask to install it again. A theme
|
|
31
|
+
* or a language of data alone goes by its folder, when no npm package has its name: theme:<id> and language:<code> name them alone.
|
|
32
|
+
*/
|
|
27
33
|
export async function uninstalled(root, context, name) {
|
|
28
34
|
const packages = context.packages;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
const npmName = name.startsWith("npm:") ? name.slice(4) : name;
|
|
36
|
+
const unpacked = findUnpacked(context, name);
|
|
37
|
+
const system = systemsHere(root, context).find((one) => one.package !== undefined && (one.package === npmName || comparableText(one.name) === comparableText(npmName)));
|
|
38
|
+
const other = system?.package
|
|
39
|
+
?? languagesHere(context).find((one) => one.unpacked !== true && (one.package === npmName || comparableText(one.code) === comparableText(npmName)))?.package;
|
|
34
40
|
const found = other === undefined
|
|
35
|
-
? installedExtensions(context.extensionFolders ?? []).find((one) => one.package ===
|
|
41
|
+
? installedExtensions(context.extensionFolders ?? []).find((one) => one.package === npmName || comparableText(shortName(one.package)) === comparableText(npmName))
|
|
36
42
|
: { package: other };
|
|
37
43
|
// A package that reads as nothing, as a system whose system.yaml is broken, is still npm's to take away by its folder, under its npm name.
|
|
38
|
-
const
|
|
39
|
-
|
|
44
|
+
const unread = found === undefined && packages !== undefined && isPackageName(npmName)
|
|
45
|
+
&& (context.extensionFolders ?? []).some((folder) => files().entries(join(folder, ...npmName.split("/"))).length > 0);
|
|
46
|
+
const npm = unpacked !== undefined && /^(theme|language):/i.test(name) ? undefined : (found?.package ?? (unread ? npmName : undefined));
|
|
47
|
+
// A theme or a language of data alone goes only when no npm package has its name; when both have it, the player says which.
|
|
48
|
+
if (unpacked !== undefined && npm !== undefined) {
|
|
49
|
+
const npmAs = npm.startsWith("@") ? npm : `npm:${npm}`;
|
|
50
|
+
throw new Refusal(`${name} names two packages on this computer: ${npm} from npm, and the ${unpacked.kind} ${unpacked.kind === "theme" ? (unpacked.theme.theme?.name ?? unpacked.theme.id) : unpacked.pack.name}. `
|
|
51
|
+
+ `Say which: ${npmAs} for the one from npm, ${unpackedName(unpacked)} for the ${unpacked.kind}. Nothing changed.`, "ambiguous-name", { name, npm: npmAs, unpacked: unpackedName(unpacked) });
|
|
52
|
+
}
|
|
53
|
+
if (unpacked !== undefined) {
|
|
54
|
+
return unpacked.kind === "theme" ? themeUninstalled(root, context, unpacked.theme) : dataLanguageUninstalled(root, context, unpacked.pack);
|
|
55
|
+
}
|
|
56
|
+
if (system?.used === true) {
|
|
57
|
+
throw new Refusal(`The campaign plays ${system.name}: it stays on this computer. Nothing changed.`, "system-played", { name: system.name });
|
|
58
|
+
}
|
|
59
|
+
if (unread && packages !== undefined) {
|
|
40
60
|
const why = await packages.uninstall(npmName);
|
|
41
61
|
if (why !== undefined) {
|
|
42
62
|
throw new Refusal(`${npmName} could not be taken off this computer: ${why}. Nothing changed.`, "uninstall-failed", { name: npmName, why });
|
|
@@ -5,7 +5,7 @@ import { readCounter } from "../../counters/index.js";
|
|
|
5
5
|
import { findPage, isPartyMember, linksIn, pagesWithName, parsePageReference } from "../../pages/index.js";
|
|
6
6
|
import { sceneTypes } from "../../scene/index.js";
|
|
7
7
|
import { formatGameDate } from "../../time/index.js";
|
|
8
|
-
import { chapterCraft,
|
|
8
|
+
import { chapterCraft, scenesPerChapter, scenesText, untoldScenes } from "../shared/campaign/book.js";
|
|
9
9
|
import { firstInChat } from "../shared/campaign/parts.js";
|
|
10
10
|
import { isTickedOpenQuest, tickedQuestNote } from "../shared/campaign/quests.js";
|
|
11
11
|
import { isPlayerDead, makeSave, saveText } from "../shared/campaign/saves.js";
|
|
@@ -77,10 +77,10 @@ export function close(root, world, summary, context) {
|
|
|
77
77
|
...saved,
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
/** The
|
|
80
|
+
/** The closed scenes that wait for the book's next chapter, for the master to write it where the story turns, with how to write it once in a chat (T-227). */
|
|
81
81
|
function bookChapter(root, context) {
|
|
82
|
-
const
|
|
83
|
-
return
|
|
82
|
+
const untold = untoldScenes(root).map((scene) => scene.number);
|
|
83
|
+
return untold.length === 0 ? {} : { untold, ...(firstInChat(context, "book") ? { craft: chapterCraft } : {}) };
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* The save at the end of a scene, named by its title (D-55, SAV-3): none while the player character is dead, since going back is what one is for. A save that
|
|
@@ -172,7 +172,7 @@ export function closedText(result) {
|
|
|
172
172
|
const advance = "Advance any time it took that you have not advanced yet; write on their pages what it changed for good, such as a fire put out or a door broken.";
|
|
173
173
|
const endless = result.endless.length === 0 ? "" : `\nStill there, with no end: ${result.endless.join(" · ")}. End those the scene ended, with effect end.`;
|
|
174
174
|
const ended = `${result.ended.length === 0 ? "" : `\nEnded with the scene: ${result.ended.join(" · ")}.`}${endless}`;
|
|
175
|
-
const quests = `${result.quests.map((line) => `\n${line}`).join("")}${chapterLine(result.
|
|
175
|
+
const quests = `${result.quests.map((line) => `\n${line}`).join("")}${chapterLine(result.untold, result.craft)}`;
|
|
176
176
|
if (result.unreadable !== undefined) {
|
|
177
177
|
return `The open scene could not be read (${result.unreadable}): closed it, without its copies. ${advance}${ended}${quests}${saved}`;
|
|
178
178
|
}
|
|
@@ -186,7 +186,14 @@ export function closedText(result) {
|
|
|
186
186
|
const peak = result.afterPeak === undefined ? "" : `\n${result.afterPeak}`;
|
|
187
187
|
return `Scene closed${rounds}: ${result.title}.${gone} ${advance}${ended}${left}${fallen}${rewards}${quests}${peak}${saved}`;
|
|
188
188
|
}
|
|
189
|
-
/** The book's chapter
|
|
190
|
-
function chapterLine(
|
|
191
|
-
|
|
189
|
+
/** The scenes the book's next chapter waits for (T-227): written now where the story turns, and once they are many. */
|
|
190
|
+
function chapterLine(untold, craft) {
|
|
191
|
+
if (untold === undefined) {
|
|
192
|
+
return "";
|
|
193
|
+
}
|
|
194
|
+
const scenes = scenesText(untold.map((number) => ({ number })));
|
|
195
|
+
const when = untold.length >= scenesPerChapter
|
|
196
|
+
? "write it now with book."
|
|
197
|
+
: "if the story turned here (a goal reached or lost, a place left, a night passed), write it now with book, while the scenes are fresh; else at a later scene's end.";
|
|
198
|
+
return `\nThe book: ${scenes} ${untold.length === 1 ? "waits" : "wait"} for the next chapter; ${when}${craft === undefined ? "" : ` ${craft}`}`;
|
|
192
199
|
}
|
|
@@ -63,10 +63,6 @@ export interface AdventureExported {
|
|
|
63
63
|
/** The pages and layers written from the player's documents (source:), when no license was given: the zip keeps them to the player. */
|
|
64
64
|
sourced?: string[];
|
|
65
65
|
}
|
|
66
|
-
/** Whether what was given to package install is an adventure: a .zip, a link, or a folder with adventure.yaml; a document says it is imported instead. */
|
|
67
|
-
export declare function isAdventureSpec(spec: string): boolean;
|
|
68
|
-
/** The adventure a .zip, a folder or an https link gives (ADV-1): a GitHub repository is read as the zip of its branch. */
|
|
69
|
-
export declare function readAdventureSpec(spec: string, context: Context): Promise<AdventureFiles>;
|
|
70
66
|
/** The adventures the log says are installed and not taken out, in the order they came (ADV-6): they go back with a save. */
|
|
71
67
|
export declare function installedAdventures(root: string): InstalledAdventure[];
|
|
72
68
|
/** Installs an adventure in the campaign (ADV-2–ADV-5): checked whole, then written, or nothing at all; installed again, it finishes what stopped. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The adventures of a campaign (D-476, D-483): installed from a package whole or not at all, taken out while the story has not touched them, and exported as
|
|
2
2
|
// they were at the start (ADV-1–ADV-7), with the campaign's layers over its game system as they are now (ADV-8).
|
|
3
|
-
import { basename, join, relative,
|
|
3
|
+
import { basename, join, relative, sep } from "node:path";
|
|
4
4
|
import { parse, parseDocument, stringify, visit } from "yaml";
|
|
5
|
-
import { adventureFolderName, adventureTarget,
|
|
5
|
+
import { adventureFolderName, adventureTarget, manifestLine, packAdventure } from "../../../adventures/index.js";
|
|
6
6
|
import { houseRulesFolderName, readSettings } from "../../../campaign/index.js";
|
|
7
7
|
import { appendLogEntry, readLog } from "../../../core/log.js";
|
|
8
8
|
import { Refusal } from "../../../core/refusal.js";
|
|
@@ -26,35 +26,6 @@ import { houseRules, systemRuleBook } from "./rules.js";
|
|
|
26
26
|
const changesMade = "Changes were made: the files under layers/ modify pages the game system adapted from that material.";
|
|
27
27
|
// The mark of an install under way, with its title and the days it moves dates by: while it is there, installing the same adventure finishes it (ADV-5).
|
|
28
28
|
const installMarkName = ".adventure-install.yaml";
|
|
29
|
-
// The documents a master imports, never a package: their pages are written by the master (D-483 (10)).
|
|
30
|
-
const documentPattern = /\.(pdf|docx?|odt|rtf|txt|md|epub)$/i;
|
|
31
|
-
/** Whether what was given to package install is an adventure: a .zip, a link, or a folder with adventure.yaml; a document says it is imported instead. */
|
|
32
|
-
export function isAdventureSpec(spec) {
|
|
33
|
-
if (documentPattern.test(spec)) {
|
|
34
|
-
throw new Refusal(`${spec} is a document, not a package: make an adventure from it with import; package install takes only what has adventure.yaml. Nothing changed.`, "document", { name: spec });
|
|
35
|
-
}
|
|
36
|
-
return /\.zip$/i.test(spec) || /^https:\/\//i.test(spec) || isAdventureFolder(resolve(spec));
|
|
37
|
-
}
|
|
38
|
-
/** The adventure a .zip, a folder or an https link gives (ADV-1): a GitHub repository is read as the zip of its branch. */
|
|
39
|
-
export async function readAdventureSpec(spec, context) {
|
|
40
|
-
if (/^https:\/\//i.test(spec)) {
|
|
41
|
-
if (context.download === undefined) {
|
|
42
|
-
throw new Error("Only the game's server and the command line download an adventure: give a .zip or a folder of this computer.");
|
|
43
|
-
}
|
|
44
|
-
const repository = /^https:\/\/github\.com\/([^/]+)\/([^/#?]+?)(?:\.git)?(?:\/tree\/([^#?]+))?\/?$/i.exec(spec);
|
|
45
|
-
const url = repository === null ? spec : `https://codeload.github.com/${repository[1]}/${repository[2]}/zip/${repository[3] === undefined ? "HEAD" : `refs/heads/${repository[3]}`}`;
|
|
46
|
-
return readAdventureZip(await context.download(url, largestAdventure, context.signal), spec);
|
|
47
|
-
}
|
|
48
|
-
const path = resolve(spec);
|
|
49
|
-
if (/\.zip$/i.test(spec)) {
|
|
50
|
-
const bytes = files().bytes(path);
|
|
51
|
-
if (bytes === undefined) {
|
|
52
|
-
throw new Refusal(`There is no file ${path}: give the path of the adventure's .zip. Nothing changed.`, "not-on-computer", { name: path });
|
|
53
|
-
}
|
|
54
|
-
return readAdventureZip(bytes, basename(path));
|
|
55
|
-
}
|
|
56
|
-
return readAdventureFolder(path);
|
|
57
|
-
}
|
|
58
29
|
/** The adventures the log says are installed and not taken out, in the order they came (ADV-6): they go back with a save. */
|
|
59
30
|
export function installedAdventures(root) {
|
|
60
31
|
return adventuresOfLog(readLog(root));
|
|
@@ -8,6 +8,7 @@ import { codeAndBase } from "../../../core/language.js";
|
|
|
8
8
|
import { files } from "../../../core/store.js";
|
|
9
9
|
import { languagePackFor, packPhrases } from "../../../languages/index.js";
|
|
10
10
|
import { layeredSystemWords, systemContentFolders, systemWords } from "../../../systems/index.js";
|
|
11
|
+
import { languageFolders } from "../packages/unpacked.js";
|
|
11
12
|
// How many phrases go in one request.
|
|
12
13
|
const batchSize = 130;
|
|
13
14
|
// How long a language whose translation stopped short waits before it is tried again, so that a writer that fails is not called at every reading.
|
|
@@ -51,7 +52,7 @@ export function pageTranslator(context, page, notify) {
|
|
|
51
52
|
return {
|
|
52
53
|
read: (language, system) => {
|
|
53
54
|
// A translation made by hand, installed as a package, comes before the one made on the fly (D-485 (3)).
|
|
54
|
-
const pack = languagePackFor(context
|
|
55
|
+
const pack = languagePackFor(languageFolders(context), language);
|
|
55
56
|
const own = { ...(context.home === undefined ? {} : readJson(join(context.home, "i18n", `${language}.json`))), ...(pack === undefined ? {} : packPhrases(pack)) };
|
|
56
57
|
const missing = Object.keys(reference()).filter((phrase) => !(phrase in own)).length;
|
|
57
58
|
const can = context.writer?.ready() === true && context.home !== undefined;
|
|
@@ -85,7 +86,7 @@ export function pagePhrase(context, language, phrase) {
|
|
|
85
86
|
}
|
|
86
87
|
const page = context.pageFolder;
|
|
87
88
|
const codes = codeAndBase(language);
|
|
88
|
-
const pack = languagePackFor(context
|
|
89
|
+
const pack = languagePackFor(languageFolders(context), language);
|
|
89
90
|
const shipped = [...codes, codes.at(-1) === "no" ? "nb" : ""].filter((candidate) => candidate !== "").map((candidate) => readJson(join(page, "i18n", `${candidate}.json`)));
|
|
90
91
|
const own = context.home === undefined ? {} : readJson(join(context.home, "i18n", `${language}.json`));
|
|
91
92
|
return [pack === undefined ? {} : packPhrases(pack), ...shipped, own].map((phrases) => phrases[phrase]).find((said) => typeof said === "string" && said !== "") ?? phrase;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** A scene of the story
|
|
2
|
-
export interface
|
|
1
|
+
/** A scene of the story: its number, as the journal counts them, its title and summary, its game date, when it ran in real time, and the log line that opened it. */
|
|
2
|
+
export interface StoryScene {
|
|
3
3
|
number: number;
|
|
4
4
|
title: string;
|
|
5
5
|
summary?: string;
|
|
@@ -15,15 +15,28 @@ export interface BookChapter {
|
|
|
15
15
|
title: string;
|
|
16
16
|
text: string;
|
|
17
17
|
}
|
|
18
|
+
/** A chapter with the scenes it tells, by their numbers, first and last. */
|
|
19
|
+
export interface WrittenChapter extends BookChapter {
|
|
20
|
+
first: number;
|
|
21
|
+
last: number;
|
|
22
|
+
}
|
|
23
|
+
/** How many closed scenes may wait for their chapter before the master is told to write it now. */
|
|
24
|
+
export declare const scenesPerChapter = 4;
|
|
18
25
|
/** How the master writes a chapter (T-227): told once in a chat, by the first scene that closes or the first call of book. */
|
|
19
26
|
export declare const chapterCraft: string;
|
|
20
27
|
/** The scenes of the story in order, by the public lines of the log, as the journal numbers them: a scene closed with no line that opened it is one too. */
|
|
21
|
-
export declare function
|
|
22
|
-
/** The chapters of the book whose scenes are in the story as it stands, in order. */
|
|
23
|
-
export declare function campaignBook(root: string):
|
|
24
|
-
/**
|
|
25
|
-
export declare function
|
|
28
|
+
export declare function storyScenes(root: string): StoryScene[];
|
|
29
|
+
/** The chapters of the book whose scenes are in the story as it stands, in order: each going on from the one before, the first from the first scene. */
|
|
30
|
+
export declare function campaignBook(root: string): WrittenChapter[];
|
|
31
|
+
/** The closed scenes no chapter tells yet, in order: those the next chapter is for. */
|
|
32
|
+
export declare function untoldScenes(root: string, book?: WrittenChapter[]): StoryScene[];
|
|
33
|
+
/** Writes a chapter telling these scenes, in place of the one with its number. */
|
|
34
|
+
export declare function writeChapter(root: string, number: number, scenes: StoryScene[], title: string, text: string): void;
|
|
26
35
|
/** Takes a chapter out of the book; nothing when it has none. */
|
|
27
36
|
export declare function removeChapter(root: string, number: number): void;
|
|
28
|
-
/** What status says of a book left behind, by a chat closed or a computer turned off: the
|
|
37
|
+
/** What status says of a book left behind, by a chat closed or a computer turned off: the scenes waiting too long for their chapter, once the book has begun. */
|
|
29
38
|
export declare function bookBehind(root: string): string | undefined;
|
|
39
|
+
/** Scenes by their numbers, as «scene 4» or «scenes 4–7». */
|
|
40
|
+
export declare function scenesText(scenes: {
|
|
41
|
+
number: number;
|
|
42
|
+
}[]): string;
|
|
@@ -1,59 +1,74 @@
|
|
|
1
|
-
// The campaign's story told as a book (T-227):
|
|
2
|
-
//
|
|
1
|
+
// The campaign's story told as a book (T-227): chapters of prose written by the master into book/, out of the saves, each telling the closed scenes since the one
|
|
2
|
+
// before, ended where the story turns. A chapter holds its scenes by the log lines that opened them: one whose scenes a load undid, or that a reset took away, is
|
|
3
|
+
// left out, with those after it, until the master writes it again.
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import { parse, stringify } from "yaml";
|
|
5
6
|
import { bookFolderName } from "../../../campaign/index.js";
|
|
6
7
|
import { readLog } from "../../../core/log.js";
|
|
7
8
|
import { files } from "../../../core/store.js";
|
|
9
|
+
/** How many closed scenes may wait for their chapter before the master is told to write it now. */
|
|
10
|
+
export const scenesPerChapter = 4;
|
|
8
11
|
/** How the master writes a chapter (T-227): told once in a chat, by the first scene that closes or the first call of book. */
|
|
9
12
|
export const chapterCraft = "How to write a chapter: as a chapter of a novel, never a summary or a report. In the campaign's language, third person with an outside narrator, in the prose style the player chose: "
|
|
10
|
-
+ "its voice binds the book, its limits on length and its endings in play do not.
|
|
13
|
+
+ "its voice binds the book, its limits on length and its endings in play do not. A chapter tells the scenes closed since the last one, ended where the story turns: a goal reached or lost, a place left, a night passed. "
|
|
14
|
+
+ "Pick up where the last chapter left off (book with its number reads it back), without retelling it. "
|
|
11
15
|
+ "Tell it in scenes: places, gestures, silences, and people's words as dialogue where they mattered; summary only for roads and time passing. "
|
|
12
16
|
+ "The player character does and says only what the player played: their words may be put better, never a deed, a line or a choice of yours added. "
|
|
13
17
|
+ "Only what the player saw and learned: no secret, no hidden roll, nothing you planned, no conclusion they did not reach. No game words: no rolls, points, turns, nor a condition by its game name. "
|
|
14
|
-
+ "As long as
|
|
18
|
+
+ "As long as its scenes deserve, from about 1500 words to 4000: a short scene a page of it, a great one most of it; end on an image or a line, never on a question to the player. "
|
|
15
19
|
+ "Paragraphs apart by a blank line, *italics* where a voice or a thought needs them, *** alone on a line for a break within the chapter.";
|
|
16
20
|
/** The scenes of the story in order, by the public lines of the log, as the journal numbers them: a scene closed with no line that opened it is one too. */
|
|
17
|
-
export function
|
|
18
|
-
const
|
|
21
|
+
export function storyScenes(root) {
|
|
22
|
+
const scenes = [];
|
|
19
23
|
let open;
|
|
20
24
|
for (const entry of readLog(root).filter((line) => line.visibility === "public")) {
|
|
21
25
|
if (entry.type !== "scene-opened" && entry.type !== "scene-closed") {
|
|
22
26
|
continue;
|
|
23
27
|
}
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
number:
|
|
28
|
+
const known = entry.type === "scene-opened" ? undefined : open;
|
|
29
|
+
const scene = known ?? {
|
|
30
|
+
number: scenes.length + 1,
|
|
27
31
|
title: String(entry.data.title ?? ""),
|
|
28
32
|
...(entry.date === undefined ? {} : { date: entry.date }),
|
|
29
33
|
from: entry.at,
|
|
30
34
|
scene: entry.id,
|
|
31
35
|
};
|
|
32
|
-
if (
|
|
33
|
-
|
|
36
|
+
if (known === undefined) {
|
|
37
|
+
scenes.push(scene);
|
|
34
38
|
}
|
|
35
39
|
if (entry.type === "scene-opened") {
|
|
36
|
-
open =
|
|
40
|
+
open = scene;
|
|
37
41
|
continue;
|
|
38
42
|
}
|
|
39
43
|
const summary = typeof entry.data.summary === "string" ? entry.data.summary.trim() : "";
|
|
40
|
-
Object.assign(
|
|
44
|
+
Object.assign(scene, { to: entry.at }, summary === "" ? {} : { summary });
|
|
41
45
|
open = undefined;
|
|
42
46
|
}
|
|
43
|
-
return
|
|
47
|
+
return scenes;
|
|
44
48
|
}
|
|
45
|
-
/** The chapters of the book whose scenes are in the story as it stands, in order. */
|
|
49
|
+
/** The chapters of the book whose scenes are in the story as it stands, in order: each going on from the one before, the first from the first scene. */
|
|
46
50
|
export function campaignBook(root) {
|
|
47
|
-
const scenes =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.
|
|
51
|
+
const scenes = storyScenes(root);
|
|
52
|
+
const book = [];
|
|
53
|
+
for (const chapter of writtenChapters(root).sort((one, other) => one.number - other.number)) {
|
|
54
|
+
const told = scenes.slice(chapter.first - 1, chapter.last);
|
|
55
|
+
const follows = chapter.number === book.length + 1 && chapter.first === (book.at(-1)?.last ?? 0) + 1;
|
|
56
|
+
if (!follows || told.length !== chapter.scenes.length || told.some((scene, index) => scene.scene !== chapter.scenes[index] || scene.to === undefined)) {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
book.push({ number: chapter.number, title: chapter.title, text: chapter.text, first: chapter.first, last: chapter.last });
|
|
60
|
+
}
|
|
61
|
+
return book;
|
|
62
|
+
}
|
|
63
|
+
/** The closed scenes no chapter tells yet, in order: those the next chapter is for. */
|
|
64
|
+
export function untoldScenes(root, book = campaignBook(root)) {
|
|
65
|
+
const told = book.at(-1)?.last ?? 0;
|
|
66
|
+
return storyScenes(root).filter((scene) => scene.number > told && scene.to !== undefined);
|
|
52
67
|
}
|
|
53
|
-
/** Writes a
|
|
54
|
-
export function writeChapter(root,
|
|
55
|
-
const head = stringify({ chapter:
|
|
56
|
-
files().write(chapterPath(root,
|
|
68
|
+
/** Writes a chapter telling these scenes, in place of the one with its number. */
|
|
69
|
+
export function writeChapter(root, number, scenes, title, text) {
|
|
70
|
+
const head = stringify({ chapter: number, title, scenes: scenes.map((scene) => scene.scene) }, { lineWidth: 0 });
|
|
71
|
+
files().write(chapterPath(root, number), `---\n${head}---\n\n${text}\n`);
|
|
57
72
|
}
|
|
58
73
|
/** Takes a chapter out of the book; nothing when it has none. */
|
|
59
74
|
export function removeChapter(root, number) {
|
|
@@ -62,34 +77,42 @@ export function removeChapter(root, number) {
|
|
|
62
77
|
files().remove(path);
|
|
63
78
|
}
|
|
64
79
|
}
|
|
80
|
+
/** What status says of a book left behind, by a chat closed or a computer turned off: the scenes waiting too long for their chapter, once the book has begun. */
|
|
81
|
+
export function bookBehind(root) {
|
|
82
|
+
const book = campaignBook(root);
|
|
83
|
+
const untold = untoldScenes(root, book);
|
|
84
|
+
return book.length === 0 || untold.length < scenesPerChapter ? undefined : `The book is behind: ${scenesText(untold)} wait for their chapter. Write it with book before the story goes on; book lists them with their chats.`;
|
|
85
|
+
}
|
|
86
|
+
/** Scenes by their numbers, as «scene 4» or «scenes 4–7». */
|
|
87
|
+
export function scenesText(scenes) {
|
|
88
|
+
const first = scenes[0]?.number;
|
|
89
|
+
const last = scenes.at(-1)?.number;
|
|
90
|
+
return first === last ? `scene ${first}` : `scenes ${first}–${last}`;
|
|
91
|
+
}
|
|
65
92
|
function chapterPath(root, number) {
|
|
66
93
|
return join(root, bookFolderName, `${String(number).padStart(3, "0")}.md`);
|
|
67
94
|
}
|
|
68
|
-
/** The chapters written in the book folder, each with the
|
|
95
|
+
/** The chapters written in the book folder, each with the scenes it tells, after the scenes before it; a file that does not read as one is left out. */
|
|
69
96
|
function writtenChapters(root) {
|
|
70
|
-
|
|
71
|
-
const
|
|
97
|
+
const read = files().files(join(root, bookFolderName), (name) => /^\d+\.md$/.test(name)).flatMap((path) => {
|
|
98
|
+
const parts = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(files().text(path) ?? "");
|
|
72
99
|
try {
|
|
73
|
-
const head =
|
|
74
|
-
|
|
100
|
+
const head = parts === null ? undefined : parse(parts[1]);
|
|
101
|
+
const scenes = Array.isArray(head?.scenes) ? head.scenes.filter((scene) => typeof scene === "string") : [];
|
|
102
|
+
if (parts === null || head === null || head === undefined || typeof head.chapter !== "number" || scenes.length === 0) {
|
|
75
103
|
return [];
|
|
76
104
|
}
|
|
77
|
-
return [{ number: head.chapter, title: typeof head.title === "string" ? head.title : "", text:
|
|
105
|
+
return [{ number: head.chapter, title: typeof head.title === "string" ? head.title : "", text: parts[2].trim(), scenes }];
|
|
78
106
|
}
|
|
79
107
|
catch {
|
|
80
108
|
return [];
|
|
81
109
|
}
|
|
110
|
+
}).sort((one, other) => one.number - other.number);
|
|
111
|
+
// Each chapter goes on from the scenes of those before it.
|
|
112
|
+
let told = 0;
|
|
113
|
+
return read.map((chapter) => {
|
|
114
|
+
const first = told + 1;
|
|
115
|
+
told += chapter.scenes.length;
|
|
116
|
+
return { ...chapter, first, last: told };
|
|
82
117
|
});
|
|
83
118
|
}
|
|
84
|
-
/** What status says of a book left behind, by a chat closed or a computer turned off: the closed chapters still to write, once the book has begun (T-227). */
|
|
85
|
-
export function bookBehind(root) {
|
|
86
|
-
const written = campaignBook(root);
|
|
87
|
-
if (written.length === 0) {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
const missing = sceneChapters(root).filter((scene) => scene.to !== undefined && !written.some((chapter) => chapter.number === scene.number)).map((scene) => scene.number);
|
|
91
|
-
const list = missing.length > 10 ? `${missing.slice(0, 10).join(", ")}…` : missing.join(", ");
|
|
92
|
-
return missing.length === 0
|
|
93
|
-
? undefined
|
|
94
|
-
: `The book lacks ${missing.length === 1 ? "chapter" : "chapters"} ${list}, of scenes closed: write ${missing.length === 1 ? "it" : "them"} with book before the story goes on; book lists them with their chats.`;
|
|
95
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The saves of a campaign as commands use them (D-54, D-55): which files a save holds, a save made at the end of a scene or when asked, and given back.
|
|
2
2
|
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { bookFolderName, campaignFileName, hostFileNames, readSettings, sessionsFolderName } from "../../../campaign/index.js";
|
|
3
|
+
import { bookFolderName, campaignFileName, hostFileNames, inboxFolderName, readSettings, sessionsFolderName } from "../../../campaign/index.js";
|
|
4
4
|
import { filesIn } from "../../../core/files.js";
|
|
5
5
|
import { appendLogEntry, logFileName, logLine, readLog } from "../../../core/log.js";
|
|
6
6
|
import { files, isInside } from "../../../core/store.js";
|
|
@@ -274,7 +274,7 @@ function gameFiles(root) {
|
|
|
274
274
|
/** Whether a name at the top of a campaign is the game's: not the host's, in any case, as Windows reads them, and not starting with a dot. */
|
|
275
275
|
function isGameName(name) {
|
|
276
276
|
return !name.startsWith(".") && !hostNames.has(name.toLowerCase()) && name.toLowerCase() !== exportsFolderName && name.toLowerCase() !== sessionsFolderName
|
|
277
|
-
&& name.toLowerCase() !== bookFolderName;
|
|
277
|
+
&& name.toLowerCase() !== bookFolderName && name.toLowerCase() !== inboxFolderName;
|
|
278
278
|
}
|
|
279
279
|
function joinBytes(first, second) {
|
|
280
280
|
const joined = new Uint8Array((first?.length ?? 0) + second.length);
|
|
@@ -10,6 +10,7 @@ import { layerFolder, layersFolderName, loadWorld, playerCharacters, searchSyste
|
|
|
10
10
|
import { engineSettingValue, findCampaignSystem, findSystem, layeredSystemWords, readableSystems, rulesetSetting, systemContentFolders, systemWords, withSettings, } from "../../../systems/index.js";
|
|
11
11
|
import { homeSystemWords } from "../books/words.js";
|
|
12
12
|
import { campaignExtensions, extensionSources, layeredParts } from "../packages/extensions.js";
|
|
13
|
+
import { languageFolders } from "../packages/unpacked.js";
|
|
13
14
|
/** The world of the campaign in `root`, with the pages of its game system when campaign.yaml names one that is installed (SYS-1, SYS-3). */
|
|
14
15
|
export function campaignWorld(root, context) {
|
|
15
16
|
// The same world until one of its pages, campaign.yaml or the system's pages translated on this computer change, or a folder of the packages is read again
|
|
@@ -48,7 +49,7 @@ export function ownTranslationFolder(context, system, language) {
|
|
|
48
49
|
*/
|
|
49
50
|
export function systemWordsOf(root, system, language, context) {
|
|
50
51
|
// A language package's words come first, then the system's own, then those translated on the fly (D-485 (3)).
|
|
51
|
-
const pack = languagePackFor(context
|
|
52
|
+
const pack = languagePackFor(languageFolders(context), language);
|
|
52
53
|
const packed = pack === undefined ? undefined : packSystemFolder(pack, system.name);
|
|
53
54
|
const own = (packed === undefined ? undefined : systemWords(packed, language)) ?? layeredSystemWords(systemContentFolders(system), language) ?? homeSystemWords(context.home, system, language);
|
|
54
55
|
const added = campaignExtensions(root, context).extensions.reduce((fields, extension) => ({ ...fields, ...extensionFieldWords(extension, language) }), {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from "../../../core/context.ts";
|
|
2
2
|
/** The kinds of packages the catalog lists. */
|
|
3
|
-
export type CatalogKind = "system" | "adventure" | "extension" | "language";
|
|
3
|
+
export type CatalogKind = "system" | "adventure" | "extension" | "language" | "theme";
|
|
4
4
|
/** A package one may add, as the page lists it (D-486 (3)). */
|
|
5
5
|
export interface CatalogEntry {
|
|
6
6
|
kind: CatalogKind;
|
|
@@ -13,7 +13,7 @@ export interface CatalogEntry {
|
|
|
13
13
|
code: boolean;
|
|
14
14
|
/** What the player adds it by: an npm name or a GitHub link. */
|
|
15
15
|
source: string;
|
|
16
|
-
/** The version here, when it is installed. */
|
|
16
|
+
/** The version here, when it is installed; empty for a theme installed without one. */
|
|
17
17
|
installed?: string;
|
|
18
18
|
update: boolean;
|
|
19
19
|
/** Its latest version, when it needs a newer rpg-engine than this one, which version offers the newest it reads (D-515 (2)): with the first engine that reads it. */
|
|
@@ -23,7 +23,7 @@ export interface CatalogEntry {
|
|
|
23
23
|
};
|
|
24
24
|
/** The game system an extension is made for, as its package.json says (D-548). */
|
|
25
25
|
system?: string;
|
|
26
|
-
/** An adventure's levels, length and language, as its adventure.yaml says. */
|
|
26
|
+
/** An adventure's levels, length and language, as its adventure.yaml says; a language's code. */
|
|
27
27
|
levels?: string;
|
|
28
28
|
length?: string;
|
|
29
29
|
language?: string;
|