make headshot match more flexible when looking for headshot count by hit location name

This commit is contained in:
RaidMax 2023-05-09 21:15:25 -05:00
parent 108aac83a5
commit e9c1d37cb5

View File

@ -16,7 +16,7 @@
ViewBag.Description = Model.ClientName.StripColors(); ViewBag.Description = Model.ClientName.StripColors();
const string headshotKey = "MOD_HEAD_SHOT"; const string headshotKey = "MOD_HEAD_SHOT";
const string headshotKey2 = "headshot"; const string headshotKey2 = "head";
const string meleeKey = "MOD_MELEE"; const string meleeKey = "MOD_MELEE";
var suicideKeys = new[] { "MOD_SUICIDE", "MOD_FALLING" }; var suicideKeys = new[] { "MOD_SUICIDE", "MOD_FALLING" };
@ -137,7 +137,7 @@
: null; : null;
var headShots = allPerServer.Any() var headShots = allPerServer.Any()
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || hit.HitLocation?.Name == headshotKey2).Sum(hit => hit.HitCount) ? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || (hit.HitLocation?.Name?.StartsWith(headshotKey2) ?? false)).Sum(hit => hit.HitCount)
: (int?)null; // want to default to -- in ui instead of 0 : (int?)null; // want to default to -- in ui instead of 0
var meleeKills = allPerServer.Any() var meleeKills = allPerServer.Any()