2024-04-16 18:29:40 +00:00
|
|
|
using System.Text.Json.Serialization;
|
2023-08-12 19:08:38 +01:00
|
|
|
using LootDumpProcessor.Storage;
|
2024-04-16 18:29:40 +00:00
|
|
|
using LootDumpProcessor.Utils;
|
2023-08-12 19:08:38 +01:00
|
|
|
|
2025-01-11 10:52:23 +03:00
|
|
|
|
|
|
|
namespace LootDumpProcessor.Model;
|
|
|
|
|
|
|
|
public class Template : IKeyable, ICloneable
|
2023-08-12 19:08:38 +01:00
|
|
|
{
|
2025-01-11 10:52:23 +03:00
|
|
|
[JsonIgnore] public string __ID { get; } = KeyGenerator.GetNextKey();
|
|
|
|
|
|
|
|
|
|
|
|
public string? Id { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool? IsContainer { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool? UseGravity { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool? RandomRotation { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Vector3? Position { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Vector3? Rotation { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool? IsGroupPosition { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public List<GroupPosition>? GroupPositions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool? IsAlwaysSpawn { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string? Root { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public required List<Item> Items { get; set; }
|
|
|
|
|
|
|
|
protected bool Equals(Template other) => Id == other.Id;
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
{
|
|
|
|
if (ReferenceEquals(null, obj)) return false;
|
|
|
|
if (ReferenceEquals(this, obj)) return true;
|
|
|
|
if (obj.GetType() != GetType()) return false;
|
|
|
|
return Equals((Template)obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override int GetHashCode() => Id != null ? Id.GetHashCode() : 0;
|
|
|
|
|
|
|
|
public IKey GetKey()
|
2023-08-12 19:08:38 +01:00
|
|
|
{
|
2025-01-11 10:52:23 +03:00
|
|
|
return new FlatUniqueKey(new[] { __ID });
|
2023-08-12 19:08:38 +01:00
|
|
|
}
|
2025-01-11 10:52:23 +03:00
|
|
|
|
|
|
|
public object Clone() => new Template
|
|
|
|
{
|
|
|
|
Id = Id,
|
|
|
|
IsContainer = IsContainer,
|
|
|
|
UseGravity = UseGravity,
|
|
|
|
RandomRotation = RandomRotation,
|
|
|
|
Position = ProcessorUtil.Copy(Position),
|
|
|
|
Rotation = ProcessorUtil.Copy(Rotation),
|
|
|
|
IsGroupPosition = IsGroupPosition,
|
|
|
|
GroupPositions = ProcessorUtil.Copy(GroupPositions),
|
|
|
|
IsAlwaysSpawn = IsAlwaysSpawn,
|
|
|
|
Root = Root,
|
|
|
|
Items = ProcessorUtil.Copy(Items)
|
|
|
|
};
|
2023-08-12 19:08:38 +01:00
|
|
|
}
|