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:
parent
095fcf08fd
commit
3846363758
@ -2506,5 +2506,47 @@
|
|||||||
"5696686a4bdc2da3298b456a": 0
|
"5696686a4bdc2da3298b456a": 0
|
||||||
},
|
},
|
||||||
"walletTplPool": ["5783c43d2459774bbe137486", "60b0f6c058e0b0481a09ad11"]
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,13 +165,6 @@
|
|||||||
"6540d2162ae6d96b540afcaf"
|
"6540d2162ae6d96b540afcaf"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dynamicLoot": {
|
|
||||||
"moneyStackLimits": {
|
|
||||||
"5449016a4bdc2d6f028b456f": 12000,
|
|
||||||
"5696686a4bdc2da3298b456a": 120,
|
|
||||||
"569668774bdc2da2298b4568": 120
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"useDifficultyOverride": false,
|
"useDifficultyOverride": false,
|
||||||
"difficulty": "AsOnline",
|
"difficulty": "AsOnline",
|
||||||
"botRelativeLevelDeltaMax": 10,
|
"botRelativeLevelDeltaMax": 10,
|
||||||
|
@ -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)
|
// Attempt to add item to container(s)
|
||||||
const itemAddedResult = this.botGeneratorHelper.addItemWithChildrenToEquipmentSlot(
|
const itemAddedResult = this.botGeneratorHelper.addItemWithChildrenToEquipmentSlot(
|
||||||
@ -525,11 +525,13 @@ export class BotLootGenerator
|
|||||||
* @param itemToAddTemplate Db template of item to check
|
* @param itemToAddTemplate Db template of item to check
|
||||||
* @param itemToAddChildrenTo Item to add children to
|
* @param itemToAddChildrenTo Item to add children to
|
||||||
* @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes)
|
* @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(
|
protected addRequiredChildItemsToParent(
|
||||||
itemToAddTemplate: ITemplateItem,
|
itemToAddTemplate: ITemplateItem,
|
||||||
itemToAddChildrenTo: Item[],
|
itemToAddChildrenTo: Item[],
|
||||||
isPmc: boolean,
|
isPmc: boolean,
|
||||||
|
botRole: string,
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
// Fill ammo box
|
// Fill ammo box
|
||||||
@ -540,7 +542,7 @@ export class BotLootGenerator
|
|||||||
// Make money a stack
|
// Make money a stack
|
||||||
else if (this.itemHelper.isOfBaseclass(itemToAddTemplate._id, BaseClasses.MONEY))
|
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
|
// Make ammo a stack
|
||||||
else if (this.itemHelper.isOfBaseclass(itemToAddTemplate._id, BaseClasses.AMMO))
|
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
|
* 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 itemTemplate item details from db
|
||||||
* @param moneyItem Money item to randomise
|
* @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
|
// Get all currency weights for this bot type
|
||||||
const minStackSize = itemTemplate._props.StackMinRandom;
|
let currencyWeights = this.botConfig.currencyStackSize[botRole];
|
||||||
const maxStackSize = isPmc
|
if (!currencyWeights)
|
||||||
? this.pmcConfig.dynamicLoot.moneyStackLimits[itemTemplate._id]
|
{
|
||||||
: itemTemplate._props.StackMaxRandom;
|
currencyWeights = this.botConfig.currencyStackSize.default;
|
||||||
const randomSize = this.randomUtil.getInt(minStackSize, maxStackSize);
|
}
|
||||||
|
|
||||||
|
const currencyWeight = currencyWeights[moneyItem._tpl];
|
||||||
|
|
||||||
if (!moneyItem.upd)
|
if (!moneyItem.upd)
|
||||||
{
|
{
|
||||||
moneyItem.upd = {};
|
moneyItem.upd = {};
|
||||||
}
|
}
|
||||||
|
moneyItem.upd.StackObjectsCount = Number.parseInt(this.weightedRandomHelper.getWeightedValue(currencyWeight));
|
||||||
moneyItem.upd.StackObjectsCount = randomSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +39,8 @@ export interface IBotConfig extends IBaseConfig
|
|||||||
botRolesWithDogTags: string[];
|
botRolesWithDogTags: string[];
|
||||||
/** Settings to control the items that get added into wallets on bots */
|
/** Settings to control the items that get added into wallets on bots */
|
||||||
walletLoot: IWalletLootSettings;
|
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 */
|
/** Number of bots to generate and store in cache on raid start per bot type */
|
||||||
|
@ -15,7 +15,6 @@ export interface IPmcConfig extends IBaseConfig
|
|||||||
pocketLoot: SlotLootSettings;
|
pocketLoot: SlotLootSettings;
|
||||||
/** Global whitelist/blacklist of backpack loot for PMCs */
|
/** Global whitelist/blacklist of backpack loot for PMCs */
|
||||||
backpackLoot: SlotLootSettings;
|
backpackLoot: SlotLootSettings;
|
||||||
dynamicLoot: DynamicLoot;
|
|
||||||
/** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */
|
/** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */
|
||||||
useDifficultyOverride: boolean;
|
useDifficultyOverride: boolean;
|
||||||
/** Difficulty override e.g. "AsOnline/Hard" */
|
/** Difficulty override e.g. "AsOnline/Hard" */
|
||||||
@ -63,8 +62,3 @@ export interface SlotLootSettings
|
|||||||
blacklist: string[];
|
blacklist: string[];
|
||||||
moneyStackLimits: Record<string, number>;
|
moneyStackLimits: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DynamicLoot
|
|
||||||
{
|
|
||||||
moneyStackLimits: Record<string, number>;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user