mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
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);
|
this.healthHelper.saveVitality(serverPmcProfile, postRaidRequest.health, sessionID);
|
||||||
|
|
||||||
// Remove inventory if player died and send insurance items
|
// Remove inventory if player died and send insurance items
|
||||||
|
let insuredItemsLostCount = 0;
|
||||||
if (mapHasInsuranceEnabled)
|
if (mapHasInsuranceEnabled)
|
||||||
{
|
{
|
||||||
this.insuranceService.storeLostGear(serverPmcProfile, postRaidRequest, preRaidGear, sessionID, isDead);
|
insuredItemsLostCount = this.insuranceService.storeLostGear(
|
||||||
|
serverPmcProfile,
|
||||||
|
postRaidRequest,
|
||||||
|
preRaidGear,
|
||||||
|
sessionID,
|
||||||
|
isDead,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
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
|
// 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 preRaidGear gear player wore prior to raid
|
||||||
* @param sessionID Session id
|
* @param sessionID Session id
|
||||||
* @param playerDied did the player die in raid
|
* @param playerDied did the player die in raid
|
||||||
|
* @returns Count of insured items lost in raid
|
||||||
*/
|
*/
|
||||||
public storeLostGear(
|
public storeLostGear(
|
||||||
pmcData: IPmcData,
|
pmcData: IPmcData,
|
||||||
@ -225,8 +226,9 @@ export class InsuranceService
|
|||||||
preRaidGear: Item[],
|
preRaidGear: Item[],
|
||||||
sessionID: string,
|
sessionID: string,
|
||||||
playerDied: boolean,
|
playerDied: boolean,
|
||||||
): void
|
): number
|
||||||
{
|
{
|
||||||
|
let itemsLostCount = 0;
|
||||||
const preRaidGearHash = this.createItemHashTable(preRaidGear);
|
const preRaidGearHash = this.createItemHashTable(preRaidGear);
|
||||||
const offRaidGearHash = this.createItemHashTable(offraidData.profile.Inventory.items);
|
const offRaidGearHash = this.createItemHashTable(offraidData.profile.Inventory.items);
|
||||||
|
|
||||||
@ -277,7 +279,10 @@ export class InsuranceService
|
|||||||
for (const gear of equipmentToSendToPlayer)
|
for (const gear of equipmentToSendToPlayer)
|
||||||
{
|
{
|
||||||
this.addGearToSend(gear);
|
this.addGearToSend(gear);
|
||||||
|
itemsLostCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return itemsLostCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user