Fix item duplication on restore inventory

This commit is contained in:
zontreck 2025-01-18 13:15:26 -07:00
parent 5234415034
commit 3f1ce790d9
2 changed files with 22 additions and 4 deletions

View file

@ -88,15 +88,33 @@ namespace AriasServerUtils
var invMgr = player.InventoryManager;
var iBackpackSlotNum = 0;
foreach (var type in saveInvTypes)
{
foreach (var stack in invMgr.GetOwnInventory(type))
{
if (iBackpackSlotNum >= 4)
{
continue;
}
if (type == GlobalConstants.backpackInvClassName)
{
iBackpackSlotNum++;
}
if (stack.Empty) continue;
if (stack.Inventory.ClassName == GlobalConstants.characterInvClassName)
{
if (stack.Itemstack.ItemAttributes?["protectionModifiers"].Exists ?? false)
{
inv.Items.Add(stack.Itemstack.Clone());
}
}
else
inv.Items.Add(stack.Itemstack.Clone());
API.Logger.Notification($"SAVED STORAGE ITEM TYPE: {stack.Itemstack}");
}
}

View file

@ -3,8 +3,8 @@
"modid": "ariasserverutils",
"name": "Aria's Server Utilities",
"authors": ["zontreck"],
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 04:23 AM",
"version": "1.0.0-dev.3",
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 01:00 PM",
"version": "1.0.0-dev.4",
"dependencies": {
"game": ""
}