|
|
|
@ -340,21 +340,19 @@ namespace ArtifactTracker |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const auto contInv = a_ref->GetInventory([&](RE::TESBoundObject& a_object) -> bool { |
|
|
|
|
return !cellItems.contains(a_object.formID); |
|
|
|
|
return !cellItems.contains(a_object.formID) && IsArtifact(&a_object); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
for (const auto& [item, data] : contInv) { |
|
|
|
|
if (data.first > 0) { |
|
|
|
|
cellItems.insert(item->formID); |
|
|
|
|
if (IsArtifact(item)) { |
|
|
|
|
if (inv.find(item) == inv.end()) { |
|
|
|
|
g_cellStorage->AddObjectToContainer(item, nullptr, 1, nullptr); |
|
|
|
|
} |
|
|
|
|
if (!g_listStored->HasForm(item)) { |
|
|
|
|
ListRemoveItem(g_listNew, item); |
|
|
|
|
ListRemoveItem(g_listFound, item); |
|
|
|
|
g_listStored->AddForm(item); |
|
|
|
|
} |
|
|
|
|
if (inv.find(item) == inv.end()) { |
|
|
|
|
g_cellStorage->AddObjectToContainer(item, nullptr, 1, nullptr); |
|
|
|
|
} |
|
|
|
|
if (!g_listStored->HasForm(item)) { |
|
|
|
|
ListRemoveItem(g_listNew, item); |
|
|
|
|
ListRemoveItem(g_listFound, item); |
|
|
|
|
g_listStored->AddForm(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -362,20 +360,12 @@ namespace ArtifactTracker |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (a_ref->IsDisabled() || a_ref->IsMarkedForDeletion()) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (cellItems.contains(baseObj->formID)) { |
|
|
|
|
if (a_ref->IsDisabled() || a_ref->IsMarkedForDeletion() || cellItems.contains(baseObj->formID) || !IsArtifact(baseObj)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cellItems.insert(baseObj->formID); |
|
|
|
|
|
|
|
|
|
if (!IsArtifact(baseObj)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (inv.find(baseObj) == inv.end()) { |
|
|
|
|
g_cellStorage->AddObjectToContainer(baseObj, nullptr, 1, nullptr); |
|
|
|
|
} |
|
|
|
@ -390,11 +380,18 @@ namespace ArtifactTracker |
|
|
|
|
for (const auto& [item, data] : inv) { |
|
|
|
|
const auto& [count, entry] = data; |
|
|
|
|
if (count > 0 && !cellItems.contains(item->formID)) { |
|
|
|
|
|
|
|
|
|
g_cellStorage->RemoveItem(item, count, RE::ITEM_REMOVE_REASON::kRemove, nullptr, nullptr); |
|
|
|
|
|
|
|
|
|
if (!RefListHasItem(g_persistentStorage, item->formID)) { |
|
|
|
|
ListRemoveItem(g_listNew, item); |
|
|
|
|
ListRemoveItem(g_listStored, item); |
|
|
|
|
g_listFound->AddForm(item); |
|
|
|
|
if (GetItemCount(RE::PlayerCharacter::GetSingleton(), item) || FollowersHaveItem(item)) { |
|
|
|
|
ListRemoveItem(g_listNew, item); |
|
|
|
|
g_listFound->AddForm(item); |
|
|
|
|
} else { |
|
|
|
|
ListRemoveItem(g_listFound, item); |
|
|
|
|
g_listNew->AddForm(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|