diff --git a/Plugins/Stats/Helpers/StatManager.cs b/Plugins/Stats/Helpers/StatManager.cs index 4f9a651e..b30eefc5 100644 --- a/Plugins/Stats/Helpers/StatManager.cs +++ b/Plugins/Stats/Helpers/StatManager.cs @@ -872,8 +872,12 @@ namespace IW4MAdmin.Plugins.Stats.Helpers victimStats.LastScore = 0; } - var estimatedAttackerScore = attacker.Score > 0 ? attacker.Score : attackerStats.SessionKills * 50; - var estimatedVictimScore = victim.Score > 0 ? victim.Score : victimStats.SessionKills * 50; + var estimatedAttackerScore = (int)attacker.CurrentServer.GameName != 10 + ? attacker.Score + : (attackerStats.SessionKills * 50) / (attacker.ConnectionLength / 60); + var estimatedVictimScore = (int)attacker.CurrentServer.GameName != 10 + ? victim.Score + : victimStats.SessionKills * 50 / (attacker.ConnectionLength / 60); attackerStats.SessionScore = estimatedAttackerScore; victimStats.SessionScore = estimatedVictimScore; diff --git a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs index 630f0da3..0f4d667b 100644 --- a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs +++ b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs @@ -146,6 +146,7 @@ namespace SharedLibraryCore.Configuration [UIHint("ServerConfiguration")] public ServerConfiguration[] Servers { get; set; } + [ConfigurationIgnore] public int MinimumNameLength { get; set; } = 3; [ConfigurationIgnore] public string Id { get; set; } [ConfigurationIgnore] public string SubscriptionId { get; set; } [ConfigurationIgnore] public MapConfiguration[] Maps { get; set; } diff --git a/SharedLibraryCore/Configuration/ServerConfiguration.cs b/SharedLibraryCore/Configuration/ServerConfiguration.cs index 65c2f4cc..90b4f395 100644 --- a/SharedLibraryCore/Configuration/ServerConfiguration.cs +++ b/SharedLibraryCore/Configuration/ServerConfiguration.cs @@ -65,7 +65,7 @@ namespace SharedLibraryCore.Configuration { RConParserVersion = rconParsers.FirstOrDefault(_parser => _parser.Name == selection.Item2)?.Version; - if (selection.Item1 > 0 && !rconParsers[selection.Item1 - 1].CanGenerateLogPath) + if (selection.Item1 > 0 && !rconParsers[selection.Item1].CanGenerateLogPath) { Console.WriteLine(loc["SETUP_SERVER_NO_LOG"]); ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_LOG_PATH"]); diff --git a/SharedLibraryCore/PartialEntities/EFClient.cs b/SharedLibraryCore/PartialEntities/EFClient.cs index cba16f07..9e3a1ba9 100644 --- a/SharedLibraryCore/PartialEntities/EFClient.cs +++ b/SharedLibraryCore/PartialEntities/EFClient.cs @@ -457,9 +457,10 @@ namespace SharedLibraryCore.Database.Models using (LogContext.PushProperty("Server", CurrentServer?.ToString())) { - if (string.IsNullOrWhiteSpace(Name) || CleanedName.Replace(" ", "").Length < 3) + if (string.IsNullOrWhiteSpace(Name) || CleanedName.Replace(" ", "").Length < + (CurrentServer?.Manager?.GetApplicationSettings()?.Configuration()?.MinimumNameLength ?? 3)) { - Utilities.DefaultLogger.LogInformation("Kicking {client} because their name is too short", ToString()); + Utilities.DefaultLogger.LogInformation("Kicking {Client} because their name is too short", ToString()); Kick(loc["SERVER_KICK_MINNAME"], Utilities.IW4MAdminClient(CurrentServer)); return false; } @@ -468,14 +469,14 @@ namespace SharedLibraryCore.Database.Models .DisallowedClientNames ?.Any(_name => Regex.IsMatch(Name, _name)) ?? false) { - Utilities.DefaultLogger.LogInformation("Kicking {client} because their name is not allowed", ToString()); + Utilities.DefaultLogger.LogInformation("Kicking {Client} because their name is not allowed", ToString()); Kick(loc["SERVER_KICK_GENERICNAME"], Utilities.IW4MAdminClient(CurrentServer)); return false; } if (Name.Where(c => char.IsControl(c)).Count() > 0) { - Utilities.DefaultLogger.LogInformation("Kicking {client} because their name contains control characters", ToString()); + Utilities.DefaultLogger.LogInformation("Kicking {Client} because their name contains control characters", ToString()); Kick(loc["SERVER_KICK_CONTROLCHARS"], Utilities.IW4MAdminClient(CurrentServer)); return false; } @@ -487,7 +488,7 @@ namespace SharedLibraryCore.Database.Models CurrentServer.GetClientsAsList().Count <= CurrentServer.MaxClients && CurrentServer.MaxClients != 0) { - Utilities.DefaultLogger.LogInformation("Kicking {client} their spot is reserved", ToString()); + Utilities.DefaultLogger.LogInformation("Kicking {Client} their spot is reserved", ToString()); Kick(loc["SERVER_KICK_SLOT_IS_RESERVED"], Utilities.IW4MAdminClient(CurrentServer)); return false; }