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

Constructors

new
QuestController(
logger: ILogger,
timeUtil: TimeUtil,
jsonUtil: JsonUtil,
httpResponseUtil: HttpResponseUtil,
eventOutputHolder: EventOutputHolder,
databaseServer: DatabaseServer,
itemHelper: ItemHelper,
dialogueHelper: DialogueHelper,
mailSendService: MailSendService,
profileHelper: ProfileHelper,
traderHelper: TraderHelper,
questHelper: QuestHelper,
questConditionHelper: QuestConditionHelper,
playerService: PlayerService,
localeService: LocaleService,
seasonalEventService: SeasonalEventService,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
dialogueHelper: DialogueHelper
protected
eventOutputHolder: EventOutputHolder
protected
httpResponseUtil: HttpResponseUtil
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
localeService: LocaleService
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
mailSendService: MailSendService
protected
playerService: PlayerService
protected
profileHelper: ProfileHelper
protected
questConditionHelper: QuestConditionHelper
protected
questConfig: IQuestConfig
protected
questHelper: QuestHelper
protected
seasonalEventService: SeasonalEventService
protected
timeUtil: TimeUtil
protected
traderHelper: TraderHelper

Methods

protected
addTimeLockedQuestsToProfile(
pmcData: IPmcData,
quests: IQuest[],
completedQuestId: string,
): void

Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile

protected
failQuests(
sessionID: string,
pmcData: IPmcData,
questsToFail: IQuest[],
): void

Fail the provided quests Update quest in profile, otherwise add fresh quest object with failed status

protected
getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[]

Return a list of quests that would fail when supplied quest is completed

protected
getQuestsWithDifferentStatuses(preQuestStatusus: IQuestStatus[], postQuestStatuses: IQuestStatus[]): IQuestStatus[]

Return quests that have different statuses

Look for an accepted quest inside player profile, return matching

protected
playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean

Does a provided quest have a level requirement equal to or below defined level

protected
removeQuestFromScavProfile(sessionId: string, questIdToRemove: string): void

Remove a quest entirely from a profile

protected
sendSuccessDialogMessageOnQuestComplete(
sessionID: string,
pmcData: IPmcData,
completedQuestId: string,
questRewards: Item[],
): void

Send a popup to player on successful completion of a quest

protected
showEventQuestToPlayer(questId: string): boolean

Should a quest be shown to the player in trader quest screen

protected
showQuestItemHandoverMatchError(
handoverQuestRequest: IHandoverQuestRequestData,
itemHandedOver: Item,
handoverRequirements: IQuestCondition,
): IItemEventRouterResponse

Show warning to user and write to log quest item handed over did not match what is required

Show warning to user and write to log that repeatable quest failed a condition check

protected
updateProfileTaskConditionCounterValue(
pmcData: IPmcData,
conditionId: string,
questId: string,
counterValue: number,
): void

Increment a backend counter stored value by an amount, Create counter if it does not exist

acceptQuest(
pmcData: IPmcData,
acceptedQuest: IAcceptQuestRequestData,
sessionID: string,
): IItemEventRouterResponse

Handle QuestAccept event Handle the client accepting a quest and starting it Send starting rewards if any to player and Send start notification if any to player

Handle the client accepting a repeatable quest and starting it Send starting rewards if any to player and Send start notification if any to player

Handle QuestComplete event Update completed quest in profile Add newly unlocked quests to profile Also recalculate their level due to exp rewards

Handle /client/game/profile/items/moving - QuestFail

getClientQuests(sessionID: string): IQuest[]

Handle client/quest/list Get all quests visible to player Exclude quests with incomplete preconditions (level/loyalty)

handoverQuest(
pmcData: IPmcData,
handoverQuestRequest: IHandoverQuestRequestData,
sessionID: string,
): IItemEventRouterResponse

Handle QuestHandover event