mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Updated itemDelivery method in InraidController to filter out insured items from the items array using the insuranceService. Added logic to exclude insured items from being sent as part of the delivery message to the player. Co-authored-by: mihaicm93 <45673304+mihaicm93@users.noreply.github.com> Reviewed-on: SPT-AKI/Server#190 Co-authored-by: Mihai <mihai@noreply.dev.sp-tarkov.com> Co-committed-by: Mihai <mihai@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
f59041121b
commit
e0e62d8e47
@ -523,12 +523,27 @@ export class InraidController
|
||||
/**
|
||||
* Handle singleplayer/traderServices/itemDelivery
|
||||
*/
|
||||
public itemDelivery(sessionId: string, traderId: string, items: Item[]): void
|
||||
public itemDelivery(sessionId: string, traderId: string, items: Item[]): void
|
||||
{
|
||||
const insuredItems: Item[] = items.filter(item =>
|
||||
this.insuranceService.getInsuranceItems(sessionId, Traders[traderId]).includes(item)
|
||||
);
|
||||
|
||||
// Remove insured items from the insurance list
|
||||
insuredItems.forEach(insuredItem =>
|
||||
{
|
||||
const insuranceList = this.insuranceService.getInsuranceItems(sessionId, Traders[traderId]);
|
||||
const index = insuranceList.indexOf(insuredItem);
|
||||
if (index !== -1)
|
||||
{
|
||||
insuranceList.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
const dialogueTemplates = this.databaseServer.getTables().traders[traderId].dialogue;
|
||||
const messageId = this.randomUtil.getArrayValue(dialogueTemplates.itemsDelivered);
|
||||
const messageStoreTime = this.timeUtil.getHoursAsSeconds(this.traderConfig.fence.btrDeliveryExpireHours);
|
||||
|
||||
|
||||
this.mailSendService.sendLocalisedNpcMessageToPlayer(
|
||||
sessionId,
|
||||
this.traderHelper.getTraderById(traderId),
|
||||
|
Loading…
x
Reference in New Issue
Block a user