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

Constructors

new
BotHelper(
logger: ILogger,
jsonUtil: JsonUtil,
databaseServer: DatabaseServer,
randomUtil: RandomUtil,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
botConfig: IBotConfig
protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
pmcConfig: IPmcConfig
protected
randomUtil: RandomUtil

Methods

protected
getRandomizedPmcSide(): string

Get a randomized PMC side based on bot config value 'isUsec'

addBotToEnemyList(
difficultySettings: Difficulty,
typesToAdd: string[],
typeBeingEdited: string,
): void

Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list

addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void

Add a bot to the FRIENDLY_BOT_TYPES array

addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void

Add a bot to the REVENGE_BOT_TYPES array

botRoleIsPmc(botRole: string): boolean

Get randomization settings for bot from config/bot.json

getBotTemplate(role: string): IBotType

Get a template object for the specified botRole from bots.types db

getPmcSideByRole(botRole: string): string

Get the corresponding side when sptBear or sptUsec is passed in

Choose between sptBear and sptUsec at random based on the % defined in pmcConfig.isUsec

isBotBoss(botRole: string): boolean
isBotFollower(botRole: string): boolean
isBotPmc(botRole: string): boolean

Is the passed in bot role a PMC (usec/bear/pmc)

randomizePmcHostility(difficultySettings: Difficulty): void

Randomize the chance the PMC will attack their own side Look up value in bot.json/chanceSameSideIsHostilePercent

rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean
shouldBotBePmc(botRole: string): boolean

Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check