diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index 1c4d8f99..068ea094 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -209,7 +209,42 @@ }, "lootNValue": { "scav": 4, - "pmc": 3 + "pmc": 3, + "assault": 4, + "marksman": 4, + "arenafighterevent": 4, + "bossbully": 4, + "bear": 3, + "usec": 3, + "bossbully": 3, + "bossgluhar": 3, + "bosskilla": 3, + "bossknight": 3, + "bosskojaniy": 3, + "bosssanitar": 3, + "bosstagilla": 3, + "bosstest": 4, + "bosszryachiy": 3, + "cursedassault": 4, + "exusec": 4, + "followerbigpipe": 4, + "followerbirdeye": 4, + "followerbully": 4, + "followergluharassault": 4, + "followergluharscout": 4, + "followergluharsecurity": 4, + "followergluharsnipe": 4, + "followerkojaniy": 4, + "followersanitar": 4, + "followertagilla": 4, + "followertest": 4, + "followerzryachiy": 4, + "gifter": 4, + "marksman": 4, + "pmcbot": 4, + "sectantpriest": 4, + "sectantwarrior": 4, + "test": 4 }, "chanceAssaultScavHasPlayerScavName": 10, "secureContainerAmmoStackCount": 15, diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index 56024079..329ddcde 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -59,7 +59,7 @@ export class BotLootGenerator // Limits on item types to be added as loot const itemCounts = botJsonTemplate.generation.items; - const nValue = this.getBotLootNValue(isPmc); + const nValue = this.getBotLootNValueByRole(botRole); const looseLootMin = itemCounts.looseLoot.min; const looseLootMax = itemCounts.looseLoot.max; @@ -199,7 +199,7 @@ export class BotLootGenerator const itemSpawnLimits: Record> = {}; for (let i = 0; i < totalItemCount; i++) { - const itemToAddTemplate = this.getRandomItemFromPool(pool, isPmc); + const itemToAddTemplate = this.getRandomItemFromPoolByRole(pool, botRole); const id = this.hashUtil.generate(); const itemsToAdd: Item[] = [{ _id: id, @@ -282,6 +282,7 @@ export class BotLootGenerator } /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -294,6 +295,19 @@ export class BotLootGenerator } /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem + { + const itemIndex = this.randomUtil.getBiasedRandomNumber(0, pool.length - 1, pool.length - 1, this.getBotLootNValueByRole(botRole)); + return pool[itemIndex]; + } + + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number @@ -308,6 +322,24 @@ export class BotLootGenerator return this.botConfig.lootNValue["scav"]; } + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number + { + const result = this.botConfig.lootNValue[botRole]; + if (!result) + { + this.logger.warning(`Bot ${botRole} loot n value missing, using scav value instead`); + + return this.botConfig.lootNValue["scav"]; + } + + return result; + } + /** * Update item limit array to contain items that have a limit * All values are set to 0