CommonLibSSE NG
TESActorBaseData.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSTArray.h"
5 #include "RE/F/FactionRank.h"
6 
7 namespace RE
8 {
9  class BGSVoiceType;
10  class TESActorBase;
11  class TESFaction;
12  class TESForm;
13  class TESLevItem;
14  class TESNPC;
15 
17  {
18  public:
19  enum class Flag
20  {
21  kNone = 0,
22  kFemale = 1 << 0,
23  kEssential = 1 << 1,
24  kIsChargenFacePreset = 1 << 2,
25  kRespawn = 1 << 3,
26  kAutoCalcStats = 1 << 4,
27  kUnique = 1 << 5,
29  kPCLevelMult = 1 << 7,
30  kUsesTemplate = 1 << 8,
31  kCalcForAllTemplates = 1 << 9,
32  kProtected = 1 << 11,
33  kNoRumors = 1 << 13,
34  kSummonable = 1 << 14,
35  kDoesntBleed = 1 << 16,
36  kBleedoutOverride = 1 << 18,
37  kOppositeGenderAnims = 1 << 19,
38  kSimpleActor = 1 << 20,
39  kLoopedScript = 1 << 21, // ?
40  kNoActivation = 1 << 23,
41  kLoopedAudio = 1 << 28, // ?
42  kIsGhost = 1 << 29,
43  kInvulnerable = 1 << 31
44  };
45 
46  enum class TEMPLATE_USE_FLAG
47  {
48  kNone = 0,
49  kTraits = 1 << 0,
50  kStats = 1 << 1,
51  kFactions = 1 << 2,
52  kSpells = 1 << 3,
53  kAIData = 1 << 4,
54  kAIPackages = 1 << 5,
55  kUnused = 1 << 6,
56  kBaseData = 1 << 7,
57  kInventory = 1 << 8,
58  kScript = 1 << 9,
59  kAIDefPackList = 1 << 10,
60  kAttackData = 1 << 11,
61  kKeywords = 1 << 12,
62  kCopiedTemplate = 1 << 15
63  };
64 
65  // members
67  std::int16_t magickaOffset; // 04
68  std::int16_t staminaOffset; // 06
69  std::uint16_t level; // 08
70  std::uint16_t calcLevelMin; // 0A
71  std::uint16_t calcLevelMax; // 0C
72  std::uint16_t speedMult; // 0E
73  std::uint16_t baseDisposition; // 10 - unused
75  std::int16_t healthOffset; // 14
76  std::int16_t bleedoutOverride; // 16
77  };
78  static_assert(sizeof(ACTOR_BASE_DATA) == 0x18);
79 
80  class TESActorBaseData : public BaseFormComponent // ACBS
81  {
82  public:
83  inline static constexpr auto RTTI = RTTI_TESActorBaseData;
84 
85  ~TESActorBaseData() override;
86 
87  // override (BaseFormComponent)
88  void InitializeDataComponent() override; // 01
89  void ClearDataComponent() override; // 02
90  void CopyComponent(BaseFormComponent* a_rhs) override; // 03
91 
92  // add
93  virtual void CopyFromTemplateForms(TESActorBase** a_templateForms); // 04 - { return; }
94  [[nodiscard]] virtual bool GetIsGhost() const; // 05 - { return (flags >> 29) & 1; }
95  [[nodiscard]] virtual bool GetInvulnerable() const; // 06 - { test flags, 80000000h; }
96  virtual void Unk_07(void); // 07 - { return 1; }
97  virtual BGSVoiceType* GetVoiceType(void); // 08 - { return voice; }
98 
99  [[nodiscard]] constexpr bool AffectsStealthMeter() const noexcept { return actorData.actorBaseFlags.none(ACTOR_BASE_DATA::Flag::kDoesntAffectStealthMeter); }
100  [[nodiscard]] constexpr bool Bleeds() const noexcept { return actorData.actorBaseFlags.none(ACTOR_BASE_DATA::Flag::kDoesntBleed); }
101  [[nodiscard]] constexpr bool IsEssential() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kEssential); }
102  [[nodiscard]] constexpr bool IsFemale() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kFemale); }
103  [[nodiscard]] inline bool IsGhost() const { return GetIsGhost(); }
104  [[nodiscard]] constexpr bool IsPreset() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kIsChargenFacePreset); }
105  [[nodiscard]] constexpr bool IsProtected() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kProtected); }
106  [[nodiscard]] constexpr bool IsSimpleActor() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kSimpleActor); }
107  [[nodiscard]] constexpr bool IsSummonable() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kSummonable); }
108  [[nodiscard]] constexpr bool IsUnique() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kUnique); }
109  [[nodiscard]] inline bool IsInvulnerable() const { return GetInvulnerable(); }
110  [[nodiscard]] constexpr bool HasAutoCalcStats() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kAutoCalcStats); }
111  [[nodiscard]] constexpr bool HasBleedoutOverride() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kBleedoutOverride); }
112  [[nodiscard]] constexpr bool HasPCLevelMult() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kPCLevelMult); }
113  [[nodiscard]] constexpr bool Respawns() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kRespawn); }
114  [[nodiscard]] constexpr bool UsesOppositeGenderAnims() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kOppositeGenderAnims); }
115  [[nodiscard]] constexpr bool UsesTemplate() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kUsesTemplate); }
116 
117  [[nodiscard]] std::uint16_t GetLevel() const
118  {
119  using func_t = decltype(&TESActorBaseData::GetLevel);
120  REL::Relocation<func_t> func{ RELOCATION_ID(14262, 14384) };
121  return func(this);
122  }
123 
124  // members
126  TESLevItem* deathItem; // 20 - INAM
127  BGSVoiceType* voiceType; // 28 - VTCK
128  TESForm* baseTemplateForm; // 30 - TPLT
131  };
132  static_assert(sizeof(TESActorBaseData) == 0x58);
133 }
#define RELOCATION_ID(a_se, a_ae)
Definition: PCH.h:724
Definition: Relocation.h:204
Definition: BGSVoiceType.h:25
Definition: BSTArray.h:377
Definition: BaseFormComponent.h:8
Definition: TESActorBaseData.h:81
TESLevItem * deathItem
Definition: TESActorBaseData.h:126
ACTOR_BASE_DATA actorData
Definition: TESActorBaseData.h:125
constexpr bool HasAutoCalcStats() const noexcept
Definition: TESActorBaseData.h:110
void CopyComponent(BaseFormComponent *a_rhs) override
TESForm ** templateForms
Definition: TESActorBaseData.h:129
constexpr bool UsesTemplate() const noexcept
Definition: TESActorBaseData.h:115
constexpr bool IsSummonable() const noexcept
Definition: TESActorBaseData.h:107
constexpr bool HasBleedoutOverride() const noexcept
Definition: TESActorBaseData.h:111
constexpr bool IsEssential() const noexcept
Definition: TESActorBaseData.h:101
std::uint16_t GetLevel() const
Definition: TESActorBaseData.h:117
constexpr bool IsPreset() const noexcept
Definition: TESActorBaseData.h:104
constexpr bool IsSimpleActor() const noexcept
Definition: TESActorBaseData.h:106
TESForm * baseTemplateForm
Definition: TESActorBaseData.h:128
virtual BGSVoiceType * GetVoiceType(void)
BGSVoiceType * voiceType
Definition: TESActorBaseData.h:127
static constexpr auto RTTI
Definition: TESActorBaseData.h:83
virtual bool GetIsGhost() const
constexpr bool Bleeds() const noexcept
Definition: TESActorBaseData.h:100
constexpr bool UsesOppositeGenderAnims() const noexcept
Definition: TESActorBaseData.h:114
virtual bool GetInvulnerable() const
~TESActorBaseData() override
bool IsInvulnerable() const
Definition: TESActorBaseData.h:109
constexpr bool IsUnique() const noexcept
Definition: TESActorBaseData.h:108
virtual void CopyFromTemplateForms(TESActorBase **a_templateForms)
constexpr bool Respawns() const noexcept
Definition: TESActorBaseData.h:113
virtual void Unk_07(void)
bool IsGhost() const
Definition: TESActorBaseData.h:103
constexpr bool HasPCLevelMult() const noexcept
Definition: TESActorBaseData.h:112
constexpr bool AffectsStealthMeter() const noexcept
Definition: TESActorBaseData.h:99
constexpr bool IsFemale() const noexcept
Definition: TESActorBaseData.h:102
constexpr bool IsProtected() const noexcept
Definition: TESActorBaseData.h:105
BSTArray< FACTION_RANK > factions
Definition: TESActorBaseData.h:130
void InitializeDataComponent() override
void ClearDataComponent() override
Definition: TESActorBase.h:32
Definition: TESForm.h:36
Definition: TESLevItem.h:12
constexpr bool none(Args... a_args) const noexcept requires(std
Definition: PCH.h:302
constexpr bool all(Args... a_args) const noexcept requires(std
Definition: PCH.h:295
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_TESActorBaseData(513939, 392580, 0x1edb3b0)
Definition: TESActorBaseData.h:17
stl::enumeration< TEMPLATE_USE_FLAG, std::uint16_t > templateUseFlags
Definition: TESActorBaseData.h:74
stl::enumeration< Flag, std::uint32_t > actorBaseFlags
Definition: TESActorBaseData.h:66
std::uint16_t baseDisposition
Definition: TESActorBaseData.h:73
std::int16_t healthOffset
Definition: TESActorBaseData.h:75
std::int16_t staminaOffset
Definition: TESActorBaseData.h:68
std::int16_t bleedoutOverride
Definition: TESActorBaseData.h:76
TEMPLATE_USE_FLAG
Definition: TESActorBaseData.h:47
std::uint16_t calcLevelMax
Definition: TESActorBaseData.h:71
std::uint16_t level
Definition: TESActorBaseData.h:69
std::uint16_t calcLevelMin
Definition: TESActorBaseData.h:70
Flag
Definition: TESActorBaseData.h:20
std::int16_t magickaOffset
Definition: TESActorBaseData.h:67
std::uint16_t speedMult
Definition: TESActorBaseData.h:72