Skip to main content
The Deno 2 Release Candidate is here
Learn more
class BotInventoryGenerator
Re-export
import { BotInventoryGenerator } from "https://deno.land/x/sptaki@1.2.0/generators/mod.ts";

Constructors

new
BotInventoryGenerator(
logger: ILogger,
hashUtil: HashUtil,
randomUtil: RandomUtil,
databaseServer: DatabaseServer,
botWeaponGenerator: BotWeaponGenerator,
botLootGenerator: BotLootGenerator,
botGeneratorHelper: BotGeneratorHelper,
botHelper: BotHelper,
weightedRandomHelper: WeightedRandomHelper,
itemHelper: ItemHelper,
localisationService: LocalisationService,
botEquipmentModPoolService: BotEquipmentModPoolService,
botEquipmentModGenerator: BotEquipmentModGenerator,
configServer: ConfigServer,
)

Properties

protected
botConfig: IBotConfig
protected
botEquipmentModGenerator: BotEquipmentModGenerator
protected
botEquipmentModPoolService: BotEquipmentModPoolService
protected
botGeneratorHelper: BotGeneratorHelper
protected
botHelper: BotHelper
protected
botLootGenerator: BotLootGenerator
protected
botWeaponGenerator: BotWeaponGenerator
protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
hashUtil: HashUtil
protected
itemHelper: ItemHelper
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
randomUtil: RandomUtil
protected
weightedRandomHelper: WeightedRandomHelper

Methods

protected
addWeaponAndMagazinesToInventory(
sessionId: string,
weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; },
templateInventory: Inventory,
botInventory: PmcInventory,
equipmentChances: Chances,
botRole: string,
isPmc: boolean,
itemGenerationWeights: Generation,
botLevel: number,
): void

Add weapon + spare mags/ammo to bots inventory

protected
filterRigsToThoseWithoutProtection(templateInventory: Inventory): void

Remove armored rigs from parameter data

protected
filterRigsToThoseWithProtection(templateInventory: Inventory): void

Remove non-armored rigs from parameter data

protected
generateAndAddEquipmentToBot(
templateInventory: Inventory,
wornItemChances: Chances,
botRole: string,
botInventory: PmcInventory,
botLevel: number,
): void

Add equipment to a bot

protected
generateAndAddWeaponsToBot(
templateInventory: Inventory,
equipmentChances: Chances,
sessionId: string,
botInventory: PmcInventory,
botRole: string,
isPmc: boolean,
itemGenerationLimitsMinMax: Generation,
botLevel: number,
): void

Work out what weapons bot should have equipped and add them to bot inventory

protected
generateEquipment(settings: IGenerateEquipmentProperties): boolean

Add a piece of equipment with mods to inventory from the provided pools

Create a pmcInventory object with all the base/generic items needed

protected
getDesiredWeaponsForBot(equipmentChances: Chances): { slot: EquipmentSlots; shouldSpawn: boolean; }[]

Calculate if the bot should have weapons in Primary/Secondary/Holster slots

protected
getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record<string, string[]>

Get all possible mods for item and filter down based on equipment blacklist from bot.json config

generateInventory(
sessionId: string,
botJsonTemplate: IBotType,
botRole: string,
isPmc: boolean,
botLevel: number,
): PmcInventory

Add equipment/weapons/loot to bot