CommonLibVR
InventoryChanges.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSContainer.h"
4 #include "RE/B/BSTList.h"
5 #include "RE/F/FormTypes.h"
6 #include "RE/M/MemoryManager.h"
7 #include "RE/T/TESBoundObject.h"
8 
9 namespace RE
10 {
11  class ExtraDataList;
12  class InventoryEntryData;
13  class TESBoundObject;
14 
16  {
17  public:
18  enum class VisitResult : std::uint32_t
19  {
20  kStop = 0,
21  kContinue = 1,
22  };
23 
25  {
26  public:
27  inline static constexpr auto RTTI = RTTI_InventoryChanges__IItemChangeVisitor;
28  inline static constexpr auto VTABLE = VTABLE_InventoryChanges__IItemChangeVisitor;
29 
30  virtual ~IItemChangeVisitor() = default; // 00
31 
32  // add
33  virtual BSContainer::ForEachResult Visit(InventoryEntryData* a_entryData) = 0; // 01
34  virtual bool ShouldVisit([[maybe_unused]] InventoryEntryData* a_entryData, [[maybe_unused]] TESBoundObject* a_object) { return true; } // 02
35  virtual BSContainer::ForEachResult Unk_03(InventoryEntryData* a_entryData, [[maybe_unused]] void* a_arg2, bool* a_arg3) // 03
36  {
37  *a_arg3 = true;
38  return Visit(a_entryData);
39  }
40  };
41  static_assert(sizeof(IItemChangeVisitor) == 0x8);
42 
44  explicit InventoryChanges(TESObjectREFR* a_ref);
46 
49  TESObjectARMO* GetArmorInSlot(std::int32_t a_slot);
51  std::int16_t GetItemCount(RE::TESBoundObject* a_obj);
52  std::uint16_t GetNextUniqueID();
53  std::uint32_t GetWornMask();
56  void InitOutfitItems(BGSOutfit* a_outfit, std::uint16_t a_npcLevel);
57  void InitScripts();
58  void RemoveFavorite(InventoryEntryData* a_entry, ExtraDataList* a_itemList);
59  void RemoveAllItems(TESObjectREFR* a_ref, TESObjectREFR* a_moveToRef, bool a_arg4, bool a_keepOwnership, bool a_arg6);
60  void SendContainerChangedEvent(ExtraDataList* a_itemExtraList, TESObjectREFR* a_fromRefr, TESForm* a_item, std::int32_t a_count);
61  void SetFavorite(InventoryEntryData* a_entry, ExtraDataList* a_itemList);
62  void SetUniqueID(ExtraDataList* a_itemList, TESForm* a_oldForm, TESForm* a_newForm);
65 
67 
68  // members
70  TESObjectREFR* owner{ nullptr }; // 08
71  float totalWeight{ 0.0F }; // 10
72  float armorWeight{ 0.0F }; // 14
73  bool changed{ false }; // 18
74  std::uint8_t unk19{ 0 }; // 19
75  std::uint8_t unk1A{ 0 }; // 1A
76  std::uint8_t unk1B{ 0 }; // 1B
77  std::uint32_t unk1C{ 0 }; // 1C
78 
79  private:
80  InventoryChanges* Ctor(TESObjectREFR* a_ref);
81  void Dtor();
82 
83  private:
84  KEEP_FOR_RE()
85  };
86  static_assert(sizeof(InventoryChanges) == 0x20);
87 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: BGSOutfit.h:11
Definition: BSTList.h:10
Definition: ExtraDataList.h:51
Definition: InventoryChanges.h:25
virtual BSContainer::ForEachResult Unk_03(InventoryEntryData *a_entryData, [[maybe_unused]] void *a_arg2, bool *a_arg3)
Definition: InventoryChanges.h:35
static constexpr auto VTABLE
Definition: InventoryChanges.h:28
virtual BSContainer::ForEachResult Visit(InventoryEntryData *a_entryData)=0
static constexpr auto RTTI
Definition: InventoryChanges.h:27
virtual bool ShouldVisit([[maybe_unused]] InventoryEntryData *a_entryData, [[maybe_unused]] TESBoundObject *a_object)
Definition: InventoryChanges.h:34
Definition: InventoryChanges.h:16
VisitResult
Definition: InventoryChanges.h:19
void SetUniqueID(ExtraDataList *a_itemList, TESForm *a_oldForm, TESForm *a_newForm)
void AddEntryData(InventoryEntryData *a_entry)
std::int16_t GetItemCount(RE::TESBoundObject *a_obj)
std::uint16_t GetNextUniqueID()
float totalWeight
Definition: InventoryChanges.h:71
TESObjectARMO * GetArmorInSlot(std::int32_t a_slot)
void GenerateLeveledListChanges()
std::uint8_t unk19
Definition: InventoryChanges.h:74
void VisitInventory(IItemChangeVisitor &visitor)
std::uint32_t GetWornMask()
std::uint32_t unk1C
Definition: InventoryChanges.h:77
float armorWeight
Definition: InventoryChanges.h:72
void RemoveFavorite(InventoryEntryData *a_entry, ExtraDataList *a_itemList)
TESObjectREFR * owner
Definition: InventoryChanges.h:70
bool changed
Definition: InventoryChanges.h:73
std::uint8_t unk1B
Definition: InventoryChanges.h:76
void SendContainerChangedEvent(ExtraDataList *a_itemExtraList, TESObjectREFR *a_fromRefr, TESForm *a_item, std::int32_t a_count)
BSSimpleList< InventoryEntryData * > * entryList
Definition: InventoryChanges.h:69
void RemoveAllItems(TESObjectREFR *a_ref, TESObjectREFR *a_moveToRef, bool a_arg4, bool a_keepOwnership, bool a_arg6)
std::uint8_t unk1A
Definition: InventoryChanges.h:75
void SetFavorite(InventoryEntryData *a_entry, ExtraDataList *a_itemList)
void InitOutfitItems(BGSOutfit *a_outfit, std::uint16_t a_npcLevel)
void VisitWornItems(IItemChangeVisitor &visitor)
InventoryChanges(TESObjectREFR *a_ref)
Definition: InventoryEntryData.h:15
Definition: TESBoundObject.h:26
Definition: TESForm.h:40
Definition: TESObjectARMO.h:37
Definition: TESObjectREFR.h:113
ForEachResult
Definition: BSContainer.h:6
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 1 > VTABLE_InventoryChanges__IItemChangeVisitor
Definition: Offsets_VTABLE.h:11920
constexpr REL::ID RTTI_InventoryChanges__IItemChangeVisitor(static_cast< std::uint64_t >(684949))