|
|
|
@ -24,21 +24,21 @@ namespace ArtifactTracker |
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
|
|
|
|
|
|
if (!dataHandler) { |
|
|
|
|
SKSE::log::warn("Failed to call RE::TESDataHandler::GetSingleton()"); |
|
|
|
|
SKSE::log::error("Failed to call RE::TESDataHandler::GetSingleton()"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
g_cellContainer = dataHandler->LookupForm(0x800, "Artifact Tracker.esp")->As<RE::TESBoundObject>(); |
|
|
|
|
g_cellContainer = dataHandler->LookupForm(0x800, "Artifact Tracker.esp")->As<RE::TESBoundObject>(); // ETR_CellStorageContainer
|
|
|
|
|
|
|
|
|
|
g_listNew = dataHandler->LookupForm<RE::BGSListForm>(0x803, "Artifact Tracker.esp"); |
|
|
|
|
g_listStored = dataHandler->LookupForm<RE::BGSListForm>(0x805, "Artifact Tracker.esp"); |
|
|
|
|
g_listFound = dataHandler->LookupForm<RE::BGSListForm>(0x806, "Artifact Tracker.esp"); |
|
|
|
|
g_persistentStorage = dataHandler->LookupForm<RE::BGSListForm>(0x807, "Artifact Tracker.esp"); |
|
|
|
|
g_listNew = dataHandler->LookupForm<RE::BGSListForm>(0x803, "Artifact Tracker.esp"); // ETR_ItemsNew
|
|
|
|
|
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_homeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xFC1A3, "Skyrim.esm"); |
|
|
|
|
g_homeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xFC1A3, "Skyrim.esm"); // LocTypePlayerHouse
|
|
|
|
|
|
|
|
|
|
const RE::BGSKeyword* recipeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xF5CB0, "Skyrim.esm"); // VendorItemRecipe
|
|
|
|
|
RE::BGSListForm* excludeKeywords = dataHandler->LookupForm<RE::BGSListForm>(0x801, "Artifact Tracker.esp"); // ETR_ExcludeMiscKeywords
|
|
|
|
|
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 || !recipeKeyword || !excludeKeywords) { |
|
|
|
|
SKSE::log::warn("Failed to load data from Artifact Tracker.esp"); |
|
|
|
@ -49,7 +49,7 @@ namespace ArtifactTracker |
|
|
|
|
// Preloading item lists
|
|
|
|
|
|
|
|
|
|
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectBOOK>()) { |
|
|
|
|
if (form && !form->TeachesSpell() && (!form->HasKeyword(recipeKeyword) || BookCheck::IsBook(form))) { |
|
|
|
|
if (form && !form->TeachesSpell() && (form->HasKeyword(recipeKeyword) || BookCheck::IsBook(form))) { |
|
|
|
|
g_artifactMap[form->formID] = form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -130,7 +130,7 @@ namespace ArtifactTracker |
|
|
|
|
g_bHomeContainer = IsHome() |
|
|
|
|
&& refr |
|
|
|
|
&& refr.get()->GetParentCell() == RE::PlayerCharacter::GetSingleton()->GetParentCell() |
|
|
|
|
&& !g_persistentStorage->HasForm(refr.get()); |
|
|
|
|
&& !g_persistentMap.contains(refr.get()->formID); |
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
if (g_bHomeContainer) { |
|
|
|
@ -248,7 +248,7 @@ namespace ArtifactTracker |
|
|
|
|
g_persistentMap[cellStorage->formID] = cellStorage; |
|
|
|
|
ToggleHomeMode(cellStorage); |
|
|
|
|
} else { |
|
|
|
|
SKSE::log::warn("Failed to create cell storage in OnCellEnter"); |
|
|
|
|
SKSE::log::error("Failed to create cell storage in OnCellEnter"); |
|
|
|
|
ToggleHomeMode(nullptr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -410,8 +410,8 @@ namespace ArtifactTracker |
|
|
|
|
if (!RefHasItem(g_cellStorage, form->formID)) { |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
SKSE::log::info("Added dropped {} to cell storage", form->GetName()); |
|
|
|
|
RE::DebugNotification("Adding to cell storage"); |
|
|
|
|
#endif |
|
|
|
|
RE::DebugNotification("adding to cell storage"); |
|
|
|
|
g_cellStorage->AddObjectToContainer(form->As<RE::TESBoundObject>(), nullptr, 1, nullptr); |
|
|
|
|
} |
|
|
|
|
ListRemoveItem(g_listFound, form); |
|
|
|
|