CommonLibSSE NG
TESObjectWEAP.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/ActorValues.h"
6 #include "RE/B/BGSEquipType.h"
7 #include "RE/B/BGSKeywordForm.h"
8 #include "RE/B/BGSMessageIcon.h"
10 #include "RE/B/BGSPreloadable.h"
11 #include "RE/F/FormTypes.h"
12 #include "RE/S/SoundLevels.h"
14 #include "RE/T/TESBoundObject.h"
15 #include "RE/T/TESDescription.h"
17 #include "RE/T/TESFullName.h"
18 #include "RE/T/TESIcon.h"
19 #include "RE/T/TESModel.h"
21 #include "RE/T/TESValueForm.h"
22 #include "RE/T/TESWeightForm.h"
23 
24 namespace RE
25 {
26  enum class WEAPONHITBEHAVIOR
27  {
28  kNormal = 0,
29  kDismemberOnly = 1,
30  kExplodeOnly = 2,
32  };
33 
35  {
36  kConstant = 0,
37  kPeriodicSquare = 1,
40  };
41 
42  struct WeaponTypes
43  {
44  enum WEAPON_TYPE : std::uint32_t
45  {
53  kBow = 7,
54  kStaff = 8,
55  kCrossbow = 9,
56 
57  kTotal = 10
58  };
59  };
61 
62  class TESObjectWEAP :
63  public TESBoundObject, // 000
64  public TESFullName, // 030
65  public TESModelTextureSwap, // 040
66  public TESIcon, // 078
67  public TESEnchantableForm, // 088
68  public TESValueForm, // 0A0
69  public TESWeightForm, // 0B0
70  public TESAttackDamageForm, // 0C0
71  public BGSDestructibleObjectForm, // 0D0
72  public BGSEquipType, // 0E0
73  public BGSPreloadable, // 0F0
74  public BGSMessageIcon, // 0F8
75  public BGSPickupPutdownSounds, // 110
76  public BGSBlockBashData, // 128
77  public BGSKeywordForm, // 140
78  public TESDescription // 158
79  {
80  public:
81  inline static constexpr auto RTTI = RTTI_TESObjectWEAP;
82  inline static constexpr auto VTABLE = VTABLE_TESObjectWEAP;
83  inline static constexpr auto FORMTYPE = FormType::Weapon;
84 
85  struct RecordFlags
86  {
87  enum RecordFlag : std::uint32_t
88  {
89  kNonPlayable = 1 << 2,
90  kDeleted = 1 << 5,
91  kIgnored = 1 << 12
92  };
93  };
94 
95  struct RangedData
96  {
97  public:
98  // members
99  float sightFOV; // 00
100  float unk04; // 04
103  float firingRumbleDuration; // 10
105  std::int8_t numProjectiles; // 18
106  std::uint8_t pad19; // 19
107  std::uint16_t pad1A; // 1A
108  };
109  static_assert(sizeof(RangedData) == 0x1C);
110 
111  struct Data // DNAM
112  {
113  public:
114  enum class Flag2
115  {
116  kNone = 0,
117  kPlayerOnly = 1 << 0,
118  kNPCsUseAmmo = 1 << 1,
119  kNoJamAfterReload = 1 << 2, // unused
120  kMinorCrime = 1 << 4,
121  kRangeFixed = 1 << 5,
122  kNotUsedInNormalCombat = 1 << 6,
123  kDontUse3rdPersonISAnim = 1 << 8, // unused
124  kBurstShot = 1 << 9,
125  kRumbleAlternate = 1 << 10,
126  kLongBursts = 1 << 11,
127  kNonHostile = 1 << 12,
128  kBoundWeapon = 1 << 13
129  };
130 
131  enum class AttackAnimation
132  {
133  kAttackLeft = 26,
134  kAttackRight = 32,
135  kAttack3 = 38,
136  kAttack4 = 44,
137  kAttack5 = 50,
138  kAttack7 = 62,
139  kAttack8 = 68,
140  kAttackLoop = 74,
141  kAttackSpin = 80,
142  kAttackSpin2 = 86,
143  kPlaceMine = 97,
144  kPlaceMine2 = 103,
145  kAttackThrow = 109,
146  kAttackThrow2 = 115,
147  kAttackThrow3 = 121,
148  kAttackThrow4 = 127,
149  kAttackThrow5 = 133,
150  kDefault = 255
151  };
152 
153  enum class Flag
154  {
155  kNone = 0,
157  kAutomatic = 1 << 1, // unused
158  kHasScope = 1 << 2, // unused
159  kCantDrop = 1 << 3,
160  kHideBackpack = 1 << 4, // unused
161  kEmbeddedWeapon = 1 << 5, // unused
162  kDontUseFirstPersonISAnim = 1 << 6, // unused
163  kNonPlayable = 1 << 7
164  };
165 
166  // members
168  float speed; // 08
169  float reach; // 0C
170  float minRange; // 10
171  float maxRange; // 14
172  float animationAttackMult; // 18
173  float unk1C; // 1C
174  float staggerValue; // 20
179  std::uint8_t baseVATSToHitChance; // 32
184  std::uint8_t unk37; // 37
185  };
186  static_assert(sizeof(Data) == 0x38);
187 
188  struct CriticalData // CRDT
189  {
190  public:
191  enum Flag
192  {
193  kNone = 0,
194  kOnDeath = 1 << 0
195  };
196 
197  // members
198  float prcntMult; // 00
199  std::uint32_t pad04; // 04
201  std::uint16_t damage; // 10
203  std::uint8_t pad13; // 13
204  std::uint32_t pad14; // 14
205  };
206  static_assert(sizeof(CriticalData) == 0x18);
207 
208  struct Unk1B8
209  {
210  public:
211  // members
214  };
215  static_assert(sizeof(Unk1B8) == 0x30);
216 
217  ~TESObjectWEAP() override; // 00
218 
219  // override (TESBoundObject)
220  void InitializeData() override; // 04
221  void ClearData() override; // 05
222  bool Load(TESFile* a_mod) override; // 06
223  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
224  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
225  void InitItemImpl() override; // 13
226  TESFile* GetDescriptionOwnerFile() const override; // 14
227  bool GetPlayable() const override; // 19 - { return ~((data.flags >> 7) & 1); }
228  const char* GetObjectTypeName() const override; // 39 - { return g_animationStrings[data.animationType]; }
229 
230  // override (BGSKeywordForm)
231  [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
232 
233  [[nodiscard]] float GetSpeed() const;
234  [[nodiscard]] float GetReach() const;
235  [[nodiscard]] float GetStagger() const;
236  [[nodiscard]] float GetMinRange() const;
237  [[nodiscard]] float GetMaxRange() const;
238  [[nodiscard]] std::uint16_t GetCritDamage() const;
240  void GetNodeName(char* a_dstBuff) const;
241  [[nodiscard]] WEAPON_TYPE GetWeaponType() const;
242  [[nodiscard]] bool IsBound() const;
243  [[nodiscard]] bool IsMelee() const;
244  [[nodiscard]] bool IsRanged() const;
245  [[nodiscard]] bool IsHandToHandMelee() const;
246  [[nodiscard]] bool IsOneHandedSword() const;
247  [[nodiscard]] bool IsOneHandedDagger() const;
248  [[nodiscard]] bool IsOneHandedAxe() const;
249  [[nodiscard]] bool IsOneHandedMace() const;
250  [[nodiscard]] bool IsTwoHandedSword() const;
251  [[nodiscard]] bool IsTwoHandedAxe() const;
252  [[nodiscard]] bool IsBow() const;
253  [[nodiscard]] bool IsStaff() const;
254  [[nodiscard]] bool IsCrossbow() const;
255 
256  // members
257  Data weaponData; // 168 - DNAM
258  CriticalData criticalData; // 1A0 - CRDT
259  Unk1B8* unk1B8; // 1B8
272  std::uint32_t pad21C; // 21C
273  };
274  static_assert(sizeof(TESObjectWEAP) == 0x220);
275 }
Definition: BGSBlockBashData.h:9
Definition: BGSDestructibleObjectForm.h:61
Definition: BGSEquipType.h:9
Definition: BGSImpactDataSet.h:13
Definition: BGSKeywordForm.h:12
Definition: BGSKeyword.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSMessageIcon.h:9
Definition: BGSPickupPutdownSounds.h:10
Definition: BGSPreloadable.h:8
Definition: BGSSaveFormBuffer.h:8
Definition: BGSSoundDescriptorForm.h:14
Definition: NiAVObject.h:50
Definition: SpellItem.h:16
Definition: TESAttackDamageForm.h:8
Definition: TESBoundObject.h:24
Definition: TESDescription.h:12
Definition: TESEffectShader.h:182
Definition: TESEnchantableForm.h:11
Definition: TESFile.h:17
Definition: TESFullName.h:9
Definition: TESIcon.h:8
Definition: TESModelTextureSwap.h:10
Definition: TESModel.h:16
Definition: TESObjectSTAT.h:30
Definition: TESObjectWEAP.h:79
void InitItemImpl() override
stl::enumeration< SOUND_LEVEL, std::uint32_t > soundLevel
Definition: TESObjectWEAP.h:271
bool IsRanged() const
bool IsOneHandedDagger() const
const char * GetObjectTypeName() const override
static constexpr auto RTTI
Definition: TESObjectWEAP.h:81
std::uint32_t pad21C
Definition: TESObjectWEAP.h:272
void GetNodeName(char *a_dstBuff) const
bool IsBow() const
BGSSoundDescriptorForm * attackSound2D
Definition: TESObjectWEAP.h:261
CriticalData criticalData
Definition: TESObjectWEAP.h:258
void LoadGame(BGSLoadFormBuffer *a_buf) override
bool Load(TESFile *a_mod) override
BGSKeyword * GetDefaultKeyword() const override
TESObjectSTAT * firstPersonModelObject
Definition: TESObjectWEAP.h:268
bool IsCrossbow() const
BGSSoundDescriptorForm * attackSound
Definition: TESObjectWEAP.h:260
bool IsHandToHandMelee() const
float GetMaxRange() const
float GetSpeed() const
~TESObjectWEAP() override
static constexpr auto FORMTYPE
Definition: TESObjectWEAP.h:83
void InitializeData() override
BGSSoundDescriptorForm * equipSound
Definition: TESObjectWEAP.h:265
bool IsStaff() const
float GetReach() const
TESFile * GetDescriptionOwnerFile() const override
BSFixedString embeddedNode
Definition: TESObjectWEAP.h:270
Unk1B8 * unk1B8
Definition: TESObjectWEAP.h:259
bool IsOneHandedSword() const
bool IsTwoHandedAxe() const
BGSImpactDataSet * impactDataSet
Definition: TESObjectWEAP.h:267
bool IsOneHandedMace() const
bool IsOneHandedAxe() const
bool IsMelee() const
static constexpr auto VTABLE
Definition: TESObjectWEAP.h:82
TESObjectWEAP * templateWeapon
Definition: TESObjectWEAP.h:269
Data weaponData
Definition: TESObjectWEAP.h:257
float GetMinRange() const
void SaveGame(BGSSaveFormBuffer *a_buf) override
BGSSoundDescriptorForm * attackLoopSound
Definition: TESObjectWEAP.h:262
BGSSoundDescriptorForm * attackFailSound
Definition: TESObjectWEAP.h:263
BGSSoundDescriptorForm * idleSound
Definition: TESObjectWEAP.h:264
WEAPON_TYPE GetWeaponType() const
float GetStagger() const
NiAVObject * GetFireNode(NiAVObject *a_root) const
std::uint16_t GetCritDamage() const
bool IsTwoHandedSword() const
bool GetPlayable() const override
BGSSoundDescriptorForm * unequipSound
Definition: TESObjectWEAP.h:266
bool IsBound() const
void ClearData() override
Definition: TESValueForm.h:8
Definition: TESWeightForm.h:8
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_TESObjectWEAP(513916, 392539, 0x1edaa78)
WEAPON_RUMBLE_PATTERN
Definition: TESObjectWEAP.h:35
WEAPONHITBEHAVIOR
Definition: TESObjectWEAP.h:27
constexpr std::array< REL::VariantID, 16 > VTABLE_TESObjectWEAP
Definition: Offsets_VTABLE.h:557
Definition: TESObjectWEAP.h:189
std::uint16_t damage
Definition: TESObjectWEAP.h:201
Flag
Definition: TESObjectWEAP.h:192
@ kOnDeath
Definition: TESObjectWEAP.h:194
@ kNone
Definition: TESObjectWEAP.h:193
std::uint32_t pad04
Definition: TESObjectWEAP.h:199
float prcntMult
Definition: TESObjectWEAP.h:198
SpellItem * effect
Definition: TESObjectWEAP.h:200
stl::enumeration< Flag, std::uint8_t > flags
Definition: TESObjectWEAP.h:202
std::uint8_t pad13
Definition: TESObjectWEAP.h:203
std::uint32_t pad14
Definition: TESObjectWEAP.h:204
Definition: TESObjectWEAP.h:112
float minRange
Definition: TESObjectWEAP.h:170
float animationAttackMult
Definition: TESObjectWEAP.h:172
RangedData * rangedData
Definition: TESObjectWEAP.h:167
stl::enumeration< ActorValue, std::uint32_t > resistance
Definition: TESObjectWEAP.h:177
float staggerValue
Definition: TESObjectWEAP.h:174
std::uint8_t unk37
Definition: TESObjectWEAP.h:184
float maxRange
Definition: TESObjectWEAP.h:171
Flag
Definition: TESObjectWEAP.h:154
stl::enumeration< AttackAnimation, std::uint8_t > attackAnimation
Definition: TESObjectWEAP.h:180
stl::enumeration< Flag2, std::uint16_t > flags2
Definition: TESObjectWEAP.h:178
Flag2
Definition: TESObjectWEAP.h:115
stl::enumeration< WEAPONHITBEHAVIOR, std::uint32_t > hitBehavior
Definition: TESObjectWEAP.h:175
std::uint8_t baseVATSToHitChance
Definition: TESObjectWEAP.h:179
stl::enumeration< Flag, std::uint8_t > flags
Definition: TESObjectWEAP.h:183
float reach
Definition: TESObjectWEAP.h:169
stl::enumeration< ActorValue, std::uint8_t > embeddedWeaponAV
Definition: TESObjectWEAP.h:181
float speed
Definition: TESObjectWEAP.h:168
stl::enumeration< WEAPON_TYPE, std::uint8_t > animationType
Definition: TESObjectWEAP.h:182
stl::enumeration< ActorValue, std::uint32_t > skill
Definition: TESObjectWEAP.h:176
float unk1C
Definition: TESObjectWEAP.h:173
AttackAnimation
Definition: TESObjectWEAP.h:132
Definition: TESObjectWEAP.h:96
float sightFOV
Definition: TESObjectWEAP.h:99
std::int8_t numProjectiles
Definition: TESObjectWEAP.h:105
std::uint8_t pad19
Definition: TESObjectWEAP.h:106
stl::enumeration< WEAPON_RUMBLE_PATTERN, std::uint32_t > rumblePattern
Definition: TESObjectWEAP.h:104
float firingRumbleRightMotorStrength
Definition: TESObjectWEAP.h:102
float firingRumbleDuration
Definition: TESObjectWEAP.h:103
std::uint16_t pad1A
Definition: TESObjectWEAP.h:107
float firingRumbleLeftMotorStrength
Definition: TESObjectWEAP.h:101
float unk04
Definition: TESObjectWEAP.h:100
Definition: TESObjectWEAP.h:86
RecordFlag
Definition: TESObjectWEAP.h:88
@ kIgnored
Definition: TESObjectWEAP.h:91
@ kDeleted
Definition: TESObjectWEAP.h:90
@ kNonPlayable
Definition: TESObjectWEAP.h:89
Definition: TESObjectWEAP.h:209
TESEffectShader * unk28
Definition: TESObjectWEAP.h:213
TESModel unk00
Definition: TESObjectWEAP.h:212
Definition: TESObjectWEAP.h:43
WEAPON_TYPE
Definition: TESObjectWEAP.h:45
@ kHandToHandMelee
Definition: TESObjectWEAP.h:46
@ kOneHandMace
Definition: TESObjectWEAP.h:50
@ kTotal
Definition: TESObjectWEAP.h:57
@ kOneHandSword
Definition: TESObjectWEAP.h:47
@ kTwoHandAxe
Definition: TESObjectWEAP.h:52
@ kTwoHandSword
Definition: TESObjectWEAP.h:51
@ kBow
Definition: TESObjectWEAP.h:53
@ kOneHandDagger
Definition: TESObjectWEAP.h:48
@ kCrossbow
Definition: TESObjectWEAP.h:55
@ kStaff
Definition: TESObjectWEAP.h:54
@ kOneHandAxe
Definition: TESObjectWEAP.h:49