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 
35  {
36  kNone = static_cast<std::underlying_type_t<PACKAGE_PROCEDURE_TYPE>>(-1),
37  kFind = 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  kFind2 = 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  };
77 
79  {
80  kBegin = 0,
81  kEnd,
82  kChange,
83  kPatrol
84  };
85 
87  {
88  kNone = static_cast<std::underlying_type_t<PACK_INTERRUPT_TARGET>>(-1),
89  kSpectator = 0,
90  kObserveDead = 0x1,
91  kGuardWarn = 0x2,
92  kCombat = 0x3
93  };
94 
95  struct PACKAGE_DATA // PKDT
96  {
97  public:
98  enum class GeneralFlag
99  {
100  kNone = 0,
101  kOffersServices = 1 << 0,
102  kMustComplete = 1 << 2,
103  kMaintainSpeedAtGoal = 1 << 3,
105  kUnlocksDoorsAtPackageEnd = 1 << 7,
106  kContinueIfPCNear = 1 << 9,
107  kOncePerDay = 1 << 10,
108  kPreferredSpeed = 1 << 13,
109  kAlwaysSneak = 1 << 17,
110  kAllowSwimming = 1 << 18,
111  kIgnoreCombat = 1 << 20,
112  kWeaponsUnequipped = 1 << 21,
113  kWeaponDrawn = 1 << 23,
114  kNoCombatAlert = 1 << 27,
115  kWearSleepOutfit = 1 << 29
116  };
117 
118  enum class PreferredSpeed
119  {
120  kWalk = 0,
121  kJog = 1,
122  kRun = 2,
123  kFastWalk = 3
124  };
125 
126  enum class InterruptFlag
127  {
128  kNone = 0,
129  kHellosToPlayer = 1 << 0,
130  kRandomConversations = 1 << 1,
131  kObserveCombatBehaviour = 1 << 2,
132  kGreetCorpseBehaviour = 1 << 3,
133  kReactionToPlayerActions = 1 << 4,
134  kFriendlyFireComments = 1 << 5,
135  kAggroRadiusBehavior = 1 << 6,
136  kAllowIdleChatter = 1 << 7,
137  kWorldInteractions = 1 << 9
138  };
139 
140  // members
145  std::uint8_t pad7; // 7
147  std::uint16_t packageSpecificFlags; // A
148  };
149  static_assert(sizeof(PACKAGE_DATA) == 0xC);
150 
152  {
153  public:
154  union Target
155  {
156  inline Target() :
157  object(nullptr)
158  {}
159 
160  ~Target() {}
161 
162  // members
167  std::uint32_t aliasID;
169  };
170  static_assert(sizeof(Target) == 0x8);
171 
172  // members
173  std::int8_t targType; // 00
174  std::uint8_t pad01; // 01
175  std::uint16_t pad02; // 02
176  Target target; // 08
177  std::int32_t value; // 10
178  std::uint32_t pad14; // 14
179  };
180  static_assert(sizeof(PackageTarget) == 0x18);
181 
183  {
184  enum class DayOfWeek
185  {
186  kAny = -1,
187  kSunday = 0,
188  kMonday = 1,
189  kTuesday = 2,
190  kWednesday = 3,
191  kThursday = 4,
192  kFriday = 5,
193  kSaturday = 6,
194  kWeekdays = 7,
195  kWeekends = 8,
197  kTuesdayThursday = 10
198  };
199 
200  // members
201  std::int8_t month; // 0
203  std::int8_t date; // 2
204  std::int8_t hour; // 3
205  std::int8_t minute; // 4
206  std::uint8_t pad5; // 5
207  std::uint8_t pad6; // 6
208  std::uint8_t pad7; // 7
209  std::int32_t duration; // 8 - minutes
210  };
211  static_assert(sizeof(PACK_SCHED_DATA) == 0xC);
212 
213  class PackageSchedule // PSDT
214  {
215  public:
216  // members
218  };
219  static_assert(sizeof(PackageSchedule) == 0xC);
220 
222  {
223  public:
224  struct TopicData // PDTO
225  {
226  enum class Type
227  {
228  kTopicRef = 0,
229  kTopicSubtype = 1
230  };
231 
232  // members
234  std::uint32_t pad04; // 04
235  TESTopic* topic; // 08
236  };
237  static_assert(sizeof(TopicData) == 0x10);
238 
239  // members
240  TESIdleForm* idle; // 00 - INAM
242  std::uint32_t pad0C; // 0C
243  TopicData topic; // 10 - PDTO
244  };
245  static_assert(sizeof(PackageEventAction) == 0x20);
246 
247  class TESPackage : public TESForm
248  {
249  public:
250  inline static constexpr auto RTTI = RTTI_TESPackage;
251  inline static constexpr auto FORMTYPE = FormType::Package;
252 
253  struct ChangeFlags
254  {
255  enum ChangeFlag : std::uint32_t
256  {
257  kWaitingFlag = 1 << 26,
258  kNeverRunFlag = (std::uint32_t)1 << 31
259  };
260  };
261 
262  struct RecordFlags
263  {
264  enum RecordFlag : std::uint32_t
265  {
266  kDeleted = 1 << 5,
267  kIgnored = 1 << 12
268  };
269  };
270 
271  ~TESPackage() override; // 00
272 
273  // override (TESForm)
274  void InitializeData() override; // 04
275  void ClearData() override; // 05
276  bool Load(TESFile* a_mod) override; // 06
277  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
278  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
279  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
280  void InitItemImpl() override; // 13
281  std::uint32_t GetRefCount() const override; // 2D - { return refCount; }
282  [[nodiscard]] const char* GetObjectTypeName() const override; // 39 - { return g_packageTypeStrings[packData.packType]; }
283 
284  // add
285  virtual bool IsActorAtLocation(Actor* a_actor, bool a_arg2, float a_arg3, bool a_arg4); // 3B
286  virtual bool IsActorAtSecondLocation(Actor* a_arg1, Actor* a_arg2, bool a_arg3, float a_arg4, bool a_arg5); // 3C
287  virtual bool IsActorAtRefTarget(Actor* a_actor, std::int32_t a_arg2); // 3D
288  virtual bool IsTargetAtLocation(Actor* a_actor, std::int32_t a_arg2); // 3E
289  virtual bool IsPackageOwner(Actor* a_actor); // 3F - { return true; }
290 
291  // members
292  PACKAGE_DATA packData; // 20 - PKDT
293  std::uint32_t pad2C; // 2C
299  std::uint32_t pad5C; // 5C
302  TESQuest* ownerQuest; // 70 - QNAM
307  volatile std::uint32_t refCount; // DC
308  };
309  static_assert(sizeof(TESPackage) == 0xE0);
310 }
Definition: Actor.h:125
Definition: BGSIdleCollection.h:10
Definition: TESPackage.h:222
TESIdleForm * idle
Definition: TESPackage.h:237
stl::enumeration< PACK_EVENT_ACTION_TYPE, std::uint32_t > type
Definition: TESPackage.h:241
TopicData topic
Definition: TESPackage.h:243
std::uint32_t pad0C
Definition: TESPackage.h:242
Definition: PackageLocation.h:11
Definition: TESPackage.h:214
PACK_SCHED_DATA psData
Definition: TESPackage.h:217
Definition: TESPackage.h:152
std::uint32_t pad14
Definition: TESPackage.h:178
std::int8_t targType
Definition: TESPackage.h:170
std::uint8_t pad01
Definition: TESPackage.h:174
std::int32_t value
Definition: TESPackage.h:177
std::uint16_t pad02
Definition: TESPackage.h:175
Target target
Definition: TESPackage.h:176
Definition: TESCombatStyle.h:65
Definition: TESCondition.h:987
Definition: TESFile.h:14
Definition: TESForm.h:34
Definition: TESIdleForm.h:35
Definition: TESPackageData.h:10
Definition: TESPackage.h:248
stl::enumeration< PACKAGE_PROCEDURE_TYPE, std::uint32_t > procedureType
Definition: TESPackage.h:306
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:304
std::uint32_t GetRefCount() const override
void Revert(BGSLoadFormBuffer *a_buf) override
void SaveGame(BGSSaveFormBuffer *a_buf) override
~TESPackage() override
void ClearData() override
std::uint32_t pad2C
Definition: TESPackage.h:293
static constexpr auto RTTI
Definition: TESPackage.h:250
TESCombatStyle * combatStyle
Definition: TESPackage.h:301
static constexpr auto FORMTYPE
Definition: TESPackage.h:251
PackageEventAction onChange
Definition: TESPackage.h:305
TESQuest * ownerQuest
Definition: TESPackage.h:302
PackageEventAction onBegin
Definition: TESPackage.h:303
const char * GetObjectTypeName() const override
TESPackageData * data
Definition: TESPackage.h:294
volatile std::uint32_t refCount
Definition: TESPackage.h:307
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:292
void InitializeData() override
BGSIdleCollection * idleCollection
Definition: TESPackage.h:297
std::uint32_t pad5C
Definition: TESPackage.h:299
PackageSchedule packSched
Definition: TESPackage.h:298
PackageTarget * packTarg
Definition: TESPackage.h:296
PackageLocation * packLoc
Definition: TESPackage.h:295
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:300
void LoadGame(BGSLoadFormBuffer *a_buf) override
Definition: TESQuest.h:189
Definition: TESTopic.h:135
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_TESPackage
Definition: Offsets_RTTI.h:6046
PACK_EVENT_ACTION_TYPE
Definition: TESPackage.h:79
PACKAGE_OBJECT_TYPE
Definition: TESPackage.h:15
PACK_INTERRUPT_TARGET
Definition: TESPackage.h:87
PACKAGE_PROCEDURE_TYPE
Definition: TESPackage.h:35
Definition: TESPackage.h:96
stl::enumeration< PACKAGE_PROCEDURE_TYPE, std::uint8_t > packType
Definition: TESPackage.h:142
stl::enumeration< InterruptFlag, std::uint16_t > foBehaviorFlags
Definition: TESPackage.h:146
stl::enumeration< GeneralFlag, std::uint32_t > packFlags
Definition: TESPackage.h:141
GeneralFlag
Definition: TESPackage.h:99
std::uint16_t packageSpecificFlags
Definition: TESPackage.h:147
PreferredSpeed
Definition: TESPackage.h:119
stl::enumeration< PACK_INTERRUPT_TARGET, std::uint8_t > interruptOverrideType
Definition: TESPackage.h:143
std::uint8_t pad7
Definition: TESPackage.h:145
InterruptFlag
Definition: TESPackage.h:127
stl::enumeration< PreferredSpeed, std::uint8_t > maxSpeed
Definition: TESPackage.h:144
Definition: TESPackage.h:183
std::int32_t duration
Definition: TESPackage.h:209
std::uint8_t pad6
Definition: TESPackage.h:207
DayOfWeek
Definition: TESPackage.h:185
stl::enumeration< DayOfWeek, std::int8_t > dayOfWeek
Definition: TESPackage.h:202
std::int8_t month
Definition: TESPackage.h:201
std::int8_t minute
Definition: TESPackage.h:205
std::int8_t hour
Definition: TESPackage.h:204
std::uint8_t pad7
Definition: TESPackage.h:208
std::uint8_t pad5
Definition: TESPackage.h:206
std::int8_t date
Definition: TESPackage.h:203
Definition: TESPackage.h:225
stl::enumeration< Type, std::uint32_t > type
Definition: TESPackage.h:233
std::uint32_t pad04
Definition: TESPackage.h:234
Type
Definition: TESPackage.h:227
TESTopic * topic
Definition: TESPackage.h:235
Definition: TESPackage.h:254
ChangeFlag
Definition: TESPackage.h:256
@ kNeverRunFlag
Definition: TESPackage.h:258
@ kWaitingFlag
Definition: TESPackage.h:257
Definition: TESPackage.h:263
RecordFlag
Definition: TESPackage.h:265
@ kIgnored
Definition: TESPackage.h:267
@ kDeleted
Definition: TESPackage.h:266
Definition: TESPackage.h:155
stl::enumeration< PACK_INTERRUPT_TARGET, std::uint32_t > interruptTarg
Definition: TESPackage.h:168
stl::enumeration< PACKAGE_OBJECT_TYPE, std::uint32_t > objType
Definition: TESPackage.h:166
Target()
Definition: TESPackage.h:156
TESForm * object
Definition: TESPackage.h:164
ObjectRefHandle handle
Definition: TESPackage.h:163
~Target()
Definition: TESPackage.h:160
std::uint32_t aliasID
Definition: TESPackage.h:167
TESForm * refOrObj
Definition: TESPackage.h:165