CommonLibSSE (Parapets fork)
Loading...
Searching...
No Matches
MagicItem.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/A/ActorValues.h"
5#include "RE/B/BSTArray.h"
7#include "RE/M/MagicSystem.h"
9#include "RE/T/TESFullName.h"
10
11namespace RE
12{
13 class Actor;
14 class ActorValueInfo;
15 class Character;
16 class EffectItem;
17 class EffectSetting;
18 class QueuedFile;
19 class TESModel;
20 class TESObjectWEAP;
21 struct Effect;
22
23 class MagicItem :
24 public TESBoundObject, // 00
25 public TESFullName, // 30
26 public BGSKeywordForm // 40
27 {
28 public:
29 inline static constexpr auto RTTI = RTTI_MagicItem;
30
32 {
33 public:
34 // add
35 virtual void VisitModel(TESModel* a_model) = 0; // 00
36 virtual void VisitWeapon(TESObjectWEAP* a_weapon) = 0; // 01
37 };
38 static_assert(sizeof(PreloadableVisitor) == 0x8);
39
41 {
42 public:
43 // members
44 EffectItem* effect; // 00
46 float magnitude; // 0C
47 bool custom; // 10
48 std::uint8_t pad11; // 11
49 std::uint16_t pad12; // 12
50 std::uint32_t pad14; // 14
51 };
52 static_assert(sizeof(SkillUsageData) == 0x18);
53
54 class Data
55 {
56 public:
57 // members
58 std::int32_t costOverride; // 0
59 std::uint32_t flags; // 4
60 };
61 static_assert(sizeof(Data) == 0x8);
62
63 ~MagicItem() override; // 00
64
65 // override (TESBoundObject)
66 void InitializeData() override; // 04 - { TESForm::InitDefaults(); }
67 bool Load(TESFile* a_mod) override; // 06
68 void InitItemImpl() override; // 13
69 bool IsMagicItem() const override; // 29 - { return true; }
70 void Copy(TESForm* a_srcForm) override; // 2F
71 bool IsAutoCalc() const override; // 3E - { return (GetData().flags & 1) == 0; }
72
73 // override (BGSKeywordForm)
74 bool HasKeyword(const BGSKeyword* a_keyword) const override; // 04
75
76 // add
77 [[nodiscard]] virtual MagicSystem::SpellType GetSpellType() const = 0; // 53
78 virtual void SetCastingType(MagicSystem::CastingType a_type); // 54 - { return; }
79 [[nodiscard]] virtual MagicSystem::CastingType GetCastingType() const = 0; // 55
80 virtual void SetDelivery(MagicSystem::Delivery a_delivery); // 56 - { return; }
81 [[nodiscard]] virtual MagicSystem::Delivery GetDelivery() const = 0; // 57
82 virtual bool IsValidDelivery(MagicSystem::Delivery a_delivery); // 58 - { return true; }
83 [[nodiscard]] virtual float GetFixedCastDuration() const; // 59 - { return 0.0; }
84 [[nodiscard]] virtual float GetRange() const; // 5A - { return 0.0; }
85 [[nodiscard]] virtual bool IgnoresResistance() const; // 5B - { return false; }
86 [[nodiscard]] virtual bool IgnoreLOS() const; // 5C - { return false; }
87 [[nodiscard]] virtual bool IsFood() const; // 5D - { return false; }
88 [[nodiscard]] virtual bool GetNoAbsorb() const; // 5E - { return false; }
89 [[nodiscard]] virtual bool GetNoDualCastModifications() const; // 5F - { return false; }
90 virtual bool GetSkillUsageData(SkillUsageData& a_data) const; // 60 - { return false; }
91 [[nodiscard]] virtual bool IsPoison() const; // 61 - { return GetSpellType() == MagicSystem::SpellType::kPoison; }
92 [[nodiscard]] virtual bool IsMedicine() const; // 62 - { return false; }
93 virtual void AdjustCost(float& a_cost, Actor* a_actor) const; // 63 - { return; }
94 [[nodiscard]] virtual float GetChargeTime() const; // 64 - { return 0.0; }
95 [[nodiscard]] virtual std::uint32_t GetMaxEffectCount() const; // 65 - { return 0; }
96 [[nodiscard]] virtual ActorValue GetAssociatedSkill() const; // 66 - { return ActorValue::kNone; }
97 [[nodiscard]] virtual bool IsTwoHanded() const; // 67 - { return false; }
98 virtual std::uint32_t GetChunkID() = 0; // 68
99 virtual void CopyMagicItemData(MagicItem* a_src) = 0; // 69
100 virtual void LoadMagicItemChunk(TESFile* a_mod, std::uint32_t a_chunkID); // 6A - { return; }
101 virtual void LoadChunkDataPostProcess(TESFile* a_mod); // 6B - { return; }
102 [[nodiscard]] virtual const Data* GetData1() const = 0; // 6C
103 virtual Data* GetData2() = 0; // 6D
104 [[nodiscard]] virtual std::uint32_t GetDataSize() const = 0; // 6E
105 virtual void InitFromChunk(TESFile* a_mod) = 0; // 6F
106 virtual void InitChunk() = 0; // 70
107
108 float CalculateMagickaCost(Actor* a_caster) const;
109 float CalculateTotalGoldValue(Actor* a_caster = nullptr) const;
110 Effect* GetCostliestEffectItem(std::uint32_t a_arg1 = 5, bool a_arg2 = false);
112 [[nodiscard]] const Data* GetData() const;
113
114 // members
116 std::int32_t hostileCount; // 70
117 std::uint32_t pad74; // 74
119 std::uint32_t preloadCount; // 80
120 std::uint32_t pad84; // 84
122
123 protected:
124 float CalculateCost(Actor* a_caster) const;
125 };
126 static_assert(sizeof(MagicItem) == 0x90);
127}
Definition: Actor.h:125
Definition: BGSKeywordForm.h:10
Definition: BGSKeyword.h:10
Definition: BSTArray.h:377
Definition: BSTSmartPointer.h:37
Definition: EffectSetting.h:24
Definition: MagicItem.h:55
std::uint32_t flags
Definition: MagicItem.h:59
std::int32_t costOverride
Definition: MagicItem.h:58
Definition: MagicItem.h:32
virtual void VisitModel(TESModel *a_model)=0
virtual void VisitWeapon(TESObjectWEAP *a_weapon)=0
Definition: MagicItem.h:27
virtual void LoadChunkDataPostProcess(TESFile *a_mod)
virtual bool IsMedicine() const
virtual bool GetNoDualCastModifications() const
virtual bool IgnoresResistance() const
float CalculateTotalGoldValue(Actor *a_caster=nullptr) const
virtual void CopyMagicItemData(MagicItem *a_src)=0
void Copy(TESForm *a_srcForm) override
std::uint32_t pad74
Definition: MagicItem.h:117
virtual bool GetNoAbsorb() const
virtual bool IsFood() const
bool IsMagicItem() const override
virtual Data * GetData2()=0
Effect * GetCostliestEffectItem(std::uint32_t a_arg1=5, bool a_arg2=false)
EffectSetting * avEffectSetting
Definition: MagicItem.h:118
Data * GetData()
void InitItemImpl() override
virtual bool IsValidDelivery(MagicSystem::Delivery a_delivery)
virtual void LoadMagicItemChunk(TESFile *a_mod, std::uint32_t a_chunkID)
virtual float GetChargeTime() const
virtual void AdjustCost(float &a_cost, Actor *a_actor) const
BSTSmartPointer< QueuedFile > preloadedItem
Definition: MagicItem.h:121
virtual float GetRange() const
virtual void InitFromChunk(TESFile *a_mod)=0
std::int32_t hostileCount
Definition: MagicItem.h:116
virtual ActorValue GetAssociatedSkill() const
bool HasKeyword(const BGSKeyword *a_keyword) const override
const Data * GetData() const
virtual std::uint32_t GetMaxEffectCount() const
static constexpr auto RTTI
Definition: MagicItem.h:29
std::uint32_t preloadCount
Definition: MagicItem.h:119
virtual void SetCastingType(MagicSystem::CastingType a_type)
bool Load(TESFile *a_mod) override
virtual void InitChunk()=0
virtual bool GetSkillUsageData(SkillUsageData &a_data) const
virtual float GetFixedCastDuration() const
virtual MagicSystem::Delivery GetDelivery() const =0
void InitializeData() override
virtual const Data * GetData1() const =0
virtual MagicSystem::SpellType GetSpellType() const =0
bool IsAutoCalc() const override
virtual void SetDelivery(MagicSystem::Delivery a_delivery)
virtual MagicSystem::CastingType GetCastingType() const =0
std::uint32_t pad84
Definition: MagicItem.h:120
BSTArray< Effect * > effects
Definition: MagicItem.h:115
virtual bool IgnoreLOS() const
float CalculateCost(Actor *a_caster) const
virtual bool IsPoison() const
~MagicItem() override
virtual std::uint32_t GetChunkID()=0
virtual std::uint32_t GetDataSize() const =0
float CalculateMagickaCost(Actor *a_caster) const
virtual bool IsTwoHanded() const
Definition: TESBoundObject.h:24
Definition: TESFile.h:14
Definition: TESForm.h:34
Definition: TESFullName.h:9
Definition: TESModel.h:16
Definition: TESObjectWEAP.h:73
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_MagicItem
Definition: Offsets_RTTI.h:5128
Definition: Effect.h:11
Definition: MagicItem.h:41
std::uint32_t pad14
Definition: MagicItem.h:50
bool custom
Definition: MagicItem.h:47
std::uint8_t pad11
Definition: MagicItem.h:48
float magnitude
Definition: MagicItem.h:46
std::uint16_t pad12
Definition: MagicItem.h:49
EffectItem * effect
Definition: MagicItem.h:44
ActorValue skill
Definition: MagicItem.h:45