diff --git a/project/assets/configs/inventory.json b/project/assets/configs/inventory.json index f71e6beb..e498f7f9 100644 --- a/project/assets/configs/inventory.json +++ b/project/assets/configs/inventory.json @@ -54,6 +54,7 @@ "5df24cf80dee1b22f862e9bc": 1 }, "defaultPresetsOnly": true, + "foundInRaid": true, "weaponModRewardLimits": { "5448bc234bdc2d3c308b4569": { "type": "magazine", diff --git a/project/src/controllers/InventoryController.ts b/project/src/controllers/InventoryController.ts index e34734fe..ecaec5c4 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -41,7 +41,6 @@ import { import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; import { Traders } from "../models/enums/Traders"; -import { RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -772,20 +771,21 @@ export class InventoryController items: [] }; - let rewardContainerDetails: RewardDetails = { - rewardCount: 0, - foundInRaid: true - }; - + let foundInRaid = false; if (isSealedWeaponBox) { - newItemRequest.items.push(...this.lootGenerator.getSealedWeaponCaseLoot()); + const containerSettings = this.inventoryHelper.getInventoryConfig().sealedAirdropContainer; + newItemRequest.items.push(...this.lootGenerator.getSealedWeaponCaseLoot(containerSettings)); + + foundInRaid = containerSettings.foundInRaid; } else { // Get summary of loot from config - rewardContainerDetails = this.inventoryHelper.getRandomLootContainerRewardDetails(openedItem._tpl); + const rewardContainerDetails = this.inventoryHelper.getRandomLootContainerRewardDetails(openedItem._tpl); newItemRequest.items.push(...this.lootGenerator.getRandomLootContainerLoot(rewardContainerDetails)); + + foundInRaid = rewardContainerDetails.foundInRaid; } const output = this.eventOutputHolder.getOutput(sessionID); @@ -793,8 +793,8 @@ export class InventoryController // Find and delete opened item from player inventory this.inventoryHelper.removeItem(pmcData, body.item, sessionID, output); - // Add random reward items to player inventory - this.inventoryHelper.addItem(pmcData, newItemRequest, output, sessionID, null, rewardContainerDetails.foundInRaid); + // Add reward items to player inventory + this.inventoryHelper.addItem(pmcData, newItemRequest, output, sessionID, null, foundInRaid); return output; } diff --git a/project/src/generators/LootGenerator.ts b/project/src/generators/LootGenerator.ts index 50c4aebf..ff53d39c 100644 --- a/project/src/generators/LootGenerator.ts +++ b/project/src/generators/LootGenerator.ts @@ -261,12 +261,12 @@ export class LootGenerator /** * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings * @returns Array of items to add to player inventory */ - public getSealedWeaponCaseLoot(): AddItem[] + public getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[] { const itemsToReturn: AddItem[] = []; - const containerSettings = this.inventoryHelper.getInventoryConfig().sealedAirdropContainer; // choose a weapon to give to the player (weighted) const chosenWeaponTpl = this.weightedRandomHelper.getWeightedInventoryItem(containerSettings.weaponRewardWeight); diff --git a/project/src/models/spt/config/IInventoryConfig.ts b/project/src/models/spt/config/IInventoryConfig.ts index 4be35a48..5573b46c 100644 --- a/project/src/models/spt/config/IInventoryConfig.ts +++ b/project/src/models/spt/config/IInventoryConfig.ts @@ -23,6 +23,7 @@ export interface ISealedAirdropContainerSettings { weaponRewardWeight: Record defaultPresetsOnly: boolean + foundInRaid: boolean; weaponModRewardLimits: Record rewardTypeLimits: Record ammoBoxWhitelist: string[]