/// <summary> /// Swaps the content of the slot with another one /// </summary> /// <param name="left">The slot to swap from</param> /// <param name="right">The slot to swap to</param> public static void Swap(IInventorySlot left, IInventorySlot right) { //Only swap if slot types match if (!left.CanSet(right.Item.Type) || !right.CanSet(left.Item.Type)) { return; } var leftId = left.Id; var leftAmount = left.Amount; left.Set(right.Id, right.Amount); right.Set(leftId, leftAmount); }
/// <summary> /// Swaps the content of the slot with another one /// </summary> /// <param name="other">The other slot to swap the content with</param> public void Swap(IInventorySlot other) { //Only swap if slot types match if (!CanSet(other.Item.Type) || !other.CanSet(Item.Type)) { return; } var id = Id; var amount = Amount; Set(other.Id, other.Amount); other.Set(id, amount); }