Class: QuestManager

QuestManager


new QuestManager(id)

Quests will be stored under gameData.quests[id]
All mods have their own QuestManager to prevent questIDs from overlapping. If your mod needs to do things with other mod's quests you should make sure you use that mod's QuestManager.
The default QuestManager id is "QB".

Parameters:
Name Type Description
id string
Source:

Methods


addQuest(config)

Parameters:
Name Type Description
config QuestManager.QuestConfig
Source:

addSubquest(config)

Parameters:
Name Type Description
config QuestManager.SubquestConfig
Source:

complete(questID, subquestID [, rewardsParameter])

Completing a quest sets the quest status to true and runs the rewards function if there is one.

Parameters:
Name Type Argument Description
questID string
subquestID string
rewardsParameter * <optional>

If you need to pass anything into the rewards function

Source:
Returns:
Type
Promise

getActiveQuests()

Returns subquests

Source:
Returns:
Type
Array.<Subquest>

getAllQuests()

Source:
Returns:
Type
object

getQuest(questID [, subquestID])

Parameters:
Name Type Argument Description
questID string
subquestID string <optional>

If you want the subquest put a subquestID

Source:
Returns:
Type
QuestManager.Quest | QuestManager.Subquest

getQuestStatus(questID, subquestID)

Parameters:
Name Type Description
questID string
subquestID string
Source:
Returns:
Type
boolean

getSubquestProgress(subquest)

Parameters:
Name Type Description
subquest QuestManager.Subquest
Source:
Returns:
Type
*

isComplete(questID, subquestID)

Parameters:
Name Type Description
questID string
subquestID string
Source:
Returns:
Type
boolean

setQuestStatus(questID, subquestID, variable)

Parameters:
Name Type Description
questID string
subquestID string
variable *
Source:

Type Definitions


Quest

Type:
  • object
Properties:
Name Type Description
modID string

ID of mod that was used to create this quest.

questID string

ID of quest

questName string

Name of quest

questImportant boolean

If the quest shows a pink or grey heart on the quest log

subquests object.<QuestManager.Subquest>

List of all subquests under this quest

Source:
Example
{
    modID: "QB",
    questID: "myQuest",
    questName: "This is my quest",
    questImportant: false,
    subquests: {}
}

QuestConfig

Config file for creating quests.

Type:
  • object
Properties:
Name Type Argument Default Description
questID string

ID of quest

questName string

Name of quest to put on the input option

questImportant boolean <optional>
false

If the quest should show a pink or grey heart on the quest log

subquests Array.<QuestManager.SubquestConfig> <optional>
[]

Array of subquest configs if you don't want to call addSubquest manually

Source:
Example
{
    questID: "myQuest",
    questName: "This is my quest",
    questImportant: false,
    subquests: []
}

Subquest

Type:
  • object
Properties:
Name Type Argument Description
modID string

ID of mod that was used to create this quest.

questID string

ID of quest

subquestID string

ID of subquest

questCondition function | boolean

Only display quest if this condition is true

questProgress function | boolean

Condition for the quest to be complete

mapKey string

mapKey used in userInput

dialogueKey string

dialogueKey used in userInput

rewards function <optional>

Function called after completing quest

questStart boolean <optional>

If the quest should have a "!" icon

questLog obj <optional>

If the quest should appear on the quest log

Properties
Name Type Argument Description
questDescription string

Description of the quest

progress function | string <optional>

User's progress of the quest. If a function, it should return a string

Source:

SubquestConfig

Config file for creating subquests

Type:
  • object
Properties:
Name Type Argument Description
questID string

ID of quest

subquestID string

ID of subquest

questCondition function | boolean

Only display quest if this condition is true

questProgress function | boolean

Condition for the quest to be complete

mapKey string <optional>

mapKey used in userInput

dialogueKey string <optional>

dialogueKey used in userInput

rewards function <optional>

Function called after completing quest

questStart boolean <optional>

If the quest should have a "!" icon

questLog obj <optional>

If the quest should appear on the quest log

Properties
Name Type Argument Description
questDescription string

Description of the quest

progress function | string <optional>

User's progress of the quest. If a function, it should return a string

Source:
Example
{
    questID: "myQuest",
    subquestID: "giveHandjob",
    questCondition: function () {
        // Quest is available only if this condition is met
        return GAME.quest.isComplete('townFuckQuest', 'Completed');
    },
    questProgress: function () {
        // Quest is completable only if this condition is met
        return GAME.girl.getGirlLevel('Queen', 'Hands') >= 5;
    },
    mapKey: "TownMayorOffice",
    dialogueKey: "myQuestgiveHandjob",
    rewards: function () {
         // Called when the player completes the quest
         GAME.girl.gainExp('Queen', 'Hands', 500);
    },
    questLog: {
         questDescription: "Queen must give handjobs to everyone in Easthollow!",
         progress: function () {
             return "Level 5 hands needed. Queen's level: " + GAME.girl.getGirlLevel('Queen', 'Hands');
         }
    }
}