Bring back objects from Sokko TCG Expeditions and open bonus and hidden destinations

- Expeditions bring back objects by weight, proportional to the loot; treasure-map fragments, burins and workshop plans need enough average Orientation.
- A guide star adds a fifth destination to the player's day, a sky chart a sixth with richer loot, and enough fragments open one of two hidden destinations: Le Passage Écarlate and L'Observatoire perdu.
- An anchor recalls a running solo expedition and keeps the Éclats and stardust already earned; a burin engraves a tag on a common to create the synergy a player wants.
- The Veilleur's bag lists objects with their use, reports show brought-back objects, and Administration › Guilde tunes object chances, weights, the Orientation threshold and hidden-destination loot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-15 17:28:05 +01:00
parent 320498d878
commit ae23adfdd9
28 changed files with 532 additions and 73 deletions

View file

@ -1,6 +1,6 @@
// Rôle : équipe une carte rare ou mieux depuis sa fiche : emplacements ouverts par la Puissance, communes à poser et leurs synergies.
import { useState } from "react";
import { equipCard } from "./cardsApi.js";
import { engraveEquipment, equipCard } from "./cardsApi.js";
import { tagLabel } from "./expeditionFormat.js";
const STAT_SHORT = { bravoure: "Bravoure", endurance: "Endurance", fortune: "Fortune", orientation: "Orientation" };
@ -8,6 +8,8 @@ const statsText = (stats) => Object.entries(stats).map(([stat, value]) => `${val
export function CardEquipment({ catalog, state, progress, busy, runMutation }) {
const [choosing, setChoosing] = useState(null);
const [engraving, setEngraving] = useState(null);
const burins = state.items?.engraving ?? 0;
const nameOf = (cardId) => catalog.cards.find((card) => card.id === cardId)?.name || cardId;
const sharedTag = (item) => item.tags.find((tag) => progress.tags.includes(tag)) ?? null;
// Communes en synergie d'abord, puis les plus fortes sur leur meilleure stat.
@ -22,8 +24,13 @@ export function CardEquipment({ catalog, state, progress, busy, runMutation }) {
const open = slot < progress.slots;
return <li key={slot} className="nds-list-row" data-locked={!open || undefined}>
{!open ? <span>Emplacement ouvert à Puissance {power}</span> : item ? <>
<span><strong>{item.name}</strong> {statsText(item.stats)}{item.synergyTag && <span className="nds-badge" data-variant="success">Synergie · {tagLabel(catalog, item.synergyTag)}</span>}</span>
<span><strong>{item.name}</strong> {statsText(item.stats)}{item.synergyTag && <span className="nds-badge" data-variant="success">Synergie · {tagLabel(catalog, item.synergyTag)}</span>}{item.engraved && <span className="nds-badge" data-variant="gold">Gravée · {tagLabel(catalog, item.engraved)}</span>}</span>
{!item.engraved && !item.synergyTag && burins > 0 && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} aria-pressed={engraving === item.editionId} onClick={() => setEngraving(engraving === item.editionId ? null : item.editionId)}>Graver</button>}
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => equip(slot, null)}>Retirer</button>
{engraving === item.editionId && <div className="nebula-card-equipment-engrave" role="group" aria-label={`Étiquette à graver sur ${item.name}`}>
<span className="nebula-form-help">Un burin grave une étiquette de cette carte sur la commune, pour toujours ({burins} burin{burins > 1 ? "s" : ""}) :</span>
{progress.tags.map((tag) => <button key={tag} className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={async () => { if (await runMutation(() => engraveEquipment(item.editionId, tag))) setEngraving(null); }}>{tagLabel(catalog, tag)}</button>)}
</div>}
</> : <>
<span>Emplacement libre</span>
<button className="nds-button" data-size="sm" data-variant={choosing === slot ? "primary" : "secondary"} type="button" disabled={busy || !choices.length} aria-pressed={choosing === slot} onClick={() => setChoosing(choosing === slot ? null : slot)}>Équiper</button>

View file

@ -97,7 +97,7 @@ export function ExpeditionPlanner({ catalog, view, mode = "solo", content, busy,
return <button key={item.id} type="button" className="nebula-expedition-destination" aria-pressed={item.id === destination.id} onClick={() => setDestinationId(item.id)}>
{cover && <img src={cover.card.image} alt="" />}
<span className="nebula-expedition-destination-copy">
<strong>{item.name}</strong>
<strong>{item.name}{item.bonusSlot && <span className="nds-badge" data-variant="gold">{content.bonusSlots[item.bonusSlot]}</span>}</strong>
<span>{item.description}</span>
<span className="nebula-expedition-destination-roles">{(group ? item.groupRoles : item.roles).map((stat) => <span key={stat} className="nds-badge" data-variant="neutral">{fillTemplate(content.roleBadge, { role: content.roles[stat], stat: content.stats[stat] })}</span>)}</span>
</span>

View file

@ -11,10 +11,12 @@ function RewardBadges({ reward, content }) {
<span className="nds-badge" data-variant="gold">{fillTemplate(content.rewardEclats, { value: formatEclats(reward.eclats) })}</span>
{reward.stardust > 0 && <span className="nds-badge" data-variant="neutral">{fillTemplate(content.rewardStardust, { value: formatStardust(reward.stardust) })}</span>}
{reward.packs.length > 0 && <span className="nds-badge" data-variant="success">{fillTemplate(content.rewardPacks, { count: reward.packs.length, s: reward.packs.length > 1 ? "s" : "" })}</span>}
{(reward.items || []).map((item, index) => <span key={`${item}-${index}`} className="nds-badge" data-variant="success">{content.items[item]}</span>)}
{reward.recalledPct != null && <span className="nds-badge" data-variant="warning">{fillTemplate(content.recalledShare, { pct: reward.recalledPct })}</span>}
</div>;
}
export function ExpeditionReport({ catalog, expedition, content, now, busy, onClaim }) {
export function ExpeditionReport({ catalog, expedition, content, now, busy, onClaim, anchors = 0, onRecall = null }) {
// Le serveur dit « en route » au chargement ; passé l'heure du retour, la page propose déjà de récupérer le butin.
// En groupe, un joueur qui a récupéré sa part voit l'expédition terminée, même si les autres n'ont pas encore récupéré la leur.
const status = expedition.claimedAt ? "completed" : expedition.status === "running" && expedition.returnsAt <= now ? "returned" : expedition.status;
@ -43,6 +45,9 @@ export function ExpeditionReport({ catalog, expedition, content, now, busy, onCl
const who = expedition.mode === "group" ? ` · ${slot.own ? content.you : slot.playerName}` : "";
return <li key={slot.position}><NebulaCard catalog={catalog} entry={entry} size="sm" /><span>{slot.role ? content.roles[slot.role] : content.noRole}{who}</span></li>;
})}</ul>
{status === "running" && expedition.mode === "solo" && anchors > 0 && onRecall && <div className="nds-card-actions">
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onRecall(expedition.id)}>{fillTemplate(content.recall, { count: anchors })}</button>
</div>}
{status === "returned" && !expedition.claimedAt && <div className="nds-card-actions">
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy} onClick={() => onClaim(expedition.id)}>{content.claim}</button>
</div>}

View file

@ -1,6 +1,6 @@
// Rôle : présente les Expéditions, quête de la Guilde : expéditions du joueur (retour, butin) et préparation d'une expédition solo.
import { useEffect, useState } from "react";
import { claimExpedition, convertStardust, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
import { addBonusDestination, claimExpedition, convertStardust, recallExpedition, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
import { fillTemplate, formatCountdown } from "./dailyShare.js";
import { ExpeditionGroupCard } from "./ExpeditionGroupCard.jsx";
import { ExpeditionPlanner } from "./ExpeditionPlanner.jsx";
@ -20,6 +20,24 @@ const expeditionCall = (call) => async () => {
}
};
// Sac du Veilleur : objets rapportés ; les destinations bonus s'ouvrent ici, l'ancre et le burin depuis l'expédition et la fiche de carte.
function ItemBag({ view, content, busy, onBonus }) {
const { items } = view;
const used = new Set(view.destinations.map((destination) => destination.bonusSlot).filter(Boolean));
const actions = { guideStar: ["5", content.useGuideStar, 1], skyChart: ["6", content.useSkyChart, 1], fragment: ["hidden", content.useFragments, view.fragmentsForMap] };
const owned = Object.entries(items).filter(([, count]) => count > 0);
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title">
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
{owned.length ? <ul>{owned.map(([id, count]) => {
const action = actions[id];
return <li key={id} className="nds-list-row">
<span><strong>{content.items[id]}</strong> ×{count}<span className="nebula-form-help">{content.itemHelp[id]}</span></span>
{action && view.enabled && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy || count < action[2] || used.has(action[0])} onClick={() => onBonus(id)}>{action[1]}</button>}
</li>;
})}</ul> : <p className="nebula-form-help">{content.bagEmpty}</p>}
</section>;
}
// Pont des Veilleurs : de la poussière vers les Éclats, au taux réglé ; la conversion inverse n'existe pas.
function BridgeForm({ rate, stardust, busy, content, onConvert }) {
const [amount, setAmount] = useState("1");
@ -81,6 +99,8 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
if (result) setNotice({ variant: "success", text: fillTemplate(content.bridged, { eclats: formatEclats(eclats) }) });
return Boolean(result);
};
const bonus = async (item) => handle(await runMutation(expeditionCall(() => addBonusDestination(item))), content.bonusAdded);
const recall = async (id) => handle(await runMutation(expeditionCall(() => recallExpedition(id))), content.recalled);
const depart = async (id) => handle(await runMutation(expeditionCall(() => departExpedition(id))), content.departed);
const expired = view.enabled && now >= view.nextDayAt;
@ -97,13 +117,14 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
</div>
</div>
<p className="nebula-form-help">{content.eclatsHelp}</p>
<ItemBag view={view} content={content} busy={busy} onBonus={bonus} />
<BridgeForm rate={view.progression.stardustPerEclat} stardust={state.wallet.stardust} busy={busy} content={content} onConvert={convert} />
{notice && <p className="nds-inline-notice" data-variant={notice.variant} role="status">{notice.text}</p>}
{expired && <div className="nds-inline-notice nebula-daily-expired" data-variant="warning" role="status"><span>{content.expired}</span><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={reload}>{content.reload}</button></div>}
{view.expeditions.length > 0 && <section className="nebula-expedition-active" aria-labelledby="nebula-expedition-active-title">
<h3 id="nebula-expedition-active-title">{content.activeTitle}</h3>
<div className="nebula-expedition-reports">{view.expeditions.map((expedition) => <ExpeditionReport key={expedition.id} catalog={catalog} expedition={expedition} content={content} now={now} busy={busy} onClaim={claim} />)}</div>
<div className="nebula-expedition-reports">{view.expeditions.map((expedition) => <ExpeditionReport key={expedition.id} catalog={catalog} expedition={expedition} content={content} now={now} busy={busy} onClaim={claim} anchors={view.items.anchor} onRecall={recall} />)}</div>
</section>}
{(view.enabled || view.groups.length > 0) && <section className="nebula-expedition-active" aria-labelledby="nebula-expedition-groups-title">

View file

@ -21,7 +21,8 @@ const EVENT_LABELS = {
expedition_cancelled_by_guild: "Expédition annulée par la Guilde",
expedition_dissolved: "Groupe d’expédition dissous",
card_upgraded: "Carte améliorée",
eclats_converted: "Éclats d’étoile obtenus"
eclats_converted: "Éclats d’étoile obtenus",
item_used: "Objet utilisé"
};
// Le journal garde la quantité réellement offerte : les comptes plus anciens n'ont reçu qu'une ouverture.
@ -65,6 +66,11 @@ function HistoryDetail({ entry, catalog }) {
if (entry.type === "expedition_cancelled_by_guild") return <span>{details.destinationName} · cartes libérées, sans butin</span>;
if (entry.type === "expedition_dissolved") return <span>{details.destinationName} · {details.reason === "creator_left" ? "dissous par son créateur" : "pas assez de joueurs"} · cartes libérées</span>;
if (entry.type === "card_upgraded") return <span>{[cardReference(entry.entityId, catalog), `niveau ${details.level}`, `Puissance ${details.power}`, details.method === "duplicate" ? "un doublon utilisé" : `−${details.eclats} Éclats`].join(" · ")}</span>;
if (entry.type === "item_used") {
const name = { anchor: "Ancre des Veilleurs", guideStar: "Étoile guide", skyChart: "Carte céleste", fragment: "Carte au trésor", engraving: "Burin de graveur" }[details.item] || details.item;
const detail = details.destinationName ? `${details.destinationName}${details.recalledPct != null ? ` · rappel à ${details.recalledPct} %` : ""}` : details.tag ? `${cardReference(details.editionId, catalog)} · étiquette gravée` : "";
return <span>{[name, detail].filter(Boolean).join(" · ")}</span>;
}
if (entry.type === "eclats_converted") return <span>+{details.eclats} Éclats · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "opening_purchased") return <span>−{formatStardust(details.price)} d’étoiles</span>;
if (!details.collectionId) return null;

View file

@ -78,6 +78,24 @@ export const EXPEDITION_SETTING_GROUPS = [
{ path: "synergy.sistersCount", label: "Cartes d’un même thème pour les Étoiles sœurs" }
]
},
{
id: "items",
title: "Objets",
help: "Chance de rapporter un objet (proportionnelle au butin), poids de chaque objet, Orientation qui ouvre la partie cachée (fragments, burins, plans) et butin des destinations cachées.",
fields: [
{ path: "items.chancePerHourPermille", label: "Chance d’objet par heure (‰)" },
{ path: "items.maxPerExpedition", label: "Objets au plus par expédition" },
{ path: "items.orientationPerSlot", label: "Orientation par place pour la partie cachée" },
{ path: "items.fragmentsForMap", label: "Fragments pour une carte au trésor" },
{ path: "items.hiddenLootPct", label: "Multiplicateur de butin des destinations cachées (%)" },
{ path: "items.weights.fragment", label: "Poids : fragment de carte au trésor" },
{ path: "items.weights.engraving", label: "Poids : burin de graveur" },
{ path: "items.weights.plan", label: "Poids : plan d’atelier" },
{ path: "items.weights.anchor", label: "Poids : ancre des Veilleurs" },
{ path: "items.weights.guideStar", label: "Poids : étoile guide (5e destination)" },
{ path: "items.weights.skyChart", label: "Poids : carte céleste (6e destination)" }
]
},
{
id: "requirements",
title: "Exigences",

View file

@ -223,3 +223,16 @@ export function convertStardust(eclats) {
export function equipCard(editionId, slot, equipmentEditionId) {
return request("/equipment", { method: "PUT", body: JSON.stringify({ editionId, slot, equipmentEditionId }) });
}
// Objets des Expéditions : destination bonus (« guideStar », « skyChart », « fragment »), rappel avec l'ancre, gravure d'une commune.
export function addBonusDestination(item) {
return request("/expeditions/bonus", { method: "POST", body: JSON.stringify({ item }) });
}
export function recallExpedition(expeditionId) {
return request(`/expeditions/${encodeURIComponent(expeditionId)}/recall`, { method: "POST" });
}
export function engraveEquipment(editionId, tag) {
return request("/equipment/engrave", { method: "POST", body: JSON.stringify({ editionId, tag }) });
}

View file

@ -118,3 +118,12 @@
.nebula-account-alerts ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.nebula-account-alerts .nds-list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding: var(--space-3); }
.nebula-account-alerts .nds-list-row > .nds-button { flex: 0 0 auto; width: auto; }
// Sac du Veilleur et gravure d'un équipement.
.nds-panel.nebula-expedition-bag { display: grid; gap: var(--space-2); padding: var(--space-4); }
.nebula-expedition-bag ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.nebula-expedition-bag .nds-list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding: var(--space-3); }
.nebula-expedition-bag .nds-list-row > span { display: grid; flex: 1 1 240px; gap: 2px; }
.nebula-expedition-bag .nds-list-row > .nds-button { flex: 0 0 auto; width: auto; }
.nebula-expedition-destination strong { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.nebula-card-equipment-engrave { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }