Improve lost insurance message system, only send lost insurance when an insured item was lost
This commit is contained in:
parent
8b90373965
commit
afce41d68b
@ -154,13 +154,23 @@ export class InraidController
|
||||
this.healthHelper.saveVitality(serverPmcProfile, postRaidRequest.health, sessionID);
|
||||
|
||||
// Remove inventory if player died and send insurance items
|
||||
let insuredItemsLostCount = 0;
|
||||
if (mapHasInsuranceEnabled)
|
||||
{
|
||||
this.insuranceService.storeLostGear(serverPmcProfile, postRaidRequest, preRaidGear, sessionID, isDead);
|
||||
insuredItemsLostCount = this.insuranceService.storeLostGear(
|
||||
serverPmcProfile,
|
||||
postRaidRequest,
|
||||
preRaidGear,
|
||||
sessionID,
|
||||
isDead,
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.insuranceService.sendLostInsuranceMessage(sessionID, locationName);
|
||||
if (insuredItemsLostCount > 0)
|
||||
{
|
||||
this.insuranceService.sendLostInsuranceMessage(sessionID, locationName);
|
||||
}
|
||||
}
|
||||
|
||||
// Edge case - Handle usec players leaving lighthouse with Rogues angry at them
|
||||
|
@ -218,6 +218,7 @@ export class InsuranceService
|
||||
* @param preRaidGear gear player wore prior to raid
|
||||
* @param sessionID Session id
|
||||
* @param playerDied did the player die in raid
|
||||
* @returns Count of insured items lost in raid
|
||||
*/
|
||||
public storeLostGear(
|
||||
pmcData: IPmcData,
|
||||
@ -225,8 +226,9 @@ export class InsuranceService
|
||||
preRaidGear: Item[],
|
||||
sessionID: string,
|
||||
playerDied: boolean,
|
||||
): void
|
||||
): number
|
||||
{
|
||||
let itemsLostCount = 0;
|
||||
const preRaidGearHash = this.createItemHashTable(preRaidGear);
|
||||
const offRaidGearHash = this.createItemHashTable(offraidData.profile.Inventory.items);
|
||||
|
||||
@ -277,7 +279,10 @@ export class InsuranceService
|
||||
for (const gear of equipmentToSendToPlayer)
|
||||
{
|
||||
this.addGearToSend(gear);
|
||||
itemsLostCount++;
|
||||
}
|
||||
|
||||
return itemsLostCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user