- Every catalog card carries expedition tags and every collection a stat profile, validated at load; twelve destinations live server-side so hidden ones stay secret. - Pure rules compute card power, per-slot requirements, roles, dangers, the long-trip malus, the score (one more star never raises it) and loot proportional to the chosen duration. - A simulator script and a balance test guard the design thresholds; agent docs and a new-card skill explain how to tag new cards. - Migration 8 adds Éclats d'étoile, expedition settings stored as one validated JSON, daily destinations, expeditions, members and slots, and rebuilds gift_packs so a pack can come from an expedition. - Players launch a solo expedition from the Guild, see an exact preview, and claim their loot when it returns; the card sheet shows cards away on an expedition. - Administration › Guilde tunes every value with server-side bounds, toggles destinations and cancels running expeditions; expeditions stay closed until an administrator opens them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
71 lines
4.1 KiB
JavaScript
71 lines
4.1 KiB
JavaScript
// Rôle : présente la Guilde des Veilleurs et la tuile de chacune de ses quêtes, avec leur état.
|
|
import { useState } from "react";
|
|
import { dailyQuestStatus, fillTemplate, formatStreak } from "./dailyShare.js";
|
|
import { expeditionQuestStatus } from "./expeditionFormat.js";
|
|
import { guildQuests } from "./guildQuests.js";
|
|
|
|
// Carte du jour : un dos vierge, propre à aucune collection et marqué d'un « ? », figure la carte cachée à retrouver.
|
|
const DAILY_COVER = "/static/img/cards/empty-back.webp";
|
|
|
|
function DailyQuest({ summary: daily, content }) {
|
|
const finished = daily.status !== "playing";
|
|
return <article className="nds-card nebula-quest" data-status={daily.status} aria-labelledby="nebula-quest-daily-title">
|
|
{/* La série en cours se range sous la couverture. */}
|
|
<div className="nebula-quest-media">
|
|
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true">
|
|
<img src={DAILY_COVER} alt="" />
|
|
<span>?</span>
|
|
</div>
|
|
{daily.streak > 0 && <span className="nds-badge" data-variant="gold">{fillTemplate(content.dailyStreak, { streak: formatStreak(daily.streak) })}</span>}
|
|
</div>
|
|
<div className="nds-card-body nebula-quest-body">
|
|
<p className="eyebrow">{content.dailyKind}</p>
|
|
<h3 id="nebula-quest-daily-title">{content.dailyTitle}</h3>
|
|
<p>{content.dailyDescription}</p>
|
|
<p className="nebula-quest-status">{dailyQuestStatus(daily, content)}</p>
|
|
<div className="nds-card-actions">
|
|
<a className="nds-button" data-size="sm" data-variant={finished ? "secondary" : "primary"} href="#/cards/daily">{finished ? content.dailyResult : content.dailyAction}</a>
|
|
</div>
|
|
</div>
|
|
</article>;
|
|
}
|
|
|
|
// Expéditions : la couverture montre le Grand Vide, et le bouton mène au butin dès qu'une expédition est revenue.
|
|
const EXPEDITIONS_COVER = "/static/img/cards/primordial-nebula/epic/deep_sky_ray.webp";
|
|
|
|
function ExpeditionsQuest({ summary, pending, content, now }) {
|
|
const returned = summary.returned > 0 || (summary.nextReturnAt != null && summary.nextReturnAt <= now);
|
|
return <article className="nds-card nebula-quest" data-status={returned ? "returned" : summary.running ? "running" : "idle"} aria-labelledby="nebula-quest-expeditions-title">
|
|
<div className="nebula-quest-media">
|
|
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true"><img src={EXPEDITIONS_COVER} alt="" /></div>
|
|
</div>
|
|
<div className="nds-card-body nebula-quest-body">
|
|
<p className="eyebrow">{content.expeditionsKind}</p>
|
|
<h3 id="nebula-quest-expeditions-title">{content.expeditionsTitle}</h3>
|
|
<p>{content.expeditionsDescription}</p>
|
|
<p className="nebula-quest-status">{expeditionQuestStatus(summary, content, now)}</p>
|
|
<div className="nds-card-actions">
|
|
<a className="nds-button" data-size="sm" data-variant={pending ? "primary" : "secondary"} href="#/cards/expeditions">{returned ? content.expeditionsClaim : summary.enabled ? content.expeditionsAction : content.expeditionsOpen}</a>
|
|
</div>
|
|
</div>
|
|
</article>;
|
|
}
|
|
|
|
// Tuile de chaque type de quête, choisie par l'identifiant donné dans guildQuests.
|
|
const QUEST_TILES = { daily: DailyQuest, expeditions: ExpeditionsQuest };
|
|
|
|
export function GuildPanel({ catalog, state, content }) {
|
|
// Heure d'affichage de la page : elle suffit pour savoir si une expédition est déjà rentrée.
|
|
const [now] = useState(() => Date.now());
|
|
const quests = guildQuests(state, now).filter((quest) => QUEST_TILES[quest.id]);
|
|
return <section className="nebula-quests" aria-labelledby="nebula-guild-title">
|
|
<div className="nds-section-heading nebula-section-heading">
|
|
<div><p className="eyebrow">{content.eyebrow}</p><h2 id="nebula-guild-title">{content.title}</h2><p className="nebula-guild-intro">{content.intro}</p></div>
|
|
</div>
|
|
{quests.length ? <div className="nebula-quests-grid">{quests.map(({ id, summary, pending }) => {
|
|
const Tile = QUEST_TILES[id];
|
|
return <Tile key={id} catalog={catalog} summary={summary} pending={pending} content={content} now={now} />;
|
|
})}</div>
|
|
: <div className="nds-empty-state"><p>{content.empty}</p></div>}
|
|
</section>;
|
|
}
|