IW4M-Admin/SharedLibraryCore/Dtos/ServerInfo.cs

44 lines
1.3 KiB
C#
Raw Normal View History

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; }
public List<ChatInfo> ChatHistory { get; set; }
2018-02-21 20:29:23 -05:00
public List<PlayerInfo> Players { get; set; }
public ClientHistoryInfo ClientHistory { get; set; }
public long ID { get; set; }
public bool Online { get; set; }
public string ConnectProtocolUrl { get; set; }
public string IPAddress { get; set; }
2022-04-19 19:43:58 -04:00
public string ExternalIPAddress { get; set; }
public bool IsPasswordProtected { get; set; }
public string Endpoint => $"{IPAddress}:{Port}";
public double? LobbyZScore
{
get
{
var valid = Players.Where(player => player.ZScore != null && player.ZScore != 0)
.ToList();
2022-01-26 11:32:16 -05: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
}
}