58 lines
1.8 KiB
C#
Raw Normal View History

using System.Text.Json.Serialization;
using LootDumpProcessor.Utils;
2023-08-12 19:08:38 +01:00
using Newtonsoft.Json;
namespace LootDumpProcessor.Model
{
public class Item : ICloneable
{
[JsonProperty("_id", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("_id")]
public string? Id { get; set; }
[JsonProperty("_tpl", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("_tpl")]
public string? Tpl { get; set; }
[JsonProperty("parentId", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("parentId")]
public string? ParentId { get; set; }
[JsonProperty("slotId", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("slotId")]
public string? SlotId { get; set; }
[JsonProperty("location", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("location")]
public object? Location { get; set; }
[JsonProperty("upd", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("upd")]
public Upd? Upd { get; set; }
public override bool Equals(object? obj)
{
if (obj is not Item parsed)
return false;
return parsed.Tpl == Tpl && parsed.ParentId == ParentId;
2023-08-12 19:08:38 +01:00
}
public override int GetHashCode()
{
return (Tpl?.GetHashCode() + ParentId?.GetHashCode()) ?? base.GetHashCode();
2023-08-12 19:08:38 +01:00
}
public object Clone()
{
return new Item
{
Id = Id,
Tpl = Tpl,
ParentId = ParentId,
SlotId = SlotId,
Location = Location,
Upd = ProcessorUtil.Copy(Upd)
2023-08-12 19:08:38 +01:00
};
}
}
}