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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

fix: exclude infested archwing and Deimos from alert generator (#4449)

Fixes #4432 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4449 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>

3209bde4
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

2 个文件 +38 -30
Modified src/services/worldStateService.ts +37 -30
@@ -5478,7 +5478,7 @@ const getVersionAppropriateHelmet = (helmetPath: string, buildLabel: string): st
5478 5478 return isStore ? toStoreItem(resultPath) : resultPath;
5479 5479 };
5480 5480
5481 const getEligibleAlertNodes = (): string[] => {
5481 const getEligibleAlertNodes = (regions: Record<string, IRegion>, buildLabel: string): string[] => {
5482 5482 const eligibleNodes: string[] = [];
5483 5483 const validMissionTypes = new Set([
5484 5484 "MT_SURVIVAL",
@@ -5489,17 +5489,18 @@ const getEligibleAlertNodes = (): string[] => {
5489 5489 "MT_SABOTAGE",
5490 5490 "MT_MOBILE_DEFENSE",
5491 5491 "MT_EXCAVATE",
5492 "MT_INTEL"
5492 "MT_INTEL",
5493 "MT_TERRITORY",
5494 "MT_PURSUIT",
5495 "MT_SABOTAGE",
5496 "MT_RACE"
5493 5497 ]);
5494 5498 const validFactions = new Set(["FC_GRINEER", "FC_CORPUS", "FC_INFESTATION", "FC_CORRUPTED", "FC_OROKIN"]);
5495 const invalidSystems = new Set([
5496 "/Lotus/Language/Locations/Moon",
5497 "/Lotus/Language/Locations/Derelict",
5498 "/Lotus/Language/Locations/Fortress",
5499 "/Lotus/Language/Locations/RelayStationSanctuary"
5500 ]);
5501 5499
5502 for (const [nodeId, nodeData] of Object.entries(ExportRegions)) {
5500 for (const [nodeId, nodeData] of Object.entries(regions)) {
5501 if (!isRegionAvailableIn(nodeId, nodeData, buildLabel)) {
5502 continue;
5503 }
5503 5504 if (!nodeId.startsWith("SolNode") && !nodeId.startsWith("SettlementNode")) {
5504 5505 continue;
5505 5506 }
@@ -5512,7 +5513,11 @@ const getEligibleAlertNodes = (): string[] => {
5512 5513 if (!nodeData.faction || !validFactions.has(nodeData.faction)) {
5513 5514 continue;
5514 5515 }
5515 if (invalidSystems.has(nodeData.systemName) || nodeData.systemName.endsWith("_SPACE")) {
5516
5517 if (
5518 nodeData.systemIndex == 16 || // Deimos/Derelict
5519 nodeData.systemIndex > 18 // Kuva fortress and more modern things
5520 ) {
5516 5521 continue;
5517 5522 }
5518 5523 eligibleNodes.push(nodeId);
@@ -5693,8 +5698,9 @@ const generateSeededAlert = (
5693 5698
5694 5699 const isPreU14 = version_compare(buildLabel, gameToBuildVersion["14.0.0"]) < 0;
5695 5700 const isPostU18 = version_compare(buildLabel, gameToBuildVersion["18.0.2"]) >= 0;
5701 const isArch = isArchwingMission(nodeData);
5696 5702
5697 const factions: TFaction[] = ["FC_GRINEER", "FC_CORPUS", "FC_INFESTATION"];
5703 const factions: TFaction[] = isArch ? ["FC_GRINEER", "FC_CORPUS"] : ["FC_GRINEER", "FC_CORPUS", "FC_INFESTATION"];
5698 5704 let faction: TFaction = rng.randomInt(0, 9) < 7 ? (nodeData.faction as TFaction) : rng.randomElement(factions)!;
5699 5705 if (faction === "FC_OROKIN" && isPostU18) {
5700 5706 faction = "FC_CORRUPTED" as TFaction;
@@ -5725,27 +5731,31 @@ const generateSeededAlert = (
5725 5731 levelOverride = undefined;
5726 5732 }
5727 5733
5734 if (isArch) {
5735 missionType = rng.randomElement(
5736 faction == "FC_GRINEER"
5737 ? ["MT_EXTERMINATION", "MT_MOBILE_DEFENSE", "MT_TERRITORY", "MT_PURSUIT"]
5738 : ["MT_EXTERMINATION", "MT_MOBILE_DEFENSE", "MT_SABOTAGE", "MT_RACE"]
5739 )!;
5740 }
5741
5728 5742 if (missionType !== nodeData.missionType || faction !== nodeData.faction) {
5729 5743 let foundEnemySpec: string | undefined = undefined;
5730 5744 let foundExtraEnemySpec: string | undefined = undefined;
5731 5745 const searchFaction = (faction as string) === "FC_CORRUPTED" ? "FC_OROKIN" : faction;
5732 5746
5733 for (const node of Object.values(regions)) {
5734 if (node.faction === searchFaction && node.missionType === missionType && node.enemySpec) {
5735 foundEnemySpec = node.enemySpec;
5736 foundExtraEnemySpec = node.extraEnemySpec;
5737 break;
5738 }
5747 if (isArch) {
5748 const targetTileset =
5749 faction == "FC_GRINEER" ? "ArchwingGrineerSpaceTileset" : "ArchwingCorpusTrenchrunTileset";
5750 foundEnemySpec = rng.randomElement(ExportTilesets[targetTileset].missions[missionType]!.enemySpecs!)!;
5739 5751 }
5740 5752
5741 5753 if (!foundEnemySpec) {
5742 for (const node of Object.values(regions)) {
5743 if (node.faction === searchFaction && node.enemySpec) {
5744 foundEnemySpec = node.enemySpec;
5745 foundExtraEnemySpec = node.extraEnemySpec;
5746 break;
5747 }
5748 }
5754 const nodes = Object.values(regions).filter(node => node.faction == searchFaction && node.enemySpec);
5755 const node = nodes.find(node => node.missionType == missionType) ?? nodes[0];
5756
5757 foundEnemySpec = node.enemySpec;
5758 foundExtraEnemySpec = node.extraEnemySpec;
5749 5759 }
5750 5760
5751 5761 enemySpec = foundEnemySpec;
@@ -5941,7 +5951,8 @@ const generateSeededAlert = (
5941 5951 minEnemyLevel: minEnemyLevel,
5942 5952 maxEnemyLevel: maxEnemyLevel,
5943 5953 descText: descText,
5944 nightmare: isNightmare || undefined
5954 nightmare: isNightmare || undefined,
5955 archwingRequired: isArchwingMission(nodeData) || undefined
5945 5956 }
5946 5957 };
5947 5958
@@ -5955,12 +5966,8 @@ export const populateAlerts = async (worldState: IWorldState): Promise<void> =>
5955 5966 (version_compare(buildLabel, gameToBuildVersion["5.1.0"]) >= 0 &&
5956 5967 version_compare(buildLabel, gameToBuildVersion["24.3.0"]) < 0) // alerts were retired with U24.3.0
5957 5968 ) {
5958 const eligibleNodes = getEligibleAlertNodes();
5959 5969 const regions = await getRegions(buildLabel);
5960 const validNodes = eligibleNodes.filter(nodeId => {
5961 const region = regions[nodeId] as (typeof regions)[string] | undefined;
5962 return region && isRegionAvailableIn(nodeId, region, buildLabel);
5963 });
5970 const validNodes = getEligibleAlertNodes(regions, buildLabel);
5964 5971
5965 5972 if (validNodes.length === 0) return;
5966 5973
Modified src/types/worldStateTypes.ts +1 -0
@@ -100,6 +100,7 @@ export interface IAlertMissionInfo {
100 100 missionType: TMissionType;
101 101 faction: TFaction;
102 102 difficulty: number;
103 archwingRequired?: true;
103 104 missionReward?: IMissionReward;
104 105 levelOverride?: string;
105 106 enemySpec?: string;