|
|
|
@ -24,6 +24,8 @@ namespace ArtifactTracker |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SKSE::GetModCallbackEventSource()->RemoveEventSink(EventListener::GetSingleton()); |
|
|
|
|
|
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
|
|
|
|
|
|
if (!dataHandler) { |
|
|
|
@ -44,10 +46,13 @@ namespace ArtifactTracker |
|
|
|
|
const auto recipeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xF5CB0, "Skyrim.esm"); // VendorItemRecipe
|
|
|
|
|
const auto excludeKeywords = dataHandler->LookupForm<RE::BGSListForm>(0x801, "Artifact Tracker.esp"); // ETR_ExcludeMiscKeywords
|
|
|
|
|
const auto dummyKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xF3E6C, "Skyrim.esm"); // Dummy
|
|
|
|
|
const auto disallowEnchanting = dataHandler->LookupForm<RE::BGSKeyword>(0xC27BD, "Skyrim.esm"); // MagicDisallowEnchanting
|
|
|
|
|
const auto daedricArtifact = dataHandler->LookupForm<RE::BGSKeyword>(0xA8668, "Skyrim.esm"); // DaedricArtifact
|
|
|
|
|
|
|
|
|
|
const auto extraArtifactKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xDE3FD3, "Update.esm"); // ETR_ExtraArtifact
|
|
|
|
|
const auto notArtifactKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xDE3FD4, "Update.esm"); // ETR_NotArtifact
|
|
|
|
|
|
|
|
|
|
if (!g_cellContainer || !g_listNew || !g_listStored || !g_listFound || !g_persistentStorage || !g_homeKeyword || !recipeKeyword || !excludeKeywords || !dummyKeyword || !extraArtifactKeyword || !notArtifactKeyword) { |
|
|
|
|
if (!g_cellContainer || !g_listNew || !g_listStored || !g_listFound || !g_persistentStorage || !g_homeKeyword || !recipeKeyword || !excludeKeywords || !dummyKeyword || !extraArtifactKeyword || !notArtifactKeyword || !disallowEnchanting || !daedricArtifact) { |
|
|
|
|
SKSE::log::warn("Unable to load data from Artifact Tracker.esp"); |
|
|
|
|
RE::DebugMessageBox("Unable to load data from Artifact Tracker.esp, the mod is disabled."); |
|
|
|
|
return false; |
|
|
|
@ -55,18 +60,34 @@ namespace ArtifactTracker |
|
|
|
|
|
|
|
|
|
// Preloading item lists
|
|
|
|
|
|
|
|
|
|
std::map<std::string, bool> settings{ |
|
|
|
|
{ "ExcludeDisenchantableItems", true }, |
|
|
|
|
{ "DumpItemNames", false }, |
|
|
|
|
}; |
|
|
|
|
LoadINI(&settings, "Data/SKSE/Plugins/ArtifactTracker.ini"); |
|
|
|
|
|
|
|
|
|
bool bExcludeDisenchantableItems = settings.at("ExcludeDisenchantableItems"); |
|
|
|
|
|
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::Weapon); |
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectWEAP>()) { |
|
|
|
|
if (form->GetPlayable() && !form->IsBound() && !form->weaponData.flags.all(RE::TESObjectWEAP::Data::Flag::kCantDrop) && !form->IsDeleted() && !form->HasKeyword(dummyKeyword) && !form->HasKeyword(notArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
if (form->GetPlayable() && !form->IsBound() && !form->weaponData.flags.all(RE::TESObjectWEAP::Data::Flag::kCantDrop) && !form->IsDeleted() && !form->HasKeyword(dummyKeyword)) { |
|
|
|
|
if (!bExcludeDisenchantableItems || !form->As<RE::TESEnchantableForm>()->formEnchanting || form->HasKeyword(disallowEnchanting) || form->HasKeyword(daedricArtifact) || form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
if (!form->HasKeyword(notArtifactKeyword) && strlen(form->GetName()) > 0) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
g_artifactMap.erase(0x1F4); // Unarmed
|
|
|
|
|
|
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::Armor); |
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectARMO>()) { |
|
|
|
|
if (form->GetPlayable() && !form->IsDeleted() && !form->HasKeyword(dummyKeyword) && !form->HasKeyword(notArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
if (form->GetPlayable() && !form->IsDeleted() && !form->HasKeyword(dummyKeyword)) { |
|
|
|
|
if (!bExcludeDisenchantableItems || !form->As<RE::TESEnchantableForm>()->formEnchanting || form->HasKeyword(disallowEnchanting) || form->HasKeyword(daedricArtifact) || form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
if (!form->HasKeyword(notArtifactKeyword) && strlen(form->GetName()) > 0) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
g_artifactMap.erase(0xD64); // SkinNaked
|
|
|
|
@ -82,7 +103,7 @@ namespace ArtifactTracker |
|
|
|
|
|
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::Misc); |
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectMISC>()) { |
|
|
|
|
if (form->GetPlayable() && !form->IsDeleted() && (form->HasKeyword(extraArtifactKeyword) || !form->HasKeywordInList(excludeKeywords, false)) && !form->HasKeyword(notArtifactKeyword)) { |
|
|
|
|
if (form->GetPlayable() && !form->IsDeleted() && (form->HasKeyword(extraArtifactKeyword) || !form->HasKeywordInList(excludeKeywords, false)) && !form->HasKeyword(notArtifactKeyword) && strlen(form->GetName()) > 0) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -121,8 +142,16 @@ namespace ArtifactTracker |
|
|
|
|
|
|
|
|
|
OnGameLoad(); |
|
|
|
|
EventListener::Install(); |
|
|
|
|
|
|
|
|
|
g_bLoaded = true; |
|
|
|
|
|
|
|
|
|
SKSE::log::info("Total artifacts: {}", g_artifactMap.size()); |
|
|
|
|
|
|
|
|
|
if (settings.at("DumpItemNames")) { |
|
|
|
|
for (const auto& item : g_artifactMap) { |
|
|
|
|
SKSE::log::info("[{:08X}] {}", item.second->formID, item.second->GetName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|