Table of Contents

Class TimbnQuest

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

A quest added with the plugin's Quests.Add, all its stages included. Keep it to start the quest, mark it ready or complete it from your own code, and pass it to another quest's OfferAfter or ContinuesFrom to chain them.

public sealed class TimbnQuest
Inheritance
TimbnQuest
Inherited Members

Examples

var bats = Quests.Add("my_cellar_bats", TimbnGameIds.Npcs.Larry, "Bats in the Cellar", quest => quest
    .Description("Smoke the bats out of the cellar.")
    .ReadyByCode());

Events.PlayerItemUsed(item => { if (item.id == "smoke_bomb") bats.MarkReady(); });

Properties

CurrentRun

The current run of a quest with a Setup, or null when none is rolled, no save is loaded, or the quest was skipped because another mod adds one with the same id.

public TimbnQuestRun? CurrentRun { get; }

Property Value

TimbnQuestRun

Id

The quest id, which is also its first stage's id. Saves keep progress under it.

public string Id { get; }

Property Value

string

Stage

The name of the stage the player is on, or null for a quest without stages or one not in progress. Between two stages, once one is done and before the next starts, it is the next stage. When the quest's own calls are its first stage, that stage's name is the quest id.

public string? Stage { get; }

Property Value

string

Status

The quest's status in the loaded save, or null when no save is loaded or the quest was skipped because another mod adds one with the same id. A quest with stages is in progress from its first stage starting until its last stage is completed, the moment between two stages included, and completed once its last stage is.

public QuestStatus? Status { get; }

Property Value

QuestStatus?

Methods

Cancel()

Ends the current run early, whether or not the player took the quest on. Every stage goes back to not started and leaves the log, and a quest with a Setup waits for the next NewRun. It does nothing once a quest that is not repeatable is done.

public bool Cancel()

Returns

bool

True when a run or a quest in progress was canceled.

Complete()

Completes the stage the player is on straight away, or the quest when it has no stages, for something your own code decides is done, talk or not. It pays the rewards, plays the DoneLines and runs OnDone. It does nothing unless that stage has started.

public bool Complete()

Returns

bool

True when it was completed.

MarkReady()

Marks the stage the player is on ready, for a quest or stage that waits on ReadyByCode. It does nothing unless that stage has started, so it is safe to call whenever the thing happens.

public bool MarkReady()

Returns

bool

True when it was marked.

MarkReady(string)

Marks one stage ready, and only while the player is on that stage.

public bool MarkReady(string stage)

Parameters

stage string

The stage's name.

Returns

bool

True when it was marked.

NewRun()

Rolls a new run of a quest with a Setup, such as on a lucky new day. Setup fills it, then the giver offers the quest, or it starts straight away when it has no Offer or StartsOn. It does nothing while a run is going, while the quest is in progress or done, or until OfferAfter and OfferWhen allow it.

public bool NewRun()

Returns

bool

True when a run was rolled.

Examples

Events.NewDayStarted(_ =>
{
    if (UnityEngine.Random.Range(0, 7) == 0)
        craving.NewRun();
});

Reset()

Puts the quest, every stage included, back to not started in the loaded save, as if the player had never taken it, so it can be played again while testing. Items and money already handed over stay spent.

public bool Reset()

Returns

bool

True when the quest was reset, false when no save is loaded.

Start()

Starts the quest in the loaded save, for a quest with no offer or one your own code hands out. It does nothing once the quest has started or finished.

public bool Start()

Returns

bool

True when the quest started.