fix issue with selecting wrong parser during setup

add minimum name length option
fix issue with stats spm
This commit is contained in:
RaidMax 2021-06-27 20:31:39 -05:00
parent 9cbca390fe
commit 95cbc85144
4 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -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; }

View File

@ -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"]);

View File

@ -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;
}