Add per bottype loot N values

Made bosses share same value as PMCs
This commit is contained in:
Dev 2023-07-05 18:44:35 +01:00
parent 5c428f527e
commit bf4e42b211
2 changed files with 70 additions and 3 deletions

View File

@ -209,7 +209,42 @@
}, },
"lootNValue": { "lootNValue": {
"scav": 4, "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, "chanceAssaultScavHasPlayerScavName": 10,
"secureContainerAmmoStackCount": 15, "secureContainerAmmoStackCount": 15,

View File

@ -59,7 +59,7 @@ export class BotLootGenerator
// Limits on item types to be added as loot // Limits on item types to be added as loot
const itemCounts = botJsonTemplate.generation.items; const itemCounts = botJsonTemplate.generation.items;
const nValue = this.getBotLootNValue(isPmc); const nValue = this.getBotLootNValueByRole(botRole);
const looseLootMin = itemCounts.looseLoot.min; const looseLootMin = itemCounts.looseLoot.min;
const looseLootMax = itemCounts.looseLoot.max; const looseLootMax = itemCounts.looseLoot.max;
@ -199,7 +199,7 @@ export class BotLootGenerator
const itemSpawnLimits: Record<string,Record<string, number>> = {}; const itemSpawnLimits: Record<string,Record<string, number>> = {};
for (let i = 0; i < totalItemCount; i++) 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 id = this.hashUtil.generate();
const itemsToAdd: Item[] = [{ const itemsToAdd: Item[] = [{
_id: id, _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 * Get a random item from the pool parameter using the biasedRandomNumber system
* @param pool pool of items to pick an item from * @param pool pool of items to pick an item from
* @param isPmc is the bot being created a pmc * @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 * Get the loot nvalue from botconfig
* @param isPmc if true the pmc nvalue is returned * @param isPmc if true the pmc nvalue is returned
* @returns nvalue as number * @returns nvalue as number
@ -308,6 +322,24 @@ export class BotLootGenerator
return this.botConfig.lootNValue["scav"]; 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 * Update item limit array to contain items that have a limit
* All values are set to 0 * All values are set to 0