diff --git a/SharedLibraryCore/Dtos/ServerInfo.cs b/SharedLibraryCore/Dtos/ServerInfo.cs index 68febd140..e621bef5e 100644 --- a/SharedLibraryCore/Dtos/ServerInfo.cs +++ b/SharedLibraryCore/Dtos/ServerInfo.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Data.Models; using SharedLibraryCore.Helpers; namespace SharedLibraryCore.Dtos @@ -40,5 +41,6 @@ namespace SharedLibraryCore.Dtos return Math.Round(valid.Select(player => player.ZScore.Value).Average(), 2); } } + public Reference.Game Game { get; set; } } } diff --git a/WebfrontCore/Controllers/ServerController.cs b/WebfrontCore/Controllers/ServerController.cs index f0ce6656e..344885ef4 100644 --- a/WebfrontCore/Controllers/ServerController.cs +++ b/WebfrontCore/Controllers/ServerController.cs @@ -5,6 +5,7 @@ using SharedLibraryCore; using SharedLibraryCore.Dtos; using SharedLibraryCore.Interfaces; using System.Linq; +using Data.Models; using Data.Models.Client.Stats; using IW4MAdmin.Plugins.Stats.Helpers; using WebfrontCore.ViewModels; @@ -34,6 +35,7 @@ namespace WebfrontCore.Controllers ID = s.EndPoint, Port = s.Port, Map = s.CurrentMap.Alias, + Game = (Reference.Game)s.GameName, ClientCount = s.Clients.Count(client => client != null), MaxClients = s.MaxClients, GameType = s.GametypeName, diff --git a/WebfrontCore/ViewComponents/ServerListViewComponent.cs b/WebfrontCore/ViewComponents/ServerListViewComponent.cs index 0fad09f33..c9e5e30a9 100644 --- a/WebfrontCore/ViewComponents/ServerListViewComponent.cs +++ b/WebfrontCore/ViewComponents/ServerListViewComponent.cs @@ -4,11 +4,9 @@ using Microsoft.AspNetCore.Mvc; using SharedLibraryCore; using SharedLibraryCore.Dtos; using System.Linq; -using System.Net; using System.Threading; -using System.Threading.Tasks; +using Data.Models; using Data.Models.Client.Stats; -using Microsoft.AspNetCore.Hosting.Server; using SharedLibraryCore.Configuration; using SharedLibraryCore.Interfaces; using static SharedLibraryCore.Server; @@ -72,6 +70,7 @@ namespace WebfrontCore.ViewComponents ID = server.EndPoint, Port = server.Port, Map = server.CurrentMap.Alias, + Game = (Reference.Game)server.GameName, ClientCount = server.Clients.Count(client => client != null), MaxClients = server.MaxClients, GameType = server.GametypeName, diff --git a/WebfrontCore/Views/Server/_Server.cshtml b/WebfrontCore/Views/Server/_Server.cshtml index dffa61f18..1675b10ff 100644 --- a/WebfrontCore/Views/Server/_Server.cshtml +++ b/WebfrontCore/Views/Server/_Server.cshtml @@ -15,7 +15,9 @@ foreach (var snapshot in Model.ClientHistory.ClientCounts) { snapshot.MapAlias = GetMapName(snapshot.Map); - } + }; + + string MakeAbbreviation(string gameName) => string.Join("", gameName.Split(' ').Select(word => char.ToUpper(word.First())).ToArray()); }
@@ -42,6 +44,7 @@ class="text-light align-self-center"> + @MakeAbbreviation(ViewBag.Localization[$"GAME_{Model.Game}"])
@@ -52,6 +55,7 @@ @Model.GameType } +