From 23abe97fca24d024d5379db73307149ea4ad38fb Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 27 Jan 2024 00:04:10 +0530 Subject: [PATCH] Add `ExtraDataList::HasQuestObjectAlias` --- include/RE/E/ExtraDataList.h | 1 + src/RE/E/ExtraDataList.cpp | 9 ++++++++- src/RE/I/InventoryEntryData.cpp | 12 +++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/RE/E/ExtraDataList.h b/include/RE/E/ExtraDataList.h index 98e891596..baec37472 100644 --- a/include/RE/E/ExtraDataList.h +++ b/include/RE/E/ExtraDataList.h @@ -181,6 +181,7 @@ namespace RE TESForm* GetOwner(); SOUL_LEVEL GetSoulLevel() const; ObjectRefHandle GetTeleportLinkedDoor(); + bool HasQuestObjectAlias(); void SetCount(std::uint16_t a_count); void SetEncounterZone(BGSEncounterZone* a_zone); void SetExtraFlags(ExtraFlags::Flag a_flags, bool a_enable); diff --git a/src/RE/E/ExtraDataList.cpp b/src/RE/E/ExtraDataList.cpp index bbf0b83ba..7d3b546df 100644 --- a/src/RE/E/ExtraDataList.cpp +++ b/src/RE/E/ExtraDataList.cpp @@ -282,7 +282,14 @@ namespace RE ObjectRefHandle(); } - void ExtraDataList::SetCount(std::uint16_t a_count) + bool ExtraDataList::HasQuestObjectAlias() + { + using func_t = decltype(&ExtraDataList::HasQuestObjectAlias); + REL::Relocation func{ RELOCATION_ID(11913, 12052) }; + return func(this); + } + + void ExtraDataList::SetCount(std::uint16_t a_count) { using func_t = decltype(&ExtraDataList::SetCount); REL::Relocation func{ Offset::ExtraDataList::SetCount }; diff --git a/src/RE/I/InventoryEntryData.cpp b/src/RE/I/InventoryEntryData.cpp index 18402da92..2c467664e 100644 --- a/src/RE/I/InventoryEntryData.cpp +++ b/src/RE/I/InventoryEntryData.cpp @@ -245,9 +245,15 @@ namespace RE bool InventoryEntryData::IsQuestObject() const { - using func_t = decltype(&InventoryEntryData::IsQuestObject); - REL::Relocation func{ RELOCATION_ID(15767, 16005) }; - return func(this); + if (extraLists) { + for (const auto& xList : *extraLists) { + if (xList && xList->HasQuestObjectAlias()) { + return true; + } + } + } + + return false; } void InventoryEntryData::PoisonObject(AlchemyItem* a_alchItem, std::uint32_t a_count)