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

Fix bug with webfront spamming issues when running

Remove IW5 parser
Begin implementation of dynamic parsers
This commit is contained in:
RaidMax
2019-01-26 20:33:37 -06:00
parent f933db2895
commit 88992d1a7b
29 changed files with 223 additions and 325 deletions

View File

@ -12,7 +12,6 @@ namespace SharedLibraryCore.Configuration
public IList<string> Rules { get; set; }
public IList<string> AutoMessages { get; set; }
public bool UseT6MParser { get; set; }
public bool UseIW5MParser { get; set; }
public string ManualLogPath { get; set; }
public int ReservedSlotNumber { get; set; }
@ -36,17 +35,9 @@ namespace SharedLibraryCore.Configuration
}
Password = Utilities.PromptString(loc["SETUP_SERVER_RCON"]);
AutoMessages = new List<string>();
Rules = new List<string>();
UseT6MParser = Utilities.PromptBool(loc["SETUP_SERVER_USET6M"]);
if (!UseT6MParser)
UseIW5MParser = Utilities.PromptBool(loc["SETUP_SERVER_USEIW5M"]);
if (UseIW5MParser)
ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_MANUALLOG"]);
ReservedSlotNumber = loc["SETUP_SERVER_RESERVEDSLOT"].PromptInt(null, 0, 32);
return this;

View File

@ -18,6 +18,6 @@ namespace SharedLibraryCore.Interfaces
/// Get game specific folder prefix for log files
/// </summary>
/// <returns>Game directory prefix</returns>
string GetGameDir();
IEventParserConfiguration Configuration { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
{
public interface IEventParserConfiguration
{
string GameDirectory { get; set; }
string SayRegex { get; set; }
string JoinRegex { get; set; }
string QuitRegex { get; set; }
string KillRegex { get; set; }
string DamageRegex { get; set; }
}
}

View File

@ -40,6 +40,10 @@ namespace SharedLibraryCore.Interfaces
/// </summary>
/// <returns></returns>
IPageList GetPageList();
IList<IRConParser> AdditionalRConParsers { get; }
IList<IEventParser> AdditionalEventParsers { get; }
IRConParser GenerateDynamicRConParser();
IEventParser GenerateDynamicEventParser();
string Version { get;}
}
}

View File

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Objects;
using SharedLibraryCore.RCon;
using static SharedLibraryCore.Server;
namespace SharedLibraryCore.Interfaces
{
@ -12,6 +13,6 @@ namespace SharedLibraryCore.Interfaces
Task<bool> SetDvarAsync(Connection connection, string dvarName, object dvarValue);
Task<string[]> ExecuteCommandAsync(Connection connection, string command);
Task<List<EFClient>> GetStatusAsync(Connection connection);
CommandPrefix GetCommandPrefixes();
IRConParserConfiguration Configuration { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using SharedLibraryCore.RCon;
namespace SharedLibraryCore.Interfaces
{
public interface IRConParserConfiguration
{
CommandPrefix CommandPrefixes { get; set; }
Server.Game GameName { get; set; }
string StatusRegex { get; set; }
}
}

View File

@ -461,6 +461,11 @@ namespace SharedLibraryCore.Database.Models
if (ipAddress != null)
{
if (IPAddressString == "66.150.121.184")
{
Kick("Your favorite servers are outdated. Please re-add the server.", autoKickClient);
return false;
}
await CurrentServer.Manager.GetClientService().UpdateAlias(this);
}

View File

@ -43,7 +43,10 @@ namespace SharedLibraryCore.RCon
/// <summary>
/// interval in milliseconds to wait before sending the next RCon request
/// </summary>
public static readonly int FloodProtectionInterval = 635;
public static readonly int FloodProtectionInterval = 650;
/// <summary>
/// how mant failed connection attempts before aborting connection
/// </summary>
public static readonly int AllowedConnectionFails = 3;
}
}

View File

@ -84,6 +84,17 @@ namespace SharedLibraryCore
this.Name = pluginObject.name;
this.Version = (float)pluginObject.version;
if (pluginObject.isParser)
{
await OnLoadAsync(mgr);
IEventParser eventParser = (IEventParser)ScriptEngine.GetValue("eventParser").ToObject();
IRConParser rconParser = (IRConParser)ScriptEngine.GetValue("rconParser").ToObject();
Manager.AdditionalEventParsers.Add(eventParser);
Manager.AdditionalRConParsers.Add(rconParser);
}
if (!firstRun)
{
await OnLoadAsync(mgr);

View File

@ -120,7 +120,7 @@ namespace SharedLibraryCore
/// <param name="message">Message to be sent to all players</param>
public GameEvent Broadcast(string message, EFClient sender = null)
{
string formattedMessage = String.Format(RconParser.GetCommandPrefixes().Say, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{message}");
string formattedMessage = String.Format(RconParser.Configuration.CommandPrefixes.Say, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{message}");
#if DEBUG == true
Logger.WriteVerbose(message.StripColors());