返回提交历史
Modified
src/constants/gameToBuildVersion.ts
+2
-0
Modified
src/services/missionInventoryUpdateService.ts
+13
-11
Modified
src/services/worldStateService.ts
+82
-8
XFEstudio/XFESpaceNinjaServer
fix: missing special rewards for alerts (#4381)
Closes #4365 --------- Co-authored-by: Vitruvio <vitruvio> Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4381 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: Vitruvio <16+vitruvio@noreply.localhost> Co-committed-by: Vitruvio <16+vitruvio@noreply.localhost>
ff470330
代码差异
3 个文件
+97
-19
@@ -81,6 +81,7 @@ const gameToBuildVersion = {
81
81
"18.13.3": "2016.06.02.12.11",
82
82
"18.5.0": "2016.03.04.10.06",
83
83
"18.0.2": "2015.12.05.18.07",
84
"17.12.0": "2015.11.25.18.32", // guessed from hotfix forum post
84
85
"17.7.1": "2015.10.15.12.24",
85
86
"16.5.5": "2015.05.14.16.29",
86
87
"16.0.2": "2015.03.21.08.17",
@@ -101,6 +102,7 @@ const gameToBuildVersion = {
101
102
"9.1.0": "2013.07.13.03.21",
102
103
"8.3.0": "2013.07.04.20.17",
103
104
"8.0.0": "2013.05.23.16.06",
105
"7.11.0": "2013.05.17.22.49", // guessed from hotfix forum post, "Update 7.11.0: Vauban"
104
106
"7.3.0": "2013.03.25.11.45",
105
107
"5.2.0": "2013.01.04.10.41",
106
108
"5.1.0": "2012.12.31.16.20"
@@ -787,7 +787,7 @@ export const addMissionInventoryUpdates = async (
787
787
clientProgress.DefenderScore *= 3;
788
788
}
789
789
const dbProgress = inventory.QualifyingInvasions.find(x =>
790
x.invasionId.equals(clientProgress._id.$oid)
790
x.invasionId.equals(fromOid(clientProgress._id))
791
791
);
792
792
if (dbProgress) {
793
793
dbProgress.Delta += clientProgress.Delta;
@@ -795,13 +795,13 @@ export const addMissionInventoryUpdates = async (
795
795
dbProgress.DefenderScore += clientProgress.DefenderScore;
796
796
} else {
797
797
inventory.QualifyingInvasions.push({
798
invasionId: new Types.ObjectId(clientProgress._id.$oid),
798
invasionId: new Types.ObjectId(fromOid(clientProgress._id)),
799
799
Delta: clientProgress.Delta,
800
800
AttackerScore: clientProgress.AttackerScore,
801
801
DefenderScore: clientProgress.DefenderScore
802
802
});
803
803
}
804
const invasion = getInvasionByOid(clientProgress._id.$oid)!;
804
const invasion = getInvasionByOid(fromOid(clientProgress._id))!;
805
805
const factionSidedWith = clientProgress.AttackerScore ? invasion.Faction : invasion.DefenderFaction;
806
806
if (invasion.Faction != "FC_INFESTATION") {
807
807
const info = factionSidedWith != "FC_GRINEER" ? grineerDeathSquadInfo : corpusDeathSquadInfo;
@@ -1227,7 +1227,7 @@ export const addMissionRewards = async (
1227
1227
if (rewardInfo.alertId) {
1228
1228
const worldState = getWorldState(buildLabel);
1229
1229
await populateAlerts(worldState);
1230
const alert = worldState.Alerts.find(x => x._id.$oid == rewardInfo.alertId);
1230
const alert = worldState.Alerts.find(x => fromOid(x._id) == rewardInfo.alertId);
1231
1231
if (!alert) {
1232
1232
logger.warn(`mission completed unknown alert`, { alertId: rewardInfo.alertId });
1233
1233
} else {
@@ -1260,7 +1260,9 @@ export const addMissionRewards = async (
1260
1260
1261
1261
if (invasionProgress) {
1262
1262
for (const clientProgress of invasionProgress) {
1263
const dbProgress = inventory.QualifyingInvasions.find(x => x.invasionId.equals(clientProgress._id.$oid));
1263
const dbProgress = inventory.QualifyingInvasions.find(x =>
1264
x.invasionId.equals(fromOid(clientProgress._id))
1265
);
1264
1266
if (dbProgress) {
1265
1267
const run =
1266
1268
(clientProgress.AttackerScore > clientProgress.DefenderScore
@@ -1272,7 +1274,7 @@ export const addMissionRewards = async (
1272
1274
}
1273
1275
1274
1276
if (rewardInfo.goalId) {
1275
const goal = getWorldState(buildLabel).Goals.find(x => x._id.$oid == rewardInfo.goalId);
1277
const goal = getWorldState(buildLabel).Goals.find(x => fromOid(x._id) == rewardInfo.goalId);
1276
1278
if (goal) {
1277
1279
if (rewardInfo.node == goal.Node && goal.MissionKeyName) levelKeyName = goal.MissionKeyName;
1278
1280
if (goal.ConcurrentNodes && goal.ConcurrentMissionKeyNames) {
@@ -1315,7 +1317,7 @@ export const addMissionRewards = async (
1315
1317
await handleGuildGoalProgress(guild, {
1316
1318
Count: 10,
1317
1319
Tag: goal.Tag,
1318
goalId: new Types.ObjectId(goal._id.$oid)
1320
goalId: new Types.ObjectId(fromOid(goal._id))
1319
1321
});
1320
1322
}
1321
1323
}
@@ -2536,7 +2538,7 @@ async function getRandomMissionDrops(
2536
2538
2537
2539
if (RewardInfo.EnemyCachesFound) {
2538
2540
if (RewardInfo.goalId) {
2539
const goal = getWorldState(buildLabel).Goals.find(x => x._id.$oid == RewardInfo.goalId);
2541
const goal = getWorldState(buildLabel).Goals.find(x => fromOid(x._id) == RewardInfo.goalId);
2540
2542
if (goal) {
2541
2543
let currentMissionKey: string | undefined;
2542
2544
if (RewardInfo.node == goal.Node) {
@@ -2577,7 +2579,7 @@ async function getRandomMissionDrops(
2577
2579
} else if (RewardInfo.alertId) {
2578
2580
const worldState = getWorldState(buildLabel);
2579
2581
await populateAlerts(worldState);
2580
const alert = worldState.Alerts.find(x => x._id.$oid == RewardInfo.alertId);
2582
const alert = worldState.Alerts.find(x => fromOid(x._id) == RewardInfo.alertId);
2581
2583
if (alert && alert.MissionInfo.enemyCacheOverride) {
2582
2584
const deck = ExportRewards[alert.MissionInfo.enemyCacheOverride];
2583
2585
for (let rotation = 0; rotation != RewardInfo.EnemyCachesFound; ++rotation) {
@@ -2731,12 +2733,12 @@ const getSyndicateJob = (
2731
2733
2732
2734
let syndicateEntry: ISyndicateMissionInfo | IGoal | undefined;
2733
2735
if (isGoalJob) {
2734
syndicateEntry = getWorldState(buildLabel).Goals.find(g => g._id.$oid === syndicateMissionId);
2736
syndicateEntry = getWorldState(buildLabel).Goals.find(g => fromOid(g._id) === syndicateMissionId);
2735
2737
if (syndicateEntry) syndicateTag = syndicateEntry.JobAffiliationTag!;
2736
2738
} else if (syndicateMissionId) {
2737
2739
const syndicateMissions: ISyndicateMissionInfo[] = [];
2738
2740
pushClassicBounties(syndicateMissions, idToBountyCycle(syndicateMissionId), buildLabel);
2739
syndicateEntry = syndicateMissions.find(m => m._id.$oid == syndicateMissionId);
2741
syndicateEntry = syndicateMissions.find(m => fromOid(m._id) == syndicateMissionId);
2740
2742
if (syndicateEntry) syndicateTag = syndicateEntry.Tag;
2741
2743
}
2742
2744
@@ -5773,7 +5773,7 @@ const generateSeededAlert = (
5773
5773
if (version_compare(buildLabel, gameToBuildVersion["14.0.0"]) >= 0) {
5774
5774
filteredSpecRes.push({ path: "/Lotus/Types/Items/MiscItems/Eventium", qty: 5 });
5775
5775
}
5776
if (version_compare(buildLabel, gameToBuildVersion["18.5.0"]) >= 0) {
5776
if (version_compare(buildLabel, gameToBuildVersion["17.12.0"]) >= 0) {
5777
5777
filteredSpecRes.push({ path: "/Lotus/Types/Items/MiscItems/Alertium", qty: 1 });
5778
5778
}
5779
5779
if (version_compare(buildLabel, gameToBuildVersion["18.13.3"]) >= 0) {
@@ -5794,7 +5794,7 @@ const generateSeededAlert = (
5794
5794
];
5795
5795
if (hasNightmare) categories.push({ name: "NIGHTMARE_MODS", weight: 30 });
5796
5796
if (filteredSpecRes.length > 0) categories.push({ name: "SPECIAL_RESOURCES", weight: 10 });
5797
if (version_compare(buildLabel, gameToBuildVersion["5.2.0"]) >= 0) {
5797
if (version_compare(buildLabel, gameToBuildVersion["7.11.0"]) >= 0) {
5798
5798
categories.push({ name: "VAUBAN_PARTS", weight: 7 });
5799
5799
}
5800
5800
@@ -5973,13 +5973,87 @@ export const populateAlerts = async (worldState: IWorldState): Promise<void> =>
5973
5973
if (timeMs >= activationTime && timeMs < expiryTime) {
5974
5974
usedNodes.add(alert.MissionInfo.location);
5975
5975
5976
if (alert.MissionInfo.missionReward?.items) {
5977
alert.MissionInfo.missionReward.items = alert.MissionInfo.missionReward.items.map(item => {
5978
if (item.includes("/Recipes/Helmets/")) {
5979
return getVersionAppropriateHelmet(item, buildLabel);
5976
const isPreU14 = version_compare(buildLabel, gameToBuildVersion["14.0.0"]) < 0;
5977
if (alert.MissionInfo.missionReward) {
5978
if (alert.MissionInfo.missionReward.items) {
5979
alert.MissionInfo.missionReward.items = alert.MissionInfo.missionReward.items.map(item => {
5980
let processedItem = item;
5981
if (processedItem.includes("/Recipes/Helmets/")) {
5982
processedItem = getVersionAppropriateHelmet(processedItem, buildLabel);
5983
}
5984
5985
if (isPreU14) {
5986
const parts = processedItem.split("/");
5987
const filename = parts[parts.length - 1];
5988
5989
if (processedItem.includes("/Recipes/WarframeRecipes/")) {
5990
return `/Lotus/Types/Recipes/WarframeRecipes/${filename}StoreItem`;
5991
}
5992
5993
const isPreU13 = version_compare(buildLabel, gameToBuildVersion["13.0.0"]) < 0;
5994
if (filename === "FormaBlueprint") {
5995
if (isPreU13) {
5996
return "/Lotus/Types/StoreItems/Recipes/OrokinCatalystBlueprintStoreItem";
5997
}
5998
return "/Lotus/Types/Recipes/Components/FormaBlueprintStoreItem";
5999
}
6000
if (filename === "Forma") {
6001
if (isPreU13) {
6002
return "/Lotus/Types/StoreItems/Recipes/OrokinCatalystStoreItem";
6003
}
6004
return "/Lotus/Types/Recipes/Components/FormaStoreItem";
6005
}
6006
if (filename === "OrokinReactorBlueprint") {
6007
if (isPreU13) {
6008
return "/Lotus/Types/StoreItems/Recipes/OrokinReactorBlueprintStoreItem";
6009
}
6010
return "/Lotus/Types/Recipes/Components/OrokinReactorBlueprintStoreItem";
6011
}
6012
if (filename === "OrokinCatalystBlueprint") {
6013
return "/Lotus/Types/StoreItems/Recipes/OrokinCatalystBlueprintStoreItem";
6014
}
6015
if (filename.endsWith("Blueprint")) {
6016
return `/Lotus/Types/StoreItems/Recipes/${filename}StoreItem`;
6017
}
6018
return processedItem;
6019
}
6020
6021
return processedItem;
6022
});
6023
}
6024
6025
if (alert.MissionInfo.missionReward.countedItems) {
6026
if (isPreU14) {
6027
alert.MissionInfo.missionReward.countedItems =
6028
alert.MissionInfo.missionReward.countedItems.map(ci => {
6029
if (ci.ItemType === "/Lotus/Types/Items/MiscItems/ArgonCrystal") {
6030
return {
6031
ItemType: "/Lotus/Types/Items/MiscItems/OrokinCell",
6032
ItemCount: ci.ItemCount
6033
};
6034
}
6035
if (ci.ItemType === "/Lotus/Types/Items/MiscItems/OxiumAlloy") {
6036
return {
6037
ItemType: "/Lotus/Types/Items/MiscItems/Gallium",
6038
ItemCount: Math.max(1, Math.round(ci.ItemCount / 10))
6039
};
6040
}
6041
if (ci.ItemType === "/Lotus/Types/Items/MiscItems/Tellurium") {
6042
return {
6043
ItemType: "/Lotus/Types/Items/MiscItems/Morphic",
6044
ItemCount: ci.ItemCount
6045
};
6046
}
6047
if (ci.ItemType === "/Lotus/Types/Items/MiscItems/Alertium") {
6048
return {
6049
ItemType: "/Lotus/Types/Items/MiscItems/Neurode",
6050
ItemCount: ci.ItemCount
6051
};
6052
}
6053
return ci;
6054
});
5980
6055
}
5981
return item;
5982
});
6056
}
5983
6057
}
5984
6058
5985
6059
activeAlerts.push(alert);