fix: handle CurrentLoadOutIds missing LoadOuts in missionInventoryUpdate #1421
@ -414,6 +414,7 @@ export const addMissionInventoryUpdates = async (
 | 
				
			|||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case "CurrentLoadOutIds": {
 | 
					            case "CurrentLoadOutIds": {
 | 
				
			||||||
 | 
					                if (value.LoadOuts) {
 | 
				
			||||||
                    const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId });
 | 
					                    const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId });
 | 
				
			||||||
                    if (loadout) {
 | 
					                    if (loadout) {
 | 
				
			||||||
                        for (const [loadoutId, loadoutConfig] of Object.entries(value.LoadOuts.NORMAL)) {
 | 
					                        for (const [loadoutId, loadoutConfig] of Object.entries(value.LoadOuts.NORMAL)) {
 | 
				
			||||||
@ -426,6 +427,7 @@ export const addMissionInventoryUpdates = async (
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        await loadout.save();
 | 
					                        await loadout.save();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
 | 
				
			|||||||
@ -114,7 +114,7 @@ export type IMissionInventoryUpdateRequest = {
 | 
				
			|||||||
    UnlockWeapons?: boolean; // sent when recovered weapons from zanuka capture
 | 
					    UnlockWeapons?: boolean; // sent when recovered weapons from zanuka capture
 | 
				
			||||||
    IncHarvester?: boolean; // sent when recovered weapons from zanuka capture
 | 
					    IncHarvester?: boolean; // sent when recovered weapons from zanuka capture
 | 
				
			||||||
    CurrentLoadOutIds?: {
 | 
					    CurrentLoadOutIds?: {
 | 
				
			||||||
        LoadOuts: ILoadOutPresets; // sent when recovered weapons from zanuka capture
 | 
					        LoadOuts?: ILoadOutPresets; // sent when recovered weapons from zanuka capture
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
} & {
 | 
					} & {
 | 
				
			||||||
    [K in TEquipmentKey]?: IEquipmentClient[];
 | 
					    [K in TEquipmentKey]?: IEquipmentClient[];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user