Reworked bot generation to pass game version into generateEquipment()
`generateAndAddEquipmentToBot()` now handles pockets separately, flags UhD pockets as not to gen mods as for some reason it has slots 😕
Use this data to adjust the pocket tpl chosen for `unheard_edition`
Add pocket loot weightings of 5 + 6 items for unheard_edition PMCs
This commit is contained in:
parent
928f9068a3
commit
df69b229b3
@ -191,7 +191,7 @@ export class BotGenerator
|
||||
|
||||
this.removeBlacklistedLootFromBotTemplate(botJsonTemplate.inventory);
|
||||
|
||||
// Remove hideout data if bot is not a PMC or pscav
|
||||
// Remove hideout data if bot is not a PMC or pscav - match what live sends
|
||||
if (!(botGenerationDetails.isPmc || botGenerationDetails.isPlayerScav))
|
||||
{
|
||||
bot.Hideout = undefined;
|
||||
@ -208,6 +208,17 @@ export class BotGenerator
|
||||
bot.Health = this.generateHealth(botJsonTemplate.health, bot.Info.Side === "Savage");
|
||||
bot.Skills = this.generateSkills(<any>botJsonTemplate.skills); // TODO: fix bad type, bot jsons store skills in dict, output needs to be array
|
||||
|
||||
let chosenGameVersion = bot.Info.GameVersion;
|
||||
if (botGenerationDetails.isPmc)
|
||||
{
|
||||
bot.Info.IsStreamerModeAvailable = true; // Set to true so client patches can pick it up later - client sometimes alters botrole to assaultGroup
|
||||
chosenGameVersion = this.setRandomisedGameVersionAndCategory(bot.Info);
|
||||
if (chosenGameVersion === "unheard_edition")
|
||||
{
|
||||
this.addAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
this.setBotAppearance(bot, botJsonTemplate.appearance, botGenerationDetails);
|
||||
|
||||
bot.Inventory = this.botInventoryGenerator.generateInventory(
|
||||
@ -216,15 +227,9 @@ export class BotGenerator
|
||||
botRole,
|
||||
botGenerationDetails.isPmc,
|
||||
botLevel.level,
|
||||
chosenGameVersion,
|
||||
);
|
||||
|
||||
if (this.botHelper.isBotPmc(botRole))
|
||||
{
|
||||
this.setRandomisedGameVersionAndCategory(bot.Info);
|
||||
bot.Info.IsStreamerModeAvailable = true; // Set to true so client patches can pick it up later - client sometimes alters botrole to assaultGroup
|
||||
this.setPmcPocketsByGameVersion(bot);
|
||||
}
|
||||
|
||||
if (this.botConfig.botRolesWithDogTags.includes(botRole))
|
||||
{
|
||||
this.addDogtagToBot(bot);
|
||||
@ -245,6 +250,14 @@ export class BotGenerator
|
||||
return bot;
|
||||
}
|
||||
|
||||
protected addAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate: IBotType): void
|
||||
{
|
||||
// Adjust pocket loot weights to allow for 5 or 6 items
|
||||
const pocketWeights = botJsonTemplate.generation.items.pocketLoot.weights;
|
||||
pocketWeights["5"] = 1;
|
||||
pocketWeights["6"] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove items from item.json/lootableItemBlacklist from bots inventory
|
||||
* @param botInventory Bot to filter
|
||||
@ -566,22 +579,25 @@ export class BotGenerator
|
||||
* Chooses from all the game versions (standard, eod etc)
|
||||
* Chooses account type (default, Sherpa, etc)
|
||||
* @param botInfo bot info object to update
|
||||
* @returns Chosen game version
|
||||
*/
|
||||
protected setRandomisedGameVersionAndCategory(botInfo: Info): void
|
||||
protected setRandomisedGameVersionAndCategory(botInfo: Info): string
|
||||
{
|
||||
if (botInfo.Nickname.toLowerCase() === "nikita")
|
||||
{
|
||||
botInfo.GameVersion = "edge_of_darkness";
|
||||
botInfo.MemberCategory = MemberCategory.DEVELOPER;
|
||||
|
||||
return;
|
||||
return botInfo.GameVersion;
|
||||
}
|
||||
|
||||
// more color = more op
|
||||
// More color = more op
|
||||
botInfo.GameVersion = this.weightedRandomHelper.getWeightedValue(this.pmcConfig.gameVersionWeight);
|
||||
botInfo.MemberCategory = Number.parseInt(
|
||||
this.weightedRandomHelper.getWeightedValue(this.pmcConfig.accountTypeWeight),
|
||||
);
|
||||
|
||||
return botInfo.GameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,6 +58,7 @@ export class BotInventoryGenerator
|
||||
* @param botRole Role bot has (assault/pmcBot)
|
||||
* @param isPmc Is bot being converted into a pmc
|
||||
* @param botLevel Level of bot being generated
|
||||
* @param chosenGameVersion Game version for bot, only really applies for PMCs
|
||||
* @returns PmcInventory object with equipment/weapons/loot
|
||||
*/
|
||||
public generateInventory(
|
||||
@ -66,6 +67,7 @@ export class BotInventoryGenerator
|
||||
botRole: string,
|
||||
isPmc: boolean,
|
||||
botLevel: number,
|
||||
chosenGameVersion: string,
|
||||
): PmcInventory
|
||||
{
|
||||
const templateInventory = botJsonTemplate.inventory;
|
||||
@ -75,7 +77,13 @@ export class BotInventoryGenerator
|
||||
// Generate base inventory with no items
|
||||
const botInventory = this.generateInventoryBase();
|
||||
|
||||
this.generateAndAddEquipmentToBot(templateInventory, wornItemChances, botRole, botInventory, botLevel);
|
||||
this.generateAndAddEquipmentToBot(
|
||||
templateInventory,
|
||||
wornItemChances,
|
||||
botRole,
|
||||
botInventory,
|
||||
botLevel,
|
||||
chosenGameVersion);
|
||||
|
||||
// Roll weapon spawns (primary/secondary/holster) and generate a weapon for each roll that passed
|
||||
this.generateAndAddWeaponsToBot(
|
||||
@ -133,6 +141,7 @@ export class BotInventoryGenerator
|
||||
* @param botRole Role bot has (assault/pmcBot)
|
||||
* @param botInventory Inventory to add equipment to
|
||||
* @param botLevel Level of bot
|
||||
* @param chosenGameVersion Game version for bot, only really applies for PMCs
|
||||
*/
|
||||
protected generateAndAddEquipmentToBot(
|
||||
templateInventory: Inventory,
|
||||
@ -140,10 +149,12 @@ export class BotInventoryGenerator
|
||||
botRole: string,
|
||||
botInventory: PmcInventory,
|
||||
botLevel: number,
|
||||
chosenGameVersion: string,
|
||||
): void
|
||||
{
|
||||
// These will be handled later
|
||||
const excludedSlots: string[] = [
|
||||
EquipmentSlots.POCKETS,
|
||||
EquipmentSlots.FIRST_PRIMARY_WEAPON,
|
||||
EquipmentSlots.SECOND_PRIMARY_WEAPON,
|
||||
EquipmentSlots.HOLSTER,
|
||||
@ -178,6 +189,18 @@ export class BotInventoryGenerator
|
||||
}
|
||||
|
||||
// Generate below in specific order
|
||||
this.generateEquipment({
|
||||
rootEquipmentSlot: EquipmentSlots.POCKETS,
|
||||
rootEquipmentPool: chosenGameVersion === "unheard_edition" ? { [ItemTpl.POCKETS_1X4_TUE]: 1 } : templateInventory.equipment.Pockets,
|
||||
modPool: templateInventory.mods,
|
||||
spawnChances: wornItemChances,
|
||||
botRole: botRole,
|
||||
botLevel: botLevel,
|
||||
inventory: botInventory,
|
||||
botEquipmentConfig: botEquipConfig,
|
||||
randomisationDetails: randomistionDetails,
|
||||
generateModsBlacklist: [ItemTpl.POCKETS_1X4_TUE],
|
||||
});
|
||||
this.generateEquipment({
|
||||
rootEquipmentSlot: EquipmentSlots.FACE_COVER,
|
||||
rootEquipmentPool: templateInventory.equipment.FaceCover,
|
||||
@ -398,7 +421,7 @@ export class BotInventoryGenerator
|
||||
}
|
||||
|
||||
// Item has slots, fill them
|
||||
if (pickedItemDb._props.Slots?.length > 0)
|
||||
if (pickedItemDb._props.Slots?.length > 0 && !settings.generateModsBlacklist?.includes(pickedItemDb._id))
|
||||
{
|
||||
const items = this.botEquipmentModGenerator.generateModsForEquipment(
|
||||
[item],
|
||||
@ -576,4 +599,6 @@ export interface IGenerateEquipmentProperties
|
||||
botEquipmentConfig: EquipmentFilters
|
||||
/** Settings from bot.json to adjust how item is generated */
|
||||
randomisationDetails: RandomisationDetails
|
||||
/** OPTIONAL - Do not generate mods for tpls in this array */
|
||||
generateModsBlacklist?: string[]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user