Added system to weight stack size of money in bot inventories

Removed `dynamicLoot` system from pmc config as its been replaced with this one

#546
This commit is contained in:
Dev 2024-03-05 12:24:09 +00:00
parent 095fcf08fd
commit 3846363758
5 changed files with 59 additions and 25 deletions

View File

@ -2506,5 +2506,47 @@
"5696686a4bdc2da3298b456a": 0
},
"walletTplPool": ["5783c43d2459774bbe137486", "60b0f6c058e0b0481a09ad11"]
},
"currencyStackSize": {
"default": {
"5449016a4bdc2d6f028b456f": {
"25000": 2,
"20000": 4,
"15000": 8,
"10000": 14,
"5000": 20
},
"5696686a4bdc2da3298b456a": {
"50": 10,
"100": 5,
"250": 1
},
"569668774bdc2da2298b4568": {
"50": 10,
"100": 5,
"250": 1
}
},
"assault": {
"5449016a4bdc2d6f028b456f": {
"30000": 2,
"25000": 4,
"20000": 8,
"15000": 16,
"10000": 28,
"5000": 40,
"350000": 1
},
"5696686a4bdc2da3298b456a": {
"50": 10,
"100": 5,
"250": 1
},
"569668774bdc2da2298b4568": {
"50": 10,
"100": 5,
"250": 1
}
}
}
}

View File

@ -165,13 +165,6 @@
"6540d2162ae6d96b540afcaf"
]
},
"dynamicLoot": {
"moneyStackLimits": {
"5449016a4bdc2d6f028b456f": 12000,
"5696686a4bdc2da3298b456a": 120,
"569668774bdc2da2298b4568": 120
}
},
"useDifficultyOverride": false,
"difficulty": "AsOnline",
"botRelativeLevelDeltaMax": 10,

View File

@ -437,7 +437,7 @@ export class BotLootGenerator
}
}
this.addRequiredChildItemsToParent(itemToAddTemplate, itemWithChildrenToAdd, isPmc);
this.addRequiredChildItemsToParent(itemToAddTemplate, itemWithChildrenToAdd, isPmc, botRole);
// Attempt to add item to container(s)
const itemAddedResult = this.botGeneratorHelper.addItemWithChildrenToEquipmentSlot(
@ -525,11 +525,13 @@ export class BotLootGenerator
* @param itemToAddTemplate Db template of item to check
* @param itemToAddChildrenTo Item to add children to
* @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes)
* @param botRole role bot has that owns item
*/
protected addRequiredChildItemsToParent(
itemToAddTemplate: ITemplateItem,
itemToAddChildrenTo: Item[],
isPmc: boolean,
botRole: string,
): void
{
// Fill ammo box
@ -540,7 +542,7 @@ export class BotLootGenerator
// Make money a stack
else if (this.itemHelper.isOfBaseclass(itemToAddTemplate._id, BaseClasses.MONEY))
{
this.randomiseMoneyStackSize(isPmc, itemToAddTemplate, itemToAddChildrenTo[0]);
this.randomiseMoneyStackSize(botRole, itemToAddTemplate, itemToAddChildrenTo[0]);
}
// Make ammo a stack
else if (this.itemHelper.isOfBaseclass(itemToAddTemplate._id, BaseClasses.AMMO))
@ -695,25 +697,26 @@ export class BotLootGenerator
/**
* Randomise the stack size of a money object, uses different values for pmc or scavs
* @param isPmc Is money on a PMC bot
* @param botRole Role bot has that has money stack
* @param itemTemplate item details from db
* @param moneyItem Money item to randomise
*/
protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void
protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void
{
// PMCs have a different stack max size
const minStackSize = itemTemplate._props.StackMinRandom;
const maxStackSize = isPmc
? this.pmcConfig.dynamicLoot.moneyStackLimits[itemTemplate._id]
: itemTemplate._props.StackMaxRandom;
const randomSize = this.randomUtil.getInt(minStackSize, maxStackSize);
// Get all currency weights for this bot type
let currencyWeights = this.botConfig.currencyStackSize[botRole];
if (!currencyWeights)
{
currencyWeights = this.botConfig.currencyStackSize.default;
}
const currencyWeight = currencyWeights[moneyItem._tpl];
if (!moneyItem.upd)
{
moneyItem.upd = {};
}
moneyItem.upd.StackObjectsCount = randomSize;
moneyItem.upd.StackObjectsCount = Number.parseInt(this.weightedRandomHelper.getWeightedValue(currencyWeight));
}
/**

View File

@ -39,6 +39,8 @@ export interface IBotConfig extends IBaseConfig
botRolesWithDogTags: string[];
/** Settings to control the items that get added into wallets on bots */
walletLoot: IWalletLootSettings;
/** Currency weights, Keyed by botrole / currency */
currencyStackSize: Record<string, Record<string, Record<string, number>>>;
}
/** Number of bots to generate and store in cache on raid start per bot type */

View File

@ -15,7 +15,6 @@ export interface IPmcConfig extends IBaseConfig
pocketLoot: SlotLootSettings;
/** Global whitelist/blacklist of backpack loot for PMCs */
backpackLoot: SlotLootSettings;
dynamicLoot: DynamicLoot;
/** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */
useDifficultyOverride: boolean;
/** Difficulty override e.g. "AsOnline/Hard" */
@ -63,8 +62,3 @@ export interface SlotLootSettings
blacklist: string[];
moneyStackLimits: Record<string, number>;
}
export interface DynamicLoot
{
moneyStackLimits: Record<string, number>;
}