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;
|
|
|
|
|
2025-01-13 02:19:41 +03:00
|
|
|
public class Template(
|
|
|
|
string internalId, string? id, bool isContainer, bool? useGravity, bool? randomRotation,
|
|
|
|
Vector3? position, Vector3? rotation, bool? isGroupPosition, List<GroupPosition>? groupPositions,
|
|
|
|
bool? isAlwaysSpawn, string? root, List<Item> items
|
|
|
|
)
|
|
|
|
: IKeyable, ICloneable
|
2023-08-12 19:08:38 +01:00
|
|
|
{
|
2025-01-13 02:19:41 +03:00
|
|
|
[JsonIgnore] public string InternalId { get; } = internalId;
|
|
|
|
[JsonPropertyName("Id")] public string? Id { get; set; } = id;
|
|
|
|
[JsonPropertyName("IsContainer")] public bool IsContainer { get; set; } = isContainer;
|
|
|
|
public bool? UseGravity { get; set; } = useGravity;
|
|
|
|
public bool? RandomRotation { get; set; } = randomRotation;
|
|
|
|
[JsonPropertyName("Position")] public Vector3? Position { get; set; } = position;
|
|
|
|
[JsonPropertyName("Rotation")] public Vector3? Rotation { get; set; } = rotation;
|
|
|
|
[JsonPropertyName("IsGroupPosition")] public bool? IsGroupPosition { get; set; } = isGroupPosition;
|
|
|
|
[JsonPropertyName("GroupPositions")] public List<GroupPosition>? GroupPositions { get; set; } = groupPositions;
|
|
|
|
[JsonPropertyName("IsAlwaysSpawn")] public bool? IsAlwaysSpawn { get; set; } = isAlwaysSpawn;
|
|
|
|
[JsonPropertyName("Root")] public string? Root { get; set; } = root;
|
|
|
|
[JsonPropertyName("Items")] public List<Item> Items { get; set; } = items;
|
2025-01-11 10:52:23 +03:00
|
|
|
|
2025-01-11 11:50:02 +03:00
|
|
|
private bool Equals(Template other) => Id == other.Id;
|
2025-01-11 10:52:23 +03:00
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
{
|
|
|
|
if (ReferenceEquals(null, obj)) return false;
|
|
|
|
if (ReferenceEquals(this, obj)) return true;
|
2025-01-11 11:50:02 +03:00
|
|
|
return obj.GetType() == GetType() && Equals((Template)obj);
|
2025-01-11 10:52:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public override int GetHashCode() => Id != null ? Id.GetHashCode() : 0;
|
|
|
|
|
2025-01-12 22:13:30 +03:00
|
|
|
public IKey GetKey() => new FlatUniqueKey([InternalId]);
|
2025-01-11 10:52:23 +03:00
|
|
|
|
|
|
|
public object Clone() => new Template
|
2025-01-11 11:50:02 +03:00
|
|
|
(
|
2025-01-12 22:13:30 +03:00
|
|
|
InternalId,
|
2025-01-11 11:50:02 +03:00
|
|
|
Id,
|
|
|
|
IsContainer,
|
|
|
|
UseGravity,
|
|
|
|
RandomRotation,
|
2025-01-11 12:15:01 +03:00
|
|
|
Position,
|
|
|
|
Rotation,
|
2025-01-11 11:50:02 +03:00
|
|
|
IsGroupPosition,
|
|
|
|
ProcessorUtil.Copy(GroupPositions),
|
|
|
|
IsAlwaysSpawn,
|
|
|
|
Root,
|
|
|
|
ProcessorUtil.Copy(Items)
|
|
|
|
);
|
2023-08-12 19:08:38 +01:00
|
|
|
}
|