Skip to main content
Deno 2 is finally here 🎉️
Learn more
class PmcChatResponseService
import { PmcChatResponseService } from "https://deno.land/x/sptaki@1.2.0/services/PmcChatResponseService.d.ts";

Constructors

new
PmcChatResponseService(
logger: ILogger,
hashUtil: HashUtil,
randomUtil: RandomUtil,
notificationSendHelper: NotificationSendHelper,
matchBotDetailsCacheService: MatchBotDetailsCacheService,
localisationService: LocalisationService,
weightedRandomHelper: WeightedRandomHelper,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
hashUtil: HashUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
matchBotDetailsCacheService: MatchBotDetailsCacheService
protected
notificationSendHelper: NotificationSendHelper
protected
pmcResponsesConfig: IPmcChatResponse
protected
randomUtil: RandomUtil
protected
weightedRandomHelper: WeightedRandomHelper

Methods

protected
allCaps(isVictim: boolean): boolean

Should capitalisation be stripped from the message response before sending

protected
chooseMessage(isVictim: boolean, pmcData: IPmcData): string

Choose a localised message to send the player (different if sender was killed or killed player)

protected
chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo

Randomly draw a victim of the the array and return thier details

protected
chooseResponseType(isVictim?: boolean): string

Choose a type of response based on the weightings in pmc response config

protected
getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]

Get locale keys related to the type of response to send (victim/killer)

protected
getResponseSuffixLocaleKeys(): string[]

Get all locale keys that start with pmcresponse-suffix

Convert a victim object into a IUserDialogInfo object

protected
stripCapitalistion(isVictim: boolean): boolean

Should capitalisation be stripped from the message response before sending

appendSuffixToMessageEnd(isVictim: boolean): boolean

Should a suffix be appended to the end of the message being sent to player

sendKillerResponse(
sessionId: string,
pmcData: IPmcData,
killer: Aggressor,
): void

Not fully implemented yet, needs method of acquiring killers details after raid

sendVictimResponse(
sessionId: string,
pmcVictims: Victim[],
pmcData: IPmcData,
): void

For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative