-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08f6c04
commit 8fa6be0
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
namespace Hooks { | ||
|
||
struct InitItemImpl | ||
{ | ||
static void Thunk(RE::TESObjectREFR* a_ref) | ||
{ | ||
if (a_ref->HasContainer()) { | ||
func(a_ref); | ||
|
||
logger::info("processing container: {}", a_ref->GetFormID()); | ||
|
||
auto inv = a_ref->GetInventory(); | ||
for (const auto& [form, data] : inv) { | ||
logger::info("contains: {}", form->GetFormEditorID()); | ||
} | ||
|
||
auto gold = RE::TESDataHandler::GetSingleton()->LookupForm(0xF, "Skyrim.esm"); | ||
|
||
a_ref->RemoveItem(gold->As<RE::TESBoundObject>(), 1000000, RE::ITEM_REMOVE_REASON::kRemove, nullptr, nullptr); | ||
a_ref->AddObjectToContainer(gold->As<RE::TESBoundObject>(), nullptr, 100, nullptr); | ||
|
||
return; | ||
} | ||
|
||
func(a_ref); | ||
} | ||
static inline REL::Relocation<decltype(Thunk)> func; | ||
static inline constexpr std::size_t idx{ 0x13 }; | ||
|
||
static void Install() | ||
{ | ||
stl::write_vfunc<RE::TESObjectREFR, InitItemImpl>(); | ||
logger::info("Installed Object Reference hook"); | ||
} | ||
}; | ||
|
||
void Install(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "Hooks.h" | ||
|
||
void Hooks::Install() { | ||
Hooks::InitItemImpl::Install(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters