Skip to main content
The Deno 2 Release Candidate is here
Learn more
class BotGeneratorHelper
import { BotGeneratorHelper } from "https://deno.land/x/sptaki@1.2.0/helpers/BotGeneratorHelper.d.ts";

Constructors

new
BotGeneratorHelper(
logger: ILogger,
randomUtil: RandomUtil,
databaseServer: DatabaseServer,
durabilityLimitsHelper: DurabilityLimitsHelper,
itemHelper: ItemHelper,
inventoryHelper: InventoryHelper,
containerHelper: ContainerHelper,
applicationContext: ApplicationContext,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
applicationContext: ApplicationContext
protected
botConfig: IBotConfig
protected
configServer: ConfigServer
protected
containerHelper: ContainerHelper
protected
databaseServer: DatabaseServer
protected
durabilityLimitsHelper: DurabilityLimitsHelper
protected
inventoryHelper: InventoryHelper
protected
itemHelper: ItemHelper
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
pmcConfig: IPmcConfig
protected
randomUtil: RandomUtil

Methods

protected
generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable

Create a repairable object for an armor that containers durability + max durability properties

protected
generateWeaponRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable

Create a repairable object for a weapon that containers durability + max durability properties

protected
getBotEquipmentSettingFromConfig(
botRole: string,
setting: keyof EquipmentFilters,
defaultValue: number,
): number

Get the chance for the weapon attachment or helmet equipment to be set as activated

protected
getRandomizedResourceValue(maxResource: number, randomizationValues: IRandomisedResourceValues): number

Randomize the HpResource for bots e.g (245/400 resources)

protected
itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean

Is the provided item allowed inside a container

addItemWithChildrenToEquipmentSlot(
equipmentSlots: string[],
rootItemId: string,
rootItemTplId: string,
itemWithChildren: Item[],
inventory: Inventory,
containersIdFull?: Set<string>,
): ItemAddedResult

Adds an item with all its children into specified equipmentSlots, wherever it fits.

generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }

Adds properties to an item e.g. Repairable / HasHinge / Foldable / MaxDurability

getBotEquipmentRole(botRole: string): string

Convert a bots role to the equipment role used in config/bot.json

isItemIncompatibleWithCurrentItems(
itemsEquipped: Item[],
tplToCheck: string,
equipmentSlot: string,
): IChooseRandomCompatibleModResult

Can item be added to another item without conflict

isWeaponModIncompatibleWithCurrentMods(
itemsEquipped: Item[],
tplToCheck: string,
modSlot: string,
): IChooseRandomCompatibleModResult