Skip to content

Commit

Permalink
prevent auto parsing of base gamescript and anticheat events to mitig…
Browse files Browse the repository at this point in the history
…ate unneeded processing time
  • Loading branch information
RaidMax committed Jul 13, 2024
1 parent 135fc98 commit a34ac7d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Application/EventParsers/BaseEventParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Linq;
using Data.Models;
using IW4MAdmin.Plugins.Stats.Events;
using Microsoft.Extensions.Logging;
using SharedLibraryCore.Events.Game;
using SharedLibraryCore.Interfaces.Events;
Expand Down Expand Up @@ -202,7 +203,17 @@ public virtual GameEvent GenerateGameEvent(string logLine)
var createdEvent = _gameScriptEventFactory.Create(split[0], logLine.Replace(split[0], ""));
if (createdEvent is not null)
{
createdEvent.ParseArguments();
var eventTypeName = createdEvent.GetType().Name;
var isParseIgnoredEvent = eventTypeName is nameof(GameScriptEvent) or nameof(AntiCheatDamageEvent);

// avoid parsing base script event (which has no viable properties)
// and anticheat events as they are manually mapped.
// for performance as dynamic "Invoke" is relatively costly due
if (isParseIgnoredEvent)
{
createdEvent.ParseArguments();
}

return createdEvent as GameEventV2;
}
}
Expand Down

0 comments on commit a34ac7d

Please sign in to comment.