|
|
|
@ -43,12 +43,12 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (bUpdateINI) { |
|
|
|
|
logger::info("New settings detected, adding to ArtifactTracker.ini"); |
|
|
|
|
logger::info("New settings detected, adding to EnderalSEEasyCrafting.ini"); |
|
|
|
|
ini.SaveFile(iniPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (const std::exception& e) { |
|
|
|
|
logger::error(e.what()); |
|
|
|
|
//logger::error(e.what());
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -105,10 +105,10 @@ inline void FetchSuppliesByType(RE::FormType formType) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline void FetchByWorkbenchKeyword(RE::BGSKeyword* keyword) |
|
|
|
|
inline void FetchByWorkbench(RE::TESFurniture* workbench) |
|
|
|
|
{ |
|
|
|
|
if (!keyword) { |
|
|
|
|
logger::warn("Invalid keyword argument in FetchByWorkbenchKeyword"); |
|
|
|
|
if (!workbench) { |
|
|
|
|
logger::warn("Invalid workbench argument in FetchByWorkbench"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -117,10 +117,11 @@ inline void FetchByWorkbenchKeyword(RE::BGSKeyword* keyword) |
|
|
|
|
const auto chest = GetChest(); |
|
|
|
|
const auto playerRef = RE::PlayerCharacter::GetSingleton(); |
|
|
|
|
const auto inv = chest->GetInventory(); |
|
|
|
|
const auto keywords = workbench->As<RE::BGSKeywordForm>(); |
|
|
|
|
RE::ITEM_REMOVE_REASON iReason = RE::ITEM_REMOVE_REASON::kStoreInContainer; |
|
|
|
|
|
|
|
|
|
for (const auto& recipe : RE::TESDataHandler::GetSingleton()->GetFormArray<RE::BGSConstructibleObject>()) { |
|
|
|
|
if (recipe->benchKeyword == keyword && recipe->requiredItems.numContainerObjects > 0) { |
|
|
|
|
if (recipe->benchKeyword && keywords->HasKeyword(recipe->benchKeyword) && recipe->requiredItems.numContainerObjects > 0) { |
|
|
|
|
for (int i = 0; i < recipe->requiredItems.numContainerObjects; i++) { |
|
|
|
|
const auto component = recipe->requiredItems.GetContainerObjectAt(i).value(); |
|
|
|
|
const auto formID = (component && component->obj) ? component->obj->formID : NULL; |
|
|
|
@ -274,13 +275,12 @@ inline void FetchSupplies(RE::TESFurniture* a_furn) |
|
|
|
|
std::thread([a_furn]() { |
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1)); |
|
|
|
|
SKSE::GetTaskInterface()->AddTask([a_furn]() { |
|
|
|
|
bool bNotify = GetSettings().at("ShowFetchingNotification"); |
|
|
|
|
|
|
|
|
|
switch (a_furn->workBenchData.benchType.underlying()) { |
|
|
|
|
|
|
|
|
|
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemy: |
|
|
|
|
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemyExperiment: |
|
|
|
|
NotifyFetching("Fetching alchemy ingredients..."); |
|
|
|
|
NotifyFetching("Fetching ingredients..."); |
|
|
|
|
FetchSuppliesByType(RE::FormType::Ingredient); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
@ -291,37 +291,8 @@ inline void FetchSupplies(RE::TESFurniture* a_furn) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingCookpot")) { |
|
|
|
|
NotifyFetching("Fetching cooking ingredients..."); |
|
|
|
|
FetchByWorkbenchKeyword(RE::TESForm::LookupByID<RE::BGSKeyword>(0xA5CB3)); // CraftingCookpot
|
|
|
|
|
|
|
|
|
|
} else if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingSmelter")) { |
|
|
|
|
NotifyFetching("Fetching smelting supplies..."); |
|
|
|
|
FetchByWorkbenchKeyword(RE::TESForm::LookupByID<RE::BGSKeyword>(0xA5CCE)); // CraftingSmelter
|
|
|
|
|
|
|
|
|
|
} else if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingTanningRack")) { |
|
|
|
|
NotifyFetching("Fetching tanning supplies..."); |
|
|
|
|
FetchByWorkbenchKeyword(RE::TESForm::LookupByID<RE::BGSKeyword>(0x7866A)); // CraftingTanningRack
|
|
|
|
|
|
|
|
|
|
} else if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingSmithingSharpeningWheel")) { |
|
|
|
|
NotifyFetching("Fetching crafting supplies..."); |
|
|
|
|
FetchByWorkbenchKeyword(RE::TESForm::LookupByID<RE::BGSKeyword>(0x88108)); // CraftingSmithingSharpeningWheel
|
|
|
|
|
|
|
|
|
|
} else if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingSmithingForge")) { |
|
|
|
|
NotifyFetching("Fetching crafting supplies..."); |
|
|
|
|
FetchByWorkbenchKeyword(RE::TESForm::LookupByID<RE::BGSKeyword>(0x88105)); // CraftingSmithingForge
|
|
|
|
|
|
|
|
|
|
} else if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingSmithingArmorTable")) { |
|
|
|
|
NotifyFetching("Fetching crafting supplies..."); |
|
|
|
|
FetchByWorkbenchKeyword(RE::TESForm::LookupByID<RE::BGSKeyword>(0xADB78)); // CraftingSmithingArmorTable
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
NotifyFetching("Fetching crafting supplies..."); |
|
|
|
|
FetchSuppliesByType(RE::FormType::Misc); |
|
|
|
|
FetchSuppliesByType(RE::FormType::Ingredient); |
|
|
|
|
FetchSuppliesByType(RE::FormType::SoulGem); |
|
|
|
|
FetchSuppliesByType(RE::FormType::AlchemyItem); |
|
|
|
|
} |
|
|
|
|
NotifyFetching("Fetching supplies..."); |
|
|
|
|
FetchByWorkbench(a_furn); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}).detach(); |
|
|
|
|