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