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