CommonLibSSE (powerof3)
TESObjectBOOK.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/ActorValues.h"
5 #include "RE/B/BGSKeywordForm.h"
6 #include "RE/B/BGSMessageIcon.h"
8 #include "RE/F/FormTypes.h"
9 #include "RE/T/TESBoundObject.h"
10 #include "RE/T/TESDescription.h"
11 #include "RE/T/TESFullName.h"
12 #include "RE/T/TESIcon.h"
14 #include "RE/T/TESValueForm.h"
15 #include "RE/T/TESWeightForm.h"
16 
17 namespace RE
18 {
19  struct OBJ_BOOK // DATA
20  {
21  enum class Flag
22  {
23  kNone = 0,
24  kAdvancesActorValue = 1 << 0,
25  kCantTake = 1 << 1,
26  kTeachesSpell = 1 << 2, // takes priority over skill
27  kHasBeenRead = 1 << 3
28  };
29 
30  enum class Type
31  {
32  kBookTome = 0x00,
33  kNoteScroll = static_cast<std::underlying_type_t<Type>>(-1),
34  };
35 
36  union Teaches
37  {
40  };
41  static_assert(sizeof(Teaches) == 0x8);
42 
43  [[nodiscard]] Flag GetSanitizedType() const;
44 
45  // members
48  std::uint16_t pad02; // 02
49  std::uint32_t pad04; // 04
51  };
52  static_assert(sizeof(OBJ_BOOK) == 0x10);
53 
54  class TESObjectBOOK :
55  public TESBoundObject, // 00
56  public TESFullName, // 30
57  public TESModelTextureSwap, // 40
58  public TESIcon, // 78
59  public TESValueForm, // 88
60  public TESWeightForm, // 98
61  public TESDescription, // A8
62  public BGSDestructibleObjectForm, // B8
63  public BGSMessageIcon, // C8
64  public BGSPickupPutdownSounds, // E0
65  public BGSKeywordForm // F8
66  {
67  public:
68  inline static constexpr auto RTTI = RTTI_TESObjectBOOK;
69  inline static constexpr auto VTABLE = VTABLE_TESObjectBOOK;
70  inline static constexpr auto FORMTYPE = FormType::Book;
71 
72  struct ChangeFlags
73  {
74  enum ChangeFlag : std::uint32_t
75  {
76  kTeachesSkill = 1 << 5,
77  kRead = 1 << 6
78  };
79  };
80 
81  struct RecordFlags
82  {
83  enum RecordFlag : std::uint32_t
84  {
85  kDeleted = 1 << 5,
86  kIgnored = 1 << 12
87  };
88  };
89 
90  ~TESObjectBOOK() override; // 00
91 
92  // override (TESBoundObject)
93  void InitializeData() override; // 04
94  void ClearData() override; // 05 - { return TESForm::ClearData(); }
95  bool Load(TESFile* a_mod) override; // 06
96  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
97  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
98  void InitItemImpl() override; // 13
99  bool Activate(TESObjectREFR* a_targetRef, TESObjectREFR* a_activatorRef, std::uint8_t a_arg3, TESBoundObject* a_object, std::int32_t a_targetCount) override; // 37
100  bool GetActivateText(TESObjectREFR* a_activator, BSString& a_dst) override; // 4C
101 
102  // override (BGSKeywordForm)
103  [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05
104 
105  [[nodiscard]] bool TeachesSkill() const;
106  [[nodiscard]] bool TeachesSpell() const;
107  [[nodiscard]] bool IsRead() const;
108  [[nodiscard]] bool CanBeTaken() const;
109  [[nodiscard]] bool IsBookTome() const;
110  [[nodiscard]] bool IsNoteScroll() const;
111  [[nodiscard]] ActorValue GetSkill() const;
113  bool Read(TESObjectREFR* a_reader);
114 
115  // members
116  OBJ_BOOK data; // 110 - DATA
119  };
120  static_assert(sizeof(TESObjectBOOK) == 0x138);
121 }
Definition: BGSDestructibleObjectForm.h:61
Definition: BGSKeywordForm.h:12
Definition: BGSKeyword.h:10
Definition: BGSLoadFormBuffer.h:11
Definition: BGSMessageIcon.h:9
Definition: BGSPickupPutdownSounds.h:10
Definition: BGSSaveFormBuffer.h:8
Definition: SpellItem.h:16
Definition: TESBoundObject.h:24
Definition: TESDescription.h:12
Definition: TESFile.h:17
Definition: TESFullName.h:9
Definition: TESIcon.h:8
Definition: TESModelTextureSwap.h:10
Definition: TESObjectBOOK.h:66
SpellItem * GetSpell()
bool IsNoteScroll() const
static constexpr auto FORMTYPE
Definition: TESObjectBOOK.h:70
void InitItemImpl() override
BGSKeyword * GetDefaultKeyword() const override
static constexpr auto RTTI
Definition: TESObjectBOOK.h:68
bool IsBookTome() const
bool Load(TESFile *a_mod) override
ActorValue GetSkill() const
bool Read(TESObjectREFR *a_reader)
OBJ_BOOK data
Definition: TESObjectBOOK.h:116
bool Activate(TESObjectREFR *a_targetRef, TESObjectREFR *a_activatorRef, std::uint8_t a_arg3, TESBoundObject *a_object, std::int32_t a_targetCount) override
TESObjectSTAT * inventoryModel
Definition: TESObjectBOOK.h:117
bool IsRead() const
bool GetActivateText(TESObjectREFR *a_activator, BSString &a_dst) override
void ClearData() override
bool TeachesSpell() const
TESDescription itemCardDescription
Definition: TESObjectBOOK.h:118
bool CanBeTaken() const
void LoadGame(BGSLoadFormBuffer *a_buf) override
void SaveGame(BGSSaveFormBuffer *a_buf) override
static constexpr auto VTABLE
Definition: TESObjectBOOK.h:69
void InitializeData() override
~TESObjectBOOK() override
bool TeachesSkill() const
Definition: TESObjectREFR.h:114
Definition: TESObjectSTAT.h:30
Definition: TESValueForm.h:8
Definition: TESWeightForm.h:8
Definition: AbsorbEffect.h:6
ActorValue
Definition: ActorValues.h:6
constexpr std::array< REL::ID, 11 > VTABLE_TESObjectBOOK
Definition: Offsets_VTABLE.h:12860
constexpr REL::ID RTTI_TESObjectBOOK(static_cast< std::uint64_t >(513977))
Definition: TESObjectBOOK.h:20
REX::EnumSet< Flag, std::uint8_t > flags
Definition: TESObjectBOOK.h:46
REX::EnumSet< Type, std::uint8_t > type
Definition: TESObjectBOOK.h:47
std::uint32_t pad04
Definition: TESObjectBOOK.h:49
Type
Definition: TESObjectBOOK.h:31
Teaches teaches
Definition: TESObjectBOOK.h:50
std::uint16_t pad02
Definition: TESObjectBOOK.h:48
Flag GetSanitizedType() const
Flag
Definition: TESObjectBOOK.h:22
Definition: TESObjectBOOK.h:73
ChangeFlag
Definition: TESObjectBOOK.h:75
@ kRead
Definition: TESObjectBOOK.h:77
@ kTeachesSkill
Definition: TESObjectBOOK.h:76
Definition: TESObjectBOOK.h:82
RecordFlag
Definition: TESObjectBOOK.h:84
@ kIgnored
Definition: TESObjectBOOK.h:86
@ kDeleted
Definition: TESObjectBOOK.h:85
Definition: TESObjectBOOK.h:37
ActorValue actorValueToAdvance
Definition: TESObjectBOOK.h:38
SpellItem * spell
Definition: TESObjectBOOK.h:39