1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

Finish preliminary parser for TeknoMW3

This commit is contained in:
RaidMax
2019-02-02 18:54:30 -06:00
parent 213ddf0a15
commit 67aa9953c0
12 changed files with 56 additions and 31 deletions

View File

@ -28,6 +28,7 @@ namespace SharedLibraryCore.Configuration
public string Id { get; set; }
public List<ServerConfiguration> Servers { get; set; }
public int AutoMessagePeriod { get; set; }
public string CustomParserVersion { get; set; }
public List<string> AutoMessages { get; set; }
public List<string> GlobalRules { get; set; }
public List<MapConfiguration> Maps { get; set; }

View File

@ -38,6 +38,22 @@ namespace SharedLibraryCore.Interfaces
public string Pattern { get; set; }
public Dictionary<GroupType, int> GroupMapping { get; private set; }
public void AddMapping(object mapKey, object mapValue)
{
if (int.TryParse(mapKey.ToString(), out int key) && int.TryParse(mapValue.ToString(), out int value))
{
if (GroupMapping.ContainsKey((GroupType)key))
{
GroupMapping[(GroupType)key] = value;
}
else
{
GroupMapping.Add((GroupType)key, value);
}
}
}
public ParserRegex()
{
GroupMapping = new Dictionary<GroupType, int>();

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IEventParser
{
@ -19,5 +15,6 @@ namespace SharedLibraryCore.Interfaces
/// </summary>
/// <returns>Game directory prefix</returns>
IEventParserConfiguration Configuration { get; set; }
string Version { get; set; }
}
}

View File

@ -14,5 +14,6 @@ namespace SharedLibraryCore.Interfaces
Task<string[]> ExecuteCommandAsync(Connection connection, string command);
Task<List<EFClient>> GetStatusAsync(Connection connection);
IRConParserConfiguration Configuration { get; set; }
string Version { get; set; }
}
}

View File

@ -435,7 +435,9 @@ namespace SharedLibraryCore.Database.Models
// reserved slots stuff
// todo: bots don't seem to honor party_maxplayers/sv_maxclients
if (CurrentServer.MaxClients - (CurrentServer.GetClientsAsList().Count(_client => !_client.IsPrivileged())) < CurrentServer.ServerConfig.ReservedSlotNumber &&
!this.IsPrivileged())
!this.IsPrivileged() &&
CurrentServer.GetClientsAsList().Count <= CurrentServer.MaxClients &&
CurrentServer.MaxClients != 0)
{
CurrentServer.Logger.WriteDebug($"Kicking {this} their spot is reserved");
Kick(loc["SERVER_KICK_SLOT_IS_RESERVED"], Utilities.IW4MAdminClient(CurrentServer));