45 lines
929 B
C#
45 lines
929 B
C#
using System;
|
|
|
|
namespace LLib.Shop.Model;
|
|
|
|
public sealed class ItemForSale : IEquatable<ItemForSale>
|
|
{
|
|
public required int Position { get; init; }
|
|
|
|
public required uint ItemId { get; init; }
|
|
|
|
public required string? ItemName { get; init; }
|
|
|
|
public required uint Price { get; init; }
|
|
|
|
public required uint CurrencyItemId { get; init; }
|
|
|
|
public required uint OwnedItems { get; init; }
|
|
|
|
public bool Equals(ItemForSale? other)
|
|
{
|
|
if (other == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (this == other)
|
|
{
|
|
return true;
|
|
}
|
|
if (Position == other.Position && ItemId == other.ItemId && Price == other.Price && CurrencyItemId == other.CurrencyItemId)
|
|
{
|
|
return OwnedItems == other.OwnedItems;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
return Equals(obj as ItemForSale);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(Position, ItemId, Price, CurrencyItemId, OwnedItems);
|
|
}
|
|
}
|