From 8dca05a442e9ea0b59067d2876d2d318c671e318 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 17 Dec 2018 13:45:16 -0600 Subject: [PATCH] Small fixes --- Application/IW4MServer.cs | 2 +- Application/RconParsers/IW4RConParser.cs | 3 ++- Plugins/Stats/Helpers/StatManager.cs | 5 +++-- SharedLibraryCore/Commands/NativeCommands.cs | 2 +- SharedLibraryCore/Objects/EFClient.cs | 2 +- SharedLibraryCore/Server.cs | 2 +- SharedLibraryCore/Services/PenaltyService.cs | 5 ++--- .../ViewComponents/PenaltyListViewComponent.cs | 10 +++++++--- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index aa937e1ba..2874d2639 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -940,7 +940,7 @@ namespace IW4MAdmin await Manager.GetPenaltyService().Create(newPenalty); } - override protected async Task Ban(string reason, EFClient targetClient, EFClient originClient, bool isEvade) + override protected async Task Ban(string reason, EFClient targetClient, EFClient originClient, bool isEvade = false) { // ensure player gets banned if command not performed on them in game if (targetClient.ClientNumber < 0) diff --git a/Application/RconParsers/IW4RConParser.cs b/Application/RconParsers/IW4RConParser.cs index 0f325b786..95c0f8d81 100644 --- a/Application/RconParsers/IW4RConParser.cs +++ b/Application/RconParsers/IW4RConParser.cs @@ -124,13 +124,14 @@ namespace IW4MAdmin.Application.RconParsers IsBot = ip == null, State = EFClient.ClientState.Connecting }; - StatusPlayers.Add(client); // they've not fully connected yet if (!client.IsBot && ping == 999) { continue; } + + StatusPlayers.Add(client); } } diff --git a/Plugins/Stats/Helpers/StatManager.cs b/Plugins/Stats/Helpers/StatManager.cs index 2fade33f1..b72b80480 100644 --- a/Plugins/Stats/Helpers/StatManager.cs +++ b/Plugins/Stats/Helpers/StatManager.cs @@ -618,8 +618,9 @@ namespace IW4MAdmin.Plugins.Stats.Helpers } }, Level = EFClient.Permission.Console, - CurrentServer = attacker.CurrentServer - }); + CurrentServer = attacker.CurrentServer, + + }, false); if (clientDetection.Tracker.HasChanges) { SaveTrackedSnapshots(clientDetection, ctx); diff --git a/SharedLibraryCore/Commands/NativeCommands.cs b/SharedLibraryCore/Commands/NativeCommands.cs index 5ea733891..a49396cab 100644 --- a/SharedLibraryCore/Commands/NativeCommands.cs +++ b/SharedLibraryCore/Commands/NativeCommands.cs @@ -231,7 +231,7 @@ namespace SharedLibraryCore.Commands public override async Task ExecuteAsync(GameEvent E) { - var _ = !(await E.Target.Ban(E.Data, E.Origin).WaitAsync()).Failed ? + var _ = !(await E.Target.Ban(E.Data, E.Origin, false).WaitAsync()).Failed ? E.Origin.Tell($"^5{E.Target} ^7{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_BAN_SUCCESS"]}") : E.Origin.Tell($"{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_BAN_FAIL"]} {E.Target.Name}"); } diff --git a/SharedLibraryCore/Objects/EFClient.cs b/SharedLibraryCore/Objects/EFClient.cs index 5c0ac2af4..8b5377cb4 100644 --- a/SharedLibraryCore/Objects/EFClient.cs +++ b/SharedLibraryCore/Objects/EFClient.cs @@ -348,7 +348,7 @@ namespace SharedLibraryCore.Database.Models /// /// reason for the ban /// client performing the ban - public GameEvent Ban(String banReason, EFClient sender, bool isEvade = false) + public GameEvent Ban(String banReason, EFClient sender, bool isEvade) { var e = new GameEvent() { diff --git a/SharedLibraryCore/Server.cs b/SharedLibraryCore/Server.cs index 053f8a2e9..967ea57de 100644 --- a/SharedLibraryCore/Server.cs +++ b/SharedLibraryCore/Server.cs @@ -208,7 +208,7 @@ namespace SharedLibraryCore /// The reason for the ban /// The person to ban /// The person who banned the target - abstract protected Task Ban(String Reason, EFClient Target, EFClient Origin, bool isEvade); + abstract protected Task Ban(String Reason, EFClient Target, EFClient Origin, bool isEvade = false); abstract protected Task Warn(String Reason, EFClient Target, EFClient Origin); diff --git a/SharedLibraryCore/Services/PenaltyService.cs b/SharedLibraryCore/Services/PenaltyService.cs index b024b48a9..b8434b71e 100644 --- a/SharedLibraryCore/Services/PenaltyService.cs +++ b/SharedLibraryCore/Services/PenaltyService.cs @@ -66,7 +66,6 @@ namespace SharedLibraryCore.Services public async Task> Find(Func expression) { throw await Task.FromResult(new Exception()); - } public Task Get(int entityID) @@ -96,7 +95,7 @@ namespace SharedLibraryCore.Services .OrderByDescending(p => p.When) .Skip(offset) .Take(count) - .ToListAsync(); + .ToListAsync(); } } @@ -116,7 +115,7 @@ namespace SharedLibraryCore.Services /// /// Get a read-only copy of client penalties /// - /// + /// /// Retreive penalties for clients receiving penalties, other wise given /// public async Task> ReadGetClientPenaltiesAsync(int clientId, bool victim = true) diff --git a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs index 0cbec7422..e0e539cce 100644 --- a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs +++ b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using SharedLibraryCore; +using SharedLibraryCore.Database.Models; using SharedLibraryCore.Dtos; using SharedLibraryCore.Objects; using System; @@ -12,6 +13,9 @@ namespace WebfrontCore.ViewComponents { public async Task InvokeAsync(int offset, Penalty.PenaltyType showOnly) { + string showEvadeString(EFPenalty penalty) => penalty.IsEvadedOffense == true ? + $"({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]}) " : ""; + var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(12, offset, showOnly); var penaltiesDto = penalties.Select(p => new PenaltyInfo() { @@ -25,9 +29,9 @@ namespace WebfrontCore.ViewComponents #if DEBUG Offense = !string.IsNullOrEmpty(p.AutomatedOffense) ? p.AutomatedOffense : p.Offense, #else - Offense = User.Identity.IsAuthenticated && !string.IsNullOrEmpty(p.AutomatedOffense) ? (p.IsEvadedOffense ? - $"({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]}) " : "") + p.AutomatedOffense : - $"({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]}) " + p.Offense, + Offense = (User.Identity.IsAuthenticated && !string.IsNullOrEmpty(p.AutomatedOffense)) ? + $"{showEvadeString(p)}{p.AutomatedOffense}" : + $"{showEvadeString(p)}{p.Offense}", #endif Type = p.Type.ToString(), TimePunished = Utilities.GetTimePassed(p.When, false),