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

Move T6 parser to javascript parser

This commit is contained in:
RaidMax
2019-02-03 20:47:05 -06:00
parent 6b051f2252
commit 54147e274b
17 changed files with 97 additions and 192 deletions

View File

@ -28,7 +28,6 @@ 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

@ -13,6 +13,7 @@ namespace SharedLibraryCore.Configuration
public IList<string> AutoMessages { get; set; }
public bool UseT6MParser { get; set; }
public string ManualLogPath { get; set; }
public string CustomParserVersion { get; set; }
public int ReservedSlotNumber { get; set; }
public IBaseConfiguration Generate()

View File

@ -20,5 +20,10 @@ namespace SharedLibraryCore.Interfaces
/// stores the regex info for parsing get DVAR responses
/// </summary>
ParserRegex Dvar { get; set; }
/// <summary>
/// indicates if the application should wait for response from server
/// when executing a command
/// </summary>
bool WaitForResponse { get; set; }
}
}

View File

@ -434,7 +434,7 @@ 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 &&
if (CurrentServer.MaxClients - (CurrentServer.GetClientsAsList().Count(_client => !_client.IsPrivileged() && !_client.IsBot)) < CurrentServer.ServerConfig.ReservedSlotNumber &&
!this.IsPrivileged() &&
CurrentServer.GetClientsAsList().Count <= CurrentServer.MaxClients &&
CurrentServer.MaxClients != 0)

View File

@ -13,7 +13,9 @@ namespace SharedLibraryCore.RCon
public string Ban { get; set; }
public string Unban { get; set; }
public string TempBan { get; set; }
public string RConQuery { get; set; }
public string RConCommand { get; set; }
public string RConGetDvar { get; set; }
public string RConSetDvar { get; set; }
public string RConGetStatus { get; set; }
public string RConGetInfo { get; set; }
public string RConResponse { get; set; }

View File

@ -45,7 +45,7 @@ namespace SharedLibraryCore.RCon
Config = config;
}
public async Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "", bool waitForResponse = true)
public async Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "")
{
if (!ActiveQueries.ContainsKey(this.Endpoint))
{
@ -75,18 +75,26 @@ namespace SharedLibraryCore.RCon
#endif
byte[] payload = null;
bool waitForResponse = Config.WaitForResponse;
switch (type)
{
case StaticHelpers.QueryType.DVAR:
case StaticHelpers.QueryType.GET_DVAR:
waitForResponse |= true;
payload = (string.Format(Config.CommandPrefixes.RConGetDvar, RConPassword, parameters + '\0')).Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.SET_DVAR:
payload = (string.Format(Config.CommandPrefixes.RConSetDvar, RConPassword, parameters + '\0')).Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.COMMAND:
payload = Utilities.EncodingType
.GetBytes(string.Format(Config.CommandPrefixes.RConQuery, RConPassword, parameters + '\0'));
payload = (string.Format(Config.CommandPrefixes.RConCommand, RConPassword, parameters + '\0')).Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.GET_STATUS:
waitForResponse |= true;
payload = (Config.CommandPrefixes.RConGetStatus + '\0').Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.GET_INFO:
waitForResponse |= true;
payload = (Config.CommandPrefixes.RConGetInfo + '\0').Select(Convert.ToByte).ToArray();
break;
}

View File

@ -24,7 +24,12 @@ namespace SharedLibraryCore.RCon
/// retrieve the value of a DVAR
/// RCon password is required
/// </summary>
DVAR,
GET_DVAR,
/// <summary>
/// set the value of a DVAR
/// RCon password is required
/// </summary>
SET_DVAR,
/// <summary>
/// execute a command
/// RCon password is required