fix(server): persist selectable battle ratings
Validate the selected rank against owned modifications and return the saved profile. Use the saved rank delta for mode eligibility and room matchmaking. Verified with typecheck and a local 2.61.0.58 server run using temporary data. In-game acceptance is pending.
This commit is contained in:
1 parent
3f0e08c5b7
commit
899fb5d91b
8 files changed
+82
-17
No files matched your search
@@ -37,6 +37,7 @@ export interface EnqueueBattleInput {
|
||||
readonly modes?: readonly OfferedGameMode[];
|
||||
readonly country: string;
|
||||
readonly slotVehicles: readonly string[];
|
||||
readonly mrankDeltas: ReadonlyMap<string, number>;
|
||||
readonly selectedSlot?: BattleCrewSlot;
|
||||
readonly bannedMissions: ReadonlySet<string>;
|
||||
readonly dislikedMissions: ReadonlySet<string>;
|
||||
@@ -117,13 +118,14 @@ export class BattleMatchmaker {
|
||||
(mode) => mode.declaration.displayType !== 'pve_battle' && twoSidedMissionsOf(mode).length > 0,
|
||||
);
|
||||
if (pvpModes.length === 0) return { ok: false, error: 'PVE_NOT_SUPPORTED' };
|
||||
const chosenMode = this.#pickQueuedMode(pvpModes, input.slotVehicles, input.selectedSlot?.unitName);
|
||||
const chosenMode = this.#pickQueuedMode(pvpModes, input);
|
||||
if (!chosenMode) return { ok: false, error: 'BAD_PARAMS' };
|
||||
|
||||
const { declaration } = chosenMode;
|
||||
const activeVehicles = activeVehiclesForMode(declaration, input.slotVehicles, input.selectedSlot?.unitName, this.#vehiclesByName);
|
||||
const playerMrank = lineupMrank(
|
||||
activeVehicles, this.#vehiclesByName, declaration.difficulty, declaration.requiredClass, declaration.allowedClasses,
|
||||
input.mrankDeltas,
|
||||
);
|
||||
const minMrank = Math.max(declaration.minQueueMrank ?? 0, playerMrank - this.#tuning.brSpreadMrank);
|
||||
const roomCeiling = chosenMode.missionRanks?.maxMrank ?? Infinity;
|
||||
@@ -158,13 +160,10 @@ export class BattleMatchmaker {
|
||||
};
|
||||
}
|
||||
|
||||
#pickQueuedMode(
|
||||
candidates: readonly OfferedGameMode[],
|
||||
slotVehicles: readonly string[],
|
||||
selectedSlotVehicle: string | undefined,
|
||||
): OfferedGameMode | undefined {
|
||||
const pool = candidates.filter((mode) =>
|
||||
isModeEligibleForLineup(mode.declaration, slotVehicles, selectedSlotVehicle, this.#vehiclesByName));
|
||||
#pickQueuedMode(candidates: readonly OfferedGameMode[], input: EnqueueBattleInput): OfferedGameMode | undefined {
|
||||
const pool = candidates.filter((mode) => isModeEligibleForLineup(
|
||||
mode.declaration, input.slotVehicles, input.selectedSlot?.unitName, this.#vehiclesByName, input.mrankDeltas,
|
||||
));
|
||||
if (pool.length === 0) return candidates.find((mode) => mode.declaration.multiSlot !== false);
|
||||
const classics = pool.filter((mode) => !mode.declaration.tag);
|
||||
const subModes = pool.filter((mode) => Boolean(mode.declaration.tag));
|
||||
|
||||
Reference in new issue
Block a user