CommonLibSSE (powerof3)
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  inline static constexpr auto VTABLE = VTABLE_TESActorBaseData;
85 
86  ~TESActorBaseData() override;
87 
88  // override (BaseFormComponent)
89  void InitializeDataComponent() override; // 01
90  void ClearDataComponent() override; // 02
91  void CopyComponent(BaseFormComponent* a_rhs) override; // 03
92 
93  // add
94  virtual void CopyFromTemplateForms(TESActorBase** a_templateForms); // 04 - { return; }
95  [[nodiscard]] virtual bool GetIsGhost() const; // 05 - { return (flags >> 29) & 1; }
96  [[nodiscard]] virtual bool GetInvulnerable() const; // 06 - { test flags, 80000000h; }
97  virtual void Unk_07(void); // 07 - { return 1; }
98  virtual BGSVoiceType* GetVoiceType(void); // 08 - { return voice; }
99 
100  [[nodiscard]] constexpr bool AffectsStealthMeter() const noexcept { return actorData.actorBaseFlags.none(ACTOR_BASE_DATA::Flag::kDoesntAffectStealthMeter); }
101  [[nodiscard]] constexpr bool Bleeds() const noexcept { return actorData.actorBaseFlags.none(ACTOR_BASE_DATA::Flag::kDoesntBleed); }
102  [[nodiscard]] constexpr bool IsEssential() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kEssential); }
103  [[nodiscard]] constexpr bool IsFemale() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kFemale); }
104  [[nodiscard]] inline bool IsGhost() const { return GetIsGhost(); }
105  [[nodiscard]] constexpr bool IsPreset() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kIsChargenFacePreset); }
106  [[nodiscard]] constexpr bool IsProtected() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kProtected); }
107  [[nodiscard]] constexpr bool IsSimpleActor() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kSimpleActor); }
108  [[nodiscard]] constexpr bool IsSummonable() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kSummonable); }
109  [[nodiscard]] constexpr bool IsUnique() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kUnique); }
110  [[nodiscard]] inline bool IsInvulnerable() const { return GetInvulnerable(); }
111  [[nodiscard]] constexpr bool HasAutoCalcStats() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kAutoCalcStats); }
112  [[nodiscard]] constexpr bool HasBleedoutOverride() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kBleedoutOverride); }
113  [[nodiscard]] constexpr bool HasPCLevelMult() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kPCLevelMult); }
114  [[nodiscard]] constexpr bool Respawns() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kRespawn); }
115  [[nodiscard]] constexpr bool UsesOppositeGenderAnims() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kOppositeGenderAnims); }
116  [[nodiscard]] constexpr bool UsesTemplate() const noexcept { return actorData.actorBaseFlags.all(ACTOR_BASE_DATA::Flag::kUsesTemplate); }
117 
118  [[nodiscard]] std::uint16_t GetLevel() const
119  {
120  using func_t = decltype(&TESActorBaseData::GetLevel);
121  static REL::Relocation<func_t> func{ RELOCATION_ID(14262, 14384) };
122  return func(this);
123  }
124 
125  // members
127  TESLevItem* deathItem; // 20 - INAM
128  BGSVoiceType* voiceType; // 28 - VTCK
129  TESForm* baseTemplateForm; // 30 - TPLT
132  };
133  static_assert(sizeof(TESActorBaseData) == 0x58);
134 }
#define RELOCATION_ID(SE, AE)
Definition: PCH.h:505
Definition: Relocation.h:210
constexpr bool none(Args... a_args) const noexcept requires(std
Definition: EnumSet.h:106
constexpr bool all(Args... a_args) const noexcept requires(std
Definition: EnumSet.h:99
Definition: BGSVoiceType.h:25
Definition: BSTArray.h:378
Definition: BaseFormComponent.h:8
Definition: TESActorBaseData.h:81
TESLevItem * deathItem
Definition: TESActorBaseData.h:127
ACTOR_BASE_DATA actorData
Definition: TESActorBaseData.h:126
constexpr bool HasAutoCalcStats() const noexcept
Definition: TESActorBaseData.h:111
void CopyComponent(BaseFormComponent *a_rhs) override
TESForm ** templateForms
Definition: TESActorBaseData.h:130
constexpr bool UsesTemplate() const noexcept
Definition: TESActorBaseData.h:116
constexpr bool IsSummonable() const noexcept
Definition: TESActorBaseData.h:108
constexpr bool HasBleedoutOverride() const noexcept
Definition: TESActorBaseData.h:112
constexpr bool IsEssential() const noexcept
Definition: TESActorBaseData.h:102
std::uint16_t GetLevel() const
Definition: TESActorBaseData.h:118
constexpr bool IsPreset() const noexcept
Definition: TESActorBaseData.h:105
constexpr bool IsSimpleActor() const noexcept
Definition: TESActorBaseData.h:107
TESForm * baseTemplateForm
Definition: TESActorBaseData.h:129
static constexpr auto VTABLE
Definition: TESActorBaseData.h:84
virtual BGSVoiceType * GetVoiceType(void)
BGSVoiceType * voiceType
Definition: TESActorBaseData.h:128
static constexpr auto RTTI
Definition: TESActorBaseData.h:83
virtual bool GetIsGhost() const
constexpr bool Bleeds() const noexcept
Definition: TESActorBaseData.h:101
constexpr bool UsesOppositeGenderAnims() const noexcept
Definition: TESActorBaseData.h:115
virtual bool GetInvulnerable() const
~TESActorBaseData() override
bool IsInvulnerable() const
Definition: TESActorBaseData.h:110
constexpr bool IsUnique() const noexcept
Definition: TESActorBaseData.h:109
virtual void CopyFromTemplateForms(TESActorBase **a_templateForms)
constexpr bool Respawns() const noexcept
Definition: TESActorBaseData.h:114
virtual void Unk_07(void)
bool IsGhost() const
Definition: TESActorBaseData.h:104
constexpr bool HasPCLevelMult() const noexcept
Definition: TESActorBaseData.h:113
constexpr bool AffectsStealthMeter() const noexcept
Definition: TESActorBaseData.h:100
constexpr bool IsFemale() const noexcept
Definition: TESActorBaseData.h:103
constexpr bool IsProtected() const noexcept
Definition: TESActorBaseData.h:106
BSTArray< FACTION_RANK > factions
Definition: TESActorBaseData.h:131
void InitializeDataComponent() override
void ClearDataComponent() override
Definition: TESActorBase.h:32
Definition: TESForm.h:36
Definition: TESLevItem.h:12
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 1 > VTABLE_TESActorBaseData
Definition: Offsets_VTABLE.h:12800
constexpr REL::ID RTTI_TESActorBaseData(static_cast< std::uint64_t >(513939))
Definition: TESActorBaseData.h:17
REX::EnumSet< TEMPLATE_USE_FLAG, std::uint16_t > templateUseFlags
Definition: TESActorBaseData.h:74
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
REX::EnumSet< Flag, std::uint32_t > actorBaseFlags
Definition: TESActorBaseData.h:66
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