CommonLibSSE (powerof3)
ActorValueInfo.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/F/FormTypes.h"
5 #include "RE/T/TESDescription.h"
6 #include "RE/T/TESForm.h"
7 #include "RE/T/TESFullName.h"
8 #include "RE/T/TESIcon.h"
9 
10 namespace RE
11 {
12  class ActorValueOwner;
13  class BGSSkillPerkTreeNode;
14 
16  public TESForm, // 000
17  public TESFullName, // 020
18  public TESDescription, // 030
19  public TESIcon // 040
20  {
21  public:
22  inline static constexpr auto RTTI = RTTI_ActorValueInfo;
23  inline static constexpr auto VTABLE = VTABLE_ActorValueInfo;
24  inline static constexpr auto FORMTYPE = FormType::ActorValueInfo;
25 
26  using DynamicBaseValueFunctor = float (*)(ActorValueOwner*, uint32_t avIndex);
27 
28  struct RecordFlags
29  {
30  enum RecordFlag : std::uint32_t
31  {
32  kDeleted = 1 << 5,
33  kIgnored = 1 << 12
34  };
35  };
36 
37  enum class ActorValueType : std::uint32_t
38  {
39  kAttribute, // e.g. Health, HealRate
40  kSkill, // e.g. OneHanded, VampirePerks, WerewolfPerks
41  kAITemperament, // e.g. Aggression, Energy, Morality
42  kDamageResistance, // e.g. PoisonResist
43  kLimbCondition, // e.g. BrainCondition
44  kStatus, // e.g. DetectLifeRange, Invisibility, NightEye, Paralysis
45  kMiscellaneous, // e.g. ArmorPerks, BowSpeedBonus, Fame, [Skill]Mod, [Skill]SkillAdvance, Variable01, WardPower
46  };
47 
48  enum class ActorValueFlag : std::uint32_t
49  {
50  // used for combat-related magic skills
52 
53  // affects kClampAsSpecialStat behavior
55 
56  // clamped value (ActorValueOwner::GetClampedActorValue) is in the range [0, 10]
57  // or [1, 10]
58  kClampAsSpecialStat = 1 << 3,
59 
60  // clamped value is in the range [0, 100]
61  kClampAsSkill = 1 << 4,
62 
63  // the value can have "permanent," "temporary," and "damage" modifiers
64  // (see RE::Modifiers, RE::ActorValueStorage, RE::Actor::healthModifiers, etc.)
65  kCanHaveModifiers = 1 << 5,
66 
67  // if the base value is computed from the actor or race, then the computed
68  // base value is the dynamic computation + the current value
70 
71  // base value is computed per reference (`computeBaseFunc`), and the GetAVInfo
72  // console command lists the "derived" value as "ignored"
74 
75  // the AV is an enum.
76  kEnumeration = 1 << 8,
77 
78  // damaging this AV increases the value, and restoring it decreases the value.
79  // used for AVs where high = bad, e.g. MovementNoiseMult impairing sneak
80  kInverted = 1 << 9,
81 
82  // base value is computed per reference (`computeBaseFunc`), and values cached
83  // in the AI process (see other flags) are forcibly refreshed on race change or
84  // savegame load
86 
87  // Papyrus APIs refuse to alter this AV's value
88  kCannotBeAlteredByScripts = 1 << 14,
89 
90  kBaseValueIsAlwaysZero = 1 << 15,
91 
92  // probably intended for multipliers, though some (e.g. WeaponSpeedMult) use the
93  // kBaseValueIsAlwaysZero flag instead
94  kBaseValueIsAlwaysOne = 1 << 16,
95 
96  // used for limb condition AVs
98 
99  // see RE::CachedValues::actorValueCache
101 
102  // see RE::CachedValues::maxActorValueCache. non-numeric AVs like Confidence, in
103  // particular, only cache their current value and not a maximum
104  kAIProcessCachesMaxValue = 1 << 19,
105 
106  // the current value for the player cannot be decreased while ToggleGodMode
107  // is active
108  kProtectedByGodMode = 1 << 20,
109 
110  // when an effect's <MAG> token is substituted for the magnitude, the displayed
111  // value is scaled by 100
113  };
114 
115  struct Skill // AVSK
116  {
117  float useMult; // 00
118  float offsetMult; // 04
119  float improveMult; // 08
120  float improveOffset; // 0C
121  };
122  static_assert(sizeof(Skill) == 0x10);
123 
124  ~ActorValueInfo() override; // 00
125 
126  // override (TESForm)
127  void ClearData() override; // 05
128  bool Load(TESFile* a_mod) override; // 06
129  void InitItemImpl() override; // 13
130 
131  // override (TESIcon)
132  [[nodiscard]] const char* GetDefaultPath() const override; // 06 - { return "Textures\\"; }
133 
134  // members
135  const char* enumName; // 050
139  DynamicBaseValueFunctor computeBaseFunc; // 068 - used if appropriate flags are set
140  std::uint32_t unk070; // 070
141  std::uint32_t unk074; // 074
142  std::uint32_t unk078; // 078
143  std::uint32_t unk07C; // 07C
144  std::uint32_t unk080; // 080
145  std::uint32_t unk084; // 084
146  std::uint32_t unk088; // 088
147  std::uint32_t unk08C; // 08C
148  std::uint32_t unk090; // 090
149  std::uint32_t unk094; // 094
150  std::uint32_t unk098; // 098
151  std::uint32_t unk09C; // 09C
152  std::uint32_t unk0A0; // 0A0
153  std::uint32_t unk0A4; // 0A4
154  std::uint32_t unk0A8; // 0A8
155  std::uint32_t unk0AC; // 0AC
156  std::uint64_t enumValueCount; // 0B0
157  const char* enumValues[0xA]; // 0B8
158  Skill* skill; // 108 - AVSK
159  std::uint32_t isNthAICachedCurrentValue; // 110 - if appropriate AV flag is set, RE::CachedValues::actorValueCache[n] is this AV
160  std::uint32_t isNthAICachedMaxValue; // 114 - if appropriate AV flag is set, RE::CachedValues::maxActorValueCache[n] is this AV
162  std::uint32_t perkTreeWidth; // 120
163  std::uint32_t unk124; // 124 - CNAM
164  };
165  static_assert(sizeof(ActorValueInfo) == 0x128);
166 }
Definition: ActorValueInfo.h:20
std::uint32_t unk080
Definition: ActorValueInfo.h:144
std::uint32_t unk074
Definition: ActorValueInfo.h:141
void ClearData() override
std::uint32_t isNthAICachedCurrentValue
Definition: ActorValueInfo.h:159
std::uint32_t unk078
Definition: ActorValueInfo.h:142
std::uint32_t isNthAICachedMaxValue
Definition: ActorValueInfo.h:160
Skill * skill
Definition: ActorValueInfo.h:158
std::uint32_t unk0A8
Definition: ActorValueInfo.h:154
const char * enumValues[0xA]
Definition: ActorValueInfo.h:157
REX::EnumSet< ActorValueFlag, std::uint32_t > flags
Definition: ActorValueInfo.h:137
std::uint32_t unk0AC
Definition: ActorValueInfo.h:155
BGSSkillPerkTreeNode * perkTree
Definition: ActorValueInfo.h:161
std::uint64_t enumValueCount
Definition: ActorValueInfo.h:156
static constexpr auto RTTI
Definition: ActorValueInfo.h:22
std::uint32_t perkTreeWidth
Definition: ActorValueInfo.h:162
ActorValueType type
Definition: ActorValueInfo.h:138
std::uint32_t unk09C
Definition: ActorValueInfo.h:151
void InitItemImpl() override
std::uint32_t unk07C
Definition: ActorValueInfo.h:143
std::uint32_t unk070
Definition: ActorValueInfo.h:140
std::uint32_t unk098
Definition: ActorValueInfo.h:150
std::uint32_t unk090
Definition: ActorValueInfo.h:148
std::uint32_t unk0A4
Definition: ActorValueInfo.h:153
DynamicBaseValueFunctor computeBaseFunc
Definition: ActorValueInfo.h:139
std::uint32_t unk094
Definition: ActorValueInfo.h:149
std::uint32_t unk124
Definition: ActorValueInfo.h:163
float(*)(ActorValueOwner *, uint32_t avIndex) DynamicBaseValueFunctor
Definition: ActorValueInfo.h:26
~ActorValueInfo() override
const char * enumName
Definition: ActorValueInfo.h:135
std::uint32_t unk08C
Definition: ActorValueInfo.h:147
bool Load(TESFile *a_mod) override
static constexpr auto VTABLE
Definition: ActorValueInfo.h:23
std::uint32_t unk0A0
Definition: ActorValueInfo.h:152
static constexpr auto FORMTYPE
Definition: ActorValueInfo.h:24
const char * GetDefaultPath() const override
BSFixedString abbreviation
Definition: ActorValueInfo.h:136
ActorValueType
Definition: ActorValueInfo.h:38
std::uint32_t unk088
Definition: ActorValueInfo.h:146
std::uint32_t unk084
Definition: ActorValueInfo.h:145
ActorValueFlag
Definition: ActorValueInfo.h:49
Definition: ActorValueOwner.h:8
Definition: BGSSkillPerkTreeNode.h:11
Definition: TESDescription.h:12
Definition: TESFile.h:17
Definition: TESForm.h:36
Definition: TESFullName.h:9
Definition: TESIcon.h:8
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 4 > VTABLE_ActorValueInfo
Definition: Offsets_VTABLE.h:7386
constexpr REL::ID RTTI_ActorValueInfo(static_cast< std::uint64_t >(685586))
Definition: ActorValueInfo.h:29
RecordFlag
Definition: ActorValueInfo.h:31
@ kDeleted
Definition: ActorValueInfo.h:32
@ kIgnored
Definition: ActorValueInfo.h:33
Definition: ActorValueInfo.h:116
float useMult
Definition: ActorValueInfo.h:117
float improveOffset
Definition: ActorValueInfo.h:120
float improveMult
Definition: ActorValueInfo.h:119
float offsetMult
Definition: ActorValueInfo.h:118