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