rpg-engine 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/campaign/settings.d.ts +1 -0
- package/dist/campaign/settings.js +6 -5
- package/dist/command-line.js +12 -5
- package/dist/commands/advance.js +1 -1
- package/dist/commands/ask.d.ts +37 -2
- package/dist/commands/ask.js +106 -35
- package/dist/commands/change.js +28 -17
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/config.js +69 -21
- package/dist/commands/effect.js +42 -23
- package/dist/commands/find.js +1 -1
- package/dist/commands/game-adventures.js +2 -2
- package/dist/commands/game-catalog.d.ts +13 -0
- package/dist/commands/game-catalog.js +26 -2
- package/dist/commands/game-checks.js +23 -21
- package/dist/commands/{game-hit-dice.d.ts → game-dice-pool.d.ts} +3 -3
- package/dist/commands/{game-hit-dice.js → game-dice-pool.js} +7 -7
- package/dist/commands/game-effects.d.ts +12 -4
- package/dist/commands/game-effects.js +21 -13
- package/dist/commands/game-examples.d.ts +22 -0
- package/dist/commands/game-examples.js +72 -0
- package/dist/commands/game-extension-list.d.ts +31 -3
- package/dist/commands/game-extension-list.js +94 -6
- package/dist/commands/game-images.d.ts +1 -1
- package/dist/commands/game-images.js +3 -2
- package/dist/commands/game-library.d.ts +3 -0
- package/dist/commands/game-library.js +2 -2
- package/dist/commands/game-mode.js +1 -1
- package/dist/commands/game-package-code.d.ts +87 -0
- package/dist/commands/game-package-code.js +648 -0
- package/dist/commands/game-package-hooks.d.ts +37 -0
- package/dist/commands/game-package-hooks.js +116 -0
- package/dist/commands/game-recipes.js +2 -2
- package/dist/commands/game-reminders.d.ts +5 -2
- package/dist/commands/game-reminders.js +7 -4
- package/dist/commands/game-rules.d.ts +4 -1
- package/dist/commands/game-rules.js +7 -1
- package/dist/commands/game-upkeep.js +3 -3
- package/dist/commands/game-view-place.d.ts +8 -20
- package/dist/commands/game-view-place.js +16 -35
- package/dist/commands/game-widgets.d.ts +42 -8
- package/dist/commands/game-widgets.js +182 -31
- package/dist/commands/game-world.d.ts +32 -3
- package/dist/commands/game-world.js +113 -24
- package/dist/commands/image.js +1 -1
- package/dist/commands/init.js +2 -2
- package/dist/commands/mode.d.ts +1 -1
- package/dist/commands/package.d.ts +15 -1
- package/dist/commands/package.js +96 -24
- package/dist/commands/progression.d.ts +2 -0
- package/dist/commands/progression.js +7 -2
- package/dist/commands/roll.d.ts +2 -0
- package/dist/commands/roll.js +50 -24
- package/dist/commands/rules.js +6 -4
- package/dist/commands/scene.d.ts +2 -2
- package/dist/commands/scene.js +13 -10
- package/dist/commands/sheet.js +10 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +14 -4
- package/dist/commands/trade.js +6 -4
- package/dist/commands/translate.js +2 -2
- package/dist/commands/travel.js +1 -1
- package/dist/commands/validate.js +2 -2
- package/dist/commands/view.d.ts +12 -4
- package/dist/commands/view.js +11 -8
- package/dist/commands/worked-out.js +11 -5
- package/dist/commands/write.d.ts +8 -1
- package/dist/commands/write.js +84 -25
- package/dist/core/command-reference.js +3 -2
- package/dist/core/consents.d.ts +18 -0
- package/dist/core/consents.js +93 -0
- package/dist/core/context.d.ts +68 -27
- package/dist/core/context.js +3 -1
- package/dist/core/examples.d.ts +25 -0
- package/dist/core/examples.js +19 -0
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +10 -1
- package/dist/core/package-api.d.ts +388 -0
- package/dist/core/package-declarations.d.ts +102 -0
- package/dist/core/package-declarations.js +81 -0
- package/dist/core/registry.d.ts +4 -0
- package/dist/core/text.d.ts +5 -0
- package/dist/core/text.js +12 -0
- package/dist/dashboard/acts.js +31 -24
- package/dist/dashboard/address.js +4 -1
- package/dist/dashboard/api.js +65 -3
- package/dist/dashboard/app.js +222 -98
- package/dist/dashboard/ask-card.js +169 -0
- package/dist/dashboard/asked-dice.js +57 -0
- package/dist/dashboard/dice/tray.js +6 -4
- package/dist/dashboard/extension-widgets.js +136 -16
- package/dist/dashboard/faces.js +6 -4
- package/dist/dashboard/help.js +10 -3
- package/dist/dashboard/i18n/ar.json +34 -29
- package/dist/dashboard/i18n/cs.json +34 -29
- package/dist/dashboard/i18n/da.json +34 -29
- package/dist/dashboard/i18n/de.json +34 -29
- package/dist/dashboard/i18n/el.json +34 -29
- package/dist/dashboard/i18n/es.json +34 -29
- package/dist/dashboard/i18n/fi.json +34 -29
- package/dist/dashboard/i18n/fr.json +34 -29
- package/dist/dashboard/i18n/he.json +34 -29
- package/dist/dashboard/i18n/hi.json +34 -29
- package/dist/dashboard/i18n/hu.json +34 -29
- package/dist/dashboard/i18n/is.json +34 -29
- package/dist/dashboard/i18n/it.json +34 -29
- package/dist/dashboard/i18n/ja.json +34 -29
- package/dist/dashboard/i18n/ko.json +34 -29
- package/dist/dashboard/i18n/nb.json +34 -29
- package/dist/dashboard/i18n/nl.json +34 -29
- package/dist/dashboard/i18n/pl.json +34 -29
- package/dist/dashboard/i18n/pt.json +34 -29
- package/dist/dashboard/i18n/ro.json +34 -29
- package/dist/dashboard/i18n/ru.json +34 -29
- package/dist/dashboard/i18n/sv.json +34 -29
- package/dist/dashboard/i18n/tr.json +34 -29
- package/dist/dashboard/i18n/uk.json +34 -29
- package/dist/dashboard/i18n/zh.json +34 -29
- package/dist/dashboard/icons.js +4 -1
- package/dist/dashboard/kit.js +35 -0
- package/dist/dashboard/labels.js +1 -0
- package/dist/dashboard/pack-card.js +97 -0
- package/dist/dashboard/package-page.js +50 -0
- package/dist/dashboard/packages.js +180 -24
- package/dist/dashboard/page-code.js +248 -0
- package/dist/dashboard/party.js +13 -14
- package/dist/dashboard/people.js +4 -0
- package/dist/dashboard/person-panel.js +110 -0
- package/dist/dashboard/place-map-view.js +11 -6
- package/dist/dashboard/rolls.js +2 -2
- package/dist/dashboard/scene.js +12 -9
- package/dist/dashboard/settings.js +55 -9
- package/dist/dashboard/sheet.js +21 -13
- package/dist/dashboard/status.js +69 -15
- package/dist/dashboard/style.css +859 -574
- package/dist/dashboard/top.js +75 -25
- package/dist/dashboard/turns.js +34 -13
- package/dist/dashboard/widgets.js +9 -2
- package/dist/dashboard-server.js +246 -11
- package/dist/dice/roll-dice.js +1 -1
- package/dist/effects/effect.d.ts +7 -4
- package/dist/effects/effect.js +12 -9
- package/dist/extensions/engine.d.ts +4 -0
- package/dist/extensions/engine.js +74 -0
- package/dist/extensions/extension.d.ts +28 -33
- package/dist/extensions/extension.js +37 -46
- package/dist/extensions/index.d.ts +4 -3
- package/dist/extensions/index.js +5 -2
- package/dist/extensions/packages.d.ts +14 -0
- package/dist/extensions/packages.js +148 -12
- package/dist/extensions/words.d.ts +2 -1
- package/dist/extensions/words.js +5 -4
- package/dist/index.d.ts +1 -3
- package/dist/mcp-server.js +52 -15
- package/dist/page-words.d.ts +4 -0
- package/dist/page-words.js +4 -4
- package/dist/page.d.ts +218 -0
- package/dist/page.js +2 -0
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/pages/load.d.ts +7 -1
- package/dist/pages/load.js +10 -5
- package/dist/pages/page-file.js +1 -1
- package/dist/pages/stack-writes.js +5 -4
- package/dist/pages/standard-fields.d.ts +2 -0
- package/dist/pages/standard-fields.js +8 -1
- package/dist/pages/world.d.ts +8 -0
- package/dist/pages/world.js +9 -2
- package/dist/systems/game-system.d.ts +61 -30
- package/dist/systems/game-system.js +159 -50
- package/dist/systems/index.d.ts +3 -3
- package/dist/systems/index.js +3 -3
- package/dist/systems/system-code.d.ts +29 -88
- package/dist/systems/system-code.js +68 -23
- package/dist/systems/words.d.ts +2 -0
- package/dist/systems/words.js +11 -0
- package/dist/testing.d.ts +76 -0
- package/dist/testing.js +197 -0
- package/instructions/combat.md +2 -2
- package/instructions/core.md +2 -2
- package/instructions/dashboard.md +1 -1
- package/instructions/mentor-tutorial.md +1 -1
- package/instructions/play.md +2 -2
- package/instructions/setup.md +1 -1
- package/package.json +15 -2
- package/systems/5e/LICENSE.md +13 -3
- package/systems/5e/dist/dying.js +83 -16
- package/systems/5e/dist/index.js +2 -2
- package/systems/5e/dist/page-style.js +634 -0
- package/systems/5e/dist/page.js +166 -0
- package/systems/5e/dist/shown.js +23 -0
- package/systems/5e/instructions/combat.md +1 -0
- package/systems/5e/package.json +4 -2
- package/systems/5e/system.yaml +35 -7
- package/systems/5e/versions/srd-5.1/system.yaml +2 -0
- package/systems/5e/words/ar.yaml +30 -0
- package/systems/5e/words/cs.yaml +30 -0
- package/systems/5e/words/da.yaml +30 -0
- package/systems/5e/words/de.yaml +30 -0
- package/systems/5e/words/el.yaml +30 -0
- package/systems/5e/words/es.yaml +30 -0
- package/systems/5e/words/fi.yaml +30 -0
- package/systems/5e/words/fr.yaml +30 -0
- package/systems/5e/words/he.yaml +30 -0
- package/systems/5e/words/hi.yaml +30 -0
- package/systems/5e/words/hu.yaml +30 -0
- package/systems/5e/words/is.yaml +30 -0
- package/systems/5e/words/it.yaml +30 -0
- package/systems/5e/words/ja.yaml +30 -0
- package/systems/5e/words/ko.yaml +30 -0
- package/systems/5e/words/nb.yaml +30 -0
- package/systems/5e/words/nl.yaml +30 -0
- package/systems/5e/words/pl.yaml +30 -0
- package/systems/5e/words/pt.yaml +30 -0
- package/systems/5e/words/ro.yaml +30 -0
- package/systems/5e/words/ru.yaml +30 -0
- package/systems/5e/words/sv.yaml +30 -0
- package/systems/5e/words/tr.yaml +30 -0
- package/systems/5e/words/uk.yaml +30 -0
- package/systems/5e/words/zh.yaml +30 -0
- package/dist/commands/game-extensions.d.ts +0 -34
- package/dist/commands/game-extensions.js +0 -182
- package/dist/commands/game-system-code.d.ts +0 -25
- package/dist/commands/game-system-code.js +0 -172
- package/dist/dashboard/death-save.js +0 -67
- package/dist/dashboard/dying.js +0 -46
- package/dist/dashboard/save-outcome.js +0 -42
- package/dist/dashboard/spend.js +0 -115
- package/dist/extensions/api.d.ts +0 -155
- /package/dist/{extensions/api.js → core/package-api.js} +0 -0
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"“{title}” is read: the master asks you where to start": "“{title}”已读完:主持人会问你从哪里开始",
|
|
3
3
|
"{count} being read": "{count} 本读取中",
|
|
4
4
|
"{count} books read": "已读取 {count} 本书",
|
|
5
|
-
"{count} failures": "{count} 次失败",
|
|
6
5
|
"{count} feet": "{count}英尺",
|
|
7
6
|
"{count} in this campaign": "本战役中有 {count} 个",
|
|
8
7
|
"{count} in use": "{count} 个使用中",
|
|
@@ -28,9 +27,6 @@
|
|
|
28
27
|
"{dice}, free roll, not logged": "{dice},自由掷骰,不记录",
|
|
29
28
|
"{distance} {direction}": "{direction}{distance}",
|
|
30
29
|
"{distance} from you": "距你 {distance}",
|
|
31
|
-
"{face}: {count} failures": "{face}:{count} 次失败",
|
|
32
|
-
"{face}: back up with {value}": "{face}:以 {value} 点生命站起",
|
|
33
|
-
"{face}: two failures": "{face}:两次失败",
|
|
34
30
|
"{file} is ready.": "{file}已就绪。",
|
|
35
31
|
"{fuel}: {count} left": "{fuel}:剩余 {count}",
|
|
36
32
|
"{hours}h": "{hours}小时",
|
|
@@ -61,7 +57,6 @@
|
|
|
61
57
|
"{terrain} terrain": "{terrain}地形",
|
|
62
58
|
"{title}: {says}": "{title}:{says}",
|
|
63
59
|
"{value} of {max}": "{value}/{max}",
|
|
64
|
-
"{value} or more: a success": "{value} 或更高:成功",
|
|
65
60
|
"{who} learned: {what}": "{who}得知:{what}",
|
|
66
61
|
"{who} to {place}": "{who} → {place}",
|
|
67
62
|
"{who} to the open": "{who} → 野外",
|
|
@@ -103,7 +98,7 @@
|
|
|
103
98
|
"Add a {die}: {count} chosen": "加一个{die}:已选 {count} 个",
|
|
104
99
|
"add a die to the die {condition}": "{condition}时给该骰子追加一次掷骰",
|
|
105
100
|
"Add to {setting}": "添加到{setting}",
|
|
106
|
-
"Add what you know, e.g.
|
|
101
|
+
"Add what you know, e.g. Initiative": "添加你已了解的,例如先攻",
|
|
107
102
|
"Add, e.g. spiders": "添加,例如蜘蛛",
|
|
108
103
|
"Add, e.g. torture": "添加,例如酷刑",
|
|
109
104
|
"Add…": "添加…",
|
|
@@ -140,10 +135,10 @@
|
|
|
140
135
|
"as written: food and water each day, light as it burns, fatigue and encumbrance": "按规则:每天消耗食物和水,光源随燃烧消耗,计算疲劳与负重",
|
|
141
136
|
"Ash": "白蜡木",
|
|
142
137
|
"Asking npm and GitHub…": "正在查询 npm 和 GitHub…",
|
|
138
|
+
"Asking npm for the newest version…": "正在向 npm 查询最新版本…",
|
|
143
139
|
"at {place}": "在{place}",
|
|
144
140
|
"at key moments, as the master chooses, the character themselves, knowing only what they know, where your AI app can": "关键时刻由主持人挑选,由角色本人发言,只知道自己所知的事(需你的 AI 应用支持)",
|
|
145
141
|
"at least {points} at level {level}": "{level}级至少需要{points}",
|
|
146
|
-
"at the maximum": "已达上限",
|
|
147
142
|
"Attack": "攻击",
|
|
148
143
|
"Attack with {item}": "用{item}攻击",
|
|
149
144
|
"Author": "作者",
|
|
@@ -159,8 +154,6 @@
|
|
|
159
154
|
"Back to the campaign's start: everything that happened since is gone from the story.": "回到战役开头:此后发生的一切都会从故事中消失。",
|
|
160
155
|
"Back to the party": "回到队伍",
|
|
161
156
|
"Back to the start of play, after session zero.": "回到游戏开头,即零号团之后。",
|
|
162
|
-
"Back up": "站起",
|
|
163
|
-
"Back up with {value}": "以 {value} 点生命站起",
|
|
164
157
|
"Backstory": "背景故事",
|
|
165
158
|
"Before session zero": "零号团之前",
|
|
166
159
|
"Behind the screen": "暗骰",
|
|
@@ -182,14 +175,13 @@
|
|
|
182
175
|
"Camp": "营地",
|
|
183
176
|
"Can't act": "无法行动",
|
|
184
177
|
"Cancel": "取消",
|
|
185
|
-
"Cast": "施放",
|
|
186
|
-
"Cast {item}": "施放{item}",
|
|
187
178
|
"Castle": "城堡",
|
|
188
179
|
"Catalog": "目录",
|
|
189
180
|
"Cave": "洞穴",
|
|
190
181
|
"challenge": "挑战",
|
|
191
182
|
"Change it in Settings.": "可在设置中更改。",
|
|
192
183
|
"Change the campaign's name": "修改战役名称",
|
|
184
|
+
"Change the rules": "更改规则",
|
|
193
185
|
"Change what you sent": "修改已发送的内容",
|
|
194
186
|
"Changing the library…": "正在更改资料库…",
|
|
195
187
|
"Chapter {number}": "第{number}章",
|
|
@@ -211,6 +203,7 @@
|
|
|
211
203
|
"Clock": "进度钟",
|
|
212
204
|
"Close": "关闭",
|
|
213
205
|
"Close the free roll": "关闭自由掷骰",
|
|
206
|
+
"Close this chat.": "关闭这个聊天。",
|
|
214
207
|
"Codex is on this computer but not logged in. To have pictures:\n1. Open a terminal: on Windows, Start, then type Terminal.\n2. Paste `codex login` and sign in with your ChatGPT account in the browser that opens.\nCodex makes them with your ChatGPT plan, never paying by the picture.": "这台电脑上已安装 Codex,但尚未登录。要使用图片:\n1. 打开终端:在 Windows 中点击开始,然后输入“终端”。\n2. 粘贴 `codex login`,并在弹出的浏览器中登录你的 ChatGPT 账号。\nCodex 使用你的 ChatGPT 套餐生成图片,无需按张付费。",
|
|
215
208
|
"Codex makes them on this computer, from your ChatGPT plan.": "由 Codex 在这台电脑上使用你的 ChatGPT 套餐生成。",
|
|
216
209
|
"Codex on this computer pays for each picture with an API key, which the engine never uses. To make them with your ChatGPT plan instead:\n1. Open a terminal: on Windows, Start, then type Terminal.\n2. Paste `codex login` and sign in with your ChatGPT account in the browser that opens.": "这台电脑上的 Codex 使用 API 密钥按张付费,而引擎从不使用该方式。若要改用你的 ChatGPT 套餐生成图片:\n1. 打开终端:在 Windows 中点击开始,然后输入“终端”。\n2. 粘贴 `codex login`,并在弹出的浏览器中登录你的 ChatGPT 账号。",
|
|
@@ -244,7 +237,6 @@
|
|
|
244
237
|
"Days": "天数",
|
|
245
238
|
"Days of the story": "故事天数",
|
|
246
239
|
"dead": "死亡",
|
|
247
|
-
"Dead": "死亡",
|
|
248
240
|
"Deadline": "期限",
|
|
249
241
|
"Deadline of {quest}": "{quest}的期限",
|
|
250
242
|
"deadline of {quests}": "{quests}的期限",
|
|
@@ -262,7 +254,6 @@
|
|
|
262
254
|
"Dice": "骰子",
|
|
263
255
|
"Dice and measures": "骰子与单位",
|
|
264
256
|
"Dice edges": "骰子棱角",
|
|
265
|
-
"Dice rolled": "已掷骰子",
|
|
266
257
|
"Dice set": "骰子套装",
|
|
267
258
|
"Dice sound": "骰子音效",
|
|
268
259
|
"Dice: a check the master asks, or a free roll": "骰子:主持人要求的检定,或自由掷骰",
|
|
@@ -272,7 +263,6 @@
|
|
|
272
263
|
"disgusted": "厌恶",
|
|
273
264
|
"Documents": "文档",
|
|
274
265
|
"done": "已完成",
|
|
275
|
-
"Done": "完成",
|
|
276
266
|
"Done.": "完成。",
|
|
277
267
|
"door": "门",
|
|
278
268
|
"Double the dice": "骰子加倍",
|
|
@@ -283,7 +273,6 @@
|
|
|
283
273
|
"drop the {count} lowest": "去掉最低的{count}个",
|
|
284
274
|
"drop the highest": "去掉最高的",
|
|
285
275
|
"drop the lowest": "去掉最低的",
|
|
286
|
-
"Dying": "濒死",
|
|
287
276
|
"e.g. third person, past tense; more dialogue": "例如:第三人称,过去时;多一些对话",
|
|
288
277
|
"Each campaign then turns on its own; the master searches them after the game system, citing the book and the page.": "之后每个战役会启用各自使用的文件夹;主持人会在查阅游戏系统之后再查阅这些文件夹,并注明书名和页码。",
|
|
289
278
|
"each rule explained the first time, the numbers shown, a short review after fights": "每条规则首次出现时讲解,显示数字,战斗后简短回顾",
|
|
@@ -293,6 +282,7 @@
|
|
|
293
282
|
"Easy": "简单",
|
|
294
283
|
"Elsewhere": "其他地方",
|
|
295
284
|
"Emerald": "祖母绿",
|
|
285
|
+
"Engine": "引擎",
|
|
296
286
|
"Epic": "史诗",
|
|
297
287
|
"Episodes": "单元",
|
|
298
288
|
"Equip": "装备",
|
|
@@ -315,7 +305,7 @@
|
|
|
315
305
|
"Factions": "势力",
|
|
316
306
|
"factions, threats and places with secrets, no main plot: you choose where to go": "势力、威胁和藏有秘密的地点,没有主线:去哪里由你决定",
|
|
317
307
|
"Failed": "已失败",
|
|
318
|
-
"
|
|
308
|
+
"failed: {count}": "失败:{count}",
|
|
319
309
|
"Farm": "农场",
|
|
320
310
|
"feet and miles": "英尺和英里",
|
|
321
311
|
"Fight corporate control of technology, not our right to use it.": "该对抗的是大企业对技术的控制,而不是我们使用技术的权利。",
|
|
@@ -347,6 +337,7 @@
|
|
|
347
337
|
"Game system": "游戏系统",
|
|
348
338
|
"Game systems, extensions and languages come from npm: a file, a link or a folder can be added all the same.": "游戏系统、扩展和语言来自 npm;也可以通过文件、链接或文件夹添加。",
|
|
349
339
|
"GitHub does not answer.": "GitHub 没有响应。",
|
|
340
|
+
"GitHub is the site where RPG Engine is made: you write there with a free account, as in a forum, and anyone can read it.": "GitHub 是制作 RPG Engine 的网站:用免费账号就能在上面发帖,就像在论坛里一样,任何人都能看到。",
|
|
350
341
|
"github.com/someone/an-adventure": "github.com/someone/an-adventure",
|
|
351
342
|
"Glass": "玻璃",
|
|
352
343
|
"Go back": "回到存档",
|
|
@@ -359,6 +350,7 @@
|
|
|
359
350
|
"happy": "开心",
|
|
360
351
|
"Hard": "困难",
|
|
361
352
|
"has code: asks your yes": "含代码:需要你确认",
|
|
353
|
+
"held: {count}": "待定:{count}",
|
|
362
354
|
"Help": "帮助",
|
|
363
355
|
"Here": "此处",
|
|
364
356
|
"hidden": "隐藏",
|
|
@@ -383,16 +375,10 @@
|
|
|
383
375
|
"I attack at {square} with {item}.": "我用{item}攻击{square}格子。",
|
|
384
376
|
"I attack myself with {item}.": "我用{item}攻击自己。",
|
|
385
377
|
"I attack with {item}.": "我用{item}攻击。",
|
|
386
|
-
"I cast {item} at {square}.": "我向{square}格子施放{item}。",
|
|
387
|
-
"I cast {item} on {target}.": "我对{target}施放{item}。",
|
|
388
|
-
"I cast {item} on myself.": "我对自己施放{item}。",
|
|
389
|
-
"I cast {item}.": "我施放{item}。",
|
|
390
378
|
"I equip {item}.": "我装备{item}。",
|
|
391
379
|
"I know it": "很熟悉",
|
|
392
380
|
"I opened a new chat": "我已开启新聊天",
|
|
393
|
-
"I prepare {item}.": "我准备{item}。",
|
|
394
381
|
"I put away {item}.": "我收起{item}。",
|
|
395
|
-
"I spend none": "不消耗",
|
|
396
382
|
"I talk to {target}:": "我对{target}说:",
|
|
397
383
|
"I use {item} at {square}.": "我向{square}格子使用{item}。",
|
|
398
384
|
"I use {item} on {target}.": "我对{target}使用{item}。",
|
|
@@ -426,6 +412,8 @@
|
|
|
426
412
|
"Install {name} again": "重新安装 {name}",
|
|
427
413
|
"Install it again": "重新安装",
|
|
428
414
|
"Installed": "已安装",
|
|
415
|
+
"Installed another way, in {folder}: update it the way you installed it.": "以其他方式安装在 {folder}:请按安装时的方式更新。",
|
|
416
|
+
"Installed with npm link from {folder}, for its development: update it there, with git pull and npm run build.": "通过 npm link 从 {folder} 安装,用于开发:请在那里用 git pull 和 npm run build 更新。",
|
|
429
417
|
"it asks for a password to open: save a copy without one.": "打开需要密码:请另存一份无密码的副本。",
|
|
430
418
|
"It asks whether code that RPG Engine did not publish may run here. Can't see it? It is behind the browser.": "它会询问是否允许运行并非 RPG Engine 发布的代码。看不到窗口?它在浏览器后面。",
|
|
431
419
|
"It asks whether RPG Engine may read the documents of that folder. Can't see it? It is behind the browser.": "它会询问 RPG Engine 是否可以读取该文件夹中的文档。没看到?它在浏览器后面。",
|
|
@@ -465,7 +453,6 @@
|
|
|
465
453
|
"left": "剩余",
|
|
466
454
|
"Left to the master: {settings}.": "交给主持人:{settings}。",
|
|
467
455
|
"Left to the master: they choose, and tell you.": "交给主持人:由主持人决定并告诉你。",
|
|
468
|
-
"Left: {count}": "剩余:{count}",
|
|
469
456
|
"Legend": "图例",
|
|
470
457
|
"less": "收起",
|
|
471
458
|
"Lethality": "致命度",
|
|
@@ -548,7 +535,6 @@
|
|
|
548
535
|
"No scene of the story on this day.": "这一天没有故事场景。",
|
|
549
536
|
"No window for your yes opens on this computer: add it from your terminal, in the campaign's folder.": "这台电脑上无法打开确认窗口:请在战役文件夹中通过终端添加。",
|
|
550
537
|
"None": "无",
|
|
551
|
-
"None left": "已用完",
|
|
552
538
|
"None open now.": "目前没有未完成的。",
|
|
553
539
|
"None yet: add one in Add, from the catalog, a .zip or a link.": "暂无:在“添加”中从目录、.zip 文件或链接添加。",
|
|
554
540
|
"None yet: add the folder of your manuals.": "还没有:添加你的规则书文件夹吧。",
|
|
@@ -582,6 +568,7 @@
|
|
|
582
568
|
"Notice": "告示",
|
|
583
569
|
"Now": "现在",
|
|
584
570
|
"Now acting": "当前行动",
|
|
571
|
+
"npm does not answer: a newer version cannot be checked now.": "npm 没有响应:现在无法检查是否有更新的版本。",
|
|
585
572
|
"npm does not answer.": "npm 没有响应。",
|
|
586
573
|
"Obsidian": "黑曜石",
|
|
587
574
|
"Of the {die}, which count": "{die}中,哪些计入",
|
|
@@ -600,7 +587,6 @@
|
|
|
600
587
|
"On whom": "对象",
|
|
601
588
|
"One {die} less": "少一个{die}",
|
|
602
589
|
"One change at a time: wait for the one under way, then try again.": "一次只能改一项:请等待进行中的操作完成,然后重试。",
|
|
603
|
-
"One die at a time: stop when you like.": "一次掷一个骰子,想停就停。",
|
|
604
590
|
"one for each new place and quest, and for each one you meet": "每个新地点、每个新任务和每个遇到的人各一张",
|
|
605
591
|
"One less": "少一个",
|
|
606
592
|
"One package at a time: wait for the one under way, then try again.": "一次只能处理一个包:请等当前的完成后再试。",
|
|
@@ -611,6 +597,7 @@
|
|
|
611
597
|
"Onyx": "缟玛瑙",
|
|
612
598
|
"Open": "打开",
|
|
613
599
|
"Open a new chat with the master.": "与主持人开启新的聊天。",
|
|
600
|
+
"Open a report on GitHub": "在 GitHub 上反馈",
|
|
614
601
|
"Open source, under the MIT licence.": "采用 MIT 许可证开源。",
|
|
615
602
|
"Open the question": "打开问题",
|
|
616
603
|
"Open the sheet": "打开角色卡",
|
|
@@ -646,12 +633,11 @@
|
|
|
646
633
|
"Plain": "朴素",
|
|
647
634
|
"Plains": "平原",
|
|
648
635
|
"Play": "游戏",
|
|
636
|
+
"Play by {rules}?": "按{rules}来玩?",
|
|
649
637
|
"Port": "港口",
|
|
650
638
|
"Portal": "传送门",
|
|
651
639
|
"Premise": "前提",
|
|
652
640
|
"Preparation": "准备",
|
|
653
|
-
"Prepare": "准备",
|
|
654
|
-
"Prepare {item}": "准备{item}",
|
|
655
641
|
"Previous month": "上个月",
|
|
656
642
|
"Propose changes to your story": "提出故事修改建议",
|
|
657
643
|
"Prose": "文风",
|
|
@@ -664,6 +650,7 @@
|
|
|
664
650
|
"Questions": "问题",
|
|
665
651
|
"Quests": "任务",
|
|
666
652
|
"quicker answers, a little less thought": "回答更快,思考略少",
|
|
653
|
+
"Quit the app you play in completely, not just its window, then open it again.": "完全退出你玩游戏的应用,而不只是关闭窗口,然后重新打开。",
|
|
667
654
|
"Read": "已读",
|
|
668
655
|
"Read all you know": "阅读全部所知",
|
|
669
656
|
"Read elsewhere": "在别处读过",
|
|
@@ -673,6 +660,9 @@
|
|
|
673
660
|
"Ready buttons": "快捷按钮",
|
|
674
661
|
"Region": "区域",
|
|
675
662
|
"Regions and ways": "区域与路径",
|
|
663
|
+
"Reload this page.": "重新加载此页面。",
|
|
664
|
+
"Report a problem": "反馈问题",
|
|
665
|
+
"Report a problem with {name}": "反馈 {name} 的问题",
|
|
676
666
|
"reroll once {condition}": "{condition}时重掷一次",
|
|
677
667
|
"rest": "休息",
|
|
678
668
|
"Restore the cleared rolls": "恢复已清空的掷骰",
|
|
@@ -689,9 +679,12 @@
|
|
|
689
679
|
"Round": "轮",
|
|
690
680
|
"Round {round}": "第{round}轮",
|
|
691
681
|
"Rounded": "圆润",
|
|
682
|
+
"RPG Engine {version} is installed.": "RPG Engine {version} 已安装。",
|
|
683
|
+
"RPG Engine was not updated.": "RPG Engine 未更新。",
|
|
692
684
|
"Ruby": "红宝石",
|
|
693
685
|
"Ruin": "废墟",
|
|
694
686
|
"Rules": "规则",
|
|
687
|
+
"Ruleset": "规则版本",
|
|
695
688
|
"sad": "悲伤",
|
|
696
689
|
"Said to the master": "已告诉主持人",
|
|
697
690
|
"Sapphire": "蓝宝石",
|
|
@@ -710,6 +703,7 @@
|
|
|
710
703
|
"Search what your character knows": "搜索角色所知",
|
|
711
704
|
"Sections": "分区",
|
|
712
705
|
"See it in Installed": "在“已安装”中查看",
|
|
706
|
+
"See RPG Engine": "查看 RPG Engine",
|
|
713
707
|
"Send": "发送",
|
|
714
708
|
"Send to the master": "发送给主持人",
|
|
715
709
|
"Sent to the master: they write it in your page once you agree in the chat.": "已发送给主持人:在聊天中商定后,主持人会把它写进你的页面。",
|
|
@@ -744,6 +738,7 @@
|
|
|
744
738
|
"Someone": "某人",
|
|
745
739
|
"Someone else's": "他人作品",
|
|
746
740
|
"Someone else's · {author}": "他人作品 · {author}",
|
|
741
|
+
"Something doesn't work, confuses you or could be better? Tell us what you did, what you expected and what happened: every report helps.": "有什么不好用、让你困惑,或者可以做得更好?说说你做了什么、本来期望什么、实际发生了什么:每一条反馈都有帮助。",
|
|
747
742
|
"Sometimes": "有时",
|
|
748
743
|
"somewhere": "别处",
|
|
749
744
|
"somewhere you do not know": "你不知道的地方",
|
|
@@ -755,6 +750,7 @@
|
|
|
755
750
|
"south-south-west": "西南偏南",
|
|
756
751
|
"south-west": "西南",
|
|
757
752
|
"spring": "春季",
|
|
753
|
+
"Start a new chat in the campaign, as you always do.": "像平常一样,在战役中开始一个新聊天。",
|
|
758
754
|
"Start over": "重新开始",
|
|
759
755
|
"Start the campaign over?": "重新开始战役?",
|
|
760
756
|
"Start the campaign over…": "重新开始战役…",
|
|
@@ -764,7 +760,6 @@
|
|
|
764
760
|
"Stop following": "取消追踪",
|
|
765
761
|
"Stories": "故事",
|
|
766
762
|
"Story": "故事",
|
|
767
|
-
"Success": "成功",
|
|
768
763
|
"Suggested": "推荐",
|
|
769
764
|
"summer": "夏季",
|
|
770
765
|
"Support {product}": "支持 {product}",
|
|
@@ -790,6 +785,7 @@
|
|
|
790
785
|
"Tales and events": "传说与事件",
|
|
791
786
|
"Talk to {name}": "与{name}交谈",
|
|
792
787
|
"Tell the master": "告诉主持人",
|
|
788
|
+
"Tell us": "告诉我们",
|
|
793
789
|
"Temple": "神庙",
|
|
794
790
|
"tense action, strong colours, each message ending on a threat or a hook": "动作紧张,色彩浓烈,每条消息都以威胁或悬念收尾",
|
|
795
791
|
"Text, or PDFs whose text can be selected, read best; a scanned PDF is read from the pictures of its pages, on Windows only, in a few minutes.": "文本或可选中文字的 PDF 读取效果最好;扫描版 PDF 会根据页面图片读取,仅限 Windows,需要几分钟。",
|
|
@@ -815,6 +811,7 @@
|
|
|
815
811
|
"The extension is in the campaign: it counts from now on.": "扩展已加入战役,从现在起生效。",
|
|
816
812
|
"The folder is on this computer and in this campaign: its books are read now, then the master searches them.": "文件夹位于这台电脑,并用于本战役:其中的书会先读取,之后由主持人查阅。",
|
|
817
813
|
"The game": "游戏",
|
|
814
|
+
"The game follows these rules from the master's next move: the sheets are worked out with them, and the master reads them.": "从主持人的下一步起,游戏遵循这些规则:角色卡按它们重新计算,主持人也会阅读它们。",
|
|
818
815
|
"The game gave no saves: reload the page.": "游戏没有给出存档:请刷新页面。",
|
|
819
816
|
"The game gave no setup: reload the page.": "游戏没有给出设定:请刷新页面。",
|
|
820
817
|
"The game goes back to how it was then. What happened after it is gone from the story, and so are the {count} saves after it.": "游戏会回到当时的样子。之后发生的事会从故事中消失,之后的 {count} 个存档也一样。",
|
|
@@ -836,6 +833,7 @@
|
|
|
836
833
|
"the language of this page": "本页面的语言",
|
|
837
834
|
"the language the master plays in, and the page's too when it is translated": "主持人游戏时使用的语言;页面若已翻译,也使用该语言",
|
|
838
835
|
"The master": "主持人",
|
|
836
|
+
"The master goes on with {version} in this chat. To play with {next}:": "在这个聊天中,主持人继续使用 {version}。要使用 {next} 来玩:",
|
|
839
837
|
"The master has already heard it.": "主持人已经听到了。",
|
|
840
838
|
"The master has read it": "主持人已读",
|
|
841
839
|
"The master hears it at their next call": "主持人会在下次行动时收到",
|
|
@@ -893,6 +891,7 @@
|
|
|
893
891
|
"This computer is translating the page into {language}: until then it stays in English.": "这台电脑正在将页面翻译成{language},在此之前仍显示英文。",
|
|
894
892
|
"This page": "本页",
|
|
895
893
|
"This page could not be read now: try again in a moment.": "现在无法读取此页,请稍后再试。",
|
|
894
|
+
"this roll: {count}": "本次掷骰:{count}",
|
|
896
895
|
"This turn": "本回合",
|
|
897
896
|
"those you ask for": "只生成你要求的",
|
|
898
897
|
"Time is up": "时间到了",
|
|
@@ -914,7 +913,6 @@
|
|
|
914
913
|
"Turns": "回合",
|
|
915
914
|
"Tutorial": "教程",
|
|
916
915
|
"Twice the dice, the same number added": "骰子加倍,加值不变",
|
|
917
|
-
"Two failures": "两次失败",
|
|
918
916
|
"under {map}": "在{map}之下",
|
|
919
917
|
"Uninstall": "卸载",
|
|
920
918
|
"Uninstall {name} from this computer?": "从本机卸载 {name}?",
|
|
@@ -928,14 +926,19 @@
|
|
|
928
926
|
"until day {day}": "直到第{day}天",
|
|
929
927
|
"until day {day}, {time}": "直到第{day}天{time}",
|
|
930
928
|
"until the scene ends": "直到场景结束",
|
|
929
|
+
"Up to date": "已是最新",
|
|
931
930
|
"Update": "更新",
|
|
932
931
|
"Update {name} to {version}": "将 {name} 更新到 {version}",
|
|
932
|
+
"Update RPG Engine first": "先更新 RPG Engine",
|
|
933
|
+
"Updating RPG Engine…": "正在更新 RPG Engine…",
|
|
933
934
|
"Updating…": "正在更新…",
|
|
934
935
|
"Use": "使用",
|
|
935
936
|
"Use {item}": "使用{item}",
|
|
936
937
|
"used": "已用",
|
|
937
938
|
"Veils": "帷幕",
|
|
938
939
|
"Verified": "已验证",
|
|
940
|
+
"Version {version} needs a newer RPG Engine.": "版本 {version} 需要更新的 RPG Engine。",
|
|
941
|
+
"Version {version} needs RPG Engine {engine}.": "版本 {version} 需要 RPG Engine {engine}。",
|
|
939
942
|
"Village": "村庄",
|
|
940
943
|
"waiting for the game": "等待游戏",
|
|
941
944
|
"wall": "墙",
|
|
@@ -949,8 +952,10 @@
|
|
|
949
952
|
"what a fall means": "倒下意味着什么",
|
|
950
953
|
"what happens only off screen, without details": "只在画面外发生,不写细节",
|
|
951
954
|
"What is added to the game. The master hears of each change at their next move.": "加入游戏的内容。每次变更,主持人都会在下一步行动时得知。",
|
|
955
|
+
"What is already in play stays as it is, and you can go back whenever you want.": "已经在进行中的内容保持不变,你随时可以改回来。",
|
|
952
956
|
"What it wrote in the campaign stays, and comes back if you install it again.": "它在战役中写入的内容会保留,重新安装后会恢复。",
|
|
953
957
|
"what never appears in the game": "游戏中绝不出现的内容",
|
|
958
|
+
"What runs the game: the master's tools and this page.": "驱动游戏的部分:主持人的工具和这个页面。",
|
|
954
959
|
"What the master asks": "主持人的提问",
|
|
955
960
|
"what the master asks you to roll": "主持人要你掷的骰子",
|
|
956
961
|
"what the master has explained: take one off to have it explained again": "主持人已讲解的内容:取消一项即可重新讲解",
|
package/dist/dashboard/icons.js
CHANGED
|
@@ -66,6 +66,8 @@ const iconPaths = {
|
|
|
66
66
|
about: "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18Z M12 11v6 M12 7.6v.3",
|
|
67
67
|
// The packages (D-475): a box, as npm draws it; what is done with one, and the system that stays.
|
|
68
68
|
packages: "M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73Z M12 22V12 M3.29 7 12 12l8.71-5 M7.5 4.27l9 5.15",
|
|
69
|
+
// A package's own page, as the packages.
|
|
70
|
+
pkg: "M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73Z M12 22V12 M3.29 7 12 12l8.71-5 M7.5 4.27l9 5.15",
|
|
69
71
|
download: "M12 4v11 M7 10.5l5 5 5-5 M5 20h14",
|
|
70
72
|
update: "M20 12a8 8 0 1 1-2.3-5.6 M20 4v4.5h-4.5",
|
|
71
73
|
lock: "M6.5 10.5h11v10h-11Z M8.5 10.5V7.5a3.5 3.5 0 0 1 7 0v3",
|
|
@@ -73,6 +75,8 @@ const iconPaths = {
|
|
|
73
75
|
unverified: "M12 3 5 6v5c0 4.5 3 8.3 7 10 4-1.7 7-5.5 7-10V6Z M12 8v5 M12 16v.3",
|
|
74
76
|
offline: "M3 3l18 18 M8.5 16.5a5 5 0 0 1 7 0 M5 12.5a10 10 0 0 1 4.5-2.4 M14.5 10.2A10 10 0 0 1 19 12.5 M2 8.8a15 15 0 0 1 4.3-2.6 M10.5 5.1A15 15 0 0 1 22 8.8 M12 20h.01",
|
|
75
77
|
terminal: "M3.5 4.5h17v15h-17Z M7 9l3 3-3 3 M12.5 15H17",
|
|
78
|
+
// RPG Engine itself: the master's robot, its head and antenna.
|
|
79
|
+
engine: "M7 8.5h10a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7.5a2 2 0 0 1 2-2Z M12 8.5V5.5 M12 3.5v.01 M9.5 13.5v1 M14.5 13.5v1 M3 13v3 M21 13v3",
|
|
76
80
|
// The campaign shared as an adventure (D-483): out of the box.
|
|
77
81
|
share: "M12 15V3.5 M7.5 8 12 3.5 16.5 8 M8 11H5v9.5h14V11h-3",
|
|
78
82
|
// Help's parts (D-409): the chat with the master, and the dice.
|
|
@@ -106,7 +110,6 @@ const iconPaths = {
|
|
|
106
110
|
*/
|
|
107
111
|
export const statusIcons = {
|
|
108
112
|
dead: "M12 2.5C7 2.5 3.5 6 3.5 10.6c0 2.7 1.2 4.8 3.2 6.1V19.5c0 1.1.9 2 2 2h6.6c1.1 0 2-.9 2-2v-2.8c2-1.3 3.2-3.4 3.2-6.1C20.5 6 17 2.5 12 2.5Z M8.6 8.8a2.3 2.4 0 1 0 0 4.8a2.3 2.4 0 1 0 0-4.8Z M15.4 8.8a2.3 2.4 0 1 0 0 4.8a2.3 2.4 0 1 0 0-4.8Z M12 13.8l-1.4 2.5h2.8Z M10.1 18.4h1.1v3.4h-1.1Z M12.8 18.4h1.1v3.4h-1.1Z",
|
|
109
|
-
down: "M3 12.5h4.5l2-5 3 10 2.5-5H21",
|
|
110
113
|
fallen: "M12 4v10.5 M7.5 10l4.5 4.5 4.5-4.5 M4.5 19.5h15",
|
|
111
114
|
inactive: "M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17Z M10 9v6 M14 9v6",
|
|
112
115
|
condition: "M12 4l1.8 6.2L20 12l-6.2 1.8L12 20l-1.8-6.2L4 12l6.2-1.8Z",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useContext } from "preact/hooks";
|
|
3
|
+
import { Drawn, Text } from "./extension-widgets.js";
|
|
4
|
+
import { NotationIcons } from "./icons.js";
|
|
5
|
+
import { sideOf, Token } from "./party.js";
|
|
6
|
+
import { PeopleContext } from "./people.js";
|
|
7
|
+
export { Choices } from "./ask-card.js";
|
|
8
|
+
export { Text, Track, Value, Who } from "./extension-widgets.js";
|
|
9
|
+
export { cardPages } from "./page-code.js";
|
|
10
|
+
/** A button of words, as the page's: gold for the one main action, quiet for a secondary one, danger for one that loses something. */
|
|
11
|
+
export function Button({ children, onClick, kind, disabled, tip }) {
|
|
12
|
+
return (_jsx("button", { type: "button", class: kind === undefined ? "button" : `button ${kind}`, "aria-disabled": disabled === true ? "true" : undefined, "data-tip": tip, onClick: () => disabled !== true && onClick(), children: children }));
|
|
13
|
+
}
|
|
14
|
+
/** A button of an icon, named by its words, which its tooltip shows. */
|
|
15
|
+
export function IconButton({ path, label, onClick }) {
|
|
16
|
+
return (_jsx("button", { type: "button", class: "icon-button", "aria-label": label, "data-tip": label, onClick: onClick, children: _jsx(Drawn, { path: path, kind: "icon" }) }));
|
|
17
|
+
}
|
|
18
|
+
/** An icon, a path on a grid of 24 stroked in the accent as the page's own. */
|
|
19
|
+
export function Icon({ path }) {
|
|
20
|
+
return _jsx(Drawn, { path: path, kind: "icon" });
|
|
21
|
+
}
|
|
22
|
+
/** The dice of a notation as the page draws them, as a d20 for 1d20+5. */
|
|
23
|
+
export function Dice({ notation }) {
|
|
24
|
+
return _jsx(NotationIcons, { notation: notation });
|
|
25
|
+
}
|
|
26
|
+
/** Things of a list, as the page's chips. */
|
|
27
|
+
export function Chips({ items }) {
|
|
28
|
+
return (_jsx("ul", { class: "chips", children: items.map((item, index) => (_jsx("li", { dir: "auto", children: _jsx(Text, { text: item }) }, index))) }));
|
|
29
|
+
}
|
|
30
|
+
/** Someone's portrait as the page draws it, the party and those at the place known by name, else their initials; large as in a sheet. */
|
|
31
|
+
export function Portrait({ name, large }) {
|
|
32
|
+
const person = useContext(PeopleContext).find((one) => one.name === name) ?? { name, role: "other" };
|
|
33
|
+
const side = sideOf(person.role);
|
|
34
|
+
return _jsx(Token, { member: person, large: large === true, ...(side === undefined ? {} : { side }) });
|
|
35
|
+
}
|
package/dist/dashboard/labels.js
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The card after a reading of what the master asks: the question's card once its widget answered, the one before while it has not; the card a call left
|
|
3
|
+
* once over, unless the player let it go; the one before while the button pressed goes; else none, as when another question takes its place. `gone`: the
|
|
4
|
+
* attempts the player let go, each with the question they did it at.
|
|
5
|
+
*/
|
|
6
|
+
export function nextPackCard(before, now, gone) {
|
|
7
|
+
const asked = now.asked ?? undefined;
|
|
8
|
+
if (asked !== undefined) {
|
|
9
|
+
const card = asked.card;
|
|
10
|
+
const kept = before?.key === card?.key ? before : undefined;
|
|
11
|
+
// Let go by the player at this very question, which the master has not taken back yet.
|
|
12
|
+
if (card === undefined || card.shows === undefined || (gone.has(card.key) && gone.get(card.key) === asked.id)) {
|
|
13
|
+
return card?.coming === true && kept !== undefined ? { card: kept } : {};
|
|
14
|
+
}
|
|
15
|
+
const sent = kept?.asked?.id === asked.id && kept.sent !== undefined ? { sent: kept.sent } : {};
|
|
16
|
+
const rolled = kept?.rolled === undefined ? {} : { rolled: kept.rolled };
|
|
17
|
+
return { card: { widget: card.widget, key: card.key, shows: card.shows, title: kept?.title ?? asked.question, asked, ...sent, ...rolled } };
|
|
18
|
+
}
|
|
19
|
+
const ended = now.card;
|
|
20
|
+
// The call over with nothing for its card to show, as a roll turned down before its first die: the card goes.
|
|
21
|
+
if (ended?.ended === true && ended.shows === undefined && before?.key === ended.key) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
if (ended?.ended === true && ended.shows !== undefined && !gone.has(ended.key)) {
|
|
25
|
+
const kept = before?.key === ended.key ? before : undefined;
|
|
26
|
+
const title = kept?.title === undefined ? {} : { title: kept.title };
|
|
27
|
+
const rolled = kept?.rolled === undefined ? {} : { rolled: kept.rolled };
|
|
28
|
+
return { card: { widget: ended.widget, key: ended.key, shows: ended.shows, ...title, ...(kept?.asked === undefined ? {} : { asked: kept.asked }), ...rolled, ended: true } };
|
|
29
|
+
}
|
|
30
|
+
// Its question gone with no button of it pressed, as answered in words or taken back by the master: the card goes, and what the call leaves stays away.
|
|
31
|
+
if (before !== undefined && before.ended !== true) {
|
|
32
|
+
return before.sent !== undefined ? { card: before } : { let: before.key };
|
|
33
|
+
}
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
/** Whether a question is asked in a package's card, coming or come, which shows in place of the banner and alone answers it (D-507). */
|
|
37
|
+
export function inCard(asked) {
|
|
38
|
+
return asked?.card !== undefined && (asked.card.shows !== undefined || asked.card.coming === true);
|
|
39
|
+
}
|
|
40
|
+
/** A widget's parts as a card lays them out: a count with no place in the middle, the facts in the place of the last count at the end, else the middle. */
|
|
41
|
+
export function cardLayout(shows) {
|
|
42
|
+
const layout = { places: { start: [], center: [], end: [] }, facts: [], texts: [], others: [] };
|
|
43
|
+
for (const part of shows.parts ?? []) {
|
|
44
|
+
if ("lead" in part) {
|
|
45
|
+
layout.lead ??= part;
|
|
46
|
+
}
|
|
47
|
+
else if ("who" in part) {
|
|
48
|
+
layout.who ??= part;
|
|
49
|
+
}
|
|
50
|
+
else if ("track" in part) {
|
|
51
|
+
layout.places[part.track.stage ?? "center"].push(part.track);
|
|
52
|
+
}
|
|
53
|
+
else if ("facts" in part) {
|
|
54
|
+
layout.facts.push(...part.facts);
|
|
55
|
+
}
|
|
56
|
+
else if ("text" in part) {
|
|
57
|
+
layout.texts.push(part.text);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
layout.others.push(part);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return layout;
|
|
64
|
+
}
|
|
65
|
+
/** What changed on each count from one look of a card to the next, by its label: only the counts that changed. */
|
|
66
|
+
export function trackChanges(before, after) {
|
|
67
|
+
const changes = new Map();
|
|
68
|
+
const was = new Map(tracksOf(before).map((track) => [labelKey(track.label), track]));
|
|
69
|
+
for (const track of tracksOf(after)) {
|
|
70
|
+
const old = was.get(labelKey(track.label));
|
|
71
|
+
if (old === undefined) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const [from, to] = [litOf(old), litOf(track)];
|
|
75
|
+
const marked = range(to, to + (track.marked ?? 0)).filter((index) => index < litOf(old) || index >= litOf(old) + (old.marked ?? 0));
|
|
76
|
+
const change = { lit: range(from, to), out: range(to, from).reverse(), marked };
|
|
77
|
+
if (change.lit.length + change.out.length + change.marked.length > 0) {
|
|
78
|
+
changes.set(labelKey(track.label), change);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return changes;
|
|
82
|
+
}
|
|
83
|
+
/** A count's label as a key, the same however its values are given. */
|
|
84
|
+
export function labelKey(label) {
|
|
85
|
+
return JSON.stringify(label);
|
|
86
|
+
}
|
|
87
|
+
/** The marks a count shows filled: those lit, then those held. */
|
|
88
|
+
function litOf(track) {
|
|
89
|
+
return track.value + (track.held ?? 0);
|
|
90
|
+
}
|
|
91
|
+
function tracksOf(shows) {
|
|
92
|
+
return (shows?.parts ?? []).flatMap((part) => ("track" in part ? [part.track] : []));
|
|
93
|
+
}
|
|
94
|
+
/** The whole numbers from one to the other, the last left out; none when the second is not past the first. */
|
|
95
|
+
function range(from, to) {
|
|
96
|
+
return Array.from({ length: Math.max(0, to - from) }, (_, index) => from + index);
|
|
97
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
// A package's own pages (D-511): at #/pkg/<package>/<name>, the page's head with its title and icon, its whole inside drawn by the package's page code; and the
|
|
3
|
+
// links to them in the package's row of Packages, by their titles.
|
|
4
|
+
import { useContext, useEffect, useRef } from "preact/hooks";
|
|
5
|
+
import { sectionAddress } from "./address.js";
|
|
6
|
+
import { Drawn, WidgetsContext } from "./extension-widgets.js";
|
|
7
|
+
import { Icon } from "./icons.js";
|
|
8
|
+
import { codeOfModule, ExtensionRoot, ModulesContext, ownPageIn, pagePropsOf, usePageModule, useWidgetData } from "./page-code.js";
|
|
9
|
+
// Whether the player moved in the page since it loaded: a package's page opened then takes the focus to its title.
|
|
10
|
+
let moved = false;
|
|
11
|
+
if (typeof window !== "undefined") {
|
|
12
|
+
window.addEventListener("hashchange", () => {
|
|
13
|
+
moved = true;
|
|
14
|
+
}, { once: true });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A package's page by its package and name, once its module came; the focus on its title as it opens. Nothing while its module comes or has no such page;
|
|
18
|
+
* a module that did not load says so in the page, with its error and whose it is.
|
|
19
|
+
*/
|
|
20
|
+
export function PackagePage({ name, page }) {
|
|
21
|
+
const module = useContext(ModulesContext).find((one) => one.package === name);
|
|
22
|
+
const owner = module === undefined ? undefined : codeOfModule(module);
|
|
23
|
+
const loaded = usePageModule(owner);
|
|
24
|
+
const title = useRef(null);
|
|
25
|
+
const found = page === undefined ? undefined : ownPageIn(loaded, page);
|
|
26
|
+
const own = found instanceof Error ? undefined : found;
|
|
27
|
+
const data = useWidgetData(module?.package ?? "", own?.widget, undefined, useContext(WidgetsContext));
|
|
28
|
+
// Opened from the page, as by a tab or a menu, the focus goes to its title; loaded by its address, the focus stays at the page's start, as any page's,
|
|
29
|
+
// and its title has no ring.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (moved) {
|
|
32
|
+
title.current?.focus({ preventScroll: true });
|
|
33
|
+
}
|
|
34
|
+
}, [own === undefined, name, page]);
|
|
35
|
+
if (owner === undefined || page === undefined || found === undefined) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const Drawing = own?.draw;
|
|
39
|
+
return (_jsxs("section", { class: "page-stack package-page", "aria-labelledby": "package-page-title", children: [_jsxs("div", { class: "page-head", children: [_jsx("span", { class: "page-mark", children: own?.icon === undefined ? _jsx(Icon, { name: "packages" }) : _jsx(Drawn, { path: own.icon, kind: "icon" }) }), _jsx("h2", { id: "package-page-title", ref: title, tabIndex: -1, dir: "auto", children: own?.title ?? page })] }), _jsx(ExtensionRoot, { widget: owner, loaded: loaded, kind: "ext-page", draw: () => (Drawing === undefined ? null : _jsx(Drawing, { ...pagePropsOf(owner), name: page, ...(data === undefined ? {} : { data }) })) })] }));
|
|
40
|
+
}
|
|
41
|
+
/** The links to a package's own pages, by their titles, after the meta of its row in Packages; nothing for a package without any. */
|
|
42
|
+
export function OwnPageLinks({ name }) {
|
|
43
|
+
const module = useContext(ModulesContext).find((one) => one.package === name);
|
|
44
|
+
return module === undefined ? null : _jsx(ModulePageLinks, { module: module });
|
|
45
|
+
}
|
|
46
|
+
function ModulePageLinks({ module }) {
|
|
47
|
+
const loaded = usePageModule(codeOfModule(module));
|
|
48
|
+
const pages = loaded === undefined || loaded instanceof Error ? [] : Object.entries(loaded.pages ?? {});
|
|
49
|
+
return (_jsx(_Fragment, { children: pages.map(([page, own]) => (_jsxs("span", { children: [_jsx("span", { class: "package-report-gap", children: " · " }), _jsx("a", { class: "package-report", href: sectionAddress("pkg", module.package, page), dir: "auto", children: own.title })] }, page))) }));
|
|
50
|
+
}
|