diff --git a/Application/EventParsers/BaseEventParser.cs b/Application/EventParsers/BaseEventParser.cs index 1d81f308..2bb40fbb 100644 --- a/Application/EventParsers/BaseEventParser.cs +++ b/Application/EventParsers/BaseEventParser.cs @@ -93,16 +93,25 @@ namespace IW4MAdmin.Application.EventParsers public virtual GameEvent GenerateGameEvent(string logLine) { var timeMatch = Configuration.Time.PatternMatcher.Match(logLine); - int gameTime = 0; + var gameTime = 0L; if (timeMatch.Success) { - gameTime = timeMatch - .Values - .Skip(2) - // this converts the timestamp into seconds passed - .Select((_value, index) => int.Parse(_value.ToString()) * (index == 0 ? 60 : 1)) - .Sum(); + if (timeMatch.Values[0].Contains(":")) + { + gameTime = timeMatch + .Values + .Skip(2) + // this converts the timestamp into seconds passed + .Select((_value, index) => long.Parse(_value.ToString()) * (index == 0 ? 60 : 1)) + .Sum(); + + } + else + { + gameTime = long.Parse(timeMatch.Values[0]); + } + // we want to strip the time from the log line logLine = logLine.Substring(timeMatch.Values.First().Length); } diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index 6b9b1224..17c9bd80 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -29,7 +29,7 @@ namespace IW4MAdmin private readonly ITranslationLookup _translationLookup; private readonly IMetaService _metaService; private const int REPORT_FLAG_COUNT = 4; - private int lastGameTime = 0; + private long lastGameTime = 0; public int Id { get; private set; } private readonly IServiceProvider _serviceProvider; diff --git a/IW4MAdmin.sln b/IW4MAdmin.sln index c2dfee15..1cc50347 100644 --- a/IW4MAdmin.sln +++ b/IW4MAdmin.sln @@ -44,6 +44,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug Plugins\ScriptPlugins\SampleScriptPluginCommand.js = Plugins\ScriptPlugins\SampleScriptPluginCommand.js Plugins\ScriptPlugins\SharedGUIDKick.js = Plugins\ScriptPlugins\SharedGUIDKick.js Plugins\ScriptPlugins\VPNDetection.js = Plugins\ScriptPlugins\VPNDetection.js + Plugins\ScriptPlugins\ParserT4.js = Plugins\ScriptPlugins\ParserT4.js EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{A848FCF1-8527-4AA8-A1AA-50D29695C678}" diff --git a/Plugins/ScriptPlugins/ParserCoD4x.js b/Plugins/ScriptPlugins/ParserCoD4x.js index ada571c6..3a735815 100644 --- a/Plugins/ScriptPlugins/ParserCoD4x.js +++ b/Plugins/ScriptPlugins/ParserCoD4x.js @@ -23,10 +23,13 @@ var plugin = { rconParser.Configuration.Dvar.Pattern = '^"(.+)" is: "(.+)?" default: "(.+)?" info: "(.+)?"$'; rconParser.Configuration.Dvar.AddMapping(109, 2); // DVAR latched value rconParser.Configuration.Dvar.AddMapping(110, 4); // dvar info + rconParser.Configuration.GuidNumberStyle = 7; // Integer + rconParser.Configuration.NoticeLineSeparator = '. '; // CoD4x does not support \n in the client notice rconParser.Version = 'CoD4 X - win_mingw-x86 build 963 Mar 12 2019'; rconParser.GameName = 1; // IW3 eventParser.Configuration.GameDirectory = 'main'; + eventParser.Configuration.GuidNumberStyle = 7; // Integer eventParser.Version = 'CoD4 X - win_mingw-x86 build 963 Mar 12 2019'; eventParser.GameName = 1; // IW3 eventParser.URLProtocolFormat = 'cod4://{{ip}}:{{port}}'; diff --git a/Plugins/ScriptPlugins/ParserT4.js b/Plugins/ScriptPlugins/ParserT4.js new file mode 100644 index 00000000..8186fc38 --- /dev/null +++ b/Plugins/ScriptPlugins/ParserT4.js @@ -0,0 +1,30 @@ +var rconParser; +var eventParser; + +var plugin = { + author: 'RaidMax', + version: 0.1, + name: 'Call of Duty 5: World at War Parser', + isParser: true, + + onEventAsync: function (gameEvent, server) { + }, + + onLoadAsync: function (manager) { + rconParser = manager.GenerateDynamicRConParser(this.name); + eventParser = manager.GenerateDynamicEventParser(this.name); + rconParser.Configuration.CommandPrefixes.RConResponse = '\xff\xff\xff\xffprint\n'; + rconParser.Configuration.GuidNumberStyle = 7; // Integer + rconParser.Version = "Call of Duty Multiplayer COD_WaW MP build 1.7.1263 CL(350073) JADAMS2 Thu Oct 29 15:43:55 2009 win-x86"; + + eventParser.Configuration.GuidNumberStyle = 7; // Integer + eventParser.GameName = 5; // T4 + eventParser.Version = "Call of Duty Multiplayer COD_WaW MP build 1.7.1263 CL(350073) JADAMS2 Thu Oct 29 15:43:55 2009 win-x86"; + }, + + onUnloadAsync: function () { + }, + + onTickAsync: function (server) { + } +}; diff --git a/SharedLibraryCore/Events/GameEvent.cs b/SharedLibraryCore/Events/GameEvent.cs index 293d4465..88db3035 100644 --- a/SharedLibraryCore/Events/GameEvent.cs +++ b/SharedLibraryCore/Events/GameEvent.cs @@ -235,7 +235,7 @@ namespace SharedLibraryCore /// /// Specifies the game time offset as printed in the log /// - public int? GameTime { get; set; } + public long? GameTime { get; set; } public EFClient Origin; public EFClient Target; public EFClient ImpersonationOrigin { get; set; } diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index ac8a91a6..f956268e 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -366,7 +366,8 @@ namespace SharedLibraryCore /// true if is bot guid, otherwise false public static bool IsBotGuid(this string guid) { - return guid.Contains("bot") || guid == "0"; + // todo: revisit this magic number for cod5 bot guid + return guid.Contains("bot") || guid == "0" || guid == "1075569476"; } ///