CommonLibSSE (powerof3)
TESAmmo.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BGSKeywordForm.h"
5 #include "RE/B/BGSMessageIcon.h"
7 #include "RE/F/FormTypes.h"
8 #include "RE/T/TESBoundObject.h"
9 #include "RE/T/TESDescription.h"
10 #include "RE/T/TESFullName.h"
11 #include "RE/T/TESIcon.h"
13 #include "RE/T/TESValueForm.h"
14 #include "RE/T/TESWeightForm.h"
15 
16 namespace RE
17 {
18  struct AMMO_DATA // DATA
19  {
20  public:
21  enum class Flag
22  {
23  kNone = 0,
25  kNonPlayable = 1 << 1,
26  kNonBolt = 1 << 2
27  };
28 
29  // members
32  std::uint8_t pa09; // 09
33  std::uint16_t pa0A; // 0A
34  float damage; // 0C
35  };
36  static_assert(sizeof(AMMO_DATA) == 0x10);
37 
38  class TESAmmo :
39  public TESBoundObject, // 000
40  public TESFullName, // 030
41  public TESModelTextureSwap, // 040
42  public TESIcon, // 078
43  public BGSMessageIcon, // 088
44  public TESValueForm, // 0A0
45  public TESWeightForm, // 0B0
46  public BGSDestructibleObjectForm, // 0C0
47  public BGSPickupPutdownSounds, // 0D0
48  public TESDescription, // 0E8
49  public BGSKeywordForm // 0F8
50  {
51  public:
52  inline static constexpr auto RTTI = RTTI_TESAmmo;
53  inline static constexpr auto VTABLE = VTABLE_TESAmmo;
54  inline static constexpr auto FORMTYPE = FormType::Ammo;
55 
56  struct RecordFlags
57  {
58  enum RecordFlag : std::uint32_t
59  {
60  kNonPlayable = 1 << 2,
61  kDeleted = 1 << 5,
62  kIgnored = 1 << 12
63  };
64  };
65 
66  ~TESAmmo() override; // 00
67 
68  // override (TESBoundObject)
69  void InitializeData() override; // 04
70  bool Load(TESFile* a_mod) override; // 06
71  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
72  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
73  void InitItemImpl() override; // 13
74  bool GetPlayable() const override; // 19 - { return ~((data.flags >> 1) & 1); }
75  NiAVObject* Clone3D(TESObjectREFR* a_ref, bool a_arg3) override; // 40
76  void HandleRemoveItemFromContainer(TESObjectREFR* a_container) override; // 4E
77 
78  // override (BGSKeywordForm)
79  [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
80 
82  bool IsBolt();
83 
84  // members
85  AMMO_DATA data; // 110 - DATA
86  BSFixedString shortDesc; // 120 - ONAM
87  };
88  static_assert(sizeof(TESAmmo) == 0x128);
89 }
Definition: BGSDestructibleObjectForm.h:61
Definition: BGSKeywordForm.h:12
Definition: BGSKeyword.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSMessageIcon.h:9
Definition: BGSPickupPutdownSounds.h:10
Definition: BGSProjectile.h:79
Definition: BGSSaveFormBuffer.h:8
Definition: NiAVObject.h:51
Definition: TESAmmo.h:50
void InitItemImpl() override
bool GetPlayable() const override
static constexpr auto RTTI
Definition: TESAmmo.h:52
BSFixedString shortDesc
Definition: TESAmmo.h:86
void HandleRemoveItemFromContainer(TESObjectREFR *a_container) override
static constexpr auto VTABLE
Definition: TESAmmo.h:53
bool IgnoresNormalWeaponResistance()
void SaveGame(BGSSaveFormBuffer *a_buf) override
NiAVObject * Clone3D(TESObjectREFR *a_ref, bool a_arg3) override
void InitializeData() override
BGSKeyword * GetDefaultKeyword() const override
bool IsBolt()
static constexpr auto FORMTYPE
Definition: TESAmmo.h:54
~TESAmmo() override
AMMO_DATA data
Definition: TESAmmo.h:85
bool Load(TESFile *a_mod) override
void LoadGame(BGSLoadFormBuffer *a_buf) override
Definition: TESBoundObject.h:24
Definition: TESDescription.h:12
Definition: TESFile.h:17
Definition: TESFullName.h:9
Definition: TESIcon.h:8
Definition: TESModelTextureSwap.h:10
Definition: TESObjectREFR.h:114
Definition: TESValueForm.h:8
Definition: TESWeightForm.h:8
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 11 > VTABLE_TESAmmo
Definition: Offsets_VTABLE.h:12802
constexpr REL::ID RTTI_TESAmmo(static_cast< std::uint64_t >(513901))
Definition: TESAmmo.h:19
BGSProjectile * projectile
Definition: TESAmmo.h:30
Flag
Definition: TESAmmo.h:22
REX::EnumSet< Flag, std::uint8_t > flags
Definition: TESAmmo.h:31
std::uint16_t pa0A
Definition: TESAmmo.h:33
float damage
Definition: TESAmmo.h:34
std::uint8_t pa09
Definition: TESAmmo.h:32
Definition: TESAmmo.h:57
RecordFlag
Definition: TESAmmo.h:59
@ kIgnored
Definition: TESAmmo.h:62
@ kDeleted
Definition: TESAmmo.h:61
@ kNonPlayable
Definition: TESAmmo.h:60