diff --git a/Application/EventParsers/BaseEventParser.cs b/Application/EventParsers/BaseEventParser.cs index 9c2e9b97a..a271f858c 100644 --- a/Application/EventParsers/BaseEventParser.cs +++ b/Application/EventParsers/BaseEventParser.cs @@ -97,7 +97,8 @@ namespace IW4MAdmin.Application.EventParsers {Configuration.Say, GameEvent.EventType.Say}, {Configuration.Kill, GameEvent.EventType.Kill}, {Configuration.MapChange, GameEvent.EventType.MapChange}, - {Configuration.MapEnd, GameEvent.EventType.MapEnd} + {Configuration.MapEnd, GameEvent.EventType.MapEnd}, + {Configuration.JoinTeam, GameEvent.EventType.JoinTeam} }; _eventTypeMap = new Dictionary @@ -107,8 +108,8 @@ namespace IW4MAdmin.Application.EventParsers {"K", GameEvent.EventType.Kill}, {"D", GameEvent.EventType.Damage}, {"J", GameEvent.EventType.PreConnect}, - {"JT", GameEvent.EventType.JoinTeam }, - {"Q", GameEvent.EventType.PreDisconnect}, + {"JT", GameEvent.EventType.JoinTeam}, + {"Q", GameEvent.EventType.PreDisconnect} }; } @@ -340,6 +341,11 @@ namespace IW4MAdmin.Application.EventParsers var originName = match.Values[Configuration.JoinTeam.GroupMapping[ParserRegex.GroupType.OriginName]]; var team = match.Values[Configuration.JoinTeam.GroupMapping[ParserRegex.GroupType.OriginTeam]]; + if (Configuration.TeamMapping.ContainsKey(team)) + { + team = Configuration.TeamMapping[team].ToString(); + } + var networkId = originIdString.IsBotGuid() ? originName.GenerateGuidFromString() : originIdString.ConvertGuidToLong(Configuration.GuidNumberStyle); diff --git a/Application/EventParsers/DynamicEventParserConfiguration.cs b/Application/EventParsers/DynamicEventParserConfiguration.cs index d3815c429..55d1455b2 100644 --- a/Application/EventParsers/DynamicEventParserConfiguration.cs +++ b/Application/EventParsers/DynamicEventParserConfiguration.cs @@ -1,6 +1,8 @@ -using SharedLibraryCore.Interfaces; +using System.Collections.Generic; +using SharedLibraryCore.Interfaces; using System.Globalization; using SharedLibraryCore; +using SharedLibraryCore.Database.Models; namespace IW4MAdmin.Application.EventParsers { @@ -23,6 +25,8 @@ namespace IW4MAdmin.Application.EventParsers public ParserRegex MapEnd { get; set; } public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber; + public Dictionary TeamMapping { get; set; } = new(); + public DynamicEventParserConfiguration(IParserRegexFactory parserRegexFactory) { Say = parserRegexFactory.CreateParserRegex(); diff --git a/Plugins/ScriptPlugins/ParserCSGO.js b/Plugins/ScriptPlugins/ParserCSGO.js index 8bba01775..eb63d824a 100644 --- a/Plugins/ScriptPlugins/ParserCSGO.js +++ b/Plugins/ScriptPlugins/ParserCSGO.js @@ -3,7 +3,7 @@ let eventParser; const plugin = { author: 'RaidMax', - version: 0.4, + version: 0.5, name: 'CS:GO Parser', engine: 'Source', isParser: true, @@ -105,6 +105,17 @@ const plugin = { eventParser.Configuration.Kill.AddMapping(8, 8); eventParser.Configuration.Kill.AddMapping(9, 9); eventParser.Configuration.Kill.AddMapping(12, 10); + + eventParser.Configuration.MapEnd.Pattern = '^World triggered "Match_Start" on "(.+)"$'; + + eventParser.Configuration.JoinTeam.Pattern = '^"(.+)<(\\d+)><(.*)>" switched from team <(.+)> to <(.+)>$'; + eventParser.Configuration.JoinTeam.AddMapping(5, 1); + eventParser.Configuration.JoinTeam.AddMapping(3, 2); + eventParser.Configuration.JoinTeam.AddMapping(1, 3); + eventParser.Configuration.JoinTeam.AddMapping(7, 5); + + eventParser.Configuration.TeamMapping.Add('CT', 2); + eventParser.Configuration.TeamMapping.Add('TERRORIST', 3); eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:'; @@ -120,4 +131,4 @@ const plugin = { onTickAsync: function (server) { } -}; \ No newline at end of file +}; diff --git a/Plugins/ScriptPlugins/ParserCSGOSM.js b/Plugins/ScriptPlugins/ParserCSGOSM.js index 7600a8aa1..950d07b72 100644 --- a/Plugins/ScriptPlugins/ParserCSGOSM.js +++ b/Plugins/ScriptPlugins/ParserCSGOSM.js @@ -3,7 +3,7 @@ let eventParser; const plugin = { author: 'RaidMax', - version: 0.5, + version: 0.6, name: 'CS:GO (SourceMod) Parser', engine: 'Source', isParser: true, @@ -105,7 +105,18 @@ const plugin = { eventParser.Configuration.Kill.AddMapping(8, 8); eventParser.Configuration.Kill.AddMapping(9, 9); eventParser.Configuration.Kill.AddMapping(12, 10); + + eventParser.Configuration.MapEnd.Pattern = '^World triggered "Match_Start" on "(.+)"$'; + eventParser.Configuration.JoinTeam.Pattern = '^"(.+)<(\\d+)><(.*)>" switched from team <(.+)> to <(.+)>$'; + eventParser.Configuration.JoinTeam.AddMapping(5, 1); + eventParser.Configuration.JoinTeam.AddMapping(3, 2); + eventParser.Configuration.JoinTeam.AddMapping(1, 3); + eventParser.Configuration.JoinTeam.AddMapping(7, 5); + + eventParser.Configuration.TeamMapping.Add('CT', 2); + eventParser.Configuration.TeamMapping.Add('TERRORIST', 3); + eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:'; rconParser.Version = 'CSGOSM'; @@ -120,4 +131,4 @@ const plugin = { onTickAsync: function (server) { } -}; \ No newline at end of file +}; diff --git a/SharedLibraryCore/Interfaces/IEventParserConfiguration.cs b/SharedLibraryCore/Interfaces/IEventParserConfiguration.cs index c08b58351..cdf3889da 100644 --- a/SharedLibraryCore/Interfaces/IEventParserConfiguration.cs +++ b/SharedLibraryCore/Interfaces/IEventParserConfiguration.cs @@ -1,4 +1,6 @@ -using System.Globalization; +using System.Collections.Generic; +using System.Globalization; +using SharedLibraryCore.Database.Models; namespace SharedLibraryCore.Interfaces { @@ -63,5 +65,10 @@ namespace SharedLibraryCore.Interfaces /// indicates the format expected for parsed guids /// NumberStyles GuidNumberStyle { get; set; } + + /// + /// maps the team code name to a type type eg "CT" -> Allies + /// + Dictionary TeamMapping { get; } } }