feat: conquest research points #1796

Merged
Sainan merged 5 commits from janisslsm/SpaceNinjaServer:conquest-points into conquest-progress 2025-04-22 15:23:29 -07:00
Showing only changes of commit 7e23810cad - Show all commits

View File

@ -75,8 +75,6 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
const { MissionRewards, inventoryChanges, credits, AffiliationMods, SyndicateXPItemReward } =
await addMissionRewards(inventory, missionReport, firstCompletion);
//TODO: figure out when to send inventory. it is needed for many cases.
const response: IMissionInventoryUpdateResponse = {
InventoryChanges: inventoryChanges,
@ -92,45 +90,41 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
response.ConquestCompletedMissionsCount =
missionReport.ConquestMissionsCompleted == 2 ? 0 : missionReport.ConquestMissionsCompleted + 1;
let score = 1;
if(missionReport.RewardInfo?.ConquestHardModeActive === 1)
score += 3
if (missionReport.RewardInfo?.ConquestHardModeActive === 1) score += 3;
if (missionReport.RewardInfo?.ConquestPersonalModifiersActive !== undefined)
Sainan marked this conversation as resolved
Review

I'd add satisfies IMissionInventoryUpdateResponse

I'd add `satisfies IMissionInventoryUpdateResponse`
score += missionReport.RewardInfo?.ConquestPersonalModifiersActive;
if (missionReport.RewardInfo?.ConquestEquipmentSuggestionsFulfilled !== undefined)
score += missionReport.RewardInfo?.ConquestEquipmentSuggestionsFulfilled;
score *= missionReport.ConquestMissionsCompleted + 1
score *= missionReport.ConquestMissionsCompleted + 1;
if(missionReport.ConquestMissionsCompleted == 2 && missionReport.RewardInfo?.ConquestHardModeActive === 1)
if (missionReport.ConquestMissionsCompleted == 2 && missionReport.RewardInfo?.ConquestHardModeActive === 1)
score += 1;
const conquestType = missionReport.RewardInfo?.ConquestType;
const conquestNode = conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked";
if(score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined)
const conquestNode =
conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked";
if (score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined)
inventory.NodeIntrosCompleted.push(conquestNode);
if(conquestType == "HexConquest")
{
if (conquestType == "HexConquest") {
inventory.EchoesHexConquestCacheScoreMission ??= 0;
if(score > inventory.EchoesHexConquestCacheScoreMission )
if (score > inventory.EchoesHexConquestCacheScoreMission)
inventory.EchoesHexConquestCacheScoreMission = score;
}else
{
} else {
inventory.EntratiLabConquestCacheScoreMission ??= 0;
if(score > inventory.EntratiLabConquestCacheScoreMission )
if (score > inventory.EntratiLabConquestCacheScoreMission)
inventory.EntratiLabConquestCacheScoreMission = score;
}
}
await inventory.save();
const inventoryResponse = await getInventoryResponse(inventory, true);
response.InventoryJson = JSON.stringify(inventoryResponse);
response.InventoryJson = JSON.stringify(inventoryResponse);
res.json(response);
};