Updated EnsureItemHasValidStackCount to be an extension method
This commit is contained in:
@@ -856,8 +856,8 @@ public class InventoryController(
|
||||
return;
|
||||
}
|
||||
|
||||
EnsureItemHasValidStackCount(destinationItem);
|
||||
EnsureItemHasValidStackCount(sourceItem);
|
||||
destinationItem.EnsureItemHasValidStackCount();
|
||||
sourceItem.EnsureItemHasValidStackCount();
|
||||
|
||||
// Merging non Found in Raid (SpawnedInSession) items with FiR item causing result to be not Found in Raid
|
||||
if (!sourceItem.Upd.SpawnedInSession.GetValueOrDefault(false) && destinationItem.Upd.SpawnedInSession.GetValueOrDefault(false))
|
||||
@@ -881,25 +881,6 @@ public class InventoryController(
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure an item has a upd object with a stack count of 1
|
||||
/// </summary>
|
||||
/// <param name="item">Item to check</param>
|
||||
protected void EnsureItemHasValidStackCount(Item item)
|
||||
{
|
||||
if (item.Upd is null)
|
||||
{
|
||||
item.AddUpd();
|
||||
item.Upd.StackObjectsCount = 1;
|
||||
}
|
||||
|
||||
if (item.Upd.StackObjectsCount is null or 0)
|
||||
{
|
||||
// Items pulled out of raid can have no stack count, default to 1
|
||||
item.Upd.StackObjectsCount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Split Item stack - 1 stack into 2
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user