From b608f5a0e070f12424cd5a5edffb35d23c07c2e9 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:11:49 -0500 Subject: [PATCH] feat: `Actor` --- include/RE/A/Actor.h | 97 ++++++++++++++++++++++++++++++++++++++++++-- include/RE/IDs.h | 9 +++- 2 files changed, 101 insertions(+), 5 deletions(-) diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index f3aad848..74112bec 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -7,12 +7,13 @@ #include "RE/I/IStoreAnimationActions.h" #include "RE/M/MagicTarget.h" #include "RE/P/PerkRankData.h" +#include "RE/T/TESNPC.h" #include "RE/T/TESObjectREFR.h" namespace RE { - class TESNPC; class AIProcess; + class BGSKeyword; class BGSPerk; class CombatController; class CombatGroup; @@ -50,7 +51,6 @@ namespace RE struct Perks { - public: // members BSTArray* perkRanks; // 00 BSTArray unk10; // 08 @@ -277,8 +277,88 @@ namespace RE virtual void Unk_1A0(); // 1A0 virtual void Unk_1A1(); // 1A1 - void EvaluatePackage(bool a_immediate = false, bool a_resetAI = false); - [[nodiscard]] bool IsHostileToActor(Actor* a_actor); + void EvaluatePackage(bool a_immediate = false, bool a_resetAI = false) + { + using func_t = decltype(&Actor::EvaluatePackage); + static REL::Relocation func{ ID::Actor::EvaluatePackage }; + func(this, a_immediate, a_resetAI); + } + + [[nodiscard]] TESNPC* GetNPC() + { + return GetBaseObject()->As(); + } + + [[nodiscard]] const TESNPC* GetNPC() const + { + return GetBaseObject()->As(); + } + + [[nodiscard]] bool IsHostileToActor(Actor* a_actor) + { + using func_t = decltype(&Actor::IsHostileToActor); + static REL::Relocation func{ ID::Actor::IsHostileToActor }; + return func(this, a_actor); + } + + [[nodiscard]] bool IsInWater() const + { + return boolBits.all(RE::Actor::BOOL_BITS::kInWater); + } + + [[nodiscard]] bool IsInCombatSearch() const + { + return boolBits.all(RE::Actor::BOOL_BITS::kSearchingInCombat); + } + + [[nodiscard]] bool IsJumping() + { + using func_t = decltype(&Actor::IsJumping); + static REL::Relocation func{ ID::Actor::IsJumping }; + return func(this); + } + + [[nodiscard]] bool IsOverEncumbered() + { + using func_t = decltype(&Actor::IsOverEncumbered); + static REL::Relocation func{ ID::Actor::IsOverEncumbered }; + return func(this); + } + + [[nodiscard]] bool IsSneaking() + { + using func_t = decltype(&Actor::IsSneaking); + static REL::Relocation func{ ID::Actor::IsSneaking }; + return func(this); + } + + void SetSkinTone(std::uint32_t a_index) + { + using func_t = decltype(&Actor::SetSkinTone); + static REL::Relocation func{ ID::Actor::SetSkinTone }; + func(this, a_index); + } + + void UpdateAppearance(bool a_arg1, std::uint32_t a_flags, bool a_changeRace) + { + using func_t = decltype(&Actor::UpdateAppearance); + static REL::Relocation func{ ID::Actor::UpdateAppearance }; + func(this, a_arg1, a_flags, a_changeRace); + } + + void UpdateChargenAppearance() + { + using func_t = decltype(&Actor::UpdateChargenAppearance); + static REL::Relocation func{ ID::Actor::UpdateChargenAppearance }; + func(this); + } + + [[nodiscard]] bool WornHasKeyword(BGSKeyword* a_keyword) + { + using func_t = decltype(&Actor::WornHasKeyword); + static REL::Relocation func{ ID::Actor::WornHasKeyword }; + return func(this, a_keyword); + } // members REX::EnumSet boolBits; // 200 @@ -384,4 +464,13 @@ namespace RE std::uint8_t unk518[88]; // 518 }; static_assert(sizeof(Actor) == 0x578); + + class MenuActor : + public Actor + { + public: + SF_RTTI_VTABLE(MenuActor); + + virtual ~MenuActor() override; // 00 + }; } diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 0e10d76a..304ff88b 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -6,6 +6,13 @@ namespace RE::ID { inline constexpr REL::ID EvaluatePackage{ 150640 }; inline constexpr REL::ID IsHostileToActor{ 150777 }; + inline constexpr REL::ID IsJumping{ 150985 }; + inline constexpr REL::ID IsOverEncumbered{ 150999 }; + inline constexpr REL::ID IsSneaking{ 151014 }; + inline constexpr REL::ID SetSkinTone{ 146270 }; + inline constexpr REL::ID UpdateAppearance{ 151216 }; + inline constexpr REL::ID UpdateChargenAppearance{ 146273 }; + inline constexpr REL::ID WornHasKeyword{ 106992 }; } namespace ActorValue @@ -15,7 +22,7 @@ namespace RE::ID namespace ActorEquipManager { - inline constexpr REL::ID singleton{ 879425 }; + inline constexpr REL::ID Singleton{ 879425 }; inline constexpr REL::ID EquipObject{ 151991 }; inline constexpr REL::ID UnequipObject{ 152007 }; }