diff --git a/SKSE/Plugins/EnderalSEEasyCrafting.dll b/SKSE/Plugins/EnderalSEEasyCrafting.dll index 4d9a7ae..e014f59 100644 Binary files a/SKSE/Plugins/EnderalSEEasyCrafting.dll and b/SKSE/Plugins/EnderalSEEasyCrafting.dll differ diff --git a/SKSE/Plugins/EnderalSEEasyCrafting.ini b/SKSE/Plugins/EnderalSEEasyCrafting.ini index 9f057e6..6b65ae8 100644 --- a/SKSE/Plugins/EnderalSEEasyCrafting.ini +++ b/SKSE/Plugins/EnderalSEEasyCrafting.ini @@ -1,3 +1,2 @@ LoadSuppliesEverywhere = false StoreInventorySupplies = true -StoreCraftedSupplies = true diff --git a/src/src/EventListener.cpp b/src/src/EventListener.cpp index 7b3a21c..662eec7 100644 --- a/src/src/EventListener.cpp +++ b/src/src/EventListener.cpp @@ -40,7 +40,6 @@ auto EventListener::ProcessEvent( -> RE::BSEventNotifyControl { if (!a_event->opening && a_event->menuName == RE::CraftingMenu::MENU_NAME) { - RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink(EventListener::GetSingleton()); SKSE::GetTaskInterface()->AddTask([]() { ReturnSupplies(); }); @@ -99,32 +98,3 @@ auto EventListener::ProcessEvent( return RE::BSEventNotifyControl::kContinue; } - -auto EventListener::ProcessEvent( - const RE::TESContainerChangedEvent* a_event, - RE::BSTEventSource* a_eventSource) - -> RE::BSEventNotifyControl -{ - if (!RE::UI::GetSingleton()->IsMenuOpen(RE::CraftingMenu::MENU_NAME)) { - RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink(EventListener::GetSingleton()); - return RE::BSEventNotifyControl::kContinue; - } - - const auto item = RE::TESForm::LookupByID(a_event->baseObj); - const auto kForm = item->As(); - bool isMaterial = false; - - if (item->Is(RE::FormType::Misc) && (kForm->HasKeywordString("VendorItemOreIngot") || kForm->HasKeywordString("VendorItemAnimalHide") || kForm->HasKeywordString("VendorItemAnimalPart") || kForm->HasKeywordString("VendorItemFireword"))) { - isMaterial = true; - } else if (item->Is(RE::FormType::AlchemyItem) && kForm->HasKeywordString("VendorItemFoodRaw")) { - isMaterial = true; - } else if (item->Is(RE::FormType::Ingredient)) { - isMaterial = true; - } - - if (isMaterial) { - AddToCraftedSupplies(item, a_event->itemCount); - } - - return RE::BSEventNotifyControl::kContinue; -} \ No newline at end of file diff --git a/src/src/EventListener.h b/src/src/EventListener.h index 23187cf..311cb42 100644 --- a/src/src/EventListener.h +++ b/src/src/EventListener.h @@ -3,8 +3,7 @@ class EventListener : public RE::BSTEventSink, public RE::BSTEventSink, - public RE::BSTEventSink, - public RE::BSTEventSink + public RE::BSTEventSink { public: ~EventListener() = default; @@ -30,11 +29,6 @@ public: const RE::TESActivateEvent* a_event, RE::BSTEventSource* a_eventSource) -> RE::BSEventNotifyControl override; - - auto ProcessEvent( - const RE::TESContainerChangedEvent* a_event, - RE::BSTEventSource* a_eventSource) - -> RE::BSEventNotifyControl override; private: EventListener() = default; diff --git a/src/src/Util.h b/src/src/Util.h index d29a101..2c9f3df 100644 --- a/src/src/Util.h +++ b/src/src/Util.h @@ -58,23 +58,11 @@ inline const std::map GetSettings(bool bInit = false) if (bInit) { settings.insert({ "LoadSuppliesEverywhere", false }); settings.insert({ "StoreInventorySupplies", true }); - settings.insert({ "StoreCraftedSupplies", true }); LoadINI(&settings, "Data/SKSE/Plugins/EnderalSEEasyCrafting.ini"); } return settings; } -inline void AddToCraftedSupplies(RE::TESForm* form, std::int32_t itemCount) -{ - auto it = supplyCount.find(form); - - if (it != supplyCount.end()) { - it->second += itemCount; - } else { - supplyCount.insert({ form, itemCount }); - } -} - inline void FetchSuppliesByType(RE::FormType formType) { const auto chest = RE::TESForm::LookupByID(0x5C132)->As(); @@ -144,6 +132,7 @@ inline void ReturnSupplies() } else if (kform->HasKeyword(kOreIngot) || kform->HasKeyword(kAnimalPart) || kform->HasKeyword(kAnimalHide) || kform->HasKeyword(kFirewood)) { return true; } + return false; } if (a_form.Is(RE::FormType::AlchemyItem)) { @@ -177,11 +166,10 @@ inline void FetchSupplies(RE::TESFurniture* a_furn) bAllowFetch = true; } else { RE::TES::GetSingleton()->ForEachReferenceInRange(playerRef, 4000, [&chestAct, &bAllowFetch](RE::TESObjectREFR& b_ref) { - if (const auto base = b_ref.GetBaseObject(); base) { - if (chestAct == base) { - bAllowFetch = true; - return false; - } + const auto base = b_ref.GetBaseObject(); + if (chestAct == base) { + bAllowFetch = true; + return false; } return true; }); @@ -191,10 +179,6 @@ inline void FetchSupplies(RE::TESFurniture* a_furn) return; } - if (GetSettings().at("StoreCraftedSupplies")) { - RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink(EventListener::GetSingleton()); - } - bSuppliesFetched = true; switch (a_furn->workBenchData.benchType.underlying()) {