CommonLibSSE (powerof3)
InventoryEntryData.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSTList.h"
4 #include "RE/F/FormTypes.h"
5 #include "RE/M/MemoryManager.h"
6 #include "RE/S/SoulLevels.h"
7 
8 namespace RE
9 {
10  class ExtraDataList;
11  class TESBoundObject;
12 
14  {
15  public:
16  InventoryEntryData() noexcept = default;
18 
20  object(std::exchange(a_rhs.object, nullptr)),
21  extraLists(std::exchange(a_rhs.extraLists, nullptr)),
22  countDelta(std::exchange(a_rhs.countDelta, 0))
23  {}
24 
25  InventoryEntryData(TESBoundObject* a_object, std::int32_t a_countDelta) :
26  object(a_object),
27  countDelta(a_countDelta)
28  {}
29 
31 
34 
35  void AddExtraList(ExtraDataList* a_extra);
36  [[nodiscard]] const char* GetDisplayName();
37  [[nodiscard]] std::optional<double> GetEnchantmentCharge() const;
38  [[nodiscard]] constexpr TESBoundObject* GetObject() noexcept { return object; }
39  [[nodiscard]] constexpr const TESBoundObject* GetObject() const noexcept { return object; }
40  [[nodiscard]] TESForm* GetOwner();
41  [[nodiscard]] SOUL_LEVEL GetSoulLevel() const;
42 
43  [[nodiscard]] std::int32_t GetValue() const
44  {
45  using func_t = decltype(&InventoryEntryData::GetValue);
46  REL::Relocation<func_t> func{ REL::ID(15995) };
47  return func(this);
48  }
49 
50  [[nodiscard]] float GetWeight() const;
51  [[nodiscard]] bool IsEnchanted() const;
52  [[nodiscard]] bool IsLeveled() const;
53  [[nodiscard]] bool IsWorn() const;
54 
55  [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, bool a_defaultTo = true)
56  {
57  return IsOwnedBy(a_testOwner, GetOwner(), a_defaultTo);
58  }
59 
60  [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo = true)
61  {
62  return IsOwnedBy_Impl(a_testOwner, a_itemOwner, a_defaultTo);
63  }
64 
65  [[nodiscard]] bool IsQuestObject() const
66  {
67  using func_t = decltype(&InventoryEntryData::IsQuestObject);
68  REL::Relocation<func_t> func{ REL::ID(16005) };
69  return func(this);
70  }
71 
73 
74  // members
75  TESBoundObject* object{ nullptr }; // 00
77  std::int32_t countDelta{ 0 }; // 10
78  std::uint32_t pad14{ 0 }; // 14
79 
80  private:
81  [[nodiscard]] bool IsOwnedBy_Impl(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo)
82  {
83  using func_t = decltype(&InventoryEntryData::IsOwnedBy_Impl);
84  REL::Relocation<func_t> func{ REL::ID(16020) };
85  return func(this, a_testOwner, a_itemOwner, a_defaultTo);
86  }
87  };
88  static_assert(sizeof(InventoryEntryData) == 0x18);
89 }
Definition: Relocation.h:841
Definition: Relocation.h:867
Definition: Actor.h:125
Definition: BSTList.h:10
Definition: ExtraDataList.h:40
Definition: InventoryEntryData.h:14
std::optional< double > GetEnchantmentCharge() const
float GetWeight() const
TESBoundObject * object
Definition: InventoryEntryData.h:75
bool IsLeveled() const
bool IsEnchanted() const
void AddExtraList(ExtraDataList *a_extra)
std::int32_t countDelta
Definition: InventoryEntryData.h:77
BSSimpleList< ExtraDataList * > * extraLists
Definition: InventoryEntryData.h:76
bool IsOwnedBy(Actor *a_testOwner, TESForm *a_itemOwner, bool a_defaultTo=true)
Definition: InventoryEntryData.h:60
constexpr const TESBoundObject * GetObject() const noexcept
Definition: InventoryEntryData.h:39
InventoryEntryData() noexcept=default
std::uint32_t pad14
Definition: InventoryEntryData.h:78
bool IsOwnedBy(Actor *a_testOwner, bool a_defaultTo=true)
Definition: InventoryEntryData.h:55
constexpr TESBoundObject * GetObject() noexcept
Definition: InventoryEntryData.h:38
bool IsQuestObject() const
Definition: InventoryEntryData.h:65
const char * GetDisplayName()
SOUL_LEVEL GetSoulLevel() const
InventoryEntryData & operator=(const InventoryEntryData &a_rhs)
std::int32_t GetValue() const
Definition: InventoryEntryData.h:43
InventoryEntryData(TESBoundObject *a_object, std::int32_t a_countDelta)
Definition: InventoryEntryData.h:25
InventoryEntryData & operator=(InventoryEntryData &&a_rhs)
Definition: TESBoundObject.h:24
Definition: TESForm.h:34
Definition: AbsorbEffect.h:6
SOUL_LEVEL
Definition: SoulLevels.h:6
Definition: NiBinaryStream.h:94