mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
FIx
Fixed `openRandomLootContainer()` failing when no config values are found for desired random container
This commit is contained in:
parent
e9d8c02ac2
commit
a53eea239c
@ -891,6 +891,12 @@ export class InventoryController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const rewardContainerDetails = this.inventoryHelper.getRandomLootContainerRewardDetails(openedItem._tpl);
|
const rewardContainerDetails = this.inventoryHelper.getRandomLootContainerRewardDetails(openedItem._tpl);
|
||||||
|
if (!rewardContainerDetails || !rewardContainerDetails.rewardCount)
|
||||||
|
{
|
||||||
|
this.logger.error(`Unable to add loot to container: ${openedItem._tpl}, no rewards found`);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
rewards.push(...this.lootGenerator.getRandomLootContainerLoot(rewardContainerDetails));
|
rewards.push(...this.lootGenerator.getRandomLootContainerLoot(rewardContainerDetails));
|
||||||
|
|
||||||
if (rewardContainerDetails.foundInRaid)
|
if (rewardContainerDetails.foundInRaid)
|
||||||
@ -898,7 +904,10 @@ export class InventoryController
|
|||||||
foundInRaid = rewardContainerDetails.foundInRaid;
|
foundInRaid = rewardContainerDetails.foundInRaid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rewards.length > 0)
|
||||||
|
{
|
||||||
const addItemsRequest: IAddItemsDirectRequest = {
|
const addItemsRequest: IAddItemsDirectRequest = {
|
||||||
itemsWithModsToAdd: rewards,
|
itemsWithModsToAdd: rewards,
|
||||||
foundInRaid: foundInRaid,
|
foundInRaid: foundInRaid,
|
||||||
@ -910,6 +919,7 @@ export class InventoryController
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find and delete opened container item from player inventory
|
// Find and delete opened container item from player inventory
|
||||||
this.inventoryHelper.removeItem(pmcData, body.item, sessionID, output);
|
this.inventoryHelper.removeItem(pmcData, body.item, sessionID, output);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user