CommonLibVR
TESQuest.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BSAtomic.h"
5 #include "RE/B/BSFixedString.h"
6 #include "RE/B/BSString.h"
7 #include "RE/B/BSTArray.h"
8 #include "RE/B/BSTHashMap.h"
9 #include "RE/B/BSTList.h"
10 #include "RE/D/DialogueTypes.h"
11 #include "RE/F/FormTypes.h"
12 #include "RE/Q/QuestEvents.h"
14 #include "RE/T/TESCondition.h"
15 #include "RE/T/TESFullName.h"
16 
17 namespace RE
18 {
19  class BGSBaseAlias;
20  class QueuedPromoteQuestTask;
21 
22  enum class QuestFlag
23  {
24  kStopStart = static_cast<std::underlying_type_t<QuestFlag>>(-1),
25  kNone = 0,
26  kEnabled = 1 << 0,
27  kCompleted = 1 << 1,
28  kAddIdleToHello = 1 << 2,
29  kAllowRepeatStages = 1 << 3,
30  kStartsEnabled = 1 << 4,
31  kDisplayedInHUD = 1 << 5,
32  kFailed = 1 << 6,
33  kStageWait = 1 << 7,
34  kRunOnce = 1 << 8,
35  kExcludeFromExport = 1 << 9,
36  kWarnOnAliasFillFailure = 1 << 10,
37  kActive = 1 << 11,
38  kRepeatsConditions = 1 << 12,
39  kKeepInstance = 1 << 13,
40  kWantDormant = 1 << 14,
41  kHasDialogueData = 1 << 15
42  };
43 
45  {
46  kNone = 0,
47  kORWithPrevious = 1 << 0,
48  kNoStatsTracking = 1 << 1
49  };
50 
52  {
53  public:
54  struct StringData
55  {
56  public:
57  // members
58  std::uint32_t aliasID; // 0
59  std::uint32_t fullNameFormID; // 4
60  };
61  static_assert(sizeof(StringData) == 0x8);
62 
64  {
65  public:
66  // members
67  const TESGlobal* global; // 00
68  float value; // 08
69  std::uint32_t pad0C; // 0C
70  };
71  static_assert(sizeof(GlobalValueData) == 0x10);
72 
73  // members
74  std::uint32_t id; // 00
75  std::uint32_t pad04; // 04
78  std::uint16_t journalStage; // 38
79  std::int8_t journalStageItem; // 3A
80  std::uint8_t pad3B; // 3B
81  std::uint32_t pad3C; // 3C
82  };
83  static_assert(sizeof(BGSQuestInstanceText) == 0x40);
84 
85  struct QUEST_DATA // DNAM
86  {
87  public:
88  enum class Type
89  {
90  kNone = 0,
91  kMainQuest = 1,
92  kMagesGuild = 2,
93  kThievesGuild = 3,
94  kDarkBrotherhood = 4,
95  kCompanionsQuest = 5,
96  kMiscellaneous = 6,
97  kDaedric = 7,
98  kSideQuest = 8,
99  kCivilWar = 9,
100  kDLC01_Vampire = 10,
101  kDLC02_Dragonborn = 11
102  };
103 
104  // members
105  float questDelayTime; // 0
107  std::int8_t priority; // 6
109  };
110  static_assert(sizeof(QUEST_DATA) == 0x8);
111 
113  {
114  public:
115  enum class Flag
116  {
117  kNone = 0,
118  kStartUpStage = 1 << 1,
119  kShutDownStage = 1 << 2,
121  };
122 
123  // members
124  std::uint16_t index; // 0
126  std::uint8_t pad3; // 3
127  std::uint32_t pad4; // 4
128  };
129  static_assert(sizeof(QUEST_STAGE_DATA) == 0x8);
130 
132  {
133  public:
134  explicit operator bool() const;
135 
136  // members
138  private:
139  KEEP_FOR_RE()
140  };
141  static_assert(sizeof(TESQuestStage) == 0x8);
142 
143  class TESQuestTarget // QSTA
144  {
145  public:
146  enum class Flag
147  {
148  kNone = 0,
150  };
151 
152  // members
153  std::uint64_t unk00; // 00
155  std::uint8_t alias; // 10
156  std::uint8_t unk11; // 11
157  std::uint16_t unk12; // 12
158  std::uint32_t unk14; // 14
159  private:
160  KEEP_FOR_RE()
161  };
162  static_assert(sizeof(TESQuestTarget) == 0x18);
163 
165  {
166  public:
167  // members
170  TESQuestTarget** targets; // 10 - QSTA
171  std::uint32_t numTargets; // 18
172  std::uint16_t index; // 1C - QOBJ
173  bool initialized; // 1E
176  std::uint32_t pad24; // 24
177  private:
178  KEEP_FOR_RE()
179  };
180  static_assert(sizeof(BGSQuestObjective) == 0x28);
181 
183  {
184  public:
185  // members
186  std::uint32_t id; // 00
187  std::uint32_t index; // 04
188  std::uint64_t members[6]; // 08
189  private:
190  KEEP_FOR_RE()
191  };
192  static_assert(sizeof(BGSStoryEvent) == 0x38);
193 
194  class TESQuest :
195  public BGSStoryManagerTreeForm, // 000
196  public TESFullName // 028
197  {
198  public:
199  inline static constexpr auto RTTI = RTTI_TESQuest;
200  inline static constexpr auto VTABLE = VTABLE_TESQuest;
201 
202  using DT = DIALOGUE_TYPE;
203  inline static constexpr auto FORMTYPE = FormType::Quest;
204 
205  struct ChangeFlags
206  {
207  enum ChangeFlag : std::uint32_t
208  {
209  kQuestFlags = 1 << 1,
211  kQuestAlreadyRun = 1 << 26,
213  kQuestRuntimeData = 1 << 28,
214  kQuestObjectives = 1 << 29,
215  kQuestScript = 1 << 30,
216  kQuestStages = (std::uint32_t)1 << 31
217  };
218  };
219 
220  struct RecordFlags
221  {
222  enum RecordFlag : std::uint32_t
223  {
224  kDeleted = 1 << 5,
225  kIgnored = 1 << 12
226  };
227  };
228 
229  ~TESQuest() override; // 00
230 
231  // override (BGSStoryManagerTreeForm)
232  void InitializeData() override; // 04
233  void ClearData() override; // 05
234  bool Load(TESFile* a_mod) override; // 06
235  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
236  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
237  void FinishLoadGame(BGSLoadFormBuffer* a_buf) override; // 11
238  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
239  void InitItemImpl() override; // 13
240  const char* GetFormEditorID() const override; // 32 - { return formEditorID.c_str(); }
241  bool SetFormEditorID(const char* a_str) override; // 33
242  TESCondition* QConditions() override; // 3D - { return &objConditions; }
244 
245  ObjectRefHandle& CreateRefHandleByAliasID(ObjectRefHandle& a_handle, std::uint32_t a_aliasID);
246  bool EnsureQuestStarted(bool& a_result, bool a_startNow);
247  std::uint16_t GetCurrentStageID() const;
248  [[nodiscard]] constexpr QUEST_DATA::Type GetType() const noexcept { return data.questType.get(); }
249  bool IsActive() const;
250  bool IsCompleted() const;
251  bool IsEnabled() const;
252  bool IsRunning() const;
253  bool IsStarting() const;
254  bool IsStopped() const;
255  bool IsStopping() const;
256  void Reset();
258  void SetEnabled(bool a_set);
259  bool Start();
260  bool StartsEnabled() const;
261  void Stop();
262 
263  // members
265  std::uint32_t currentInstanceID; // 050
266  std::uint32_t pad054; // 054
269  BSTHashMap<UnkKey, UnkValue> unk0A0; // 0A0 - alias related
271  QUEST_DATA data; // 0D8 - DNAM
272  QuestEvent eventID; // 0E0 - ENAM
273  std::uint32_t pad0E4; // 0E4
280  BSTArray<TESTopic*> topics[DT::kTotal - DT::kBranchedTotal]; // 178
283  std::uint16_t currentStage; // 228
284  bool alreadyRun; // 22A
285  std::uint8_t pad22B; // 22B
286  std::uint32_t pad22C; // 22C
291  private:
292  KEEP_FOR_RE()
293  };
294  static_assert(sizeof(TESQuest) == 0x268);
295 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: BGSLoadFormBuffer.h:11
Definition: TESQuest.h:165
std::uint32_t pad24
Definition: TESQuest.h:176
TESQuestTarget ** targets
Definition: TESQuest.h:170
bool initialized
Definition: TESQuest.h:173
TESQuest * ownerQuest
Definition: TESQuest.h:169
stl::enumeration< QUEST_OBJECTIVE_FLAGS, std::uint32_t > flags
Definition: TESQuest.h:175
std::uint32_t numTargets
Definition: TESQuest.h:171
stl::enumeration< QUEST_OBJECTIVE_STATE, std::uint8_t > state
Definition: TESQuest.h:174
std::uint16_t index
Definition: TESQuest.h:172
BSFixedString displayText
Definition: TESQuest.h:168
Definition: BGSSaveFormBuffer.h:8
Definition: TESQuest.h:183
std::uint32_t id
Definition: TESQuest.h:186
std::uint64_t members[6]
Definition: TESQuest.h:188
std::uint32_t index
Definition: TESQuest.h:187
Definition: BGSStoryManagerTreeForm.h:47
Definition: BGSStoryManagerTreeForm.h:16
VisitControl
Definition: BGSStoryManagerTreeForm.h:22
Definition: BSAtomic.h:112
Definition: BSTList.h:10
Definition: BSTArray.h:378
Definition: BSTHashMap.h:21
Definition: TESCondition.h:992
Definition: TESFile.h:17
Definition: TESFullName.h:9
Definition: TESGlobal.h:10
Definition: TESQuest.h:132
QUEST_STAGE_DATA data
Definition: TESQuest.h:137
Definition: TESQuest.h:144
Flag
Definition: TESQuest.h:147
std::uint32_t unk14
Definition: TESQuest.h:158
std::uint64_t unk00
Definition: TESQuest.h:153
std::uint16_t unk12
Definition: TESQuest.h:157
TESCondition conditions
Definition: TESQuest.h:154
std::uint8_t unk11
Definition: TESQuest.h:156
std::uint8_t alias
Definition: TESQuest.h:155
Definition: TESQuest.h:197
std::uint16_t currentStage
Definition: TESQuest.h:283
void InitItemImpl() override
BSTArray< TESGlobal * > * textGlobals
Definition: TESQuest.h:282
TESCondition * QConditions() override
std::uint32_t pad054
Definition: TESQuest.h:266
BSTArray< BGSBaseAlias * > aliases
Definition: TESQuest.h:267
BGSStoryManagerTreeVisitor::VisitControl AcceptVisitor(BGSStoryManagerTreeVisitor &a_visitor) override
void InitializeData() override
BSTArray< BGSScene * > scenes
Definition: TESQuest.h:281
BSSimpleList< BGSQuestObjective * > objectives
Definition: TESQuest.h:276
BSTHashMap< std::uint32_t, ObjectRefHandle > refAliasMap
Definition: TESQuest.h:268
void SetEnabled(bool a_set)
BSTHashMap< UnkKey, UnkValue > unk0A0
Definition: TESQuest.h:269
bool IsCompleted() const
std::uint32_t pad0E4
Definition: TESQuest.h:273
bool IsEnabled() const
constexpr QUEST_DATA::Type GetType() const noexcept
Definition: TESQuest.h:248
BSSimpleList< TESQuestStage * > * waitingStages
Definition: TESQuest.h:275
~TESQuest() override
bool SetFormEditorID(const char *a_str) override
bool alreadyRun
Definition: TESQuest.h:284
bool IsStarting() const
BSTHashMap< BGSDialogueBranch *, BSTArray< TESTopic * > * > branchedDialogue[DT::kBranchedTotal]
Definition: TESQuest.h:279
void FinishLoadGame(BGSLoadFormBuffer *a_buf) override
void LoadGame(BGSLoadFormBuffer *a_buf) override
BSReadWriteLock aliasAccessLock
Definition: TESQuest.h:270
void ResetAndUpdate()
std::uint16_t GetCurrentStageID() const
const char * GetFormEditorID() const override
BSSimpleList< TESQuestStage > * executedStages
Definition: TESQuest.h:274
void ClearData() override
bool StartsEnabled() const
ObjectRefHandle & CreateRefHandleByAliasID(ObjectRefHandle &a_handle, std::uint32_t a_aliasID)
QUEST_DATA data
Definition: TESQuest.h:271
bool IsStopped() const
static constexpr auto FORMTYPE
Definition: TESQuest.h:203
std::uint32_t pad22C
Definition: TESQuest.h:286
const BGSStoryEvent * startEventData
Definition: TESQuest.h:288
BSTArray< BGSQuestInstanceText * > instanceData
Definition: TESQuest.h:264
bool IsActive() const
bool EnsureQuestStarted(bool &a_result, bool a_startNow)
void SaveGame(BGSSaveFormBuffer *a_buf) override
bool Load(TESFile *a_mod) override
TESCondition objConditions
Definition: TESQuest.h:277
TESCondition storyManagerConditions
Definition: TESQuest.h:278
static constexpr auto RTTI
Definition: TESQuest.h:199
bool IsStopping() const
NiPointer< QueuedPromoteQuestTask > promoteTask
Definition: TESQuest.h:289
BSString formEditorID
Definition: TESQuest.h:287
void Revert(BGSLoadFormBuffer *a_buf) override
BSTArray< ObjectRefHandle > promotedRefs
Definition: TESQuest.h:290
bool IsRunning() const
QuestEvent eventID
Definition: TESQuest.h:272
std::uint8_t pad22B
Definition: TESQuest.h:285
std::uint32_t currentInstanceID
Definition: TESQuest.h:265
static constexpr auto VTABLE
Definition: TESQuest.h:200
BSTArray< TESTopic * > topics[DT::kTotal - DT::kBranchedTotal]
Definition: TESQuest.h:280
constexpr enum_type get() const noexcept
Definition: PCH.h:263
Definition: AbsorbEffect.h:6
QuestEvent
Definition: QuestEvents.h:6
DIALOGUE_TYPES::DIALOGUE_TYPE DIALOGUE_TYPE
Definition: DialogueTypes.h:27
QuestFlag
Definition: TESQuest.h:23
constexpr REL::ID RTTI_TESQuest(static_cast< std::uint64_t >(513910))
constexpr std::array< REL::ID, 2 > VTABLE_TESQuest
Definition: Offsets_VTABLE.h:12880
@ kNone
Definition: PlayerCharacter.h:85
QUEST_OBJECTIVE_FLAGS
Definition: TESQuest.h:45
const TESGlobal * global
Definition: TESQuest.h:67
std::uint32_t pad0C
Definition: TESQuest.h:69
float value
Definition: TESQuest.h:68
Definition: TESQuest.h:55
std::uint32_t aliasID
Definition: TESQuest.h:58
std::uint32_t fullNameFormID
Definition: TESQuest.h:59
Definition: TESQuest.h:52
std::int8_t journalStageItem
Definition: TESQuest.h:79
std::uint32_t id
Definition: TESQuest.h:71
std::uint16_t journalStage
Definition: TESQuest.h:78
BSTArray< StringData > stringData
Definition: TESQuest.h:76
std::uint32_t pad04
Definition: TESQuest.h:75
std::uint32_t pad3C
Definition: TESQuest.h:81
std::uint8_t pad3B
Definition: TESQuest.h:80
BSTArray< GlobalValueData > valueData
Definition: TESQuest.h:77
DIALOGUE_TYPE
Definition: DialogueTypes.h:8
Definition: TESQuest.h:86
float questDelayTime
Definition: TESQuest.h:105
Type
Definition: TESQuest.h:89
stl::enumeration< Type, std::uint8_t > questType
Definition: TESQuest.h:108
stl::enumeration< QuestFlag, std::uint16_t > flags
Definition: TESQuest.h:106
std::int8_t priority
Definition: TESQuest.h:107
Definition: TESQuest.h:113
std::uint8_t pad3
Definition: TESQuest.h:126
std::uint32_t pad4
Definition: TESQuest.h:127
Flag
Definition: TESQuest.h:116
std::uint16_t index
Definition: TESQuest.h:124
stl::enumeration< Flag, std::uint8_t > flags
Definition: TESQuest.h:125
Definition: TESQuest.h:206
ChangeFlag
Definition: TESQuest.h:208
@ kQuestObjectives
Definition: TESQuest.h:214
@ kQuestFlags
Definition: TESQuest.h:209
@ kQuestInstanceData
Definition: TESQuest.h:212
@ kQuestScriptDelay
Definition: TESQuest.h:210
@ kQuestAlreadyRun
Definition: TESQuest.h:211
@ kQuestScript
Definition: TESQuest.h:215
@ kQuestRuntimeData
Definition: TESQuest.h:213
@ kQuestStages
Definition: TESQuest.h:216
Definition: TESQuest.h:221
RecordFlag
Definition: TESQuest.h:223
@ kIgnored
Definition: TESQuest.h:225
@ kDeleted
Definition: TESQuest.h:224