CommonLibSSE (powerof3)
TESPackage.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSPointerHandle.h"
4 #include "RE/F/FormTypes.h"
5 #include "RE/T/TESCondition.h"
6 #include "RE/T/TESForm.h"
7 
8 namespace 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,
166  kUnlocksDoorsAtPackageEnd = 1 << 7,
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,
193  kObserveCombatBehaviour = 1 << 2,
194  kGreetCorpseBehaviour = 1 << 3,
195  kReactionToPlayerActions = 1 << 4,
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:
216  union Target
217  {
218  inline Target() :
219  object(nullptr)
220  {}
221 
222  ~Target() {}
223 
224  // members
229  std::uint32_t aliasID;
231  };
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
238  Target target; // 08
239  std::int32_t value; // 10
240  std::uint32_t pad14; // 14
241  };
242  static_assert(sizeof(PackageTarget) == 0x18);
243 
245  {
246  enum class DayOfWeek
247  {
248  kAny = -1,
249  kSunday = 0,
250  kMonday = 1,
251  kTuesday = 2,
252  kWednesday = 3,
253  kThursday = 4,
254  kFriday = 5,
255  kSaturday = 6,
256  kWeekdays = 7,
257  kWeekends = 8,
259  kTuesdayThursday = 10
260  };
261 
262  // members
263  std::int8_t month; // 0
265  std::int8_t date; // 2
266  std::int8_t hour; // 3
267  std::int8_t minute; // 4
268  std::uint8_t pad5; // 5
269  std::uint8_t pad6; // 6
270  std::uint8_t pad7; // 7
271  std::int32_t duration; // 8 - minutes
272  };
273  static_assert(sizeof(PACK_SCHED_DATA) == 0xC);
274 
275  class PackageSchedule // PSDT
276  {
277  public:
278  // members
280  };
281  static_assert(sizeof(PackageSchedule) == 0xC);
282 
284  {
285  public:
286  struct TopicData // PDTO
287  {
288  enum class Type
289  {
290  kTopicRef = 0,
291  kTopicSubtype = 1
292  };
293 
294  // members
296  std::uint32_t pad04; // 04
297  TESTopic* topic; // 08
298  };
299  static_assert(sizeof(TopicData) == 0x10);
300 
301  // members
302  TESIdleForm* idle; // 00 - INAM
304  std::uint32_t pad0C; // 0C
305  TopicData topic; // 10 - PDTO
306  };
307  static_assert(sizeof(PackageEventAction) == 0x20);
308 
309  class TESPackage : public TESForm
310  {
311  public:
312  inline static constexpr auto RTTI = RTTI_TESPackage;
313  inline static constexpr auto VTABLE = VTABLE_TESPackage;
314  inline static constexpr auto FORMTYPE = FormType::Package;
315 
316  struct ChangeFlags
317  {
318  enum ChangeFlag : std::uint32_t
319  {
320  kWaitingFlag = 1 << 26,
321  kNeverRunFlag = (std::uint32_t)1 << 31
322  };
323  };
324 
325  struct RecordFlags
326  {
327  enum RecordFlag : std::uint32_t
328  {
329  kDeleted = 1 << 5,
330  kIgnored = 1 << 12
331  };
332  };
333 
334  ~TESPackage() override; // 00
335 
336  // override (TESForm)
337  void InitializeData() override; // 04
338  void ClearData() override; // 05
339  bool Load(TESFile* a_mod) override; // 06
340  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
341  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
342  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
343  void InitItemImpl() override; // 13
344  std::uint32_t GetRefCount() const override; // 2D - { return refCount; }
345  [[nodiscard]] const char* GetObjectTypeName() const override; // 39 - { return g_packageTypeStrings[packData.packType]; }
346 
347  // add
348  virtual bool IsActorAtLocation(Actor* a_actor, bool a_arg2, float a_arg3, bool a_arg4); // 3B
349  virtual bool IsActorAtSecondLocation(Actor* a_arg1, Actor* a_arg2, bool a_arg3, float a_arg4, bool a_arg5); // 3C
350  virtual bool IsActorAtRefTarget(Actor* a_actor, std::int32_t a_arg2); // 3D
351  virtual bool IsTargetAtLocation(Actor* a_actor, std::int32_t a_arg2); // 3E
352  virtual bool IsPackageOwner(Actor* a_actor); // 3F - { return true; }
353 
355  {
356  using func_t = decltype(&TESPackage::CreatePackage);
357  static REL::Relocation<func_t> func{ RELOCATION_ID(28732, 29496) };
358  return func(a_type);
359  }
360 
362  {
363  using func_t = decltype(&TESPackage::SetPackType);
364  static REL::Relocation<func_t> func{ RELOCATION_ID(28751, 29525) };
365  return func(this, a_type);
366  }
367 
368  // members
369  PACKAGE_DATA packData; // 20 - PKDT
370  std::uint32_t pad2C; // 2C
376  std::uint32_t pad5C; // 5C
379  TESQuest* ownerQuest; // 70 - QNAM
384  volatile std::uint32_t refCount; // DC
385  };
386  static_assert(sizeof(TESPackage) == 0xE0);
387 }
#define RELOCATION_ID(SE, AE)
Definition: PCH.h:505
Definition: Relocation.h:210
Definition: Actor.h:133
Definition: BGSIdleCollection.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSSaveFormBuffer.h:8
Definition: TESPackage.h:284
TESIdleForm * idle
Definition: TESPackage.h:299
TopicData topic
Definition: TESPackage.h:305
REX::EnumSet< PACK_EVENT_ACTION_TYPE, std::uint32_t > type
Definition: TESPackage.h:303
std::uint32_t pad0C
Definition: TESPackage.h:304
Definition: PackageLocation.h:11
Definition: TESPackage.h:276
PACK_SCHED_DATA psData
Definition: TESPackage.h:279
Definition: TESPackage.h:214
std::uint32_t pad14
Definition: TESPackage.h:240
std::int8_t targType
Definition: TESPackage.h:232
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:36
Definition: TESIdleForm.h:37
Definition: TESPackageData.h:10
Definition: TESPackage.h:310
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:381
std::uint32_t GetRefCount() const override
void Revert(BGSLoadFormBuffer *a_buf) override
void SetPackType(PACKAGE_PROCEDURE_TYPE a_type)
Definition: TESPackage.h:361
void SaveGame(BGSSaveFormBuffer *a_buf) override
~TESPackage() override
void ClearData() override
std::uint32_t pad2C
Definition: TESPackage.h:370
static TESPackage * CreatePackage(PACKAGE_PROCEDURE_TYPE a_type)
Definition: TESPackage.h:354
static constexpr auto VTABLE
Definition: TESPackage.h:313
static constexpr auto RTTI
Definition: TESPackage.h:312
TESCombatStyle * combatStyle
Definition: TESPackage.h:378
static constexpr auto FORMTYPE
Definition: TESPackage.h:314
PackageEventAction onChange
Definition: TESPackage.h:382
TESQuest * ownerQuest
Definition: TESPackage.h:379
PackageEventAction onBegin
Definition: TESPackage.h:380
const char * GetObjectTypeName() const override
TESPackageData * data
Definition: TESPackage.h:371
REX::EnumSet< PACKAGE_PROCEDURE_TYPE, std::uint32_t > procedureType
Definition: TESPackage.h:383
volatile std::uint32_t refCount
Definition: TESPackage.h:384
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:369
void InitializeData() override
BGSIdleCollection * idleCollection
Definition: TESPackage.h:374
std::uint32_t pad5C
Definition: TESPackage.h:376
PackageSchedule packSched
Definition: TESPackage.h:375
PackageTarget * packTarg
Definition: TESPackage.h:373
PackageLocation * packLoc
Definition: TESPackage.h:372
bool Load(TESFile *a_mod) override
virtual bool IsActorAtLocation(Actor *a_actor, bool a_arg2, float a_arg3, bool a_arg4)
TESCondition packConditions
Definition: TESPackage.h:377
void LoadGame(BGSLoadFormBuffer *a_buf) override
Definition: TESQuest.h:189
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
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:245
std::int32_t duration
Definition: TESPackage.h:271
std::uint8_t pad6
Definition: TESPackage.h:269
DayOfWeek
Definition: TESPackage.h:247
std::int8_t month
Definition: TESPackage.h:263
std::int8_t minute
Definition: TESPackage.h:267
std::int8_t hour
Definition: TESPackage.h:266
REX::EnumSet< DayOfWeek, std::int8_t > dayOfWeek
Definition: TESPackage.h:264
std::uint8_t pad7
Definition: TESPackage.h:270
std::uint8_t pad5
Definition: TESPackage.h:268
std::int8_t date
Definition: TESPackage.h:265
Definition: TESPackage.h:287
REX::EnumSet< Type, std::uint32_t > type
Definition: TESPackage.h:295
std::uint32_t pad04
Definition: TESPackage.h:296
Type
Definition: TESPackage.h:289
TESTopic * topic
Definition: TESPackage.h:297
Definition: TESPackage.h:317
ChangeFlag
Definition: TESPackage.h:319
@ kNeverRunFlag
Definition: TESPackage.h:321
@ kWaitingFlag
Definition: TESPackage.h:320
Definition: TESPackage.h:326
RecordFlag
Definition: TESPackage.h:328
@ kIgnored
Definition: TESPackage.h:330
@ kDeleted
Definition: TESPackage.h:329
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