forked from OpenWF/SpaceNinjaServer
		
	move this logic before MissionRewards are discharged
This commit is contained in:
		
							parent
							
								
									f609850c0c
								
							
						
					
					
						commit
						ad2e13c1a8
					
				@ -693,6 +693,40 @@ export const addMissionRewards = async (
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (const reward of MissionRewards) {
 | 
			
		||||
        const inventoryChange = await handleStoreItemAcquisition(
 | 
			
		||||
            reward.StoreItem,
 | 
			
		||||
@ -884,40 +918,6 @@ export const addMissionRewards = async (
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user