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
3 changed files with 62 additions and 13 deletions

View File

@ -72,14 +72,19 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
return;
}
const { MissionRewards, inventoryChanges, credits, AffiliationMods, SyndicateXPItemReward } =
await addMissionRewards(inventory, missionReport, firstCompletion);
const {
MissionRewards,
inventoryChanges,
credits,
AffiliationMods,
SyndicateXPItemReward,
ConquestCompletedMissionsCount
} = await addMissionRewards(inventory, missionReport, firstCompletion);
await inventory.save();
const inventoryResponse = await getInventoryResponse(inventory, true);
//TODO: figure out when to send inventory. it is needed for many cases.
const response: IMissionInventoryUpdateResponse = {
res.json({
InventoryJson: JSON.stringify(inventoryResponse),
InventoryChanges: inventoryChanges,
MissionRewards,
@ -87,13 +92,9 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
...inventoryUpdates,
//FusionPoints: inventoryChanges?.FusionPoints, // This in combination with InventoryJson or InventoryChanges seems to just double the number of endo shown, so unsure when this is needed.
SyndicateXPItemReward,
AffiliationMods
};
if (missionReport.ConquestMissionsCompleted !== undefined) {
response.ConquestCompletedMissionsCount =
missionReport.ConquestMissionsCompleted == 2 ? 0 : missionReport.ConquestMissionsCompleted + 1;
}
res.json(response);
AffiliationMods,
ConquestCompletedMissionsCount
Sainan marked this conversation as resolved
Review

I'd add satisfies IMissionInventoryUpdateResponse

I'd add `satisfies IMissionInventoryUpdateResponse`
} satisfies IMissionInventoryUpdateResponse);
};
/*

View File

@ -586,6 +586,7 @@ interface AddMissionRewardsReturnType {
credits?: IMissionCredits;
AffiliationMods?: IAffiliationMods[];
SyndicateXPItemReward?: number;
ConquestCompletedMissionsCount?: number;
}
//TODO: return type of partial missioninventoryupdate response
@ -620,6 +621,7 @@ export const addMissionRewards = async (
const inventoryChanges: IInventoryChanges = {};
const AffiliationMods: IAffiliationMods[] = [];
let SyndicateXPItemReward;
let ConquestCompletedMissionsCount;
let missionCompletionCredits = 0;
//inventory change is what the client has not rewarded itself, also the client needs to know the credit changes for display
@ -882,7 +884,48 @@ export const addMissionRewards = async (
}
}
return { inventoryChanges, MissionRewards, credits, AffiliationMods, SyndicateXPItemReward };
if (rewardInfo.ConquestCompleted !== undefined) {
let score = 1;
if (rewardInfo.ConquestHardModeActive === 1) score += 3;
if (rewardInfo.ConquestPersonalModifiersActive !== undefined)
score += rewardInfo.ConquestPersonalModifiersActive;
if (rewardInfo.ConquestEquipmentSuggestionsFulfilled !== undefined)
score += rewardInfo.ConquestEquipmentSuggestionsFulfilled;
score *= rewardInfo.ConquestCompleted + 1;
if (rewardInfo.ConquestCompleted == 2 && rewardInfo.ConquestHardModeActive === 1) score += 1;
const conquestType = rewardInfo.ConquestType;
const conquestNode =
conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked";
if (score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined)
inventory.NodeIntrosCompleted.push(conquestNode);
if (conquestType == "HexConquest") {
inventory.EchoesHexConquestCacheScoreMission ??= 0;
if (score > inventory.EchoesHexConquestCacheScoreMission)
inventory.EchoesHexConquestCacheScoreMission = score;
} else {
inventory.EntratiLabConquestCacheScoreMission ??= 0;
if (score > inventory.EntratiLabConquestCacheScoreMission)
inventory.EntratiLabConquestCacheScoreMission = score;
}
ConquestCompletedMissionsCount = rewardInfo.ConquestCompleted == 2 ? 0 : rewardInfo.ConquestCompleted + 1;
}
return {
inventoryChanges,
MissionRewards,
credits,
AffiliationMods,
SyndicateXPItemReward,
ConquestCompletedMissionsCount
};
};
//creditBonus is not entirely accurate.

View File

@ -151,7 +151,12 @@ export interface IRewardInfo {
PurgatoryRewardQualifications?: string;
rewardSeed?: number | bigint;
periodicMissionTag?: string;
ConquestType?: string;
ConquestCompleted?: number;
ConquestEquipmentSuggestionsFulfilled?: number;
ConquestPersonalModifiersActive?: number;
ConquestStickersActive?: number;
ConquestHardModeActive?: number;
// for bounties, only EOM_AFK and node are given from above, plus:
JobTier?: number;
jobId?: string;