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