2022-10-23 02:38:58 +00:00
|
|
|
|
using ECommons.SplatoonAPI;
|
|
|
|
|
using Palace;
|
|
|
|
|
using System;
|
2022-10-31 16:34:47 +00:00
|
|
|
|
using System.Collections.Generic;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
using System.Numerics;
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Pal.Client
|
|
|
|
|
{
|
|
|
|
|
internal class Marker
|
|
|
|
|
{
|
2022-10-25 21:31:35 +00:00
|
|
|
|
public EType Type { get; set; } = EType.Unknown;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
public Vector3 Position { get; set; }
|
2022-10-31 16:34:47 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether we have encountered the trap/coffer at this location in-game.
|
|
|
|
|
/// </summary>
|
2022-10-23 02:38:58 +00:00
|
|
|
|
public bool Seen { get; set; } = false;
|
|
|
|
|
|
2022-10-31 16:34:47 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Network id for the server you're currently connected to.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public Guid? NetworkId { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// For markers that the server you're connected to doesn't know: Whether this was requested to be uploaded, to avoid duplicate requests.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public bool UploadRequested { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Which account ids this marker was seen. This is a list merely to support different remote endpoints
|
|
|
|
|
/// (where each server would assign you a different id).
|
|
|
|
|
/// </summary>
|
2023-02-06 21:00:38 +00:00
|
|
|
|
public List<string> RemoteSeenOn { get; set; } = new List<string>();
|
2022-10-31 16:34:47 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this marker was requested to be seen, to avoid duplicate requests.
|
|
|
|
|
/// </summary>
|
2022-10-23 02:38:58 +00:00
|
|
|
|
[JsonIgnore]
|
2022-10-31 16:34:47 +00:00
|
|
|
|
public bool RemoteSeenRequested { get; set; } = false;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
|
2022-12-22 00:01:09 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// To keep track of which markers were imported through a downloaded file, we save the associated import-id.
|
|
|
|
|
///
|
|
|
|
|
/// Importing another file for the same remote server will remove the old import-id, and add the new import-id here.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<Guid> Imports { get; set; } = new List<Guid>();
|
|
|
|
|
|
|
|
|
|
public bool WasImported { get; set; }
|
|
|
|
|
|
2023-02-05 01:07:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// To make rollbacks of local data easier, keep track of the version which was used to write the marker initially.
|
|
|
|
|
/// </summary>
|
2023-02-05 03:21:24 +00:00
|
|
|
|
public string? SinceVersion { get; set; }
|
2023-02-05 01:07:58 +00:00
|
|
|
|
|
2022-10-23 02:38:58 +00:00
|
|
|
|
[JsonIgnore]
|
2022-10-30 10:02:49 +00:00
|
|
|
|
public Element? SplatoonElement { get; set; }
|
2022-10-23 02:38:58 +00:00
|
|
|
|
|
2022-10-31 16:34:47 +00:00
|
|
|
|
public Marker(EType type, Vector3 position, Guid? networkId = null)
|
2022-10-23 02:38:58 +00:00
|
|
|
|
{
|
|
|
|
|
Type = type;
|
|
|
|
|
Position = position;
|
2022-10-31 16:34:47 +00:00
|
|
|
|
NetworkId = networkId;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return HashCode.Combine(Type, (int)Position.X, (int)Position.Y, (int)Position.Z);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-30 10:02:49 +00:00
|
|
|
|
public override bool Equals(object? obj)
|
2022-10-23 02:38:58 +00:00
|
|
|
|
{
|
2022-10-25 21:31:35 +00:00
|
|
|
|
return obj is Marker otherMarker && Type == otherMarker.Type && (int)Position.X == (int)otherMarker.Position.X && (int)Position.Y == (int)otherMarker.Position.Y && (int)Position.Z == (int)otherMarker.Position.Z;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-30 10:02:49 +00:00
|
|
|
|
public static bool operator ==(Marker? a, object? b)
|
2022-10-25 21:31:35 +00:00
|
|
|
|
{
|
|
|
|
|
return Equals(a, b);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-30 10:02:49 +00:00
|
|
|
|
public static bool operator !=(Marker? a, object? b)
|
2022-10-25 21:31:35 +00:00
|
|
|
|
{
|
|
|
|
|
return !Equals(a, b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-02-05 03:21:24 +00:00
|
|
|
|
public bool IsPermanent() => Type == EType.Trap || Type == EType.Hoard || Type == EType.Debug;
|
2022-10-25 21:31:35 +00:00
|
|
|
|
|
|
|
|
|
public enum EType
|
|
|
|
|
{
|
|
|
|
|
Unknown = ObjectType.Unknown,
|
|
|
|
|
|
|
|
|
|
#region Permanent Markers
|
|
|
|
|
Trap = ObjectType.Trap,
|
|
|
|
|
Hoard = ObjectType.Hoard,
|
2023-02-05 03:21:24 +00:00
|
|
|
|
Debug = ObjectType.Debug,
|
2022-10-25 21:31:35 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
# region Markers that only show up if they're currently visible
|
|
|
|
|
SilverCoffer = 100,
|
|
|
|
|
#endregion
|
2022-10-23 02:38:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|