chore: keep conquests in sync between pre- & post-U40 clients (#2985)
Some checks failed
Build Docker image / docker (push) Has been cancelled
Build / build (push) Has been cancelled

Reviewed-on: https://www.onlyg.it/OpenWF/SpaceNinjaServer/pulls/2985
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit was merged in pull request #2985.
This commit is contained in:
2025-11-05 01:10:27 -08:00
committed by Sainan
parent 2264ae176b
commit ebda91f517
3 changed files with 36 additions and 9 deletions

View File

@@ -423,3 +423,20 @@ export const getConquest = (
RandomSeed: rng.randomInt(0, 1_000_000)
};
};
export const getMissionTypeForLegacyOverride = (missionType: TMissionType, conquestType: TConquestType): string => {
if (missionType == "MT_ENDLESS_CAPTURE") {
return "EndlessCapture";
}
let str = missionType.substring(3, 4).toUpperCase() + missionType.substring(4).toLowerCase();
if (str == "Extermination") {
str = "Exterminate";
}
if (str == "Artifact") {
str = "Disruption";
}
if (str == "Defense" && conquestType == "CT_LAB") {
str = "DualDefense";
}
return str;
};

View File

@@ -41,7 +41,7 @@ import type {
import { toMongoDate, toOid, version_compare } from "../helpers/inventoryHelpers.ts";
import { logger } from "../utils/logger.ts";
import { DailyDeal, Fissure } from "../models/worldStateModel.ts";
import { getConquest } from "./conquestService.ts";
import { getConquest, getMissionTypeForLegacyOverride } from "./conquestService.ts";
const sortieBosses = [
"SORTIE_BOSS_HYENA",
@@ -3562,13 +3562,11 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
worldState.KnownCalendarSeasons.push(getCalendarSeason(week + 1));
}
const season = (["CST_WINTER", "CST_SPRING", "CST_SUMMER", "CST_FALL"] as const)[week % 4];
const labConquest = getConquest("CT_LAB", week, null);
const hexConquest = getConquest("CT_HEX", week, season);
if (!buildLabel || version_compare(buildLabel, "2025.10.14.16.10") >= 0) {
worldState.Conquests = [];
{
const season = (["CST_WINTER", "CST_SPRING", "CST_SUMMER", "CST_FALL"] as const)[week % 4];
worldState.Conquests.push(getConquest("CT_LAB", week, null));
worldState.Conquests.push(getConquest("CT_HEX", week, season));
}
worldState.Conquests = [labConquest, hexConquest];
if (isBeforeNextExpectedWorldStateRefresh(timeMs, weekEnd)) {
const season = (["CST_WINTER", "CST_SPRING", "CST_SUMMER", "CST_FALL"] as const)[(week + 1) % 4];
worldState.Conquests.push(getConquest("CT_LAB", week, null));
@@ -3621,6 +3619,18 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
e: cheeseEnd,
n: cheeseNext
},
lqo: {
mt: labConquest.Missions.map(x => getMissionTypeForLegacyOverride(x.missionType, "CT_LAB")),
mv: labConquest.Missions.map(x => x.difficulties[1].deviation),
c: labConquest.Missions.map(x => x.difficulties[1].risks),
fv: labConquest.Variables
},
hqo: {
mt: hexConquest.Missions.map(x => getMissionTypeForLegacyOverride(x.missionType, "CT_HEX")),
mv: hexConquest.Missions.map(x => x.difficulties[1].deviation),
c: hexConquest.Missions.map(x => x.difficulties[1].risks),
fv: hexConquest.Variables
},
sfn: [550, 553, 554, 555][halfHour % 4]
};
if (Array.isArray(config.worldState?.circuitGameModes)) {

View File

@@ -485,9 +485,9 @@ interface IFbst {
// < 40.0.0
interface IConquestOverride {
mt?: string[]; // mission types but "Exterminate" instead of "MT_EXTERMINATION", etc. and "DualDefense" instead of "Defense" for hex conquest
mt?: string[];
mv?: string[];
mf?: number[]; // hex conquest only
mf?: number[]; // hex conquest only. unknown purpose.
c?: [string, string][];
fv?: string[];
}