Rebuild the artifact list if its size changed
This commit is contained in:
parent
a3cdd32cae
commit
b598d8fe38
Binary file not shown.
Binary file not shown.
@ -467,7 +467,7 @@ namespace ArtifactTracker
|
||||
}
|
||||
|
||||
// NB: During OnContainerChanged, InventoryChanges do not have the current change included yet
|
||||
if ((GetItemCount(RE::PlayerCharacter::GetSingleton(), form->formID) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
if ((GetItemCount(RE::PlayerCharacter::GetSingleton(), form) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
ListRemoveItem(g_listNew, form);
|
||||
g_listNew->AddForm(form);
|
||||
@ -506,7 +506,7 @@ namespace ArtifactTracker
|
||||
}
|
||||
|
||||
// NB: During OnContainerChanged, InventoryChanges do not have the current change included yet
|
||||
} else if (g_listFound->HasForm(form) && (GetItemCount(RE::PlayerCharacter::GetSingleton(), form->formID) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
} else if (g_listFound->HasForm(form) && (GetItemCount(RE::PlayerCharacter::GetSingleton(), form) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
g_listNew->AddForm(form);
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ namespace Papyrus::PapyrusFunctions
|
||||
ArtifactTracker::SyncCellStorage();
|
||||
}
|
||||
|
||||
inline std::uint32_t GetArtifactCount(RE::StaticFunctionTag*)
|
||||
{
|
||||
return (ArtifactTracker::g_artifactMap).size();
|
||||
}
|
||||
|
||||
// From po3's Papyrus Extender
|
||||
inline std::vector<RE::Actor*> GetPlayerFollowers(RE::StaticFunctionTag*)
|
||||
{
|
||||
@ -72,6 +77,8 @@ namespace Papyrus::PapyrusFunctions
|
||||
{
|
||||
BIND(IsLoaded);
|
||||
logger::info("Registered IsLoaded"sv);
|
||||
BIND(GetArtifactCount);
|
||||
logger::info("Registered GetArtifactCount"sv);
|
||||
BIND(RescanStoredArtifacts);
|
||||
logger::info("Registered RescanStoredArtifacts"sv);
|
||||
BIND(RescanFoundArtifacts);
|
||||
|
@ -9,8 +9,9 @@ Keyword Property LocTypePlayerHouse Auto
|
||||
Perk Property ETR_PickupPerk Auto
|
||||
|
||||
bool bAtHome = false
|
||||
int iFollowerIndex
|
||||
ObjectReference bookShelf = None
|
||||
int iFollowerIndex = 0
|
||||
int iArtifactCount = 0
|
||||
|
||||
|
||||
event OnInit()
|
||||
@ -51,6 +52,13 @@ Event OnPlayerLoadGame()
|
||||
QuickLootEE.RegisterFoundItemsList(ETR_ItemsFound)
|
||||
endif
|
||||
|
||||
int iNewArtifactCount = GetArtifactCount()
|
||||
if iNewArtifactCount != iArtifactCount
|
||||
iArtifactCount = iNewArtifactCount
|
||||
Debug.Notification("Artifact list changed, rebuilding the list")
|
||||
ETR_ItemsNew.Revert() ; rebuild the list
|
||||
endif
|
||||
|
||||
; Rebuild all lists to avoid discrepancies, stale data, and broken records
|
||||
RescanStoredArtifacts()
|
||||
RescanFoundArtifacts()
|
||||
@ -159,6 +167,8 @@ endstate
|
||||
|
||||
bool function IsLoaded() native global
|
||||
|
||||
int function GetArtifactCount() native global
|
||||
|
||||
function RescanStoredArtifacts() native global
|
||||
|
||||
function RescanFoundArtifacts() native global
|
||||
|
Loading…
Reference in New Issue
Block a user