Add FiR config and wire up + cleanup of openRandomLootContainer()
This commit is contained in:
parent
018cf9e47c
commit
7ad1fc3996
@ -54,6 +54,7 @@
|
||||
"5df24cf80dee1b22f862e9bc": 1
|
||||
},
|
||||
"defaultPresetsOnly": true,
|
||||
"foundInRaid": true,
|
||||
"weaponModRewardLimits": {
|
||||
"5448bc234bdc2d3c308b4569": {
|
||||
"type": "magazine",
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -23,6 +23,7 @@ export interface ISealedAirdropContainerSettings
|
||||
{
|
||||
weaponRewardWeight: Record<string, number>
|
||||
defaultPresetsOnly: boolean
|
||||
foundInRaid: boolean;
|
||||
weaponModRewardLimits: Record<string, MinMax>
|
||||
rewardTypeLimits: Record<string, MinMax>
|
||||
ammoBoxWhitelist: string[]
|
||||
|
Loading…
Reference in New Issue
Block a user