XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

chore: keep conquests in sync between pre- & post-U40 clients (#2985)

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>

ebda91f5
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +36 -9
Modified src/services/conquestService.ts +17 -0
@@ -423,3 +423,20 @@ export const getConquest = (
423 423 RandomSeed: rng.randomInt(0, 1_000_000)
424 424 };
425 425 };
426
427 export const getMissionTypeForLegacyOverride = (missionType: TMissionType, conquestType: TConquestType): string => {
428 if (missionType == "MT_ENDLESS_CAPTURE") {
429 return "EndlessCapture";
430 }
431 let str = missionType.substring(3, 4).toUpperCase() + missionType.substring(4).toLowerCase();
432 if (str == "Extermination") {
433 str = "Exterminate";
434 }
435 if (str == "Artifact") {
436 str = "Disruption";
437 }
438 if (str == "Defense" && conquestType == "CT_LAB") {
439 str = "DualDefense";
440 }
441 return str;
442 };
Modified src/services/worldStateService.ts +17 -7
@@ -41,7 +41,7 @@ import type {
41 41 import { toMongoDate, toOid, version_compare } from "../helpers/inventoryHelpers.ts";
42 42 import { logger } from "../utils/logger.ts";
43 43 import { DailyDeal, Fissure } from "../models/worldStateModel.ts";
44 import { getConquest } from "./conquestService.ts";
44 import { getConquest, getMissionTypeForLegacyOverride } from "./conquestService.ts";
45 45
46 46 const sortieBosses = [
47 47 "SORTIE_BOSS_HYENA",
@@ -3562,13 +3562,11 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3562 3562 worldState.KnownCalendarSeasons.push(getCalendarSeason(week + 1));
3563 3563 }
3564 3564
3565 const season = (["CST_WINTER", "CST_SPRING", "CST_SUMMER", "CST_FALL"] as const)[week % 4];
3566 const labConquest = getConquest("CT_LAB", week, null);
3567 const hexConquest = getConquest("CT_HEX", week, season);
3565 3568 if (!buildLabel || version_compare(buildLabel, "2025.10.14.16.10") >= 0) {
3566 worldState.Conquests = [];
3567 {
3568 const season = (["CST_WINTER", "CST_SPRING", "CST_SUMMER", "CST_FALL"] as const)[week % 4];
3569 worldState.Conquests.push(getConquest("CT_LAB", week, null));
3570 worldState.Conquests.push(getConquest("CT_HEX", week, season));
3571 }
3569 worldState.Conquests = [labConquest, hexConquest];
3572 3570 if (isBeforeNextExpectedWorldStateRefresh(timeMs, weekEnd)) {
3573 3571 const season = (["CST_WINTER", "CST_SPRING", "CST_SUMMER", "CST_FALL"] as const)[(week + 1) % 4];
3574 3572 worldState.Conquests.push(getConquest("CT_LAB", week, null));
@@ -3621,6 +3619,18 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3621 3619 e: cheeseEnd,
3622 3620 n: cheeseNext
3623 3621 },
3622 lqo: {
3623 mt: labConquest.Missions.map(x => getMissionTypeForLegacyOverride(x.missionType, "CT_LAB")),
3624 mv: labConquest.Missions.map(x => x.difficulties[1].deviation),
3625 c: labConquest.Missions.map(x => x.difficulties[1].risks),
3626 fv: labConquest.Variables
3627 },
3628 hqo: {
3629 mt: hexConquest.Missions.map(x => getMissionTypeForLegacyOverride(x.missionType, "CT_HEX")),
3630 mv: hexConquest.Missions.map(x => x.difficulties[1].deviation),
3631 c: hexConquest.Missions.map(x => x.difficulties[1].risks),
3632 fv: hexConquest.Variables
3633 },
3624 3634 sfn: [550, 553, 554, 555][halfHour % 4]
3625 3635 };
3626 3636 if (Array.isArray(config.worldState?.circuitGameModes)) {
Modified src/types/worldStateTypes.ts +2 -2
@@ -485,9 +485,9 @@ interface IFbst {
485 485
486 486 // < 40.0.0
487 487 interface IConquestOverride {
488 mt?: string[]; // mission types but "Exterminate" instead of "MT_EXTERMINATION", etc. and "DualDefense" instead of "Defense" for hex conquest
488 mt?: string[];
489 489 mv?: string[];
490 mf?: number[]; // hex conquest only
490 mf?: number[]; // hex conquest only. unknown purpose.
491 491 c?: [string, string][];
492 492 fv?: string[];
493 493 }