Fetch by all workbench keywords
This commit is contained in:
parent
635e37657c
commit
31b5194652
Binary file not shown.
@ -43,12 +43,12 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bUpdateINI) {
|
if (bUpdateINI) {
|
||||||
logger::info("New settings detected, adding to ArtifactTracker.ini");
|
logger::info("New settings detected, adding to EnderalSEEasyCrafting.ini");
|
||||||
ini.SaveFile(iniPath);
|
ini.SaveFile(iniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (const std::exception& e) {
|
} 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) {
|
if (!workbench) {
|
||||||
logger::warn("Invalid keyword argument in FetchByWorkbenchKeyword");
|
logger::warn("Invalid workbench argument in FetchByWorkbench");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,10 +117,11 @@ inline void FetchByWorkbenchKeyword(RE::BGSKeyword* keyword)
|
|||||||
const auto chest = GetChest();
|
const auto chest = GetChest();
|
||||||
const auto playerRef = RE::PlayerCharacter::GetSingleton();
|
const auto playerRef = RE::PlayerCharacter::GetSingleton();
|
||||||
const auto inv = chest->GetInventory();
|
const auto inv = chest->GetInventory();
|
||||||
|
const auto keywords = workbench->As<RE::BGSKeywordForm>();
|
||||||
RE::ITEM_REMOVE_REASON iReason = RE::ITEM_REMOVE_REASON::kStoreInContainer;
|
RE::ITEM_REMOVE_REASON iReason = RE::ITEM_REMOVE_REASON::kStoreInContainer;
|
||||||
|
|
||||||
for (const auto& recipe : RE::TESDataHandler::GetSingleton()->GetFormArray<RE::BGSConstructibleObject>()) {
|
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++) {
|
for (int i = 0; i < recipe->requiredItems.numContainerObjects; i++) {
|
||||||
const auto component = recipe->requiredItems.GetContainerObjectAt(i).value();
|
const auto component = recipe->requiredItems.GetContainerObjectAt(i).value();
|
||||||
const auto formID = (component && component->obj) ? component->obj->formID : NULL;
|
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::thread([a_furn]() {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
SKSE::GetTaskInterface()->AddTask([a_furn]() {
|
SKSE::GetTaskInterface()->AddTask([a_furn]() {
|
||||||
bool bNotify = GetSettings().at("ShowFetchingNotification");
|
|
||||||
|
|
||||||
switch (a_furn->workBenchData.benchType.underlying()) {
|
switch (a_furn->workBenchData.benchType.underlying()) {
|
||||||
|
|
||||||
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemy:
|
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemy:
|
||||||
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemyExperiment:
|
case (int)RE::TESFurniture::WorkBenchData::BenchType::kAlchemyExperiment:
|
||||||
NotifyFetching("Fetching alchemy ingredients...");
|
NotifyFetching("Fetching ingredients...");
|
||||||
FetchSuppliesByType(RE::FormType::Ingredient);
|
FetchSuppliesByType(RE::FormType::Ingredient);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -291,37 +291,8 @@ inline void FetchSupplies(RE::TESFurniture* a_furn)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (a_furn->As<RE::BGSKeywordForm>()->HasKeywordString("CraftingCookpot")) {
|
NotifyFetching("Fetching supplies...");
|
||||||
NotifyFetching("Fetching cooking ingredients...");
|
FetchByWorkbench(a_furn);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).detach();
|
}).detach();
|
||||||
|
Loading…
Reference in New Issue
Block a user