diff --git a/SKSE/Plugins/ArtifactTrackerFunctions.dll b/SKSE/Plugins/ArtifactTrackerFunctions.dll index b18a8a4..20c6fa6 100644 Binary files a/SKSE/Plugins/ArtifactTrackerFunctions.dll and b/SKSE/Plugins/ArtifactTrackerFunctions.dll differ diff --git a/Scripts/ETR_Functions.pex b/Scripts/ETR_Functions.pex index 114a6a7..1157206 100644 Binary files a/Scripts/ETR_Functions.pex and b/Scripts/ETR_Functions.pex differ diff --git a/Scripts/ETR_TrackFoundItems.pex b/Scripts/ETR_TrackFoundItems.pex index 2e9d5a1..a98ec13 100644 Binary files a/Scripts/ETR_TrackFoundItems.pex and b/Scripts/ETR_TrackFoundItems.pex differ diff --git a/Scripts/ETR_TrackStoredItems.pex b/Scripts/ETR_TrackStoredItems.pex index 4ef2ffc..0913806 100644 Binary files a/Scripts/ETR_TrackStoredItems.pex and b/Scripts/ETR_TrackStoredItems.pex differ diff --git a/Source/ArtifactTrackerDLL/src/Functions/ArtifactTracker.h b/Source/ArtifactTrackerDLL/src/Functions/ArtifactTracker.h index 4ad0a59..27fd2fb 100644 --- a/Source/ArtifactTrackerDLL/src/Functions/ArtifactTracker.h +++ b/Source/ArtifactTrackerDLL/src/Functions/ArtifactTracker.h @@ -198,6 +198,7 @@ namespace Papyrus::ArtifactTracker inline void SyncCellStorage(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*, RE::TESObjectREFR* a_cellStorage, + RE::BGSListForm* a_excludeContainers, RE::TESForm* a_excludeForm = NULL) { if (!a_cellStorage) { @@ -206,7 +207,6 @@ namespace Papyrus::ArtifactTracker std::unordered_map cellItems; - const auto storageBase = a_cellStorage->GetBaseObject(); const auto cell = a_cellStorage->GetParentCell(); const auto inv = a_cellStorage->GetInventory(); @@ -214,7 +214,7 @@ namespace Papyrus::ArtifactTracker const auto baseObj = a_ref->GetBaseObject(); if (baseObj->formType == RE::FormType::Container || (baseObj->formType == RE::FormType::NPC && !a_ref->IsDisabled() && baseObj->As()->GetRace()->formID == 0x0010760A)) { - if (a_ref->GetBaseObject()->formID == storageBase->formID) { + if (a_excludeContainers->HasForm(a_ref->formID)) { continue; } @@ -249,7 +249,7 @@ namespace Papyrus::ArtifactTracker if (!is_artifact(baseObj)) { continue; } - + if (inv.find(baseObj) == inv.end()) { if (!a_excludeForm || !is_excluded(baseObj, a_excludeForm)) { a_cellStorage->AddObjectToContainer(baseObj, nullptr, 1, nullptr); diff --git a/Source/Scripts/ETR_Functions.psc b/Source/Scripts/ETR_Functions.psc index 8d86a91..e97e9df 100644 --- a/Source/Scripts/ETR_Functions.psc +++ b/Source/Scripts/ETR_Functions.psc @@ -8,7 +8,7 @@ int function GetItemCountInList(FormList refList, Form baseForm) native global ObjectReference function GetCellStorage(ObjectReference ref, FormList refList, Form refToCreate, bool autoCreate = true) native global -function SyncCellStorage(ObjectReference cellStorage, Form excludeForm = None) native global +function SyncCellStorage(ObjectReference cellStorage, FormList excludeContainers, Form excludeForm = None) native global Actor[] function GetPlayerFollowers() native global diff --git a/Source/Scripts/ETR_TrackFoundItems.psc b/Source/Scripts/ETR_TrackFoundItems.psc index 9350538..d7bd417 100644 --- a/Source/Scripts/ETR_TrackFoundItems.psc +++ b/Source/Scripts/ETR_TrackFoundItems.psc @@ -87,7 +87,7 @@ Event OnUpdate() endif bRescanHome = false ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) - ETR_Functions.SyncCellStorage(cellStorage) + ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList) if ! bRescanPersistent ETR_Functions.AddArtifactsToList(cellStorage, ETR_ItemsStored) endif @@ -119,6 +119,7 @@ event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemRefe lastDestContainer = akDestContainer lastDestIsPersistent = ETR_PersistentStorageList.HasForm(akDestContainer) endif + ; Moving items without latent functions should help with avoiding stack dumps if lastDestIsPersistent bRescanHome = false diff --git a/Source/Scripts/ETR_TrackStoredItems.psc b/Source/Scripts/ETR_TrackStoredItems.psc index 9281ce2..7ee7ab5 100644 --- a/Source/Scripts/ETR_TrackStoredItems.psc +++ b/Source/Scripts/ETR_TrackStoredItems.psc @@ -78,7 +78,7 @@ Event OnUpdate() return endif ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) - ETR_Functions.SyncCellStorage(cellStorage) + ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList) endif if bRescanPersistent @@ -118,7 +118,7 @@ event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemRefere elseif bAtHome ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) if cellStorage.GetItemCount(akBaseItem) - ETR_Functions.SyncCellStorage(cellStorage) + ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList) if ETR_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) == 0 ETR_ItemsStored.RemoveAddedForm(akBaseItem) ETR_ItemsFound.AddForm(akBaseItem)