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);
|
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))
|
if (!(botGenerationDetails.isPmc || botGenerationDetails.isPlayerScav))
|
||||||
{
|
{
|
||||||
bot.Hideout = undefined;
|
bot.Hideout = undefined;
|
||||||
@ -208,6 +208,17 @@ export class BotGenerator
|
|||||||
bot.Health = this.generateHealth(botJsonTemplate.health, bot.Info.Side === "Savage");
|
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
|
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);
|
this.setBotAppearance(bot, botJsonTemplate.appearance, botGenerationDetails);
|
||||||
|
|
||||||
bot.Inventory = this.botInventoryGenerator.generateInventory(
|
bot.Inventory = this.botInventoryGenerator.generateInventory(
|
||||||
@ -216,15 +227,9 @@ export class BotGenerator
|
|||||||
botRole,
|
botRole,
|
||||||
botGenerationDetails.isPmc,
|
botGenerationDetails.isPmc,
|
||||||
botLevel.level,
|
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))
|
if (this.botConfig.botRolesWithDogTags.includes(botRole))
|
||||||
{
|
{
|
||||||
this.addDogtagToBot(bot);
|
this.addDogtagToBot(bot);
|
||||||
@ -245,6 +250,14 @@ export class BotGenerator
|
|||||||
return bot;
|
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
|
* Remove items from item.json/lootableItemBlacklist from bots inventory
|
||||||
* @param botInventory Bot to filter
|
* @param botInventory Bot to filter
|
||||||
@ -566,22 +579,25 @@ export class BotGenerator
|
|||||||
* Chooses from all the game versions (standard, eod etc)
|
* Chooses from all the game versions (standard, eod etc)
|
||||||
* Chooses account type (default, Sherpa, etc)
|
* Chooses account type (default, Sherpa, etc)
|
||||||
* @param botInfo bot info object to update
|
* @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")
|
if (botInfo.Nickname.toLowerCase() === "nikita")
|
||||||
{
|
{
|
||||||
botInfo.GameVersion = "edge_of_darkness";
|
botInfo.GameVersion = "edge_of_darkness";
|
||||||
botInfo.MemberCategory = MemberCategory.DEVELOPER;
|
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.GameVersion = this.weightedRandomHelper.getWeightedValue(this.pmcConfig.gameVersionWeight);
|
||||||
botInfo.MemberCategory = Number.parseInt(
|
botInfo.MemberCategory = Number.parseInt(
|
||||||
this.weightedRandomHelper.getWeightedValue(this.pmcConfig.accountTypeWeight),
|
this.weightedRandomHelper.getWeightedValue(this.pmcConfig.accountTypeWeight),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return botInfo.GameVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,6 +58,7 @@ export class BotInventoryGenerator
|
|||||||
* @param botRole Role bot has (assault/pmcBot)
|
* @param botRole Role bot has (assault/pmcBot)
|
||||||
* @param isPmc Is bot being converted into a pmc
|
* @param isPmc Is bot being converted into a pmc
|
||||||
* @param botLevel Level of bot being generated
|
* @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
|
* @returns PmcInventory object with equipment/weapons/loot
|
||||||
*/
|
*/
|
||||||
public generateInventory(
|
public generateInventory(
|
||||||
@ -66,6 +67,7 @@ export class BotInventoryGenerator
|
|||||||
botRole: string,
|
botRole: string,
|
||||||
isPmc: boolean,
|
isPmc: boolean,
|
||||||
botLevel: number,
|
botLevel: number,
|
||||||
|
chosenGameVersion: string,
|
||||||
): PmcInventory
|
): PmcInventory
|
||||||
{
|
{
|
||||||
const templateInventory = botJsonTemplate.inventory;
|
const templateInventory = botJsonTemplate.inventory;
|
||||||
@ -75,7 +77,13 @@ export class BotInventoryGenerator
|
|||||||
// Generate base inventory with no items
|
// Generate base inventory with no items
|
||||||
const botInventory = this.generateInventoryBase();
|
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
|
// Roll weapon spawns (primary/secondary/holster) and generate a weapon for each roll that passed
|
||||||
this.generateAndAddWeaponsToBot(
|
this.generateAndAddWeaponsToBot(
|
||||||
@ -133,6 +141,7 @@ export class BotInventoryGenerator
|
|||||||
* @param botRole Role bot has (assault/pmcBot)
|
* @param botRole Role bot has (assault/pmcBot)
|
||||||
* @param botInventory Inventory to add equipment to
|
* @param botInventory Inventory to add equipment to
|
||||||
* @param botLevel Level of bot
|
* @param botLevel Level of bot
|
||||||
|
* @param chosenGameVersion Game version for bot, only really applies for PMCs
|
||||||
*/
|
*/
|
||||||
protected generateAndAddEquipmentToBot(
|
protected generateAndAddEquipmentToBot(
|
||||||
templateInventory: Inventory,
|
templateInventory: Inventory,
|
||||||
@ -140,10 +149,12 @@ export class BotInventoryGenerator
|
|||||||
botRole: string,
|
botRole: string,
|
||||||
botInventory: PmcInventory,
|
botInventory: PmcInventory,
|
||||||
botLevel: number,
|
botLevel: number,
|
||||||
|
chosenGameVersion: string,
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
// These will be handled later
|
// These will be handled later
|
||||||
const excludedSlots: string[] = [
|
const excludedSlots: string[] = [
|
||||||
|
EquipmentSlots.POCKETS,
|
||||||
EquipmentSlots.FIRST_PRIMARY_WEAPON,
|
EquipmentSlots.FIRST_PRIMARY_WEAPON,
|
||||||
EquipmentSlots.SECOND_PRIMARY_WEAPON,
|
EquipmentSlots.SECOND_PRIMARY_WEAPON,
|
||||||
EquipmentSlots.HOLSTER,
|
EquipmentSlots.HOLSTER,
|
||||||
@ -178,6 +189,18 @@ export class BotInventoryGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate below in specific order
|
// 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({
|
this.generateEquipment({
|
||||||
rootEquipmentSlot: EquipmentSlots.FACE_COVER,
|
rootEquipmentSlot: EquipmentSlots.FACE_COVER,
|
||||||
rootEquipmentPool: templateInventory.equipment.FaceCover,
|
rootEquipmentPool: templateInventory.equipment.FaceCover,
|
||||||
@ -398,7 +421,7 @@ export class BotInventoryGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Item has slots, fill them
|
// 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(
|
const items = this.botEquipmentModGenerator.generateModsForEquipment(
|
||||||
[item],
|
[item],
|
||||||
@ -576,4 +599,6 @@ export interface IGenerateEquipmentProperties
|
|||||||
botEquipmentConfig: EquipmentFilters
|
botEquipmentConfig: EquipmentFilters
|
||||||
/** Settings from bot.json to adjust how item is generated */
|
/** Settings from bot.json to adjust how item is generated */
|
||||||
randomisationDetails: RandomisationDetails
|
randomisationDetails: RandomisationDetails
|
||||||
|
/** OPTIONAL - Do not generate mods for tpls in this array */
|
||||||
|
generateModsBlacklist?: string[]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user