From 0e10f0d36331fdb09661307046553412caf8c12a Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Wed, 22 Oct 2025 04:52:15 +0200 Subject: [PATCH] feat: invasion additional credits Re #1097 --- src/services/missionInventoryUpdateService.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 5c875ab1..336efe87 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -1126,7 +1126,8 @@ export const addMissionRewards = async ( RegularCredits: creditDrops, VoidTearParticipantsCurrWave: voidTearWave, StrippedItems: strippedItems, - AffiliationChanges: AffiliationMods + AffiliationChanges: AffiliationMods, + InvasionProgress: invasionProgress }: IMissionInventoryUpdateRequest, firstCompletion: boolean ): Promise => { @@ -1176,6 +1177,19 @@ export const addMissionRewards = async ( //inventory change is what the client has not rewarded itself, also the client needs to know the credit changes for display + if (invasionProgress) { + for (const clientProgress of invasionProgress) { + const dbProgress = inventory.QualifyingInvasions.find(x => x.invasionId.equals(clientProgress._id.$oid)); + if (dbProgress) { + const run = + (clientProgress.AttackerScore > clientProgress.DefenderScore + ? dbProgress.AttackerScore + : dbProgress.DefenderScore) - 1; + missionCompletionCredits += 1000 * Math.min(run, 10); + } + } + } + if (rewardInfo.goalId) { const goal = getWorldState().Goals.find(x => x._id.$oid == rewardInfo.goalId); if (goal) {