-
Notifications
You must be signed in to change notification settings - Fork 258
Expand file tree
/
Copy pathTESQuest.h
More file actions
140 lines (121 loc) · 3.82 KB
/
Copy pathTESQuest.h
File metadata and controls
140 lines (121 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#pragma once
#include <Games/Primitives.h>
#include <Misc/BSString.h>
#include <Components/TESFullName.h>
#include <Forms/BGSStoryManagerTree.h>
struct BGSScene : TESForm
{
GameArray<void*> phases;
GameArray<uint32_t> actorIds;
};
struct TESQuest : BGSStoryManagerTreeForm
{
enum class State : uint8_t
{
WaitingPromotion,
Running,
Stopped,
WaitingForStage
};
enum Flags : uint16_t
{
StopStart = USHRT_MAX,
None = 0,
Enabled = 1 << 0,
Completed = 1 << 1,
AddIdleToHello = 1 << 2,
AllowRepeatStages = 1 << 3,
StartsEnabled = 1 << 4,
DisplayedInHUD = 1 << 5,
Failed = 1 << 6,
StageWait = 1 << 7,
RunOnce = 1 << 8,
ExcludeFromExport = 1 << 9,
WarnOnAliasFillFailure = 1 << 10,
Active = 1 << 11,
RepeatsConditions = 1 << 12,
KeepInstance = 1 << 13,
WantDormant = 1 << 14,
HasDialogueData = 1 << 15
};
enum class Type : uint8_t
{
None = 0,
MainQuest = 1,
MagesGuild = 2,
ThievesGuild = 3,
DarkBrotherhood = 4,
CompanionsQuest = 5,
Miscellaneous = 6,
Daedric = 7,
SideQuest = 8,
CivilWar = 9,
DLC01_Vampire = 10,
DLC02_Dragonborn = 11
};
struct Objective
{
BSFixedString nameRef; // 0x0000
TESQuest* parent; // 0x0008
char pad10[12]; // 0x0010
uint16_t stageId;
uint8_t pad30;
uint8_t state;
};
static_assert(offsetof(Objective, state) == 31);
struct Stage
{
uint16_t stageIndex;
uint8_t flags;
inline bool IsDone() { return flags & 1; }
};
TESFullName fullName;
GameArray<void*> instanceData;
uint32_t currentInstanceID;
GameArray<void*> aliases; // 0x0058
char pad70[0xD8 - 0x70];
float questDelay; // 0x00D8
uint16_t flags; // 0x00DC default init: 256
uint8_t priority; // 0x00DE
Type type; // 0x00DF
int32_t scopedStatus; // 0x00E0 default init: -1, if not -1 outside of story manager scope
uint32_t padE4;
GameList<Stage> stages;
/*
GameList<Stage>* pExecutedStages; // 0x00E8
GameList<Stage>* pWaitingStages; // 0x00F0
*/
GameList<Objective> objectives; // 0x00F8
char pad108[0x100]; // 0x0108
GameArray<BGSScene*> scenes; // 0x0208
char pad210[8]; // 0x0210
uint16_t currentStage; // 0x0228
bool alreadyRun; // 0x022A
char pad22B[2];
BSString idName; // < this is the proper quest ID
void* pStartEventData;
uint64_t unkFlags;
char pad250[24];
TESObjectREFR* GetAliasedRef(uint32_t aiAliasID) noexcept;
bool IsStageDone(uint16_t stageIndex);
void SetCompleted(bool force);
void CompleteAllObjectives();// completes all objectives + stages
void SetActive(bool toggle); // < is the quest selected in journal and followed?
inline void Disable() { flags &= ~Flags::Enabled; };
inline bool IsEnabled() const { return flags & Flags::Enabled; }
inline bool IsActive() const { return flags & Flags::Active; }
inline bool IsStopped() const { return (flags & (Flags::Enabled | Flags::StageWait)) == 0; } // & 0x81
bool Kill();
State getState();
bool EnsureQuestStarted(bool &succeded, bool force);
bool SetStage(uint16_t stage);
void ScriptSetStage(uint16_t stage);
void SetStopped();
};
static_assert(sizeof(TESQuest) == 0x268);
static_assert(offsetof(TESQuest, fullName) == 0x28);
static_assert(offsetof(TESQuest, flags) == 0xDC);
static_assert(offsetof(TESQuest, stages) == 0xE8);
static_assert(offsetof(TESQuest, objectives) == 0xF8);
static_assert(offsetof(TESQuest, currentStage) == 0x228);
static_assert(offsetof(TESQuest, unkFlags) == 0x248);