Class TimbnQuestRun
One play of a quest whose details change each time, such as which villager asks and for what. A quest's Setup fills it when the mod calls NewRun, Core keeps it with the save until the play ends, and every part of the quest that takes a run reads it. Each value has a name, and text anywhere in the quest shows it with that name in braces, such as {dish}. An NPC shows as their name, an item as its name, a text value as its line (all in the player's language, looked up as the text shows), and a number as itself.
public sealed class TimbnQuestRun
- Inheritance
-
TimbnQuestRun
- Inherited Members
Examples
.Setup(run =>
{
run.Npc("villager", TimbnGameIds.Npcs.Larry).Item("dish", "cook_muffin").Number("count", 2);
return true;
})
.Description("Bring {villager} {count} {dish}.")
.Cost((cost, run) => cost.Item(run.Item("dish"), run.Number("count")))
Properties
Day
The game day the run was rolled on, as Day counts them.
public int Day { get; }
Property Value
Methods
Item(string)
Reads an item value set in Setup.
public string Item(string name)
Parameters
namestringThe value's name.
Returns
- string
The item id.
Item(string, string)
Sets an item value, shown in text as the item's name.
public TimbnQuestRun Item(string name, string itemId)
Parameters
namestringA short name of lowercase letters, digits and underscores, starting with a letter.
itemIdstringThe item id, with its quality suffix where it has one, such as grape_wine:2.
Returns
- TimbnQuestRun
This run, for chaining.
Npc(string)
Reads an NPC value set in Setup, the same as NpcId(string).
public string Npc(string name)
Parameters
namestringThe value's name.
Returns
- string
The NPC id.
Npc(string, string)
Sets an NPC value, shown in text as the NPC's name.
public TimbnQuestRun Npc(string name, string npcId)
Parameters
namestringA short name of lowercase letters, digits and underscores, starting with a letter.
npcIdstringThe NPC, from TimbnGameIds.Npcs.
Returns
- TimbnQuestRun
This run, for chaining.
NpcId(string)
Reads an NPC value set in Setup.
public string NpcId(string name)
Parameters
namestringThe value's name.
Returns
- string
The NPC id.
Number(string)
Reads a number value set in Setup.
public int Number(string name)
Parameters
namestringThe value's name.
Returns
- int
The number.
Number(string, int)
Sets a number value, shown in text as the number.
public TimbnQuestRun Number(string name, int value)
Parameters
namestringA short name of lowercase letters, digits and underscores, starting with a letter.
valueintThe number.
Returns
- TimbnQuestRun
This run, for chaining.
Text(string)
Reads a text value set in Setup.
public string Text(string name)
Parameters
namestringThe value's name.
Returns
- string
The line's localization key.
Text(string, string)
Sets a text value, the localization key of a line that shows in place of {name}, so one quest can say a different thing on each run, such as an answer that names what the player brings. Add the line with Text.Add or a lang file, and a translation of it shows in its place.
public TimbnQuestRun Text(string name, string key)
Parameters
namestringA short name of lowercase letters, digits and underscores, starting with a letter.
keystringThe line's localization key.
Returns
- TimbnQuestRun
This run, for chaining.
Examples
Text.Add("my_errand_potion", "I have some medication for you.");
...
.Setup(run => { run.Text("delivering", "my_errand_potion"); return true; })
.Talk(talk => talk.Accept("{delivering}"))