Add the Sokko TCG collectible card mini-game
Add the server-backed card game: Discord login, recharging pack openings, album, trades, gifts, stardust shop, campaign codes and its administration, stored in SQLite and disabled in production until configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
243465720f
commit
5ce35cd7ba
193 changed files with 12159 additions and 28 deletions
16
website/src/features/cards/dropRates.js
Normal file
16
website/src/features/cards/dropRates.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Rôle : présente les taux de tirage publiés sur chaque collection (`dropWeights`) et les poids recommandés.
|
||||
|
||||
// Poids recommandés des raretés, déclarés dans catalog.json.
|
||||
export function recommendedWeights(rarities) {
|
||||
return Object.fromEntries(rarities.map((rarity) => [rarity.id, rarity.recommendedWeight]));
|
||||
}
|
||||
|
||||
// Pourcentage de chaque rareté pour une carte tirée, dans l'ordre des raretés du catalogue.
|
||||
export function rarityPercentages(rarities, weights = {}) {
|
||||
const total = rarities.reduce((sum, rarity) => sum + (Number(weights[rarity.id]) || 0), 0);
|
||||
return rarities.map((rarity) => ({ rarity, weight: Number(weights[rarity.id]) || 0, percent: total ? (Number(weights[rarity.id]) || 0) / total * 100 : 0 }));
|
||||
}
|
||||
|
||||
export function formatPercent(value, maximumFractionDigits = 2) {
|
||||
return `${value.toLocaleString("fr-FR", { maximumFractionDigits })} %`;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue