Expanded pmcConfig.maxBackpackLootTotalRub to work per PMC level

non-PMC backpack loot is no longer limited to 150,000 roubles
This commit is contained in:
Dev 2024-08-22 20:42:47 +01:00
parent 9df2c90285
commit 24cd94abd3
3 changed files with 48 additions and 3 deletions

View File

@ -718,7 +718,29 @@
"min": 1,
"max": 1
},
"maxBackpackLootTotalRub": 150000,
"maxBackpackLootTotalRub": [
{
"min": 1,
"max": 15,
"value": 100000
},{
"min": 16,
"max": 35,
"value": 250000
},{
"min": 36,
"max": 45,
"value": 450000
},{
"min": 46,
"max": 64,
"value": 750000
},{
"min": 65,
"max": 100,
"value": 2500000
}
],
"maxPocketLootTotalRub": 50000,
"maxVestLootTotalRub": 50000,
"convertIntoPmcChance": {

View File

@ -260,6 +260,7 @@ export class BotLootGenerator {
);
}
const backpackLootRoubleTotal = this.getBackpackRoubleTotalByLevel(botLevel, isPmc);
this.addLootFromPool(
this.botLootCacheService.getLootFromCache(botRole, isPmc, LootCacheType.BACKPACK, botJsonTemplate),
[EquipmentSlots.BACKPACK],
@ -267,7 +268,7 @@ export class BotLootGenerator {
botInventory,
botRole,
botItemLimits,
this.pmcConfig.maxBackpackLootTotalRub,
backpackLootRoubleTotal,
isPmc,
containersIdFull,
);
@ -320,6 +321,24 @@ export class BotLootGenerator {
}
}
/**
* Gets the rouble cost total for loot in a bots backpack by the bots levl
* Will return 0 for non PMCs
* @param botLevel Bots level
* @param isPmc Is the bot a PMC
* @returns number
*/
protected getBackpackRoubleTotalByLevel(botLevel: number, isPmc: boolean): number {
if (isPmc) {
const matchingValue = this.pmcConfig.maxBackpackLootTotalRub.find(
(minMaxValue) => botLevel >= minMaxValue.min && botLevel <= minMaxValue.max,
);
return matchingValue.value;
}
return 0;
}
/**
* Get an array of the containers a bot has on them (pockets/backpack/vest)
* @param botInventory Bot to check

View File

@ -32,7 +32,7 @@ export interface IPmcConfig extends IBaseConfig {
bearType: string;
/** What 'brain' does a PMC use, keyed by map and side (USEC/BEAR) key: map location, value: type for usec/bear */
pmcType: Record<string, Record<string, Record<string, number>>>;
maxBackpackLootTotalRub: number;
maxBackpackLootTotalRub: MinMaxLootValue[];
maxPocketLootTotalRub: number;
maxVestLootTotalRub: number;
/** Percentage chance a bot from a wave is converted into a PMC, key = bot wildspawn tpye (assault/exusec), value: min+max chance to be converted */
@ -60,3 +60,7 @@ export interface SlotLootSettings {
whitelist: string[];
blacklist: string[];
}
export interface MinMaxLootValue extends MinMax {
value: number;
}