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

Constructors

new
MailSendService(
logger: ILogger,
hashUtil: HashUtil,
timeUtil: TimeUtil,
saveServer: SaveServer,
databaseServer: DatabaseServer,
notifierHelper: NotifierHelper,
dialogueHelper: DialogueHelper,
notificationSendHelper: NotificationSendHelper,
localisationService: LocalisationService,
itemHelper: ItemHelper,
traderHelper: TraderHelper,
)

Properties

protected
databaseServer: DatabaseServer
protected
dialogueHelper: DialogueHelper
protected
hashUtil: HashUtil
protected
itemHelper: ItemHelper
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
notificationSendHelper: NotificationSendHelper
protected
notifierHelper: NotifierHelper
protected
saveServer: SaveServer
protected
readonly
systemSenderId: string
protected
timeUtil: TimeUtil
protected
traderHelper: TraderHelper

Methods

protected
addRewardItemsToMessage(
message: Message,
itemsToSendToPlayer: MessageItems,
maxStorageTimeSeconds: number,
): void

Add items to message and adjust various properties to reflect the items being added

protected
createDialogMessage(dialogId: string, messageDetails: ISendMessageDetails): Message

Create a message for storage inside a dialog in the player profile

protected
getBaseItemFromRewards(items: Item[]): Item

Try to find the most correct item to be the 'primary' item in a reward mail

protected
getDialog(messageDetails: ISendMessageDetails): Dialogue

Get a dialog with a specified entity (user/trader) Create and store empty dialog if none exists in profile

protected
getMessageSenderIdByType(messageDetails: ISendMessageDetails): string

Get the appropriate sender id by the sender enum type

perform various sanitising actions on the items before they're considered ready for insertion into message

sendDirectNpcMessageToPlayer(
sessionId: string,
trader: Traders,
messageType: MessageType,
message: string,
items?: Item[],
maxStorageTimeSeconds?: any,
systemData?: any,
ragfair?: any,
): void

Send a message from an NPC (e.g. prapor) to the player with or without items using direct message text, do not look up any locale

sendLocalisedNpcMessageToPlayer(
sessionId: string,
trader: Traders,
messageType: MessageType,
messageLocaleId: string,
items?: Item[],
maxStorageTimeSeconds?: any,
systemData?: any,
ragfair?: any,
): void

Send a message from an NPC (e.g. prapor) to the player with or without items

sendLocalisedSystemMessageToPlayer(
sessionId: string,
messageLocaleId: string,
items?: Item[],
profileChangeEvents?: IProfileChangeEvent[],
maxStorageTimeSeconds?: number,
): void

Send a message from SYSTEM to the player with or without items with localised text

Large function to send messages to players from a variety of sources (SYSTEM/NPC/USER) Helper functions in this class are available to simplify common actions

sendPlayerMessageToNpc(
sessionId: string,
targetNpcId: string,
message: string,
): void

Send a message from the player to an NPC

sendSystemMessageToPlayer(
sessionId: string,
message: string,
items?: Item[],
maxStorageTimeSeconds?: number,
profileChangeEvents?: IProfileChangeEvent[],
): void

Send a message from SYSTEM to the player with or without items

sendUserMessageToPlayer(
sessionId: string,
senderDetails: IUserDialogInfo,
message: string,
items?: Item[],
maxStorageTimeSeconds?: any,
): void

Send a USER message to a player with or without items