Added helper function handleInsuredItemLostEvent()

This commit is contained in:
Dev 2024-08-23 10:35:41 +01:00
parent 3d1aa5e4fc
commit 8fc2428239

View File

@ -482,17 +482,7 @@ export class LocationLifecycleService {
// Handle items transferred via BTR to player
this.handleBTRItemTransferEvent(sessionId, request);
if (request.lostInsuredItems?.length > 0) {
const mappedItems = this.insuranceService.mapInsuredItemsToTrader(
sessionId,
request.lostInsuredItems,
request.results.profile,
);
this.insuranceService.storeGearLostInRaidToSendLater(sessionId, mappedItems);
this.insuranceService.sendInsuredItems(pmcProfile, sessionId, locationName);
}
this.handleInsuredItemLostEvent(sessionId, pmcProfile, request, locationName);
}
/**
@ -565,6 +555,25 @@ export class LocationLifecycleService {
);
}
protected handleInsuredItemLostEvent(
sessionId: string,
preRaidPmcProfile: IPmcData,
request: IEndLocalRaidRequestData,
locationName: string,
) {
if (request.lostInsuredItems?.length > 0) {
const mappedItems = this.insuranceService.mapInsuredItemsToTrader(
sessionId,
request.lostInsuredItems,
request.results.profile,
);
this.insuranceService.storeGearLostInRaidToSendLater(sessionId, mappedItems);
this.insuranceService.sendInsuredItems(preRaidPmcProfile, sessionId, locationName);
}
}
/**
* Return the equipped items from a players inventory
* @param items Players inventory to search through