feat(mods): merge additive mod system, official map selector, and mod-dev-docs
# Conflicts: # apps/launcher/src/main/workers/build-worker.ts # apps/launcher/src/renderer/src/i18n/locales/en.json # apps/launcher/src/renderer/src/i18n/locales/zh-CN.json
This commit is contained in:
commit
d94c8fe687
103 files changed
+10829
-1621
No files matched your search
@@ -86,6 +86,16 @@ export type MatchmakeOutcome =
|
||||
| { readonly ok: true; readonly launch: BattleLaunchPlan }
|
||||
| { readonly ok: false; readonly error: string };
|
||||
|
||||
export type MissionPoolFilter = (ctx: {
|
||||
readonly userId: string;
|
||||
readonly modeId: number;
|
||||
readonly modeName: string;
|
||||
readonly economicName: string;
|
||||
readonly minMrank: number;
|
||||
readonly maxMrank: number;
|
||||
readonly missions: readonly MissionHeader[];
|
||||
}) => readonly MissionHeader[];
|
||||
|
||||
export class BattleMatchmaker {
|
||||
readonly #gameModes: GameModes;
|
||||
readonly #vehicles: readonly CatalogueVehicle[];
|
||||
@@ -94,6 +104,7 @@ export class BattleMatchmaker {
|
||||
readonly #tuning: BattleTuning;
|
||||
readonly #spawnRules: BattleSpawnRulesData;
|
||||
readonly #aircraftLoadouts: ReadonlyMap<string, BotAircraftLoadout>;
|
||||
readonly #filterMissions: MissionPoolFilter | undefined;
|
||||
|
||||
constructor(
|
||||
gameModes: GameModes,
|
||||
@@ -102,6 +113,7 @@ export class BattleMatchmaker {
|
||||
tuning: BattleTuning,
|
||||
spawnRules: BattleSpawnRulesData,
|
||||
aircraftLoadouts: ReadonlyMap<string, BotAircraftLoadout>,
|
||||
filterMissions?: MissionPoolFilter,
|
||||
) {
|
||||
this.#gameModes = gameModes;
|
||||
this.#vehicles = vehicles;
|
||||
@@ -110,6 +122,7 @@ export class BattleMatchmaker {
|
||||
this.#tuning = tuning;
|
||||
this.#spawnRules = spawnRules;
|
||||
this.#aircraftLoadouts = aircraftLoadouts;
|
||||
this.#filterMissions = filterMissions;
|
||||
}
|
||||
|
||||
enqueue(input: EnqueueBattleInput): MatchmakeOutcome {
|
||||
@@ -133,8 +146,20 @@ export class BattleMatchmaker {
|
||||
const minMrank = Math.max(declaration.minQueueMrank ?? 0, playerMrank - this.#tuning.brSpreadMrank);
|
||||
const roomCeiling = chosenMode.missionRanks?.maxMrank ?? Infinity;
|
||||
const maxMrank = Math.max(minMrank, playerMrank, Math.min(roomCeiling, playerMrank + this.#tuning.brSpreadMrank));
|
||||
const missions = twoSidedMissionsOf(chosenMode, maxMrank);
|
||||
if (missions.length === 0) return { ok: false, error: 'NO_MISSION_FOR_BR' };
|
||||
const rawMissions = twoSidedMissionsOf(chosenMode, maxMrank);
|
||||
if (rawMissions.length === 0) return { ok: false, error: 'NO_MISSION_FOR_BR' };
|
||||
const filteredMissions = this.#filterMissions
|
||||
? this.#filterMissions({
|
||||
userId: input.userId,
|
||||
modeId: declaration.gameModeId,
|
||||
modeName: declaration.name,
|
||||
economicName: declaration.economicName,
|
||||
minMrank,
|
||||
maxMrank,
|
||||
missions: rawMissions,
|
||||
})
|
||||
: rawMissions;
|
||||
const missions = filteredMissions.length > 0 ? filteredMissions : rawMissions;
|
||||
const mission = pickMission(missions, input.bannedMissions, input.dislikedMissions);
|
||||
const coalitions = selectBattleCoalitions({
|
||||
vehicles: this.#vehicles,
|
||||
|
||||
Reference in new issue
Block a user