add official T4/WaW support for issue #178

CoD4x parser tweak to parse full guid as decimal
This commit is contained in:
RaidMax 2020-12-13 20:33:37 -06:00
parent f03626c3ae
commit 02b910234a
7 changed files with 54 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -235,7 +235,7 @@ namespace SharedLibraryCore
/// <summary>
/// Specifies the game time offset as printed in the log
/// </summary>
public int? GameTime { get; set; }
public long? GameTime { get; set; }
public EFClient Origin;
public EFClient Target;
public EFClient ImpersonationOrigin { get; set; }

View File

@ -366,7 +366,8 @@ namespace SharedLibraryCore
/// <returns>true if is bot guid, otherwise false</returns>
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";
}
/// <summary>