CommonLibSSE (powerof3)
InventoryEntryData.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSTList.h"
4 #include "RE/E/ExtraDataList.h"
5 #include "RE/F/FormTypes.h"
6 #include "RE/M/MemoryManager.h"
7 #include "RE/S/SoulLevels.h"
8 
9 namespace RE
10 {
11  class ExtraDataList;
12  class TESBoundObject;
13 
15  {
16  public:
17  InventoryEntryData() noexcept = default;
19 
21  object(std::exchange(a_rhs.object, nullptr)),
22  extraLists(std::exchange(a_rhs.extraLists, nullptr)),
23  countDelta(std::exchange(a_rhs.countDelta, 0))
24  {}
25 
26  InventoryEntryData(TESBoundObject* a_object, std::int32_t a_countDelta) :
27  object(a_object),
28  countDelta(a_countDelta)
29  {}
30 
32 
35 
36  void AddExtraList(ExtraDataList* a_extra);
37  [[nodiscard]] const char* GetDisplayName();
38  [[nodiscard]] EnchantmentItem* GetEnchantment() const;
39  [[nodiscard]] std::optional<double> GetEnchantmentCharge() const;
40  [[nodiscard]] constexpr TESBoundObject* GetObject() noexcept { return object; }
41  [[nodiscard]] constexpr const TESBoundObject* GetObject() const noexcept { return object; }
42  [[nodiscard]] TESForm* GetOwner();
43  [[nodiscard]] SOUL_LEVEL GetSoulLevel() const;
44  [[nodiscard]] std::int32_t GetValue() const;
45  [[nodiscard]] float GetWeight() const;
46  [[nodiscard]] bool IsEnchanted() const;
47  [[nodiscard]] bool IsFavorited() const;
48  [[nodiscard]] bool IsLeveled() const;
49  [[nodiscard]] bool IsPoisoned() const;
50  [[nodiscard]] bool IsWorn() const;
51  [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, bool a_defaultTo = true);
52  [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo = true);
53  [[nodiscard]] bool IsQuestObject() const;
54  void PoisonObject(AlchemyItem* a_alchItem, std::uint32_t a_count);
55 
57 
58  // members
59  TESBoundObject* object{ nullptr }; // 00
61  std::int32_t countDelta{ 0 }; // 10
62  std::uint32_t pad14{ 0 }; // 14
63 
64  private:
65  [[nodiscard]] bool IsOwnedBy_Impl(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo);
66 
67  template <class T>
68  [[nodiscard]] bool HasExtraDataType() const
69  {
70  if (extraLists) {
71  for (const auto& xList : *extraLists) {
72  if (xList && xList->HasType<T>()) {
73  return true;
74  }
75  }
76  }
77 
78  return false;
79  }
80  };
81  static_assert(sizeof(InventoryEntryData) == 0x18);
82 }
Definition: Actor.h:133
Definition: AlchemyItem.h:24
Definition: BSTList.h:10
Definition: EnchantmentItem.h:10
Definition: ExtraDataList.h:49
Definition: InventoryEntryData.h:15
std::optional< double > GetEnchantmentCharge() const
bool IsFavorited() const
float GetWeight() const
TESBoundObject * object
Definition: InventoryEntryData.h:59
bool IsLeveled() const
bool IsEnchanted() const
void AddExtraList(ExtraDataList *a_extra)
std::int32_t countDelta
Definition: InventoryEntryData.h:61
BSSimpleList< ExtraDataList * > * extraLists
Definition: InventoryEntryData.h:60
bool IsOwnedBy(Actor *a_testOwner, TESForm *a_itemOwner, bool a_defaultTo=true)
constexpr const TESBoundObject * GetObject() const noexcept
Definition: InventoryEntryData.h:41
bool IsPoisoned() const
InventoryEntryData() noexcept=default
std::uint32_t pad14
Definition: InventoryEntryData.h:62
bool IsOwnedBy(Actor *a_testOwner, bool a_defaultTo=true)
constexpr TESBoundObject * GetObject() noexcept
Definition: InventoryEntryData.h:40
bool IsQuestObject() const
const char * GetDisplayName()
SOUL_LEVEL GetSoulLevel() const
EnchantmentItem * GetEnchantment() const
InventoryEntryData & operator=(const InventoryEntryData &a_rhs)
std::int32_t GetValue() const
InventoryEntryData(TESBoundObject *a_object, std::int32_t a_countDelta)
Definition: InventoryEntryData.h:26
void PoisonObject(AlchemyItem *a_alchItem, std::uint32_t a_count)
InventoryEntryData & operator=(InventoryEntryData &&a_rhs)
Definition: TESBoundObject.h:24
Definition: TESForm.h:36
Definition: AbsorbEffect.h:6
SOUL_LEVEL
Definition: SoulLevels.h:6
Definition: EffectArchetypes.h:65