|
|
|
@ -12,7 +12,6 @@ namespace ArtifactTracker |
|
|
|
|
RE::BGSListForm* g_listStored; |
|
|
|
|
RE::BGSListForm* g_listFound; |
|
|
|
|
RE::BGSListForm* g_persistentStorage; |
|
|
|
|
RE::BGSKeyword* g_extraArtifactKeyword; |
|
|
|
|
RE::BGSKeyword* g_homeKeyword; |
|
|
|
|
std::unordered_map<RE::FormID, RE::TESForm*> g_artifactMap; |
|
|
|
|
std::unordered_set<RE::FormType> g_artifactFormTypes; |
|
|
|
@ -36,14 +35,13 @@ namespace ArtifactTracker |
|
|
|
|
g_listStored = dataHandler->LookupForm<RE::BGSListForm>(0x805, "Artifact Tracker.esp"); // ETR_ItemsStored
|
|
|
|
|
g_listFound = dataHandler->LookupForm<RE::BGSListForm>(0x806, "Artifact Tracker.esp"); // ETR_ItemsFound
|
|
|
|
|
g_persistentStorage = dataHandler->LookupForm<RE::BGSListForm>(0x807, "Artifact Tracker.esp"); // ETR_PersistentStorageList
|
|
|
|
|
g_extraArtifactKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xDE3FD3, "Update.esm"); // ETR_ExtraArtifact
|
|
|
|
|
|
|
|
|
|
g_homeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xFC1A3, "Skyrim.esm"); // LocTypePlayerHouse
|
|
|
|
|
|
|
|
|
|
const auto recipeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xF5CB0, "Skyrim.esm"); // VendorItemRecipe
|
|
|
|
|
const auto excludeKeywords = dataHandler->LookupForm<RE::BGSListForm>(0x801, "Artifact Tracker.esp"); // ETR_ExcludeMiscKeywords
|
|
|
|
|
|
|
|
|
|
if (!g_cellContainer || !g_listNew || !g_listStored || !g_listFound || !g_persistentStorage || !g_homeKeyword || !g_extraArtifactKeyword || !recipeKeyword || !excludeKeywords) { |
|
|
|
|
if (!g_cellContainer || !g_listNew || !g_listStored || !g_listFound || !g_persistentStorage || !g_homeKeyword || !recipeKeyword || !excludeKeywords) { |
|
|
|
|
SKSE::log::warn("Failed to load data from Artifact Tracker.esp"); |
|
|
|
|
RE::DebugMessageBox("Failed to load data from Artifact Tracker.esp, the mod is disabled."); |
|
|
|
|
return; |
|
|
|
@ -73,6 +71,15 @@ namespace ArtifactTracker |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::Misc); |
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectMISC>()) { |
|
|
|
|
if (form->GetPlayable() && !form->HasKeywordInList(excludeKeywords, false)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
g_artifactMap.erase(0xA); // Lockpick
|
|
|
|
|
g_artifactMap.erase(0xF); // Gold
|
|
|
|
|
|
|
|
|
|
// Fishing CC
|
|
|
|
|
const auto plaqueFish = dataHandler->LookupForm<RE::BGSListForm>(0xF4B, "ccBGSSSE001-Fish.esm"); // ccBGSSSE001_FishPlaqueGiftFilterList
|
|
|
|
|
if (plaqueFish) { |
|
|
|
@ -84,55 +91,52 @@ namespace ArtifactTracker |
|
|
|
|
|
|
|
|
|
OnGameLoad(); |
|
|
|
|
EventListener::Install(); |
|
|
|
|
|
|
|
|
|
g_bLoaded = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PreloadArtifactList() |
|
|
|
|
void OnKeywordDistribution() |
|
|
|
|
{ |
|
|
|
|
if (g_bLoaded) { |
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
|
const auto extraArtifactKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xDE3FD3, "Update.esm"); // ETR_ExtraArtifact
|
|
|
|
|
|
|
|
|
|
if (!dataHandler || !extraArtifactKeyword) { |
|
|
|
|
SKSE::log::error("Unable to load ETR_ExtraArtifact in OnKeywordDistribution"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
|
const auto recipeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xF5CB0, "Skyrim.esm"); // VendorItemRecipe
|
|
|
|
|
const auto excludeKeywords = dataHandler->LookupForm<RE::BGSListForm>(0x801, "Artifact Tracker.esp"); // ETR_ExcludeMiscKeywords
|
|
|
|
|
|
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectBOOK>()) { |
|
|
|
|
if (form->HasKeyword(g_extraArtifactKeyword)) { |
|
|
|
|
if (form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::Misc); |
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectMISC>()) { |
|
|
|
|
if (form->GetPlayable() && (form->HasKeyword(g_extraArtifactKeyword) || !form->HasKeywordInList(excludeKeywords, false))) { |
|
|
|
|
if (form->GetPlayable() && form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
g_artifactMap.erase(0xA); // Lockpick
|
|
|
|
|
g_artifactMap.erase(0xF); // Gold
|
|
|
|
|
|
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::AlchemyItem>()) { |
|
|
|
|
if (form->HasKeyword(g_extraArtifactKeyword)) { |
|
|
|
|
if (form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::AlchemyItem); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::IngredientItem>()) { |
|
|
|
|
if (form->HasKeyword(g_extraArtifactKeyword)) { |
|
|
|
|
if (form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::Ingredient); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESSoulGem>()) { |
|
|
|
|
if (form->HasKeyword(g_extraArtifactKeyword)) { |
|
|
|
|
if (form->HasKeyword(extraArtifactKeyword)) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
g_artifactFormTypes.insert(RE::FormType::SoulGem); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
g_bLoaded = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool IsArtifact(RE::TESForm* a_form) |
|
|
|
@ -418,7 +422,7 @@ namespace ArtifactTracker |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (g_cellStorage) { |
|
|
|
|
} else if (g_cellStorage && !g_listNew->HasForm(form)) { |
|
|
|
|
// Items picked up at home are handled in the perk
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|