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

Constructors

new
BotGenerationCacheService(
logger: ILogger,
randomUtil: RandomUtil,
jsonUtil: JsonUtil,
localisationService: LocalisationService,
botHelper: BotHelper,
)

Properties

protected
activeBotsInRaid: IBotBase[]
protected
botHelper: BotHelper
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
randomUtil: RandomUtil
protected
storedBots: Map<string, IBotBase[]>

Methods

cacheHasBotOfRole(key: string): boolean

Does cache have a bot with requested key

Remove all cached bot profiles from memory

getBot(key: string): IBotBase

Find and return a bot based on its role Remove bot from internal array so it can't be retreived again

getUsedBot(profileId: string): IBotBase

Get a bot by its profileId that has been generated and sent to client for current raid Cache is wiped post-raid in client/match/offline/end endOfflineRaid()

storeBots(key: string, botsToStore: IBotBase[]): void

Store array of bots in cache, shuffle results before storage

storeUsedBot(botToStore: IBotBase): void

Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav