CommonLibVR
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  bool CanItemBeTaken(bool a_noEquipped, bool a_noFavourited, bool a_noQuestItem) const;
38  [[nodiscard]] const char* GetDisplayName();
39  [[nodiscard]] EnchantmentItem* GetEnchantment() const;
40  [[nodiscard]] std::optional<double> GetEnchantmentCharge() const;
41  [[nodiscard]] constexpr TESBoundObject* GetObject() noexcept { return object; }
42  [[nodiscard]] constexpr const TESBoundObject* GetObject() const noexcept { return object; }
43  [[nodiscard]] TESForm* GetOwner();
44  [[nodiscard]] SOUL_LEVEL GetSoulLevel() const;
45  [[nodiscard]] std::int32_t GetValue() const;
46  [[nodiscard]] float GetWeight() const;
47  [[nodiscard]] bool IsEnchanted() const;
48  [[nodiscard]] bool IsFavorited() const;
49  [[nodiscard]] bool IsLeveled() const;
50  [[nodiscard]] bool IsPoisoned() const;
51  [[nodiscard]] bool IsWorn() const;
52  [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, bool a_defaultTo = true);
53  [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo = true);
54  [[nodiscard]] bool IsQuestObject() const;
55  void PoisonObject(AlchemyItem* a_alchItem, std::uint32_t a_count);
56 
58 
59  // members
60  TESBoundObject* object{ nullptr }; // 00
62  std::int32_t countDelta{ 0 }; // 10
63  std::uint32_t pad14{ 0 }; // 14
64 
65  private:
66  [[nodiscard]] bool IsOwnedBy_Impl(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo);
67 
68  template <class T>
69  [[nodiscard]] bool HasExtraDataType() const
70  {
71  if (extraLists) {
72  for (const auto& xList : *extraLists) {
73  if (xList && xList->HasType<T>()) {
74  return true;
75  }
76  }
77  }
78 
79  return false;
80  }
81 
82  private:
83  KEEP_FOR_RE()
84  };
85  static_assert(sizeof(InventoryEntryData) == 0x18);
86 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: Actor.h:133
Definition: AlchemyItem.h:24
Definition: BSTList.h:10
Definition: EnchantmentItem.h:10
Definition: ExtraDataList.h:51
Definition: InventoryEntryData.h:15
std::optional< double > GetEnchantmentCharge() const
bool IsFavorited() const
float GetWeight() const
TESBoundObject * object
Definition: InventoryEntryData.h:60
bool IsLeveled() const
bool IsEnchanted() const
void AddExtraList(ExtraDataList *a_extra)
std::int32_t countDelta
Definition: InventoryEntryData.h:62
BSSimpleList< ExtraDataList * > * extraLists
Definition: InventoryEntryData.h:61
bool IsOwnedBy(Actor *a_testOwner, TESForm *a_itemOwner, bool a_defaultTo=true)
constexpr const TESBoundObject * GetObject() const noexcept
Definition: InventoryEntryData.h:42
bool IsPoisoned() const
InventoryEntryData() noexcept=default
std::uint32_t pad14
Definition: InventoryEntryData.h:63
bool IsOwnedBy(Actor *a_testOwner, bool a_defaultTo=true)
constexpr TESBoundObject * GetObject() noexcept
Definition: InventoryEntryData.h:41
bool IsQuestObject() const
bool CanItemBeTaken(bool a_noEquipped, bool a_noFavourited, bool a_noQuestItem) 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:26
Definition: TESForm.h:40
Definition: AbsorbEffect.h:6
SOUL_LEVEL
Definition: SoulLevels.h:6
Definition: EffectArchetypes.h:65