fix: save nightwave challenges & sortie/archon hunt completion #933
@ -83,6 +83,19 @@ export const addMissionInventoryUpdates = (
 | 
				
			|||||||
    if (inventoryUpdates.MissionFailed === true) {
 | 
					    if (inventoryUpdates.MissionFailed === true) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (inventoryUpdates.RewardInfo && inventoryUpdates.RewardInfo.periodicMissionTag) {
 | 
				
			||||||
 | 
					        const tag = inventoryUpdates.RewardInfo.periodicMissionTag;
 | 
				
			||||||
 | 
					        const existingCompletion = inventory.PeriodicMissionCompletions.find(completion => completion.tag === tag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (existingCompletion) {
 | 
				
			||||||
 | 
					            existingCompletion.date = new Date();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            inventory.PeriodicMissionCompletions.push({
 | 
				
			||||||
 | 
					                tag: tag,
 | 
				
			||||||
 | 
					                date: new Date()
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
 | 
					    for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
 | 
				
			||||||
        if (value === undefined) {
 | 
					        if (value === undefined) {
 | 
				
			||||||
            logger.error(`Inventory update key ${key} has no value `);
 | 
					            logger.error(`Inventory update key ${key} has no value `);
 | 
				
			||||||
@ -178,6 +191,22 @@ export const addMissionInventoryUpdates = (
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            case "SyndicateId": {
 | 
				
			||||||
 | 
					                inventory.CompletedSyndicates.push(value);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            case "SortieId": {
 | 
				
			||||||
 | 
					                inventory.CompletedSorties.push(value);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            case "SeasonChallengeCompletions":
 | 
				
			||||||
 | 
					                const processedCompletions = value.map(({ challenge, id }) => ({
 | 
				
			||||||
 | 
					                    challenge: challenge.substring(challenge.lastIndexOf("/") + 1),
 | 
				
			||||||
 | 
					                    id
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                inventory.SeasonChallengeHistory.push(...processedCompletions);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                // Equipment XP updates
 | 
					                // Equipment XP updates
 | 
				
			||||||
                if (equipmentKeys.includes(key as TEquipmentKey)) {
 | 
					                if (equipmentKeys.includes(key as TEquipmentKey)) {
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,9 @@ export type IMissionInventoryUpdateRequest = {
 | 
				
			|||||||
    CrewShipAmmo?: ITypeCount[];
 | 
					    CrewShipAmmo?: ITypeCount[];
 | 
				
			||||||
    BonusMiscItems?: ITypeCount[];
 | 
					    BonusMiscItems?: ITypeCount[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SyndicateId?: string;
 | 
				
			||||||
 | 
					    SortieId?: string;
 | 
				
			||||||
 | 
					    SeasonChallengeCompletions?: ISeasonChallenge[];
 | 
				
			||||||
    AffiliationChanges?: IAffiliationChange[];
 | 
					    AffiliationChanges?: IAffiliationChange[];
 | 
				
			||||||
    crossPlaySetting?: string;
 | 
					    crossPlaySetting?: string;
 | 
				
			||||||
    rewardsMultiplier?: number;
 | 
					    rewardsMultiplier?: number;
 | 
				
			||||||
@ -100,6 +103,7 @@ export interface IRewardInfo {
 | 
				
			|||||||
    rewardQualifications?: string; // did a Survival for 5 minutes and this was "1"
 | 
					    rewardQualifications?: string; // did a Survival for 5 minutes and this was "1"
 | 
				
			||||||
    PurgatoryRewardQualifications?: string;
 | 
					    PurgatoryRewardQualifications?: string;
 | 
				
			||||||
    rewardSeed?: number;
 | 
					    rewardSeed?: number;
 | 
				
			||||||
 | 
					    periodicMissionTag?: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type IMissionStatus = "GS_SUCCESS" | "GS_FAILURE" | "GS_DUMPED" | "GS_QUIT" | "GS_INTERRUPTED";
 | 
					export type IMissionStatus = "GS_SUCCESS" | "GS_FAILURE" | "GS_DUMPED" | "GS_QUIT" | "GS_INTERRUPTED";
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user