CommonLibSSE NG
Loading...
Searching...
No Matches
TESNPC.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BGSHeadPart.h"
6#include "RE/B/BSTArray.h"
7#include "RE/B/BSTEvent.h"
8#include "RE/C/Color.h"
9#include "RE/F/FormTypes.h"
10#include "RE/M/MemoryManager.h"
11#include "RE/S/Sexes.h"
12#include "RE/S/SoundLevels.h"
13#include "RE/T/TESActorBase.h"
14#include "RE/T/TESRaceForm.h"
15
16namespace RE
17{
18 class BSFaceGenNiNode;
19 class MenuOpenCloseEvent;
20 class NiColorA;
21 class TintMask;
22
24 {
25 public:
26 // members
28 };
29 static_assert(sizeof(CreatureSounds) == 0x40);
30
31 class TESNPC :
32 public TESActorBase, // 000
33 public TESRaceForm, // 150
34 public BGSOverridePackCollection, // 160
35 public BSTEventSink<MenuOpenCloseEvent> // 188
36 {
37 public:
38 inline static constexpr auto RTTI = RTTI_TESNPC;
39 inline static constexpr auto VTABLE = VTABLE_TESNPC;
40
42 inline static constexpr auto FORMTYPE = FormType::NPC;
43
45 {
46 enum ChangeFlag : std::uint32_t
47 {
48 kBaseData = 1 << 1,
49 kAttributes = 1 << 2,
50 kAIData = 1 << 3,
51 kSpellList = 1 << 4,
52 kFullName = 1 << 5,
53 kFactions = 1 << 6,
54 kNPCSkills = 1 << 9,
55 kClass = 1 << 10,
56 kFace = 1 << 11,
57 kDefaultOutfit = 1 << 12,
58 kSleepOutfit = 1 << 13,
59 kGender = 1 << 24,
60 kRace = 1 << 25
61 };
62 };
63
65 {
66 enum RecordFlag : std::uint32_t
67 {
68 kDeleted = 1 << 5,
69 kIgnored = 1 << 12,
70 kCompressed = 1 << 18,
71 kBleedoutOverride = 1 << 29
72 };
73 };
74
75 struct Skills
76 {
77 public:
78 enum
79 {
83 kBlock = 3,
89 kSneak = 9,
98
99 kTotal
100 };
101
102 // members
103 std::uint8_t values[kTotal]; // 00
104 std::uint8_t offsets[kTotal]; // 12
105 std::uint16_t health; // 24
106 std::uint16_t magicka; // 26
107 std::uint16_t stamina; // 28
108 std::uint16_t pad2A; // 2A
110 };
111 static_assert(sizeof(Skills) == 0x30);
112
114 {
115 public:
117 ~HeadRelatedData() = default;
118
120
121 // members
122 BGSColorForm* hairColor; // 00 - HCLF
124 };
125 static_assert(sizeof(HeadRelatedData) == 0x10);
126
127 union Sounds
128 {
131 };
132 static_assert(sizeof(Sounds) == 0x8);
133
134 struct FaceData
135 {
136 public:
137 struct Morphs
138 {
139 enum
140 {
159 kUnk = 18,
160
161 kTotal = 19
162 };
163 };
164
165 struct Parts
166 {
167 enum
168 {
169 kNose = 0,
171 kEyes = 2,
173
174 kTotal = 4
175 };
176 };
177
178 enum
179 {
180 kDefault = 0x7F7FFFFF,
181 kTotalPresets = 4
182 };
183
184 // members
185 float morphs[Morphs::kTotal]; // 00 - NAM9
186 std::int32_t parts[Parts::kTotal]; // 4C - NAMA
187 };
188 static_assert(sizeof(FaceData) == 0x5C);
189
190 struct Layer
191 {
192 public:
193 [[nodiscard]] float GetInterpolationValue() const;
194
195 // members
196 Color tintColor; // 00 - TINC
197 std::uint16_t tintIndex; // 04 - TINI
198 std::uint16_t preset; // 06 - TIAS
199 std::uint16_t interpolationValue; // 08 - TINV - CK value * 100 as an int
200 std::uint16_t pad0A; // 0A
201 std::uint32_t pad0C; // 0C
202 };
203 static_assert(sizeof(Layer) == 0x10);
204
205 ~TESNPC() override; // 00
206
207 // override (TESActorBase)
208 void InitializeData() override; // 04
209 void ClearData() override; // 05
210 bool Load(TESFile* a_mod) override; // 06
211 bool FindInFileFast(TESFile* a_mod) override; // 0C
212 void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
213 void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
214 void Revert(BGSLoadFormBuffer* a_buf) override; // 12
215 void InitItemImpl() override; // 13
216 const char* GetTextForParsedSubTag(const BSFixedString& a_tag) const override; // 2E
217 void Copy(TESForm* a_srcForm) override; // 2F
218 bool Activate(TESObjectREFR* a_targetRef, TESObjectREFR* a_activatorRef, std::uint8_t a_arg3, TESBoundObject* a_object, std::int32_t a_targetCount) override; // 37
219 void UnClone3D(TESObjectREFR* a_ref) override; // 41
220 void SetObjectVoiceType(BGSVoiceType* a_voiceType) override; // 48 - { TESActorBaseData::voice = a_voiceType; }
221 BGSVoiceType* GetObjectVoiceType() const override; // 49
222 NiAVObject* Clone3D(TESObjectREFR* a_ref) override; // 4A
223 bool GetActivateText(TESObjectREFR* a_activator, BSString& a_dst) override; // 4C
224 bool CalculateDoFavor(Actor* a_activator, bool a_arg2, TESObjectREFR* a_toActivate, float a_arg3) override; // 4D
225 TESCombatStyle* GetCombatStyle() override; // 54 - { return combatStyle; }
226 void SetCombatStyle(TESCombatStyle* a_combatStyle) override; // 55 - { combatStyle = a_combatStyle; }
227
228 // override (TESActorBaseData)
229 void CopyFromTemplateForms(TESActorBase** a_templateForms) override; // 04
230
231 // override (ActorValueOwner)
232 float GetActorValue(ActorValue a_akValue) override; // 01
233 void SetActorValue(ActorValue a_akValue, float a_value) override; // 07
234
235 // override (BSTEventSink<MenuOpenCloseEvent>)
237
238 bool AddPerk(BGSPerk* a_perk, std::int8_t a_rank);
239 bool AddPerks(const std::vector<BGSPerk*>& a_perks, std::int8_t a_rank);
241 bool ContainsKeyword(std::string_view a_editorID);
242 [[nodiscard]] BGSHeadPart** GetBaseOverlays() const;
246 [[nodiscard]] float GetHeight() const;
247 [[nodiscard]] std::uint32_t GetNumBaseOverlays() const;
248 std::optional<std::uint32_t> GetPerkIndex(BGSPerk* a_perk) const;
252 [[nodiscard]] const TESNPC* GetRootFaceNPC() const;
253 [[nodiscard]] SEX GetSex() const;
254 bool HasApplicableKeywordString(std::string_view a_editorID);
256 bool IsInFaction(TESFaction* a_faction) const;
257 bool RemovePerk(BGSPerk* a_perk);
258 bool RemovePerks(const std::vector<BGSPerk*>& a_perks);
260 void SetFaceTexture(BGSTextureSet* a_textureSet);
261 void SetHairColor(BGSColorForm* a_hairColor);
262 void SetSkinFromTint(NiColorA* a_result, TintMask* a_tintMask, bool a_fromTint);
263 bool SetSleepOutfit(BGSOutfit* a_outfit);
264 void UpdateNeck(BSFaceGenNiNode* a_faceNode);
265
266 // members
267 Skills playerSkills; // 190 - DNAM
268 TESClass* npcClass; // 1C0 - CNAM
270 BGSListForm* giftFilter; // 1D0 - GNAM
272 std::uint32_t fileOffset; // 1E0
273 std::uint32_t pad1E4; // 1E4
276 float height; // 1F8 - NAM6
277 float weight; // 1FC - NAM7
278 Sounds sounds; // 200 - CSCR
280 TESObjectARMO* farSkin; // 210 - ANAM
281 BGSOutfit* defaultOutfit; // 218 - DOFT
282 BGSOutfit* sleepOutfit; // 220 - SOFT
284 TESFaction* crimeFaction; // 230 - CRIF
285 BGSHeadPart** headParts; // 238 - PNAM
286 std::int8_t numHeadParts; // 240
287 std::uint8_t unk241; // 241
288 std::uint8_t unk242; // 242
289 std::uint8_t unk243; // 243
290 std::uint8_t unk244; // 244
292 Color bodyTintColor; // 246 - QNAM
293 std::uint16_t pad24A; // 24A
294 std::uint32_t pad24C; // 24C
298
299 private:
300 void CopyPerkRankArray(const std::vector<PerkRankData>& a_copiedData);
301 };
302 static_assert(sizeof(TESNPC) == 0x268);
303}
Definition Actor.h:131
Definition BGSColorForm.h:13
Definition BGSHeadPart.h:17
HeadPartType
Definition BGSHeadPart.h:34
Definition BGSListForm.h:11
Definition BGSLoadFormBuffer.h:11
Definition BGSOutfit.h:11
Definition BGSOverridePackCollection.h:10
Definition BGSPerk.h:31
Definition BGSTextureSet.h:16
Definition BGSVoiceType.h:25
Definition BSFaceGenNiNode.h:14
Definition BSTArray.h:377
Definition BSTEvent.h:143
Definition BSTEvent.h:19
Definition TESNPC.h:24
BSTArray< void * > * unk00[8]
Definition TESNPC.h:27
Definition MenuOpenCloseEvent.h:8
Definition NiAVObject.h:50
Definition NiColor.h:276
Definition TESActorBase.h:32
Definition TESBoundObject.h:24
Definition TESClass.h:88
Definition TESCombatStyle.h:65
Definition TESFaction.h:120
Definition TESFile.h:15
Definition TESForm.h:35
Definition TESNPC.h:36
bool SetSleepOutfit(BGSOutfit *a_outfit)
std::uint8_t unk244
Definition TESNPC.h:290
std::optional< std::uint32_t > GetPerkIndex(BGSPerk *a_perk) const
~TESNPC() override
Skills playerSkills
Definition TESNPC.h:267
HeadRelatedData * headRelatedData
Definition TESNPC.h:269
void InitializeData() override
std::uint8_t unk241
Definition TESNPC.h:287
bool HasOverlays()
BSTArray< Layer * > * tintLayers
Definition TESNPC.h:297
const TESNPC * GetRootFaceNPC() const
BGSVoiceType * GetObjectVoiceType() const override
TESClass * npcClass
Definition TESNPC.h:268
std::uint32_t pad24C
Definition TESNPC.h:294
static constexpr auto VTABLE
Definition TESNPC.h:39
void SaveGame(BGSSaveFormBuffer *a_buf) override
SEX GetSex() const
bool RemovePerk(BGSPerk *a_perk)
void SetObjectVoiceType(BGSVoiceType *a_voiceType) override
float GetHeight() const
BSTArray< BGSRelationship * > * relationships
Definition TESNPC.h:295
bool CalculateDoFavor(Actor *a_activator, bool a_arg2, TESObjectREFR *a_toActivate, float a_arg3) override
bool IsInFaction(TESFaction *a_faction) const
TESCombatStyle * combatStyle
Definition TESNPC.h:271
bool Activate(TESObjectREFR *a_targetRef, TESObjectREFR *a_activatorRef, std::uint8_t a_arg3, TESBoundObject *a_object, std::int32_t a_targetCount) override
Color bodyTintColor
Definition TESNPC.h:292
BGSListForm * giftFilter
Definition TESNPC.h:270
void SetFaceTexture(BGSTextureSet *a_textureSet)
BGSHeadPart * GetHeadPartOverlayByType(HeadPartType a_type)
BSEventNotifyControl ProcessEvent(const MenuOpenCloseEvent *a_event, BSTEventSource< MenuOpenCloseEvent > *a_eventSource) override
TESObjectARMO * farSkin
Definition TESNPC.h:280
std::uint32_t pad1E4
Definition TESNPC.h:273
float GetActorValue(ActorValue a_akValue) override
void Revert(BGSLoadFormBuffer *a_buf) override
std::uint16_t pad24A
Definition TESNPC.h:293
std::uint8_t unk243
Definition TESNPC.h:289
void CopyFromTemplateForms(TESActorBase **a_templateForms) override
static constexpr auto FORMTYPE
Definition TESNPC.h:42
void SetHairColor(BGSColorForm *a_hairColor)
float weight
Definition TESNPC.h:277
BGSHeadPart ** GetBaseOverlays() const
BGSHeadPart ** headParts
Definition TESNPC.h:285
BGSHeadPart * GetCurrentHeadPartByType(HeadPartType a_type)
static constexpr auto RTTI
Definition TESNPC.h:38
stl::enumeration< SOUND_LEVEL, std::uint8_t > soundLevel
Definition TESNPC.h:291
bool HasApplicableKeywordString(std::string_view a_editorID)
bool Load(TESFile *a_mod) override
void ChangeHeadPart(BGSHeadPart *a_target)
bool SetDefaultOutfit(BGSOutfit *a_outfit)
std::uint32_t GetNumBaseOverlays() const
BGSListForm * defaultPackList
Definition TESNPC.h:283
void UnClone3D(TESObjectREFR *a_ref) override
void SetCombatStyle(TESCombatStyle *a_combatStyle) override
bool AddPerk(BGSPerk *a_perk, std::int8_t a_rank)
BGSOutfit * sleepOutfit
Definition TESNPC.h:282
const char * GetTextForParsedSubTag(const BSFixedString &a_tag) const override
BGSHeadPart * GetHeadPartByType(HeadPartType a_type)
TESNPC * GetRootFaceNPC()
void ClearData() override
void SetSkinFromTint(NiColorA *a_result, TintMask *a_tintMask, bool a_fromTint)
std::int8_t numHeadParts
Definition TESNPC.h:286
TESFaction * crimeFaction
Definition TESNPC.h:284
std::uint32_t fileOffset
Definition TESNPC.h:272
TESSpellList::SpellData * GetSpellList()
FaceData * faceData
Definition TESNPC.h:296
NiAVObject * Clone3D(TESObjectREFR *a_ref) override
float height
Definition TESNPC.h:276
bool RemovePerks(const std::vector< BGSPerk * > &a_perks)
Sounds sounds
Definition TESNPC.h:278
TESRace * GetRace()
TESRace * originalRace
Definition TESNPC.h:274
bool AddPerks(const std::vector< BGSPerk * > &a_perks, std::int8_t a_rank)
BSFixedString shortName
Definition TESNPC.h:279
void Copy(TESForm *a_srcForm) override
TESNPC * faceNPC
Definition TESNPC.h:275
std::uint8_t unk242
Definition TESNPC.h:288
void InitItemImpl() override
bool GetActivateText(TESObjectREFR *a_activator, BSString &a_dst) override
BGSOutfit * defaultOutfit
Definition TESNPC.h:281
void LoadGame(BGSLoadFormBuffer *a_buf) override
bool FindInFileFast(TESFile *a_mod) override
void UpdateNeck(BSFaceGenNiNode *a_faceNode)
bool ContainsKeyword(std::string_view a_editorID)
void SetActorValue(ActorValue a_akValue, float a_value) override
TESCombatStyle * GetCombatStyle() override
Definition TESObjectARMO.h:37
Definition TESObjectREFR.h:112
Definition TESRaceForm.h:10
Definition TESRace.h:146
Definition PCH.h:223
Definition AbsorbEffect.h:6
constexpr REL::VariantID RTTI_TESNPC(513923, 392546, 0x1edab88)
ActorValue
Definition ActorValues.h:6
constexpr std::array< REL::VariantID, 15 > VTABLE_TESNPC
Definition Offsets_VTABLE.h:931
BSEventNotifyControl
Definition BSTEvent.h:12
Definition Color.h:8
SEX
Definition Sexes.h:8
Definition TESNPC.h:45
ChangeFlag
Definition TESNPC.h:47
@ kDefaultOutfit
Definition TESNPC.h:57
@ kClass
Definition TESNPC.h:55
@ kBaseData
Definition TESNPC.h:48
@ kFace
Definition TESNPC.h:56
@ kAIData
Definition TESNPC.h:50
@ kSleepOutfit
Definition TESNPC.h:58
@ kNPCSkills
Definition TESNPC.h:54
@ kSpellList
Definition TESNPC.h:51
@ kFullName
Definition TESNPC.h:52
@ kAttributes
Definition TESNPC.h:49
@ kRace
Definition TESNPC.h:60
@ kGender
Definition TESNPC.h:59
@ kFactions
Definition TESNPC.h:53
Definition TESNPC.h:138
@ kBrows_InOut
Definition TESNPC.h:151
@ kCheeks_ForwardBack
Definition TESNPC.h:147
@ kEyes_InOut
Definition TESNPC.h:149
@ kNose_LongShort
Definition TESNPC.h:141
@ kChin_NarrowWide
Definition TESNPC.h:155
@ kLips_UpDown
Definition TESNPC.h:153
@ kCheeks_UpDown
Definition TESNPC.h:146
@ kEyes_UpDown
Definition TESNPC.h:148
@ kEyes_ForwardBack
Definition TESNPC.h:158
@ kNose_UpDown
Definition TESNPC.h:142
@ kBrows_ForwardBack
Definition TESNPC.h:152
@ kJaw_NarrowWide
Definition TESNPC.h:144
@ kUnk
Definition TESNPC.h:159
@ kBrows_UpDown
Definition TESNPC.h:150
@ kJaw_ForwardBack
Definition TESNPC.h:145
@ kTotal
Definition TESNPC.h:161
@ kChin_UnderbiteOverbite
Definition TESNPC.h:157
@ kChin_UpDown
Definition TESNPC.h:156
@ kLips_InOut
Definition TESNPC.h:154
@ kJaw_UpDown
Definition TESNPC.h:143
Definition TESNPC.h:166
@ kEyes
Definition TESNPC.h:171
@ kMouth
Definition TESNPC.h:172
@ kUnknown
Definition TESNPC.h:170
@ kTotal
Definition TESNPC.h:174
@ kNose
Definition TESNPC.h:169
Definition TESNPC.h:135
@ kTotalPresets
Definition TESNPC.h:181
@ kDefault
Definition TESNPC.h:180
std::int32_t parts[Parts::kTotal]
Definition TESNPC.h:186
float morphs[Morphs::kTotal]
Definition TESNPC.h:185
Definition TESNPC.h:191
std::uint16_t interpolationValue
Definition TESNPC.h:199
float GetInterpolationValue() const
std::uint16_t pad0A
Definition TESNPC.h:200
Color tintColor
Definition TESNPC.h:196
std::uint16_t preset
Definition TESNPC.h:198
std::uint32_t pad0C
Definition TESNPC.h:201
std::uint16_t tintIndex
Definition TESNPC.h:197
Definition TESNPC.h:65
RecordFlag
Definition TESNPC.h:67
@ kIgnored
Definition TESNPC.h:69
@ kDeleted
Definition TESNPC.h:68
@ kBleedoutOverride
Definition TESNPC.h:71
@ kCompressed
Definition TESNPC.h:70
Definition TESNPC.h:76
@ kIllusion
Definition TESNPC.h:95
@ kHeavyArmor
Definition TESNPC.h:85
@ kSpeechcraft
Definition TESNPC.h:91
@ kLockpicking
Definition TESNPC.h:88
@ kSneak
Definition TESNPC.h:89
@ kRestoration
Definition TESNPC.h:96
@ kDestruction
Definition TESNPC.h:94
@ kSmithing
Definition TESNPC.h:84
@ kOneHanded
Definition TESNPC.h:80
@ kEnchanting
Definition TESNPC.h:97
@ kConjuration
Definition TESNPC.h:93
@ kMarksman
Definition TESNPC.h:82
@ kPickpocket
Definition TESNPC.h:87
@ kBlock
Definition TESNPC.h:83
@ kAlteration
Definition TESNPC.h:92
@ kTotal
Definition TESNPC.h:99
@ kAlchemy
Definition TESNPC.h:90
@ kLightArmor
Definition TESNPC.h:86
@ kTwoHanded
Definition TESNPC.h:81
std::uint16_t health
Definition TESNPC.h:105
std::uint16_t stamina
Definition TESNPC.h:107
std::uint16_t magicka
Definition TESNPC.h:106
std::uint8_t values[kTotal]
Definition TESNPC.h:103
std::uint16_t pad2A
Definition TESNPC.h:108
float farawayModelDistance
Definition TESNPC.h:109
std::uint8_t offsets[kTotal]
Definition TESNPC.h:104
Definition TESSpellList.h:18
Definition TESNPC.h:128
TESNPC * soundCreature
Definition TESNPC.h:129
CreatureSounds * creatureSounds
Definition TESNPC.h:130