2018-02-21 20:29:23 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
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; }
|
|
|
|
|
public Helpers.PlayerHistory[] PlayerHistory { get; set; }
|
2021-08-29 14:10:10 -04:00
|
|
|
|
public List<ClientCountSnapshot> ClientCountHistory { 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; }
|
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();
|
|
|
|
|
|
|
|
|
|
if (!valid.Any())
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Math.Round(valid.Select(player => player.ZScore.Value).Average(), 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-21 20:29:23 -05:00
|
|
|
|
}
|
2021-06-30 10:57:07 -04:00
|
|
|
|
}
|