From 6619ce714a0f49971503b5904bee64aac33bcbc2 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Thu, 12 Nov 2020 20:39:56 -0600 Subject: [PATCH] modify iw6x parser to default game log vars temporarily, small amount of code cleanup to git rid of warnings --- Application/RCon/RConConnection.cs | 12 +++++++++++- Plugins/ScriptPlugins/ParserIW6x.js | 4 +++- .../Web/StatsWeb/Controllers/StatsController.cs | 9 +++++---- .../Stats/Components/TopPlayers/_List.cshtml | 16 ++++++++++++++++ .../StatsWeb/Views/Stats/_MessageContext.cshtml | 2 +- .../ViewComponents/PenaltyListViewComponent.cs | 2 +- .../PenaltyInfoList.cshtml} | 0 7 files changed, 37 insertions(+), 8 deletions(-) rename WebfrontCore/Views/{Shared/Components/PenaltyList/_List.cshtml => Penalty/PenaltyInfoList.cshtml} (100%) diff --git a/Application/RCon/RConConnection.cs b/Application/RCon/RConConnection.cs index 2c81bab5f..6586cdef3 100644 --- a/Application/RCon/RConConnection.cs +++ b/Application/RCon/RConConnection.cs @@ -128,7 +128,17 @@ namespace IW4MAdmin.Application.RCon byte[][] response = null; - retrySend: + retrySend: + if (connectionState.ConnectionAttempts > 1) + { + using (LogContext.PushProperty("Server", Endpoint.ToString())) + { + _log.LogInformation( + "Retrying RCon message ({connectionAttempts}/{allowedConnectionFailures} attempts) with parameters {payload}", + connectionState.ConnectionAttempts, + StaticHelpers.AllowedConnectionFails, parameters); + } + } using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp) { DontFragment = true, diff --git a/Plugins/ScriptPlugins/ParserIW6x.js b/Plugins/ScriptPlugins/ParserIW6x.js index a9133446e..5f8ce15fb 100644 --- a/Plugins/ScriptPlugins/ParserIW6x.js +++ b/Plugins/ScriptPlugins/ParserIW6x.js @@ -3,7 +3,7 @@ var eventParser; var plugin = { author: 'Xerxes, RaidMax', - version: 0.1, + version: 0.2, name: 'IW6x Parser', isParser: true, @@ -27,6 +27,8 @@ var plugin = { rconParser.Configuration.Status.AddMapping(102, 4); rconParser.Configuration.Status.AddMapping(103, 5); rconParser.Configuration.Status.AddMapping(104, 6); + rconParser.Configuration.DefaultDvarValues.Add('g_log', 'games_mp.log'); // todo: remove this once proper log support is implemented + rconParser.Configuration.DefaultDvarValues.Add('g_logsync', '1'); // todo: remove this once proper log support is implemented rconParser.Version = 'IW6 MP 3.15 build 2 Sat Sep 14 2013 03:58:30PM win64'; rconParser.GameName = 4; // IW6 diff --git a/Plugins/Web/StatsWeb/Controllers/StatsController.cs b/Plugins/Web/StatsWeb/Controllers/StatsController.cs index 1fa81696a..1fc704a58 100644 --- a/Plugins/Web/StatsWeb/Controllers/StatsController.cs +++ b/Plugins/Web/StatsWeb/Controllers/StatsController.cs @@ -10,6 +10,7 @@ using SharedLibraryCore.Interfaces; using Stats.Dtos; using StatsWeb.Extensions; using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -88,7 +89,7 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers SentAfter = whenLower }); - return View("_MessageContext", messages.Results); + return View("_MessageContext", messages.Results.ToList()); } [HttpGet("Message/Find")] @@ -187,13 +188,13 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers // we want to show anything related to the automated offense else { - return View("_MessageContext", new[] + return View("_MessageContext", new List { - new ChatInfo() + new MessageResponse() { ClientId = penalty.OffenderId, Message = penalty.AutomatedOffense, - Time = penalty.When + When = penalty.When } }); } diff --git a/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml b/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml index ebb5bb3f1..b747b6fcc 100644 --- a/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml +++ b/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml @@ -6,21 +6,37 @@ string rankIcon(double elo) { if (elo >= getDeviation(-0.75) && elo < getDeviation(1.25)) + { return "0_no-place/menu_div_no_place.png"; + } if (elo >= getDeviation(0.125) && elo < getDeviation(0.625)) + { return "1_iron/menu_div_iron_sub03.png"; + } if (elo >= getDeviation(0.625) && elo < getDeviation(1.0)) + { return "2_bronze/menu_div_bronze_sub03.png"; + } if (elo >= getDeviation(1.0) && elo < getDeviation(1.25)) + { return "3_silver/menu_div_silver_sub03.png"; + } if (elo >= getDeviation(1.25) && elo < getDeviation(1.5)) + { return "4_gold/menu_div_gold_sub03.png"; + } if (elo >= getDeviation(1.5) && elo < getDeviation(1.75)) + { return "5_platinum/menu_div_platinum_sub03.png"; + } if (elo >= getDeviation(1.75) && elo < getDeviation(2.0)) + { return "6_semipro/menu_div_semipro_sub03.png"; + } if (elo >= getDeviation(2.0)) + { return "7_pro/menu_div_pro_sub03.png"; + } return "0_no-place/menu_div_no_place.png"; } diff --git a/Plugins/Web/StatsWeb/Views/Stats/_MessageContext.cshtml b/Plugins/Web/StatsWeb/Views/Stats/_MessageContext.cshtml index 602d21b53..c9adc1910 100644 --- a/Plugins/Web/StatsWeb/Views/Stats/_MessageContext.cshtml +++ b/Plugins/Web/StatsWeb/Views/Stats/_MessageContext.cshtml @@ -1,5 +1,5 @@ @using SharedLibraryCore.Dtos.Meta.Responses -@model IEnumerable +@model IList @{ Layout = null; } diff --git a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs index 930748573..ccb1ceae0 100644 --- a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs +++ b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs @@ -14,7 +14,7 @@ namespace WebfrontCore.ViewComponents var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(PENALTY_COUNT, offset, showOnly, ignoreAutomated); penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList(); - return View("_List", penalties); + return View("~/Views/Penalty/PenaltyInfoList.cshtml", penalties); } } } diff --git a/WebfrontCore/Views/Shared/Components/PenaltyList/_List.cshtml b/WebfrontCore/Views/Penalty/PenaltyInfoList.cshtml similarity index 100% rename from WebfrontCore/Views/Shared/Components/PenaltyList/_List.cshtml rename to WebfrontCore/Views/Penalty/PenaltyInfoList.cshtml