/// </summary>
IClient? Client { get; set; }
+ /// <summary>
+ /// Gets the average ping of the client.
+ /// </summary>
+ float AveragePing { get; }
+
/// <summary>
/// Sends a message writer to the connection.
/// </summary>
public IClient? Client { get; set; }
+ public float AveragePing => InnerConnection is NetworkConnection networkConnection ? networkConnection.AveragePingMs : 0;
+
public ValueTask SendAsync(IMessageWriter writer)
{
return InnerConnection.SendAsync(writer);
}
}
- PlayerInfo.LastMurder = _dateTimeProvider.UtcNow;
+ PlayerInfo.LastMurder = _dateTimeProvider.UtcNow - TimeSpan.FromMilliseconds(sender.Client.Connection.AveragePing);
if (target != null && !target.PlayerInfo.IsDead)
{
public IPEndPoint EndPoint { get; }
public bool IsConnected { get; }
public IClient Client { get; set; }
+ public float AveragePing => 0;
public ValueTask SendAsync(IMessageWriter writer)
{