Vixen
caa30e12
csharp
public sealed class QuestModel

One quest, open for editing.

Read the guide page for this →

Remarks

The document is a QuestDefinition. The same bargain Vixen.Editor.Gameplay.Loot and Vixen.Editor.Ai make: a second representation is a second thing to migrate and a second place for the rules to differ from the ones the realm runs.

Every gesture is one operation and one Changed, so an undo stack is snapshot-in, snapshot-out rather than a per-field diff.

Fields and properties (2)

  • public QuestDefinition Quest

    What is being edited.

  • public int Count

    How many stages it has.

Events (1)

  • public Action<QuestModel>? Changed

    Raised after any operation.

Methods (10)

  • public QuestModel(QuestDefinition quest)

    Opens a quest.

  • public int AddStage(QuestStageDefinition? stage = null)

    Adds a stage.

  • public bool RemoveStage(int stage)

    Removes a stage.

  • public bool MoveStage(int from, int to)

    Moves a stage, which is what reordering a quest is.

  • public int AddObjective(int stage, QuestObjectiveDefinition? objective = null)

    Adds an objective to a stage.

  • public bool RemoveObjective(int stage, int objective)

    Removes an objective.

  • public bool Edit(int stage, int objective, Action<QuestObjectiveDefinition> edit)

    Edits an objective and raises one change for it.

  • public QuestDefinition Snapshot()

    A copy deep enough to restore, for an undo stack.

  • public void Restore(QuestDefinition snapshot)

    Puts a snapshot back.

  • public IReadOnlyList<QuestProblem> Validate(QuestObjectiveRegistry? objectives = null)

    What is wrong with it, as an inspector shows it.

Used by (1)

  • QuestModelTestsVixen.Editor.Gameplay.Quests.Tests