Expeditions - The journey keeps the destination landscape still while a sky scenery (clouds, floating isles, shards, sparkles) drifts behind the cards. - A returned expedition shows only what the player receives, in place and without a window; claiming it removes the card and confirms with a notice, and the page reloads by itself when an expedition comes back. - The Guild Keeper slots are gone: group requirements scale with the players. - Local development adds a 20-second test duration, a test player for groups and keeps the dev account stocked with every item. - The Wind Rose has no daily limit and is used from the destinations step. - The Guide Star opens a destination one level below the player's highest daily level, the Sky Chart one at that level; bonus destinations are badged with the item that opened them. Bag and workshop - The Watcher's bag is a grid of illustrated item cards, ordered from the destination items, with a short "Utiliser" button; the six missing item illustrations are added. - The workshop opens in a window with illustrated commons, spare counts on the cards, cancel without spending anything, and shows the crafted card with its description and power. - The engraving workshop picks a common first, then a tag from a chosen character card (in its tag colours) or from every tag, filtered by name and family; card lists filter by name, collection and stat. Card sheet - Two tabs: the card and its lore (default from the collection), and its improvement (default from the expeditions) with a summary of power, level, experience and stats. - "Répartition des statistiques" offers Par défaut, Personnalisé and profiles, previews the change in the summary, and a Parchemin d'oubli resets it to Personnalisé so the next choice is free again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
292 lines
20 KiB
JavaScript
292 lines
20 KiB
JavaScript
// Rôle : expéditions Sokko TCG, de l'ouverture au départ : tableau de la Guilde, ouverture avec une carte, inscription, départ par le
|
||
// créateur, garde-fou d'inscription. Une expédition qui part seule est un solo (une place) ; avec d'autres joueurs, un groupe.
|
||
// Ces méthodes s'ajoutent à ExpeditionService (Object.assign sur son prototype) et utilisent `this` comme lui.
|
||
import { randomUUID } from "node:crypto";
|
||
import { dailyDayKey } from "./daily.js";
|
||
import {
|
||
cardExpeditionData, cohesionPct, MAX_ACTIVE_EXPEDITIONS, dangerCount, editionExpeditionData, evaluateTeam, expectedLoot, groupLootPct, hasCondition,
|
||
requirementsFor, rollRequirementFactor, teamPowers, teamSynergy, TEST_TRIP_MS, travelHours
|
||
} from "./expedition-rules.js";
|
||
|
||
const HOUR_MS = 3_600_000;
|
||
|
||
function fail(status, code, message) {
|
||
throw Object.assign(new Error(message), { status, code });
|
||
}
|
||
|
||
// Places d'une expédition : figées à son ouverture (`slots`) ; les expéditions ouvertes avant la fin des rôles en gardaient un par place.
|
||
const slotCountOf = (setup) => setup.slots ?? setup.roles?.length ?? 1;
|
||
|
||
export const groupMethods = {
|
||
// Places des joueurs d'un groupe, prêtes pour l'évaluation (stats figées à l'inscription, étiquettes et collection du catalogue).
|
||
memberSlots(expeditionId) {
|
||
return this.db.prepare(`SELECT s.position, s.player_id, s.edition_id, s.card_id, s.level, s.stats_json, s.powers_json, p.display_name
|
||
FROM expedition_slots s LEFT JOIN players p ON p.id = s.player_id WHERE s.expedition_id = ? AND s.player_id IS NOT NULL ORDER BY s.position`).all(expeditionId)
|
||
.map((row) => {
|
||
const data = cardExpeditionData(this.cards.catalog, row.card_id);
|
||
return {
|
||
position: row.position, playerId: row.player_id, playerName: row.display_name, editionId: row.edition_id, cardId: row.card_id,
|
||
level: row.level, stats: JSON.parse(row.stats_json), powers: JSON.parse(row.powers_json || "[]"), tags: data?.tags || [], collectionId: data?.collectionId ?? null
|
||
};
|
||
});
|
||
},
|
||
|
||
// Résultat d'une expédition avec ses joueurs. Seul, c'est un solo : une place, celle de sa carte, et les exigences d'une place.
|
||
// À plusieurs, c'est un groupe : les exigences sont celles d'autant de places que de joueurs (les places restées libres ne
|
||
// comptent pas), et la cohésion de leurs collections compte.
|
||
// `requirementFactorPct` : exigences réelles tirées au départ (Coup de folie) ; sans lui, les exigences affichées.
|
||
evaluateGroup(setup, playerSlots, settings, requirementFactorPct = 100) {
|
||
const destination = this.destinations.find((item) => item.id === setup.destination.id) || { ...setup.destination, conditions: [setup.condition].filter(Boolean), dangers: setup.dangers };
|
||
const entry = { condition: setup.condition, dangers: setup.dangers };
|
||
const durationIndex = Math.max(0, settings.durations.hours.indexOf(setup.hours));
|
||
const alone = playerSlots.length <= 1;
|
||
const cohesion = cohesionPct(playerSlots, settings);
|
||
const powers = teamPowers(playerSlots);
|
||
// Cloche de brume : un bonus de synergie, en groupe seulement.
|
||
const bellPct = !alone && powers.includes("fogBell") ? settings.powers.fogBellSynergyPct : 0;
|
||
const synergy = teamSynergy({ destination, slots: playerSlots, cohesionPct: cohesion, bellPct }, settings);
|
||
const evaluation = evaluateTeam({ destination, entry, stars: setup.stars, durationIndex, slots: playerSlots, synergyPct: synergy.totalPct, powers, requirementFactorPct }, settings);
|
||
return { evaluation, cohesion, synergy, powers, destination };
|
||
},
|
||
|
||
// Butin attendu de chaque joueur : seul, le butin d'une place ; en groupe, le multiplicateur du nombre de joueurs.
|
||
teamExpected(setup, evaluation, players, powers, destination, settings) {
|
||
const alone = players <= 1;
|
||
return expectedLoot({
|
||
hours: setup.hours, stars: setup.stars, tier: evaluation.tier, fortune: evaluation.stats.fortune, slotCount: Math.max(1, players),
|
||
multiplierPct: groupLootPct(players, settings), bonusSlot: setup.bonusSlot ?? null, powers, group: !alone, specialty: destination.specialty
|
||
}, settings);
|
||
},
|
||
|
||
// Exigences affichées : celles d'autant de places que de joueurs (une carte seule pour un solo).
|
||
teamRequirements(setup, playerSlots, settings) {
|
||
return requirementsFor({ stats: setup.destination.stats }, setup.stars, Math.max(1, playerSlots.length), settings);
|
||
},
|
||
|
||
// Validation de l'ouverture d'une expédition (et de son aperçu) : destination, étoiles et durée, carte du créateur.
|
||
// L'aperçu est celui d'un départ seul : chaque joueur qui rejoint ajoute sa carte et le bonus de butin du groupe.
|
||
prepareGroup(playerId, body, settings, today) {
|
||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||
const { day, resolved, stars, durationIndex, hours, testTrip } = this.validateChoice(body, settings, today);
|
||
const card = this.ownedCard(playerId, body?.editionId, settings);
|
||
const slot = { ...card, position: 0 };
|
||
const setup = this.groupSetup(resolved, stars, hours, settings);
|
||
setup.bonusSlot = resolved.bonusSlot ?? null;
|
||
if (testTrip) setup.testTrip = true;
|
||
const { evaluation, cohesion, synergy, powers } = this.evaluateGroup(setup, [slot], settings);
|
||
const expected = this.teamExpected(setup, evaluation, 1, powers, resolved.destination, settings);
|
||
return { day, resolved, stars, durationIndex, hours, slot, setup, evaluation, cohesion, synergy, powers, expected };
|
||
},
|
||
|
||
groupSetup({ destination, entry }, stars, hours, settings) {
|
||
return {
|
||
destination: { id: destination.id, name: destination.name, description: destination.description, coverCardId: destination.coverCardId ?? null, image: destination.image ?? null, stats: destination.stats },
|
||
condition: hasCondition(stars) ? entry.condition : null,
|
||
dangers: entry.dangers.slice(0, dangerCount(stars)),
|
||
stars,
|
||
hours,
|
||
bonusSlot: null,
|
||
slots: settings.group.slots,
|
||
recruitUntil: this.now() + settings.group.recruitHours * HOUR_MS
|
||
};
|
||
},
|
||
|
||
// Ouvre une expédition au tableau ; avec `departNow`, elle part aussitôt, seule (un solo), sans alerte d'ouverture.
|
||
createGroup(playerId, body, requestKey) {
|
||
if (!requestKey || requestKey.length > 100) fail(400, "IDEMPOTENCY_REQUIRED", "Une clé d'idempotence est requise.");
|
||
const settings = this.settings;
|
||
let expeditionId;
|
||
this.cards.database.transaction(() => {
|
||
const previous = this.db.prepare("SELECT response_json FROM idempotency WHERE player_id = ? AND scope = 'expedition-group' AND request_key = ?").get(playerId, requestKey);
|
||
if (previous) {
|
||
expeditionId = JSON.parse(previous.response_json).expeditionId;
|
||
return;
|
||
}
|
||
this.settleFormingInTx(settings);
|
||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||
const day = dailyDayKey(this.now());
|
||
const plan = this.prepareGroup(playerId, body, settings, { day, entries: this.playerEntries(playerId, day, settings) });
|
||
if (plan.slot.busy) fail(409, "EXPEDITION_CARD_BUSY", "Cette carte est déjà en expédition.");
|
||
if (this.activeCount(playerId) >= MAX_ACTIVE_EXPEDITIONS) fail(409, "EXPEDITION_LIMIT", "Vous avez déjà une expédition en cours : récupérez son butin avant d’en ouvrir ou d’en rejoindre une autre.");
|
||
const now = this.now();
|
||
expeditionId = randomUUID();
|
||
this.db.prepare(`INSERT INTO expeditions(id, mode, day, destination_id, difficulty, duration_ms, creator_id, status, setup_json, created_at)
|
||
VALUES (?, 'group', ?, ?, ?, ?, ?, 'forming', ?, ?)`).run(expeditionId, plan.day, plan.setup.destination.id, plan.stars, plan.setup.testTrip ? TEST_TRIP_MS : plan.hours * HOUR_MS, playerId, JSON.stringify(plan.setup), now);
|
||
this.insertMember(expeditionId, playerId, plan.slot, 0, now);
|
||
if (body?.departNow === true) this.launchInTx(this.db.prepare("SELECT * FROM expeditions WHERE id = ?").get(expeditionId), now, settings);
|
||
else this.queueGroupOpenedInTx(playerId, plan.setup);
|
||
this.db.prepare("INSERT INTO idempotency(player_id, scope, request_key, response_json, created_at) VALUES (?, 'expedition-group', ?, ?, ?)")
|
||
.run(playerId, requestKey, JSON.stringify({ expeditionId }), now);
|
||
});
|
||
return { expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||
},
|
||
|
||
insertMember(expeditionId, playerId, slot, position, now) {
|
||
this.db.prepare("INSERT INTO expedition_members(expedition_id, player_id, joined_at) VALUES (?, ?, ?)").run(expeditionId, playerId, now);
|
||
this.db.prepare("INSERT INTO expedition_slots(expedition_id, position, role, player_id, edition_id, card_id, level, stats_json, powers_json) VALUES (?, ?, NULL, ?, ?, ?, ?, ?, ?)")
|
||
.run(expeditionId, position, playerId, slot.editionId, slot.cardId, slot.level, JSON.stringify(slot.stats), JSON.stringify(slot.powers || []));
|
||
},
|
||
|
||
formingRow(expeditionId) {
|
||
const row = this.db.prepare("SELECT * FROM expeditions WHERE id = ? AND mode = 'group'").get(expeditionId);
|
||
if (!row || row.status === "cancelled") fail(404, "EXPEDITION_NOT_FOUND", "Ce groupe n’existe plus.");
|
||
if (row.status !== "forming") fail(409, "EXPEDITION_GROUP_DEPARTED", "Ce groupe est déjà parti.");
|
||
return row;
|
||
},
|
||
|
||
joinGroup(playerId, expeditionId, body) {
|
||
const settings = this.settings;
|
||
this.cards.database.transaction(() => {
|
||
this.settleFormingInTx(settings);
|
||
if (!settings.enabled) fail(409, "EXPEDITIONS_CLOSED", "Les Expéditions sont fermées pour le moment.");
|
||
const row = this.formingRow(expeditionId);
|
||
const setup = JSON.parse(row.setup_json);
|
||
const members = this.memberSlots(row.id);
|
||
if (members.some((slot) => slot.playerId === playerId)) fail(409, "EXPEDITION_ALREADY_JOINED", "Vous faites déjà partie de ce groupe.");
|
||
if (members.length >= slotCountOf(setup)) fail(409, "EXPEDITION_GROUP_FULL", "Cette expédition est complète.");
|
||
const card = this.ownedCard(playerId, body?.editionId, settings);
|
||
if (card.busy) fail(409, "EXPEDITION_CARD_BUSY", "Cette carte est déjà en expédition.");
|
||
if (this.activeCount(playerId) >= MAX_ACTIVE_EXPEDITIONS) fail(409, "EXPEDITION_LIMIT", "Vous avez déjà une expédition en cours : récupérez son butin avant d’en ouvrir ou d’en rejoindre une autre.");
|
||
const taken = new Set(members.map((slot) => slot.position));
|
||
const position = Array.from({ length: slotCountOf(setup) }, (_, index) => index).find((index) => !taken.has(index));
|
||
this.insertMember(row.id, playerId, card, position, this.now());
|
||
});
|
||
return { expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||
},
|
||
|
||
// Serveur Vite local (`devPerks`) : un joueur de test rejoint une expédition ouverte au groupe avec une de ses cartes, pour essayer
|
||
// un groupe depuis un seul navigateur. Un joueur de test ne suit qu'une expédition à la fois : le premier libre est repris, sinon
|
||
// un nouveau est créé ; sans carte jouable libre, il reçoit une rare au hasard.
|
||
addTestPlayer(playerId, expeditionId) {
|
||
if (!this.cards.devPerks) fail(404, "NOT_FOUND", "Joueurs de test indisponibles.");
|
||
const settings = this.settings;
|
||
const members = new Set(this.memberSlots(this.formingRow(expeditionId).id).map((slot) => slot.playerId));
|
||
let tester = null;
|
||
for (let index = 1; !tester; index += 1) {
|
||
const candidate = this.cards.upsertPlayer({ discordId: `dev-test-player-${index}`, displayName: `Joueur de test ${index}` });
|
||
if (!members.has(candidate.id) && this.activeCount(candidate.id) < MAX_ACTIVE_EXPEDITIONS) tester = candidate;
|
||
}
|
||
const freeCards = () => this.eligibleCards(tester.id, settings).filter((card) => !card.busy);
|
||
if (!freeCards().length) {
|
||
const rares = this.cards.catalog.editions.filter((edition) => edition.rarity === "rare" && !edition.promotional && editionExpeditionData(this.cards.catalog, edition.id, 0, settings));
|
||
this.cards.database.transaction(() => this.cards.addCard(tester.id, rares[this.random(rares.length)].id));
|
||
}
|
||
const cards = freeCards();
|
||
this.joinGroup(tester.id, expeditionId, { editionId: cards[this.random(cards.length)].editionId });
|
||
return { expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||
},
|
||
|
||
// Quitter un groupe en formation ; s'il s'agit du créateur, le groupe est dissous.
|
||
leaveGroup(playerId, expeditionId) {
|
||
this.cards.database.transaction(() => {
|
||
this.settleFormingInTx(this.settings);
|
||
const row = this.formingRow(expeditionId);
|
||
if (!this.db.prepare("SELECT 1 FROM expedition_members WHERE expedition_id = ? AND player_id = ?").get(row.id, playerId)) fail(404, "EXPEDITION_NOT_FOUND", "Vous ne faites pas partie de ce groupe.");
|
||
this.leaveGroupInTx(row, playerId);
|
||
});
|
||
return { expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||
},
|
||
|
||
leaveGroupInTx(row, playerId) {
|
||
if (row.creator_id === playerId) return this.dissolveInTx(row, "creator_left", playerId);
|
||
this.db.prepare("DELETE FROM expedition_slots WHERE expedition_id = ? AND player_id = ?").run(row.id, playerId);
|
||
this.db.prepare("DELETE FROM expedition_members WHERE expedition_id = ? AND player_id = ?").run(row.id, playerId);
|
||
return null;
|
||
},
|
||
|
||
// Dissolution : les cartes sont libérées et les autres joueurs en sont prévenus dans leur historique.
|
||
dissolveInTx(row, reason, exceptPlayerId = null) {
|
||
this.db.prepare("UPDATE expeditions SET status = 'cancelled', completed_at = ? WHERE id = ?").run(this.now(), row.id);
|
||
const setup = JSON.parse(row.setup_json);
|
||
for (const member of this.db.prepare("SELECT player_id FROM expedition_members WHERE expedition_id = ?").all(row.id)) {
|
||
if (member.player_id === exceptPlayerId) continue;
|
||
this.cards.audit(member.player_id, "expedition_dissolved", row.id, { destinationId: setup.destination.id, destinationName: setup.destination.name, reason });
|
||
}
|
||
},
|
||
|
||
// Renonce au butin d'une expédition de groupe en route (compte supprimé) : les autres le gardent.
|
||
forfeitInTx(row, playerId) {
|
||
const now = this.now();
|
||
this.db.prepare("UPDATE expedition_members SET claimed_at = ?, reward_json = ? WHERE expedition_id = ? AND player_id = ?").run(now, JSON.stringify({ eclats: 0, stardust: 0, packs: [] }), row.id, playerId);
|
||
if (!this.db.prepare("SELECT COUNT(*) AS count FROM expedition_members WHERE expedition_id = ? AND claimed_at IS NULL").get(row.id).count) {
|
||
this.db.prepare("UPDATE expeditions SET status = 'completed', completed_at = ? WHERE id = ?").run(now, row.id);
|
||
}
|
||
},
|
||
|
||
departGroup(playerId, expeditionId) {
|
||
const settings = this.settings;
|
||
this.cards.database.transaction(() => {
|
||
this.settleFormingInTx(settings);
|
||
const row = this.formingRow(expeditionId);
|
||
if (row.creator_id !== playerId) fail(403, "EXPEDITION_NOT_CREATOR", "Seul le joueur qui a ouvert l’expédition peut la lancer.");
|
||
this.launchInTx(row, this.now(), settings);
|
||
});
|
||
return { expeditions: this.getExpeditions(playerId), state: this.cards.getState(playerId) };
|
||
},
|
||
|
||
// Départ : seule, l'expédition devient un solo (une place, butin d'un joueur) ; en groupe, une place par joueur, les places restées
|
||
// libres disparaissent. Le résultat et le butin de chacun sont tirés.
|
||
launchInTx(row, at, settings) {
|
||
const setup = JSON.parse(row.setup_json);
|
||
const members = this.memberSlots(row.id);
|
||
const alone = members.length <= 1;
|
||
// Coup de folie : les exigences réelles varient, tirées maintenant et révélées au retour.
|
||
const requirementFactorPct = rollRequirementFactor(teamPowers(members), settings, (max) => this.random(max));
|
||
const { evaluation, cohesion, synergy, powers, destination } = this.evaluateGroup(setup, members, settings, requirementFactorPct);
|
||
const multiplierPct = groupLootPct(members.length, settings);
|
||
const expected = this.teamExpected(setup, evaluation, members.length, powers, destination, settings);
|
||
const slotCount = Math.max(1, members.length);
|
||
const updateReward = this.db.prepare("UPDATE expedition_members SET reward_json = ? WHERE expedition_id = ? AND player_id = ?");
|
||
for (const member of members) updateReward.run(JSON.stringify(this.rollReward(expected, settings, { orientationPerSlot: evaluation.stats.orientation / slotCount, powers, destination, playerId: member.playerId, group: !alone })), row.id, member.playerId);
|
||
const extra = alone ? { powers } : { players: members.length, cohesionPct: cohesion, lootPct: multiplierPct, powers };
|
||
const result = this.resultView(evaluation, requirementFactorPct !== 100 || powers.includes("madCompass") ? { ...extra, requirementFactorPct } : extra, synergy);
|
||
const travel = setup.testTrip ? TEST_TRIP_MS : Math.round(travelHours(setup.hours, powers, settings) * HOUR_MS);
|
||
this.db.prepare("UPDATE expeditions SET mode = ?, status = 'running', departs_at = ?, returns_at = ?, duration_ms = ?, result_json = ? WHERE id = ?")
|
||
.run(alone ? "solo" : "group", at, at + travel, travel, JSON.stringify(result), row.id);
|
||
},
|
||
|
||
// Garde-fou : à la fin de la période d'inscription, l'expédition part d'elle-même, seule ou en groupe.
|
||
settleFormingInTx(settings) {
|
||
const now = this.now();
|
||
for (const row of this.db.prepare("SELECT * FROM expeditions WHERE status = 'forming'").all()) {
|
||
const setup = JSON.parse(row.setup_json);
|
||
if (setup.recruitUntil <= now) this.launchInTx(row, setup.recruitUntil, settings);
|
||
}
|
||
},
|
||
|
||
settleForming() {
|
||
const due = this.db.prepare("SELECT setup_json FROM expeditions WHERE status = 'forming'").all().some((row) => JSON.parse(row.setup_json).recruitUntil <= this.now());
|
||
if (due) this.cards.database.transaction(() => this.settleFormingInTx(this.settings));
|
||
},
|
||
|
||
// Tableau de la Guilde : chaque expédition en formation, ses membres, ses places libres et le résultat attendu si elle partait
|
||
// maintenant (seule ou en groupe, selon ses inscrits).
|
||
boardView(playerId, settings) {
|
||
return this.db.prepare("SELECT e.*, p.display_name AS creator_name FROM expeditions e JOIN players p ON p.id = e.creator_id WHERE e.status = 'forming' ORDER BY e.created_at").all().map((row) => {
|
||
const setup = JSON.parse(row.setup_json);
|
||
const members = this.memberSlots(row.id);
|
||
const { evaluation, cohesion, synergy, powers } = this.evaluateGroup(setup, members, settings);
|
||
const isMember = members.some((slot) => slot.playerId === playerId);
|
||
const freeSlots = Math.max(0, slotCountOf(setup) - members.length);
|
||
return {
|
||
id: row.id, day: row.day, destination: setup.destination, condition: setup.condition, dangers: setup.dangers, stars: setup.stars, hours: setup.hours,
|
||
creatorName: row.creator_name, isCreator: row.creator_id === playerId, isMember, openedAt: row.created_at, recruitUntil: setup.recruitUntil, tierLootPct: { struggle: settings.loot.tierPct[0], success: settings.loot.tierPct[1], triumph: settings.loot.tierPct[2] }, slots: slotCountOf(setup), freeSlots,
|
||
members: members.map((slot) => ({ playerName: slot.playerName, own: slot.playerId === playerId, position: slot.position, editionId: slot.editionId, cardId: slot.cardId })),
|
||
canJoin: settings.enabled && !isMember && freeSlots > 0,
|
||
canDepart: row.creator_id === playerId,
|
||
requirements: this.teamRequirements(setup, members, settings),
|
||
projected: powers.includes("madCompass") ? { hiddenRequirements: true, powers, players: members.length, cohesionPct: cohesion, lootPct: groupLootPct(members.length, settings) }
|
||
: this.resultView(evaluation, { players: members.length, cohesionPct: cohesion, lootPct: groupLootPct(members.length, settings), powers }, synergy)
|
||
};
|
||
});
|
||
},
|
||
|
||
// Expéditions que le joueur pourrait rejoindre maintenant (place libre, une carte jouable non occupée, sous sa limite).
|
||
joinableGroupCount(playerId, settings, busy) {
|
||
if (this.activeCount(playerId) >= MAX_ACTIVE_EXPEDITIONS) return 0;
|
||
const free = this.cards.collectionOf(playerId).some((entry) => !busy.has(entry.editionId) && editionExpeditionData(this.cards.catalog, entry.editionId, 0, settings));
|
||
if (!free) return 0;
|
||
return this.db.prepare("SELECT e.setup_json, (SELECT COUNT(*) FROM expedition_members m WHERE m.expedition_id = e.id) AS members FROM expeditions e WHERE e.status = 'forming' AND NOT EXISTS (SELECT 1 FROM expedition_members m WHERE m.expedition_id = e.id AND m.player_id = ?)")
|
||
.all(playerId).filter((row) => row.members < slotCountOf(JSON.parse(row.setup_json))).length;
|
||
}
|
||
};
|