Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SpellItem and related RE #203

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CommonLibSF/include/RE/B/BGSEquipType.h
Original file line number Diff line number Diff line change
@@ -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);
}
24 changes: 24 additions & 0 deletions CommonLibSF/include/RE/B/BGSMenuDisplayObject.h
Original file line number Diff line number Diff line change
@@ -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);
}
7 changes: 2 additions & 5 deletions CommonLibSF/include/RE/B/BGSObjectPlacementDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ namespace RE
public:
SF_RTTI_VTABLE(BGSObjectPlacementDefaults);

~BGSObjectPlacementDefaults() override;
~BGSObjectPlacementDefaults() override; // 00

// override (BaseFormComponent)
const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSObjectPaletteDefaults_Component"; } ???
void InitializeDataComponent() override; // 02 - { return; }

// 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);
}
13 changes: 4 additions & 9 deletions CommonLibSF/include/RE/B/BGSPreviewTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
33 changes: 33 additions & 0 deletions CommonLibSF/include/RE/E/EffectItem.h
Original file line number Diff line number Diff line change
@@ -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);
}
87 changes: 87 additions & 0 deletions CommonLibSF/include/RE/M/MagicItem.h
Original file line number Diff line number Diff line change
@@ -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<EffectItem*> listOfEffects; // 158
std::int32_t hostileCount; // 168
EffectSetting* avEffectSetting; // 170
std::uint32_t preloadCount; // 174
BSTSmartPointer<QueuedFile, BSTSmartPointerGamebryoRefCount> preloadedItem; // 180
};
static_assert(sizeof(MagicItem) == 0x188);
}
67 changes: 67 additions & 0 deletions CommonLibSF/include/RE/M/MagicSystem.h
Original file line number Diff line number Diff line change
@@ -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<std::underlying_type_t<SpellType>>(kPotion),

kWortCraft = 8,
kIngredient = static_cast<std::underlying_type_t<SpellType>>(kWortCraft),

kLeveledSpell = 9,
kAddiction = 10,
kVoicePower = 11,
kStaffEnchantment = 12,
kScroll = 13
};
}
49 changes: 49 additions & 0 deletions CommonLibSF/include/RE/S/SpellItem.h
Original file line number Diff line number Diff line change
@@ -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<MagicSystem::SpellType, std::uint8_t> spellType; // 08
float chargeTime; // 0C
stl::enumeration<MagicSystem::CastingType, std::uint8_t> castingType; // 10
stl::enumeration<MagicSystem::Delivery, std::uint8_t> 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);
}
6 changes: 1 addition & 5 deletions CommonLibSF/include/RE/T/TESBoundAnimObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Loading