forked from OpenWF/SpaceNinjaServer
		
	feat: invasion additional credits (#2925)
Re #1097 Reviewed-on: OpenWF/SpaceNinjaServer#2925 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>
This commit is contained in:
		
							parent
							
								
									98a46e51de
								
							
						
					
					
						commit
						18fafc38b5
					
				@ -1126,7 +1126,8 @@ export const addMissionRewards = async (
 | 
				
			|||||||
        RegularCredits: creditDrops,
 | 
					        RegularCredits: creditDrops,
 | 
				
			||||||
        VoidTearParticipantsCurrWave: voidTearWave,
 | 
					        VoidTearParticipantsCurrWave: voidTearWave,
 | 
				
			||||||
        StrippedItems: strippedItems,
 | 
					        StrippedItems: strippedItems,
 | 
				
			||||||
        AffiliationChanges: AffiliationMods
 | 
					        AffiliationChanges: AffiliationMods,
 | 
				
			||||||
 | 
					        InvasionProgress: invasionProgress
 | 
				
			||||||
    }: IMissionInventoryUpdateRequest,
 | 
					    }: IMissionInventoryUpdateRequest,
 | 
				
			||||||
    firstCompletion: boolean
 | 
					    firstCompletion: boolean
 | 
				
			||||||
): Promise<AddMissionRewardsReturnType> => {
 | 
					): Promise<AddMissionRewardsReturnType> => {
 | 
				
			||||||
@ -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
 | 
					    //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) {
 | 
					    if (rewardInfo.goalId) {
 | 
				
			||||||
        const goal = getWorldState().Goals.find(x => x._id.$oid == rewardInfo.goalId);
 | 
					        const goal = getWorldState().Goals.find(x => x._id.$oid == rewardInfo.goalId);
 | 
				
			||||||
        if (goal) {
 | 
					        if (goal) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user