2018-02-21 20:29:23 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2022-01-26 11:32:16 -05:00
|
|
|
|
using SharedLibraryCore.Helpers;
|
2018-02-21 20:29:23 -05:00
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore.Dtos
|
2018-02-21 20:29:23 -05:00
|
|
|
|
{
|
|
|
|
|
public class ServerInfo
|
|
|
|
|
{
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public int Port { get; set; }
|
|
|
|
|
public string Map { get; set; }
|
|
|
|
|
public string GameType { get; set; }
|
|
|
|
|
public int ClientCount { get; set; }
|
|
|
|
|
public int MaxClients { get; set; }
|
2018-05-14 13:55:10 -04:00
|
|
|
|
public List<ChatInfo> ChatHistory { get; set; }
|
2018-02-21 20:29:23 -05:00
|
|
|
|
public List<PlayerInfo> Players { get; set; }
|
2022-03-29 17:42:53 -04:00
|
|
|
|
public ClientHistoryInfo ClientHistory { get; set; }
|
2018-11-27 19:31:48 -05:00
|
|
|
|
public long ID { get; set; }
|
2018-04-05 00:38:45 -04:00
|
|
|
|
public bool Online { get; set; }
|
2019-04-07 21:14:59 -04:00
|
|
|
|
public string ConnectProtocolUrl { get; set; }
|
2019-04-08 13:29:48 -04:00
|
|
|
|
public string IPAddress { get; set; }
|
2022-04-19 19:43:58 -04:00
|
|
|
|
public string ExternalIPAddress { get; set; }
|
2020-08-20 11:38:11 -04:00
|
|
|
|
public bool IsPasswordProtected { get; set; }
|
2021-03-22 12:09:25 -04:00
|
|
|
|
public string Endpoint => $"{IPAddress}:{Port}";
|
2021-06-30 10:57:07 -04:00
|
|
|
|
|
|
|
|
|
public double? LobbyZScore
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var valid = Players.Where(player => player.ZScore != null && player.ZScore != 0)
|
|
|
|
|
.ToList();
|
2022-01-26 11:32:16 -05:00
|
|
|
|
|
2021-06-30 10:57:07 -04:00
|
|
|
|
if (!valid.Any())
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Math.Round(valid.Select(player => player.ZScore.Value).Average(), 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-21 20:29:23 -05:00
|
|
|
|
}
|
2022-03-29 17:42:53 -04:00
|
|
|
|
}
|