Table of Contents

Class QuestObjective

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

An objective that a QuestStage displays, completes, or fails.

public sealed class QuestObjective
Inheritance
QuestObjective
Inherited Members

Remarks

An objective created with no index has the lowest index of the stages that display it. The saved state records the index, and each is unique in its quest. A token <Alias=Name> in the text is replaced, as the objective is displayed, with the name of the reference or location that fills that alias. An alias converts to its token in an interpolated string: $"Bring {friend} a sweetroll".

Constructors

QuestObjective()

Creates an objective with the index of the stage that displays it, whose text SetText(QuestObjective, string) sets.

public QuestObjective()

QuestObjective(Func<string>)

Creates an objective with the index of the stage that displays it and a computed text.

public QuestObjective(Func<string> text)

Parameters

text Func<string>

Returns the text the journal shows. It is called each time a stage displays the objective.

Exceptions

ArgumentNullException

text is null.

QuestObjective(string)

Creates an objective with the index of the stage that displays it and a fixed text.

public QuestObjective(string text)

Parameters

text string

The text the journal shows.

Exceptions

ArgumentNullException

text is null.

QuestObjective(ushort)

Creates an objective whose text SetText(QuestObjective, string) sets before a stage displays it.

public QuestObjective(ushort index)

Parameters

index ushort

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

QuestObjective(ushort, Func<string>)

Creates an objective with a computed text.

public QuestObjective(ushort index, Func<string> text)

Parameters

index ushort

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

text Func<string>

Returns the text the journal shows. It is called each time a stage displays the objective.

Exceptions

ArgumentNullException

text is null.

QuestObjective(ushort, string)

Creates an objective with a fixed text.

public QuestObjective(ushort index, string text)

Parameters

index ushort

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

text string

The text the journal shows.

Exceptions

ArgumentNullException

text is null.

Properties

Index

The index the objective was created with. Null means the index of the stage that displays it.

public ushort? Index { get; }

Property Value

ushort?

LocationTargets

The location aliases whose locations' world location markers the objective's markers point at while it is neither completed nor failed.

public IReadOnlyList<QuestLocationAlias> LocationTargets { get; init; }

Property Value

IReadOnlyList<QuestLocationAlias>

Remarks

A location with no world location marker shows no marker and is logged.

Exceptions

ArgumentNullException

The value is null.

Quest

The quest the objective belongs to.

public IRuntimeQuest Quest { get; }

Property Value

IRuntimeQuest

Exceptions

InvalidOperationException

No quest whose stages display, complete, or fail the objective has been created.

Targets

The aliases the objective's markers point at while it is neither completed nor failed.

public IReadOnlyList<QuestReferenceAlias> Targets { get; init; }

Property Value

IReadOnlyList<QuestReferenceAlias>

Exceptions

ArgumentNullException

The value is null.

Methods

Complete()

Marks the objective completed, replacing a failure, as Complete(QuestObjective) does.

public void Complete()

Exceptions

InvalidOperationException

No quest declares the objective, or the quest has not displayed it.

Display()

Displays the objective, as Display(QuestObjective) does.

public void Display()

Exceptions

InvalidOperationException

No quest declares the objective, or it has no text declared or set.

Fail()

Marks the objective failed, replacing a completion, as Fail(QuestObjective) does.

public void Fail()

Exceptions

InvalidOperationException

No quest declares the objective, or the quest has not displayed it.

SetTargetReferences<TReference>(params IEnumerable<FormId<TReference>>)

Sets the references the objective's markers point at besides the aliases in Targets, as SetTargetReferences<TReference>(QuestObjective, params IEnumerable<FormId<TReference>>) does.

public void SetTargetReferences<TReference>(params IEnumerable<FormId<TReference>> referenceIds) where TReference : struct, IObjectReference

Parameters

referenceIds IEnumerable<FormId<TReference>>

Type Parameters

TReference

Exceptions

ArgumentNullException

referenceIds is null.

InvalidOperationException

No quest declares the objective.

SetText(string)

Sets the text the objective displays, replacing its declared text, as SetText(QuestObjective, string) does.

public void SetText(string text)

Parameters

text string

Exceptions

ArgumentNullException

text is null.

InvalidOperationException

No quest declares the objective.