1

Added dependency checks and warnings

This commit is contained in:
Eddoursul 2022-09-16 02:39:07 +02:00
parent 4220779b99
commit c01fbe9265
5 changed files with 29 additions and 3 deletions

Binary file not shown.

View File

@ -6,7 +6,7 @@ message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
########################################################################################################################
project(
ArtifactTracker
VERSION 1.0.5
VERSION 1.0.6
DESCRIPTION "Artifact Tracker"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)

View File

@ -14,6 +14,7 @@ namespace ArtifactTracker
bool g_bBookShelf = false;
bool g_bTakeAll = false;
bool g_bNotifyNewArtifact = false;
bool g_bWarnMissingMoreHUD = true;
std::uint32_t g_bTakeAllCount = 0;
std::int32_t g_iFollowerIndex = 0;
RE::TESBoundObject* g_cellContainer;
@ -67,10 +68,13 @@ namespace ArtifactTracker
std::map<std::string, bool> settings{
{ "DumpItemList", false },
{ "NewArtifactNotifications", false },
{ "WarnMissingMoreHUD", true },
{ "WarnMissingKID", true },
};
LoadINI(&settings, "Data/SKSE/Plugins/ArtifactTracker.ini");
g_bNotifyNewArtifact = settings.at("NewArtifactNotifications");
g_bWarnMissingMoreHUD = settings.at("WarnMissingMoreHUD");
// Preloading item lists
@ -145,6 +149,12 @@ namespace ArtifactTracker
OnGameLoad(); // covers new game and coc'ing from the main menu
g_bLoaded = true;
if (bKID) {
log::info("Keyword Item Distributor is detected.");
} else {
log::info("Keyword Item Distributor has NOT been detected, using the baseline configuration.");
}
RE::ConsoleLog::GetSingleton()->Print(std::format("Artifact Tracker registered {} items.", g_artifactMap.size()).c_str());
log::info("Total artifacts: {}", g_artifactMap.size());
@ -155,6 +165,14 @@ namespace ArtifactTracker
}
}
if (dataHandler->LookupLoadedModByName("DBM_RelicNotifications.esp")) {
RE::DebugMessageBox("Artifact Tracker is incompatible with The Curator's Companion.");
}
if (!bKID && settings.at("WarnMissingKID")) {
RE::DebugMessageBox("Artifact Tracker requires Keyword Item Distributor. If its absence is intentional, set WarnMissingKID=false in ArtifactTracker.ini.");
}
return true;
}
@ -199,6 +217,7 @@ namespace ArtifactTracker
const auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton();
RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor> stackCallback;
bool bMoreHUDInstalled = false;
if (const auto pluginInfo = g_loadInterface->GetPluginInfo("Ahzaab's moreHUD Plugin"); pluginInfo) {
if (!g_bLoaded) log::info("Detected {} v{}", pluginInfo->name, pluginInfo->version);
if (pluginInfo->version == 0) {
@ -210,6 +229,7 @@ namespace ArtifactTracker
vm->DispatchStaticCall("AhzMoreHud", "RegisterIconFormList", RE::MakeFunctionArguments<RE::BSString, RE::BGSListForm*>("dbmNew", std::move(g_listNew)), stackCallback);
vm->DispatchStaticCall("AhzMoreHud", "RegisterIconFormList", RE::MakeFunctionArguments<RE::BSString, RE::BGSListForm*>("dbmFound", std::move(g_listFound)), stackCallback);
vm->DispatchStaticCall("AhzMoreHud", "RegisterIconFormList", RE::MakeFunctionArguments<RE::BSString, RE::BGSListForm*>("dbmDisp", std::move(g_listStored)), stackCallback);
bMoreHUDInstalled = true;
} else {
log::error("MoreHUD has not been installed correctly.");
}
@ -217,6 +237,7 @@ namespace ArtifactTracker
log::error("MoreHUD has not been detected.");
}
bool bMoreHUDInvInstalled = false;
if (const auto pluginInfo = g_loadInterface->GetPluginInfo("Ahzaab's moreHUD Inventory Plugin"); pluginInfo) {
if (!g_bLoaded) log::info("Detected {} v{}", pluginInfo->name, pluginInfo->version);
if (pluginInfo->version == 0) {
@ -228,6 +249,7 @@ namespace ArtifactTracker
vm->DispatchStaticCall("AhzMoreHudIE", "RegisterIconFormList", RE::MakeFunctionArguments<RE::BSString, RE::BGSListForm*>("dbmNew", std::move(g_listNew)), stackCallback);
vm->DispatchStaticCall("AhzMoreHudIE", "RegisterIconFormList", RE::MakeFunctionArguments<RE::BSString, RE::BGSListForm*>("dbmFound", std::move(g_listFound)), stackCallback);
vm->DispatchStaticCall("AhzMoreHudIE", "RegisterIconFormList", RE::MakeFunctionArguments<RE::BSString, RE::BGSListForm*>("dbmDisp", std::move(g_listStored)), stackCallback);
bool bMoreHUDInvInstalled = true;
} else {
log::error("MoreHUD Inventory Edition has not been installed correctly.");
}
@ -235,6 +257,10 @@ namespace ArtifactTracker
log::error("MoreHUD Inventory Edition has not been detected.");
}
if (g_bWarnMissingMoreHUD && !bMoreHUDInstalled && !bMoreHUDInvInstalled) {
RE::DebugMessageBox("Artifact Tracker requires up-to-date MoreHUD and/or MoreHUD Inventory Edition. If their absence is intentional, set WarnMissingMoreHUD=false in ArtifactTracker.ini.");
}
// TODO: Uncomment when/if QuickLoot EE brings back registering formlists
/*
if (const auto pluginInfo = g_loadInterface->GetPluginInfo("QuickLootEE"); pluginInfo) {

View File

@ -178,7 +178,7 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
}
} catch (const std::exception& e) {
log::error(e.what());
log::error("{}", e.what());
}
}

View File

@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "artifact-tracker",
"version-string": "1.0.5",
"version-string": "1.0.6",
"port-version": 0,
"description": "Artifact Tracker",
"homepage": "https://eddoursul.win/mods/artifact-tracker/",