Clarify stock buying and swaps

Buy panel: each chain row shows how many shares you own and what you will
own after this purchase, and a disabled "+" now says why (none left in the
bank, not enough cash, or the per-turn limit reached).

Stock swap panel: the selects say "you have N" and "bank has N" instead of
bare numbers, the quantity is a -/+ stepper with its maximum, the preview
spells out both legs with their values and the net payment, a live line
shows cash and both holdings after the swap, the confirm button states the
exact exchange ("Swap 2 Tower for 2 Continental · Pay $800"), and an
unavailable pair explains why (no swaps left, bank empty, not enough cash).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude 2026-11-04 07:28:05 -07:00 • committed by Mike Isom
commit 84f84302b6
20 changed files with 447 additions and 35 deletions

View file

@ -123,6 +123,14 @@
const price = (chain: ChainId) => sharePrice(chain, chainSize(game.board, chain));
const cost = $derived(Object.entries(shares).reduce((sum, [chain, n]) => sum + n * price(chain as ChainId), 0));
const total = $derived(Object.values(shares).reduce((sum, n) => sum + n, 0));
const cash = $derived(seat === undefined ? 0 : game.seats[seat]!.cash);
/** Why one more share of `chain` cannot be added, beyond the shared purchase limit. */
function buyBlocked(chain: ChainId): string | undefined {
if (total >= buyLimit || canBuy(moves, adjustShares(shares, chain, 1))) {
return undefined;
}
return game.bank[chain] - (shares[chain] ?? 0) <= 0 ? t("buy.soldOut") : t("buy.cantAfford");
}
function placeSelected(): void {
if (store.selected !== undefined) {
@ -425,8 +433,23 @@
{#each buyable as chain (chain)}
{@const fewer = adjustShares(shares, chain, -1)}
{@const more = adjustShares(shares, chain, 1)}
{@const own = game.seats[seat!]!.shares[chain]}
{@const why = buyBlocked(chain)}
<tr>
<td><ChainMark {chain} withName /></td>
<td>
<ChainMark {chain} withName />
{#if own > 0 || shares[chain]}
<small class="own"
>{t("buy.owned")}
<bdi dir="ltr"
>{#if shares[chain]}{own}<span class="arrow">→</span>{/if}<strong
>{own + (shares[chain] ?? 0)}</strong
></bdi
></small
>
{/if}
{#if why}<small class="why">{why}</small>{/if}
</td>
<td class="num">{money(price(chain))}</td>
<td class="num">{game.bank[chain]}</td>
<td class="num stepper">
@ -456,8 +479,9 @@
count: total,
limit: buyLimit,
cost: money(cost),
cash: money(game.seats[seat!]!.cash - cost),
cash: money(cash - cost),
})}
{#if total >= buyLimit}<small class="why">{t("buy.limitReached", { limit: buyLimit })}</small>{/if}
</p>
<button type="button" class="actionable primary" onclick={() => store.send({ type: "buy", shares })}>
{total === 0 ? t("buy.nothing") : t("buy.confirm", { cost: money(cost) })}
@ -586,6 +610,19 @@
background: var(--panel-alt);
font-weight: 600;
}
.own,
.why {
display: block;
font-size: 12px;
color: var(--ink-muted);
font-variant-numeric: tabular-nums;
}
.why {
font-style: italic;
}
.own .arrow {
margin-inline: 0.25em;
}
.steppers .preset {
width: 100%;
padding: 5px 6px;

View file

@ -9,9 +9,11 @@
type ChainId,
} from "acquire-engine";
import ChainMark from "./ChainMark.svelte";
import HoldingChange from "./HoldingChange.svelte";
import { ofType } from "./decisions";
import { chainName } from "./format";
import type { ViewerStore } from "./store.svelte";
import { holdingsAfter, moveEffect } from "./turn-summary";
let { store, open = $bindable(false) }: { store: ViewerStore; open?: boolean } = $props();
const game = $derived(store.state!);
@ -19,11 +21,12 @@
const money = $derived(store.lang.money);
const choices = $derived(ofType(store.moves, "swap"));
const active = $derived(activeChains(game.board));
const held = $derived(game.seats[game.activeSeat]!.shares);
const seat = $derived(game.seats[game.activeSeat]!);
const held = $derived(seat.shares);
const remaining = $derived(stockSwapsRemaining(game));
let from = $state<ChainId>("tower");
let to = $state<ChainId>("continental");
let count = $state<number | undefined>(1);
let count = $state(1);
$effect(() => {
void store.state;
const first = choices[0];
@ -40,7 +43,23 @@
const cash = $derived(
cost === 0 ? t("swap.even") : t(cost > 0 ? "swap.pay" : "swap.receive", { amount: money(Math.abs(cost)) })
);
const price = (chain: ChainId) => money(sharePrice(chain, chainSize(game.board, chain)));
const priceOf = (chain: ChainId) => sharePrice(chain, chainSize(game.board, chain));
const after = $derived.by(() => {
const effect = selected && moveEffect(game, selected);
return effect ? holdingsAfter(game, effect) : undefined;
});
/** Why this pair cannot be swapped at all, most specific reason first. */
const blocked = $derived.by(() => {
if (remaining <= 0) {
return t("swap.noneLeft");
}
if (game.bank[to] <= 0) {
return t("swap.bankEmpty", { chain: chainName(to) });
}
return priceOf(to) > priceOf(from) && seat.cash < priceOf(to) - priceOf(from)
? t("swap.cash")
: t("swap.unavailable");
});
</script>
<details class="stock-swap" bind:open>
@ -63,7 +82,13 @@
}}
>
{#each active.filter((chain) => held[chain] > 0) as chain (chain)}
<option value={chain}>{chainName(chain)} · {held[chain]} · {price(chain)}</option>
<option value={chain}
>{t("swap.optionGive", {
chain: chainName(chain),
count: held[chain],
price: money(priceOf(chain)),
})}</option
>
{/each}
</select>
</label>
@ -71,26 +96,76 @@
>{t("swap.take")}
<select aria-label={t("swap.take")} bind:value={to} onchange={() => (count = 1)}>
{#each active.filter((chain) => chain !== from) as chain (chain)}
<option value={chain}>{chainName(chain)} · {game.bank[chain]} · {price(chain)}</option>
<option value={chain}
>{t("swap.optionTake", {
chain: chainName(chain),
count: game.bank[chain],
price: money(priceOf(chain)),
})}</option
>
{/each}
</select>
</label>
</div>
<div class="swap-controls">
<label>{t("swap.count")}<input type="number" min="1" {max} step="1" bind:value={count} /></label>
<div class="exchange" aria-live="polite">
<ChainMark chain={from} /><span aria-hidden="true">→</span><ChainMark chain={to} />
<strong>{selected ? cash : t("swap.unavailable")}</strong>
<span class="count-label">{t("swap.count")}</span>
<div class="stepper">
<button
type="button"
class:actionable={count > 1 && max > 0}
disabled={count <= 1 || max === 0}
onclick={() => count--}
aria-label={t("swap.fewer")}>−</button
>
<span class="value">{max === 0 ? 0 : count}</span>
<button
type="button"
class:actionable={count < max}
disabled={count >= max}
onclick={() => count++}
aria-label={t("swap.more")}>+</button
>
</div>
{#if max > 0}<small>{t("swap.max", { count: max })}</small>{/if}
</div>
{#if selected}
<p class="exchange" aria-live="polite">
<span class="leg"
><ChainMark chain={from} small />
{t("swap.giveDetail", {
count: selected.count,
chain: chainName(from),
value: money(selected.count * priceOf(from)),
})}</span
>
<span class="leg"
><ChainMark chain={to} small />
{t("swap.takeDetail", {
count: selected.count,
chain: chainName(to),
value: money(selected.count * priceOf(to)),
})}</span
>
<strong>{cash}</strong>
</p>
{#if after}
<HoldingChange label={t("swap.after")} cash={after.cash} shares={after.shares} onlyChanged />
{/if}
{:else}
<p class="why">{blocked}</p>
{/if}
<button
type="button"
class="confirm"
class:actionable={!!selected}
disabled={!selected}
onclick={() => selected && store.send(selected)}>{t("swap.confirm")}</button
onclick={() => selected && store.send(selected)}
>{selected
? t("swap.confirmExact", { count: selected.count, from: chainName(from), to: chainName(to), cash })
: t("swap.confirm")}</button
>
{:else}
<p>{t("swap.unavailable")}</p>
<p class="why">{remaining <= 0 ? t("swap.noneLeft") : t("swap.unavailable")}</p>
{/if}
</details>
@ -103,13 +178,18 @@
summary {
cursor: pointer;
font-weight: 600;
min-height: 32px;
}
small,
.note {
.note,
.why {
color: var(--ink-muted);
font-size: 13px;
font-weight: 400;
}
.why {
font-style: italic;
}
p {
margin: 8px 0;
}
@ -124,8 +204,7 @@
font-size: 13px;
min-width: 0;
}
select,
input {
select {
box-sizing: border-box;
width: 100%;
min-height: 44px;
@ -136,26 +215,44 @@
padding: 6px;
}
.swap-controls {
display: flex;
align-items: end;
gap: 12px;
margin: 10px 0;
}
.swap-controls label {
flex: 0 0 72px;
}
.exchange {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
min-width: 0;
gap: 4px 12px;
margin: 10px 0 4px;
}
.exchange strong {
flex-basis: 100%;
.count-label {
font-size: 13px;
}
.stepper {
display: inline-flex;
align-items: center;
gap: 4px;
}
.stepper button {
width: 44px;
padding: 0;
font-size: 18px;
}
.value {
display: inline-block;
min-width: 24px;
text-align: center;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.exchange {
display: grid;
gap: 4px;
min-width: 0;
font-size: 14px;
font-variant-numeric: tabular-nums;
}
.leg {
display: flex;
align-items: center;
gap: 6px;
}
button {
min-height: 44px;
padding: 6px 12px;
@ -166,6 +263,10 @@
}
button:disabled {
color: var(--ink-muted);
background: transparent;
}
.confirm {
text-align: start;
}
@media (max-width: 400px) {
.chains {

View file

@ -13,6 +13,18 @@ export const da: Catalog = {
"swap.receive": "Modtag {amount}",
"swap.even": "Ingen prisforskel",
"swap.unavailable": "Intet bytte muligt med dette antal, grænsen, aktierne og kontanterne.",
"swap.optionGive": "{chain} · du har {count} · {price}",
"swap.optionTake": "{chain} · banken har {count} · {price}",
"swap.fewer": "Byt én færre",
"swap.more": "Byt én mere",
"swap.max": "op til {count}",
"swap.giveDetail": "afgiv {count} {chain} ({value})",
"swap.takeDetail": "få {count} {chain} ({value})",
"swap.after": "Efter dette bytte",
"swap.confirmExact": "Byt {count} {from} for {count} {to} · {cash}",
"swap.noneLeft": "Ingen bytter tilbage denne tur.",
"swap.bankEmpty": "Banken har ingen {chain}-aktier.",
"swap.cash": "Ikke penge nok til prisforskellen.",
"log.swapped": "{name} bytter {count} {from} for {count} {to} · {cash}",
loading: "Indlæser spillet…",
@ -99,6 +111,10 @@ export const da: Catalog = {
"buy.total": "{count} af {limit} aktier · pris {cost} · tilbage {cash}",
"buy.nothing": "Køb intet og afslut turen",
"buy.confirm": "Køb for {cost} og afslut turen",
"buy.owned": "Du ejer",
"buy.soldOut": "Ingen tilbage i banken",
"buy.cantAfford": "Ikke penge nok til én mere",
"buy.limitReached": "Grænsen er nået: {limit} aktier pr. tur.",
"board.label": "Spilleplade",
"board.empty": "{tile} tom",
"board.loose": "{tile} enlig brik",

View file

@ -13,6 +13,18 @@ export const de: Catalog = {
"swap.receive": "{amount} erhalten",
"swap.even": "Keine Preisdifferenz",
"swap.unavailable": "Mit dieser Menge, dem Limit, Aktienbestand und Bargeld ist kein Tausch möglich.",
"swap.optionGive": "{chain} · du hast {count} · {price}",
"swap.optionTake": "{chain} · Bank hat {count} · {price}",
"swap.fewer": "Eine weniger tauschen",
"swap.more": "Eine mehr tauschen",
"swap.max": "bis zu {count}",
"swap.giveDetail": "{count} {chain} abgeben ({value})",
"swap.takeDetail": "{count} {chain} erhalten ({value})",
"swap.after": "Nach diesem Tausch",
"swap.confirmExact": "{count} {from} gegen {count} {to} tauschen · {cash}",
"swap.noneLeft": "In diesem Zug sind keine Tausche mehr übrig.",
"swap.bankEmpty": "Die Bank hat keine {chain}-Aktien.",
"swap.cash": "Nicht genug Geld für die Preisdifferenz.",
"log.swapped": "{name} tauscht {count} {from} gegen {count} {to} · {cash}",
loading: "Spiel wird geladen…",
@ -99,6 +111,10 @@ export const de: Catalog = {
"buy.total": "{count} von {limit} Aktien · Kosten {cost} · Restgeld {cash}",
"buy.nothing": "Nichts kaufen und Zug beenden",
"buy.confirm": "Für {cost} kaufen und Zug beenden",
"buy.owned": "Im Besitz",
"buy.soldOut": "Die Bank hat keine mehr",
"buy.cantAfford": "Nicht genug Geld für eine weitere",
"buy.limitReached": "Limit erreicht: {limit} Aktien pro Zug.",
"board.label": "Spielplan",
"board.empty": "{tile} leer",
"board.loose": "{tile} einzelnes Plättchen",

View file

@ -13,6 +13,18 @@ export const el: Catalog = {
"swap.receive": "Είσπραξη {amount}",
"swap.even": "Χωρίς διαφορά τιμής",
"swap.unavailable": "Δεν γίνεται ανταλλαγή με αυτή την ποσότητα, το όριο, τις μετοχές και τα μετρητά.",
"swap.optionGive": "{chain} · έχεις {count} · {price}",
"swap.optionTake": "{chain} · τράπεζα {count} · {price}",
"swap.fewer": "Ανταλλαγή μίας λιγότερης",
"swap.more": "Ανταλλαγή μίας ακόμη",
"swap.max": "έως {count}",
"swap.giveDetail": "δίνεις {count} {chain} ({value})",
"swap.takeDetail": "παίρνεις {count} {chain} ({value})",
"swap.after": "Μετά από αυτή την ανταλλαγή",
"swap.confirmExact": "Ανταλλαγή {count} {from} με {count} {to} · {cash}",
"swap.noneLeft": "Δεν απομένουν ανταλλαγές σε αυτόν τον γύρο.",
"swap.bankEmpty": "Η τράπεζα δεν έχει μετοχές {chain}.",
"swap.cash": "Δεν φτάνουν τα μετρητά για τη διαφορά τιμής.",
"log.swapped": "{name}: ανταλλαγή {count} {from} με {count} {to} · {cash}",
loading: "Φόρτωση παιχνιδιού…",
@ -99,6 +111,10 @@ export const el: Catalog = {
"buy.total": "{count} από {limit} μετοχές · κόστος {cost} · υπόλοιπο {cash}",
"buy.nothing": "Καμία αγορά και τέλος γύρου",
"buy.confirm": "Αγορά για {cost} και τέλος γύρου",
"buy.owned": "Έχεις",
"buy.soldOut": "Δεν έμειναν στην τράπεζα",
"buy.cantAfford": "Δεν φτάνουν τα μετρητά για άλλη",
"buy.limitReached": "Έφτασες το όριο: {limit} μετοχές ανά γύρο.",
"board.label": "Ταμπλό",
"board.empty": "{tile} κενό",
"board.loose": "{tile} μεμονωμένο πλακίδιο",

View file

@ -14,6 +14,18 @@ export const en = {
"swap.receive": "Receive {amount}",
"swap.even": "No cash difference",
"swap.unavailable": "No swap available with this quantity, allowance, stock and cash.",
"swap.optionGive": "{chain} · you have {count} · {price}",
"swap.optionTake": "{chain} · bank has {count} · {price}",
"swap.fewer": "Swap one fewer",
"swap.more": "Swap one more",
"swap.max": "up to {count}",
"swap.giveDetail": "give {count} {chain} ({value})",
"swap.takeDetail": "get {count} {chain} ({value})",
"swap.after": "After this swap",
"swap.confirmExact": "Swap {count} {from} for {count} {to} · {cash}",
"swap.noneLeft": "No swaps left this turn.",
"swap.bankEmpty": "The bank has no {chain} shares.",
"swap.cash": "Not enough cash to pay the price difference.",
"log.swapped": "{name} swapped {count} {from} for {count} {to} · {cash}",
loading: "Loading game…",
@ -104,6 +116,10 @@ export const en = {
"buy.total": "{count} of {limit} shares · cost {cost} · cash left {cash}",
"buy.nothing": "Buy nothing and end turn",
"buy.confirm": "Buy for {cost} and end turn",
"buy.owned": "You own",
"buy.soldOut": "None left in the bank",
"buy.cantAfford": "Not enough cash for another",
"buy.limitReached": "Limit reached: {limit} shares per turn.",
// Board and hand
"board.label": "Board",

View file

@ -13,6 +13,18 @@ export const fa: Catalog = {
"swap.receive": "دریافت {amount}",
"swap.even": "بدون اختلاف قیمت",
"swap.unavailable": "با این تعداد، سقف تعویض، سهام و وجه نقد، تعویض ممکن نیست.",
"swap.optionGive": "{chain} · دارید {count} · {price}",
"swap.optionTake": "{chain} · بانک {count} · {price}",
"swap.fewer": "یکی کمتر تعویض کن",
"swap.more": "یکی بیشتر تعویض کن",
"swap.max": "تا {count}",
"swap.giveDetail": "واگذاری {count} {chain} ({value})",
"swap.takeDetail": "دریافت {count} {chain} ({value})",
"swap.after": "پس از این تعویض",
"swap.confirmExact": "تعویض {count} {from} با {count} {to} · {cash}",
"swap.noneLeft": "در این نوبت تعویضی باقی نمانده است.",
"swap.bankEmpty": "بانک سهم {chain} ندارد.",
"swap.cash": "پول برای پرداخت اختلاف قیمت کافی نیست.",
"log.swapped": "{name} تعداد {count} سهم {from} را با {count} سهم {to} تعویض کرد · {cash}",
loading: "در حال بارگذاری بازی…",
@ -99,6 +111,10 @@ export const fa: Catalog = {
"buy.total": "{count} از {limit} سهم · هزینه {cost} · باقی‌مانده {cash}",
"buy.nothing": "چیزی نخر و نوبت را تمام کن",
"buy.confirm": "خرید به {cost} و پایان نوبت",
"buy.owned": "دارایی شما",
"buy.soldOut": "در بانک نمانده",
"buy.cantAfford": "پول برای یکی دیگر کافی نیست",
"buy.limitReached": "به سقف رسیدید: {limit} سهم در هر نوبت.",
"board.label": "صفحه‌ی بازی",
"board.empty": "{tile} خالی",
"board.loose": "{tile} کاشی تنها",

View file

@ -14,6 +14,18 @@ export const fr: Catalog = {
"swap.receive": "Recevoir {amount}",
"swap.even": "Sans différence de prix",
"swap.unavailable": "Échange impossible avec cette quantité, la limite, les actions et les fonds disponibles.",
"swap.optionGive": "{chain} · vous en avez {count} · {price}",
"swap.optionTake": "{chain} · banque : {count} · {price}",
"swap.fewer": "Échanger une de moins",
"swap.more": "Échanger une de plus",
"swap.max": "jusqu’à {count}",
"swap.giveDetail": "donner {count} {chain} ({value})",
"swap.takeDetail": "recevoir {count} {chain} ({value})",
"swap.after": "Après cet échange",
"swap.confirmExact": "Échanger {count} {from} contre {count} {to} · {cash}",
"swap.noneLeft": "Plus aucun échange possible ce tour.",
"swap.bankEmpty": "La banque n’a pas d’actions {chain}.",
"swap.cash": "Pas assez d’argent pour payer la différence de prix.",
"log.swapped": "{name} échange {count} {from} contre {count} {to} · {cash}",
loading: "Chargement de la partie…",
@ -104,6 +116,10 @@ export const fr: Catalog = {
"buy.total": "{count} actions sur {limit} · coût {cost} · argent restant {cash}",
"buy.nothing": "Ne rien acheter et finir le tour",
"buy.confirm": "Acheter pour {cost} et finir le tour",
"buy.owned": "Vous avez",
"buy.soldOut": "Plus aucune en banque",
"buy.cantAfford": "Pas assez d’argent pour une de plus",
"buy.limitReached": "Limite atteinte : {limit} actions par tour.",
"board.label": "Plateau",
"board.empty": "{tile} vide",
"board.loose": "{tile} tuile isolée",

View file

@ -13,6 +13,18 @@ export const hi: Catalog = {
"swap.receive": "{amount} लें",
"swap.even": "कीमत में कोई अंतर नहीं",
"swap.unavailable": "इस मात्रा, सीमा, शेयरों और नकद के साथ अदला-बदली उपलब्ध नहीं है।",
"swap.optionGive": "{chain} · आपके पास {count} · {price}",
"swap.optionTake": "{chain} · बैंक में {count} · {price}",
"swap.fewer": "एक कम बदलें",
"swap.more": "एक और बदलें",
"swap.max": "{count} तक",
"swap.giveDetail": "{count} {chain} दें ({value})",
"swap.takeDetail": "{count} {chain} लें ({value})",
"swap.after": "इस अदला-बदली के बाद",
"swap.confirmExact": "{count} {from} के बदले {count} {to} लें · {cash}",
"swap.noneLeft": "इस बारी में कोई अदला-बदली बाकी नहीं।",
"swap.bankEmpty": "बैंक में {chain} के शेयर नहीं हैं।",
"swap.cash": "कीमत का अंतर चुकाने के लिए नकद पर्याप्त नहीं।",
"log.swapped": "{name} ने {count} {from} के बदले {count} {to} लिए · {cash}",
loading: "खेल लोड हो रहा है…",
@ -98,6 +110,10 @@ export const hi: Catalog = {
"buy.total": "{limit} में से {count} शेयर · लागत {cost} · बची नकदी {cash}",
"buy.nothing": "कुछ न खरीदें और बारी समाप्त करें",
"buy.confirm": "{cost} में खरीदें और बारी समाप्त करें",
"buy.owned": "आपके पास",
"buy.soldOut": "बैंक में नहीं बचे",
"buy.cantAfford": "एक और के लिए नकद पर्याप्त नहीं",
"buy.limitReached": "सीमा पूरी: हर बारी में {limit} शेयर।",
"board.label": "बोर्ड",
"board.empty": "{tile} खाली",
"board.loose": "{tile} अकेली टाइल",

View file

@ -13,6 +13,18 @@ export const it: Catalog = {
"swap.receive": "Ricevi {amount}",
"swap.even": "Nessuna differenza di prezzo",
"swap.unavailable": "Scambio impossibile con questa quantità, il limite, le azioni e il denaro disponibili.",
"swap.optionGive": "{chain} · ne hai {count} · {price}",
"swap.optionTake": "{chain} · banca {count} · {price}",
"swap.fewer": "Scambia un’azione in meno",
"swap.more": "Scambia un’azione in più",
"swap.max": "fino a {count}",
"swap.giveDetail": "cedi {count} {chain} ({value})",
"swap.takeDetail": "ricevi {count} {chain} ({value})",
"swap.after": "Dopo questo scambio",
"swap.confirmExact": "Scambia {count} {from} con {count} {to} · {cash}",
"swap.noneLeft": "Nessuno scambio rimasto in questo turno.",
"swap.bankEmpty": "La banca non ha azioni {chain}.",
"swap.cash": "Denaro insufficiente per la differenza di prezzo.",
"log.swapped": "{name} scambia {count} {from} con {count} {to} · {cash}",
loading: "Caricamento della partita…",
@ -103,6 +115,10 @@ export const it: Catalog = {
"buy.total": "{count} di {limit} azioni · costo {cost} · restano {cash}",
"buy.nothing": "Non comprare nulla e termina il turno",
"buy.confirm": "Compra per {cost} e termina il turno",
"buy.owned": "Possiedi",
"buy.soldOut": "Nessuna in banca",
"buy.cantAfford": "Denaro insufficiente per un’altra",
"buy.limitReached": "Limite raggiunto: {limit} azioni per turno.",
"board.label": "Tabellone",
"board.empty": "{tile} vuota",
"board.loose": "{tile} tessera isolata",

View file

@ -13,6 +13,18 @@ export const ko: Catalog = {
"swap.receive": "{amount} 수령",
"swap.even": "차액 없음",
"swap.unavailable": "이 수량, 교환 한도, 주식 및 현금으로는 교환할 수 없습니다.",
"swap.optionGive": "{chain} · 보유 {count} · {price}",
"swap.optionTake": "{chain} · 은행 {count} · {price}",
"swap.fewer": "한 주 덜 교환",
"swap.more": "한 주 더 교환",
"swap.max": "최대 {count}",
"swap.giveDetail": "{chain} {count}주 제공 ({value})",
"swap.takeDetail": "{chain} {count}주 수령 ({value})",
"swap.after": "이 교환 후",
"swap.confirmExact": "{from} {count}주를 {to} {count}주로 교환 · {cash}",
"swap.noneLeft": "이번 턴에 남은 교환이 없습니다.",
"swap.bankEmpty": "은행에 {chain} 주식이 없습니다.",
"swap.cash": "가격 차이를 낼 현금이 부족합니다.",
"log.swapped": "{name}: {from} {count}주를 {to} {count}주로 교환 · {cash}",
loading: "게임을 불러오는 중…",
@ -99,6 +111,10 @@ export const ko: Catalog = {
"buy.total": "{limit}주 중 {count}주 · 비용 {cost} · 남는 돈 {cash}",
"buy.nothing": "사지 않고 턴 끝내기",
"buy.confirm": "{cost}에 사고 턴 끝내기",
"buy.owned": "보유",
"buy.soldOut": "은행에 남은 주식 없음",
"buy.cantAfford": "한 주 더 살 현금 부족",
"buy.limitReached": "한도 도달: 턴당 {limit}주.",
"board.label": "게임판",
"board.empty": "{tile} 빈칸",
"board.loose": "{tile} 따로 놓인 타일",

View file

@ -13,6 +13,18 @@ export const nl: Catalog = {
"swap.receive": "Ontvang {amount}",
"swap.even": "Geen prijsverschil",
"swap.unavailable": "Geen ruil mogelijk met dit aantal, de limiet, aandelen en contanten.",
"swap.optionGive": "{chain} · je hebt {count} · {price}",
"swap.optionTake": "{chain} · bank heeft {count} · {price}",
"swap.fewer": "Eén minder ruilen",
"swap.more": "Eén meer ruilen",
"swap.max": "tot {count}",
"swap.giveDetail": "geef {count} {chain} ({value})",
"swap.takeDetail": "krijg {count} {chain} ({value})",
"swap.after": "Na deze ruil",
"swap.confirmExact": "Ruil {count} {from} voor {count} {to} · {cash}",
"swap.noneLeft": "Geen ruilen meer over deze beurt.",
"swap.bankEmpty": "De bank heeft geen {chain}-aandelen.",
"swap.cash": "Niet genoeg geld voor het prijsverschil.",
"log.swapped": "{name} ruilt {count} {from} voor {count} {to} · {cash}",
loading: "Spel laden…",
@ -99,6 +111,10 @@ export const nl: Catalog = {
"buy.total": "{count} van {limit} aandelen · kosten {cost} · over {cash}",
"buy.nothing": "Niets kopen en beurt beëindigen",
"buy.confirm": "Kopen voor {cost} en beurt beëindigen",
"buy.owned": "Je hebt",
"buy.soldOut": "Geen meer in de bank",
"buy.cantAfford": "Niet genoeg geld voor nog één",
"buy.limitReached": "Limiet bereikt: {limit} aandelen per beurt.",
"board.label": "Spelbord",
"board.empty": "{tile} leeg",
"board.loose": "{tile} losse tegel",

View file

@ -13,6 +13,18 @@ export const pl: Catalog = {
"swap.receive": "Otrzymaj {amount}",
"swap.even": "Bez dopłaty",
"swap.unavailable": "Wymiana niemożliwa przy tej liczbie, limicie, akcjach i gotówce.",
"swap.optionGive": "{chain} · masz {count} · {price}",
"swap.optionTake": "{chain} · w banku {count} · {price}",
"swap.fewer": "Wymień jedną mniej",
"swap.more": "Wymień jedną więcej",
"swap.max": "maks. {count}",
"swap.giveDetail": "oddaj {count} {chain} ({value})",
"swap.takeDetail": "otrzymaj {count} {chain} ({value})",
"swap.after": "Po tej wymianie",
"swap.confirmExact": "Wymień {count} {from} na {count} {to} · {cash}",
"swap.noneLeft": "W tej turze nie zostały już wymiany.",
"swap.bankEmpty": "Bank nie ma akcji {chain}.",
"swap.cash": "Za mało gotówki na pokrycie różnicy cen.",
"log.swapped": "{name} wymienia {count} {from} na {count} {to} · {cash}",
loading: "Wczytywanie gry…",
@ -104,6 +116,10 @@ export const pl: Catalog = {
"buy.total": "{count} z {limit} akcji · koszt {cost} · zostaje {cash}",
"buy.nothing": "Nic nie kupuj i zakończ turę",
"buy.confirm": "Kup za {cost} i zakończ turę",
"buy.owned": "Masz",
"buy.soldOut": "Brak w banku",
"buy.cantAfford": "Za mało gotówki na kolejną",
"buy.limitReached": "Osiągnięto limit: {limit} akcji na turę.",
"board.label": "Plansza",
"board.empty": "{tile} puste",
"board.loose": "{tile} pojedyncza płytka",

View file

@ -13,6 +13,18 @@ export const ptBR: Catalog = {
"swap.receive": "Receber {amount}",
"swap.even": "Sem diferença de preço",
"swap.unavailable": "Troca indisponível com esta quantidade, limite, ações e dinheiro.",
"swap.optionGive": "{chain} · você tem {count} · {price}",
"swap.optionTake": "{chain} · banco tem {count} · {price}",
"swap.fewer": "Trocar uma a menos",
"swap.more": "Trocar uma a mais",
"swap.max": "até {count}",
"swap.giveDetail": "dar {count} {chain} ({value})",
"swap.takeDetail": "receber {count} {chain} ({value})",
"swap.after": "Depois desta troca",
"swap.confirmExact": "Trocar {count} {from} por {count} {to} · {cash}",
"swap.noneLeft": "Não restam trocas neste turno.",
"swap.bankEmpty": "O banco não tem ações de {chain}.",
"swap.cash": "Dinheiro insuficiente para pagar a diferença de preço.",
"log.swapped": "{name} trocou {count} {from} por {count} {to} · {cash}",
loading: "Carregando o jogo…",
@ -103,6 +115,10 @@ export const ptBR: Catalog = {
"buy.total": "{count} de {limit} ações · custo {cost} · sobra {cash}",
"buy.nothing": "Não comprar nada e encerrar o turno",
"buy.confirm": "Comprar por {cost} e encerrar o turno",
"buy.owned": "Você tem",
"buy.soldOut": "Nenhuma no banco",
"buy.cantAfford": "Dinheiro insuficiente para mais uma",
"buy.limitReached": "Limite atingido: {limit} ações por turno.",
"board.label": "Tabuleiro",
"board.empty": "{tile} vazia",
"board.loose": "{tile} peça isolada",

View file

@ -14,6 +14,18 @@ export const ro: Catalog = {
"swap.receive": "Primești {amount}",
"swap.even": "Fără diferență de preț",
"swap.unavailable": "Schimb imposibil cu această cantitate, limită, stoc și numerar.",
"swap.optionGive": "{chain} · ai {count} · {price}",
"swap.optionTake": "{chain} · banca are {count} · {price}",
"swap.fewer": "Schimbă una mai puțin",
"swap.more": "Schimbă una în plus",
"swap.max": "până la {count}",
"swap.giveDetail": "dai {count} {chain} ({value})",
"swap.takeDetail": "primești {count} {chain} ({value})",
"swap.after": "După acest schimb",
"swap.confirmExact": "Schimbă {count} {from} pe {count} {to} · {cash}",
"swap.noneLeft": "Nu mai ai schimburi în această tură.",
"swap.bankEmpty": "Banca nu are acțiuni {chain}.",
"swap.cash": "Bani insuficienți pentru diferența de preț.",
"log.swapped": "{name} schimbă {count} {from} pentru {count} {to} · {cash}",
loading: "Se încarcă jocul…",
@ -104,6 +116,10 @@ export const ro: Catalog = {
"buy.total": "{count} din {limit} acțiuni · cost {cost} · bani rămași {cash}",
"buy.nothing": "Nu cumpăra nimic și încheie tura",
"buy.confirm": "Cumpără cu {cost} și încheie tura",
"buy.owned": "Deții",
"buy.soldOut": "Banca nu mai are",
"buy.cantAfford": "Bani insuficienți pentru încă una",
"buy.limitReached": "Limită atinsă: {limit} acțiuni pe tură.",
"board.label": "Tablă",
"board.empty": "{tile} liber",
"board.loose": "{tile} piesă izolată",

View file

@ -13,6 +13,18 @@ export const ru: Catalog = {
"swap.receive": "Получить {amount}",
"swap.even": "Без доплаты",
"swap.unavailable": "Обмен невозможен с этим количеством, лимитом, запасом акций и наличными.",
"swap.optionGive": "{chain} · у вас {count} · {price}",
"swap.optionTake": "{chain} · в банке {count} · {price}",
"swap.fewer": "Обменять на одну меньше",
"swap.more": "Обменять на одну больше",
"swap.max": "до {count}",
"swap.giveDetail": "отдать {count} {chain} ({value})",
"swap.takeDetail": "получить {count} {chain} ({value})",
"swap.after": "После этого обмена",
"swap.confirmExact": "Обменять {count} {from} на {count} {to} · {cash}",
"swap.noneLeft": "Обменов в этом ходу больше нет.",
"swap.bankEmpty": "В банке нет акций {chain}.",
"swap.cash": "Не хватает денег на разницу в цене.",
"log.swapped": "{name} обменивает {count} {from} на {count} {to} · {cash}",
loading: "Загрузка игры…",
@ -104,6 +116,10 @@ export const ru: Catalog = {
"buy.total": "{count} из {limit} акций · стоимость {cost} · останется {cash}",
"buy.nothing": "Ничего не покупать и закончить ход",
"buy.confirm": "Купить за {cost} и закончить ход",
"buy.owned": "У вас",
"buy.soldOut": "В банке не осталось",
"buy.cantAfford": "Не хватает денег на ещё одну",
"buy.limitReached": "Лимит достигнут: {limit} акций за ход.",
"board.label": "Поле",
"board.empty": "{tile} пусто",
"board.loose": "{tile} одиночная фишка",

View file

@ -13,6 +13,18 @@ export const vi: Catalog = {
"swap.receive": "Nhận {amount}",
"swap.even": "Không chênh lệch tiền",
"swap.unavailable": "Không thể đổi với số lượng, hạn mức, cổ phiếu và tiền mặt này.",
"swap.optionGive": "{chain} · bạn có {count} · {price}",
"swap.optionTake": "{chain} · ngân hàng có {count} · {price}",
"swap.fewer": "Đổi bớt một",
"swap.more": "Đổi thêm một",
"swap.max": "tối đa {count}",
"swap.giveDetail": "đưa {count} {chain} ({value})",
"swap.takeDetail": "nhận {count} {chain} ({value})",
"swap.after": "Sau lần đổi này",
"swap.confirmExact": "Đổi {count} {from} lấy {count} {to} · {cash}",
"swap.noneLeft": "Lượt này đã hết lần đổi.",
"swap.bankEmpty": "Ngân hàng không có cổ phiếu {chain}.",
"swap.cash": "Không đủ tiền trả phần chênh lệch giá.",
"log.swapped": "{name} đổi {count} {from} lấy {count} {to} · {cash}",
loading: "Đang tải ván chơi…",
@ -99,6 +111,10 @@ export const vi: Catalog = {
"buy.total": "{count}/{limit} cổ phiếu · chi phí {cost} · còn lại {cash}",
"buy.nothing": "Không mua và kết thúc lượt",
"buy.confirm": "Mua với giá {cost} và kết thúc lượt",
"buy.owned": "Bạn có",
"buy.soldOut": "Ngân hàng đã hết",
"buy.cantAfford": "Không đủ tiền mua thêm",
"buy.limitReached": "Đã đạt giới hạn: {limit} cổ phiếu mỗi lượt.",
"board.label": "Bàn chơi",
"board.empty": "{tile} trống",
"board.loose": "{tile} ô nằm riêng",

View file

@ -13,6 +13,18 @@ export const zhCN: Catalog = {
"swap.receive": "收取 {amount}",
"swap.even": "无价差",
"swap.unavailable": "此数量、交换限额、股票与现金不足以完成交换。",
"swap.optionGive": "{chain} · 持有 {count} · {price}",
"swap.optionTake": "{chain} · 银行 {count} · {price}",
"swap.fewer": "少换一股",
"swap.more": "多换一股",
"swap.max": "最多 {count}",
"swap.giveDetail": "交出 {count} 股 {chain}({value})",
"swap.takeDetail": "取得 {count} 股 {chain}({value})",
"swap.after": "此交换后",
"swap.confirmExact": "用 {count} 股 {from} 换 {count} 股 {to} · {cash}",
"swap.noneLeft": "本回合已无交换次数。",
"swap.bankEmpty": "银行没有 {chain} 股票。",
"swap.cash": "现金不足以支付差价。",
"log.swapped": "{name} 以 {count} 股 {from} 交换 {count} 股 {to} · {cash}",
loading: "正在加载游戏…",
@ -98,6 +110,10 @@ export const zhCN: Catalog = {
"buy.total": "{count}/{limit} 股 · 花费 {cost} · 剩余 {cash}",
"buy.nothing": "不购买,结束回合",
"buy.confirm": "花费 {cost} 购买并结束回合",
"buy.owned": "持有",
"buy.soldOut": "银行已无存股",
"buy.cantAfford": "现金不足以再买一股",
"buy.limitReached": "已达上限:每回合 {limit} 股。",
"board.label": "游戏版图",
"board.empty": "{tile} 空",
"board.loose": "{tile} 单独板块",

View file

@ -13,6 +13,18 @@ export const zhTW: Catalog = {
"swap.receive": "收取 {amount}",
"swap.even": "無價差",
"swap.unavailable": "此數量、交換限額、股票與現金不足以完成交換。",
"swap.optionGive": "{chain} · 持有 {count} · {price}",
"swap.optionTake": "{chain} · 銀行 {count} · {price}",
"swap.fewer": "少換一股",
"swap.more": "多換一股",
"swap.max": "最多 {count}",
"swap.giveDetail": "交出 {count} 股 {chain}({value})",
"swap.takeDetail": "取得 {count} 股 {chain}({value})",
"swap.after": "此交換後",
"swap.confirmExact": "以 {count} 股 {from} 換 {count} 股 {to} · {cash}",
"swap.noneLeft": "本回合已無交換次數。",
"swap.bankEmpty": "銀行沒有 {chain} 股票。",
"swap.cash": "現金不足以支付差價。",
"log.swapped": "{name} 以 {count} 股 {from} 交換 {count} 股 {to} · {cash}",
loading: "正在載入遊戲…",
@ -98,6 +110,10 @@ export const zhTW: Catalog = {
"buy.total": "{count}/{limit} 股 · 花費 {cost} · 剩餘 {cash}",
"buy.nothing": "不購買,結束回合",
"buy.confirm": "花費 {cost} 購買並結束回合",
"buy.owned": "持有",
"buy.soldOut": "銀行已無存股",
"buy.cantAfford": "現金不足以再買一股",
"buy.limitReached": "已達上限:每回合 {limit} 股。",
"board.label": "遊戲圖板",
"board.empty": "{tile} 空",
"board.loose": "{tile} 單獨板塊",

View file

@ -324,8 +324,9 @@ try {
window.acquireDev.load(state);
}, preparedPosition("founding"));
await page.locator(".stock-swap summary").click();
await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2");
await page.getByRole("button", { name: "Swap one more", exact: true }).click();
assert.match(await page.locator(".exchange").innerText(), /Pay \$800/);
assert.match(await page.locator(".stock-swap .holding-change").innerText(), /\$6,000\s*→\s*\$5,200/);
for (const theme of ["dark", "light"]) {
await page.evaluate((theme) => window.acquireDev.emitter.emit("theme", { dark: theme === "dark" }), theme);
for (const locale of locales) {
@ -334,17 +335,18 @@ try {
await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1),
`stock swap ${locale} ${theme} ${width}px`
);
assert.equal(await page.locator(".stock-swap button").isEnabled(), true);
assert.equal(await page.locator(".stock-swap button.confirm").isEnabled(), true);
}
await preferences({ locale: "en" });
await page
.locator(".panel")
.screenshot({ path: fileURLToPath(new URL(`stock-swap-${theme}-${width}.png`, output)) });
}
await page.getByRole("button", { name: "Swap one fewer", exact: true }).click();
const original = await page.evaluate(() => JSON.stringify(window.acquireDev.state));
for (let revision = 0; revision < 3; revision++) {
await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2");
await page.getByRole("button", { name: "Swap shares", exact: true }).click();
await page.getByRole("button", { name: "Swap one more", exact: true }).click();
await page.getByRole("button", { name: "Swap 2 Tower for 2 Continental · Pay $800", exact: true }).click();
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("1 left"));
assert.equal(
await page.evaluate(() => JSON.stringify(window.acquireDev.state)),
@ -354,13 +356,13 @@ try {
await page.getByRole("button", { name: "Undo", exact: true }).click();
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("3 left"));
}
await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2");
await page.getByRole("button", { name: "Swap shares", exact: true }).click();
await page.getByRole("button", { name: "Swap one more", exact: true }).click();
await page.locator(".stock-swap button.confirm").click();
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("1 left"));
await page.getByLabel("Give (your stock)", { exact: true }).selectOption("continental");
await settle();
assert.match(await page.locator(".exchange").innerText(), /Receive \$400/);
await page.getByRole("button", { name: "Swap shares", exact: true }).click();
await page.locator(".stock-swap button.confirm").click();
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("0 left"));
for (let i = 0; i < 3; i++) {
await page.getByRole("button", { name: "Buy one more Tower", exact: true }).click();