fix issues with last release

This commit is contained in:
RaidMax 2021-07-12 14:57:44 -05:00
parent e2ea5c6ce0
commit 67c2406325
4 changed files with 22 additions and 7 deletions

View File

@ -259,7 +259,11 @@ namespace IW4MAdmin.Application
{ {
try try
{ {
await server.ProcessUpdatesAsync(_tokenSource.Token).WithWaitCancellation(runningUpdateTasks[server.EndPoint].tokenSource.Token); if (runningUpdateTasks.ContainsKey(server.EndPoint))
{
await server.ProcessUpdatesAsync(_tokenSource.Token)
.WithWaitCancellation(runningUpdateTasks[server.EndPoint].tokenSource.Token);
}
} }
catch (Exception e) catch (Exception e)

View File

@ -170,9 +170,9 @@ namespace IW4MAdmin.Plugins.Stats.Client
return; return;
} }
var attackerHitInfo = _hitInfoBuilder.Build(match.Values.Where(m => m.Length > 0).ToArray(), eventRegex, gameEvent.Origin.ClientId, var attackerHitInfo = _hitInfoBuilder.Build(match.Values.ToArray(), eventRegex, gameEvent.Origin.ClientId,
gameEvent.Origin.ClientId == gameEvent.Target.ClientId, false, gameEvent.Owner.GameName); gameEvent.Origin.ClientId == gameEvent.Target.ClientId, false, gameEvent.Owner.GameName);
var victimHitInfo = _hitInfoBuilder.Build(match.Values.Where(m => m.Length > 0).ToArray(), eventRegex, gameEvent.Target.ClientId, var victimHitInfo = _hitInfoBuilder.Build(match.Values.ToArray(), eventRegex, gameEvent.Target.ClientId,
gameEvent.Origin.ClientId == gameEvent.Target.ClientId, true, gameEvent.Owner.GameName); gameEvent.Origin.ClientId == gameEvent.Target.ClientId, true, gameEvent.Owner.GameName);
foreach (var hitInfo in new[] {attackerHitInfo, victimHitInfo}) foreach (var hitInfo in new[] {attackerHitInfo, victimHitInfo})

View File

@ -47,15 +47,25 @@ namespace Stats.Client
hitType = eventType == 'D' ? HitType.Damage : HitType.Kill; hitType = eventType == 'D' ? HitType.Damage : HitType.Kill;
} }
var damage = 0;
try
{
damage = Math.Min(MaximumDamage,
log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.Damage]
? int.Parse(log[parserRegex.GroupMapping[ParserRegex.GroupType.Damage]])
: 0);
}
catch
{
// ignored
}
var hitInfo = new HitInfo() var hitInfo = new HitInfo()
{ {
EntityId = entityId, EntityId = entityId,
IsVictim = isVictim, IsVictim = isVictim,
HitType = hitType, HitType = hitType,
Damage = Math.Min(MaximumDamage, Damage = damage,
log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.Damage]
? int.Parse(log[parserRegex.GroupMapping[ParserRegex.GroupType.Damage]])
: 0),
Location = log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.HitLocation] Location = log.Length > parserRegex.GroupMapping[ParserRegex.GroupType.HitLocation]
? log[parserRegex.GroupMapping[ParserRegex.GroupType.HitLocation]] ? log[parserRegex.GroupMapping[ParserRegex.GroupType.HitLocation]]
: "Unknown", : "Unknown",

View File

@ -113,6 +113,7 @@ namespace WebfrontCore
services.AddSingleton<IResourceQueryHelper<StatsInfoRequest, AdvancedStatsInfo>, AdvancedClientStatsResourceQueryHelper>(); services.AddSingleton<IResourceQueryHelper<StatsInfoRequest, AdvancedStatsInfo>, AdvancedClientStatsResourceQueryHelper>();
services.AddSingleton(typeof(IDataValueCache<,>), typeof(DataValueCache<,>)); services.AddSingleton(typeof(IDataValueCache<,>), typeof(DataValueCache<,>));
// todo: this needs to be handled more gracefully // todo: this needs to be handled more gracefully
services.AddSingleton(Program.ApplicationServiceProvider.GetRequiredService<DefaultSettings>());
services.AddSingleton(Program.ApplicationServiceProvider.GetRequiredService<ILoggerFactory>()); services.AddSingleton(Program.ApplicationServiceProvider.GetRequiredService<ILoggerFactory>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IConfigurationHandlerFactory>()); services.AddSingleton(Program.ApplicationServiceProvider.GetService<IConfigurationHandlerFactory>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IDatabaseContextFactory>()); services.AddSingleton(Program.ApplicationServiceProvider.GetService<IDatabaseContextFactory>());