CommonLibSSE NG
IngredientItem.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BGSEquipType.h"
6 #include "RE/F/FormTypes.h"
7 #include "RE/M/MagicItem.h"
8 #include "RE/T/TESIcon.h"
10 #include "RE/T/TESValueForm.h"
11 #include "RE/T/TESWeightForm.h"
12 
13 namespace RE
14 {
16  public MagicItem, // 000
17  public TESModelTextureSwap, // 090
18  public TESIcon, // 0C8
19  public TESWeightForm, // 0D8
20  public BGSEquipType, // 0E8
21  public BGSDestructibleObjectForm, // 0F8
22  public BGSPickupPutdownSounds, // 108
23  public TESValueForm // 120
24  {
25  public:
26  inline static constexpr auto RTTI = RTTI_IngredientItem;
27  inline static constexpr auto VTABLE = VTABLE_IngredientItem;
28  inline static constexpr auto FORMTYPE = FormType::Ingredient;
29 
30  enum class IngredientFlag
31  {
32  kNone = 0,
33  kCostOverride = 1 << 0,
34  kFoodItem = 1 << 1,
35  kExtendDuration = 1 << 3,
36  kReferencesPersist = 1 << 8
37  };
38 
39  struct ChangeFlags
40  {
41  enum ChangeFlag : std::uint32_t
42  {
43  kIngredientUse = (std::uint32_t)1 << 31
44  };
45  };
46 
47  struct RecordFlags
48  {
49  enum RecordFlag : std::uint32_t
50  {
51  kDeleted = 1 << 5,
52  kIgnored = 1 << 12
53  };
54  };
55 
56  class Data // ENIT
57  {
58  public:
59  // members
60  std::int32_t costOverride; // 00
62  };
63  static_assert(sizeof(Data) == 0x8);
64 
65  struct GameData
66  {
67  public:
68  // members
69  std::uint16_t knownEffectFlags;
70  std::uint16_t playerUses;
71  };
72  static_assert(sizeof(GameData) == 0x4);
73 
74  ~IngredientItem() override; // 00
75 
76  // override (MagicItem)
77  void InitializeData() override; // 04
78  void ClearData() override; // 05
79  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
80  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
81  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
82  void InitItemImpl() override; // 13
83  MagicSystem::SpellType GetSpellType() const override; // 53 - { return MagicSystem::SpellType::kIngredient; }
84  MagicSystem::CastingType GetCastingType() const override; // 55 - { return MagicSystem::CastingType::kFireAndForget; }
85  MagicSystem::Delivery GetDelivery() const override; // 57 - { return MagicSystem::Delivery::kSelf; }
86  bool IsFood() const override; // 5D - { return (GetData()->flags >> 1) & 1; }
87  bool GetSkillUsageData(SkillUsageData& a_data) const override; // 60
88  std::uint32_t GetMaxEffectCount() const override; // 65 - { return 4; }
89  ActorValue GetAssociatedSkill() const override; // 66 - { return ActorValue::kConfidence; }
90  std::uint32_t GetChunkID() override; // 68 - { return 'ENIT'; }
91  void CopyMagicItemData(MagicItem* a_src) override; // 69
92  void LoadMagicItemChunk(TESFile* a_mod, std::uint32_t a_chunkID) override; // 6A
93  const MagicItem::Data* GetData1() const override; // 6C - { return &effectData; }
94  MagicItem::Data* GetData2() override; // 6D - { return &effectData; }
95  std::uint32_t GetDataSize() const override; // 6E - { return 0x8; }
96  void InitFromChunk(TESFile* a_mod) override; // 6F
97  void InitChunk() override; // 70
98 
99  // override (BGSKeywordForm)
100  [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
101 
102  bool LearnEffect(std::uint32_t a_index);
103  bool LearnEffect(EffectSetting* a_effect);
104  std::optional<std::uint32_t> LearnNextEffect();
106 
107  // members
108  Data data; // 130 - ENIT
110  std::uint32_t pad13C; // 13C
111  };
112  static_assert(sizeof(IngredientItem) == 0x140);
113 }
Definition: BGSDestructibleObjectForm.h:61
Definition: BGSEquipType.h:9
Definition: BGSKeyword.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSPickupPutdownSounds.h:10
Definition: BGSSaveFormBuffer.h:8
Definition: EffectSetting.h:24
Definition: IngredientItem.h:57
stl::enumeration< IngredientFlag, std::uint32_t > flags
Definition: IngredientItem.h:61
std::int32_t costOverride
Definition: IngredientItem.h:60
Definition: IngredientItem.h:24
ActorValue GetAssociatedSkill() const override
static constexpr auto FORMTYPE
Definition: IngredientItem.h:28
bool IsFood() const override
bool GetSkillUsageData(SkillUsageData &a_data) const override
Data data
Definition: IngredientItem.h:108
std::uint32_t pad13C
Definition: IngredientItem.h:110
static constexpr auto VTABLE
Definition: IngredientItem.h:27
bool LearnEffect(EffectSetting *a_effect)
void ClearData() override
MagicSystem::CastingType GetCastingType() const override
void Revert(BGSLoadFormBuffer *a_buf) override
std::optional< std::uint32_t > LearnNextEffect()
void InitChunk() override
MagicItem::Data * GetData2() override
MagicSystem::Delivery GetDelivery() const override
std::uint32_t GetChunkID() override
static constexpr auto RTTI
Definition: IngredientItem.h:26
MagicSystem::SpellType GetSpellType() const override
void CopyMagicItemData(MagicItem *a_src) override
void InitFromChunk(TESFile *a_mod) override
GameData gamedata
Definition: IngredientItem.h:109
void SaveGame(BGSSaveFormBuffer *a_buf) override
void InitializeData() override
~IngredientItem() override
void LoadMagicItemChunk(TESFile *a_mod, std::uint32_t a_chunkID) override
std::uint32_t GetDataSize() const override
const MagicItem::Data * GetData1() const override
BGSKeyword * GetDefaultKeyword() const override
bool LearnEffect(std::uint32_t a_index)
void LoadGame(BGSLoadFormBuffer *a_buf) override
IngredientFlag
Definition: IngredientItem.h:31
void InitItemImpl() override
std::uint32_t GetMaxEffectCount() const override
Definition: MagicItem.h:58
Definition: MagicItem.h:30
Definition: TESFile.h:17
Definition: TESIcon.h:8
Definition: TESModelTextureSwap.h:10
Definition: TESValueForm.h:8
Definition: TESWeightForm.h:8
SpellType
Definition: MagicSystem.h:61
CastingType
Definition: MagicSystem.h:32
Delivery
Definition: MagicSystem.h:40
Definition: AbsorbEffect.h:6
ActorValue
Definition: ActorValues.h:6
constexpr REL::VariantID RTTI_IngredientItem(513879, 392268, 0x1ed77b8)
constexpr std::array< REL::VariantID, 10 > VTABLE_IngredientItem
Definition: Offsets_VTABLE.h:36
Definition: IngredientItem.h:40
ChangeFlag
Definition: IngredientItem.h:42
@ kIngredientUse
Definition: IngredientItem.h:43
Definition: IngredientItem.h:66
std::uint16_t playerUses
Definition: IngredientItem.h:70
std::uint16_t knownEffectFlags
Definition: IngredientItem.h:69
Definition: IngredientItem.h:48
RecordFlag
Definition: IngredientItem.h:50
@ kIgnored
Definition: IngredientItem.h:52
@ kDeleted
Definition: IngredientItem.h:51
Definition: MagicItem.h:44