From 20c874f30cc33e47345f5b0e176afc3323042261 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Thu, 26 Oct 2023 00:51:25 +0530 Subject: [PATCH] feat: `SpellItem` and related RE --- CommonLibSF/include/RE/B/BGSEquipType.h | 29 +++++++ .../include/RE/B/BGSMenuDisplayObject.h | 24 +++++ .../include/RE/B/BGSObjectPlacementDefaults.h | 7 +- .../include/RE/B/BGSPreviewTransform.h | 13 +-- CommonLibSF/include/RE/E/EffectItem.h | 33 +++++++ CommonLibSF/include/RE/M/MagicItem.h | 87 +++++++++++++++++++ CommonLibSF/include/RE/M/MagicSystem.h | 67 ++++++++++++++ CommonLibSF/include/RE/S/SpellItem.h | 49 +++++++++++ CommonLibSF/include/RE/T/TESBoundAnimObject.h | 6 +- CommonLibSF/include/RE/T/TESBoundObject.h | 47 +++++----- 10 files changed, 323 insertions(+), 39 deletions(-) create mode 100644 CommonLibSF/include/RE/B/BGSEquipType.h create mode 100644 CommonLibSF/include/RE/B/BGSMenuDisplayObject.h create mode 100644 CommonLibSF/include/RE/E/EffectItem.h create mode 100644 CommonLibSF/include/RE/M/MagicItem.h create mode 100644 CommonLibSF/include/RE/M/MagicSystem.h create mode 100644 CommonLibSF/include/RE/S/SpellItem.h diff --git a/CommonLibSF/include/RE/B/BGSEquipType.h b/CommonLibSF/include/RE/B/BGSEquipType.h new file mode 100644 index 00000000..b1370ee3 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSEquipType.h @@ -0,0 +1,29 @@ +#pragma once + +#include "RE/B/BaseFormComponent.h" + +namespace RE +{ + class BGSEquipSlot; + class TBO_InstanceData; + + class BGSEquipType : public BaseFormComponent + { + public: + SF_RTTI(BGSEquipType); + + virtual ~BGSEquipType() override; // 00 + + // override (BaseFormComponent) + const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSEquipType_Component"; } + void InitializeDataComponent() override; // 02 - { return; } + + // add + [[nodiscard]] virtual BGSEquipSlot* GetEquipSlot(const TBO_InstanceData* a_data) const; // 06 + virtual void SetEquipSlot(BGSEquipSlot* a_slot); // 07 + + // members + BGSEquipSlot* equipSlot; // 08 + }; + static_assert(sizeof(BGSEquipType) == 0x10); +} diff --git a/CommonLibSF/include/RE/B/BGSMenuDisplayObject.h b/CommonLibSF/include/RE/B/BGSMenuDisplayObject.h new file mode 100644 index 00000000..310d4595 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSMenuDisplayObject.h @@ -0,0 +1,24 @@ +#pragma once + +#include "RE/B/BaseFormComponent.h" + +namespace RE +{ + class TESBoundObject; + + class BGSMenuDisplayObject : public BaseFormComponent + { + public: + SF_RTTI(BGSMenuDisplayObject); + + virtual ~BGSMenuDisplayObject() override; // 00 + + // override (BaseFormComponent) + const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSMenuDisplayObject_Component"; } + void InitializeDataComponent() override; // 02 - { return; } + + // members + TESBoundObject* menuObject; // 08 + }; + static_assert(sizeof(BGSMenuDisplayObject) == 0x10); +} diff --git a/CommonLibSF/include/RE/B/BGSObjectPlacementDefaults.h b/CommonLibSF/include/RE/B/BGSObjectPlacementDefaults.h index a947174f..bba0f310 100644 --- a/CommonLibSF/include/RE/B/BGSObjectPlacementDefaults.h +++ b/CommonLibSF/include/RE/B/BGSObjectPlacementDefaults.h @@ -9,7 +9,7 @@ namespace RE public: SF_RTTI_VTABLE(BGSObjectPlacementDefaults); - ~BGSObjectPlacementDefaults() override; + ~BGSObjectPlacementDefaults() override; // 00 // override (BaseFormComponent) const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSObjectPaletteDefaults_Component"; } ??? @@ -17,9 +17,6 @@ namespace RE // members std::uint64_t unk08; // 08 - std::uint32_t unk10; // 10 - std::uint32_t unk14; // 14 - std::uint32_t unk18; // 18 }; - static_assert(sizeof(BGSObjectPlacementDefaults) == 0x20); + static_assert(sizeof(BGSObjectPlacementDefaults) == 0x10); } diff --git a/CommonLibSF/include/RE/B/BGSPreviewTransform.h b/CommonLibSF/include/RE/B/BGSPreviewTransform.h index f23bdb94..c6634f3a 100644 --- a/CommonLibSF/include/RE/B/BGSPreviewTransform.h +++ b/CommonLibSF/include/RE/B/BGSPreviewTransform.h @@ -4,26 +4,21 @@ namespace RE { + class BGSTransform; + class BGSPreviewTransform : public BaseFormComponent { public: SF_RTTI_VTABLE(BGSPreviewTransform); - virtual ~BGSPreviewTransform() override; + ~BGSPreviewTransform() override; // 00 // override (BaseFormComponent) const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSPreviewTransform_Component"; } void InitializeDataComponent() override; // 02 - { return; } // members - std::uint64_t unk08; // 08 - std::uint64_t unk10; // 10 - std::uint64_t unk18; // 18 - std::uint64_t unk20; // 20 - std::uint64_t unk28; // 28 - std::uint64_t unk30; // 30 - std::uint64_t unk38; // 38 - std::uint64_t unk40; // 40 + BGSTransform* transforms[8]; // 08 }; static_assert(sizeof(BGSPreviewTransform) == 0x48); } diff --git a/CommonLibSF/include/RE/E/EffectItem.h b/CommonLibSF/include/RE/E/EffectItem.h new file mode 100644 index 00000000..71110f49 --- /dev/null +++ b/CommonLibSF/include/RE/E/EffectItem.h @@ -0,0 +1,33 @@ +#pragma once + +namespace RE +{ + class EffectSetting; + class TESGlobal; + + struct EffectItemData + { + public: + // members + float magnitude; // 0 + float area; // 4 + std::int32_t duration; // 8 + }; + static_assert(sizeof(EffectItemData) == 0xC); + + class EffectItem + { + public: + // members + EffectItemData data; // 00 + EffectSetting* effectSetting; // 10 + TESGlobal* magGlobal; // 18 + TESGlobal* areaGlobal; // 20 + TESGlobal* durationGlobal; // 28 + std::uint32_t unk30; // 30 + std::uint32_t unk34; // 34 + float rawCost; // 38 + std::uint64_t conditions[2]; // 40 - TESCondition + }; + static_assert(sizeof(EffectItem) == 0x50); +} diff --git a/CommonLibSF/include/RE/M/MagicItem.h b/CommonLibSF/include/RE/M/MagicItem.h new file mode 100644 index 00000000..a14c49f9 --- /dev/null +++ b/CommonLibSF/include/RE/M/MagicItem.h @@ -0,0 +1,87 @@ +#pragma once + +#include "RE/B/BGSKeywordForm.h" +#include "RE/B/BSTArray.h" +#include "RE/B/BSTSmartPointer.h" +#include "RE/M/MagicSystem.h" +#include "RE/T/TESBoundObject.h" +#include "RE/T/TESFullName.h" + +namespace RE +{ + enum class CHUNK_ID; + + class ActorValueInfo; + class EffectItem; + class EffectSetting; + class QueuedFile; + + class MagicItem : + public TESBoundObject, // 000 + public TESFullName, // 118 + public BGSKeywordForm // 128 + { + public: + SF_RTTI_VTABLE(MagicItem); + + struct SkillUsageData + { + public: + // members + EffectItem* effect; // 00 + ActorValueInfo* skill; // 08 + float magnitude; // 10 + bool custom; // 14 + }; + static_assert(sizeof(SkillUsageData) == 0x18); + + class Data + { + public: + // members + std::int32_t costOverride; // 0 + std::uint32_t flags; // 4 + }; + static_assert(sizeof(Data) == 0x8); + + ~MagicItem() override; // 00 + + // add + virtual MagicSystem::SpellType GetSpellType() const; // 82 + virtual void SetCastingType(MagicSystem::CastingType a_castingType); // 83 + virtual MagicSystem::CastingType GetCastingType() const; // 84 + virtual void SetDelivery(MagicSystem::Delivery a_delivery); // 85 + virtual MagicSystem::Delivery GetDelivery() const; // 86 + virtual bool IsValidDelivery(MagicSystem::Delivery); // 87 + virtual float GetFixedCastDuration() const; // 88 + virtual float GetRange() const; // 89 + virtual bool IgnoreResistance() const; // 8A + virtual bool IgnoreLOS() const; // 8B + virtual bool IsFood() const; // 8C + virtual bool GetNoAbsorb() const; // 8D + virtual bool GetNoDualCastModifications() const; // 8E + virtual bool GetSkillUsageData(SkillUsageData& a_data) const; // 8F + virtual bool IsPoison() const; // 90 + virtual bool IsMedicine() const; // 91 + virtual void AdjustCost(float& a_cost, Actor* a_actor) const; // 92 + virtual float GetChargeTime() const; // 93 + virtual std::uint32_t GetMaxEffectCount() const; // 94 + virtual ActorValueInfo* GetAssociatedSkill() const; // 95 + virtual CHUNK_ID GetChunkID(); // 96 + virtual void CopyMagicItemData(MagicItem* a_copy); // 97 + virtual void LoadMagicItemChunk(TESFile* a_file, CHUNK_ID a_chunkID); // 98 + virtual void LoadChunkDataPostProcess(TESFile* a_file); // 99 + virtual Data* GetData1(); // 9A + virtual const Data* GetData2() const; // 9B + virtual std::size_t GetDataSize() const; // 9C + virtual void InitFromChunk(TESFile* a_file); // 9D + + // members + BSTArray listOfEffects; // 158 + std::int32_t hostileCount; // 168 + EffectSetting* avEffectSetting; // 170 + std::uint32_t preloadCount; // 174 + BSTSmartPointer preloadedItem; // 180 + }; + static_assert(sizeof(MagicItem) == 0x188); +} diff --git a/CommonLibSF/include/RE/M/MagicSystem.h b/CommonLibSF/include/RE/M/MagicSystem.h new file mode 100644 index 00000000..bd33d58c --- /dev/null +++ b/CommonLibSF/include/RE/M/MagicSystem.h @@ -0,0 +1,67 @@ +#pragma once + +namespace RE::MagicSystem +{ + enum class CannotCastReason + { + kOK = 0, + kMagicka = 1, + kPowerUsed = 2, + kRangedUnderWater = 3, + kMultipleCast = 4, + kItemCharge = 5, + kCastWhileShouting = 6, + kShoutWhileCasting = 7, + kStarPower = 8 + }; + + enum class CastingSource + { + kLeftHand = 0, + kRightHand = 1, + kOther = 2, + kInstant = 3 + }; + + enum class CastingType + { + kConstantEffect = 0, + kFireAndForget = 1, + kConcentration = 2, + kScroll = 3 + }; + + enum class Delivery + { + kSelf = 0, + kTouch = 1, + kAimed = 2, + kTargetActor = 3, + kTargetLocation = 4, + + kTotal + }; + + enum class SpellType + { + kSpell = 0, + kDisease = 1, + kPower = 2, + kLesserPower = 3, + kAbility = 4, + kPoison = 5, + kEnchantment = 6, + + kPotion = 7, + kAlchemy = static_cast>(kPotion), + + kWortCraft = 8, + kIngredient = static_cast>(kWortCraft), + + kLeveledSpell = 9, + kAddiction = 10, + kVoicePower = 11, + kStaffEnchantment = 12, + kScroll = 13 + }; +} diff --git a/CommonLibSF/include/RE/S/SpellItem.h b/CommonLibSF/include/RE/S/SpellItem.h new file mode 100644 index 00000000..154efd77 --- /dev/null +++ b/CommonLibSF/include/RE/S/SpellItem.h @@ -0,0 +1,49 @@ +#pragma once + +#include "RE/B/BGSEquipType.h" +#include "RE/B/BGSMenuDisplayObject.h" +#include "RE/B/BGSPickupPutdownSounds.h" +#include "RE/M/MagicItem.h" +#include "RE/T/TESDescription.h" + +namespace RE +{ + class BGSPerk; + + class SpellItem : + public MagicItem, // 000 + public BGSEquipType, // 188 + public BGSMenuDisplayObject, // 198 + public BGSPickupPutdownSounds, // 1A8 + public TESDescription // 210 + { + public: + SF_RTTI_VTABLE(SpellItem); + SF_FORMTYPE(SPEL); + + class Data : + public MagicItem::Data // 00 + { + public: + // members + stl::enumeration spellType; // 08 + float chargeTime; // 0C + stl::enumeration castingType; // 10 + stl::enumeration delivery; // 11 + float castDuration; // 14 + float range; // 18 + BGSPerk* castingPerk; // 20 + }; + static_assert(sizeof(Data) == 0x28); + + ~SpellItem() override; // 00 + + // add + virtual bool IsSpell(); // 9E - return { GetSpellType() == 0; } + virtual void SetSpellType(MagicSystem::SpellType a_spellType); // 9F + + // members + Data data; // 228 + }; + static_assert(sizeof(SpellItem) == 0x250); +} diff --git a/CommonLibSF/include/RE/T/TESBoundAnimObject.h b/CommonLibSF/include/RE/T/TESBoundAnimObject.h index da611ab4..33ee9536 100644 --- a/CommonLibSF/include/RE/T/TESBoundAnimObject.h +++ b/CommonLibSF/include/RE/T/TESBoundAnimObject.h @@ -9,11 +9,7 @@ namespace RE public: SF_RTTI_VTABLE(TESBoundAnimObject); - virtual ~TESBoundAnimObject(); - - // add - virtual void Unk_80(); // 80 - virtual void Unk_81(); // 81 + ~TESBoundAnimObject() override; // 00 }; static_assert(sizeof(TESBoundAnimObject) == 0x118); } diff --git a/CommonLibSF/include/RE/T/TESBoundObject.h b/CommonLibSF/include/RE/T/TESBoundObject.h index f4f43db2..7b5592c7 100644 --- a/CommonLibSF/include/RE/T/TESBoundObject.h +++ b/CommonLibSF/include/RE/T/TESBoundObject.h @@ -10,6 +10,7 @@ namespace RE { class BGSVoiceType; + class NiAVObject; class TESBoundObject : public TESObject { @@ -19,26 +20,28 @@ namespace RE ~TESBoundObject() override; // add - virtual void Unk_6C(); // 6C - virtual void Unk_6D(); // 6D - virtual void Unk_6E(); // 6E - virtual void Unk_6F(); // 6F - virtual void Unk_70(); // 70 - virtual void Unk_71(); // 71 - virtual void Unk_72(); // 72 - virtual void Unk_73(); // 73 - virtual void Unk_74(); // 74 - virtual void Unk_75(); // 75 - virtual void Unk_76(); // 76 - virtual BGSVoiceType* GetObjectVoiceType() const; // 77 - virtual void Unk_78(); // 78 - virtual void Unk_79(); // 79 - virtual void Unk_7A(); // 7A - virtual void Unk_7B(); // 7B - virtual void Unk_7C(); // 7C - virtual void Unk_7D(); // 7D - virtual void Unk_7E(); // 7E - virtual void Unk_7F(); // 7F + virtual void Unk_6C(); // 6C + virtual void Unk_6D(); // 6D + virtual void Unk_6E(); // 6E + virtual void Unk_6F(); // 6F + virtual void Unk_70(); // 70 + virtual void Unk_71(); // 71 + virtual void Unk_72(); // 72 + virtual void Unk_73(); // 73 + virtual void Unk_74(); // 74 + virtual void Unk_75(); // 75 + virtual void Unk_76(); // 76 + virtual BGSVoiceType* GetObjectVoiceType() const; // 77 + virtual void Clone3D(TESObjectREFR* a_requester, NiPointer& a_obj3D); // 78 + virtual void Unk_79(); // 79 + virtual void Unk_7A(); // 7A + virtual void Unk_7B(); // 7B + virtual void Unk_7C(); // 7C + virtual void Unk_7D(); // 7D + virtual void Unk_7E(); // 7E + virtual void Unk_7F(); // 7F + virtual void Unk_80(); // 80 + virtual void Unk_81(); // 81 // members BGSSnapTemplateComponent snapTemplate; // 038 @@ -47,7 +50,11 @@ namespace RE BGSMod::Template::Items templateItems; // 068 BGSPreviewTransform previewTransform; // 088 BGSObjectPlacementDefaults placementDefaults; // 0D0 + std::uint32_t unk0E0; // 0E0 + std::uint32_t unk0E4; // 0E4 + std::uint32_t unk0E8; // 0E8 std::uint32_t unk0F0; // 0F0 + std::uint32_t unk0F4; // 0F4 std::uint64_t unk0F8; // 0F8 std::uint64_t unk100; // 100 std::uint64_t unk108; // 108