Do not show the encumbrance notification

This commit is contained in:
Eddoursul 2022-08-18 11:41:13 +02:00
parent 8a876457ed
commit 3ee609540b
3 changed files with 51 additions and 28 deletions

View File

@ -27,8 +27,8 @@ namespace {
{
GetMessagingInterface()->RegisterListener([](MessagingInterface::Message* message) {
if (message->type == MessagingInterface::kPostPostLoad) {
if (!std::filesystem::exists("Data\\Enderal - Forgotten Stories.esm")) {
MessageBoxW(NULL, L"Enderal SE Easy Crafting requires Enderal - Forgotten Stories.esm.", L"Enderal SE Easy Crafting", MB_OK | MB_ICONERROR);
if (!std::filesystem::exists("Data\\Enderal - Forgotten Stories.esm") || !std::filesystem::exists("Data\\SKSE\\Plugins\\EnderalSE.dll")) {
MessageBoxW(NULL, L"Easy Crafting requires Enderal SE 2.0.12 or newer.", L"Enderal SE Easy Crafting", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
GetSettings(true);

View File

@ -148,6 +148,17 @@ inline void ReturnSupplies()
playerRef->RemoveItem(item, count, iReason, nullptr, chest, 0, 0);
}
}
std::thread([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
SKSE::GetTaskInterface()->AddTask([]() {
const auto spell = RE::TESForm::LookupByID(0x824AF);
if (spell) {
RE::PlayerCharacter::GetSingleton()->RemoveSpell(spell->As<RE::SpellItem>());
spell->As<RE::SpellItem>()->effects[0]->effectItem.magnitude = 1;
}
});
}).detach();
}
inline void FetchSupplies(RE::TESFurniture* a_furn)
@ -166,8 +177,7 @@ inline void FetchSupplies(RE::TESFurniture* a_furn)
bAllowFetch = true;
} else {
RE::TES::GetSingleton()->ForEachReferenceInRange(playerRef, 4000, [&chestAct, &bAllowFetch](RE::TESObjectREFR& b_ref) {
const auto base = b_ref.GetBaseObject();
if (chestAct == base) {
if (chestAct == b_ref.GetBaseObject()) {
bAllowFetch = true;
return false;
}
@ -181,31 +191,44 @@ inline void FetchSupplies(RE::TESFurniture* a_furn)
bSuppliesFetched = true;
switch (a_furn->workBenchData.benchType.underlying()) {
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemy:
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemyExperiment:
RE::DebugNotification("Fetching ingredients...");
FetchSuppliesByType(RE::FormType::Ingredient);
break;
case (int)RE::TESFurniture::WorkBenchData::BenchType::kEnchanting:
case (int)RE::TESFurniture::WorkBenchData::BenchType::kEnchantingExperiment:
RE::DebugNotification("Fetching soul gems...");
FetchSuppliesByType(RE::FormType::SoulGem);
break;
default:
if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingCookpot")) {
RE::DebugNotification("Fetching cooking ingredients...");
FetchSuppliesByType(RE::FormType::Ingredient);
FetchSuppliesByType(RE::FormType::AlchemyItem);
} else {
RE::DebugNotification("Fetching crafting supplies...");
FetchSuppliesByType(RE::FormType::Misc);
FetchSuppliesByType(RE::FormType::Ingredient);
FetchSuppliesByType(RE::FormType::SoulGem);
FetchSuppliesByType(RE::FormType::AlchemyItem);
}
break;
const auto spellForm = RE::TESForm::LookupByID(0x824AF);
if (spellForm) {
const auto spell = spellForm->As<RE::SpellItem>();
playerRef->RemoveSpell(spell);
spell->effects[0]->effectItem.magnitude = 30000;
playerRef->AddSpell(spell);
}
std::thread([a_furn]() {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
SKSE::GetTaskInterface()->AddTask([a_furn]() {
switch (a_furn->workBenchData.benchType.underlying()) {
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemy:
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemyExperiment:
RE::DebugNotification("Fetching ingredients...");
FetchSuppliesByType(RE::FormType::Ingredient);
break;
case (int)RE::TESFurniture::WorkBenchData::BenchType::kEnchanting:
case (int)RE::TESFurniture::WorkBenchData::BenchType::kEnchantingExperiment:
RE::DebugNotification("Fetching soul gems...");
FetchSuppliesByType(RE::FormType::SoulGem);
break;
default:
if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingCookpot")) {
RE::DebugNotification("Fetching cooking ingredients...");
FetchSuppliesByType(RE::FormType::Ingredient);
FetchSuppliesByType(RE::FormType::AlchemyItem);
} else {
RE::DebugNotification("Fetching crafting supplies...");
FetchSuppliesByType(RE::FormType::Misc);
FetchSuppliesByType(RE::FormType::Ingredient);
FetchSuppliesByType(RE::FormType::SoulGem);
FetchSuppliesByType(RE::FormType::AlchemyItem);
}
break;
}
});
}).detach();
}
inline bool GetSuppliesFetched()