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

Constructors

new
BotController(
logger: ILogger,
databaseServer: DatabaseServer,
botGenerator: BotGenerator,
botHelper: BotHelper,
botDifficultyHelper: BotDifficultyHelper,
botGenerationCacheService: BotGenerationCacheService,
matchBotDetailsCacheService: MatchBotDetailsCacheService,
localisationService: LocalisationService,
seasonalEventService: SeasonalEventService,
profileHelper: ProfileHelper,
configServer: ConfigServer,
applicationContext: ApplicationContext,
randomUtil: RandomUtil,
jsonUtil: JsonUtil,
)

Properties

protected
applicationContext: ApplicationContext
protected
botConfig: IBotConfig
protected
botDifficultyHelper: BotDifficultyHelper
protected
botGenerationCacheService: BotGenerationCacheService
protected
botGenerator: BotGenerator
protected
botHelper: BotHelper
protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
matchBotDetailsCacheService: MatchBotDetailsCacheService
protected
pmcConfig: IPmcConfig
protected
profileHelper: ProfileHelper
protected
randomUtil: RandomUtil
protected
seasonalEventService: SeasonalEventService

Methods

protected
generateBotsFirstTime(
pmcProfile: IPmcData,
sessionId: string,
): IBotBase[]

On first bot generation bots are generated and stored inside a cache, ready to be used later

protected
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]

Pull a single bot out of cache and return, if cache is empty add bots to it and then return

generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]

Generate bot profiles and store in cache

getAllBotDifficulties(): Record<string, any>
getBotCap(): number

Get the max number of bots allowed on a map Looks up location player is entering when getting cap value

Handle singleplayer/settings/bot/difficulty Get the core.json difficulty settings from database/bots

getBotDifficulty(
type: string,
diffLevel: string,
ignoreRaidSettings?: boolean,
): Difficulty

Get bot difficulty settings Adjust PMC settings to ensure they engage the correct bot types

getBotPresetGenerationLimit(type: string): number

Return the number of bot load-out varieties to be generated

getPMCDifficulty(requestedDifficulty: string): string

Get the difficulty passed in, if its not "asonline", get selected difficulty from config