Add FiR config and wire up + cleanup of openRandomLootContainer()
This commit is contained in:
parent
018cf9e47c
commit
7ad1fc3996
@ -54,6 +54,7 @@
|
|||||||
"5df24cf80dee1b22f862e9bc": 1
|
"5df24cf80dee1b22f862e9bc": 1
|
||||||
},
|
},
|
||||||
"defaultPresetsOnly": true,
|
"defaultPresetsOnly": true,
|
||||||
|
"foundInRaid": true,
|
||||||
"weaponModRewardLimits": {
|
"weaponModRewardLimits": {
|
||||||
"5448bc234bdc2d3c308b4569": {
|
"5448bc234bdc2d3c308b4569": {
|
||||||
"type": "magazine",
|
"type": "magazine",
|
||||||
|
@ -41,7 +41,6 @@ import {
|
|||||||
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
|
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
import { BackendErrorCodes } from "../models/enums/BackendErrorCodes";
|
import { BackendErrorCodes } from "../models/enums/BackendErrorCodes";
|
||||||
import { Traders } from "../models/enums/Traders";
|
import { Traders } from "../models/enums/Traders";
|
||||||
import { RewardDetails } from "../models/spt/config/IInventoryConfig";
|
|
||||||
import { ILogger } from "../models/spt/utils/ILogger";
|
import { ILogger } from "../models/spt/utils/ILogger";
|
||||||
import { EventOutputHolder } from "../routers/EventOutputHolder";
|
import { EventOutputHolder } from "../routers/EventOutputHolder";
|
||||||
import { DatabaseServer } from "../servers/DatabaseServer";
|
import { DatabaseServer } from "../servers/DatabaseServer";
|
||||||
@ -772,20 +771,21 @@ export class InventoryController
|
|||||||
items: []
|
items: []
|
||||||
};
|
};
|
||||||
|
|
||||||
let rewardContainerDetails: RewardDetails = {
|
let foundInRaid = false;
|
||||||
rewardCount: 0,
|
|
||||||
foundInRaid: true
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isSealedWeaponBox)
|
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
|
else
|
||||||
{
|
{
|
||||||
// Get summary of loot from config
|
// 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));
|
newItemRequest.items.push(...this.lootGenerator.getRandomLootContainerLoot(rewardContainerDetails));
|
||||||
|
|
||||||
|
foundInRaid = rewardContainerDetails.foundInRaid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const output = this.eventOutputHolder.getOutput(sessionID);
|
const output = this.eventOutputHolder.getOutput(sessionID);
|
||||||
@ -793,8 +793,8 @@ export class InventoryController
|
|||||||
// Find and delete opened item from player inventory
|
// Find and delete opened item from player inventory
|
||||||
this.inventoryHelper.removeItem(pmcData, body.item, sessionID, output);
|
this.inventoryHelper.removeItem(pmcData, body.item, sessionID, output);
|
||||||
|
|
||||||
// Add random reward items to player inventory
|
// Add reward items to player inventory
|
||||||
this.inventoryHelper.addItem(pmcData, newItemRequest, output, sessionID, null, rewardContainerDetails.foundInRaid);
|
this.inventoryHelper.addItem(pmcData, newItemRequest, output, sessionID, null, foundInRaid);
|
||||||
|
|
||||||
return output;
|
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)
|
* 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
|
* @returns Array of items to add to player inventory
|
||||||
*/
|
*/
|
||||||
public getSealedWeaponCaseLoot(): AddItem[]
|
public getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]
|
||||||
{
|
{
|
||||||
const itemsToReturn: AddItem[] = [];
|
const itemsToReturn: AddItem[] = [];
|
||||||
const containerSettings = this.inventoryHelper.getInventoryConfig().sealedAirdropContainer;
|
|
||||||
|
|
||||||
// choose a weapon to give to the player (weighted)
|
// choose a weapon to give to the player (weighted)
|
||||||
const chosenWeaponTpl = this.weightedRandomHelper.getWeightedInventoryItem(containerSettings.weaponRewardWeight);
|
const chosenWeaponTpl = this.weightedRandomHelper.getWeightedInventoryItem(containerSettings.weaponRewardWeight);
|
||||||
|
@ -23,6 +23,7 @@ export interface ISealedAirdropContainerSettings
|
|||||||
{
|
{
|
||||||
weaponRewardWeight: Record<string, number>
|
weaponRewardWeight: Record<string, number>
|
||||||
defaultPresetsOnly: boolean
|
defaultPresetsOnly: boolean
|
||||||
|
foundInRaid: boolean;
|
||||||
weaponModRewardLimits: Record<string, MinMax>
|
weaponModRewardLimits: Record<string, MinMax>
|
||||||
rewardTypeLimits: Record<string, MinMax>
|
rewardTypeLimits: Record<string, MinMax>
|
||||||
ammoBoxWhitelist: string[]
|
ammoBoxWhitelist: string[]
|
||||||
|
Loading…
Reference in New Issue
Block a user