Added support for equipment spectralization
This commit is contained in:
parent
ddb85480d2
commit
52b2ab878d
Binary file not shown.
@ -29,7 +29,15 @@ auto EventListener::ProcessEvent(
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (a_event->eventName == "Enderal_StartSpectralizing") {
|
||||
SKSE::GetTaskInterface()->AddTask([]() {
|
||||
FetchSpectralizingSupplies();
|
||||
});
|
||||
} else if (a_event->eventName == "Enderal_FinishSpectralizing") {
|
||||
SKSE::GetTaskInterface()->AddTask([]() {
|
||||
ReturnSupplies();
|
||||
});
|
||||
}
|
||||
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
@ -93,6 +93,31 @@ inline void FetchSuppliesByType(RE::FormType formType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void FetchSuppliesByForm(RE::TESForm* a_form)
|
||||
{
|
||||
if (!a_form) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto chest = RE::TESForm::LookupByID(0x5C132)->As<RE::TESObjectREFR>();
|
||||
const auto targetRef = RE::PlayerCharacter::GetSingleton();
|
||||
|
||||
const auto inv = chest->GetInventory([&](RE::TESBoundObject& a_xform) {
|
||||
return a_form == &a_xform;
|
||||
});
|
||||
|
||||
RE::ITEM_REMOVE_REASON iReason = RE::ITEM_REMOVE_REASON::kStoreInContainer;
|
||||
|
||||
for (const auto& [item, data] : inv) {
|
||||
const auto& [count, entry] = data;
|
||||
if (count > 0) {
|
||||
supplyCount.insert({ item, count });
|
||||
chest->RemoveItem(item, count, iReason, nullptr, targetRef, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void ReturnSupplies()
|
||||
{
|
||||
if (!bSuppliesFetched) {
|
||||
@ -248,4 +273,18 @@ inline void FetchSupplies(RE::TESFurniture* a_furn)
|
||||
inline bool GetSuppliesFetched()
|
||||
{
|
||||
return bSuppliesFetched;
|
||||
}
|
||||
}
|
||||
|
||||
inline void FetchSpectralizingSupplies()
|
||||
{
|
||||
if (GetSettings().at("ShowFetchingNotification")) {
|
||||
RE::DebugNotification("Fetching spectralizing supplies...");
|
||||
}
|
||||
|
||||
bSuppliesFetched = true;
|
||||
|
||||
supplyCount.clear();
|
||||
FetchSuppliesByType(RE::FormType::SoulGem);
|
||||
FetchSuppliesByForm(RE::TESForm::LookupByID(0x34CDD)); // Bone Meal
|
||||
FetchSuppliesByForm(RE::TESForm::LookupByID(0x3AD63)); // Ectoplasm
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user