rpg-engine 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/campaign/choices.d.ts +30 -0
- package/dist/campaign/choices.js +84 -0
- package/dist/campaign/index.d.ts +4 -1
- package/dist/campaign/index.js +4 -1
- package/dist/campaign/last-choices.d.ts +6 -0
- package/dist/campaign/last-choices.js +34 -0
- package/dist/campaign/levels.d.ts +50 -0
- package/dist/campaign/levels.js +189 -0
- package/dist/campaign/settings.d.ts +35 -13
- package/dist/campaign/settings.js +20 -51
- package/dist/commands/ask.d.ts +8 -0
- package/dist/commands/ask.js +2 -1
- package/dist/commands/change/change.js +6 -4
- package/dist/commands/choices.d.ts +64 -0
- package/dist/commands/choices.js +216 -0
- package/dist/commands/config.d.ts +8 -1
- package/dist/commands/config.js +165 -21
- package/dist/commands/effect.d.ts +1 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +8 -4
- package/dist/commands/rename.js +8 -3
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/shared/experience.d.ts +9 -2
- package/dist/commands/shared/experience.js +42 -7
- package/dist/commands/shared/inputs.d.ts +2 -2
- package/dist/commands/shared/inputs.js +15 -2
- package/dist/commands/shared/knowledge.d.ts +2 -0
- package/dist/commands/shared/knowledge.js +5 -0
- package/dist/commands/shared/mode.js +10 -3
- package/dist/commands/shared/offers.d.ts +3 -1
- package/dist/commands/shared/offers.js +6 -1
- package/dist/commands/shared/page-words.d.ts +4 -0
- package/dist/commands/shared/page-words.js +7 -7
- package/dist/commands/shared/rules.js +5 -1
- package/dist/commands/shared/system-texts.d.ts +11 -0
- package/dist/commands/shared/system-texts.js +203 -0
- package/dist/commands/shared/time.d.ts +6 -0
- package/dist/commands/shared/time.js +35 -3
- package/dist/commands/shared/upkeep.js +3 -3
- package/dist/commands/shared/world.d.ts +2 -0
- package/dist/commands/shared/world.js +20 -7
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +15 -7
- package/dist/commands/view/view.d.ts +4 -0
- package/dist/commands/view/view.js +24 -10
- package/dist/commands/write/write.d.ts +3 -3
- package/dist/commands/write/write.js +5 -2
- package/dist/core/context.d.ts +16 -0
- package/dist/core/files.js +2 -3
- package/dist/core/language.d.ts +2 -0
- package/dist/core/language.js +8 -0
- package/dist/core/text.d.ts +2 -0
- package/dist/core/text.js +5 -0
- package/dist/dashboard/address.js +8 -1
- package/dist/dashboard/api.js +20 -0
- package/dist/dashboard/app.js +20 -7
- package/dist/dashboard/choices.js +338 -0
- 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 +10 -10
- 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 +9 -9
- package/dist/dashboard/guide/it.md +8 -8
- package/dist/dashboard/guide/ja.md +8 -8
- package/dist/dashboard/guide/ko.md +9 -9
- 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 +8 -8
- package/dist/dashboard/guide/sv.md +8 -8
- package/dist/dashboard/guide/tr.md +8 -8
- package/dist/dashboard/guide/uk.md +8 -8
- package/dist/dashboard/guide/zh.md +8 -8
- package/dist/dashboard/i18n/ar.json +81 -1
- package/dist/dashboard/i18n/cs.json +81 -1
- package/dist/dashboard/i18n/da.json +81 -1
- package/dist/dashboard/i18n/de.json +81 -1
- package/dist/dashboard/i18n/el.json +81 -1
- package/dist/dashboard/i18n/es.json +81 -1
- package/dist/dashboard/i18n/fi.json +81 -1
- package/dist/dashboard/i18n/fr.json +81 -1
- package/dist/dashboard/i18n/he.json +81 -1
- package/dist/dashboard/i18n/hi.json +81 -1
- package/dist/dashboard/i18n/hu.json +81 -1
- package/dist/dashboard/i18n/is.json +81 -1
- package/dist/dashboard/i18n/it.json +81 -1
- package/dist/dashboard/i18n/ja.json +81 -1
- package/dist/dashboard/i18n/ko.json +81 -1
- package/dist/dashboard/i18n/nb.json +81 -1
- package/dist/dashboard/i18n/nl.json +81 -1
- package/dist/dashboard/i18n/pl.json +81 -1
- package/dist/dashboard/i18n/pt.json +81 -1
- package/dist/dashboard/i18n/ro.json +81 -1
- package/dist/dashboard/i18n/ru.json +81 -1
- package/dist/dashboard/i18n/sv.json +81 -1
- package/dist/dashboard/i18n/tr.json +81 -1
- package/dist/dashboard/i18n/uk.json +81 -1
- package/dist/dashboard/i18n/zh.json +81 -1
- package/dist/dashboard/icons.js +4 -0
- package/dist/dashboard/labels.js +32 -0
- package/dist/dashboard/notices.js +9 -2
- package/dist/dashboard/party.js +13 -5
- package/dist/dashboard/saves.js +1 -1
- package/dist/dashboard/settings.js +89 -40
- package/dist/dashboard/setup.js +1 -1
- package/dist/dashboard/sheet.js +3 -2
- package/dist/dashboard/style.css +729 -1
- package/dist/dashboard/text.js +7 -2
- package/dist/dashboard/top.js +8 -4
- package/dist/documents/png.d.ts +2 -3
- package/dist/documents/png.js +6 -6
- package/dist/documents/read.js +2 -1
- package/dist/extensions/words.js +2 -1
- package/dist/languages/language-pack.js +2 -2
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/pages/world.d.ts +5 -0
- package/dist/pages/world.js +22 -11
- package/dist/server/dashboard/choices.d.ts +38 -0
- package/dist/server/dashboard/choices.js +174 -0
- package/dist/server/dashboard/files.js +3 -2
- package/dist/server/dashboard/index.d.ts +3 -1
- package/dist/server/dashboard/index.js +20 -2
- package/dist/server/mcp.js +3 -1
- package/dist/systems/game-system.js +2 -1
- package/dist/systems/words.js +2 -1
- package/dist/testing/index.js +1 -1
- package/dist/time/game-date.d.ts +9 -0
- package/dist/time/game-date.js +9 -0
- package/dist/time/index.d.ts +1 -1
- package/dist/time/index.js +1 -1
- package/instructions/dashboard-guide.md +1 -1
- package/instructions/play.md +1 -1
- package/package.json +4 -4
package/dist/commands/status.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { houseRulesFolderName, readSettings, requireCampaign, settingMeaning } from "../campaign/index.js";
|
|
3
|
+
import { customSettings, houseRulesFolderName, readOneSetting, readSettings, requireCampaign, settingMeaning } from "../campaign/index.js";
|
|
4
4
|
import { defineCommand } from "../core/registry.js";
|
|
5
5
|
import { isInParty, isPartyMember, isPlayerCharacter, locate, pagesWithName, parsePageReference, playerCharacters } from "../pages/index.js";
|
|
6
6
|
import { bookTitles, readRuleBook } from "../rules/index.js";
|
|
7
7
|
import { sceneTypes } from "../scene/index.js";
|
|
8
8
|
import { rulesetSetting } from "../systems/index.js";
|
|
9
|
+
import { choicesNotes } from "./choices.js";
|
|
9
10
|
import { importLine } from "./import/import.js";
|
|
10
11
|
import { allStateChecks, markStateChecksTold } from "./shared/checks.js";
|
|
11
12
|
import { effectiveFields, effectsOf } from "./shared/effect-layer.js";
|
|
12
13
|
import { effectShown, keptEffects } from "./shared/effects.js";
|
|
13
14
|
import { surroundings, surroundingsText } from "./shared/environment.js";
|
|
14
15
|
import { clocksToMove, dueAdvice, dueText, isDated, isDue, plannedEvents, plannedText, worldFacts } from "./shared/events.js";
|
|
15
|
-
import { experienceOf, levelDueNote } from "./shared/experience.js";
|
|
16
|
+
import { experienceOf, levelDueNote, levelWay } from "./shared/experience.js";
|
|
16
17
|
import { picturesNote } from "./shared/images.js";
|
|
17
18
|
import { journeyText, readJourney } from "./shared/journey.js";
|
|
18
19
|
import { campaignMode, campaignNote } from "./shared/mode.js";
|
|
19
20
|
import { campaignCoins } from "./shared/money.js";
|
|
20
21
|
import { livingMood, masterMood } from "./shared/moods.js";
|
|
21
|
-
import { heldSystemSettings, isFixedSetting, playedEngineSetting } from "./shared/offers.js";
|
|
22
|
+
import { heldSystemSettings, isFixedSetting, playedEngineSetting, playedRigor } from "./shared/offers.js";
|
|
22
23
|
import { installableSystems } from "./shared/packages/catalog.js";
|
|
23
24
|
import { packageCodeProblems } from "./shared/packages/code.js";
|
|
24
25
|
import { extensionsLine } from "./shared/packages/extensions.js";
|
|
@@ -30,7 +31,7 @@ import { measuresOf, roadsOf } from "./shared/roads.js";
|
|
|
30
31
|
import { interruptedLoad } from "./shared/saves.js";
|
|
31
32
|
import { closedScenes, copyCounters, copyPage, partyAwayText, readOpenScene } from "./shared/scene.js";
|
|
32
33
|
import { missingSheetFields, overLoad, sheetSummary } from "./shared/sheet.js";
|
|
33
|
-
import { datedText, problemText, readPresent } from "./shared/time.js";
|
|
34
|
+
import { datedText, problemText, readPresent, timeBetweenSessions } from "./shared/time.js";
|
|
34
35
|
import { campaignSystem, campaignWorld, countedByGame, playedSettingValue, systemInStatus } from "./shared/world.js";
|
|
35
36
|
import { translationOffer } from "./translate.js";
|
|
36
37
|
// Lists in the status show this many names, then say how many more there are and how to find them.
|
|
@@ -55,7 +56,8 @@ export const status = defineCommand({
|
|
|
55
56
|
const value = isFixedSetting(root, context, name) ? undefined : playedEngineSetting(root, context, name);
|
|
56
57
|
return typeof value === "string" ? value : undefined;
|
|
57
58
|
};
|
|
58
|
-
|
|
59
|
+
// The load is counted by its own level when the rigor is custom (T-132).
|
|
60
|
+
const rigor = playedRigor(root, context, "load");
|
|
59
61
|
const world = campaignWorld(root, context);
|
|
60
62
|
const characters = world.pages.filter((page) => page.type === "character");
|
|
61
63
|
const players = playerCharacters(world);
|
|
@@ -124,7 +126,7 @@ export const status = defineCommand({
|
|
|
124
126
|
// What the chosen difficulty and rigor mean in play, one line each (D-263).
|
|
125
127
|
meanings: ["difficulty", "rigor"].flatMap((name) => {
|
|
126
128
|
const value = played(name);
|
|
127
|
-
const meaning = settingMeaning(name, value, countedByGame(system));
|
|
129
|
+
const meaning = settingMeaning(name, value, countedByGame(system), readOneSetting(root, customSettings[name]));
|
|
128
130
|
return meaning === undefined ? [] : [`${name.charAt(0).toUpperCase()}${name.slice(1)} ${value}: ${meaning}.`];
|
|
129
131
|
}),
|
|
130
132
|
// Before play, what the next mode needs and how to enter it; in play, the settings still missing (MOD-7).
|
|
@@ -169,6 +171,8 @@ export const status = defineCommand({
|
|
|
169
171
|
sceneCounts: sceneCounts(closed),
|
|
170
172
|
openQuests: openQuests(world, now),
|
|
171
173
|
now: now === undefined ? undefined : datedText(root, context, now),
|
|
174
|
+
// In play, the game time to let pass when the last move is an hour old or more and the time runs between sessions (D-133).
|
|
175
|
+
betweenSessions: mode === "play" && now !== undefined ? timeBetweenSessions(root, context, now) : undefined,
|
|
172
176
|
dateProblem: present.problem === undefined ? undefined : problemText(present.problem),
|
|
173
177
|
datedEvents: events.some(isDated),
|
|
174
178
|
dueEvents: due.map(dueText),
|
|
@@ -189,7 +193,9 @@ export const status = defineCommand({
|
|
|
189
193
|
return missing.length === 0 ? [] : [`${characterName(page)}'s sheet still lacks, by these names: ${missing.join(", ")}.`];
|
|
190
194
|
}),
|
|
191
195
|
// A level the points reach, until the classes rise (PRO-6).
|
|
192
|
-
|
|
196
|
+
// The choices on the player's dashboard (D-556).
|
|
197
|
+
choices: choicesNotes(root, context, world, system),
|
|
198
|
+
levelsDue: characters.filter(isInParty).flatMap((page) => levelDueNote(characterName(page), experienceOf(world, effectiveFields(world, page)), page.fields.role === "companion", levelWay(root, context, page.name)) ?? []),
|
|
193
199
|
};
|
|
194
200
|
},
|
|
195
201
|
format(result) {
|
|
@@ -210,6 +216,7 @@ export const status = defineCommand({
|
|
|
210
216
|
result.extensions,
|
|
211
217
|
result.houseRules.length === 0 ? "" : `House rules (rules): ${result.houseRules.join(", ")}`,
|
|
212
218
|
timeLine(result),
|
|
219
|
+
result.betweenSessions ?? "",
|
|
213
220
|
...(result.players.length === 0 ? [`No player character yet.${sheetNote(result.sheet)}`] : result.players.map((member) => `PC: ${member.name}${whereabouts(member)}${memberCounters(member)}`)),
|
|
214
221
|
...result.around.map((one) => `Around ${one.who.join(" and ")}: ${one.text}`),
|
|
215
222
|
namesLine("Companions", result.companions.map(companion), "find text companion, type character", "; "),
|
|
@@ -220,6 +227,7 @@ export const status = defineCommand({
|
|
|
220
227
|
result.mood === "neutral" ? "" : `Your mood is ${result.mood}: let your voice follow it.`,
|
|
221
228
|
...result.incompleteSheets,
|
|
222
229
|
...result.levelsDue,
|
|
230
|
+
...result.choices,
|
|
223
231
|
namesLine("Also there", result.alsoThere, result.place === undefined ? "find" : `show ${result.place}`),
|
|
224
232
|
result.scene === undefined ? "" : `Scene: ${result.scene}`,
|
|
225
233
|
result.journey === undefined ? "" : `Journey: ${result.journey}`,
|
|
@@ -119,6 +119,8 @@ export type ViewResult = {
|
|
|
119
119
|
problems: number;
|
|
120
120
|
/** An import under way, which the dashboard tells the player (D-491 (11)). */
|
|
121
121
|
importing?: ShownImport;
|
|
122
|
+
/** The campaign's language, when this computer is translating the game system's pages into it, which the dashboard tells the player (D-539). */
|
|
123
|
+
textsTranslating?: string;
|
|
122
124
|
} | {
|
|
123
125
|
kind: "page";
|
|
124
126
|
title: string;
|
|
@@ -277,6 +279,8 @@ export declare const view: import("../../core/registry.ts").Command<z.ZodObject<
|
|
|
277
279
|
problems: number;
|
|
278
280
|
/** An import under way, which the dashboard tells the player (D-491 (11)). */
|
|
279
281
|
importing?: ShownImport;
|
|
282
|
+
/** The campaign's language, when this computer is translating the game system's pages into it, which the dashboard tells the player (D-539). */
|
|
283
|
+
textsTranslating?: string;
|
|
280
284
|
} | {
|
|
281
285
|
kind: "page";
|
|
282
286
|
title: string;
|
|
@@ -10,13 +10,14 @@ import { readEffect } from "../../effects/index.js";
|
|
|
10
10
|
import { readAmount } from "../../money/index.js";
|
|
11
11
|
import { declaredKind, entryPage, isPartyMember, isPlayerCharacter, locate, pagesWithName, pagesWithNameOrAlias, parsePageReference, playerCharacters, secretNames, systemPageNamed, textsIn, } from "../../pages/index.js";
|
|
12
12
|
import { formatGameDate } from "../../time/index.js";
|
|
13
|
+
import { offeredPages } from "../choices.js";
|
|
13
14
|
import { setupQuestions, shownPlayerSettings } from "../config.js";
|
|
14
15
|
import { importShown } from "../import/import.js";
|
|
15
16
|
import { effectiveFields, effectsOf } from "../shared/effect-layer.js";
|
|
16
17
|
import { effectShown } from "../shared/effects.js";
|
|
17
18
|
import { shownImage } from "../shared/images.js";
|
|
18
19
|
import { readJourney } from "../shared/journey.js";
|
|
19
|
-
import { discoveredSecrets, knowledgeOf, knownIntroduction, knownPart, knownSecretsApart, knownText, knowsPage, pageKnownBy, playerKnowledge, playerStory, scenesLivedBy, secretKnownBy } from "../shared/knowledge.js";
|
|
20
|
+
import { discoveredSecrets, knowledgeOf, knownIntroduction, knownPart, knownSecretsApart, knownText, knowsPage, pageKnownBy, playerKnowledge, playerStory, scenesLivedBy, secretKnownBy, withPagesKnown, } from "../shared/knowledge.js";
|
|
20
21
|
import { blockingMode, campaignMode, modes } from "../shared/mode.js";
|
|
21
22
|
import { campaignCoins } from "../shared/money.js";
|
|
22
23
|
import { lastMoment, livingMood, masterMood } from "../shared/moods.js";
|
|
@@ -26,6 +27,7 @@ import { measuresOf } from "../shared/roads.js";
|
|
|
26
27
|
import { campaignSaves, loadRefusal, loadRule, mayGoBack, resetPoints, resetSave, saveMode, savesWhy, wentBackTo } from "../shared/saves.js";
|
|
27
28
|
import { readOpenScene } from "../shared/scene.js";
|
|
28
29
|
import { counterOf, experienceNeed, experienceProgress, sheetData, sheetGroup, sheetHeadline, sheetText, statBlock, tokenIcon } from "../shared/sheet.js";
|
|
30
|
+
import { translatingTexts, wantTexts } from "../shared/system-texts.js";
|
|
29
31
|
import { thoughtsIn, thoughtsRule, thoughtsShown } from "../shared/thoughts.js";
|
|
30
32
|
import { calendarDayOf, readPresent } from "../shared/time.js";
|
|
31
33
|
import { fuelLeft } from "../shared/upkeep.js";
|
|
@@ -154,26 +156,30 @@ export const view = defineCommand({
|
|
|
154
156
|
throw new Error("Give page or diary, not both: diary goes with the whole view.");
|
|
155
157
|
}
|
|
156
158
|
const reference = parsePageReference(input.page);
|
|
157
|
-
|
|
159
|
+
// The player reads the pages their choices waiting offer, to choose (VIEW-2); never a character agent.
|
|
160
|
+
const readable = input.as === undefined ? withPagesKnown(knowledge, offeredPages(root, world)) : knowledge;
|
|
161
|
+
const page = knownPage(world, readable, reference.name);
|
|
158
162
|
const system = campaignSystem(root, context);
|
|
159
163
|
if (page === undefined) {
|
|
160
|
-
return { kind: "unknown", text: `${knowerText(
|
|
164
|
+
return { kind: "unknown", text: `${knowerText(readable)} ${reference.name}.` };
|
|
161
165
|
}
|
|
162
166
|
// The sheet of the one whose view it is, and of the party when they are of it (VIEW-3, VIEW-10).
|
|
163
167
|
const party = page === pc || (isPartyMember(pc) && isPartyMember(page));
|
|
164
168
|
if (reference.section !== undefined && reference.section !== "") {
|
|
165
|
-
const part = knownPart(world,
|
|
169
|
+
const part = knownPart(world, readable, page, reference.section);
|
|
166
170
|
// A group of the sheet of the character or a companion, as show gives it (DAT-2).
|
|
167
171
|
const group = part === undefined && party ? sheetGroup(world, system, page, reference.section) : undefined;
|
|
168
172
|
if (part === undefined && group === undefined) {
|
|
169
|
-
return { kind: "unknown", text: `${
|
|
173
|
+
return { kind: "unknown", text: `${readable.each === undefined ? `${pc.name} knows nothing` : "No player character knows anything"} of ${page.name} called ${reference.section}.` };
|
|
170
174
|
}
|
|
171
175
|
// Who knows the secret, or the page, when not all the player characters do (VIEW-12).
|
|
172
176
|
const secret = secretNames(page.body).find((name) => comparableText(name) === comparableText(reference.section ?? ""));
|
|
173
|
-
const knownBy = part === undefined ? undefined : secret === undefined ? pageKnownBy(
|
|
177
|
+
const knownBy = part === undefined ? undefined : secret === undefined ? pageKnownBy(readable, page) : secretKnownBy(readable, page, secret);
|
|
174
178
|
return { kind: "section", title: `${page.name}#${group?.name ?? reference.section}`, lines: group?.lines ?? [], text: part ?? "", ...(knownBy === undefined ? {} : { knownBy }) };
|
|
175
179
|
}
|
|
176
|
-
|
|
180
|
+
// The system's pages it shows, in the campaign's language where the system has no translation (D-539).
|
|
181
|
+
wantTexts(root, context, world, [page]);
|
|
182
|
+
return shownPage(root, context, world, readable, page, party);
|
|
177
183
|
}
|
|
178
184
|
const { coins } = campaignCoins(root, context);
|
|
179
185
|
const system = campaignSystem(root, context);
|
|
@@ -238,11 +244,15 @@ export const view = defineCommand({
|
|
|
238
244
|
const settings = readSettings(root);
|
|
239
245
|
const today = now === undefined ? undefined : calendarDayOf(root, context, now.day);
|
|
240
246
|
const words = system === undefined || settings.language === undefined ? undefined : systemWordsOf(root, system, settings.language, context);
|
|
247
|
+
const titled = withPageTitles(words, world);
|
|
248
|
+
// The system's pages of the party's sheets, in the campaign's language where the system has no translation (D-539).
|
|
249
|
+
wantTexts(root, context, world, [...players, ...companions]);
|
|
250
|
+
const textsTranslating = translatingTexts(context, world);
|
|
241
251
|
return {
|
|
242
252
|
kind: "overview",
|
|
243
253
|
campaign: settings.name,
|
|
244
254
|
...(settings.language === undefined ? {} : { language: settings.language }),
|
|
245
|
-
...(
|
|
255
|
+
...(titled === undefined ? {} : { words: titled }),
|
|
246
256
|
...(system === undefined || Object.keys(system.sheetVerbs).length === 0 ? {} : { verbs: system.sheetVerbs }),
|
|
247
257
|
...(system === undefined ? {} : { system: { name: system.name, title: system.title, ...(system.attribution === undefined ? {} : { attribution: system.attribution }) } }),
|
|
248
258
|
...(now === undefined ? {} : { now: formatGameDate(now) }),
|
|
@@ -261,6 +271,7 @@ export const view = defineCommand({
|
|
|
261
271
|
rollsTotal: shownRolls.length,
|
|
262
272
|
problems: campaignProblems(root, world, context).length,
|
|
263
273
|
...(importing === undefined ? {} : { importing }),
|
|
274
|
+
...(textsTranslating === undefined ? {} : { textsTranslating }),
|
|
264
275
|
};
|
|
265
276
|
},
|
|
266
277
|
format(result) {
|
|
@@ -349,10 +360,13 @@ function shownPage(root, context, world, knowledge, page, party) {
|
|
|
349
360
|
...(story === undefined ? {} : { story }),
|
|
350
361
|
};
|
|
351
362
|
}
|
|
352
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* The system's words for the page, with the names its translation gives its pages, as Palla di fuoco for Fireball, where its words do not name them (D-542):
|
|
365
|
+
* those translated on this computer too, where the system has no words in the language (D-539).
|
|
366
|
+
*/
|
|
353
367
|
function withPageTitles(words, world) {
|
|
354
368
|
const titles = Object.fromEntries((world.system?.pages ?? []).flatMap((page) => (page.title === undefined ? [] : [[page.name, page.title]])));
|
|
355
|
-
return Object.keys(titles).length === 0 ? words : { ...words, words: { ...titles, ...words
|
|
369
|
+
return Object.keys(titles).length === 0 ? words : { groups: {}, fields: {}, ...words, words: { ...titles, ...words?.words } };
|
|
356
370
|
}
|
|
357
371
|
/** "Known to Bruna alone: Ettore plays as not knowing it, though all at the screen may read it.": who knows a page, and how the others are played (VIEW-12). */
|
|
358
372
|
function whoKnowsText(who, unaware) {
|
|
@@ -39,10 +39,10 @@ export declare const write: import("../../core/registry.ts").Command<z.ZodObject
|
|
|
39
39
|
event: "event";
|
|
40
40
|
topic: "topic";
|
|
41
41
|
}>>;
|
|
42
|
-
set: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
42
|
+
set: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<string[] | Record<string, unknown>, string>>]>>;
|
|
43
43
|
unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
-
add: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
45
|
-
remove: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
44
|
+
add: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<string[] | Record<string, unknown>, string>>]>>;
|
|
45
|
+
remove: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<string[] | Record<string, unknown>, string>>]>>;
|
|
46
46
|
text: z.ZodOptional<z.ZodString>;
|
|
47
47
|
section: z.ZodOptional<z.ZodString>;
|
|
48
48
|
append: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -12,7 +12,7 @@ import { featureParts, mergedFeatures } from "../../progression/index.js";
|
|
|
12
12
|
import { bondNotes, checkBonds } from "../shared/bonds.js";
|
|
13
13
|
import { effectiveFields, effectsField } from "../shared/effect-layer.js";
|
|
14
14
|
import { conditionNotes, consequencesNotes, eventFieldsProblem, fireEvents, heldNote, nowDueNote, plannedEventDateProblem } from "../shared/events.js";
|
|
15
|
-
import { experienceOf, leastNotes, newLevelNotes } from "../shared/experience.js";
|
|
15
|
+
import { experienceOf, leastNotes, levelWay, newLevelNotes, settleChoices } from "../shared/experience.js";
|
|
16
16
|
import { gridNotes } from "../shared/grids.js";
|
|
17
17
|
import { questPictureNote } from "../shared/images.js";
|
|
18
18
|
import { fieldValues } from "../shared/inputs.js";
|
|
@@ -161,7 +161,10 @@ export const write = defineCommand({
|
|
|
161
161
|
const [before, after] = [existing === undefined ? undefined : experienceOf(world, effectiveFields(world, existing)), experienceOf(now, effectiveFields(now, page))];
|
|
162
162
|
const companion = page.fields.role === "companion";
|
|
163
163
|
const levelUp = () => situationPart("level-up", context, system);
|
|
164
|
-
|
|
164
|
+
if (changed && isPartyMember(page)) {
|
|
165
|
+
settleChoices(root, page.name, before, after);
|
|
166
|
+
}
|
|
167
|
+
const levels = changed && isPartyMember(page) ? [...newLevelNotes(page.name, before, after, companion, levelUp, levelWay(root, context, page.name)), ...leastNotes(page.name, before, after)] : [];
|
|
165
168
|
const leftOut = changed ? changedFieldNames(fields).flatMap((field) => leftOutNote(root, context, field) ?? []) : [];
|
|
166
169
|
const opened = newQuestNotes(existing, page);
|
|
167
170
|
const picture = opened.length === 0 ? undefined : questPictureNote(root, context, now, page);
|
package/dist/core/context.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export interface Context {
|
|
|
75
75
|
pictures?: PictureMaker;
|
|
76
76
|
/** What writes text from a brief on this computer, outside the chat, as Codex or Claude Code with the player's login (D-406); missing where none can. */
|
|
77
77
|
writer?: TextWriter;
|
|
78
|
+
/** A game system's pages translated on this computer as a player first reads them, where the system has no translation of its own (D-539); missing elsewhere. */
|
|
79
|
+
texts?: SystemTexts;
|
|
78
80
|
/** What reads the player's documents outside the chat (D-489 (1)): none where no helper is ready, and in tests. */
|
|
79
81
|
reader?: DocumentReader;
|
|
80
82
|
/** The OCR of the player's system, which reads pages of a PDF without readable text from their pictures (LIB-4): by page number, those it read; none where there is none. */
|
|
@@ -95,6 +97,20 @@ export interface Context {
|
|
|
95
97
|
/** 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. */
|
|
96
98
|
helpers?: Helpers;
|
|
97
99
|
}
|
|
100
|
+
/** A game system's pages a player reads, translated into the campaign's language in the background where they lack it (D-539). */
|
|
101
|
+
export interface SystemTexts {
|
|
102
|
+
/** Asks for these pages of a system in a language, with the system's words there as a glossary; those translated or on their way are left. */
|
|
103
|
+
want(language: string, system: {
|
|
104
|
+
name: string;
|
|
105
|
+
title: string;
|
|
106
|
+
}, pages: {
|
|
107
|
+
path: string;
|
|
108
|
+
name: string;
|
|
109
|
+
body: string;
|
|
110
|
+
}[], glossary: Record<string, string>): void;
|
|
111
|
+
/** Whether pages are being translated into a language now. */
|
|
112
|
+
translating(language: string): boolean;
|
|
113
|
+
}
|
|
98
114
|
/** A package for rpg-engine as npm or its folder describes it (D-439): its name, version and kind, and what it is. */
|
|
99
115
|
export interface PackageInfo {
|
|
100
116
|
name: string;
|
package/dist/core/files.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The files of a folder and of the folders inside it, listed one folder at a time: listing a whole tree at once looks at every file again on Windows (D-194).
|
|
2
2
|
import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { codeAndBase } from "./language.js";
|
|
4
5
|
/** The full paths of `folder` and of the folders inside it, however deep; none when there is no such folder. */
|
|
5
6
|
export function foldersIn(folder) {
|
|
6
7
|
const folders = existsSync(folder) && statSync(folder).isDirectory() ? [folder] : [];
|
|
@@ -36,9 +37,7 @@ export function fileOrder(first, second) {
|
|
|
36
37
|
}
|
|
37
38
|
/** Where a game system keeps its text in a language, translations/it, by the language's code or its base one (D-542); undefined when it has none. */
|
|
38
39
|
export function translationFolder(folder, language) {
|
|
39
|
-
|
|
40
|
-
const codes = code === undefined || code === "" ? [] : [...new Set([code, code.split("-")[0]])];
|
|
41
|
-
return codes.map((one) => join(folder, "translations", one)).find((path) => existsSync(path) && statSync(path).isDirectory());
|
|
40
|
+
return codeAndBase(language ?? "").map((one) => join(folder, "translations", one)).find((path) => existsSync(path) && statSync(path).isDirectory());
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
44
43
|
* The folders of the packages in these folders of npm's, in their scopes' folders too (@rpgengine/weather), links to folders included, as npm links a package
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Chinese in traditional characters, whose base zh is the simplified.
|
|
2
|
+
const traditionalChinese = /^zh-(hant|tw|hk|mo)(-|$)/;
|
|
3
|
+
/** A language's code, then its base's where the base is written in the same script, both in lower case: pt-br and pt; zh-tw alone, as zh is simplified. */
|
|
4
|
+
export function codeAndBase(code) {
|
|
5
|
+
const own = code.trim().toLowerCase();
|
|
6
|
+
const base = own.split("-")[0];
|
|
7
|
+
return own === "" ? [] : traditionalChinese.test(own) || base === own ? [own] : [own, base];
|
|
8
|
+
}
|
package/dist/core/text.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare function comparableText(text: string): string;
|
|
|
4
4
|
export declare function wordCount(text: string): number;
|
|
5
5
|
/** How long a text is, in words: a Chinese, Japanese or Korean letter counts as one, as a model reads it; else about six letters a word. */
|
|
6
6
|
export declare function textSize(text: string): number;
|
|
7
|
+
/** A short print of a text, which changes when the text does: a translation keeps the print of the text it was made from. */
|
|
8
|
+
export declare function textPrint(text: string): string;
|
|
7
9
|
/** The first sentence of a text, up to its first ". ", as the help and the commands' reference give a command's description. */
|
|
8
10
|
export declare function firstSentence(text: string): string;
|
|
9
11
|
/** A noun with its article, as messages write it: "a character", "an item". */
|
package/dist/core/text.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { rememberedByText } from "./memo.js";
|
|
2
3
|
/** A name as it is compared: any case, accents written either way (NFC) and a curly apostrophe as a straight one (SYS-5), so that "Città" from any system matches "città". */
|
|
3
4
|
export function comparableText(text) {
|
|
@@ -14,6 +15,10 @@ export function textSize(text) {
|
|
|
14
15
|
const letters = text.match(/[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af]/gu)?.length ?? 0;
|
|
15
16
|
return Math.max(wordCount(text) + letters, Math.ceil(text.length / 6));
|
|
16
17
|
}
|
|
18
|
+
/** A short print of a text, which changes when the text does: a translation keeps the print of the text it was made from. */
|
|
19
|
+
export function textPrint(text) {
|
|
20
|
+
return createHash("sha256").update(text, "utf8").digest("hex").slice(0, 16);
|
|
21
|
+
}
|
|
17
22
|
/** The first sentence of a text, up to its first ". ", as the help and the commands' reference give a command's description. */
|
|
18
23
|
export function firstSentence(text) {
|
|
19
24
|
const end = text.indexOf(". ");
|
|
@@ -8,11 +8,13 @@ export const sections = ["party", "scene", "journal", "world"];
|
|
|
8
8
|
export const menuPages = ["saves", "help", "settings", "packages", "about"];
|
|
9
9
|
/** A package's own page, as #/pkg/<package>/<name>, reached from its row in Packages and by its address (D-511). */
|
|
10
10
|
export const packagePages = "pkg";
|
|
11
|
+
/** The choices the master prepared for one of the party, as #/choices/Bruna, with an option's page open, as #/choices/Bruna/Sonno (D-556): the Party's own. */
|
|
12
|
+
export const choicesPage = "choices";
|
|
11
13
|
/** The address a hash says, as #/party/Ettore; the sheet for none or one the page does not know. */
|
|
12
14
|
export function readAddress(hash) {
|
|
13
15
|
const [, written = "", ...rest] = hash.replace(/^#/, "").split("/");
|
|
14
16
|
const first = written === "combat" ? "scene" : written;
|
|
15
|
-
const section = [...sections, ...menuPages, packagePages].find((candidate) => candidate === first) ?? "party";
|
|
17
|
+
const section = [...sections, ...menuPages, packagePages, choicesPage].find((candidate) => candidate === first) ?? "party";
|
|
16
18
|
const sheet = first === "party" || first === "character";
|
|
17
19
|
const known = section === first;
|
|
18
20
|
const tab = sheet || !known ? "" : decoded(rest[0] ?? "");
|
|
@@ -23,6 +25,10 @@ export function readAddress(hash) {
|
|
|
23
25
|
export function sectionAddress(section, tab, name) {
|
|
24
26
|
return [`#/${section}`, ...(tab === undefined ? [] : [encodeURIComponent(tab)]), ...(tab === undefined || name === undefined ? [] : [encodeURIComponent(name)])].join("/");
|
|
25
27
|
}
|
|
28
|
+
/** The address of someone's choices, as #/choices/Bruna, or of an option's page among them, as #/choices/Bruna/Sonno: whose they are in the tab's place. */
|
|
29
|
+
export function choicesAddress(who, page) {
|
|
30
|
+
return sectionAddress(choicesPage, who, page);
|
|
31
|
+
}
|
|
26
32
|
/** A section's name as the page writes it, in its language: Scene. */
|
|
27
33
|
export function sectionLabel(section) {
|
|
28
34
|
const labels = {
|
|
@@ -36,6 +42,7 @@ export function sectionLabel(section) {
|
|
|
36
42
|
packages: t("Packages"),
|
|
37
43
|
about: t("About"),
|
|
38
44
|
pkg: t("Packages"),
|
|
45
|
+
choices: t("Party"),
|
|
39
46
|
};
|
|
40
47
|
return labels[section];
|
|
41
48
|
}
|
package/dist/dashboard/api.js
CHANGED
|
@@ -272,6 +272,26 @@ export async function answer(asked, reply) {
|
|
|
272
272
|
const response = await fetch("/api/answer", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
|
273
273
|
return response.status === 202;
|
|
274
274
|
}
|
|
275
|
+
/** The choices the master prepared for the player (D-556), and whether the player rolls their own dice. */
|
|
276
|
+
export async function readChoices() {
|
|
277
|
+
return await readJson("/api/choices");
|
|
278
|
+
}
|
|
279
|
+
// The player's choices reach the game one after another, in the order they were made.
|
|
280
|
+
let choosing = Promise.resolve();
|
|
281
|
+
/** Sends a change of a set of choices, after those sent before: the choices as they are now, "changed" when the game turned it down, or undefined when the game is away. */
|
|
282
|
+
export async function changeChoices(change) {
|
|
283
|
+
const sent = choosing.then(async () => {
|
|
284
|
+
try {
|
|
285
|
+
const response = await fetch("/api/choices", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(change) });
|
|
286
|
+
return response.ok ? await response.json() : response.status === 409 ? "changed" : undefined;
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
choosing = sent;
|
|
293
|
+
return sent;
|
|
294
|
+
}
|
|
275
295
|
/** The sentences said on the page that the master has not heard yet, those heard lately, and whether this chat hears one at once (D-495). */
|
|
276
296
|
export async function readActs() {
|
|
277
297
|
const response = await fetch("/api/act");
|
package/dist/dashboard/app.js
CHANGED
|
@@ -8,10 +8,11 @@ import { PlayerActsContext } from "./acts/names.js";
|
|
|
8
8
|
import { ActSheet } from "./acts/sheet.js";
|
|
9
9
|
import { ActStrip } from "./acts/strip.js";
|
|
10
10
|
import { readAddress, sectionAddress } from "./address.js";
|
|
11
|
-
import { answer, closeCard, readActs, readAsked, readGameTheme, readModules, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
|
|
11
|
+
import { answer, closeCard, readActs, readAsked, readChoices, readGameTheme, readModules, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
|
|
12
12
|
import { AskedDice } from "./asked-dice.js";
|
|
13
13
|
import { AskedBanner } from "./asked.js";
|
|
14
14
|
import { useMedia } from "./card.js";
|
|
15
|
+
import { choicesOf, ChoicesPage, waits } from "./choices.js";
|
|
15
16
|
import { flies } from "./dice/pool.js";
|
|
16
17
|
import { DiceTray } from "./dice/tray.js";
|
|
17
18
|
import { PageFoot } from "./footer.js";
|
|
@@ -68,6 +69,8 @@ function App() {
|
|
|
68
69
|
const [thrown, setThrown] = useState();
|
|
69
70
|
// The roll whose dice are in the air: its line comes into the rolls only as they go (D-300).
|
|
70
71
|
const [held, setHeld] = useState();
|
|
72
|
+
// The last roll whose dice landed: a roll thrown and not landed yet is in the air.
|
|
73
|
+
const [landed, setLanded] = useState();
|
|
71
74
|
const [fresh, setFresh] = useState(new Set());
|
|
72
75
|
// How many of the last rolls the page reads: more when the player asks for older ones (D-302).
|
|
73
76
|
const rollsAsked = useRef(firstRolls);
|
|
@@ -150,7 +153,12 @@ function App() {
|
|
|
150
153
|
setModules((before) => (JSON.stringify(before) === JSON.stringify(read) ? before : read));
|
|
151
154
|
}, () => undefined);
|
|
152
155
|
try {
|
|
153
|
-
const [first, askedNow, actsNow] = await Promise.all([
|
|
156
|
+
const [first, askedNow, actsNow, choicesNow] = await Promise.all([
|
|
157
|
+
readView(undefined, rollsAsked.current),
|
|
158
|
+
readAsked().catch(() => undefined),
|
|
159
|
+
readActs().catch(() => undefined),
|
|
160
|
+
readChoices().catch(() => undefined),
|
|
161
|
+
]);
|
|
154
162
|
const asked = askedNow === undefined ? undefined : askedNow.asked ?? undefined;
|
|
155
163
|
// With more than one player character, a question for one elsewhere puts them in the foreground: the place, the map and the squares are theirs (VIEW-12).
|
|
156
164
|
const here = first.kind === "overview" && (first.place?.here ?? []).some((one) => one.name === asked?.who);
|
|
@@ -259,6 +267,8 @@ function App() {
|
|
|
259
267
|
noCharacter: overview.kind === "none",
|
|
260
268
|
problems: overview.kind === "overview" ? overview.problems : undefined,
|
|
261
269
|
importing: overview.kind === "overview" || overview.kind === "none" ? overview.importing : undefined,
|
|
270
|
+
textsTranslating: overview.kind === "overview" ? overview.textsTranslating : undefined,
|
|
271
|
+
choices: choicesNow ?? before.choices,
|
|
262
272
|
}, holding.current !== undefined));
|
|
263
273
|
}
|
|
264
274
|
}
|
|
@@ -592,7 +602,7 @@ function App() {
|
|
|
592
602
|
? [{ kind: "away", text: t("Not connected: the sheet as of {time}. It comes back when the game does.", { time: shown.readAt.toLocaleTimeString(pageLocale(), { hour: "2-digit", minute: "2-digit" }) }) }]
|
|
593
603
|
: []),
|
|
594
604
|
...(shown.noCharacter && !inSetup ? [{ kind: "info", text: t("There is no player character yet: the sheet comes when the master writes one.") }] : []),
|
|
595
|
-
...gameNotices(shown.problems),
|
|
605
|
+
...gameNotices(shown.problems, shown.textsTranslating),
|
|
596
606
|
// In the setup an import under way is with the page's other notices, in the column of its card (D-491 (11)).
|
|
597
607
|
...(inSetup ? importNotices(shown.importing) : []),
|
|
598
608
|
];
|
|
@@ -606,7 +616,7 @@ function App() {
|
|
|
606
616
|
setFree([]);
|
|
607
617
|
writeFree(shown.campaign, []);
|
|
608
618
|
} }, shown.campaign));
|
|
609
|
-
return (_jsx(ModulesContext.Provider, { value: modules, children: _jsx(PeopleContext.Provider, { value: people, children: _jsx(RequestedRoll.Provider, { value: requested, children: _jsx(WidgetsContext.Provider, { value: pageWidgets, children: _jsx(PlayerActsContext.Provider, { value: playerActs, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system === undefined ? undefined : systemNameLabel(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, turnName: turnName, ownPages: ownPages, ownShown: address.section === "pkg" && address.tab !== undefined && address.name !== undefined ? ownKey({ package: address.tab, name: address.name }) : undefined })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && shown.pack !== undefined && (_jsx(AskCard, { card: shown.pack, name: several ? playerNamed(shown.party, shown.pack.asked?.who)?.name ?? turnName : undefined, widget: widgets.find((widget) => widget.id === shown.pack?.widget), onAnswer: (index) => void answerPack(index), onWords: sayPack, onClose: closePack }, shown.pack.key)), live && shown.pack === undefined && shown.asked?.spend !== undefined && !inCard(shown.asked) && (_jsx(AskedDice, { asked: shown.asked, spend: shown.asked.spend, flying: holding.current?.roll.id, onSpend: (field) => answerSpend(shown.asked?.id, { spend: field }), onDone: async (focused) => {
|
|
619
|
+
return (_jsx(ModulesContext.Provider, { value: modules, children: _jsx(PeopleContext.Provider, { value: people, children: _jsx(RequestedRoll.Provider, { value: requested, children: _jsx(WidgetsContext.Provider, { value: pageWidgets, children: _jsx(PlayerActsContext.Provider, { value: playerActs, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system === undefined ? undefined : systemNameLabel(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 === "choices" ? "party" : address.section, choices: (shown.choices?.sets ?? []).some(waits), fight: fight, yourTurn: yourTurn, turnName: turnName, ownPages: ownPages, ownShown: address.section === "pkg" && address.tab !== undefined && address.name !== undefined ? ownKey({ package: address.tab, name: address.name }) : undefined })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && shown.pack !== undefined && (_jsx(AskCard, { card: shown.pack, name: several ? playerNamed(shown.party, shown.pack.asked?.who)?.name ?? turnName : undefined, widget: widgets.find((widget) => widget.id === shown.pack?.widget), onAnswer: (index) => void answerPack(index), onWords: sayPack, onClose: closePack }, shown.pack.key)), live && shown.pack === undefined && shown.asked?.spend !== undefined && !inCard(shown.asked) && (_jsx(AskedDice, { asked: shown.asked, spend: shown.asked.spend, flying: holding.current?.roll.id, onSpend: (field) => answerSpend(shown.asked?.id, { spend: field }), onDone: async (focused) => {
|
|
610
620
|
const taken = await answerSpend(shown.asked?.id, 0);
|
|
611
621
|
if (taken && focused) {
|
|
612
622
|
focusAfterCard();
|
|
@@ -614,7 +624,7 @@ function App() {
|
|
|
614
624
|
return taken;
|
|
615
625
|
} }, shown.asked.id)), live && shown.pack === undefined && shown.asked && shown.asked.spend === undefined && !inCard(shown.asked) && (_jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn && (asker === undefined || asker.name === turnOf?.name), who: asker, turnName: turnName, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() })), inSetup
|
|
616
626
|
? _jsx(SetupView, { setup: setup })
|
|
617
|
-
: (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "scene" && shown.asked === undefined && shown.pack === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "combat" }), _jsxs("span", { children: [turnWords(turnName), shown.openScene?.round !== undefined && _jsx("span", { class: "turn-notice-round", children: ` · ${t("Round {round}", { round: shown.openScene.round })}` })] }), _jsx("span", { class: "turn-notice-go", children: t("Go to the scene") })] })), _jsx(Notices, { notices: importing }), !table && _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign }), 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, {}), !table && address.section === "scene" && _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && (_jsx(SceneView, { place: shown.place, scene: shown.openScene, actor: actor, foreground: shown.foreground, several: several, party: shown.party, turnsBeside: table, onShowCard: (name) => {
|
|
627
|
+
: (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "scene" && shown.asked === undefined && shown.pack === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "combat" }), _jsxs("span", { children: [turnWords(turnName), shown.openScene?.round !== undefined && _jsx("span", { class: "turn-notice-round", children: ` · ${t("Round {round}", { round: shown.openScene.round })}` })] }), _jsx("span", { class: "turn-notice-go", children: t("Go to the scene") })] })), _jsx(Notices, { notices: importing }), !table && _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign }), address.section === "party" && (_jsx(PartyStrip, { party: shown.party, chosen: shown.chosen, scene: shown.openScene, waiting: new Map((shown.choices?.sets ?? []).filter(waits).map((set) => [set.who, set.title])) })), _jsxs("div", { class: "body", children: [_jsxs("main", { children: [address.section === "about" && _jsx(About, { product: productName, system: shown.system }), address.section === "help" && _jsx(Help, {}), !table && address.section === "scene" && _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && (_jsx(SceneView, { place: shown.place, scene: shown.openScene, actor: actor, foreground: shown.foreground, several: several, party: shown.party, turnsBeside: table, onShowCard: (name) => {
|
|
618
628
|
handed.current = { who: name, turn: turnKey(shown.openScene) };
|
|
619
629
|
void read();
|
|
620
630
|
}, own: {
|
|
@@ -622,7 +632,7 @@ function App() {
|
|
|
622
632
|
cards: shown.cards,
|
|
623
633
|
version: shown.version,
|
|
624
634
|
onRoll: throwFromSheet,
|
|
625
|
-
} })), address.section === "world" && _jsx(WorldView, { version: shown.version, lead: lead, players: many ? players : undefined, tab: address.tab, item: address.name }), address.section === "settings" && _jsx(SettingsView, { version: shown.version, several: many }), address.section === "saves" && _jsx(SavesView, { version: shown.version, campaign: shown.campaign, several: many }), address.section === "packages" && _jsx(PackagesPage, { version: shown.version, tab: address.tab }), address.section === "pkg" && _jsx(PackagePage, { name: address.tab, page: address.name }), address.section === "journal" && _jsx(JournalView, { version: shown.version, campaign: shown.campaign, tab: address.tab, item: address.name }), address.section === "party" && member && (_jsx(PlayerActsContext.Provider, { value: member.role === "pc" || playerActs === undefined ? playerActs : { ...playerActs, actions: {} }, children: _jsx(MemberSheet, { member: member, headline: shown.headline, sheet: shown.sheet, cards: shown.cards, text: shown.text, knownBy: shown.knownBy, story: shown.story, version: shown.version, onRoll: throwFromSheet, scene: shown.openScene }, member.name) }))] }), table
|
|
635
|
+
} })), address.section === "world" && _jsx(WorldView, { version: shown.version, lead: lead, players: many ? players : undefined, tab: address.tab, item: address.name }), address.section === "settings" && _jsx(SettingsView, { version: shown.version, several: many }), address.section === "saves" && _jsx(SavesView, { version: shown.version, campaign: shown.campaign, several: many }), address.section === "packages" && _jsx(PackagesPage, { version: shown.version, tab: address.tab }), address.section === "pkg" && _jsx(PackagePage, { name: address.tab, page: address.name }), address.section === "choices" && (_jsx(ChoicesPage, { who: address.tab, open: address.name, choices: shown.choices, member: shown.party.find((one) => one.name === address.tab), version: shown.version, flying: thrown !== undefined && thrown.id !== landed ? thrown : undefined, onChanged: (choices) => setShown((before) => ({ ...before, choices })) })), address.section === "journal" && _jsx(JournalView, { version: shown.version, campaign: shown.campaign, tab: address.tab, item: address.name }), address.section === "party" && member && (_jsx(PlayerActsContext.Provider, { value: member.role === "pc" || playerActs === undefined ? playerActs : { ...playerActs, actions: {} }, children: _jsx(MemberSheet, { member: member, headline: shown.headline, sheet: shown.sheet, cards: shown.cards, text: shown.text, knownBy: shown.knownBy, story: shown.story, version: shown.version, onRoll: throwFromSheet, scene: shown.openScene, choices: choicesOf(shown.choices, member.name) }, member.name) }))] }), table
|
|
626
636
|
? (_jsxs(PlayTable, { entering: tableMoved, onFold: () => {
|
|
627
637
|
setTableMoved(true);
|
|
628
638
|
setTableAway(true);
|
|
@@ -632,7 +642,10 @@ function App() {
|
|
|
632
642
|
setTableMoved(true);
|
|
633
643
|
setTableAway(false);
|
|
634
644
|
} }))
|
|
635
|
-
: (_jsxs(_Fragment, { children: [_jsx(WidgetCards, { place: "side" }), rolls] }))] }), _jsx(PageFoot, { product: productName, system: shown.system })] })), _jsx(DiceTray, { requested: thrown, sheetThrow: sheetThrow, party: shown.party, ...(shown.campaign === undefined ? {} : { campaign: shown.campaign }), onLanded:
|
|
645
|
+
: (_jsxs(_Fragment, { children: [_jsx(WidgetCards, { place: "side" }), rolls] }))] }), _jsx(PageFoot, { product: productName, system: shown.system })] })), _jsx(DiceTray, { requested: thrown, sheetThrow: sheetThrow, party: shown.party, ...(shown.campaign === undefined ? {} : { campaign: shown.campaign }), onLanded: (roll) => {
|
|
646
|
+
land(roll);
|
|
647
|
+
setLanded(roll);
|
|
648
|
+
}, onShown: (id) => {
|
|
636
649
|
setHeld((now) => (now === id ? undefined : now));
|
|
637
650
|
if (thrown?.id === id) {
|
|
638
651
|
react(thrown, shown.party);
|