From 043eac23ed138f33a7cd181d2641acff9221f6e7 Mon Sep 17 00:00:00 2001 From: Eddoursul Date: Thu, 16 Jun 2022 14:02:24 +0200 Subject: [PATCH] Initial commit --- Artifact Tracker.esp | Bin 0 -> 4747 bytes Scripts/ETR_CellStorageScript.pex | Bin 0 -> 2018 bytes Scripts/ETR_TrackFoundItems.pex | Bin 0 -> 4528 bytes Scripts/ETR_TrackNewItems.pex | Bin 0 -> 3656 bytes Scripts/ETR_TrackStoredItems.pex | Bin 0 -> 3105 bytes Source/Scripts/ETR_CellStorageScript.psc | 58 ++++++++++++ Source/Scripts/ETR_TrackFoundItems.psc | 112 +++++++++++++++++++++++ Source/Scripts/ETR_TrackNewItems.psc | 82 +++++++++++++++++ Source/Scripts/ETR_TrackStoredItems.psc | 84 +++++++++++++++++ 9 files changed, 336 insertions(+) create mode 100644 Artifact Tracker.esp create mode 100644 Scripts/ETR_CellStorageScript.pex create mode 100644 Scripts/ETR_TrackFoundItems.pex create mode 100644 Scripts/ETR_TrackNewItems.pex create mode 100644 Scripts/ETR_TrackStoredItems.pex create mode 100644 Source/Scripts/ETR_CellStorageScript.psc create mode 100644 Source/Scripts/ETR_TrackFoundItems.psc create mode 100644 Source/Scripts/ETR_TrackNewItems.psc create mode 100644 Source/Scripts/ETR_TrackStoredItems.psc diff --git a/Artifact Tracker.esp b/Artifact Tracker.esp new file mode 100644 index 0000000000000000000000000000000000000000..eb9e1a2f48b9d8136b0d197c71634bfe21a0be50 GIT binary patch literal 4747 zcmc&&Yitx%6uvDjeQoKJS|H-`R)S3{AjI<8?!&I^ZcAs&D{FMvowh@FXO@{AN&^Bh z{4j=KBtew$!$b)|48%taQjNkNH7Oy4L^OuPnD9di7zqXhlJ%VXnB6TcsYv5(x^w2< zbMHOhch5cdo(X%UMOz7!eEeZ$0X$m0o(=~&^xn@a>)@@pm=Jf!6`W4Iv6yZdrWJQS z-PhOGporIoK2>{$NT5?iTt-UmlA|eS*pQ>Wia~-dDO^UR-hM+(G$>|*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-VvT~x+^=VOL9_&N#*`r_KKd$rK^dPHyBUfA2gdsEN)7yWVDVgGX8pDo6i z2EYKY3+DF$3>d}!`hf3mV+9o4S@;wIfbD_YJxBr+Eq)GQ5`HpZ((kn;y!FTuAzicU zE?q0*twVO*Ra?4YOL!cz@h~r7(k*Uy4O#~UzhK}~7+OyKlR70`5Ws|AcCes%_!O#@ p8CAg^Xir8JCusP@((IC22}t6 literal 0 HcmV?d00001 diff --git a/Scripts/ETR_CellStorageScript.pex b/Scripts/ETR_CellStorageScript.pex new file mode 100644 index 0000000000000000000000000000000000000000..f71411f6c36d0328c5566b7d4801c48e345ac2bb GIT binary patch literal 2018 zcmc&!%TgOh6g@4;=#2~r954<8HX(Kr+2)}n+64kORW6)DDSJr`GcA}PdZ?L}`KIji z0m&l2k#)WytDNrE2qBY7c2P?+_tE!pPT$sF?|=OxpMwBDr$7JsI~MnUJU-cz{eD-+ ziGL=$K@wf*)>RsyvLA-=AV~*(57RP}Ti22D@D1kg3}o8UE2+EM*AnGdv5uWsf2$6) zygZhd@dp{A>eTPTkjm6~#J55#hQSmQ! z{Zty%C>#(gs(xg&JyM{NKjfp~UpQ_vs%ZFLrg|?{+K-e>Q0{b0ws$0q`5Arn0)^c; z?q}*t6iy-jv{9qHg) z8n&a5oHpZMba^iVc|-7!wC#+v z9ju!Q0q+$P+nMux6@COXyNAD_z?&nGGxyR6`AndF0~J)c>UK?I8V%gX3}#2Gi6$O! zeS#&fhgilVd^)z)@EA|9K3pdMJuqR5>p9mZwy@1B?N$y`KvB5=i2N@oIf>5#%524c zs+myBgnA|v*kHxQ6xng(Myayxk*7=qBc;auCV!5Q=3E8y6ib503Yd54KykssTqMjA zftJ|oGTjF53Krq(-c+_v0UCZkscg#|~%AWNR~Tm9cKB ocCz8&Nmx0botFbX0gAx?(B8{O0iWN5I>E14oir)Bpeg literal 0 HcmV?d00001 diff --git a/Scripts/ETR_TrackFoundItems.pex b/Scripts/ETR_TrackFoundItems.pex new file mode 100644 index 0000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zN*Y75;JTGqd=fL`NUAm=Syrvja#G&7R^ez>Nx4_j^n%?*+mrsV^sBhT1f*wHjK{{J z>y_PrnMAjL?rGw;`+Ufz(s2GfFd8 z4YQvOHVD+-;XoN?>8Bb2TX_R1OK#W7$ga9PvrDFGYFxL8n3;^3r!n&^W}e5)6w-QD zzyARlbJ49-+(S+)gk8^Xw9bvyxhLpnw#&`|i{pAnMfGG+1HwxBd%i?B5v*5gZ2UVl z{7kNYZugUEZV&lJm0R}e?Sc`W^V;1{O0`?F(6_-^;ih=Y+-+3~wJB(|w$-YkjZeM9 zNRwNz{e29aiCRx8j-PGBw6t-v92kBv_P9W z;wSwZ+Cxs8X3(Lus#Fov88clmlS6lC(-Ui2S;6io9?N-&`Y<>$=xYc)xZDsrait+- z(ccid=q%XA7F=aB^he-2dm?a?s+N9%TLQN!>E3n<+~GO3#tAKwG}TF{04eq`?BHGY z@E(SAr0g|;uLSN345&yVfd}0JgOPaLrTM`te5m8(8S95RfxFGtcTZVA61b|-5M5+g)0N>pQRcb-!co3XNF8`v4NV^$n&lxfmZ_4x-1DSUlN!J#gFT(?u^o> zX!ec3>nNo}0xOJmM)^h{b4IyJ)M3rf+_l!YYiQu)UF)B_t63S{)vRpXMWo+0%B==~ z_w24-V z$c};MwSR$ye5-{8?Zk>M@Q;O54~Ed{RFnNXZC{M-ivq>az8KqIY1oG|HGlrjTr5OW zk1iIXsaqEdK`%Y3x^Ln8ps(fl`1p@-Y}thH--{}a8bKOIEBZcKQNFJ`Re`ym+~rxl hn=hhi{TEY0=c?zm>8Zs(9W{oiH~zm9Ae1nHe*lCjMQH#4 literal 0 HcmV?d00001 diff --git a/Scripts/ETR_TrackStoredItems.pex b/Scripts/ETR_TrackStoredItems.pex new file mode 100644 index 0000000000000000000000000000000000000000..1461883df3f25929445e04e1a970d64c7c59372d GIT binary patch literal 3105 zcmZ`)=~mlT5dLIr%wjMxYmzo`o3?34o3JkmO$&srEM{wxwjms0UqHo397zs`C+g{2 z^hx@&r_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78PJV2DBe+a&`E5uyf@`AD y7GYeR^aI2HE>cVeKjCM*^FTL+w(lv&B13c=!~vVsL+w98U@U|H literal 0 HcmV?d00001 diff --git a/Source/Scripts/ETR_CellStorageScript.psc b/Source/Scripts/ETR_CellStorageScript.psc new file mode 100644 index 0000000..67408ed --- /dev/null +++ b/Source/Scripts/ETR_CellStorageScript.psc @@ -0,0 +1,58 @@ +Scriptname ETR_CellStorageScript extends ObjectReference + +FormList Property ETR_ItemsNew Auto +FormList Property ETR_ItemsFound Auto +FormList Property ETR_ItemsStored Auto +FormList Property ETR_PersistentStorageList Auto + + +event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) + Debug.Notification("OnItemRemoved") + bool bStored = ETR_ItemsStored.HasForm(akBaseItem) + + if GetItemCount(akBaseItem) > 0 + if ! bStored + ETR_ItemsFound.RemoveAddedForm(akBaseItem) + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + ETR_ItemsStored.AddForm(akBaseItem) + Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsStored.") + endif + return + endif + + if Eddoursul_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) + Debug.Notification("ETR_PersistentStorageList") + ; do nothing + if ! bStored + ETR_ItemsFound.RemoveAddedForm(akBaseItem) + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + ETR_ItemsStored.AddForm(akBaseItem) + Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsStored.") + endif + + else + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + ETR_ItemsStored.RemoveAddedForm(akBaseItem) + ETR_ItemsFound.AddForm(akBaseItem) + Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsFound.") + + endif + +endevent + + +event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) + + if ETR_ItemsStored.HasForm(akBaseItem) + return + endif + + ETR_ItemsFound.RemoveAddedForm(akBaseItem) + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + ETR_ItemsStored.AddForm(akBaseItem) + + ;UI.Invoke("HUD Menu", "_root.AHZWidgetContainer.AHZWidget.RefreshWidgets") + + Debug.Notification("Added " + akBaseItem.GetName() + " to cell storage and ETR_ItemsStored.") + +endevent diff --git a/Source/Scripts/ETR_TrackFoundItems.psc b/Source/Scripts/ETR_TrackFoundItems.psc new file mode 100644 index 0000000..8da5421 --- /dev/null +++ b/Source/Scripts/ETR_TrackFoundItems.psc @@ -0,0 +1,112 @@ +Scriptname ETR_TrackFoundItems extends ReferenceAlias + +Actor Property PlayerRef Auto + +FormList Property ETR_ItemsNew Auto +FormList Property ETR_ItemsFound Auto +FormList Property ETR_ItemsStored Auto +FormList Property ETR_PersistentStorageList Auto +FormList Property ETR_ExcludeFromNew Auto + +Container Property ETR_CellStorageContainer Auto + +Keyword Property LocTypePlayerHouse Auto + +bool bAtHome = false +int iFollowerIndex = 0 + + +event OnInit() + OnPlayerLoadGame() +endevent + + +Event OnPlayerLoadGame() + AddInventoryEventFilter(ETR_ItemsFound) +EndEvent + + +Event OnLocationChange(Location akOldLoc, Location akNewLoc) + + bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse) + + int iCurrentFollowers = 0; + Actor[] aFollowers = Eddoursul_Functions.GetPlayerFollowers() + int i = aFollowers.length + while i > 0 + i -= 1 + if ! aFollowers[i].IsDead() && ! aFollowers[i].IsDisabled() + iCurrentFollowers += aFollowers[i].GetFormID() + endif + endwhile + + if iCurrentFollowers == iFollowerIndex + return + endif + + ; If the list of followers has changed, rebuild ETR_ItemsFound and ETR_ItemsNew + iFollowerIndex = iCurrentFollowers + + Debug.Notification("Team changed, updating lists") + + ETR_ItemsFound.Revert() + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) + + i = aFollowers.length + while i > 0 + i -= 1 + if ! aFollowers[i].IsDead() && ! aFollowers[i].IsDisabled() + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) + endif + endwhile + + ETR_ItemsNew.Revert() + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 26, None, ETR_ExcludeFromNew) ; armor + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 41, None, ETR_ExcludeFromNew) ; weapons + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 27, None, ETR_ExcludeFromNew) ; books + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 32, None, ETR_ExcludeFromNew) ; misc items + +endEvent + + +event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) + + if akDestContainer + if akDestContainer as Actor + if (akDestContainer as Actor).IsPlayerTeammate() + ; Keep follower items marked as found + return + endif + elseif ETR_PersistentStorageList.HasForm(akDestContainer) + ETR_ItemsFound.RemoveAddedForm(akBaseItem) + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + ETR_ItemsStored.AddForm(akBaseItem) + Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsStored") + return + endif + endif + + if bAtHome && (! akDestContainer || akDestContainer.GetParentCell() == PlayerRef.GetParentCell()) && Eddoursul_Functions.HasRefInCell(akBaseItem, None, true, ETR_PersistentStorageList) + + ObjectReference cellStorage = Eddoursul_Functions.GetOrCreateCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) + + if cellStorage.GetItemCount(akBaseItem) == 0 + cellStorage.AddItem(akBaseItem, 1, true) + endif + + elseif PlayerRef.GetItemCount(akBaseItem) == 0 && Eddoursul_Functions.GetItemCountInActors(Eddoursul_Functions.GetPlayerFollowers(), akBaseItem) == 0 + + Debug.Notification("Moving " + akBaseItem.GetName() + " to ETR_ItemsNew") + ETR_ItemsFound.RemoveAddedForm(akBaseItem) + ETR_ItemsStored.RemoveAddedForm(akBaseItem) + ETR_ItemsNew.AddForm(akBaseItem) + + endif + +endevent diff --git a/Source/Scripts/ETR_TrackNewItems.psc b/Source/Scripts/ETR_TrackNewItems.psc new file mode 100644 index 0000000..2ce602e --- /dev/null +++ b/Source/Scripts/ETR_TrackNewItems.psc @@ -0,0 +1,82 @@ +Scriptname ETR_TrackNewItems extends ReferenceAlias + +Actor Property PlayerRef Auto + +FormList Property ETR_ItemsNew Auto +FormList Property ETR_ItemsFound Auto +FormList Property ETR_ItemsStored Auto +FormList Property ETR_ExcludeFromNew Auto +FormList Property ETR_PersistentStorageList Auto + + +event OnInit() + + if Game.GetModByName("HearthFires.esm") < 255 && Game.GetModByName("Enderal - Forgotten Stories.esm") == 255 + ETR_ExcludeFromNew.AddForm(Game.GetFormFromFile(0x807, "HearthFires.esm")) ; BYOHHouseCraftingCategorySmithing + endif + + OnPlayerLoadGame() + +endevent + + +event OnPlayerLoadGame() + + AddInventoryEventFilter(ETR_ItemsNew) + + if skse.GetPluginVersion("Ahzaab's moreHUD Plugin") >= 30800 + ahzmorehud.RegisterIconFormList("dbmNew", ETR_ItemsNew) + ahzmorehud.RegisterIconFormList("dbmFound", ETR_ItemsFound) + ahzmorehud.RegisterIconFormList("dbmDisp", ETR_ItemsStored) + endif + + if skse.GetPluginVersion("Ahzaab's moreHUD Inventory Plugin") >= 10017 + ahzmorehudie.RegisterIconFormList("dbmNew", ETR_ItemsNew) + ahzmorehudie.RegisterIconFormList("dbmFound", ETR_ItemsFound) + ahzmorehudie.RegisterIconFormList("dbmDisp", ETR_ItemsStored) + endif + + ; Rebuild all lists to avoid discrepancies, stale data, and broken records + + ETR_ItemsStored.Revert() + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 26, None, ETR_ExcludeFromNew) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 41, None, ETR_ExcludeFromNew) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 27, None, ETR_ExcludeFromNew) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 32, None, ETR_ExcludeFromNew) + + ETR_ItemsFound.Revert() + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) + + Actor[] aFollowers = Eddoursul_Functions.GetPlayerFollowers() + int i = aFollowers.length + while i > 0 + i -= 1 + if ! aFollowers[i].IsDead() && ! aFollowers[i].IsDisabled() + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) + Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) + endif + endwhile + + ETR_ItemsNew.Revert() + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 26, None, ETR_ExcludeFromNew) ; armor + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 41, None, ETR_ExcludeFromNew) ; weapons + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 27, None, ETR_ExcludeFromNew) ; books + Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 32, None, ETR_ExcludeFromNew) ; misc items + +endevent + + +event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) + + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + ETR_ItemsFound.AddForm(akBaseItem) + ETR_ItemsStored.RemoveAddedForm(akBaseItem) + + Debug.Notification("New artifact acquired: " + akBaseItem.GetName()) + +endevent diff --git a/Source/Scripts/ETR_TrackStoredItems.psc b/Source/Scripts/ETR_TrackStoredItems.psc new file mode 100644 index 0000000..7a838bb --- /dev/null +++ b/Source/Scripts/ETR_TrackStoredItems.psc @@ -0,0 +1,84 @@ +Scriptname ETR_TrackStoredItems extends ReferenceAlias + +Actor Property PlayerRef Auto + +FormList Property ETR_ItemsNew Auto +FormList Property ETR_ItemsFound Auto +FormList Property ETR_ItemsStored Auto +FormList Property ETR_PersistentStorageList Auto + +Container Property ETR_CellStorageContainer Auto + +Keyword Property LocTypePlayerHouse Auto + +bool bAtHome = false + + +event OnInit() + OnPlayerLoadGame() +endevent + + +Event OnPlayerLoadGame() + AddInventoryEventFilter(ETR_ItemsStored) +EndEvent + + +Event OnLocationChange(Location akOldLoc, Location akNewLoc) + bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse) +endEvent + + +; The item is already registered as stored, and we just stored more +event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) + + if ! bAtHome + return + endif + + if akDestContainer + + if !(akDestContainer as Actor) + if ETR_PersistentStorageList.HasForm(akDestContainer) + return + endif + elseif (akDestContainer as Actor).IsPlayerTeammate() + return + endif + + endif + + if ! akDestContainer || akDestContainer.GetParentCell() == PlayerRef.GetParentCell() + + ObjectReference cellStorage = Eddoursul_Functions.GetOrCreateCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) + + if cellStorage.GetItemCount(akBaseItem) == 0 && Eddoursul_Functions.HasRefInCell(akBaseItem, None, true, ETR_PersistentStorageList) + cellStorage.AddItem(akBaseItem, 1, true) + endif + + endif + +endevent + + +; We took a stored item, and we want to find out if it's the last stored item of its kind +event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) + + if akSourceContainer && !(akSourceContainer as Actor) && ETR_PersistentStorageList.HasForm(akSourceContainer) + if Eddoursul_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) == 0 + Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsFound") + ETR_ItemsStored.RemoveAddedForm(akBaseItem) + ETR_ItemsFound.AddForm(akBaseItem) + ETR_ItemsNew.RemoveAddedForm(akBaseItem) + endif + + elseif bAtHome + ObjectReference cellStorage = Eddoursul_Functions.GetOrCreateCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) + int iCount = cellStorage.GetItemCount(akBaseItem) + if iCount > 0 && ! Eddoursul_Functions.HasRefInCell(akBaseItem, None, true, ETR_PersistentStorageList) + cellStorage.RemoveItem(akBaseItem, iCount, true) + endif + + endif + +endevent