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

Constructors

new
RepeatableQuestGenerator(
logger: ILogger,
randomUtil: RandomUtil,
mathUtil: MathUtil,
jsonUtil: JsonUtil,
databaseServer: DatabaseServer,
itemHelper: ItemHelper,
localisationService: LocalisationService,
objectId: ObjectId,
repeatableQuestHelper: RepeatableQuestHelper,
repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
mathUtil: MathUtil
protected
objectId: ObjectId
protected
questConfig: IQuestConfig
protected
randomUtil: RandomUtil
protected
repeatableQuestHelper: RepeatableQuestHelper
protected
repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator

Methods

protected
generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition

A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many)

protected
generateCompletionQuest(
pmcLevel: number,
traderId: string,
repeatableConfig: IRepeatableQuestConfig,
): IRepeatableQuest

Generates a valid Completion quest

protected
generateEliminationCondition(
target: string,
targetedBodyParts: string[],
distance: number,
allowedWeapon: string,
allowedWeaponCategory: string,
): IQuestConditionCounterCondition

Create kill condition for an elimination quest

A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) This is a helper method for GenerateEliminationQuest to create a location condition.

protected
generateEliminationQuest(
pmcLevel: number,
traderId: string,
questTypePool: IQuestTypePool,
repeatableConfig: IRepeatableQuestConfig,
): IRepeatableQuest

Generate a randomised Elimination quest

Exploration repeatable quests can specify a required extraction point. This method creates the according object which will be appended to the conditions array

protected
generateExplorationQuest(
pmcLevel: number,
traderId: string,
questTypePool: IQuestTypePool,
repeatableConfig: IRepeatableQuestConfig,
): IRepeatableQuest

Generates a valid Exploration quest

protected
generatePickupQuest(
pmcLevel: number,
traderId: string,
questTypePool: IQuestTypePool,
repeatableConfig: IRepeatableQuestConfig,
): IRepeatableQuest
protected
generateRepeatableTemplate(
type: string,
traderId: string,
side: string,
): IRepeatableQuest

Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json The templates include Elimination, Completion and Extraction quest types

protected
getEliminationKillCount(
targetKey: string,
targetsConfig: ProbabilityObjectArray<string, IBossInfo>,
eliminationConfig: IEliminationConfig,
): number

Get a number of kills neded to complete elimination quest

protected
getLocationExitsForSide(locationKey: string, playerSide: string): Exit[]

Filter a maps exits to just those for the desired side

protected
getQuestLocationByMapId(locationKey: string): string

Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567)

generateRepeatableQuest(
pmcLevel: number,
pmcTraderInfo: Record<string, TraderInfo>,
questTypePool: IQuestTypePool,
repeatableConfig: IRepeatableQuestConfig,
): IRepeatableQuest

This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest