forked from OpenWF/SpaceNinjaServer
		
	fix(webui): handle existing entries for unlock all missions (#2290)
Closes #2283 Reviewed-on: OpenWF/SpaceNinjaServer#2290 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									86f86d0476
								
							
						
					
					
						commit
						b42182c85f
					
				@ -12,18 +12,24 @@ export const completeAllMissionsController: RequestHandler = async (req, res) =>
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
    const MissionRewards: IMissionReward[] = [];
 | 
			
		||||
    for (const [tag, node] of Object.entries(ExportRegions)) {
 | 
			
		||||
        if (!inventory.Missions.find(x => x.Tag == tag)) {
 | 
			
		||||
            inventory.Missions.push({
 | 
			
		||||
                Completes: 1,
 | 
			
		||||
                Tier: 1,
 | 
			
		||||
                Tag: tag
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        let mission = inventory.Missions.find(x => x.Tag == tag);
 | 
			
		||||
        if (!mission) {
 | 
			
		||||
            mission =
 | 
			
		||||
                inventory.Missions[
 | 
			
		||||
                    inventory.Missions.push({
 | 
			
		||||
                        Completes: 0,
 | 
			
		||||
                        Tier: 0,
 | 
			
		||||
                        Tag: tag
 | 
			
		||||
                    }) - 1
 | 
			
		||||
                ];
 | 
			
		||||
        }
 | 
			
		||||
        if (mission.Completes == 0) {
 | 
			
		||||
            mission.Completes++;
 | 
			
		||||
            if (node.missionReward) {
 | 
			
		||||
                console.log(node.missionReward);
 | 
			
		||||
                addFixedLevelRewards(node.missionReward, inventory, MissionRewards);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        mission.Tier = 1;
 | 
			
		||||
    }
 | 
			
		||||
    for (const reward of MissionRewards) {
 | 
			
		||||
        await handleStoreItemAcquisition(reward.StoreItem, inventory, reward.ItemCount, undefined, true);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user