From 24cd94abd346127ec3b24b1a47122c3cfd738de5 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 22 Aug 2024 20:42:47 +0100 Subject: [PATCH] Expanded `pmcConfig.maxBackpackLootTotalRub` to work per PMC level non-PMC backpack loot is no longer limited to 150,000 roubles --- project/assets/configs/pmc.json | 24 ++++++++++++++++++++- project/src/generators/BotLootGenerator.ts | 21 +++++++++++++++++- project/src/models/spt/config/IPmcConfig.ts | 6 +++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/project/assets/configs/pmc.json b/project/assets/configs/pmc.json index 3ace0c24..343a5140 100644 --- a/project/assets/configs/pmc.json +++ b/project/assets/configs/pmc.json @@ -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": { diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index 0ad35696..f71eaa82 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -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 diff --git a/project/src/models/spt/config/IPmcConfig.ts b/project/src/models/spt/config/IPmcConfig.ts index d883314e..15db98a7 100644 --- a/project/src/models/spt/config/IPmcConfig.ts +++ b/project/src/models/spt/config/IPmcConfig.ts @@ -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>>; - 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; +}