diff --git a/engine/event-details.js b/engine/event-details.js
new file mode 100644
index 0000000..23092b7
--- /dev/null
+++ b/engine/event-details.js
@@ -0,0 +1,47 @@
+import { PRICES } from "./catalog.js";
+
+// Capture public costs and rewards before the action mutates the board or market.
+// Keep gross vatu income separate from the automatic 10-vatu conversion event.
+export function actionDetails(s, p, m) {
+ const a = s.players[p];
+ const cell = m.cell ?? a.boat;
+ const tile = s.board[cell];
+ const details = { markers: a.markers[m.action] };
+ if (m.bonus || m.preach) details.character = a.character;
+ if (m.cell || ["fish", "explore"].includes(m.action)) details.cell = cell;
+ switch (m.action) {
+ case "sail":
+ Object.assign(details, {
+ from: a.boat,
+ cell: m.path.at(-1),
+ cost: m.bonus ? 0 : m.path.length,
+ });
+ break;
+ case "fish":
+ details.fish = tile.fish;
+ if (m.bonus) details.points = tile.fish;
+ break;
+ case "explore":
+ details.treasure = tile.treasure;
+ if (m.bonus) details.income = tile.treasure;
+ break;
+ case "sell":
+ details.price = s.market;
+ details.income = m.fish.reduce((a, b) => a + b, 0) * s.market;
+ break;
+ case "build":
+ details.cost = (m.hut ? (m.bonus ? 1 : 3) : 0) + (m.dike ? 1 : 0);
+ break;
+ case "buy":
+ details.cost = PRICES[m.good];
+ break;
+ case "draw":
+ details.points = m.bonus ? 5 : 3;
+ break;
+ case "tourist":
+ details.income = tile.huts.length;
+ if (m.bonus) details.points = tile.drawings * 2;
+ break;
+ }
+ return details;
+}
diff --git a/engine/index.js b/engine/index.js
index 5e9e747..7773176 100644
--- a/engine/index.js
+++ b/engine/index.js
@@ -1,3 +1,4 @@
+import { actionDetails } from "./event-details.js";
import { markerBlockers } from "./marker-blockers.js";
import { sha256 } from "@noble/hashes/sha2.js";
import {
@@ -39,7 +40,9 @@ const turnOrder = (s) =>
const remaining = (s, p) => sum(Object.values(s.players[p].markers));
const has = (s, p, c) => s.players[p].character === c && !s.players[p].used;
function say(s, type, data = {}) {
- s.events.push({ ...data, type, round: s.round, step: s._history.length + 1 });
+ const event = { ...data, type, round: s.round, step: s._history.length + 1 };
+ s.events.push(event);
+ return event;
}
function earn(s, p, n) {
const a = s.players[p];
@@ -349,8 +352,9 @@ function exportGood(s, p, good) {
if (i < 0) continue;
d.filled[i] = true;
s.players[p].score += VALUES[good];
- if (d.filled.every(Boolean)) s.players[p].score += 2;
- return;
+ const complete = d.filled.every(Boolean);
+ if (complete) s.players[p].score += 2;
+ return { ship: d.id, complete };
}
}
function takeFrom(a, values) {
@@ -396,12 +400,14 @@ function effect(s, p, m) {
s.dikesLeft--;
}
break;
- case "buy":
+ case "buy": {
pay(s, p, PRICES[m.good]);
t.goods[m.good]--;
- exportGood(s, p, m.good);
- if (m.bonus && goodsAvailable(s, m.good) > 0) exportGood(s, p, m.good);
- break;
+ const shipments = [exportGood(s, p, m.good)];
+ if (m.bonus && goodsAvailable(s, m.good) > 0)
+ shipments.push(exportGood(s, p, m.good));
+ return shipments.filter(Boolean);
+ }
case "draw":
t.drawings++;
a.score += m.bonus ? 5 : 3;
@@ -800,7 +806,7 @@ function endRound(s) {
s.planningPass = 0;
s.neutral = emptyMarkers();
s.neutralPlaced = 0;
- say(s, "round", { round: s.round });
+ say(s, "round", { round: s.round, first: s.first });
}
function finish(s) {
for (const [p, a] of s.players.entries()) {
@@ -829,9 +835,12 @@ function finish(s) {
}
function execute(s, m, p) {
const a = s.players[p];
- say(s, m.type === "act" ? "action" : m.type, {
+ const event = say(s, m.type === "act" ? "action" : m.type, {
p,
...m,
+ ...(m.type === "act" ? { details: actionDetails(s, p, m) } : {}),
+ ...(m.type === "plan" ? { pass: s.planningPass + 1 } : {}),
+ ...(m.type === "governor" ? { markers: a.markers[m.from] } : {}),
...(m.type === "discard"
? {
blockers: markerBlockers(s, p, m.action),
@@ -860,6 +869,7 @@ function execute(s, m, p) {
return;
case "neutral":
for (const action of m.actions) s.neutral[action]++;
+ event.totals = { ...s.neutral };
s.neutralPlaced += m.actions.length;
s.increments[p]++;
if (s.neutralPlaced === 2) nextActor(s);
@@ -878,6 +888,7 @@ function execute(s, m, p) {
return;
case "plan":
for (const action of m.actions) a.markers[action]++;
+ event.totals = { ...a.markers };
s.increments[p]++;
if (nextActor(s)) {
s.planningPass++;
@@ -902,7 +913,15 @@ function execute(s, m, p) {
return;
case "act":
a.markers[m.action] = 0;
- effect(s, p, m);
+ const shipments = effect(s, p, m);
+ if (m.action === "buy") {
+ event.details.shipments = shipments;
+ event.details.points = shipments.reduce(
+ (points, delivery) =>
+ points + VALUES[m.good] + (delivery.complete ? 2 : 0),
+ 0,
+ );
+ }
if (m.preach) a.used = true;
if (s.phase !== "rest") actionDone(s, p);
else if (s._restAvailable.length === 1) {
diff --git a/package.json b/package.json
index 6fa46c3..5d878b4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@boardgamers/vanuatu",
- "version": "0.1.5",
+ "version": "0.1.6",
"private": true,
"type": "module",
"main": "dist/engine.js",
@@ -11,7 +11,7 @@
"build": "node scripts/build.mjs",
"test": "node --test test/*.test.js",
"dev": "node scripts/dev.mjs",
- "test:browser": "node test/browser.mjs",
+ "test:browser": "node test/browser.mjs && node test/journal-browser.mjs",
"check": "pnpm test:locales && pnpm build && pnpm test && pnpm test:browser && pnpm test:tutorial:browser",
"test:locales": "node scripts/check-locales.mjs viewer/localization && node --test scripts/localization.test.mjs",
"test:tutorial:browser": "node test/tutorial-browser.mjs && node test/tutorial-walkthrough-browser.mjs"
diff --git a/test/journal-browser.mjs b/test/journal-browser.mjs
new file mode 100644
index 0000000..ebc863d
--- /dev/null
+++ b/test/journal-browser.mjs
@@ -0,0 +1,251 @@
+import assert from "node:assert/strict";
+import { chromium } from "playwright";
+import { readFile, mkdir } from "node:fs/promises";
+import { createServer } from "node:http";
+import * as E from "../engine/index.js";
+const s = E.stripSecret(E.init(3, [], {}, "journal-browser"), 0);
+s.players.forEach((p, i) => (p.name = ["Coyote", "Spock", "AlphaZero"][i]));
+s.round = 2;
+s.events = [
+ { type: "start", p: 0 },
+ { type: "character", p: 0, character: "vendor" },
+ { type: "character", p: 1, character: "artist" },
+ { type: "character", p: 2, character: "buyer" },
+ ...[0, 1, 2].flatMap((pass) =>
+ [0, 1, 2].map((p) => ({
+ type: "plan",
+ p,
+ pass: pass + 1,
+ actions: pass === 2 ? ["rest"] : [E.ACTIONS[p], "draw"],
+ })),
+ ),
+ {
+ type: "action",
+ p: 0,
+ action: "sell",
+ fish: [1, 2],
+ details: { price: 3, income: 9, character: "vendor" },
+ },
+ { type: "conversion", p: 0, points: 5 },
+ {
+ type: "action",
+ p: 1,
+ action: "draw",
+ cell: "0,0",
+ bonus: true,
+ details: { points: 5, character: "artist" },
+ },
+ {
+ type: "action",
+ p: 2,
+ action: "buy",
+ cell: "0,0",
+ good: "kava",
+ bonus: true,
+ details: {
+ cost: 1,
+ points: 4,
+ character: "buyer",
+ shipments: [
+ { ship: 1, complete: false },
+ { ship: 1, complete: true },
+ ],
+ },
+ },
+ {
+ type: "action",
+ p: 0,
+ action: "build",
+ hut: true,
+ cell: "0,0",
+ details: { cost: 3 },
+ },
+ { type: "action", p: 1, action: "rest" },
+ { type: "rest", p: 1, token: "hidden" },
+ { type: "discard", p: 0, action: "sail", markers: 2 },
+ { type: "restBonus", p: 1, token: "both" },
+ { type: "round", round: 2, first: 1 },
+].map((e, i) => ({ round: 1, step: i + 1, ...e }));
+const server = createServer(async (req, res) => {
+ const name = req.url === "/viewer.css" ? "viewer.css" : "viewer.js";
+ if (req.url === "/")
+ res.end(
+ '
',
+ );
+ else {
+ res.setHeader(
+ "Content-Type",
+ name.endsWith("css") ? "text/css" : "text/javascript",
+ );
+ const url = name.endsWith("css")
+ ? process.env.JOURNAL_CSS_URL
+ : process.env.JOURNAL_JS_URL;
+ if (url) {
+ const response = await fetch(url);
+ assert.ok(response.ok);
+ res.end(Buffer.from(await response.arrayBuffer()));
+ } else res.end(await readFile(new URL("../dist/" + name, import.meta.url)));
+ }
+});
+await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+const browser = await chromium.launch();
+await mkdir(".local/qa", { recursive: true });
+try {
+ for (const width of [320, 390, 1400]) {
+ const page = await browser.newPage({
+ viewport: { width, height: 844 },
+ isMobile: width < 768,
+ hasTouch: true,
+ });
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.goto(`http://127.0.0.1:${server.address().port}`);
+ await page.evaluate((state) => {
+ window.fixture = state;
+ window.host = vanuatu.launch("#app");
+ host.emit("player", { index: 0 });
+ host.emit("preferences", { sound: false, locale: "en" });
+ host.emit("state", state);
+ }, s);
+ const list = page.locator(".event-list");
+ assert.equal(await list.locator(".round-divider").count(), 2);
+ assert.equal(await list.locator(".phase-divider").count(), 6);
+ assert.equal(await list.locator(".event-plan").count(), 9);
+ assert.ok(
+ await list
+ .locator("li")
+ .evaluateAll((rows) =>
+ rows.every(
+ (row, i) =>
+ !i ||
+ row.getBoundingClientRect().top >=
+ rows[i - 1].getBoundingClientRect().bottom - 1,
+ ),
+ ),
+ "journal rows do not overlap",
+ );
+ assert.match(
+ await list.locator(".event-plan").nth(6).innerText(),
+ /Planned/,
+ );
+ assert.match(
+ await list.locator(".event-action").first().innerText(),
+ /3.*×.*3.*→.*\+9/s,
+ );
+ const exportRow = list
+ .locator(".event-action")
+ .filter({ hasText: "Export" });
+ assert.match(
+ await exportRow.innerText(),
+ /Ship 1 completed \(\+2 included\)/,
+ );
+ assert.ok(await exportRow.locator(".event-character").count());
+ assert.equal(
+ await list.locator(".event-rest").count(),
+ 0,
+ "rest choice merged",
+ );
+ assert.equal(
+ await list
+ .locator(".event-action")
+ .filter({ hasText: "Rest token chosen" })
+ .locator(".token")
+ .count(),
+ 0,
+ "opponent choice hidden",
+ );
+ for (const locale of [
+ "fr",
+ "de",
+ "pl",
+ "ro",
+ "el",
+ "hi",
+ "ru",
+ "da",
+ "pt-BR",
+ "ko",
+ "zh-TW",
+ "vi",
+ "it",
+ "nl",
+ "fa",
+ "en",
+ ]) {
+ const c = JSON.parse(
+ await readFile(
+ new URL(`../viewer/localization/${locale}.json`, import.meta.url),
+ "utf8",
+ ),
+ );
+ await page.evaluate(
+ (locale) => host.emit("preferences", { locale, colorBlind: true }),
+ locale,
+ );
+ await page.waitForFunction(
+ (text) =>
+ document
+ .querySelector(".phase-divider")
+ ?.parentElement.textContent.includes(text),
+ c["Marker placement"],
+ );
+ assert.ok(
+ (await list.innerText()).includes(
+ c["Ship {p0} completed (+2 included)"].replace("{p0}", "1"),
+ ),
+ );
+ assert.equal(
+ await list.locator(".event-action .resource-symbol").count(),
+ 1,
+ );
+ assert.ok(
+ await list.evaluate((e) => e.scrollWidth <= e.clientWidth + 1),
+ `${width} ${locale}: no horizontal overflow`,
+ );
+ }
+ await page.evaluate(() => host.emit("preferences", { locale: "fr" }));
+ await list.scrollIntoViewIfNeeded();
+ await list
+ .locator(".event-plan")
+ .first()
+ .evaluate((e) => {
+ e.closest(".event-list").scrollTop =
+ e.offsetTop - e.closest(".event-list").offsetTop - 40;
+ });
+ await list.screenshot({ path: `.local/qa/journal-planning-${width}.png` });
+ await list
+ .locator(".event-action")
+ .first()
+ .evaluate((e) => {
+ e.closest(".event-list").scrollTop =
+ e.offsetTop - e.closest(".event-list").offsetTop - 40;
+ });
+ await list.screenshot({ path: `.local/qa/journal-actions-${width}.png` });
+ await list.evaluate((e) => (e.scrollTop = e.scrollHeight));
+ await page.waitForTimeout(100);
+ const bottom = await list.evaluate((e) => e.scrollTop),
+ b = await list.boundingBox();
+ await page.mouse.move(b.x + b.width / 2, b.y + b.height / 2);
+ await page.mouse.wheel(0, -8);
+ await page.waitForTimeout(100);
+ const reading = await list.evaluate((e) => e.scrollTop);
+ assert.ok(reading < bottom - 3, "slow wheel escapes bottom");
+ await page.evaluate(() => {
+ fixture.events.push({ type: "beg", p: 0, amount: 2, round: 2, step: 99 });
+ host.emit("state", fixture);
+ });
+ await page.waitForTimeout(100);
+ assert.ok(
+ Math.abs((await list.evaluate((e) => e.scrollTop)) - reading) < 2,
+ "new entries preserve reading position",
+ );
+ assert.deepEqual(errors, []);
+ console.log(
+ `${width}px: journal phases, sale/export outcomes, rest privacy, 16 locales and scrolling passed`,
+ );
+ await page.close();
+ }
+} finally {
+ await browser.close();
+ server.close();
+}
diff --git a/test/journal.test.js b/test/journal.test.js
new file mode 100644
index 0000000..9d4607b
--- /dev/null
+++ b/test/journal.test.js
@@ -0,0 +1,157 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import * as E from "../engine/index.js";
+import { journalRows } from "../viewer/journal.js";
+
+function fixture(action, options = {}) {
+ const s = E.init(3, ["rising-waters"], {}, "journal");
+ s.phase = "actions";
+ s.actor = s.first = 0;
+ s.players.forEach((p) => {
+ p.character = null;
+ p.boat = "1,0";
+ p.markers = Object.fromEntries(E.ACTIONS.map((a) => [a, 0]));
+ });
+ s.board["1,0"] = E.tileState("startWreck");
+ s.players[0].markers[action] = 2;
+ s.players[1].markers.rest = 1;
+ Object.assign(s.players[0], options);
+ return s;
+}
+function perform(s, action, fields = {}) {
+ const move = E.availableMoves(s, 0).find(
+ (m) =>
+ m.type === "act" &&
+ m.action === action &&
+ Object.entries(fields).every(([k, v]) => m[k] === v),
+ );
+ assert.ok(move, `legal ${action}`);
+ const next = E.move(s, move, 0);
+ return [next, next.events.findLast((e) => e.type === "action")];
+}
+test("sale records the historical price and gross income before conversion", () => {
+ const s = fixture("sell", { fish: [1, 2], money: 8 });
+ s.board["0,0"].huts = [0];
+ s.market = 3;
+ const [next, e] = perform(s, "sell");
+ // Pick the sale of both fish, not merely the first legal subset.
+ const both = E.availableMoves(s, 0).find(
+ (m) => m.action === "sell" && m.fish.length === 2,
+ );
+ const sold = E.move(s, both, 0);
+ const event = sold.events.findLast((e) => e.type === "action");
+ assert.deepEqual(event.details, { markers: 2, price: 3, income: 9 });
+ assert.equal(sold.players[0].money, 7);
+ assert.equal(sold.players[0].score, 5);
+ assert.equal(sold.events.at(-1).type, "conversion");
+ assert.equal(sold.market, 2);
+ assert.equal(next.market, 2);
+ assert.equal(e.details.price, 3);
+});
+test("exports record each shipment and its completion bonus, including Buyer", () => {
+ const s = fixture("buy", { character: "buyer", money: 3 });
+ s.demands = [
+ { id: 1, goods: ["kava", "kava"], filled: [false, false] },
+ { id: 2, goods: ["kava"], filled: [false] },
+ ];
+ const [next, e] = perform(s, "buy", { good: "kava", bonus: true });
+ assert.equal(e.details.cost, 1);
+ assert.equal(e.details.points, 4);
+ assert.equal(next.players[0].score, 4);
+ assert.deepEqual(e.details.shipments, [
+ { ship: 1, complete: false },
+ { ship: 1, complete: true },
+ ]);
+ assert.equal(e.details.character, "buyer");
+ const [, ordinary] = perform(s, "buy", { good: "kava", bonus: false });
+ assert.equal(ordinary.details.points, 1);
+ assert.deepEqual(ordinary.details.shipments, [{ ship: 1, complete: false }]);
+});
+test("fishing, diving, drawing, tourism and construction keep their exact rewards and costs", () => {
+ for (const [action, character, expected] of [
+ ["fish", "fisherman", { fish: 1, points: 1 }],
+ ["explore", "diver", { treasure: 2, income: 2 }],
+ ["draw", "artist", { points: 5 }],
+ ["tourist", "guide", { income: 2, points: 2 }],
+ ["build", "builder", { cost: 1 }],
+ ]) {
+ const s = fixture(action, { character });
+ if (action === "tourist") {
+ s.tourists = 2;
+ s.board["0,0"].huts = [0, 1];
+ s.board["0,0"].drawings = 1;
+ }
+ const [, e] = perform(s, action, {
+ bonus: true,
+ ...(action === "build" ? { hut: true } : {}),
+ });
+ for (const [k, value] of Object.entries(expected))
+ assert.equal(e.details[k], value, `${action}: ${k}`);
+ assert.equal(e.details.character, character);
+ assert.equal(e.details.markers, 2);
+ }
+ const [, dike] = perform(fixture("build"), "build", { hut: false });
+ assert.equal(dike.details.cost, 1);
+});
+test("historical reconstruction matches recorded outcomes and marker totals over a full game", () => {
+ let s = E.init(3, ["rising-waters"], {}, "journal-legacy");
+ for (let i = 0; i < 700 && !s.finished; i++) s = E.moveAI(s, s.actor);
+ assert.ok(s.finished);
+ const publicState = E.stripSecret(s, 0);
+ const old = structuredClone(publicState);
+ old.events.forEach((e) => {
+ delete e.details;
+ delete e.totals;
+ delete e.pass;
+ });
+ const legacy = journalRows(old)
+ .filter((r) => r.kind === "event")
+ .map((r) => r.event);
+ for (const e of legacy) {
+ const actual = publicState.events.find(
+ (a) =>
+ a.step === e.step &&
+ a.type === e.type &&
+ a.p === e.p &&
+ a.action === e.action,
+ );
+ if (e.type === "action") {
+ for (const [key, value] of Object.entries(e.details))
+ assert.deepEqual(
+ value,
+ actual.details[key],
+ `${e.action}, step ${e.step}, ${key}`,
+ );
+ }
+ if (e.type === "plan") assert.deepEqual(e.totals, actual.totals);
+ }
+ assert.ok(legacy.some((e) => e.type === "plan" && e.pass === 3));
+ assert.ok(
+ journalRows(old).some((r) => r.kind === "phase" && r.phase === "actions"),
+ );
+});
+test("partial replay history does not invent a past fish price, catch or character", () => {
+ const s = fixture("fish", { character: "artist" });
+ delete s.events;
+ s.lastEvents = [
+ { type: "action", p: 0, action: "sell", fish: [2], round: 3, step: 50 },
+ ];
+ const e = journalRows(s).find((r) => r.kind === "event").event;
+ assert.deepEqual(e.details, {});
+});
+test("rest choice is folded into its action without exposing an opponent's secret token", () => {
+ let s = fixture("rest");
+ s = perform(s, "rest")[0];
+ s = E.move(s, { type: "rest", token: "both" }, 0);
+ const otherRows = journalRows(E.stripSecret(s, 1));
+ assert.equal(otherRows.filter((r) => r.event?.type === "rest").length, 0);
+ assert.equal(
+ otherRows.find((r) => r.event?.action === "rest").event.restToken,
+ "hidden",
+ );
+ assert.equal(
+ journalRows(E.stripSecret(s, 0)).find((r) => r.event?.action === "rest")
+ .event.restToken,
+ "both",
+ );
+});
diff --git a/viewer/activity.js b/viewer/activity.js
index fc2839e..b908f13 100644
--- a/viewer/activity.js
+++ b/viewer/activity.js
@@ -3,16 +3,37 @@ import { tilePreviewSvg } from "./board.js";
import { blockingHtml } from "./blocking.js";
import { translateText } from "./localization/index.js";
import { mountChat } from "@boardgamers/protocol/chat/dom";
-import { icon as renderIcon, token as renderToken, esc } from "./art.js";
+import {
+ icon as renderIcon,
+ token as renderToken,
+ iconLabel,
+ esc,
+} from "./art.js";
import { translator } from "./labels.js";
-import { CHARACTERS, COLORS } from "../engine/catalog.js";
+import { journalRows } from "./journal.js";
+import { ACTIONS, CHARACTERS, COLORS } from "../engine/catalog.js";
export function mountActivity(
target,
{ chat, openPlayer, avatarForPlayer, onBack, language = "en" } = {},
) {
- let colorBlind = false;
- const icon = (name) => renderIcon(name, undefined, false, colorBlind);
- const token = (name, n) => renderToken(name, n, undefined, colorBlind);
+ let colorBlind = false,
+ lang = language;
+ const icon = (name) =>
+ renderIcon(name, translateText(iconLabel(name), lang), false, colorBlind);
+ const token = (name, n) =>
+ renderToken(
+ name,
+ n,
+ `${translateText(iconLabel(name), lang)}: ${n}`,
+ colorBlind,
+ );
+ const markerToken = (action, n) =>
+ renderToken(
+ action,
+ n,
+ `${translateText("Markers", lang)}: ${n} · ${translateText(translator(lang)(action), lang)}`,
+ colorBlind,
+ );
const root = document.createElement("section");
root.className = "activity";
root.innerHTML = ``;
@@ -28,7 +49,6 @@ export function mountActivity(
let mode = "journal",
analysis = false,
state,
- lang = language,
t = translator(lang),
following = true,
key = "";
@@ -107,67 +127,248 @@ export function mountActivity(
root.scrollIntoView({ behavior: "smooth", block: "start" });
if (kind === "journal") list.focus({ preventScroll: true });
}
- function eventHtml(e) {
- const name = state?.players[e.p]?.name ?? "";
- const actor = name
- ? `${esc(name)}`
+ const text = (source) => esc(translateText(source, lang));
+ const message = (source, value) => text(source).replace("{p0}", esc(value));
+ const playerName = (p) =>
+ state?.players[p]
+ ? `${esc(state.players[p].name)}`
: "";
+ const chip = (html, kind = "") =>
+ `${html}`;
+ const gain = (name, n) => chip(token(name, `+${n}`), "event-gain");
+ const cost = (n) =>
+ chip(n ? token("coin", `−${n}`) : text("Free"), "event-cost");
+ const location = (cell) =>
+ cell
+ ? `${esc(cell)}`
+ : "";
+ function portrait(character) {
+ const c = CHARACTERS[character];
+ return c
+ ? `
`
+ : "";
+ }
+ function heading(e, label, symbol, character) {
+ return `${playerName(e.p)}${portrait(character)} ${symbol ? icon(symbol) : ""}${label}`;
+ }
+ const details = (html) =>
+ html ? `${html}` : "";
+ function eventHtml(e) {
+ const d = e.details ?? {};
switch (e.type) {
- case "action":
- return `${actor} ${icon(e.action)}${e.good ? icon(e.good) : ""}${e.fish ? e.fish.map((n) => token("fish", n)).join("") : ""}${e.path ? ` ${e.path.length} ${icon("sail")}` : ""}${e.bonus ? ` ${esc(CHARACTERS[state.players[e.p]?.character]?.["name"] ?? "")}` : ""}`;
+ case "action": {
+ const parts = [];
+ if (d.cost !== undefined) parts.push(cost(d.cost));
+ if (e.path) parts.push(chip(token("sail", e.path.length)));
+ if (e.action === "sell") {
+ const fish = token(
+ "fish",
+ e.fish.reduce((a, b) => a + b, 0),
+ );
+ parts.push(
+ chip(
+ d.price === undefined
+ ? fish
+ : `${fish} × ${token("coin", d.price)} → ${token("coin", `+${d.income}`)}`,
+ "event-gain",
+ ),
+ );
+ }
+ if (d.fish !== undefined) parts.push(gain("fish", d.fish));
+ if (d.treasure !== undefined) parts.push(gain("explore", d.treasure));
+ if (e.good) parts.push(chip(token(e.good, d.shipments?.length ?? 1)));
+ if (e.hut) parts.push(chip(token("build", 1)));
+ if (e.dike) parts.push(chip(token("dike", 1)));
+ if (e.action === "tourist") parts.push(chip(token("tourist", 1)));
+ if (
+ d.income !== undefined &&
+ !(e.action === "sell" && d.price !== undefined)
+ )
+ parts.push(gain("coin", d.income));
+ if (d.points !== undefined) parts.push(gain("point", d.points));
+ const route = e.path
+ ? `${location(d.from)} → ${location(e.path.at(-1))}`
+ : location(d.cell ?? e.cell);
+ const completions =
+ d.shipments
+ ?.filter((s) => s.complete)
+ .map((s) =>
+ chip(
+ `${icon("check")}${message("Ship {p0} completed (+2 included)", s.ship)}`,
+ ),
+ )
+ .join("") ?? "";
+ const role =
+ d.character ??
+ (e.preach
+ ? "preacher"
+ : e.bonus
+ ? Object.keys(CHARACTERS).find(
+ (c) => CHARACTERS[c].action === e.action,
+ )
+ : null);
+ const rest =
+ e.action === "rest" && e.restToken && e.restToken !== "hidden"
+ ? restReward(e.restToken, false)
+ : "";
+ return (
+ heading(
+ e,
+ text(
+ e.action === "rest" && e.restToken
+ ? "Rest token chosen"
+ : t(e.action),
+ ),
+ e.action,
+ role,
+ ) +
+ details(parts.join("") + rest) +
+ (route || completions
+ ? `${route}${completions}`
+ : "")
+ );
+ }
case "plan":
- case "neutral":
- return `${actor} ${e.actions.map((a) => icon(a)).join("")}${e.type === "neutral" ? ` ●` : ""}`;
+ case "neutral": {
+ const counts = Object.fromEntries(
+ ACTIONS.map((a) => [a, e.actions.filter((v) => v === a).length]),
+ );
+ const added = ACTIONS.filter((a) => counts[a])
+ .map((a) => chip(markerToken(a, `+${counts[a]}`)))
+ .join("");
+ const totals = e.totals
+ ? `${text("Planned")}${ACTIONS.filter(
+ (a) => e.totals[a],
+ )
+ .map((a) => markerToken(a, e.totals[a]))
+ .join("")}`
+ : "";
+ return (
+ heading(
+ e,
+ text(e.type === "neutral" ? t("neutral") : "Place markers"),
+ "marker",
+ ) +
+ details(added) +
+ totals
+ );
+ }
case "character":
- return `${actor}
${esc(translateText(CHARACTERS[e.character]?.name ?? e.character, lang))}`;
+ return heading(
+ e,
+ `${portrait(e.character)}${text(CHARACTERS[e.character]?.name ?? e.character)}`,
+ );
case "conversion":
- return `${actor} ${token("coin", e.points * 2)} → ${token("point", e.points)}`;
- case "treasure":
- return `${actor} ${token(
- "explore",
- e.values.reduce((a, b) => a + b, 0),
- )} → ${token(
- "coin",
- e.values.reduce((a, b) => a + b, 0),
- )}`;
+ return (
+ heading(e, "") +
+ details(
+ chip(
+ `${token("coin", `−${e.points * 2}`)} → ${token("point", `+${e.points}`)}`,
+ ),
+ )
+ );
+ case "treasure": {
+ const n = e.values.reduce((a, b) => a + b, 0);
+ return (
+ heading(e, text(t("treasure")), "explore") +
+ details(chip(`${token("explore", n)} → ${token("coin", `+${n}`)}`))
+ );
+ }
case "beg":
- return `${actor} ${token("point", e.amount)} → ${token("coin", e.amount)}`;
+ return (
+ heading(e, text(t("beg"))) +
+ details(
+ chip(
+ `${token("point", `−${e.amount}`)} → ${token("coin", `+${e.amount}`)}`,
+ ) + portrait("beggar"),
+ )
+ );
case "discard":
- return `${actor} ${renderIcon("warning", translateText("Retrieve without acting", lang))} ${icon(e.action)}${e.markers ? ` ×${e.markers}` : ""}${e.blockers ? `${blockingHtml(state, e.p, e.action, lang, e.blockers)}` : ""}`;
+ return (
+ heading(e, text("Retrieve without acting"), "warning") +
+ details(chip(markerToken(e.action, e.markers ?? ""), "event-cost")) +
+ (e.blockers
+ ? `${blockingHtml(state, e.p, e.action, lang, e.blockers)}`
+ : "")
+ );
case "governor":
- return `${actor} ${icon(e.from)} → ${icon(e.to)}`;
+ return (
+ heading(e, text(t("governor"))) +
+ details(
+ chip(
+ `${markerToken(e.from, e.markers ?? "")} → ${markerToken(e.to, e.markers ?? "")}`,
+ ) + portrait("governor"),
+ )
+ );
case "rest":
- return `${actor} ${icon("rest")}`;
+ return (
+ heading(e, text("Rest token chosen"), "rest") +
+ details(e.token !== "hidden" ? restReward(e.token, false) : "")
+ );
case "restBonus":
- return `${actor} ${e.token === "first" ? icon("first") : e.token === "both" ? token("coin", 1) + token("point", 1) : token(e.token, 1)}`;
- case "round":
- return `${t("round")} ${e.round}/8`;
+ return (
+ heading(e, text(t("rest")), "rest") + details(restReward(e.token))
+ );
case "place":
- return `${actor} ${tilePreviewSvg(e.tile, { colorBlind, t, language: lang, prefix: "event-" + e.cell })}${esc(e.cell)}`;
+ return (
+ heading(e, "") +
+ `${tilePreviewSvg(e.tile, { colorBlind, t, language: lang, prefix: "event-" + e.cell })}${location(e.cell)}`
+ );
case "flood":
- return `${icon("water")} ${t("water")}`;
+ return heading(e, text(t("water")), "water");
+ case "submerged":
+ return heading(e, text("Submerged"), "water") + location(e.cell);
+ case "lost":
+ return `${text(t("lost"))}`;
case "end":
- return `${t("finished")}`;
+ return `${text(t("finished"))}${details((e.scores ?? []).map((score, p) => chip(`${playerName(p)} ${token("point", score)}`)).join(""))}`;
default:
return "";
}
}
+ function restReward(value, awarded = true) {
+ const reward = (name) => (awarded ? gain(name, 1) : chip(token(name, 1)));
+ if (value === "first") return chip(`${icon("first")}${text(t("first"))}`);
+ if (value === "both") return reward("coin") + reward("point");
+ return ["coin", "point"].includes(value) ? reward(value) : "";
+ }
+ function rowHtml(row) {
+ if (row.kind === "round")
+ return `${text(t("round"))} ${row.round}/8${row.first !== undefined ? `${icon("first")}${playerName(row.first)}` : ""}`;
+ if (row.kind === "phase") {
+ const label =
+ {
+ plan: "Marker placement",
+ actions: "Actions",
+ restBonus: "Rest bonuses",
+ }[row.phase] ?? t(row.phase);
+ const symbol = {
+ plan: "marker",
+ actions: "check",
+ restBonus: "rest",
+ character: "eye",
+ expand: "overview",
+ neutral: "marker",
+ ended: "point",
+ }[row.phase];
+ return `${symbol ? icon(symbol) : ""}${text(label)}${row.pass ? `${row.pass}/3` : ""}`;
+ }
+ const html = eventHtml(row.event);
+ return html
+ ? `${html}`
+ : "";
+ }
function refresh() {
if (!state) return;
const next =
JSON.stringify(state.events ?? state.lastEvents ?? []) +
lang +
- colorBlind;
+ colorBlind +
+ JSON.stringify(state.players.map(({ name, color }) => [name, color])) +
+ state.boardLayout;
if (next === key) return;
key = next;
- list.innerHTML = (state.events ?? state.lastEvents ?? [])
- .map((e) => ({ e, html: eventHtml(e) }))
- .filter((x) => x.html)
- .map(
- ({ e, html }) =>
- `${html}`,
- )
- .join("");
+ list.innerHTML = journalRows(state).map(rowHtml).join("");
if (following)
requestAnimationFrame(() => (list.scrollTop = list.scrollHeight));
}
diff --git a/viewer/journal.js b/viewer/journal.js
new file mode 100644
index 0000000..9fd0be1
--- /dev/null
+++ b/viewer/journal.js
@@ -0,0 +1,141 @@
+import { ACTIONS, START_CELLS, tileState, PRICES } from "../engine/catalog.js";
+import { actionDetails } from "../engine/event-details.js";
+
+const emptyMarkers = () => Object.fromEntries(ACTIONS.map((a) => [a, 0]));
+const total = (values) => values.reduce((a, b) => a + b, 0);
+
+// Old saves contain the moves, but not their outcomes. Reconstruct only public,
+// deterministic information. In particular, never guess old trade-ship bonuses
+// or use today's character, fish price or board contents for an earlier action.
+export function journalRows(state) {
+ const events = state.events ?? state.lastEvents ?? [];
+ const completeHistory = events[0]?.type === "start";
+ const board = {};
+ if (completeHistory)
+ for (const cell of ["0,0", ...START_CELLS]) {
+ const id = state.board[cell]?.id;
+ if (id) board[cell] = tileState(id);
+ }
+ const startBoat = Object.keys(board).find((c) => board[c].id === "startBoat");
+ const players = state.players.map(() => ({
+ boat: startBoat,
+ markers: emptyMarkers(),
+ character: null,
+ }));
+ const context = { board, players, market: completeHistory ? 3 : undefined };
+ let neutral = emptyMarkers(),
+ round,
+ phase;
+ const rows = [];
+ for (const original of events) {
+ const e = { ...original };
+ if (e.round !== round) {
+ round = e.round;
+ phase = undefined;
+ rows.push({
+ kind: "round",
+ round,
+ first: e.type === "start" ? e.p : e.first,
+ });
+ if (completeHistory || e.type === "round") context.market = 3;
+ neutral = emptyMarkers();
+ players.forEach((p) => (p.markers = emptyMarkers()));
+ }
+ if (["start", "round"].includes(e.type)) continue;
+ const player = players[e.p];
+ let nextPhase = {
+ place: "expand",
+ neutral: "neutral",
+ character: "character",
+ plan: "plan",
+ action: "actions",
+ discard: "actions",
+ governor: "actions",
+ rest: "actions",
+ restBonus: "restBonus",
+ end: "ended",
+ lost: "ended",
+ }[e.type];
+ if (e.type === "plan") {
+ const n = total(Object.values(player.markers));
+ e.pass ??= completeHistory ? Math.floor(n / 2) + 1 : undefined;
+ nextPhase += e.pass ?? "";
+ }
+ if (nextPhase && phase !== nextPhase) {
+ phase = nextPhase;
+ rows.push({
+ kind: "phase",
+ phase: e.type === "plan" ? "plan" : phase,
+ pass: e.pass,
+ });
+ }
+ if (e.type === "character") player.character = e.character;
+ if (e.type === "plan" || e.type === "neutral") {
+ const markers = e.type === "neutral" ? neutral : player.markers;
+ for (const action of e.actions) markers[action]++;
+ if (e.totals) Object.assign(markers, e.totals);
+ e.totals ??= completeHistory ? { ...markers } : undefined;
+ }
+ if (e.type === "place") board[e.cell] = tileState(e.tile);
+ if (e.type === "action") {
+ const fallback = {};
+ if (completeHistory && board[e.cell ?? player.boat])
+ Object.assign(fallback, actionDetails(context, e.p, e));
+ else {
+ if (e.cell) fallback.cell = e.cell;
+ if (e.action === "sail") {
+ fallback.cost = e.bonus ? 0 : e.path.length;
+ fallback.cell = e.path.at(-1);
+ }
+ if (e.action === "build")
+ fallback.cost = (e.hut ? (e.bonus ? 1 : 3) : 0) + (e.dike ? 1 : 0);
+ if (e.action === "buy") fallback.cost = PRICES[e.good];
+ if (e.action === "draw") fallback.points = e.bonus ? 5 : 3;
+ if (e.action === "sell" && context.market !== undefined) {
+ fallback.price = context.market;
+ fallback.income = total(e.fish) * context.market;
+ }
+ }
+ e.details = { ...fallback, ...e.details };
+ const tile = board[e.cell ?? player.boat];
+ if (e.action === "sail") player.boat = e.path.at(-1);
+ if (e.action === "sell" && context.market !== undefined)
+ context.market = Math.max(1, context.market - 1);
+ if (tile) {
+ if (e.action === "fish") tile.fish--;
+ if (e.action === "explore") tile.treasure--;
+ if (e.action === "build" && e.hut) tile.huts.push(e.p);
+ if (e.action === "draw") tile.drawings++;
+ }
+ player.markers[e.action] = 0;
+ }
+ if (e.type === "discard") {
+ e.markers ??= completeHistory ? player.markers[e.action] : undefined;
+ player.markers[e.action] = 0;
+ }
+ if (e.type === "governor") {
+ e.markers ??= completeHistory ? player.markers[e.from] : undefined;
+ player.markers[e.to] += player.markers[e.from];
+ player.markers[e.from] = 0;
+ }
+ if (e.type === "submerged" && board[e.cell]) {
+ board[e.cell].huts = [];
+ board[e.cell].drawings = 0;
+ }
+ if (e.type === "rest") {
+ const previous = rows.findLast(
+ (row) => row.kind === "event" && row.event.p === e.p,
+ );
+ if (
+ previous?.event.type === "action" &&
+ previous.event.action === "rest" &&
+ previous.event.round === e.round
+ ) {
+ previous.event.restToken = e.token;
+ continue;
+ }
+ }
+ rows.push({ kind: "event", event: e });
+ }
+ return rows;
+}
diff --git a/viewer/localization/da.json b/viewer/localization/da.json
index 8bd0849..6ed6a15 100644
--- a/viewer/localization/da.json
+++ b/viewer/localization/da.json
@@ -850,5 +850,14 @@
"épuisé": "opbrugt",
"— next catch on this tile": "— næste fangst på denne brik",
"— prochaine prise sur cette tuile": "— næste fangst på denne brik",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Placering af markører",
+ "Actions": "Handlinger",
+ "Rest bonuses": "Hvilebonusser",
+ "Place markers": "Placerer markører",
+ "Planned": "Planlagt",
+ "Ship {p0} completed (+2 included)": "Skib {p0} fyldt (+2 inkluderet)",
+ "Rest token chosen": "Hvilebrik valgt",
+ "Free": "Gratis",
+ "Location": "Placering"
}
diff --git a/viewer/localization/de.json b/viewer/localization/de.json
index 24dabc6..cb5ec57 100644
--- a/viewer/localization/de.json
+++ b/viewer/localization/de.json
@@ -850,5 +850,14 @@
"épuisé": "erschöpft",
"— next catch on this tile": "— nächster Fang auf diesem Feld",
"— prochaine prise sur cette tuile": "— nächster Fang auf diesem Feld",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Aktionssteine einsetzen",
+ "Actions": "Aktionen",
+ "Rest bonuses": "Ruheboni",
+ "Place markers": "Steine einsetzen",
+ "Planned": "Geplant",
+ "Ship {p0} completed (+2 included)": "Schiff {p0} vollständig (+2 enthalten)",
+ "Rest token chosen": "Ruheplättchen gewählt",
+ "Free": "Kostenlos",
+ "Location": "Ort"
}
diff --git a/viewer/localization/el.json b/viewer/localization/el.json
index 3bcb00d..3e233da 100644
--- a/viewer/localization/el.json
+++ b/viewer/localization/el.json
@@ -850,5 +850,14 @@
"épuisé": "εξαντλημένο",
"— next catch on this tile": "— επόμενη ψαριά σε αυτό το πλακίδιο",
"— prochaine prise sur cette tuile": "— επόμενη ψαριά σε αυτό το πλακίδιο",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Τοποθέτηση δεικτών",
+ "Actions": "Ενέργειες",
+ "Rest bonuses": "Μπόνους ανάπαυσης",
+ "Place markers": "Τοποθετεί δείκτες",
+ "Planned": "Προγραμματισμένα",
+ "Ship {p0} completed (+2 included)": "Πλοίο {p0} ολοκληρώθηκε (περιλαμβάνει +2)",
+ "Rest token chosen": "Επιλέχθηκε πλακίδιο ανάπαυσης",
+ "Free": "Δωρεάν",
+ "Location": "Θέση"
}
diff --git a/viewer/localization/en.json b/viewer/localization/en.json
index c5d9022..586cbcd 100644
--- a/viewer/localization/en.json
+++ b/viewer/localization/en.json
@@ -850,5 +850,14 @@
"épuisé": "épuisé",
"— next catch on this tile": "— next catch on this tile",
"— prochaine prise sur cette tuile": "— prochaine prise sur cette tuile",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Marker placement",
+ "Actions": "Actions",
+ "Rest bonuses": "Rest bonuses",
+ "Place markers": "Place markers",
+ "Planned": "Planned",
+ "Ship {p0} completed (+2 included)": "Ship {p0} completed (+2 included)",
+ "Rest token chosen": "Rest token chosen",
+ "Free": "Free",
+ "Location": "Location"
}
diff --git a/viewer/localization/fa.json b/viewer/localization/fa.json
index 94e095f..d077da9 100644
--- a/viewer/localization/fa.json
+++ b/viewer/localization/fa.json
@@ -850,5 +850,14 @@
"épuisé": "تمام شده",
"— next catch on this tile": "؛ صید بعدی در این کاشی",
"— prochaine prise sur cette tuile": "؛ صید بعدی در این کاشی",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "قرار دادن نشانگرها",
+ "Actions": "اقدامها",
+ "Rest bonuses": "پاداشهای استراحت",
+ "Place markers": "نشانگر میگذارد",
+ "Planned": "برنامهریزیشده",
+ "Ship {p0} completed (+2 included)": "کشتی {p0} تکمیل شد (شامل ۲+ امتیاز)",
+ "Rest token chosen": "نشان استراحت انتخاب شد",
+ "Free": "رایگان",
+ "Location": "مکان"
}
diff --git a/viewer/localization/fr.json b/viewer/localization/fr.json
index 398d838..97ed441 100644
--- a/viewer/localization/fr.json
+++ b/viewer/localization/fr.json
@@ -850,5 +850,14 @@
"épuisé": "épuisé",
"— next catch on this tile": "— prochaine prise sur cette tuile",
"— prochaine prise sur cette tuile": "— prochaine prise sur cette tuile",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Placement des pions",
+ "Actions": "Actions",
+ "Rest bonuses": "Bonus de repos",
+ "Place markers": "Place des pions",
+ "Planned": "Programmation",
+ "Ship {p0} completed (+2 included)": "Bateau {p0} complété (+2 inclus)",
+ "Rest token chosen": "Jeton Repos choisi",
+ "Free": "Gratuit",
+ "Location": "Emplacement"
}
diff --git a/viewer/localization/hi.json b/viewer/localization/hi.json
index 3ad2c75..a7e577f 100644
--- a/viewer/localization/hi.json
+++ b/viewer/localization/hi.json
@@ -850,5 +850,14 @@
"épuisé": "समाप्त",
"— next catch on this tile": "— इस टाइल पर अगली पकड़",
"— prochaine prise sur cette tuile": "— इस टाइल पर अगली पकड़",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "मार्कर रखना",
+ "Actions": "कार्रवाइयाँ",
+ "Rest bonuses": "विश्राम बोनस",
+ "Place markers": "मार्कर रखता है",
+ "Planned": "नियोजित",
+ "Ship {p0} completed (+2 included)": "जहाज़ {p0} पूरा हुआ (+2 शामिल)",
+ "Rest token chosen": "विश्राम टोकन चुना",
+ "Free": "मुफ़्त",
+ "Location": "स्थान"
}
diff --git a/viewer/localization/it.json b/viewer/localization/it.json
index d29aa92..4d79abc 100644
--- a/viewer/localization/it.json
+++ b/viewer/localization/it.json
@@ -850,5 +850,14 @@
"épuisé": "esaurito",
"— next catch on this tile": "— prossima pesca su questa tessera",
"— prochaine prise sur cette tuile": "— prossima pesca su questa tessera",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Piazzamento segnalini",
+ "Actions": "Azioni",
+ "Rest bonuses": "Bonus riposo",
+ "Place markers": "Piazza segnalini",
+ "Planned": "Pianificato",
+ "Ship {p0} completed (+2 included)": "Nave {p0} completata (+2 inclusi)",
+ "Rest token chosen": "Gettone riposo scelto",
+ "Free": "Gratis",
+ "Location": "Posizione"
}
diff --git a/viewer/localization/ko.json b/viewer/localization/ko.json
index 70d2744..af3586c 100644
--- a/viewer/localization/ko.json
+++ b/viewer/localization/ko.json
@@ -850,5 +850,14 @@
"épuisé": "고갈됨",
"— next catch on this tile": "— 이 타일에서 다음에 잡을 물고기의 가치",
"— prochaine prise sur cette tuile": "— 이 타일의 다음 어획량",
- "🏝️ Vanuatu": "🏝️ 바누아투"
+ "🏝️ Vanuatu": "🏝️ 바누아투",
+ "Marker placement": "마커 배치",
+ "Actions": "행동",
+ "Rest bonuses": "휴식 보너스",
+ "Place markers": "마커 배치",
+ "Planned": "계획",
+ "Ship {p0} completed (+2 included)": "배 {p0} 완성 (+2 포함)",
+ "Rest token chosen": "휴식 토큰 선택",
+ "Free": "무료",
+ "Location": "위치"
}
diff --git a/viewer/localization/nl.json b/viewer/localization/nl.json
index 0638378..df3b643 100644
--- a/viewer/localization/nl.json
+++ b/viewer/localization/nl.json
@@ -850,5 +850,14 @@
"épuisé": "uitgeput",
"— next catch on this tile": "— volgende vangst op deze tegel",
"— prochaine prise sur cette tuile": "— volgende vangst op deze tegel",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Actiemarkers plaatsen",
+ "Actions": "Acties",
+ "Rest bonuses": "Rustbonussen",
+ "Place markers": "Plaatst markers",
+ "Planned": "Gepland",
+ "Ship {p0} completed (+2 included)": "Schip {p0} voltooid (+2 inbegrepen)",
+ "Rest token chosen": "Rustfiche gekozen",
+ "Free": "Gratis",
+ "Location": "Locatie"
}
diff --git a/viewer/localization/pl.json b/viewer/localization/pl.json
index 1c98e87..5e85026 100644
--- a/viewer/localization/pl.json
+++ b/viewer/localization/pl.json
@@ -850,5 +850,14 @@
"épuisé": "wyczerpany",
"— next catch on this tile": "— następny połów na tym kafelku",
"— prochaine prise sur cette tuile": "— prochaine prise sur cette tuile",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Rozmieszczanie znaczników",
+ "Actions": "Akcje",
+ "Rest bonuses": "Premie odpoczynku",
+ "Place markers": "Umieszcza znaczniki",
+ "Planned": "Zaplanowane",
+ "Ship {p0} completed (+2 included)": "Statek {p0} zapełniony (+2 wliczone)",
+ "Rest token chosen": "Wybrano żeton odpoczynku",
+ "Free": "Za darmo",
+ "Location": "Miejsce"
}
diff --git a/viewer/localization/pt-BR.json b/viewer/localization/pt-BR.json
index 0746ba5..f04ba5e 100644
--- a/viewer/localization/pt-BR.json
+++ b/viewer/localization/pt-BR.json
@@ -850,5 +850,14 @@
"épuisé": "esgotado",
"— next catch on this tile": "— próxima captura neste tile",
"— prochaine prise sur cette tuile": "— próxima pesca nesta peça",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Colocação de marcadores",
+ "Actions": "Ações",
+ "Rest bonuses": "Bônus de descanso",
+ "Place markers": "Coloca marcadores",
+ "Planned": "Planejado",
+ "Ship {p0} completed (+2 included)": "Navio {p0} completo (+2 incluídos)",
+ "Rest token chosen": "Ficha de descanso escolhida",
+ "Free": "Grátis",
+ "Location": "Local"
}
diff --git a/viewer/localization/ro.json b/viewer/localization/ro.json
index 7a4f4da..880bedf 100644
--- a/viewer/localization/ro.json
+++ b/viewer/localization/ro.json
@@ -850,5 +850,14 @@
"épuisé": "epuizat",
"— next catch on this tile": "— următoarea captură pe această piesă",
"— prochaine prise sur cette tuile": "— următoarea captură pe această piesă",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Plasarea jetoanelor",
+ "Actions": "Acțiuni",
+ "Rest bonuses": "Bonusuri de odihnă",
+ "Place markers": "Plasează jetoane",
+ "Planned": "Planificate",
+ "Ship {p0} completed (+2 included)": "Nava {p0} completată (+2 incluse)",
+ "Rest token chosen": "Jeton de odihnă ales",
+ "Free": "Gratuit",
+ "Location": "Loc"
}
diff --git a/viewer/localization/rtl.css b/viewer/localization/rtl.css
index af816a7..fb5480e 100644
--- a/viewer/localization/rtl.css
+++ b/viewer/localization/rtl.css
@@ -28,3 +28,10 @@
.event-explanation:lang(fa) {
unicode-bidi: plaintext;
}
+
+.vanuatu .event-verb:lang(fa),
+.vanuatu .phase-divider:lang(fa),
+.vanuatu .event-totals > span:lang(fa) {
+ direction: rtl;
+ unicode-bidi: plaintext;
+}
diff --git a/viewer/localization/ru.json b/viewer/localization/ru.json
index 03e240f..76fb848 100644
--- a/viewer/localization/ru.json
+++ b/viewer/localization/ru.json
@@ -850,5 +850,14 @@
"épuisé": "исчерпано",
"— next catch on this tile": "— следующий улов на этом тайле",
"— prochaine prise sur cette tuile": "— следующий улов на этой клетке",
- "🏝️ Vanuatu": "🏝️ Вануату"
+ "🏝️ Vanuatu": "🏝️ Вануату",
+ "Marker placement": "Размещение маркеров",
+ "Actions": "Действия",
+ "Rest bonuses": "Бонусы отдыха",
+ "Place markers": "Размещает маркеры",
+ "Planned": "Запланировано",
+ "Ship {p0} completed (+2 included)": "Корабль {p0} заполнен (+2 учтены)",
+ "Rest token chosen": "Выбран жетон отдыха",
+ "Free": "Бесплатно",
+ "Location": "Место"
}
diff --git a/viewer/localization/vi.json b/viewer/localization/vi.json
index 5abaed4..ddb6f60 100644
--- a/viewer/localization/vi.json
+++ b/viewer/localization/vi.json
@@ -850,5 +850,14 @@
"épuisé": "đã cạn kiệt",
"— next catch on this tile": "— giá trị mẻ cá tiếp theo trên ô này",
"— prochaine prise sur cette tuile": "— mẻ cá tiếp theo trên ô này",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "Đặt dấu hành động",
+ "Actions": "Hành động",
+ "Rest bonuses": "Thưởng nghỉ ngơi",
+ "Place markers": "Đặt dấu hành động",
+ "Planned": "Đã lên kế hoạch",
+ "Ship {p0} completed (+2 included)": "Tàu {p0} đã đầy (đã tính +2)",
+ "Rest token chosen": "Đã chọn thẻ nghỉ ngơi",
+ "Free": "Miễn phí",
+ "Location": "Vị trí"
}
diff --git a/viewer/localization/zh-TW.json b/viewer/localization/zh-TW.json
index cc1304b..087bec4 100644
--- a/viewer/localization/zh-TW.json
+++ b/viewer/localization/zh-TW.json
@@ -850,5 +850,14 @@
"épuisé": "已枯竭",
"— next catch on this tile": "— 此板塊下次捕魚的價值",
"— prochaine prise sur cette tuile": "— 此板塊的下次漁獲",
- "🏝️ Vanuatu": "🏝️ Vanuatu"
+ "🏝️ Vanuatu": "🏝️ Vanuatu",
+ "Marker placement": "放置標記",
+ "Actions": "行動",
+ "Rest bonuses": "休息獎勵",
+ "Place markers": "放置標記",
+ "Planned": "已規劃",
+ "Ship {p0} completed (+2 included)": "船隻 {p0} 已裝滿(含 +2)",
+ "Rest token chosen": "已選擇休息標記",
+ "Free": "免費",
+ "Location": "位置"
}
diff --git a/viewer/style.css b/viewer/style.css
index c2d1aa3..d6af1f8 100644
--- a/viewer/style.css
+++ b/viewer/style.css
@@ -1625,3 +1625,96 @@ body:has(.vanuatu) {
border-radius: 999px;
background: #f0eddd;
}
+
+/* The journal separates intentions (markers) from the actions they pay for. */
+.vanuatu .event-list .phase-divider {
+ padding: 6px 8px;
+ margin-top: 8px;
+ background: #e5ece2;
+ border-left: 3px solid #568d88;
+ border-bottom: 0;
+ border-radius: 3px;
+ font-size: 11px;
+ gap: 7px;
+}
+.vanuatu .phase-divider > span {
+ margin-left: auto;
+ font-variant-numeric: tabular-nums;
+}
+.vanuatu .event-list .journal-event {
+ padding: 6px 0;
+ gap: 5px 8px;
+}
+.vanuatu .event-main,
+.vanuatu .event-verb,
+.vanuatu .event-details,
+.vanuatu .event-context,
+.vanuatu .event-totals,
+.vanuatu .event-first {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 5px;
+}
+.vanuatu .event-main {
+ flex-basis: auto;
+ gap: 4px 8px;
+}
+.vanuatu .event-player {
+ overflow-wrap: anywhere;
+}
+.vanuatu .event-verb {
+ font-weight: 500;
+}
+.vanuatu .event-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 2px 5px;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ background: var(--paper);
+ line-height: 1.4;
+}
+.vanuatu .event-gain {
+ color: #356a43;
+}
+.vanuatu .event-cost {
+ color: #97502d;
+}
+.vanuatu .event-context {
+ color: var(--muted);
+ font-size: 10px;
+}
+.vanuatu .event-totals {
+ flex-basis: 100%;
+ color: var(--muted);
+ font-size: 10px;
+ gap: 4px 8px;
+}
+.vanuatu .event-totals .icon {
+ width: 19px;
+ height: 19px;
+}
+.vanuatu .event-coordinate {
+ white-space: nowrap;
+ font-variant-numeric: tabular-nums;
+}
+.vanuatu .event-role {
+ display: inline-flex;
+}
+.vanuatu .event-role .event-character {
+ width: 22px;
+ height: 28px;
+}
+.vanuatu .event-select-character .event-role .event-character {
+ width: 32px;
+ height: 40px;
+}
+.vanuatu .event-first {
+ margin-left: auto;
+ font-size: 11px;
+}
+.vanuatu .event-list .round-divider {
+ background: var(--paper);
+}