Table of Contents

Class TimbnQuestStage

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

One stage of a quest added with AddStage(string, string, Action<TimbnQuestStage>), with its own goal, talk and rewards. Core makes it a game quest of its own that continues the stage before.

public sealed class TimbnQuestStage
Inheritance
TimbnQuestStage
Inherited Members

Methods

Cost(Action<TimbnCost, TimbnQuestRun>)

A cost read from the quest's run, such as the dish the villager asked for.

public TimbnQuestStage Cost(Action<TimbnCost, TimbnQuestRun> cost)

Parameters

cost Action<TimbnCost, TimbnQuestRun>

Adds the cost.

Returns

TimbnQuestStage

This builder, for chaining.

Examples

.Cost((cost, run) => cost.Item(run.Item("dish")))

Cost(Action<TimbnCost>)

What the player pays to finish the stage, taken when they pick the talk's Accept answer, which shows it as the game's price and is grayed out until they can pay. The NPC only shows a speech bubble once they can.

public TimbnQuestStage Cost(Action<TimbnCost> cost)

Parameters

cost Action<TimbnCost>

Adds the cost.

Returns

TimbnQuestStage

This builder, for chaining.

DoneDescription(string)

The quest description once this stage is done. Left out, it keeps the stage's description.

public TimbnQuestStage DoneDescription(string text)

Parameters

text string

The text.

Returns

TimbnQuestStage

This stage, for chaining.

DoneLines(Action<TimbnLines>)

Lines that play once a stage with no Talk is done, such as the player thinking aloud on arriving somewhere. Use PlayerSay for those. A Say line comes from the quest giver wherever they stand. A stage with a Talk puts its lines after the Accept answer instead.

public TimbnQuestStage DoneLines(Action<TimbnLines> lines)

Parameters

lines Action<TimbnLines>

Adds the lines.

Returns

TimbnQuestStage

This builder, for chaining.

Examples

.ReadyOn(TimbnQuestEvent.EnteredWorldZone("vineyard_basement"))
.DoneLines(then => then.PlayerSay("This would be a good place to make wine."))

Icon(Func<TimbnQuestRun, string>)

The quest's icon read from its run, such as the icon of the item the villager asked for. Any sprite the game has works, item icons included. Before the first run it shows the icon from Icon(string).

public TimbnQuestStage Icon(Func<TimbnQuestRun, string> iconId)

Parameters

iconId Func<TimbnQuestRun, string>

Picks the icon's sprite id from the run.

Returns

TimbnQuestStage

This builder, for chaining.

Examples

.Icon(run => TimbnItems.IconId(run.Item("dish")))

Icon(string)

The quest's icon in the quest tree and log, such as quest_icon_larry_portal. Left out, a quest that continues another uses that quest's icon, and any other quest the game's default.

public TimbnQuestStage Icon(string iconId)

Parameters

iconId string

The icon's sprite id.

Returns

TimbnQuestStage

This builder, for chaining.

Name(string)

The stage's name in the quest tree and log. Left out, it uses the quest's name.

public TimbnQuestStage Name(string name)

Parameters

name string

The name.

Returns

TimbnQuestStage

This stage, for chaining.

Needs(Action<TimbnNeeds, TimbnQuestRun>)

Needs read from the quest's run, such as having the item the villager asked for.

public TimbnQuestStage Needs(Action<TimbnNeeds, TimbnQuestRun> needs)

Parameters

needs Action<TimbnNeeds, TimbnQuestRun>

Adds the needs.

Returns

TimbnQuestStage

This builder, for chaining.

Needs(Action<TimbnNeeds>)

What has to be true before the NPC offers the stage's Talk, checked but never taken, such as reputation with that NPC or the day of the week. When the NPC has a menu of its own, the talk's answer shows there with a lock for each until they are met.

public TimbnQuestStage Needs(Action<TimbnNeeds> needs)

Parameters

needs Action<TimbnNeeds>

Adds the needs.

Returns

TimbnQuestStage

This builder, for chaining.

OnDone(Action)

Runs your code once the stage is done, after the lines that follow the Accept answer, or as soon as they stop if they end early. A throw is logged.

public TimbnQuestStage OnDone(Action action)

Parameters

action Action

The code to run.

Returns

TimbnQuestStage

This builder, for chaining.

OnDoneExpression(string)

One of the game's script expressions, run once by the game the moment the quest is completed, such as RevealTech("tech_x"). See OnStartExpression(string).

public TimbnQuestStage OnDoneExpression(string expression)

Parameters

expression string

The game expression.

Returns

TimbnQuestStage

This builder, for chaining.

OnEnd(Action)

Runs your code when the quest stops being in progress, whether it is done, reset, the player leaves the save, or the plugin unloads, to undo what OnStart(Action) did. A throw is logged.

public TimbnQuestStage OnEnd(Action action)

Parameters

action Action

The code to run.

Returns

TimbnQuestStage

This builder, for chaining.

OnStart(Action)

Runs your code when the quest starts and again whenever a save loads with it in progress. Use it for effects that are not saved, such as a marker or a hold on the player, and undo them in OnEnd(Action). For a change that is saved, use OnStartExpression(string). A throw is logged.

public TimbnQuestStage OnStart(Action action)

Parameters

action Action

The code to run.

Returns

TimbnQuestStage

This builder, for chaining.

OnStartExpression(string)

One of the game's script expressions, run once by the game the moment the quest starts, such as AddPerk("perk_x") or $money += 50. Use it for changes that are saved, since the save keeps the result. The game also replays a RevealTech("...") here on load. Call it again to add more. A typo fails when the quest is added.

public TimbnQuestStage OnStartExpression(string expression)

Parameters

expression string

The game expression.

Returns

TimbnQuestStage

This builder, for chaining.

Phase(int)

Which of the game's five rings the quest's node in the quest tree shows while the quest is in progress, the way the game sets one for each of its own quests. The green grows further around with each ring, and a completed quest always shows the gold laurel. Left out, a step of a ContinuesFrom chain gets a ring by its place in the chain, growing as the story goes on like the game's own storylines, and a quest on its own shows the first ring.

public TimbnQuestStage Phase(int phase)

Parameters

phase int

The ring, 1 to 5.

Returns

TimbnQuestStage

This builder, for chaining.

ReadyByCode()

The quest also waits for your code to call its MarkReady, such as when the player reaches a place.

public TimbnQuestStage ReadyByCode()

Returns

TimbnQuestStage

This builder, for chaining.

ReadyOn(TimbnQuestEvent)

The quest also waits for something the player does in the game, such as sleeping or crafting.

public TimbnQuestStage ReadyOn(TimbnQuestEvent gameEvent)

Parameters

gameEvent TimbnQuestEvent

The event.

Returns

TimbnQuestStage

This builder, for chaining.

Reward(Action<TimbnRewards, TimbnQuestRun>)

A reward read from the quest's run, such as the sale price of the dish the villager asked for.

public TimbnQuestStage Reward(Action<TimbnRewards, TimbnQuestRun> rewards)

Parameters

rewards Action<TimbnRewards, TimbnQuestRun>

Adds the rewards.

Returns

TimbnQuestStage

This builder, for chaining.

Examples

.Reward((reward, run) => reward.Money(TimbnItems.SalePrice(run.Item("dish"))))

Reward(Action<TimbnRewards>)

What the player gets when the stage is done. A Talk's Accept answer shows it, and the game pays it when the answer is picked. Otherwise Core pays it when the stage completes.

public TimbnQuestStage Reward(Action<TimbnRewards> rewards)

Parameters

rewards Action<TimbnRewards>

Adds the rewards.

Returns

TimbnQuestStage

This builder, for chaining.

Talk(Action<TimbnQuestTalk>)

The conversation that finishes the stage, with the NPC from TalksWith(string) or the quest giver. Its Accept answer takes the stage's Cost(Action<TimbnCost>), gives its Reward(Action<TimbnRewards>) and completes the stage. Accept with no text completes the stage once the lines are done, for something the NPC simply hands over. See TimbnQuestTalk.

public TimbnQuestStage Talk(Action<TimbnQuestTalk> talk)

Parameters

talk Action<TimbnQuestTalk>

Scripts the talk. It needs an Accept.

Returns

TimbnQuestStage

This builder, for chaining.

Examples

.Reward(reward => reward.Item("grape_wine:3"))
.Talk(talk => talk
    .PlayerSay("I'm here for my wine.")
    .Say("Found it, here you go.")
    .Accept())

TalksWith(Func<TimbnQuestRun, string>)

The NPC the stage's Talk is with, read from the quest's run, such as the villager a delivery goes to.

public TimbnQuestStage TalksWith(Func<TimbnQuestRun, string> npcId)

Parameters

npcId Func<TimbnQuestRun, string>

Picks the NPC from the run.

Returns

TimbnQuestStage

This builder, for chaining.

TalksWith(string)

The NPC the stage's Talk is with, such as TimbnGameIds.Npcs.Herm for a job Larry sends the player on. Left out, it is the quest giver.

public TimbnQuestStage TalksWith(string npcId)

Parameters

npcId string

The NPC, from TimbnGameIds.Npcs.

Returns

TimbnQuestStage

This builder, for chaining.