CommonLibVR
Loading...
Searching...
No Matches
TESPackage.h
Go to the documentation of this file.
1#pragma once
2
4#include "RE/F/FormTypes.h"
5#include "RE/T/TESCondition.h"
6#include "RE/T/TESForm.h"
7
8namespace RE
9{
10 class BGSIdleCollection;
11 class PackageLocation;
12 class TESPackageData;
13
15 {
16 kNone = 0,
17 kACTI = 1,
18 kARMO = 2,
19 kBOOK = 3,
20 kCONT = 4,
21 kDOOR = 5,
22 kINGR = 6,
23 kLIGH = 7,
24 kMISC = 8,
25 kFLOR = 9,
26 kFURN = 10,
27 kWEAP = 11,
28 kAMMO = 12,
29 kKEYM = 13,
30 kALCH = 14,
31 kFOOD = 15
32 };
33
34 enum class PACKAGE_TYPE
35 {
36 kNone = static_cast<std::underlying_type_t<PACKAGE_TYPE>>(-1),
37 kExplore = 0,
38 kFollow = 1,
39 kEscort = 2,
40 kEat = 3,
41 kSleep = 4,
42 kWander = 5,
43 kTravel = 6,
44 kAccompany = 7,
45 kUseItemAt = 8,
46 kAmbush = 9,
47 kFleeNotCombat = 10,
48 kCastMagic = 11,
49 kSandbox = 12,
50 kPatrol = 13,
51 kGuard = 14,
52 kDialogue = 15,
53 kUseWeapon = 16,
54 kFind = 17,
55 kPackage = 18,
56 kPackageTemplate = 19,
57 kActivate = 20,
58 kAlarm = 21,
59 kFlee = 22,
60 kTrespass = 23,
61 kSpectator = 24,
62 kReactToDead = 25,
63 kGetUpFromChairBed = 26,
64 kDoNothing = 27,
65 kInGameDialogue = 28,
66 kSurface = 29,
67 kSearchForAttacker = 30,
68 kAvoidPlayer = 31,
69 kReactToDestroyedObject = 32,
70 kReactToGrenadeOrMine = 33,
71 kStealWarning = 34,
72 kPickPocketWarning = 35,
73 kMovementBlocked = 36,
74 kVampireFeed = 37,
75 kCannibal = 38,
76 kLanding = 39,
77 kUnused = 40,
78 kMountActor = 41,
79 kDismountActor = 42,
80 kClearMountPosition = 43,
81
82 kTotal = 44
83 };
84
86 {
87 kNone = static_cast<std::underlying_type_t<PACKAGE_PROCEDURE_TYPE>>(-1),
88 kExploreTravel = 0,
89 kExploreWander = 1,
90 ExploreActivate = 2,
91 kExploreAcquire = 3,
92 kSleep = 4,
93 kEat = 5,
94 kFollowWithEscort = 6,
95 kAmbushFollow = 7,
96 kEscortActor = 8,
97 kEscortObject = 9,
98 kDialogue = 10,
99 kAlarm = 11,
100 kActivate = 12,
101 kGreet = 13,
102 kObserveCombat = 14,
103 kObserveDialogue = 15,
104 kTalkToDead = 16,
105 kFlee = 17,
106 kTrespass = 18,
107 kGetUpFromChairBed = 19,
108 kExploreNPC = 20,
109 kMountActor = 21,
110 kDismountActor = 22,
111 kDoNothing = 23,
112 kExploreAcquireGeneric = 24,
113 kAccompany = 25,
114 kUseItemAt = 26,
115 kVampireFeed = 27,
116 kAmbush = 28,
117 kSurface = 29,
118 kFleeNotCombat = 30,
119 kSearchForAttacker = 31,
120 kClearMountPosition = 32,
121 kWaitForDialogue = 33,
122 kAvoidPlayer = 34,
123 kSandbox = 35,
124 kPatrol = 36,
125 kReactToDestroyedObject = 37,
126 kReactToGrenadeOrMine = 38,
127 kGuard = 39,
128 kStealWarning = 40,
129 kPickPocketWarning = 41,
130 kUseWeapon = 42,
131 kFollowWithoutEscort = 43,
132 kMovementBlocked = 44,
133 kCannibal = 45,
134 kPackage = 46,
135 kLanding = 47,
136 kKeepAnEyeOn = 48
137 };
138
140 {
141 kBegin = 0,
142 kEnd,
143 kChange,
144 kPatrol
145 };
146
148 {
149 kNone = static_cast<std::underlying_type_t<PACK_INTERRUPT_TARGET>>(-1),
150 kSpectator = 0,
151 kObserveDead = 0x1,
152 kGuardWarn = 0x2,
153 kCombat = 0x3
154 };
155
156 struct PACKAGE_DATA // PKDT
157 {
158 public:
159 enum class GeneralFlag
160 {
161 kNone = 0,
162 kOffersServices = 1 << 0,
163 kMustComplete = 1 << 2,
164 kMaintainSpeedAtGoal = 1 << 3,
167 kContinueIfPCNear = 1 << 9,
168 kOncePerDay = 1 << 10,
169 kCreated = 1 << 11,
170 kPreferredSpeed = 1 << 13,
171 kAlwaysSneak = 1 << 17,
172 kAllowSwimming = 1 << 18,
173 kIgnoreCombat = 1 << 20,
174 kWeaponsUnequipped = 1 << 21,
175 kWeaponDrawn = 1 << 23,
176 kNoCombatAlert = 1 << 27,
177 kWearSleepOutfit = 1 << 29
178 };
179
180 enum class PreferredSpeed
181 {
182 kWalk = 0,
183 kJog = 1,
184 kRun = 2,
185 kFastWalk = 3
186 };
187
188 enum class InterruptFlag
189 {
190 kNone = 0,
191 kHellosToPlayer = 1 << 0,
192 kRandomConversations = 1 << 1,
194 kGreetCorpseBehaviour = 1 << 3,
196 kFriendlyFireComments = 1 << 5,
197 kAggroRadiusBehavior = 1 << 6,
198 kAllowIdleChatter = 1 << 7,
199 kWorldInteractions = 1 << 9
200 };
201
202 // members
207 std::uint8_t pad7; // 7
209 std::uint16_t packageSpecificFlags; // A
210 };
211 static_assert(sizeof(PACKAGE_DATA) == 0xC);
212
214 {
215 public:
232 static_assert(sizeof(Target) == 0x8);
233
234 // members
235 std::int8_t targType; // 00
236 std::uint8_t pad01; // 01
237 std::uint16_t pad02; // 02
239 std::int32_t value; // 10
240 std::uint32_t pad14; // 14
241 private:
243 };
244 static_assert(sizeof(PackageTarget) == 0x18);
245
247 {
248 enum class DayOfWeek
249 {
250 kAny = -1,
251 kSunday = 0,
252 kMonday = 1,
253 kTuesday = 2,
254 kWednesday = 3,
255 kThursday = 4,
256 kFriday = 5,
257 kSaturday = 6,
258 kWeekdays = 7,
259 kWeekends = 8,
262 };
263
264 // members
265 std::int8_t month; // 0
267 std::int8_t date; // 2
268 std::int8_t hour; // 3
269 std::int8_t minute; // 4
270 std::uint8_t pad5; // 5
271 std::uint8_t pad6; // 6
272 std::uint8_t pad7; // 7
273 std::int32_t duration; // 8 - minutes
274 };
275 static_assert(sizeof(PACK_SCHED_DATA) == 0xC);
276
277 class PackageSchedule // PSDT
278 {
279 public:
280 // members
282 private:
284 };
285 static_assert(sizeof(PackageSchedule) == 0xC);
286
288 {
289 public:
290 struct TopicData // PDTO
291 {
292 enum class Type
293 {
294 kTopicRef = 0,
295 kTopicSubtype = 1
296 };
297
298 // members
300 std::uint32_t pad04; // 04
302 };
303 static_assert(sizeof(TopicData) == 0x10);
304
305 // members
306 TESIdleForm* idle; // 00 - INAM
308 std::uint32_t pad0C; // 0C
309 TopicData topic; // 10 - PDTO
310 private:
312 };
313 static_assert(sizeof(PackageEventAction) == 0x20);
314
315 class TESPackage : public TESForm
316 {
317 public:
318 inline static constexpr auto RTTI = RTTI_TESPackage;
319 inline static constexpr auto VTABLE = VTABLE_TESPackage;
320 inline static constexpr auto FORMTYPE = FormType::Package;
321
323 {
324 enum ChangeFlag : std::uint32_t
325 {
326 kWaitingFlag = 1 << 26,
327 kNeverRunFlag = (std::uint32_t)1 << 31
328 };
329 };
330
332 {
333 enum RecordFlag : std::uint32_t
334 {
335 kDeleted = 1 << 5,
336 kIgnored = 1 << 12
337 };
338 };
339
340 ~TESPackage() override; // 00
341
342 // override (TESForm)
343 void InitializeData() override; // 04
344 void ClearData() override; // 05
345 bool Load(TESFile* a_mod) override; // 06
346 void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
347 void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
348 void Revert(BGSLoadFormBuffer* a_buf) override; // 12
349 void InitItemImpl() override; // 13
350 std::uint32_t GetRefCount() const override; // 2D - { return refCount; }
351 [[nodiscard]] const char* GetObjectTypeName() const override; // 39 - { return g_packageTypeStrings[packData.packType]; }
352
353 // add
354 virtual bool IsActorAtLocation(Actor* a_actor, bool a_arg2, float a_arg3, bool a_arg4); // 3B
355 virtual bool IsActorAtSecondLocation(Actor* a_arg1, Actor* a_arg2, bool a_arg3, float a_arg4, bool a_arg5); // 3C
356 virtual bool IsActorAtRefTarget(Actor* a_actor, std::int32_t a_arg2); // 3D
357 virtual bool IsTargetAtLocation(Actor* a_actor, std::int32_t a_arg2); // 3E
358 virtual bool IsPackageOwner(Actor* a_actor); // 3F - { return true; }
359
361 {
362 using func_t = decltype(&TESPackage::CreatePackage);
363 static REL::Relocation<func_t> func{ RELOCATION_ID(28732, 29496) };
364 return func(a_type);
365 }
366
368 {
369 using func_t = decltype(&TESPackage::SetPackType);
370 static REL::Relocation<func_t> func{ RELOCATION_ID(28751, 29525) };
371 return func(this, a_type);
372 }
373
374 // members
375 PACKAGE_DATA packData; // 20 - PKDT
376 std::uint32_t pad2C; // 2C
382 std::uint32_t pad5C; // 5C
385 TESQuest* ownerQuest; // 70 - QNAM
390 volatile std::uint32_t refCount; // DC
391 private:
393 };
394 static_assert(sizeof(TESPackage) == 0xE0);
395}
#define KEEP_FOR_RE()
Definition PCH.h:517
#define RELOCATION_ID(SE, AE)
Definition PCH.h:506
Definition Relocation.h:210
Definition EnumSet.h:9
Definition Actor.h:133
Definition BGSIdleCollection.h:10
Definition BGSLoadFormBuffer.h:11
Definition BGSSaveFormBuffer.h:8
Definition TESPackage.h:288
TESIdleForm * idle
Definition TESPackage.h:306
TopicData topic
Definition TESPackage.h:309
REX::EnumSet< PACK_EVENT_ACTION_TYPE, std::uint32_t > type
Definition TESPackage.h:307
std::uint32_t pad0C
Definition TESPackage.h:308
Definition PackageLocation.h:11
Definition TESPackage.h:278
PACK_SCHED_DATA psData
Definition TESPackage.h:281
Definition TESPackage.h:214
std::uint32_t pad14
Definition TESPackage.h:240
std::int8_t targType
Definition TESPackage.h:235
std::uint8_t pad01
Definition TESPackage.h:236
std::int32_t value
Definition TESPackage.h:239
std::uint16_t pad02
Definition TESPackage.h:237
Target target
Definition TESPackage.h:238
Definition TESCombatStyle.h:65
Definition TESCondition.h:992
Definition TESFile.h:17
Definition TESForm.h:40
Definition TESIdleForm.h:37
Definition TESPackageData.h:10
Definition TESPackage.h:316
void InitItemImpl() override
virtual bool IsActorAtSecondLocation(Actor *a_arg1, Actor *a_arg2, bool a_arg3, float a_arg4, bool a_arg5)
PackageEventAction onEnd
Definition TESPackage.h:387
std::uint32_t GetRefCount() const override
void Revert(BGSLoadFormBuffer *a_buf) override
void SetPackType(PACKAGE_PROCEDURE_TYPE a_type)
Definition TESPackage.h:367
void SaveGame(BGSSaveFormBuffer *a_buf) override
~TESPackage() override
void ClearData() override
std::uint32_t pad2C
Definition TESPackage.h:376
static constexpr auto VTABLE
Definition TESPackage.h:319
static constexpr auto RTTI
Definition TESPackage.h:318
TESCombatStyle * combatStyle
Definition TESPackage.h:384
static constexpr auto FORMTYPE
Definition TESPackage.h:320
PackageEventAction onChange
Definition TESPackage.h:388
TESQuest * ownerQuest
Definition TESPackage.h:385
PackageEventAction onBegin
Definition TESPackage.h:386
TESPackageData * data
Definition TESPackage.h:377
REX::EnumSet< PACKAGE_PROCEDURE_TYPE, std::uint32_t > procedureType
Definition TESPackage.h:389
volatile std::uint32_t refCount
Definition TESPackage.h:390
const char * GetObjectTypeName() const override
virtual bool IsActorAtRefTarget(Actor *a_actor, std::int32_t a_arg2)
virtual bool IsPackageOwner(Actor *a_actor)
virtual bool IsTargetAtLocation(Actor *a_actor, std::int32_t a_arg2)
PACKAGE_DATA packData
Definition TESPackage.h:375
void InitializeData() override
BGSIdleCollection * idleCollection
Definition TESPackage.h:380
std::uint32_t pad5C
Definition TESPackage.h:382
PackageSchedule packSched
Definition TESPackage.h:381
PackageTarget * packTarg
Definition TESPackage.h:379
PackageLocation * packLoc
Definition TESPackage.h:378
bool Load(TESFile *a_mod) override
static TESPackage * CreatePackage(PACKAGE_PROCEDURE_TYPE a_type)
Definition TESPackage.h:360
virtual bool IsActorAtLocation(Actor *a_actor, bool a_arg2, float a_arg3, bool a_arg4)
TESCondition packConditions
Definition TESPackage.h:383
void LoadGame(BGSLoadFormBuffer *a_buf) override
Definition TESQuest.h:197
Definition TESTopic.h:135
Definition AbsorbEffect.h:6
PACKAGE_TYPE
Definition TESPackage.h:35
PACK_EVENT_ACTION_TYPE
Definition TESPackage.h:140
PACKAGE_OBJECT_TYPE
Definition TESPackage.h:15
constexpr REL::ID RTTI_TESPackage(static_cast< std::uint64_t >(513902))
constexpr std::array< REL::ID, 1 > VTABLE_TESPackage
Definition Offsets_VTABLE.h:12875
@ kNone
Definition PlayerCharacter.h:85
PACK_INTERRUPT_TARGET
Definition TESPackage.h:148
PACKAGE_PROCEDURE_TYPE
Definition TESPackage.h:86
Definition TESPackage.h:157
REX::EnumSet< PACK_INTERRUPT_TARGET, std::uint8_t > interruptOverrideType
Definition TESPackage.h:205
REX::EnumSet< PreferredSpeed, std::uint8_t > maxSpeed
Definition TESPackage.h:206
REX::EnumSet< GeneralFlag, std::uint32_t > packFlags
Definition TESPackage.h:203
GeneralFlag
Definition TESPackage.h:160
REX::EnumSet< InterruptFlag, std::uint16_t > foBehaviorFlags
Definition TESPackage.h:208
std::uint16_t packageSpecificFlags
Definition TESPackage.h:209
PreferredSpeed
Definition TESPackage.h:181
REX::EnumSet< PACKAGE_TYPE, std::uint8_t > packType
Definition TESPackage.h:204
std::uint8_t pad7
Definition TESPackage.h:207
InterruptFlag
Definition TESPackage.h:189
Definition TESPackage.h:247
std::int32_t duration
Definition TESPackage.h:273
std::uint8_t pad6
Definition TESPackage.h:271
DayOfWeek
Definition TESPackage.h:249
std::int8_t month
Definition TESPackage.h:265
std::int8_t minute
Definition TESPackage.h:269
std::int8_t hour
Definition TESPackage.h:268
REX::EnumSet< DayOfWeek, std::int8_t > dayOfWeek
Definition TESPackage.h:266
std::uint8_t pad7
Definition TESPackage.h:272
std::uint8_t pad5
Definition TESPackage.h:270
std::int8_t date
Definition TESPackage.h:267
Definition TESPackage.h:291
REX::EnumSet< Type, std::uint32_t > type
Definition TESPackage.h:299
std::uint32_t pad04
Definition TESPackage.h:300
Type
Definition TESPackage.h:293
TESTopic * topic
Definition TESPackage.h:301
Definition TESPackage.h:323
ChangeFlag
Definition TESPackage.h:325
@ kNeverRunFlag
Definition TESPackage.h:327
@ kWaitingFlag
Definition TESPackage.h:326
Definition TESPackage.h:332
RecordFlag
Definition TESPackage.h:334
@ kIgnored
Definition TESPackage.h:336
@ kDeleted
Definition TESPackage.h:335
Definition TESPackage.h:217
REX::EnumSet< PACKAGE_OBJECT_TYPE, std::uint32_t > objType
Definition TESPackage.h:228
Target()
Definition TESPackage.h:218
TESForm * object
Definition TESPackage.h:226
REX::EnumSet< PACK_INTERRUPT_TARGET, std::uint32_t > interruptTarg
Definition TESPackage.h:230
ObjectRefHandle handle
Definition TESPackage.h:225
~Target()
Definition TESPackage.h:222
std::uint32_t aliasID
Definition TESPackage.h:229
TESForm * refOrObj
Definition TESPackage.h:227