CommonLibSSE (powerof3)
SpellItem.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BGSEquipType.h"
5 #include "RE/F/FormTypes.h"
6 #include "RE/M/MagicItem.h"
7 #include "RE/T/TESDescription.h"
8 
9 namespace RE
10 {
11  class SpellItem :
12  public MagicItem, // 00
13  public BGSEquipType, // 90
14  public BGSMenuDisplayObject, // A0
15  public TESDescription // B0
16  {
17  public:
18  inline static constexpr auto RTTI = RTTI_SpellItem;
19  inline static constexpr auto FORMTYPE = FormType::Spell;
20 
21  enum class SpellFlag
22  {
23  kNone = 0,
24  kCostOverride = 1 << 0,
25  kFoodItem = 1 << 1,
26  kExtendDuration = 1 << 3,
27  kPCStartSpell = 1 << 17,
28  kInstantCast = 1 << 18,
29  kIgnoreLOSCheck = 1 << 19,
30  kIgnoreResistance = 1 << 20,
31  kNoAbsorb = 1 << 21,
32  kNoDualCastMods = 1 << 23
33  };
34 
35  struct RecordFlags
36  {
37  enum RecordFlag : std::uint32_t
38  {
39  kDeleted = 1 << 5,
40  kIgnored = 1 << 12
41  };
42  };
43 
44  class Data // SPIT
45  {
46  public:
47  // members
48  std::int32_t costOverride; // 00
51  float chargeTime; // 0C
54  float castDuration; // 18
55  float range; // 1C
57  };
58  static_assert(sizeof(Data) == 0x28);
59 
60  ~SpellItem() override; // 00
61 
62  // override (MagicItem)
63  void InitializeData() override; // 04
64  void ClearData() override; // 05
65  void InitItemImpl() override; // 13
66  MagicSystem::SpellType GetSpellType() const override; // 53 - { return data.spellType; }
67  void SetCastingType(MagicSystem::CastingType a_type) override; // 54 - { data.castingType = a_type; }
68  MagicSystem::CastingType GetCastingType() const override; // 55 - { return data.castingType; }
69  void SetDelivery(MagicSystem::Delivery a_type) override; // 56 - { if (Unk_58()) { data.delivery = a_type; } }
70  MagicSystem::Delivery GetDelivery() const override; // 57 - { return data.delivery; }
71  float GetFixedCastDuration() const override; // 59 - { return (GetCastingType() == MagicSystem::CastingType::kConcentration) ? data.castDuration : 0.0; }
72  float GetRange() const override; // 5A - { return data.range; }
73  bool IgnoresResistance() const override; // 5B - { return (GetData()->flags >> 20) & 1; }
74  bool IgnoreLOS() const override; // 5C - { return (GetData()->flags >> 19) & 1; }
75  bool GetNoAbsorb() const override; // 5E - { return (GetData()->flags >> 21) & 1; }
76  bool GetNoDualCastModifications() const override; // 5F - { return (GetData()->flags >> 23) & 1; }
77  bool GetSkillUsageData(SkillUsageData& a_data) const override; // 60
78  void AdjustCost(float& a_cost, Actor* a_actor) const override; // 63
79  float GetChargeTime() const override; // 64
80  ActorValue GetAssociatedSkill() const override; // 66
81  bool IsTwoHanded() const override; // 67 - { BGSEquipSlot* equipSlot = BGSEquipType::GetEquipSlot(); return equipSlot && equipSlot->flags & 1; }
82  std::uint32_t GetChunkID() override; // 68 - { return 'SPIT'; }
83  void CopyMagicItemData(MagicItem* a_src) override; // 69
84  void LoadMagicItemChunk(TESFile* a_mod, std::uint32_t a_chunkID) override; // 6A
85  void LoadChunkDataPostProcess(TESFile* a_mod) override; // 6B
86  const MagicItem::Data* GetData1() const override; // 6C - { return &data; }
87  MagicItem::Data* GetData2() override; // 6D - { return &data; }
88  std::uint32_t GetDataSize() const override; // 6E - { return 0x28; }
89  void InitFromChunk(TESFile* a_mod) override; // 6F
90  void InitChunk() override; // 70
91 
92  // override (BGSMenuDisplayObject)
93  [[nodiscard]] TESBoundObject* GetMenuDisplayObject() const override; // 04 - { return menuDispObject; }
94 
95  // members
96  Data data; // C0 - SPIT
97  };
98  static_assert(sizeof(SpellItem) == 0xE8);
99 }
Definition: Actor.h:125
Definition: BGSEquipType.h:9
Definition: BGSMenuDisplayObject.h:10
Definition: BGSPerk.h:31
Definition: MagicItem.h:55
Definition: MagicItem.h:27
Definition: SpellItem.h:45
MagicSystem::CastingType castingType
Definition: SpellItem.h:52
float range
Definition: SpellItem.h:55
MagicSystem::Delivery delivery
Definition: SpellItem.h:53
float chargeTime
Definition: SpellItem.h:51
std::int32_t costOverride
Definition: SpellItem.h:48
BGSPerk * castingPerk
Definition: SpellItem.h:56
float castDuration
Definition: SpellItem.h:54
stl::enumeration< SpellFlag, std::uint32_t > flags
Definition: SpellItem.h:49
MagicSystem::SpellType spellType
Definition: SpellItem.h:50
Definition: SpellItem.h:16
bool GetSkillUsageData(SkillUsageData &a_data) const override
bool IgnoreLOS() const override
bool GetNoAbsorb() const override
MagicSystem::SpellType GetSpellType() const override
void LoadMagicItemChunk(TESFile *a_mod, std::uint32_t a_chunkID) override
static constexpr auto RTTI
Definition: SpellItem.h:18
bool IgnoresResistance() const override
static constexpr auto FORMTYPE
Definition: SpellItem.h:19
void LoadChunkDataPostProcess(TESFile *a_mod) override
void InitItemImpl() override
TESBoundObject * GetMenuDisplayObject() const override
ActorValue GetAssociatedSkill() const override
MagicSystem::Delivery GetDelivery() const override
void InitFromChunk(TESFile *a_mod) override
MagicItem::Data * GetData2() override
const MagicItem::Data * GetData1() const override
MagicSystem::CastingType GetCastingType() const override
float GetRange() const override
~SpellItem() override
float GetChargeTime() const override
void InitializeData() override
Data data
Definition: SpellItem.h:96
bool GetNoDualCastModifications() const override
void ClearData() override
void InitChunk() override
void SetCastingType(MagicSystem::CastingType a_type) override
void SetDelivery(MagicSystem::Delivery a_type) override
std::uint32_t GetChunkID() override
void AdjustCost(float &a_cost, Actor *a_actor) const override
void CopyMagicItemData(MagicItem *a_src) override
bool IsTwoHanded() const override
SpellFlag
Definition: SpellItem.h:22
float GetFixedCastDuration() const override
std::uint32_t GetDataSize() const override
Definition: TESBoundObject.h:24
Definition: TESDescription.h:12
Definition: TESFile.h:14
SpellType
Definition: MagicSystem.h:56
CastingType
Definition: MagicSystem.h:29
Delivery
Definition: MagicSystem.h:37
Definition: AbsorbEffect.h:6
ActorValue
Definition: ActorValues.h:6
constexpr REL::ID RTTI_SpellItem
Definition: Offsets_RTTI.h:5936
Definition: MagicItem.h:41
Definition: SpellItem.h:36
RecordFlag
Definition: SpellItem.h:38
@ kDeleted
Definition: SpellItem.h:39
@ kIgnored
Definition: SpellItem.h:40