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