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

Constructors

new
BotLootGenerator(
logger: ILogger,
hashUtil: HashUtil,
randomUtil: RandomUtil,
itemHelper: ItemHelper,
jsonUtil: JsonUtil,
inventoryHelper: InventoryHelper,
databaseServer: DatabaseServer,
handbookHelper: HandbookHelper,
botGeneratorHelper: BotGeneratorHelper,
botWeaponGenerator: BotWeaponGenerator,
weightedRandomHelper: WeightedRandomHelper,
botHelper: BotHelper,
botLootCacheService: BotLootCacheService,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
botConfig: IBotConfig
protected
botGeneratorHelper: BotGeneratorHelper
protected
botHelper: BotHelper
protected
botLootCacheService: BotLootCacheService
protected
botWeaponGenerator: BotWeaponGenerator
protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
handbookHelper: HandbookHelper
protected
hashUtil: HashUtil
protected
inventoryHelper: InventoryHelper
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
pmcConfig: IPmcConfig
protected
randomUtil: RandomUtil
protected
weightedRandomHelper: WeightedRandomHelper

Methods

protected
addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void

Force healing items onto bot to ensure they can heal in-raid

protected
addLooseWeaponsToInventorySlot(
sessionId: string,
botInventory: PmcInventory,
equipmentSlot: string,
templateInventory: Inventory,
modChances: ModsChances,
botRole: string,
isPmc: boolean,
botLevel: number,
containersIdFull?: Set<string>,
): void

Add generated weapons to inventory as loot

protected
addLootFromPool(
pool: Record<string, number>,
equipmentSlots: string[],
totalItemCount: number,
inventoryToAddItemsTo: PmcInventory,
botRole: string,
itemSpawnLimits?: IItemSpawnLimitSettings,
totalValueLimitRub?: number,
isPmc?: boolean,
containersIdFull?: Set<string>,
): void

Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached

protected
addRequiredChildItemsToParent(
itemToAddTemplate: ITemplateItem,
itemToAddChildrenTo: Item[],
isPmc: boolean,
botRole: string,
): void

Some items need child items to function, add them to the itemToAddChildrenTo array

protected
createWalletLoot(walletId: string): Item[][]

Get an array of the containers a bot has on them (pockets/backpack/vest)

protected
getItemSpawnLimitsForBotType(botRole: string): Record<string, number>

Get spawn limits for a specific bot type from bot.json config If no limit found for a non pmc bot, fall back to defaults

protected
getMatchingIdFromSpawnLimits(itemTemplate: ITemplateItem, spawnLimits: Record<string, number>): string

Get the parentId or tplId of item inside spawnLimits object if it exists

protected
getRandomisedCount(
min: number,
max: number,
nValue: number,
): number

Get a biased random number

protected
initItemLimitArray(botRole: string, limitCount: Record<string, number>): void

Hydrate item limit array to contain items that have a limit for a specific bot type All values are set to 0

protected
itemHasReachedSpawnLimit(
itemTemplate: ITemplateItem,
botRole: string,
itemSpawnLimits: IItemSpawnLimitSettings,
): boolean

Check if an item has reached its bot-specific spawn limit

protected
randomiseAmmoStackSize(
isPmc: boolean,
itemTemplate: ITemplateItem,
ammoItem: Item,
): void

Randomise the size of an ammo stack

protected
randomiseMoneyStackSize(
botRole: string,
itemTemplate: ITemplateItem,
moneyItem: Item,
): void

Randomise the stack size of a money object, uses different values for pmc or scavs

generateLoot(
sessionId: string,
botJsonTemplate: IBotType,
isPmc: boolean,
botRole: string,
botInventory: PmcInventory,
botLevel: number,
): void

Add loot to bots containers