generated from AriasCreations/vsmodtemplate
Fix item duplication on restore inventory
This commit is contained in:
parent
5234415034
commit
3f1ce790d9
2 changed files with 22 additions and 4 deletions
|
@ -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;
|
||||
inv.Items.Add(stack.Itemstack.Clone());
|
||||
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}");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue