public override InventoryItem.MergeResult TryStack(IInventoryItem other) { int uses = base.uses; if (uses != 0) { DB datablock = other.datablock as DB; if ((datablock != null) && (datablock == this.datablock)) { if (other.uses == base.maxUses) { return(InventoryItem.MergeResult.Failed); } if (this.datablock.IsSplittable()) { IInventoryItem item = other; int numWant = item.AddUses(uses); if (numWant == 0) { return(InventoryItem.MergeResult.Failed); } if (item2.Consume(ref numWant)) { item2.inventory.RemoveItem(item2.slot); } return(InventoryItem.MergeResult.Merged); } } } return(InventoryItem.MergeResult.Failed); }
public override InventoryItem.MergeResult TryStack(IInventoryItem other) { int num = base.uses; if (num == 0) { return(InventoryItem.MergeResult.Failed); } DB dB = (DB)(other.datablock as DB); if (dB && dB == this.datablock) { if (other.uses == this.maxUses) { return(InventoryItem.MergeResult.Failed); } if (this.datablock.IsSplittable()) { IInventoryItem inventoryItem = other; InventoryItem <DB> inventoryItem1 = this; int num1 = inventoryItem.AddUses(num); if (num1 == 0) { return(InventoryItem.MergeResult.Failed); } if (inventoryItem1.Consume(ref num1)) { inventoryItem1.inventory.RemoveItem(inventoryItem1.slot); } return(InventoryItem.MergeResult.Merged); } } return(InventoryItem.MergeResult.Failed); }