CommonLibSSE (powerof3)
Loading...
Searching...
No Matches
InventoryEntryData.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSTList.h"
5#include "RE/F/FormTypes.h"
7#include "RE/S/SoulLevels.h"
8
9namespace 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
37 [[nodiscard]] const char* GetDisplayName();
38 [[nodiscard]] std::optional<double> GetEnchantmentCharge() const;
39 [[nodiscard]] constexpr TESBoundObject* GetObject() noexcept { return object; }
40 [[nodiscard]] constexpr const TESBoundObject* GetObject() const noexcept { return object; }
41 [[nodiscard]] TESForm* GetOwner();
42 [[nodiscard]] SOUL_LEVEL GetSoulLevel() const;
43
44 [[nodiscard]] std::int32_t GetValue() const
45 {
46 using func_t = decltype(&InventoryEntryData::GetValue);
47 REL::Relocation<func_t> func{ RELOCATION_ID(15757, 15995) };
48 return func(this);
49 }
50
51 [[nodiscard]] float GetWeight() const;
52 [[nodiscard]] bool IsEnchanted() const;
53 [[nodiscard]] bool IsFavorited() const;
54 [[nodiscard]] bool IsLeveled() const;
55 [[nodiscard]] bool IsPoisoned() const;
56 [[nodiscard]] bool IsWorn() const;
57
58 [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, bool a_defaultTo = true)
59 {
60 return IsOwnedBy(a_testOwner, GetOwner(), a_defaultTo);
61 }
62
63 [[nodiscard]] bool IsOwnedBy(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo = true)
64 {
65 return IsOwnedBy_Impl(a_testOwner, a_itemOwner, a_defaultTo);
66 }
67
68 [[nodiscard]] bool IsQuestObject() const
69 {
70 using func_t = decltype(&InventoryEntryData::IsQuestObject);
71 REL::Relocation<func_t> func{ RELOCATION_ID(15767, 16005) };
72 return func(this);
73 }
74
75 void PoisonObject(AlchemyItem* a_alchItem, std::uint32_t a_count)
76 {
77 using func_t = decltype(&InventoryEntryData::PoisonObject);
78 REL::Relocation<func_t> func{ RELOCATION_ID(15786, 16024) };
79 return func(this, a_alchItem, a_count);
80 }
81
83
84 // members
85 TESBoundObject* object{ nullptr }; // 00
87 std::int32_t countDelta{ 0 }; // 10
88 std::uint32_t pad14{ 0 }; // 14
89
90 private:
91 [[nodiscard]] bool IsOwnedBy_Impl(Actor* a_testOwner, TESForm* a_itemOwner, bool a_defaultTo)
92 {
93 using func_t = decltype(&InventoryEntryData::IsOwnedBy_Impl);
94 REL::Relocation<func_t> func{ RELOCATION_ID(15782, 16020) };
95 return func(this, a_testOwner, a_itemOwner, a_defaultTo);
96 }
97
98 template <class T>
99 [[nodiscard]] bool HasExtraDataType() const
100 {
101 if (extraLists) {
102 for (const auto& xList : *extraLists) {
103 if (xList && xList->HasType<T>()) {
104 return true;
105 }
106 }
107 }
108
109 return false;
110 }
111 };
112 static_assert(sizeof(InventoryEntryData) == 0x18);
113}
#define RELOCATION_ID(SE, AE)
Definition: PCH.h:711
Definition: Actor.h:127
Definition: AlchemyItem.h:24
Definition: BSTList.h:10
Definition: ExtraDataList.h:49
Definition: InventoryEntryData.h:15
bool IsFavorited() const
float GetWeight() const
TESBoundObject * object
Definition: InventoryEntryData.h:85
bool IsLeveled() const
constexpr const TESBoundObject * GetObject() const noexcept
Definition: InventoryEntryData.h:40
InventoryEntryData & operator=(const InventoryEntryData &a_rhs)
const char * GetDisplayName()
bool IsEnchanted() const
void AddExtraList(ExtraDataList *a_extra)
TESForm * GetOwner()
std::int32_t countDelta
Definition: InventoryEntryData.h:87
BSSimpleList< ExtraDataList * > * extraLists
Definition: InventoryEntryData.h:86
bool IsOwnedBy(Actor *a_testOwner, TESForm *a_itemOwner, bool a_defaultTo=true)
Definition: InventoryEntryData.h:63
TES_HEAP_REDEFINE_NEW()
bool IsPoisoned() const
InventoryEntryData() noexcept=default
std::uint32_t pad14
Definition: InventoryEntryData.h:88
bool IsOwnedBy(Actor *a_testOwner, bool a_defaultTo=true)
Definition: InventoryEntryData.h:58
constexpr TESBoundObject * GetObject() noexcept
Definition: InventoryEntryData.h:39
bool IsWorn() const
bool IsQuestObject() const
Definition: InventoryEntryData.h:68
std::optional< double > GetEnchantmentCharge() const
InventoryEntryData & operator=(InventoryEntryData &&a_rhs)
~InventoryEntryData()
SOUL_LEVEL GetSoulLevel() const
std::int32_t GetValue() const
Definition: InventoryEntryData.h:44
InventoryEntryData(TESBoundObject *a_object, std::int32_t a_countDelta)
Definition: InventoryEntryData.h:26
void PoisonObject(AlchemyItem *a_alchItem, std::uint32_t a_count)
Definition: InventoryEntryData.h:75
Definition: TESBoundObject.h:24
Definition: TESForm.h:35
Definition: Relocation.h:875
Definition: AbsorbEffect.h:6
SOUL_LEVEL
Definition: SoulLevels.h:6
Definition: EffectArchetypes.h:65