Table of Contents

Class QuestStage

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

A stage of a quest, which SetAsync() sets once.

public sealed class QuestStage
Inheritance
QuestStage
Inherited Members

Remarks

Setting the stage completes ObjectivesToComplete, fails ObjectivesToFail, ends the other open objectives as OpenObjectivesOutcome states, displays ObjectivesToDisplay, writes the log entry as the quest's description, ends the quest as QuestOutcome states, starts ScenesToStart, and then runs OnSet, in that order.

Constructors

QuestStage(ushort)

A stage of a quest, which SetAsync() sets once.

public QuestStage(ushort index)

Parameters

index ushort

The stage's index, unique among the quest's stages and the same in every version of the plugin. The saved state records it.

Remarks

Setting the stage completes ObjectivesToComplete, fails ObjectivesToFail, ends the other open objectives as OpenObjectivesOutcome states, displays ObjectivesToDisplay, writes the log entry as the quest's description, ends the quest as QuestOutcome states, starts ScenesToStart, and then runs OnSet, in that order.

QuestStage(ushort, Func<string>)

Creates a stage whose log entry is computed each time it is set.

public QuestStage(ushort index, Func<string> logEntry)

Parameters

index ushort

The stage's index, unique among the quest's stages and the same in every version of the plugin. The saved state records it.

logEntry Func<string>

Returns the paragraph the journal shows under the quest's name from this stage onward. It is called as the stage is set, before the stage changes anything, so an exception it throws leaves the stage unset. Its alias tokens are replaced as QuestObjective describes.

Exceptions

ArgumentNullException

logEntry is null.

Properties

Index

The stage's index.

public ushort Index { get; }

Property Value

ushort

IsCurrent

Whether the stage is set last of the quest's stages in the loaded game, as Current returns.

public bool IsCurrent { get; }

Property Value

bool

Exceptions

InvalidOperationException

No quest declares the stage.

IsDone

Whether the stage is set in the loaded game.

public bool IsDone { get; }

Property Value

bool

Exceptions

InvalidOperationException

No quest declares the stage.

LogEntry

The paragraph the journal shows under the quest's name from this stage on. Null leaves the description unchanged, and is the value for a stage created with a computed log entry.

public string? LogEntry { get; init; }

Property Value

string

Remarks

Its alias tokens are replaced as the stage is set, as QuestObjective describes.

Exceptions

InvalidOperationException

The stage was created with a computed log entry.

ObjectivesToComplete

The objectives the stage completes. An objective that is not displayed, or is already completed or failed, is unchanged.

public IReadOnlyList<QuestObjective> ObjectivesToComplete { get; init; }

Property Value

IReadOnlyList<QuestObjective>

Exceptions

ArgumentNullException

The value is null.

ObjectivesToDisplay

The objectives the stage displays.

public IReadOnlyList<QuestObjective> ObjectivesToDisplay { get; init; }

Property Value

IReadOnlyList<QuestObjective>

Exceptions

ArgumentNullException

The value is null.

ObjectivesToFail

The objectives the stage fails. An objective that is not displayed, or is already completed or failed, is unchanged.

public IReadOnlyList<QuestObjective> ObjectivesToFail { get; init; }

Property Value

IReadOnlyList<QuestObjective>

Exceptions

ArgumentNullException

The value is null.

OnSet

Runs on the thread that sets the stage, once it is set.

public Func<QuestStageContext, Task>? OnSet { get; init; }

Property Value

Func<QuestStageContext, Task>

Remarks

It does not run again when a save is loaded. The task SetAsync(QuestStage) returns completes once this one does, and an exception it throws faults that task, with the stage set.

OpenObjectivesOutcome

The outcome the stage gives every open objective other than those it names in ObjectivesToComplete, ObjectivesToFail, and ObjectivesToDisplay. Null means QuestOutcome, and leaves them open when that is null as well.

public QuestOutcome? OpenObjectivesOutcome { get; init; }

Property Value

QuestOutcome?

Quest

The quest the stage belongs to.

public IRuntimeQuest Quest { get; }

Property Value

IRuntimeQuest

Exceptions

InvalidOperationException

No quest that declares the stage has been created.

QuestOutcome

The outcome the stage gives the quest, and its open objectives unless OpenObjectivesOutcome is set. Null leaves the quest open.

public QuestOutcome? QuestOutcome { get; init; }

Property Value

QuestOutcome?

ScenesToStart

The scenes the stage starts. The quest declares every scene a stage starts.

public IReadOnlyList<QuestScene> ScenesToStart { get; init; }

Property Value

IReadOnlyList<QuestScene>

Remarks

A scene that does not start is logged, and the stage is set regardless.

Exceptions

ArgumentNullException

The value is null.

Methods

SetAsync()

Sets the stage, as SetAsync(QuestStage) does.

public Task<bool> SetAsync()

Returns

Task<bool>

A task whose result is whether this call set the stage. The stage is applied before this returns, and the task completes once OnSet does. An exception a computed log entry throws faults the task and leaves the stage unset.

Exceptions

InvalidOperationException

No quest declares the stage. The task also faults with this exception where the stage cannot be set, as SetAsync(QuestStage) describes.