@using WebfrontCore.ViewModels @using System.Globalization @using SharedLibraryCore.Database.Models @model WebfrontCore.ViewModels.ScoreboardInfo @{ Layout = null; object OrderByFunc(ClientScoreboardInfo item) { var property = typeof(ClientScoreboardInfo).GetProperties().FirstOrDefault(prop => prop.CanRead && prop.Name.Equals(Model.OrderByKey, StringComparison.InvariantCultureIgnoreCase)); return property != null ? property.GetValue(item) : item.Score; } string GetColumnSortDisplay(string propertyName) { if (propertyName == (Model.OrderByKey ?? nameof(ClientScoreboardInfo.Score))) { return Model.ShouldOrderDescending ? "" : ""; } return null; } string GetTeamBackgroundColorClass(ClientScoreboardInfo client) { return $"team-{client.Team.ToString().ToLower()}-bg {(client.Team == EFClient.TeamType.Unknown ? "bg-dark-dm bg-light-lm" : "")}"; } }

@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]

@if (!Model.ClientInfo.Any()) {
@ViewBag.Localization["WEBFRONT_SCOREBOARD_NO_PLAYERS"]
} else { @foreach (var client in Model.ShouldOrderDescending ? Model.ClientInfo.OrderByDescending(OrderByFunc) : Model.ClientInfo.OrderBy(OrderByFunc)) { }
@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PLAYER"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ClientName))) @ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Score))) @ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Kills))) @ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_DEATHS"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Deaths))) @ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_RATIO"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Kdr))) @ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_SPM"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ScorePerMinute))) @ViewBag.Localization["WEBFRONT_ADV_STATS_ZSCORE"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ZScore))) @ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PING"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Ping)))
@client.Score @(client.Kills ?? 0) @(client.Deaths ?? 0) @Math.Round(client.Kdr ?? 0, 2) @Math.Round(client.ScorePerMinute ?? 0) @(client.ZScore is null or 0 ? "--" : Math.Round(client.ZScore.Value, 2).ToString(CultureInfo.CurrentCulture)) @client.Ping
@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PLAYER"]
@ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"]
@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]
@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_DEATHS"]
@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_RATIO"]
@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_SPM"]
@ViewBag.Localization["WEBFRONT_ADV_STATS_ZSCORE"]
@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PING"]
@client.Score
@(client.Kills ?? 0)
@(client.Deaths ?? 0)
@Math.Round(client.Kdr ?? 0, 2)
@Math.Round(client.ScorePerMinute ?? 0)
@(client.ZScore is null or 0 ? "--" : Math.Round(client.ZScore.Value, 2).ToString(CultureInfo.CurrentCulture))
@client.Ping
}