Add group Expeditions with a Guild board to Sokko TCG
- A player opens a group with one card and a chosen role; others join from the board with a free role, and the creator launches it once enough players are in. - At departure the Veilleur de la Guilde holds empty places without a role, each member rolls their own loot multiplied by the number of players, and distinct collections add a cohesion bonus. - An unlaunched group departs on its own at the end of recruitment with enough players, or dissolves and tells its members; leaving, dissolving and deleted accounts free cards or forfeit shares. - The Guild tile flags joinable groups; Administration › Guilde tunes group places, players, stars, recruitment, loot multipliers, keeper stats, cohesion and the score bonus cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8bb1d53d70
commit
6b7605d04e
24 changed files with 858 additions and 99 deletions
68
website/src/features/cards/ExpeditionGroupCard.jsx
Normal file
68
website/src/features/cards/ExpeditionGroupCard.jsx
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
// Rôle : présente un groupe en formation sur le tableau de la Guilde : membres, rôles libres, résultat attendu, et l'inscription d'une carte.
|
||||
import { useState } from "react";
|
||||
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
||||
import { conditionText, coverEntry, dangerText, editionEntry, formatEclats } from "./expeditionFormat.js";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
|
||||
const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
|
||||
|
||||
// Inscription : un rôle libre et une carte jouable non occupée.
|
||||
function JoinForm({ catalog, group, cards, content, busy, onJoin, onCancel }) {
|
||||
const [role, setRole] = useState(group.freeRoles[0]);
|
||||
const [editionId, setEditionId] = useState(null);
|
||||
const available = [...cards].filter((card) => !card.busy).sort((a, b) => (b.stats[role] ?? 0) - (a.stats[role] ?? 0) || b.power - a.power);
|
||||
return <div className="nebula-expedition-join">
|
||||
<div role="group" aria-label={content.joinRole} className="nds-toolbar">{group.freeRoles.map((value) => <button key={value} type="button" className="nds-button" data-size="sm" data-variant={value === role ? "primary" : "secondary"} aria-pressed={value === role} onClick={() => setRole(value)}>
|
||||
{fillTemplate(content.roleBadge, { role: content.roles[value], stat: content.stats[value] })}
|
||||
</button>)}</div>
|
||||
{available.length ? <ul className="nebula-expedition-cards" aria-label={content.cardsLabel}>{available.map((card) => {
|
||||
const entry = editionEntry(catalog, card.editionId);
|
||||
return entry && <li key={card.editionId}>
|
||||
<NebulaCard catalog={catalog} entry={entry} size="sm" selected={card.editionId === editionId} onSelect={() => setEditionId(card.editionId)} selectLabel={fillTemplate(content.chooseCard, { card: entry.card.name, role: content.roles[role] })} />
|
||||
<span className="nebula-expedition-card-power">{fillTemplate(content.power, { power: card.power })}</span>
|
||||
</li>;
|
||||
})}</ul> : <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.noCards, { count: 1 })}</p>}
|
||||
<div className="nds-toolbar">
|
||||
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !editionId} onClick={() => onJoin(group.id, { editionId, role })}>{content.joinConfirm}</button>
|
||||
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={onCancel}>{content.cancel}</button>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
|
||||
export function ExpeditionGroupCard({ catalog, group, cards, content, now, busy, limitReached, minPlayers, onJoin, onLeave, onDepart }) {
|
||||
const [joining, setJoining] = useState(false);
|
||||
const cover = group.destination.coverCardId && coverEntry(catalog, group.destination.coverCardId);
|
||||
const projected = group.projected;
|
||||
return <article className="nds-card nebula-expedition-report nebula-expedition-group" aria-labelledby={`nebula-group-${group.id}`}>
|
||||
{cover && <div className="nds-card-cover nebula-expedition-report-cover" aria-hidden="true"><img src={cover.card.image} alt="" /></div>}
|
||||
<div className="nds-card-body nebula-expedition-report-body">
|
||||
<p className="eyebrow">{fillTemplate(content.groupMeta, { stars: "★".repeat(group.stars), hours: group.hours, creator: group.isCreator ? content.you : group.creatorName })}</p>
|
||||
<h4 id={`nebula-group-${group.id}`}>{group.destination.name}</h4>
|
||||
<p className="nebula-form-help">{fillTemplate(content.groupDeadline, { time: formatCountdown(group.recruitUntil - now), min: minPlayers })}</p>
|
||||
<ul className="nebula-expedition-group-members" aria-label={content.groupMembers}>
|
||||
{group.members.map((member) => {
|
||||
const entry = editionEntry(catalog, member.editionId);
|
||||
return <li key={member.role}>{entry && <NebulaCard catalog={catalog} entry={entry} size="sm" />}<span><strong>{content.roles[member.role]}</strong>{member.own ? content.you : member.playerName}</span></li>;
|
||||
})}
|
||||
{group.freeRoles.map((role) => <li key={role} className="nebula-expedition-group-free"><span><strong>{content.roles[role]}</strong>{content.groupFreeRole}</span></li>)}
|
||||
</ul>
|
||||
{group.freeRoles.length > 0 && <p className="nebula-form-help">{content.groupKeeper}</p>}
|
||||
<div className="nebula-expedition-rewards" aria-label={content.groupProjected}>
|
||||
<span className="nds-badge" data-variant={TIER_VARIANTS[projected.tier]}>{content.tiers[projected.tier]}</span>
|
||||
<span className="nds-badge" data-variant="neutral">{fillTemplate(content.score, { score: formatEclats(projected.scorePct) })}</span>
|
||||
{projected.cohesionPct > 0 && <span className="nds-badge" data-variant="success">{fillTemplate(content.cohesion, { value: projected.cohesionPct })}</span>}
|
||||
<span className="nds-badge" data-variant="gold">{fillTemplate(content.lootBonus, { value: formatEclats(projected.lootPct / 100) })}</span>
|
||||
</div>
|
||||
{group.condition && <p className="nebula-form-help">{conditionText(group.condition, catalog, content)}</p>}
|
||||
{group.dangers.map((danger) => <p key={danger.id} className="nebula-form-help">{dangerText(danger, catalog, content)}</p>)}
|
||||
<div className="nds-card-actions nebula-expedition-group-actions">
|
||||
{group.canJoin && !joining && <button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || limitReached} onClick={() => setJoining(true)}>{content.join}</button>}
|
||||
{group.isCreator && <button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !group.canDepart} onClick={() => onDepart(group.id)}>{content.depart}</button>}
|
||||
{group.isMember && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onLeave(group.id)}>{group.isCreator ? content.dissolve : content.leave}</button>}
|
||||
</div>
|
||||
{group.isCreator && !group.canDepart && <p className="nebula-form-help">{fillTemplate(content.departWait, { min: minPlayers })}</p>}
|
||||
{group.canJoin && limitReached && <p className="nebula-form-help">{content.groupLimit}</p>}
|
||||
{joining && <JoinForm catalog={catalog} group={group} cards={cards} content={content} busy={busy} onJoin={async (...args) => { if (await onJoin(...args)) setJoining(false); }} onCancel={() => setJoining(false)} />}
|
||||
</div>
|
||||
</article>;
|
||||
}
|
||||
|
|
@ -41,17 +41,26 @@ function Preview({ preview, content }) {
|
|||
</div>;
|
||||
}
|
||||
|
||||
export function ExpeditionPlanner({ catalog, view, content, busy, onStart }) {
|
||||
// `mode` : « solo » (toutes les places à soi, rôles fixés par la destination) ou « group » (une carte et un rôle choisi, les autres places au tableau).
|
||||
export function ExpeditionPlanner({ catalog, view, mode = "solo", content, busy, onStart }) {
|
||||
const group = mode === "group";
|
||||
const slotCount = group ? 1 : view.soloCards;
|
||||
const [destinationId, setDestinationId] = useState(view.destinations[0]?.id || "");
|
||||
const [stars, setStars] = useState(view.stars.min);
|
||||
const [stars, setStars] = useState(group ? view.group.stars.min : view.stars.min);
|
||||
const [hours, setHours] = useState(view.durations[0]);
|
||||
const [slots, setSlots] = useState(() => Array.from({ length: view.soloCards }, () => null));
|
||||
const [slots, setSlots] = useState(() => Array.from({ length: slotCount }, () => null));
|
||||
const [groupRole, setGroupRole] = useState(null);
|
||||
const [activeSlot, setActiveSlot] = useState(0);
|
||||
const [preview, setPreview] = useState({ key: "", value: null, error: "" });
|
||||
const destination = view.destinations.find((item) => item.id === destinationId) || view.destinations[0];
|
||||
const option = destination?.stars[stars];
|
||||
const starOptions = group ? destination?.groupStars : destination?.stars;
|
||||
const option = starOptions?.[stars];
|
||||
const chosenRole = group ? (destination?.groupRoles.includes(groupRole) ? groupRole : destination?.groupRoles[0]) : null;
|
||||
const slotRoles = group ? [chosenRole] : destination?.roles || [];
|
||||
const complete = Boolean(destination && slots.every(Boolean));
|
||||
const body = useMemo(() => ({ day: view.day, destinationId: destination?.id, difficulty: stars, durationHours: hours, slots }), [view.day, destination?.id, stars, hours, slots]);
|
||||
const body = useMemo(() => (group
|
||||
? { mode: "group", day: view.day, destinationId: destination?.id, difficulty: stars, durationHours: hours, editionId: slots[0], role: chosenRole }
|
||||
: { day: view.day, destinationId: destination?.id, difficulty: stars, durationHours: hours, slots }), [group, view.day, destination?.id, stars, hours, slots, chosenRole]);
|
||||
const bodyKey = JSON.stringify(body);
|
||||
|
||||
// Aperçu demandé au serveur dès que l'équipe est complète, après une courte pause pour ne pas l'interroger à chaque clic.
|
||||
|
|
@ -66,7 +75,7 @@ export function ExpeditionPlanner({ catalog, view, content, busy, onStart }) {
|
|||
return () => { active = false; clearTimeout(timer); };
|
||||
}, [bodyKey, complete]);
|
||||
|
||||
const roleStat = destination?.roles[activeSlot];
|
||||
const roleStat = slotRoles[activeSlot];
|
||||
const cards = useMemo(() => [...view.cards].sort((a, b) => Number(a.busy) - Number(b.busy) || (b.stats[roleStat] ?? 0) - (a.stats[roleStat] ?? 0) || b.power - a.power), [view.cards, roleStat]);
|
||||
if (!destination) return <div className="nds-empty-state"><p>{content.noDestination}</p></div>;
|
||||
|
||||
|
|
@ -89,7 +98,7 @@ export function ExpeditionPlanner({ catalog, view, content, busy, onStart }) {
|
|||
<span className="nebula-expedition-destination-copy">
|
||||
<strong>{item.name}</strong>
|
||||
<span>{item.description}</span>
|
||||
<span className="nebula-expedition-destination-roles">{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 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>
|
||||
</button>;
|
||||
})}</div>
|
||||
|
|
@ -98,7 +107,7 @@ export function ExpeditionPlanner({ catalog, view, content, busy, onStart }) {
|
|||
<section className="nds-panel nebula-expedition-step" aria-labelledby="nebula-expedition-settings-title">
|
||||
<h3 id="nebula-expedition-settings-title">{content.difficultyTitle}</h3>
|
||||
<div className="nebula-expedition-choices">
|
||||
<div role="group" aria-label={content.difficultyLabel} className="nds-toolbar">{Object.keys(destination.stars).map(Number).map((value) => <button key={value} type="button" className="nds-button" data-size="sm" data-variant={value === stars ? "primary" : "secondary"} aria-pressed={value === stars} onClick={() => setStars(value)}>{"★".repeat(value)}</button>)}</div>
|
||||
<div role="group" aria-label={content.difficultyLabel} className="nds-toolbar">{Object.keys(starOptions).map(Number).map((value) => <button key={value} type="button" className="nds-button" data-size="sm" data-variant={value === stars ? "primary" : "secondary"} aria-pressed={value === stars} onClick={() => setStars(value)}>{"★".repeat(value)}</button>)}</div>
|
||||
<div role="group" aria-label={content.durationLabel} className="nds-toolbar">{view.durations.map((value) => <button key={value} type="button" className="nds-button" data-size="sm" data-variant={value === hours ? "primary" : "secondary"} aria-pressed={value === hours} onClick={() => setHours(value)}>{fillTemplate(content.hours, { hours: value })}</button>)}</div>
|
||||
</div>
|
||||
{option && <Requirements catalog={catalog} option={option} content={content} />}
|
||||
|
|
@ -106,10 +115,13 @@ export function ExpeditionPlanner({ catalog, view, content, busy, onStart }) {
|
|||
|
||||
<section className="nds-panel nebula-expedition-step" aria-labelledby="nebula-expedition-team-title">
|
||||
<h3 id="nebula-expedition-team-title">{content.teamTitle}</h3>
|
||||
<p className="nebula-form-help">{fillTemplate(content.teamHelp, { count: view.soloCards })}</p>
|
||||
<p className="nebula-form-help">{group ? content.groupTeamHelp : fillTemplate(content.teamHelp, { count: view.soloCards })}</p>
|
||||
{group && <div role="group" aria-label={content.joinRole} className="nds-toolbar">{destination.groupRoles.map((stat) => <button key={stat} type="button" className="nds-button" data-size="sm" data-variant={stat === chosenRole ? "primary" : "secondary"} aria-pressed={stat === chosenRole} onClick={() => setGroupRole(stat)}>
|
||||
{fillTemplate(content.roleBadge, { role: content.roles[stat], stat: content.stats[stat] })}
|
||||
</button>)}</div>}
|
||||
<div className="nebula-expedition-slots">{slots.map((editionId, index) => {
|
||||
const entry = editionId && editionEntry(catalog, editionId);
|
||||
const stat = destination.roles[index];
|
||||
const stat = slotRoles[index];
|
||||
return <div key={index} className="nebula-expedition-slot" data-active={index === activeSlot || undefined}>
|
||||
<button type="button" className="nds-button" data-size="sm" data-variant={index === activeSlot ? "primary" : "secondary"} aria-pressed={index === activeSlot} onClick={() => setActiveSlot(index)}>
|
||||
{fillTemplate(content.roleBadge, { role: content.roles[stat], stat: content.stats[stat] })}
|
||||
|
|
@ -127,16 +139,17 @@ export function ExpeditionPlanner({ catalog, view, content, busy, onStart }) {
|
|||
<span className="nebula-expedition-card-power">{card.busy ? content.busy : fillTemplate(content.power, { power: card.power })}</span>
|
||||
<StatLine stats={card.stats} content={content} />
|
||||
</li>;
|
||||
})}</ul> : <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.noCards, { count: view.soloCards })}</p>}
|
||||
})}</ul> : <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.noCards, { count: slotCount })}</p>}
|
||||
</section>
|
||||
|
||||
<section className="nds-panel nebula-expedition-step" aria-labelledby="nebula-expedition-preview-title">
|
||||
<h3 id="nebula-expedition-preview-title">{content.previewTitle}</h3>
|
||||
{!complete && <p className="nebula-form-help">{fillTemplate(content.previewEmpty, { count: view.soloCards })}</p>}
|
||||
{!complete && <p className="nebula-form-help">{fillTemplate(content.previewEmpty, { count: slotCount })}</p>}
|
||||
{group && <p className="nebula-form-help">{content.groupPreviewNote}</p>}
|
||||
{shownPreview?.error && <p className="nds-inline-notice" data-variant="warning" role="status">{shownPreview.error}</p>}
|
||||
{shownPreview?.value && <Preview preview={shownPreview.value} content={content} />}
|
||||
<div className="nds-toolbar">
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !complete} onClick={async () => { if (await onStart(body)) setSlots(slots.map(() => null)); }}>{content.start}</button>
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !complete} onClick={async () => { if (await onStart(body)) setSlots(slots.map(() => null)); }}>{group ? content.groupStart : content.start}</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ function RewardBadges({ reward, content }) {
|
|||
|
||||
export function ExpeditionReport({ catalog, expedition, content, now, busy, onClaim }) {
|
||||
// Le serveur dit « en route » au chargement ; passé l'heure du retour, la page propose déjà de récupérer le butin.
|
||||
const status = expedition.status === "running" && expedition.returnsAt <= now ? "returned" : expedition.status;
|
||||
// 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;
|
||||
const cover = expedition.destination.coverCardId && coverEntry(catalog, expedition.destination.coverCardId);
|
||||
const stars = "★".repeat(expedition.stars);
|
||||
return <article className="nds-card nebula-expedition-report" data-status={status} aria-labelledby={`nebula-expedition-${expedition.id}`}>
|
||||
|
|
@ -33,9 +34,13 @@ export function ExpeditionReport({ catalog, expedition, content, now, busy, onCl
|
|||
<span className="nds-badge" data-variant="neutral">{fillTemplate(content.score, { score: formatEclats(expedition.result.scorePct) })}</span>
|
||||
</div>}
|
||||
{expedition.reward && <RewardBadges reward={expedition.reward} content={content} />}
|
||||
<ul className="nebula-expedition-report-team" aria-label={content.teamTitle}>{expedition.slots.filter((slot) => slot.editionId).map((slot) => {
|
||||
const entry = editionEntry(catalog, slot.editionId);
|
||||
return entry && <li key={slot.position}><NebulaCard catalog={catalog} entry={entry} size="sm" /><span>{slot.role ? content.roles[slot.role] : content.noRole}</span></li>;
|
||||
{expedition.result?.players > 1 && <p className="nebula-form-help">{fillTemplate(content.reportPlayers, { count: expedition.result.players, loot: formatEclats(expedition.result.lootPct / 100) })}</p>}
|
||||
<ul className="nebula-expedition-report-team" aria-label={content.teamTitle}>{expedition.slots.map((slot) => {
|
||||
const entry = slot.editionId && editionEntry(catalog, slot.editionId);
|
||||
// Place du Veilleur de la Guilde : sans carte ni rôle.
|
||||
if (!entry) return <li key={slot.position} className="nebula-expedition-group-free"><span>{content.keeper}</span></li>;
|
||||
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 === "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>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// 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, loadExpeditions, startExpedition } from "./cardsApi.js";
|
||||
import { claimExpedition, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, startExpedition } from "./cardsApi.js";
|
||||
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
||||
import { ExpeditionGroupCard } from "./ExpeditionGroupCard.jsx";
|
||||
import { ExpeditionPlanner } from "./ExpeditionPlanner.jsx";
|
||||
import { ExpeditionReport } from "./ExpeditionReport.jsx";
|
||||
import { formatEclats } from "./expeditionFormat.js";
|
||||
|
|
@ -23,6 +24,7 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
const [loadError, setLoadError] = useState("");
|
||||
const [reloadKey, setReloadKey] = useState(0);
|
||||
const [notice, setNotice] = useState(null);
|
||||
const [mode, setMode] = useState("solo");
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -53,12 +55,16 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
else if (result?.expeditionError) setNotice({ variant: "warning", text: result.expeditionError.message });
|
||||
return false;
|
||||
};
|
||||
const start = async (body) => handle(await runMutation(expeditionCall(() => startExpedition(body))), content.started);
|
||||
const start = async (body) => handle(await runMutation(expeditionCall(() => startExpedition(body))), body.mode === "group" ? content.groupOpened : content.started);
|
||||
const claim = async (id) => handle(await runMutation(expeditionCall(() => claimExpedition(id))), content.claimed);
|
||||
const join = async (id, choice) => handle(await runMutation(expeditionCall(() => joinExpedition(id, choice))), content.joined);
|
||||
const leave = async (id) => handle(await runMutation(expeditionCall(() => leaveExpedition(id))), content.left);
|
||||
const depart = async (id) => handle(await runMutation(expeditionCall(() => departExpedition(id))), content.departed);
|
||||
|
||||
const expired = view.enabled && now >= view.nextDayAt;
|
||||
const active = view.expeditions.filter((expedition) => expedition.status === "running" && !expedition.claimedAt);
|
||||
const limitReached = active.length >= view.soloLimit;
|
||||
const soloActive = view.expeditions.filter((expedition) => expedition.mode === "solo" && expedition.status === "running" && !expedition.claimedAt);
|
||||
const soloLimitReached = soloActive.length >= view.soloLimit;
|
||||
const groupLimitReached = view.group.active >= view.group.limit;
|
||||
|
||||
return <section className="nebula-expeditions" aria-labelledby="nebula-expeditions-title">
|
||||
<div className="nds-section-heading nebula-section-heading">
|
||||
|
|
@ -77,14 +83,22 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content })
|
|||
<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>
|
||||
</section>}
|
||||
|
||||
{(view.enabled || view.groups.length > 0) && <section className="nebula-expedition-active" aria-labelledby="nebula-expedition-groups-title">
|
||||
<h3 id="nebula-expedition-groups-title">{content.groupsTitle}</h3>
|
||||
{view.groups.length ? <div className="nebula-expedition-reports">{view.groups.map((group) => <ExpeditionGroupCard key={group.id} catalog={catalog} group={group} cards={view.cards} content={content} now={now} busy={busy} limitReached={groupLimitReached} minPlayers={view.group.minPlayers} onJoin={join} onLeave={leave} onDepart={depart} />)}</div>
|
||||
: <p className="nebula-form-help">{content.groupsEmpty}</p>}
|
||||
</section>}
|
||||
|
||||
{!view.enabled ? <div className="nds-empty-state"><h3>{content.closedTitle}</h3><p>{content.closedText}</p></div>
|
||||
: limitReached ? <p className="nds-inline-notice" data-variant="info">{content.limitReached}</p>
|
||||
: !expired && <>
|
||||
<div className="nebula-expedition-plan-heading">
|
||||
<h3>{content.planTitle}</h3>
|
||||
<span className="nebula-form-help">{fillTemplate(content.nextDay, { time: formatCountdown(view.nextDayAt - now) })}</span>
|
||||
</div>
|
||||
<ExpeditionPlanner key={view.day} catalog={catalog} view={view} content={content} busy={busy} onStart={start} />
|
||||
</>}
|
||||
: !expired && <>
|
||||
<div className="nebula-expedition-plan-heading">
|
||||
<h3>{content.planTitle}</h3>
|
||||
<span className="nebula-form-help">{fillTemplate(content.nextDay, { time: formatCountdown(view.nextDayAt - now) })}</span>
|
||||
</div>
|
||||
<div role="group" aria-label={content.modeLabel} className="nds-toolbar">{[["solo", content.modeSolo], ["group", content.modeGroup]].map(([value, label]) => <button key={value} type="button" className="nds-button" data-size="sm" data-variant={value === mode ? "primary" : "secondary"} aria-pressed={value === mode} onClick={() => setMode(value)}>{label}</button>)}</div>
|
||||
{mode === "solo" && soloLimitReached ? <p className="nds-inline-notice" data-variant="info">{content.limitReached}</p>
|
||||
: mode === "group" && groupLimitReached ? <p className="nds-inline-notice" data-variant="info">{content.groupLimit}</p>
|
||||
: <ExpeditionPlanner key={`${view.day}-${mode}`} catalog={catalog} view={view} mode={mode} content={content} busy={busy} onStart={start} />}
|
||||
</>}
|
||||
</section>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,22 @@ export const EXPEDITION_SETTING_GROUPS = [
|
|||
{ path: "solo.maxStars", label: "Étoile maximale en solo" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "group",
|
||||
title: "Groupe",
|
||||
help: "Le créateur lance le groupe quand il veut, dès le minimum de joueurs ; à la fin de l’inscription, le groupe part seul ou se dissout. Le Veilleur de la Guilde tient les places vides, sans rôle.",
|
||||
fields: [
|
||||
{ path: "group.slots", label: "Places par groupe" },
|
||||
{ path: "group.minPlayers", label: "Joueurs minimum pour partir" },
|
||||
{ path: "group.maxConcurrent", label: "Groupes en même temps par joueur" },
|
||||
{ path: "group.minStars", label: "Étoile minimale en groupe" },
|
||||
{ path: "group.maxStars", label: "Étoile maximale en groupe" },
|
||||
{ path: "group.recruitHours", label: "Période d’inscription maximale (heures)" },
|
||||
{ path: "group.lootPct", label: "Multiplicateur de butin par joueur (%)", items: ["2 joueurs", "3 joueurs", "4 joueurs"] },
|
||||
{ path: "group.npcStat", label: "Stats du Veilleur de la Guilde (chacune)" },
|
||||
{ path: "group.cohesionPct", label: "Bonus de cohésion, collections toutes différentes (%)" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "power",
|
||||
title: "Puissance et rôles",
|
||||
|
|
@ -55,6 +71,7 @@ export const EXPEDITION_SETTING_GROUPS = [
|
|||
{ path: "score.otherWeight", label: "Poids des autres stats" },
|
||||
{ path: "score.overflowPct", label: "Valeur d’un point au-delà de 100 % (%)" },
|
||||
{ path: "score.overflowSpanPct", label: "Dépassement pris en compte (%)" },
|
||||
{ path: "score.synergyCapPct", label: "Plafond des bonus de score (%)" },
|
||||
{ path: "durations.malusPct", label: "Malus de durée (%)", items: ["Courte", "Moyenne", "Longue"] },
|
||||
{ path: "durations.endurancePerSlot", label: "Endurance par place qui efface le malus de durée" },
|
||||
{ path: "danger.malusPct", label: "Malus d’un danger (%)" },
|
||||
|
|
|
|||
|
|
@ -191,3 +191,15 @@ export function updateExpeditionSettings(settings) {
|
|||
export function cancelExpedition(expeditionId) {
|
||||
return request(`/admin/expeditions/${encodeURIComponent(expeditionId)}/cancel`, { method: "POST" });
|
||||
}
|
||||
|
||||
export function joinExpedition(expeditionId, { editionId, role }) {
|
||||
return request(`/expeditions/${encodeURIComponent(expeditionId)}/join`, { method: "POST", body: JSON.stringify({ editionId, role }) });
|
||||
}
|
||||
|
||||
export function leaveExpedition(expeditionId) {
|
||||
return request(`/expeditions/${encodeURIComponent(expeditionId)}/leave`, { method: "POST" });
|
||||
}
|
||||
|
||||
export function departExpedition(expeditionId) {
|
||||
return request(`/expeditions/${encodeURIComponent(expeditionId)}/depart`, { method: "POST" });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ export function dangerText(danger, catalog, content) {
|
|||
|
||||
// Statut de la tuile Expéditions dans la Guilde (textes cards.guild).
|
||||
export function expeditionQuestStatus(summary, content, now = Date.now()) {
|
||||
if (!summary.enabled && !summary.running && !summary.returned) return content.expeditionsClosed;
|
||||
if (!summary.enabled && !summary.running && !summary.returned && !summary.forming) return content.expeditionsClosed;
|
||||
if (summary.returned > 0 || (summary.nextReturnAt != null && summary.nextReturnAt <= now)) return content.expeditionsReturned;
|
||||
if (summary.joinableGroups > 0) return fillTemplate(content.expeditionsGroups, { count: summary.joinableGroups, s: summary.joinableGroups > 1 ? "s" : "" });
|
||||
if (summary.forming) return content.expeditionsForming;
|
||||
if (summary.running) return fillTemplate(content.expeditionsRunning, { time: formatCountdown(summary.nextReturnAt - now) });
|
||||
if (summary.eligible < summary.soloCards) return fillTemplate(content.expeditionsNoCards, { count: summary.soloCards });
|
||||
return summary.launchedToday ? content.expeditionsIdle : content.expeditionsToLaunch;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
// Rôle : recense les quêtes que la Guilde des Veilleurs propose au joueur et celles qui l'attendent.
|
||||
// Chaque quête (Carte du jour, Expéditions…) s'ajoute à cette liste avec sa tuile dans GuildPanel.
|
||||
|
||||
// Expéditions en attente : un butin à récupérer, ou aucune expédition lancée aujourd'hui alors que le joueur a de quoi partir.
|
||||
// Au plus un rappel par jour, plus les retours ; un joueur sans cartes jouables n'est jamais sollicité.
|
||||
// Expéditions en attente : un butin à récupérer, un groupe que le joueur peut rejoindre, ou aucune expédition lancée aujourd'hui
|
||||
// alors qu'il a de quoi partir. Au plus un rappel par jour, plus les retours et les groupes ; sans cartes jouables, aucun rappel.
|
||||
export function expeditionsPending(summary, now = Date.now()) {
|
||||
if (!summary) return false;
|
||||
if (summary.returned > 0 || (summary.nextReturnAt != null && summary.nextReturnAt <= now)) return true;
|
||||
return summary.enabled && !summary.running && !summary.launchedToday && summary.eligible >= summary.soloCards;
|
||||
if (summary.joinableGroups > 0) return true;
|
||||
return summary.enabled && !summary.running && !summary.forming && !summary.launchedToday && summary.eligible >= summary.soloCards;
|
||||
}
|
||||
|
||||
// Une quête : identifiant (qui choisit sa tuile), état fourni par le serveur et `pending` tant qu'elle attend le joueur.
|
||||
|
|
@ -15,7 +16,7 @@ export function guildQuests(state, now = Date.now()) {
|
|||
const quests = [];
|
||||
if (state.daily) quests.push({ id: "daily", pending: state.daily.status === "playing", summary: state.daily });
|
||||
const expeditions = state.expeditions;
|
||||
if (expeditions && (expeditions.enabled || expeditions.running || expeditions.returned)) quests.push({ id: "expeditions", pending: expeditionsPending(expeditions, now), summary: expeditions });
|
||||
if (expeditions && (expeditions.enabled || expeditions.running || expeditions.returned || expeditions.forming)) quests.push({ id: "expeditions", pending: expeditionsPending(expeditions, now), summary: expeditions });
|
||||
return quests;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,3 +77,14 @@
|
|||
.nebula-admin-expedition-destinations label { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-expedition-destinations input { width: 80px; }
|
||||
.nebula-admin-expedition-destinations .nds-list-row > .nds-button { flex: 0 0 auto; width: auto; }
|
||||
|
||||
// Groupe : membres par rôle (places libres en pointillés), inscription sous la carte du groupe.
|
||||
.nebula-expedition-group h4 { margin: 0; }
|
||||
.nebula-expedition-group-members { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
|
||||
.nebula-expedition-group-members li, .nebula-expedition-report-team li { min-width: 0; }
|
||||
.nebula-expedition-group-members li { display: grid; gap: var(--space-1); justify-items: center; color: var(--color-text-secondary); font-size: var(--font-size-xs); text-align: center; }
|
||||
.nebula-expedition-group-members li span { display: grid; }
|
||||
.nebula-expedition-group-members strong { color: var(--color-text-primary); }
|
||||
.nebula-expedition-group-free { display: grid; place-items: center; min-width: 96px; min-height: 64px; padding: var(--space-2); border: 1px dashed var(--color-border); border-radius: var(--radius-md); }
|
||||
.nebula-expedition-group-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
|
||||
.nebula-expedition-join { display: grid; gap: var(--space-3); justify-self: stretch; padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue