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

Constructors

new
QuestHelper(
logger: ILogger,
jsonUtil: JsonUtil,
timeUtil: TimeUtil,
hashUtil: HashUtil,
itemHelper: ItemHelper,
questConditionHelper: QuestConditionHelper,
eventOutputHolder: EventOutputHolder,
databaseServer: DatabaseServer,
localeService: LocaleService,
ragfairServerHelper: RagfairServerHelper,
dialogueHelper: DialogueHelper,
profileHelper: ProfileHelper,
paymentHelper: PaymentHelper,
localisationService: LocalisationService,
traderHelper: TraderHelper,
presetHelper: PresetHelper,
mailSendService: MailSendService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
dialogueHelper: DialogueHelper
protected
eventOutputHolder: EventOutputHolder
protected
hashUtil: HashUtil
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
localeService: LocaleService
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
mailSendService: MailSendService
protected
paymentHelper: PaymentHelper
protected
presetHelper: PresetHelper
protected
profileHelper: ProfileHelper
protected
questConditionHelper: QuestConditionHelper
protected
questConfig: IQuestConfig
protected
ragfairServerHelper: RagfairServerHelper
protected
timeUtil: TimeUtil
protected
traderHelper: TraderHelper

Methods

protected
addItemStackSizeChangeIntoEventResponse(
sessionId: string,
item: Item,
): void

Add item stack change object into output route event response

protected
compareAvailableForValues(
current: number,
required: number,
compareMethod: string,
): boolean
protected
findAndAddHideoutProductionIdToProfile(
pmcData: IPmcData,
craftUnlockReward: IQuestReward,
questDetails: IQuest,
sessionID: string,
): void

WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile also update client response recipeUnlocked array with craft id

protected
generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void

Add missing mod items to a quest armor reward

protected
getQuestMoneyRewardBonus(pmcData: IPmcData): number

Get players money reward bonus from profile

Get quests, strip all requirement conditions except level

protected
processReward(questReward: IQuestReward): Item[]

Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids

addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void

Add all quests to a profile with the provided statuses

adjustSkillExpForLowLevels(profileSkill: Common, progressAmount: number): number

Adjust skill experience for low skill levels, mimicing the official client

applyMoneyBoost(
quest: IQuest,
multiplier: number,
questStatus: QuestStatus,
): IQuest

Adjust quest money rewards by passed in multiplier

applyQuestReward(
profileData: IPmcData,
questId: string,
state: QuestStatus,
sessionId: string,
questResponse: IItemEventRouterResponse,
): Item[]

Give player quest rewards - Skills/exp/trader standing/items/assort unlocks - Returns reward items player earned

changeItemStack(
pmcData: IPmcData,
itemId: string,
newStackSize: number,
sessionID: string,
): void

Sets the item stack to new value, or delete the item if value <= 0 // TODO maybe merge this function and the one from customization

doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean

returns true is the level condition is satisfied

failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]

Get quests that can be shown to player after failing a quest

failQuest(
pmcData: IPmcData,
failRequest: IFailQuestRequestData,
sessionID: string,
): void

Fail a quest in a player profile

findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void
getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]

Get the quests found in both arrays (inner join)

getFindItemConditionByQuestItem(
itemTpl: string,
questIds: string[],
allQuests: IQuest[],
): Record<string, string>

Find quest with 'findItem' condition that needs the item tpl be handed in

getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string

Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead

getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]

Get quests that can be shown to player after starting a quest

getQuestFromDb(questId: string, pmcData: IPmcData): IQuest

Get quest by id from database (repeatables are stored in profile, check there if questId not found)

getQuestLocaleIdFromDb(questMessageId: string): string

Get the locale Id from locale db for a quest message

getQuestNameFromLocale(questId: string): string

Get quest name by quest id

Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile

Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success)

getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]

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

Get List of All Quests from db NOT CLONED

getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus

Get status of a quest in player profile by its id

Remove all quest conditions except for level requirement

questIsForOtherSide(playerSide: string, questId: string): boolean

Is the quest for the opposite side the player is on

resetQuestState(
pmcData: IPmcData,
newQuestState: QuestStatus,
questId: string,
): void

Resets a quests values back to its chosen state

traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean

Check if trader has sufficient loyalty to fulfill quest requirement

traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean

Check if trader has sufficient standing to fulfill quest requirement

updateQuestState(
pmcData: IPmcData,
newQuestState: QuestStatus,
questId: string,
): void

Alter a quests state + Add a record to its status timers object