Let players choose how their cards spend level points with vocations or free points, and sell the Parchemin d'oubli

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-16 23:00:40 +01:00
parent 18bcf435b5
commit 7d331d1a3f
24 changed files with 473 additions and 60 deletions

View file

@ -1,7 +1,8 @@
// Rôle : affiche la fiche détaillée d'une carte possédée (grand format, favori, recyclage d'un doublon).
// Rôle : affiche la fiche détaillée d'une carte possédée (grand format, favori, recyclage d'un doublon, progression d'expédition).
import { Modal } from "../../components/Modal.jsx";
import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
import { CardEquipment } from "./CardEquipment.jsx";
import { CardPlan } from "./CardPlan.jsx";
import { CurrencyAmount } from "./Currency.jsx";
import { readCollection } from "./collectionState.js";
import { NebulaCard } from "./NebulaCard.jsx";
@ -11,7 +12,7 @@ import { formatStardust } from "./stardustFormat.js";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
// Expéditions : niveau, Puissance, stats et amélioration d'une carte rare ou mieux (Éclats, ou doublon de la même édition).
function CardProgress({ catalog, state, progress, eclats, busy, runMutation }) {
function CardProgress({ catalog, state, progress, eclats, locked, busy, runMutation }) {
const atCap = progress.nextCost == null;
return <section className="nebula-card-progress" aria-labelledby="nebula-card-progress-title">
<h3 id="nebula-card-progress-title">Expéditions · niveau {progress.level} / {progress.maxLevel}</h3>
@ -22,6 +23,7 @@ function CardProgress({ catalog, state, progress, eclats, busy, runMutation }) {
{progress.spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>Améliorer avec un doublon</button>}
</div>}
{!atCap && <p className="nebula-form-help">Vous avez {formatEclats(eclats)} Éclats. Chaque retour d’expédition donne de l’expérience de terrain ({progress.fieldXp} % du niveau suivant).</p>}
<CardPlan key={`${progress.plan.id}-${progress.plan.points}-${JSON.stringify(progress.plan.allocation)}`} progress={progress} oblivions={state.items?.oblivion ?? 0} locked={locked} busy={busy} runMutation={runMutation} />
<CardEquipment catalog={catalog} state={state} progress={progress} busy={busy} runMutation={runMutation} />
</section>;
}
@ -39,7 +41,7 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
<div className="nebula-card-detail-layout"><NebulaCard catalog={catalog} entry={entry} size="lg" />
<div><p className="eyebrow">{catalog.rarities.find((item) => item.id === entry.edition.rarity)?.label}</p><h2 id="nebula-card-detail-title">{entry.card.name}</h2><p>{entry.card.description}</p>
<dl><div><dt>Exemplaires possédés</dt><dd>{quantity}</dd></div><div><dt>Collection</dt><dd>{catalog.collections.find((item) => item.id === entry.card.collectionId)?.name}</dd></div><div><dt>Finitions</dt><dd>{entry.edition.finishIds.map((id) => catalog.finishes.find((item) => item.id === id)?.label).join(" · ")}</dd></div></dl>
{progress && <CardProgress catalog={catalog} state={state} progress={progress} eclats={state.wallet.eclats ?? 0} busy={busy} runMutation={runMutation} />}
{progress && <CardProgress catalog={catalog} state={state} progress={progress} eclats={state.wallet.eclats ?? 0} locked={Boolean(expedition)} busy={busy} runMutation={runMutation} />}
<button className="nds-button" data-variant={favorites.has(entry.edition.id) ? "primary" : "secondary"} type="button" disabled={busy} aria-pressed={favorites.has(entry.edition.id)} onClick={() => runMutation(() => setFavorite(entry.edition.id, !favorites.has(entry.edition.id)))}>{favorites.has(entry.edition.id) ? "Retirer des favoris" : "Ajouter aux favoris"}</button>
{spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => recycleDuplicates(entry.edition.id))}>Recycler un doublon (+{formatStardust(value)})</button>}
{spare > 0 && onStartTransfer && <>

View file

@ -0,0 +1,78 @@
// Rôle : plan de progression d'une carte depuis sa fiche : ses points de niveau suivent sa collection, une vocation (la stat d'un rôle)
// ou la répartition du joueur. Aperçu des stats avant de valider ; le premier choix est gratuit, les changements suivants coûtent
// un Parchemin d'oubli (ajouter des points en libre reste gratuit).
import { useState } from "react";
import { setCardPlan } from "./cardsApi.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
const PLANS = [
{ id: "collection", label: "Sa collection", help: "Les points suivent le profil de la collection de la carte." },
{ id: "leader", stat: "bravoure", label: "Meneur", help: "Faite pour la place de Meneur : surtout de la Bravoure." },
{ id: "guardian", stat: "endurance", label: "Gardien", help: "Faite pour la place de Gardien : surtout de l’Endurance." },
{ id: "seeker", stat: "fortune", label: "Chercheur", help: "Faite pour la place de Chercheur : surtout de la Fortune." },
{ id: "navigator", stat: "orientation", label: "Navigateur", help: "Faite pour la place de Navigateur : surtout de l’Orientation." },
{ id: "free", label: "Libre", help: "Vous placez vous-même chaque point." }
];
const total = (stats) => Object.values(stats).reduce((sum, value) => sum + value, 0);
const toDraft = (allocation) => Object.fromEntries(STATS.map(([stat]) => [stat, String(allocation?.[stat] ?? 0)]));
function StatPreview({ before, after }) {
return <ul className="nebula-card-plan-preview" aria-label="Stats de la carte avec ce plan, hors équipement">{STATS.map(([stat, label]) => {
const delta = after[stat] - before[stat];
return <li key={stat} data-trend={delta > 0 ? "up" : delta < 0 ? "down" : undefined}>
<span><MaskIcon name={stat} />{label}</span>
<strong>{delta ? <>{before[stat]} → {after[stat]}</> : after[stat]}</strong>
</li>;
})}</ul>;
}
// `locked` : la carte est en expédition, son plan ne change pas avant son retour.
export function CardPlan({ progress, oblivions, locked = false, busy, runMutation }) {
const plan = progress.plan;
const [choice, setChoice] = useState(plan.id);
const [draft, setDraft] = useState(() => toDraft(plan.allocation));
const free = choice === "free";
const allocation = Object.fromEntries(STATS.map(([stat]) => [stat, Math.max(0, Number.parseInt(draft[stat], 10) || 0)]));
const left = plan.points - total(allocation);
const placed = plan.allocation || toDraft(null);
const unchanged = choice === plan.id && (!free || STATS.every(([stat]) => allocation[stat] === Number(placed[stat])));
const onlyAdds = free && plan.id === "free" && STATS.every(([stat]) => allocation[stat] >= Number(placed[stat]));
const paid = plan.paid && !onlyAdds;
const preview = free ? Object.fromEntries(STATS.map(([stat]) => [stat, plan.levelBase[stat] + allocation[stat]])) : plan.previews[choice];
const chosen = PLANS.find((item) => item.id === choice);
// Un point de plus ne dépasse ni le plafond d'une stat, ni les points restants.
const setPoints = (stat, raw) => {
const limit = Math.min(plan.maxStatPoints, allocation[stat] + left);
setDraft((current) => ({ ...current, [stat]: raw !== "" && Number(raw) > limit ? String(limit) : raw }));
};
return <section className="nebula-card-plan" aria-labelledby="nebula-card-plan-title">
<h4 id="nebula-card-plan-title">Plan de progression</h4>
<p className="nebula-form-help">{plan.points
? `Ses ${plan.points} points de niveau se répartissent selon ce plan, au plus ${plan.maxStatPoints} dans une même stat.`
: "Chaque amélioration donne des points de stats, répartis selon ce plan."}</p>
<div role="group" aria-label="Plan de progression" className="nds-toolbar nebula-card-plan-choices">{PLANS.map((item) => <button key={item.id} type="button" className="nds-button" data-size="sm"
data-variant={item.id === choice ? "primary" : "secondary"} aria-pressed={item.id === choice} disabled={busy} onClick={() => setChoice(item.id)}>
{item.stat && <MaskIcon name={item.stat} />}{item.label}
</button>)}</div>
<p className="nebula-form-help">{chosen.help}</p>
{free && <div className="nebula-card-plan-points">
{STATS.map(([stat, label]) => <label key={stat}><span><MaskIcon name={stat} />{label}</span>
<input className="nds-input" type="number" inputMode="numeric" min="0" max={plan.maxStatPoints} step="1" value={draft[stat]} disabled={busy || !plan.points}
onChange={(event) => setPoints(stat, event.target.value)} onBlur={() => { if (draft[stat] === "") setDraft((current) => ({ ...current, [stat]: "0" })); }} />
</label>)}
<p className="nebula-form-help" role="status">{!plan.points ? "Aucun point à placer pour l’instant : améliorez la carte." : left > 0 ? `${left} point${left > 1 ? "s" : ""} à placer.` : "Tous les points sont placés."}</p>
</div>}
<StatPreview before={progress.baseStats} after={preview} />
{!unchanged && <p className="nebula-form-help">{paid
? `Coûte 1 Parchemin d’oubli : vous en avez ${oblivions}.${oblivions < 1 ? " Ils s’achètent dans la Boutique." : ""}`
: plan.id === "collection" ? "Premier choix gratuit : ensuite, changer de plan coûtera un Parchemin d’oubli." : "Placer de nouveaux points est gratuit."}</p>}
{locked && <p className="nebula-form-help">Cette carte est en expédition : son plan pourra changer à son retour.</p>}
<div className="nds-toolbar">
<button className="nds-button" data-variant="primary" type="button" disabled={busy || locked || unchanged || (paid && oblivions < 1)}
onClick={() => runMutation(() => setCardPlan(progress.editionId, choice, free ? allocation : null))}>{free ? "Valider les points" : "Choisir ce plan"}</button>
{!unchanged && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => { setChoice(plan.id); setDraft(toDraft(plan.allocation)); }}>Annuler</button>}
</div>
</section>;
}

View file

@ -11,6 +11,8 @@ import { NebulaCard } from "./NebulaCard.jsx";
const PREVIEW_DELAY_MS = 250;
const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
const LOOT_KINDS = ["eclats", "stardust", "cards", "items"];
// Vocation d'une carte (son plan de progression) : icône de la stat de son rôle à côté de sa Puissance.
const STAT_BY_PLAN = { leader: "bravoure", guardian: "endurance", seeker: "fortune", navigator: "orientation" };
// Effet de la spécialité sur le butin : flèche verte sur ce qui augmente, rouge sur ce qui baisse.
function LootEffects({ specialty, pct, content }) {
@ -185,7 +187,7 @@ export function ExpeditionPlanner({ catalog, view, mode = "solo", content, busy,
const selected = slots.includes(card.editionId);
return <li key={card.editionId} data-busy={card.busy || undefined}>
<NebulaCard catalog={catalog} entry={entry} size="sm" selected={selected} disabled={card.busy} onSelect={card.busy ? undefined : () => choose(card)} selectLabel={fillTemplate(content.chooseCard, { card: entry.card.name, role: content.roles[roleStat] })} />
<span className="nebula-expedition-card-power">{card.busy ? content.busy : fillTemplate(content.power, { power: card.power })}</span>
<span className="nebula-expedition-card-power">{STAT_BY_PLAN[card.plan] && <MaskIcon name={STAT_BY_PLAN[card.plan]} />}{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: slotCount })}</p>}

View file

@ -23,9 +23,13 @@ const EVENT_LABELS = {
card_upgraded: "Carte améliorée",
eclats_converted: "Éclats d’étoile obtenus",
item_used: "Objet utilisé",
destination_starter: "Carte de destination offerte"
destination_starter: "Carte de destination offerte",
card_plan_changed: "Plan de progression choisi",
oblivion_bought: "Parchemins d’oubli achetés"
};
const PLAN_NAMES = { collection: "selon sa collection", leader: "Meneur", guardian: "Gardien", seeker: "Chercheur", navigator: "Navigateur", free: "points libres" };
// Le journal garde la quantité réellement offerte : les comptes plus anciens n'ont reçu qu'une ouverture.
function eventLabel(entry) {
if (entry.type !== "welcome_opening") return EVENT_LABELS[entry.type];
@ -74,6 +78,8 @@ function HistoryDetail({ entry, catalog }) {
return <span>{[name, detail].filter(Boolean).join(" · ")}</span>;
}
if (entry.type === "destination_starter") return <span>{cardReference(details.editionId, catalog)} · par la Guilde des Veilleurs</span>;
if (entry.type === "card_plan_changed") return <span>{[cardReference(entry.entityId, catalog), PLAN_NAMES[details.plan] || details.plan, details.oblivion && "un Parchemin d’oubli utilisé"].filter(Boolean).join(" · ")}</span>;
if (entry.type === "oblivion_bought") return <span>{details.count} Parchemin{details.count > 1 ? "s" : ""} · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "eclats_converted") return <span>+{details.eclats} Éclats · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "opening_purchased") return <span>{details.count > 1 && `${details.count} ouvertures · `}−{formatStardust(details.stardust ?? details.price)} d’étoiles</span>;
if (!details.collectionId) return null;

View file

@ -1,7 +1,7 @@
// Rôle : boutique du joueur ; affiche le solde de poussière d'étoiles, achète des ouvertures de paquet et, quand les Expéditions
// sont ouvertes, change la poussière en Éclats d'étoile (Pont des Veilleurs).
// sont ouvertes, change la poussière en Éclats d'étoile (Pont des Veilleurs) et vend les Parchemins d'oubli.
import { useState } from "react";
import { buyOpening, buyShopPack, convertStardust } from "./cardsApi.js";
import { buyOblivion, buyOpening, buyShopPack, convertStardust } from "./cardsApi.js";
import { DashboardAside } from "./CardsDashboard.jsx";
import { CollectionCardBack } from "./CollectionCardBack.jsx";
import { EclatsBalance, StardustBalance } from "./Currency.jsx";
@ -13,6 +13,7 @@ import { formatStardust } from "./stardustFormat.js";
// Bornes du serveur par achat (service.js et expedition-progress.js) : la quantité ne dépasse ni elles, ni ce que la poussière paie.
const MAX_OPENINGS_PER_PURCHASE = 100;
const MAX_ECLATS_PER_CONVERSION = 10_000;
const MAX_OBLIVION_PER_PURCHASE = 100;
const affordable = (stardust, price, limit) => (price > 0 ? Math.min(Math.floor(stardust / price), limit) : limit);
// Quantité saisie (texte du champ) : jamais au-dessus du maximum payable. Si le solde baisse (un autre achat), la valeur
@ -54,6 +55,10 @@ export function ShopEclatsCover() {
return <div className="nds-card-cover nebula-shop-item-cover"><img src="/static/img/cards/shop/eclats.webp" alt="" loading="lazy" /></div>;
}
export function ShopOblivionCover() {
return <div className="nds-card-cover nebula-shop-item-cover"><img src="/static/img/cards/shop/oblivion.webp" alt="" loading="lazy" /></div>;
}
// Bouton d'achat pleine largeur : l'action et le coût total en poussière.
function BuyButton({ label, total, disabled, type = "submit", onClick }) {
return <button className="nds-button nebula-shop-buy" data-variant="primary" type={type} disabled={disabled} aria-label={`${label} · ${formatStardust(total)}`} onClick={onClick}>
@ -116,6 +121,13 @@ export function ShopPanel({ catalog, state, runMutation, busy, content, onOpenPa
return Boolean(result);
}
async function buyScrolls(count) {
setNotice("");
const result = await runMutation(() => buyOblivion(count));
if (result) setNotice(fillTemplate(content.oblivionDone, { count, s: count > 1 ? "s" : "" }));
return Boolean(result);
}
return <div className="nebula-shop">
<div className="nds-section-heading nebula-section-heading">
<div><p className="eyebrow">Poussière d’étoiles</p><h2>Boutique</h2></div>
@ -144,6 +156,10 @@ export function ShopPanel({ catalog, state, runMutation, busy, content, onOpenPa
{showEclats && <QuantityItem id="eclats" cover={<ShopEclatsCover />} title={content.eclatsTitle} description={content.eclatsDescription}
quantityLabel={content.eclatsLabel} rateLabel={content.unitRate} price={shop.stardustPerEclat} limit={MAX_ECLATS_PER_CONVERSION} actionLabel={content.eclatsAction}
stardust={wallet.stardust} busy={busy} onSubmit={convert} />}
{/* Parchemin d'oubli : change le plan de progression d'une carte (fiche de la carte), au prix réglé dans la boutique. */}
{showEclats && <QuantityItem id="oblivion" cover={<ShopOblivionCover />} title={content.oblivionTitle} description={fillTemplate(content.oblivionDescription, { count: state.items?.oblivion ?? 0 })}
quantityLabel={content.oblivionLabel} rateLabel={content.unitRate} price={shop.oblivionPrice} limit={MAX_OBLIVION_PER_PURCHASE} actionLabel="Acheter"
stardust={wallet.stardust} busy={busy} onSubmit={buyScrolls} />}
</div>
</section>
</div>;

View file

@ -1,11 +1,11 @@
// Rôle : règle la boutique ; poussière d'étoiles gagnée par doublon recyclé et prix des articles achetables, dont l'Éclat
// d'étoile (Pont des Veilleurs), enregistré avec les réglages des Expéditions.
// d'étoile (Pont des Veilleurs) et le Parchemin d'oubli, enregistrés avec les réglages des Expéditions.
import { useState } from "react";
import { updateExpeditionSettings } from "../cardsApi.js";
import { ShopEclatsCover, ShopOpeningCover, ShopPackCover } from "../ShopPanel.jsx";
import { ShopEclatsCover, ShopOblivionCover, ShopOpeningCover, ShopPackCover } from "../ShopPanel.jsx";
import { formatStardust } from "../stardustFormat.js";
import { ApplyActions } from "./adminSettingForm.jsx";
import { ECLAT_PRICE_PATH } from "./expeditionSettingFields.js";
import { ECLAT_PRICE_PATH, OBLIVION_PRICE_PATH } from "./expeditionSettingFields.js";
import { inRange, MAX_VALUE, parse, shopSettingSaver } from "./adminSettings.js";
function RecyclingForm({ catalog, setting, busy, save }) {
@ -35,26 +35,35 @@ function RecyclingForm({ catalog, setting, busy, save }) {
</section>;
}
// Éclat d'étoile : prix, bornes du schéma des Expéditions, ouverture des Expéditions et coût du premier niveau d'une légendaire.
function eclatArticle(expedition) {
// Articles des Expéditions : prix de l'Éclat d'étoile et du Parchemin d'oubli avec les bornes du schéma, ouverture des Expéditions
// et coût du premier niveau d'une légendaire.
function expeditionArticles(expedition) {
if (!expedition) return null;
const { settings, schema } = expedition;
const field = schema.find((item) => item.path === ECLAT_PRICE_PATH);
const bounds = (path) => { const field = schema.find((item) => item.path === path); return { min: field.min, max: field.max }; };
const legendaryLevel = settings.progression.costFactor * (settings.power.legendary - settings.progression.costOffset);
return { price: settings.progression.stardustPerEclat, min: field.min, max: field.max, open: settings.enabled, legendaryLevel };
return {
open: settings.enabled,
eclat: { price: settings.progression.stardustPerEclat, ...bounds(ECLAT_PRICE_PATH), legendaryLevel },
oblivion: { price: settings.progression.oblivionPrice, ...bounds(OBLIVION_PRICE_PATH) }
};
}
function ArticlesForm({ catalog, setting, eclat, busy, save, saveEclatPrice }) {
const toDraft = () => ({ openingPrice: String(setting.openingPrice), packPrice: String(setting.shopPackPrice), eclatPrice: eclat ? String(eclat.price) : "" });
function ArticlesForm({ catalog, setting, articles, busy, save, saveExpeditionPrices }) {
const eclat = articles?.eclat;
const oblivion = articles?.oblivion;
const toDraft = () => ({ openingPrice: String(setting.openingPrice), packPrice: String(setting.shopPackPrice), eclatPrice: eclat ? String(eclat.price) : "", oblivionPrice: oblivion ? String(oblivion.price) : "" });
const [draft, setDraft] = useState(toDraft);
const openingPrice = parse(draft.openingPrice);
const shopPackPrice = parse(draft.packPrice);
const eclatPrice = parse(draft.eclatPrice);
const oblivionPrice = parse(draft.oblivionPrice);
const eclatValid = !eclat || inRange(eclatPrice, eclat.min, eclat.max);
const valid = inRange(openingPrice, 1, MAX_VALUE) && inRange(shopPackPrice, 1, MAX_VALUE) && eclatValid;
const oblivionValid = !oblivion || inRange(oblivionPrice, oblivion.min, oblivion.max);
const valid = inRange(openingPrice, 1, MAX_VALUE) && inRange(shopPackPrice, 1, MAX_VALUE) && eclatValid && oblivionValid;
const shopChanged = openingPrice !== setting.openingPrice || shopPackPrice !== setting.shopPackPrice;
const eclatChanged = Boolean(eclat) && eclatPrice !== eclat.price;
const changed = valid && (shopChanged || eclatChanged);
const expeditionChanged = Boolean(articles) && (eclatPrice !== eclat.price || oblivionPrice !== oblivion.price);
const changed = valid && (shopChanged || expeditionChanged);
const shopPack = catalog.collections.find((collection) => collection.packCategory === "shop");
// Repère : combien de doublons communs il faut recycler pour une ouverture, selon le barème en vigueur.
const commonValue = setting.stardustValues.common;
@ -86,12 +95,23 @@ function ArticlesForm({ catalog, setting, eclat, busy, save, saveEclatPrice }) {
<ShopEclatsCover />
<div className="nds-card-body nebula-shop-item-body nebula-admin-shop-item-fields">
<h4>Éclats d’étoile</h4>
{!eclat.open && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
{!articles.open && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
<label><span>Prix d’un Éclat</span><input className="nds-input" aria-label="Prix d’un Éclat d’étoile" type="number" inputMode="numeric" min={eclat.min} max={eclat.max} step="1" {...field("eclatPrice")} /></label>
{eclatValid
? <p className="nebula-form-help">Premier niveau d’une légendaire ({eclat.legendaryLevel.toLocaleString("fr-FR")} Éclats) = {formatStardust(eclat.legendaryLevel * eclatPrice)}.</p>
: <p className="nebula-form-help" role="alert">Prix d’un Éclat : entier de {eclat.min} à {eclat.max.toLocaleString("fr-FR")}.</p>}
{!eclat.open && <p className="nebula-form-help">Proposé aux joueurs quand les Expéditions sont ouvertes.</p>}
{!articles.open && <p className="nebula-form-help">Proposé aux joueurs quand les Expéditions sont ouvertes.</p>}
</div>
</article>}
{oblivion && <article className="nds-card nebula-shop-item" data-item="oblivion">
<ShopOblivionCover />
<div className="nds-card-body nebula-shop-item-body nebula-admin-shop-item-fields">
<h4>Parchemin d’oubli</h4>
{!articles.open && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
<label><span>Prix</span><input className="nds-input" aria-label="Prix d’un Parchemin d’oubli" type="number" inputMode="numeric" min={oblivion.min} max={oblivion.max} step="1" {...field("oblivionPrice")} /></label>
{oblivionValid
? <p className="nebula-form-help">Change le plan de progression d’une carte. Le premier choix de plan est gratuit.</p>
: <p className="nebula-form-help" role="alert">Prix d’un Parchemin : entier de {oblivion.min} à {oblivion.max.toLocaleString("fr-FR")}.</p>}
</div>
</article>}
</div>
@ -102,7 +122,7 @@ function ArticlesForm({ catalog, setting, eclat, busy, save, saveEclatPrice }) {
onCancel={() => setDraft(toDraft())}
onApply={async () => {
if (shopChanged) await save({ openingPrice, shopPackPrice });
if (eclatChanged) await saveEclatPrice(eclatPrice);
if (expeditionChanged) await saveExpeditionPrices({ eclatPrice, oblivionPrice });
}}
confirmTitle="Appliquer les nouveaux prix ?"
confirmMessage="Les prix s’appliquent immédiatement à tous les joueurs. Les ouvertures déjà achetées ne changent pas."
@ -117,11 +137,12 @@ export function AdminShop({ catalog, dashboard, busy, runMutation, refreshDashbo
const purchased = players.reduce((total, player) => total + player.purchasedOpenings, 0);
const save = shopSettingSaver(setting, runMutation, refreshDashboard);
const expedition = dashboard?.expeditionSettings;
const eclat = eclatArticle(expedition);
// Le prix d'un Éclat vit dans les réglages des Expéditions : on renvoie ces réglages avec ce seul prix changé.
const saveEclatPrice = async (price) => {
const articles = expeditionArticles(expedition);
// Ces prix vivent dans les réglages des Expéditions : on renvoie ces réglages avec ces seuls prix changés.
const saveExpeditionPrices = async ({ eclatPrice, oblivionPrice }) => {
const next = structuredClone(expedition.settings);
next.progression.stardustPerEclat = price;
next.progression.stardustPerEclat = eclatPrice;
next.progression.oblivionPrice = oblivionPrice;
if (await runMutation(() => updateExpeditionSettings(next))) await refreshDashboard();
};
return <div className="nebula-admin-shop-page">
@ -132,7 +153,7 @@ export function AdminShop({ catalog, dashboard, busy, runMutation, refreshDashbo
{setting
? <>
<RecyclingForm key={JSON.stringify(setting.stardustValues)} catalog={catalog} setting={setting} busy={busy} save={save} />
<ArticlesForm key={`${setting.openingPrice}-${setting.shopPackPrice}-${eclat?.price}`} catalog={catalog} setting={setting} eclat={eclat} busy={busy} save={save} saveEclatPrice={saveEclatPrice} />
<ArticlesForm key={`${setting.openingPrice}-${setting.shopPackPrice}-${articles?.eclat.price}-${articles?.oblivion.price}`} catalog={catalog} setting={setting} articles={articles} busy={busy} save={save} saveExpeditionPrices={saveExpeditionPrices} />
</>
: <div className="nds-empty-state" aria-busy="true"><p>Chargement de la boutique…</p></div>}
</div>;

View file

@ -9,6 +9,8 @@ const STATS_IN_ORDER = ["principale", "2e stat", "3e stat", "4e stat"];
export const EXPEDITION_OPEN_PATH = "enabled";
// Le prix d'un Éclat (Pont des Veilleurs) se règle dans Administration › Boutique, avec les autres articles.
export const ECLAT_PRICE_PATH = "progression.stardustPerEclat";
// Le prix d'un Parchemin d'oubli (changer le plan de progression d'une carte) aussi.
export const OBLIVION_PRICE_PATH = "progression.oblivionPrice";
// Onglets de l'administration : chacun réunit des panneaux (groupes de réglages, ou « destinations », la liste des destinations).
export const EXPEDITION_SETTING_THEMES = [
@ -27,7 +29,10 @@ export const EXPEDITION_SETTING_GROUPS = [
{
id: "shop",
title: "Boutique",
fields: [{ path: ECLAT_PRICE_PATH, label: "Prix d’un Éclat d’étoile en boutique", unit: "poussières" }]
fields: [
{ path: ECLAT_PRICE_PATH, label: "Prix d’un Éclat d’étoile en boutique", unit: "poussières" },
{ path: OBLIVION_PRICE_PATH, label: "Prix d’un Parchemin d’oubli en boutique", unit: "poussières" }
]
},
{
id: "general",
@ -77,12 +82,13 @@ export const EXPEDITION_SETTING_GROUPS = [
{
id: "progression",
title: "Améliorations",
help: "Coût d’un niveau en Éclats selon la Puissance actuelle, niveaux donnés par un doublon de la même carte et expérience gagnée à chaque retour. Le prix d’un Éclat se règle dans la Boutique.",
help: "Coût d’un niveau en Éclats selon la Puissance actuelle, niveaux donnés par un doublon de la même carte et expérience gagnée à chaque retour. Chaque niveau donne des points de stats, répartis selon le plan de progression de la carte (sa collection, une vocation ou des points libres) : une stat n’en reçoit jamais plus que la part maximale, que les vocations atteignent. Le prix d’un Éclat et celui d’un Parchemin d’oubli se règlent dans la Boutique.",
fields: [
{ path: "progression.costFactor", label: "Éclats par point de Puissance au-dessus du décalage" },
{ path: "progression.costOffset", label: "Décalage du coût (Puissance)" },
{ path: "progression.duplicateLevels", label: "Niveaux donnés par un doublon" },
{ path: "progression.fieldXpPct", label: "Expérience de terrain par retour, en part d’un niveau", unit: "%" }
{ path: "progression.fieldXpPct", label: "Expérience de terrain par retour, en part d’un niveau", unit: "%" },
{ path: "plans.maxStatPct", label: "Part maximale des points de niveau dans une stat", unit: "%" }
]
},
{

View file

@ -214,6 +214,16 @@ export function upgradeCard(editionId, method) {
return request("/progress/upgrade", { method: "POST", body: JSON.stringify({ editionId, method }) });
}
// Plan de progression d'une carte : « collection », une vocation (leader, guardian, seeker, navigator) ou « free » avec ses points placés.
export function setCardPlan(editionId, plan, allocation = null) {
return request("/progress/plan", { method: "PUT", body: JSON.stringify({ editionId, plan, allocation }) });
}
// Achète des Parchemins d'oubli avec de la poussière d'étoiles.
export function buyOblivion(count) {
return request("/shop/oblivion", { method: "POST", body: JSON.stringify({ count }) });
}
// Pont à sens unique : de la poussière vers les Éclats d'étoile.
export function convertStardust(eclats) {
return request("/eclats/convert", { method: "POST", body: JSON.stringify({ eclats }) });