public sealed class QuestJournalOne character's quests: what is taken, how far along it is, and what it has finished.
Remarks
Two collaborators rather than one, and the split is deliberate. A journal evaluates requirements against an IRequirementContext and grants its tags into a GameplayTagSet, and in a real game those are different objects — the level and the profession live in a ProgressionState, the combat state in a GameplaySubject's effects. Taking one object would mean either depending on progression, which doc 28's spine forbids, or pretending a character's state has one owner, which it does not. CompositeRequirementContext is how a caller puts them together.
⚠ Turning a quest in grants its tag into that set, and a quest chain is a requirement. "You must have finished the prologue" is HasTag(Quest.Completed.Prologue), which is the same algebra a vendor uses — so the greyed-out giver and the refused accept cannot disagree, and there is no second mechanism for quest chains to be got wrong in.
⚠ Every stage transition drops the old tracker before making the new one. A tracker is a live set of bus subscriptions; leaving one behind is a stage that goes on counting after nobody is looking, and — since the objectives of two stages usually count the same verb — a second stage that starts already half done.
Fields and properties (8)
public QuestLibrary LibraryWhere the quests come from.
public GameplayEventBus BusWhere the events come from.
public PlayerId OwnerWhose events count.
public IRequirementContext? ContextWhat requirements are evaluated against.
public GameplayTagSet TagsThe tags its quests have granted.
public IEnumerable<ActiveQuest> ActiveEvery quest on it, in the order they were accepted.
public int CountHow many quests are on it.
public IEnumerable<KeyValuePair<DefId, QuestStatus>> HistoryEverything they have finished with, in id order.
Events (2)
public Action<QuestChange>? ChangedRaised whenever a quest changes state.
public Action<DefId, ObjectiveAdvance>? AdvancedRaised whenever an objective moves, with the quest it belongs to.
Methods (14)
public QuestJournal(QuestLibrary library, GameplayEventBus bus, PlayerId owner = default(PlayerId), IRequirementContext? context = null, GameplayTagSet? tags = null)Makes a journal for one character.
public QuestStatus StatusOf(DefId quest)Where a quest is.
public ActiveQuest? Find(DefId quest)One quest on the journal.
public QuestRefusal CanAccept(DefId quest)Whether a quest can be accepted, and why not.
public QuestRefusal Accept(DefId quest)Takes a quest.
public ActiveQuest? Seat(DefId quest, int stage, float elapsed)Puts a quest back on the journal with no checks at all.
public void SeatHistory(DefId quest, QuestStatus status)Puts a finished quest back in the history with no checks. The authority's, like Seat.
public static void SeatReady(ActiveQuest entry)Says a restored quest was already finished but not handed in.
public bool Abandon(DefId quest)Gives a quest up, dropping its progress and its tags.
public bool Fail(DefId quest)Fails a quest outright. What a scripted defeat does.
public QuestRefusal CanTurnIn(DefId quest, int choice = -1)Whether a quest can be turned in, and why not.
public QuestRefusal TurnIn(DefId quest, int choice, out QuestReward? reward)Turns a quest in and says what it owes.
public int Tick(float delta)Advances every stage clock and every timed objective.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- QuestJournalTestsVixen.Gameplay.Quests.Tests
- QuestSectionVixen.Live.Gameplay
- QuestSectionTestsVixen.Live.Gameplay.Tests