2024-04-16 18:29:40 +00:00
|
|
|
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;
|
2024-04-16 18:29:40 +00:00
|
|
|
return parsed.Tpl == Tpl && parsed.ParentId == ParentId;
|
2023-08-12 19:08:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
2024-04-16 18:29:40 +00:00
|
|
|
return (Tpl?.GetHashCode() + ParentId?.GetHashCode()) ?? base.GetHashCode();
|
2023-08-12 19:08:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
{
|
|
|
|
return new Item
|
|
|
|
{
|
2024-04-16 18:29:40 +00:00
|
|
|
Id = Id,
|
|
|
|
Tpl = Tpl,
|
|
|
|
ParentId = ParentId,
|
|
|
|
SlotId = SlotId,
|
|
|
|
Location = Location,
|
|
|
|
Upd = ProcessorUtil.Copy(Upd)
|
2023-08-12 19:08:38 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|