detect headshots for CSGO on advanced stats
track say_team events for CSGO
This commit is contained in:
parent
31ee71260a
commit
5921098dce
@ -3,7 +3,7 @@ let eventParser;
|
||||
|
||||
const plugin = {
|
||||
author: 'RaidMax',
|
||||
version: 0.2,
|
||||
version: 0.3,
|
||||
name: 'CS:GO Parser',
|
||||
engine: 'Source',
|
||||
isParser: true,
|
||||
@ -66,14 +66,14 @@ const plugin = {
|
||||
rconParser.Configuration.CommandPrefixes.Say = 'say {0}';
|
||||
rconParser.Configuration.CommandPrefixes.Tell = 'say [{0}] {1}'; // no tell exists in vanilla
|
||||
|
||||
eventParser.Configuration.Say.Pattern = '^"(.+)<(\\d+)><(.+)><(.*?)>" say "(.*)"$';
|
||||
eventParser.Configuration.Say.Pattern = '^"(.+)<(\\d+)><(.+)><(.*?)>" (?:say|say_team) "(.*)"$';
|
||||
eventParser.Configuration.Say.AddMapping(5, 1);
|
||||
eventParser.Configuration.Say.AddMapping(3, 2);
|
||||
eventParser.Configuration.Say.AddMapping(1, 3);
|
||||
eventParser.Configuration.Say.AddMapping(7, 4);
|
||||
eventParser.Configuration.Say.AddMapping(13, 5);
|
||||
|
||||
eventParser.Configuration.Kill.Pattern = '"(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] killed "(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] with "(\\S*)"(.*)$';
|
||||
eventParser.Configuration.Kill.Pattern = '^"(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] killed "(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] with "(\\S*)" *(?:\\((\\w+)((?: ).+)?\\))?$';
|
||||
eventParser.Configuration.Kill.AddMapping(5, 1);
|
||||
eventParser.Configuration.Kill.AddMapping(3, 2);
|
||||
eventParser.Configuration.Kill.AddMapping(1, 3);
|
||||
@ -83,6 +83,7 @@ const plugin = {
|
||||
eventParser.Configuration.Kill.AddMapping(2, 7);
|
||||
eventParser.Configuration.Kill.AddMapping(8, 8);
|
||||
eventParser.Configuration.Kill.AddMapping(9, 9);
|
||||
eventParser.Configuration.Kill.AddMapping(11, 11);
|
||||
|
||||
eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:';
|
||||
|
||||
|
@ -3,7 +3,7 @@ let eventParser;
|
||||
|
||||
const plugin = {
|
||||
author: 'RaidMax',
|
||||
version: 0.2,
|
||||
version: 0.3,
|
||||
name: 'CS:GO (SourceMod) Parser',
|
||||
engine: 'Source',
|
||||
isParser: true,
|
||||
@ -66,14 +66,14 @@ const plugin = {
|
||||
rconParser.Configuration.CommandPrefixes.Say = 'sm_say {0}';
|
||||
rconParser.Configuration.CommandPrefixes.Tell = 'sm_psay #{0} "{1}"';
|
||||
|
||||
eventParser.Configuration.Say.Pattern = '^"(.+)<(\\d+)><(.+)><(.*?)>" say "(.*)"$';
|
||||
eventParser.Configuration.Say.Pattern = '^"(.+)<(\\d+)><(.+)><(.*?)>" (?:say|say_team) "(.*)"$';
|
||||
eventParser.Configuration.Say.AddMapping(5, 1);
|
||||
eventParser.Configuration.Say.AddMapping(3, 2);
|
||||
eventParser.Configuration.Say.AddMapping(1, 3);
|
||||
eventParser.Configuration.Say.AddMapping(7, 4);
|
||||
eventParser.Configuration.Say.AddMapping(13, 5);
|
||||
|
||||
eventParser.Configuration.Kill.Pattern = '"(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] killed "(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] with "(\\S*)"(.*)$';
|
||||
eventParser.Configuration.Kill.Pattern = '^"(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] killed "(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] with "(\\S*)" *(?:\\((\\w+)((?: ).+)?\\))?$';
|
||||
eventParser.Configuration.Kill.AddMapping(5, 1);
|
||||
eventParser.Configuration.Kill.AddMapping(3, 2);
|
||||
eventParser.Configuration.Kill.AddMapping(1, 3);
|
||||
@ -83,6 +83,7 @@ const plugin = {
|
||||
eventParser.Configuration.Kill.AddMapping(2, 7);
|
||||
eventParser.Configuration.Kill.AddMapping(8, 8);
|
||||
eventParser.Configuration.Kill.AddMapping(9, 9);
|
||||
eventParser.Configuration.Kill.AddMapping(11, 11);
|
||||
|
||||
eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:';
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
using IW4MAdmin.Plugins.Stats.Client.Game;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace Stats.Client.Abstractions
|
||||
{
|
||||
public interface IHitInfoBuilder
|
||||
{
|
||||
HitInfo Build(string[] log, int entityId, bool isSelf, bool isVictim, Server.Game gameName);
|
||||
HitInfo Build(string[] log, ParserRegex parserRegex, int entityId, bool isSelf, bool isVictim, Server.Game gameName);
|
||||
}
|
||||
}
|
@ -170,9 +170,9 @@ namespace IW4MAdmin.Plugins.Stats.Client
|
||||
return;
|
||||
}
|
||||
|
||||
var attackerHitInfo = _hitInfoBuilder.Build(match.Values.Skip(1).ToArray(), gameEvent.Origin.ClientId,
|
||||
var attackerHitInfo = _hitInfoBuilder.Build(match.Values.ToArray(), eventRegex, gameEvent.Origin.ClientId,
|
||||
gameEvent.Origin.ClientId == gameEvent.Target.ClientId, false, gameEvent.Owner.GameName);
|
||||
var victimHitInfo = _hitInfoBuilder.Build(match.Values.Skip(1).ToArray(), gameEvent.Target.ClientId,
|
||||
var victimHitInfo = _hitInfoBuilder.Build(match.Values.ToArray(), eventRegex, gameEvent.Target.ClientId,
|
||||
gameEvent.Origin.ClientId == gameEvent.Target.ClientId, true, gameEvent.Owner.GameName);
|
||||
|
||||
foreach (var hitInfo in new[] {attackerHitInfo, victimHitInfo})
|
||||
@ -241,8 +241,6 @@ namespace IW4MAdmin.Plugins.Stats.Client
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<IEnumerable<EFClientHitStatistic>> RunTasksForHitInfo(HitInfo hitInfo, long? serverId)
|
||||
{
|
||||
var weapon = await GetOrAddWeapon(hitInfo.Weapon, hitInfo.Game);
|
||||
|
@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using Stats.Client.Abstractions;
|
||||
using Stats.Client.Game;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
|
||||
namespace Stats.Client
|
||||
@ -22,7 +23,8 @@ namespace Stats.Client
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public HitInfo Build(string[] log, int entityId, bool isSelf, bool isVictim, Server.Game gameName)
|
||||
public HitInfo Build(string[] log, ParserRegex parserRegex, int entityId, bool isSelf, bool isVictim,
|
||||
Server.Game gameName)
|
||||
{
|
||||
var eventType = log[(uint) ParserRegex.GroupType.EventType].First();
|
||||
HitType hitType;
|
||||
@ -51,21 +53,21 @@ namespace Stats.Client
|
||||
IsVictim = isVictim,
|
||||
HitType = hitType,
|
||||
Damage = Math.Min(MaximumDamage,
|
||||
log.Length > (uint) ParserRegex.GroupType.Damage
|
||||
? int.Parse(log[(uint) ParserRegex.GroupType.Damage])
|
||||
log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.Damage]
|
||||
? int.Parse(log[parserRegex.GroupMapping[ParserRegex.GroupType.Damage]])
|
||||
: 0),
|
||||
Location = log.Length > (uint) ParserRegex.GroupType.HitLocation
|
||||
? log[(uint) ParserRegex.GroupType.HitLocation]
|
||||
Location = log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.HitLocation]
|
||||
? log[parserRegex.GroupMapping[ParserRegex.GroupType.HitLocation]]
|
||||
: "Unknown",
|
||||
Weapon = log.Length == 10 ? _weaponNameParser.Parse(log[8], gameName)
|
||||
: _weaponNameParser.Parse(log[(uint) ParserRegex.GroupType.Weapon], gameName),
|
||||
MeansOfDeath = log.Length > (uint) ParserRegex.GroupType.MeansOfDeath
|
||||
? log[(uint) ParserRegex.GroupType.MeansOfDeath]
|
||||
Weapon = log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.Weapon]
|
||||
? _weaponNameParser.Parse(log[parserRegex.GroupMapping[ParserRegex.GroupType.Weapon]], gameName)
|
||||
: new WeaponInfo {Name = "Unknown"},
|
||||
MeansOfDeath = log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.MeansOfDeath]
|
||||
? log[parserRegex.GroupMapping[ParserRegex.GroupType.MeansOfDeath]]
|
||||
: "Unknown",
|
||||
Game = (Reference.Game) gameName
|
||||
};
|
||||
|
||||
//_logger.LogDebug("Generated new hitInfo {@hitInfo}", hitInfo);
|
||||
return hitInfo;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
const int maxItems = 5;
|
||||
const string headshotKey = "MOD_HEAD_SHOT";
|
||||
const string headshotKey2 = "headshot";
|
||||
const string meleeKey = "MOD_MELEE";
|
||||
|
||||
var suicideKeys = new[] {"MOD_SUICIDE", "MOD_FALLING"};
|
||||
@ -138,7 +139,7 @@
|
||||
: null;
|
||||
|
||||
var headShots = allPerServer.Any()
|
||||
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey).Sum(hit => hit.HitCount)
|
||||
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || hit.MeansOfDeath?.Name == headshotKey2).Sum(hit => hit.HitCount)
|
||||
: (int?) null; // want to default to -- in ui instead of 0
|
||||
|
||||
var meleeKills = allPerServer.Any()
|
||||
|
Loading…
Reference in New Issue
Block a user