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

Constructors

new
DialogueController(
logger: ILogger,
saveServer: SaveServer,
timeUtil: TimeUtil,
dialogueHelper: DialogueHelper,
mailSendService: MailSendService,
configServer: ConfigServer,
dialogueChatBots: IDialogueChatBot[],
)

Properties

protected
configServer: ConfigServer
protected
dialogueChatBots: IDialogueChatBot[]
protected
dialogueHelper: DialogueHelper
protected
logger: ILogger
protected
mailSendService: MailSendService
protected
saveServer: SaveServer
protected
timeUtil: TimeUtil

Methods

protected
getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]

Get messages from a specific dialog that have items not expired

Get dialog from player profile, create if doesn't exist

protected
getMessagesWithAttachments(messages: Message[]): Message[]

Return array of messages with uncollected items (includes expired)

protected
getProfilesForMail(fullProfile: IAkiProfile, dialogUsers: IUserDialogInfo[]): IUserDialogInfo[]

Get the users involved in a mail between two entities

protected
getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number

Get a count of messages with attachments from a particular dialog

protected
messageHasExpired(message: Message): boolean

Has a dialog message expired

protected
messagesHaveUncollectedRewards(messages: Message[]): boolean

Does array have messages with uncollected rewards (includes expired rewards)

protected
removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void

Removes expired items from a message in player profile

protected
removeExpiredItemsFromMessages(sessionId: string): void

Delete expired items from all messages in player profile. triggers when updating traders.

generateDialogueList(sessionID: string): DialogueInfo[]

Handle client/mail/dialog/list Create array holding trader dialogs and mail interactions with player Set the content of the dialogue on the list tab.

Handle client/mail/dialog/view Handle player clicking 'messenger' and seeing all the messages they've recieved Set the content of the dialogue on the details panel, showing all the messages for the specified dialogue.

getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse

Handle client/mail/dialog/getAllAttachments Get all uncollected items attached to mail in a particular dialog

getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo

Get the content of a dialogue

getDialogueUsers(
dialog: Dialogue,
messageType: MessageType,
sessionID: string,
): IUserDialogInfo[]

Get the users involved in a dialog (player + other party)

Handle client/friend/list

removeDialogue(dialogueId: string, sessionId: string): void

Handle client/mail/dialog/remove Remove an entire dialog with an entity (trader/user)

sendMessage(sessionId: string, request: ISendMessageRequest): string

client/mail/msg/send

setDialoguePin(
dialogueId: string,
shouldPin: boolean,
sessionId: string,
): void

Handle client/mail/dialog/pin && Handle client/mail/dialog/unpin

setRead(dialogueIds: string[], sessionId: string): void

Handle client/mail/dialog/read Set a dialog to be read (no number alert/attachment alert)

update(): void

Handle onUpdate spt event