From c0879267c8df0da6de4806012b2cdfded164ea79 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Tue, 7 Jun 2022 21:58:32 -0500 Subject: [PATCH] add game to player profile and admins page --- SharedLibraryCore/Dtos/ClientInfo.cs | 2 ++ SharedLibraryCore/Dtos/PlayerInfo.cs | 1 + SharedLibraryCore/Services/ClientService.cs | 4 +++- WebfrontCore/Controllers/Client/ClientController.cs | 4 +++- WebfrontCore/Views/Client/Privileged/Index.cshtml | 6 +++++- WebfrontCore/Views/Client/Profile/Index.cshtml | 7 ++++--- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/SharedLibraryCore/Dtos/ClientInfo.cs b/SharedLibraryCore/Dtos/ClientInfo.cs index b252899a..75df7eb9 100644 --- a/SharedLibraryCore/Dtos/ClientInfo.cs +++ b/SharedLibraryCore/Dtos/ClientInfo.cs @@ -1,4 +1,5 @@ using System; +using Data.Models; using Data.Models.Client; namespace SharedLibraryCore.Dtos @@ -10,6 +11,7 @@ namespace SharedLibraryCore.Dtos public int LinkId { get; set; } public EFClient.Permission Level { get; set; } public DateTime LastConnection { get; set; } + public Reference.Game Game { get; set; } public bool IsMasked { get; set; } } } diff --git a/SharedLibraryCore/Dtos/PlayerInfo.cs b/SharedLibraryCore/Dtos/PlayerInfo.cs index 7bc424d6..dfbd752f 100644 --- a/SharedLibraryCore/Dtos/PlayerInfo.cs +++ b/SharedLibraryCore/Dtos/PlayerInfo.cs @@ -9,6 +9,7 @@ namespace SharedLibraryCore.Dtos public class PlayerInfo { public string Name { get; set; } + public Reference.Game Game { get; set; } public int ClientId { get; set; } public string Level { get; set; } public string Tag { get; set; } diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index 0f5d5ce9..83cca25a 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -178,6 +178,7 @@ namespace SharedLibraryCore.Services .Select(_client => new EFClient { ClientId = _client.ClientId, + GameName = _client.GameName, AliasLinkId = _client.AliasLinkId, Level = _client.Level, Connections = _client.Connections, @@ -789,7 +790,8 @@ namespace SharedLibraryCore.Services PasswordSalt = client.PasswordSalt, NetworkId = client.NetworkId, LastConnection = client.LastConnection, - Masked = client.Masked + Masked = client.Masked, + GameName = client.GameName }; return await iqClients.ToListAsync(); diff --git a/WebfrontCore/Controllers/Client/ClientController.cs b/WebfrontCore/Controllers/Client/ClientController.cs index 43f5f4f5..9164c10f 100644 --- a/WebfrontCore/Controllers/Client/ClientController.cs +++ b/WebfrontCore/Controllers/Client/ClientController.cs @@ -88,6 +88,7 @@ namespace WebfrontCore.Controllers var clientDto = new PlayerInfo { Name = client.Name, + Game = client.GameName ?? Reference.Game.UKN, Level = displayLevel, LevelInt = displayLevelInt, ClientId = client.ClientId, @@ -181,7 +182,8 @@ namespace WebfrontCore.Controllers Name = admin.Name, ClientId = admin.ClientId, LastConnection = admin.LastConnection, - IsMasked = admin.Masked + IsMasked = admin.Masked, + Game = admin.GameName ?? Reference.Game.UKN }); } diff --git a/WebfrontCore/Views/Client/Privileged/Index.cshtml b/WebfrontCore/Views/Client/Privileged/Index.cshtml index b493c549..d8f5e950 100644 --- a/WebfrontCore/Views/Client/Privileged/Index.cshtml +++ b/WebfrontCore/Views/Client/Privileged/Index.cshtml @@ -5,10 +5,11 @@ @foreach (var key in Model.Keys) { - +
+ @@ -33,6 +34,9 @@ + diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 6ca15770..842bdf7a 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -58,7 +58,8 @@ } -

Player Profile

+

Player Profile

+
@ViewBag.Localization[$"GAME_{Model.Game}"]
@@ -200,7 +201,7 @@
- +

@@ -299,7 +300,7 @@ EntityId = Model.ClientId }); } - + if (Model.LevelInt < (int)ViewBag.User.Level && Model.Online) { menuItems.Items.Add(new SideContextMenuItem
@key.ToLocalizedLevelName()Game Last Connected
+
@ViewBag.Localization[$"GAME_{client.Game}"]
+
@client.LastConnection.HumanizeForCurrentCulture()