protected new void HandlePlayerKilled(object sender, PlayerKilledEventArgs e) { if (!IsMatchStarted || IsFreezetime || e.Victim == null) { return; } Weapon weapon = Weapon.WeaponList.FirstOrDefault(w => w.Element == e.Weapon.Weapon); if (weapon == null) { return; } Player killed = Demo.Players.FirstOrDefault(player => player.SteamId == e.Victim.SteamID); Player killer = null; KillEvent killEvent = new KillEvent(Parser.IngameTick, Parser.CurrentTime) { KillerSteamId = e.Killer?.SteamID ?? 0, KillerName = e.Killer?.Name ?? "World", KillerSide = e.Killer?.Team.ToSide() ?? Side.None, Weapon = weapon, KillerVelocityX = e.Killer?.Velocity.X ?? 0, KillerVelocityY = e.Killer?.Velocity.Y ?? 0, KillerVelocityZ = e.Killer?.Velocity.Z ?? 0, KilledSteamId = e.Victim.SteamID, KilledName = e.Victim.Name, KilledSide = e.Victim.Team.ToSide(), RoundNumber = CurrentRound.Number, IsKillerCrouching = e.Killer?.IsDucking ?? false, IsHeadshot = e.Headshot, Point = new KillHeatmapPoint { KillerX = e.Killer?.Position.X ?? 0, KillerY = e.Killer?.Position.Y ?? 0, VictimX = e.Victim.Position.X, VictimY = e.Victim.Position.Y } }; if (!killed.RoundsLifetime.ContainsKey(CurrentRound.Number)) { killed.RoundsLifetime[CurrentRound.Number] = ((Parser.IngameTick - CurrentRound.Tick) / Parser.TickRate); } else { killed.RoundsLifetime[CurrentRound.Number] += ((Parser.IngameTick - CurrentRound.Tick) / Parser.TickRate); } bool killerIsBot = e.Killer != null && e.Killer.SteamID == 0; bool victimIsBot = e.Victim.SteamID == 0; bool assisterIsBot = e.Assister != null && e.Assister.SteamID == 0; if (e.Killer != null) { killer = Demo.Players.FirstOrDefault(player => player.SteamId == e.Killer.SteamID); } if (killer != null) { if (e.Victim.SteamID != killer.SteamId) { if (!killer.RoundsMoneyEarned.ContainsKey(CurrentRound.Number)) { killer.RoundsMoneyEarned[CurrentRound.Number] = weapon.KillAward; } else { killer.RoundsMoneyEarned[CurrentRound.Number] += weapon.KillAward; } } else { // Player suicide, hack to detect pause forced during a match // Happended during the match SK vs VP on train during Atlanta 2017 // All players are killed and the game is paused (freeze time) if (++_suicideCount == 6) { BackupToLastRound(); } return; } killEvent.KillerIsControllingBot = e.Killer.SteamID != 0 && killer.IsControllingBot; ProcessTradeKill(killEvent); } if (killed != null) { // suicide, probably because he missed the jump from upper B on train :) if (e.Killer == null) { killed.SuicideCount++; } killEvent.KilledIsControllingBot = e.Victim.SteamID != 0 && killed.IsControllingBot; } // Human killed human if (!killerIsBot && !victimIsBot) { if (killer != null && killed != null) { killed.IsAlive = false; // TK if (e.Killer.Team == e.Victim.Team) { killer.Kills.Add(killEvent); killed.Deaths.Add(killEvent); } else { // Regular kill if (!killer.IsControllingBot) { killer.Kills.Add(killEvent); } if (!killed.IsControllingBot) { killed.Deaths.Add(killEvent); } } } } // Human killed a bot if (!killerIsBot && victimIsBot) { killer?.Kills.Add(killEvent); } // A bot killed a human if (killerIsBot && !victimIsBot) { // TK or not we add a death to the human killed?.Deaths.Add(killEvent); } // Add assist if there was one if (e.Assister != null && !assisterIsBot && e.Assister.Team != e.Victim.Team) { Player assister = Demo.Players.FirstOrDefault(player => player.SteamId == e.Assister.SteamID); if (assister != null) { killEvent.AssisterSteamId = e.Assister.SteamID; killEvent.AssisterName = e.Assister.Name; killEvent.AssisterIsControllingBot = e.Assister.SteamID != 0 && assister.IsControllingBot; assister.Assists.Add(killEvent); } } // If the killer isn't a bot we can update individual kill, open and entry kills if (e.Killer != null && e.Killer.Team != e.Victim.Team && killer != null && !killer.IsControllingBot) { if (!KillsThisRound.ContainsKey(e.Killer)) { KillsThisRound[e.Killer] = 0; } KillsThisRound[e.Killer]++; ProcessOpenAndEntryKills(killEvent); } ProcessClutches(); CurrentRound.Kills.Add(killEvent); Demo.Kills.Add(killEvent); if (AnalyzePlayersPosition) { PositionPoint positionPoint = new PositionPoint { X = e.Victim.Position.X, Y = e.Victim.Position.Y, PlayerSteamId = e.Killer?.SteamID ?? 0, PlayerName = e.Killer?.Name ?? string.Empty, Team = e.Killer?.Team.ToSide() ?? Side.None, Event = killEvent, RoundNumber = CurrentRound.Number }; Demo.PositionPoints.Add(positionPoint); } }
protected new void HandlePlayerKilled(object sender, PlayerKilledEventArgs e) { if (!IsMatchStarted || e.Victim == null) { return; } Weapon weapon = Weapon.WeaponList.FirstOrDefault(w => w.Element == e.Weapon.Weapon); if (weapon == null) { return; } Player killed = Demo.Players.FirstOrDefault(player => player.SteamId == e.Victim.SteamID); Player killer = null; KillEvent killEvent = new KillEvent(Parser.IngameTick, Parser.CurrentTime) { KillerSteamId = e.Killer?.SteamID ?? 0, KillerName = e.Killer?.Name ?? "World", KillerSide = e.Killer?.Team.ToSide() ?? Side.None, Weapon = weapon, KillerVelocityX = e.Killer?.Velocity.X ?? 0, KillerVelocityY = e.Killer?.Velocity.Y ?? 0, KillerVelocityZ = e.Killer?.Velocity.Z ?? 0, KilledSteamId = e.Victim.SteamID, KilledName = e.Victim.Name, KilledSide = e.Victim.Team.ToSide(), RoundNumber = CurrentRound.Number, IsKillerCrouching = e.Killer?.IsDucking ?? false, IsHeadshot = e.Headshot, Point = new KillHeatmapPoint { KillerX = e.Killer?.Position.X ?? 0, KillerY = e.Killer?.Position.Y ?? 0, VictimX = e.Victim.Position.X, VictimY = e.Victim.Position.Y } }; bool killerIsBot = e.Killer != null && e.Killer.SteamID == 0; bool victimIsBot = e.Victim.SteamID == 0; bool assisterIsBot = e.Assister != null && e.Assister.SteamID == 0; if (e.Killer != null) { killer = Demo.Players.FirstOrDefault(player => player.SteamId == e.Killer.SteamID); } if (killer != null) { if (e.Victim.SteamID != killer.SteamId) { if (!killer.RoundsMoneyEarned.ContainsKey(CurrentRound.Number)) { killer.RoundsMoneyEarned[CurrentRound.Number] = weapon.KillAward; } else { killer.RoundsMoneyEarned[CurrentRound.Number] += weapon.KillAward; } } ProcessTradeKill(killEvent); } // Human killed human if (!killerIsBot && !victimIsBot) { if (killer != null && killed != null) { killed.IsAlive = false; // TK if (e.Killer.Team == e.Victim.Team) { killer.Kills.Add(killEvent); killed.Deaths.Add(killEvent); } else { // Regular kill if (!killer.IsControllingBot) { killer.Kills.Add(killEvent); } if (!killed.IsControllingBot) { killed.Deaths.Add(killEvent); } } } } // Human killed a bot if (!killerIsBot && victimIsBot) { killer?.Kills.Add(killEvent); } // A bot killed a human if (killerIsBot && !victimIsBot) { // TK or not we add a death to the human killed?.Deaths.Add(killEvent); } // Add assist if there was one if (e.Assister != null && !assisterIsBot && e.Assister.Team != e.Victim.Team) { Player assister = Demo.Players.FirstOrDefault(player => player.SteamId == e.Assister.SteamID); if (assister != null) { killEvent.AssisterSteamId = e.Assister.SteamID; killEvent.AssisterName = e.Assister.Name; assister.Assists.Add(killEvent); } } // If the killer isn't a bot we can update individual kill, open and entry kills if (e.Killer != null && e.Killer.Team != e.Victim.Team && killer != null && !killer.IsControllingBot) { if (!KillsThisRound.ContainsKey(e.Killer)) { KillsThisRound[e.Killer] = 0; } KillsThisRound[e.Killer]++; ProcessOpenAndEntryKills(killEvent); } ProcessClutches(); CurrentRound.Kills.Add(killEvent); Demo.Kills.Add(killEvent); if (AnalyzePlayersPosition) { PositionPoint positionPoint = new PositionPoint { X = e.Victim.Position.X, Y = e.Victim.Position.Y, PlayerSteamId = e.Killer?.SteamID ?? 0, PlayerName = e.Killer?.Name ?? string.Empty, Team = e.Killer?.Team.ToSide() ?? Side.None, Event = killEvent, RoundNumber = CurrentRound.Number }; Demo.PositionPoints.Add(positionPoint); } }
protected override void HandlePlayerKilled(object sender, PlayerKilledEventArgs e) { if (!IsMatchStarted) { return; } if (e.Killer == null || e.Victim == null) { return; } KillEvent killEvent = new KillEvent(Parser.IngameTick) { Weapon = new Weapon(e.Weapon), Killer = Demo.Players.FirstOrDefault(p => p.SteamId == e.Killer.SteamID), DeathPerson = Demo.Players.FirstOrDefault(p => p.SteamId == e.Victim.SteamID) }; if (killEvent.Killer != null) { killEvent.Killer.KillsCount++; if (e.Headshot) { killEvent.Killer.HeadshotCount++; } } if (killEvent.DeathPerson != null) { killEvent.DeathPerson.DeathCount++; killEvent.DeathPerson.IsAlive = false; } if (e.Assister != null) { killEvent.Assister = Demo.Players.FirstOrDefault(p => p.SteamId == e.Assister.SteamID); if (killEvent.Assister != null) { killEvent.Assister.AssistCount++; } } if (!KillsThisRound.ContainsKey(e.Killer)) { KillsThisRound[e.Killer] = 0; } KillsThisRound[e.Killer]++; // TK if (killEvent.Killer != null && killEvent.DeathPerson != null) { if (killEvent.Killer.Team == killEvent.DeathPerson.Team) { killEvent.Killer.KillsCount--; killEvent.Killer.TeamKillCount++; } } ProcessClutches(); ProcessOpenAndEntryKills(killEvent); ProcessPlayersRating(); if (AnalyzeHeatmapPoint) { killEvent.Point = new HeatmapPoint { X = e.Victim.Position.X, Y = e.Victim.Position.Y, Round = CurrentRound, Player = killEvent.Killer, Team = e.Killer.Team }; } CurrentRound.Kills.Add(killEvent); Demo.Kills.Add(killEvent); if (AnalyzePlayersPosition) { PositionPoint positionPoint = new PositionPoint { X = e.Victim.Position.X, Y = e.Victim.Position.Y, Player = Demo.Players.First(p => p.SteamId == e.Killer.SteamID), Team = e.Killer.Team, Event = killEvent, Round = CurrentRound }; Demo.PositionsPoint.Add(positionPoint); } }
protected override void HandlePlayerKilled(object sender, PlayerKilledEventArgs e) { if (!IsMatchStarted) { return; } if (e.Killer == null || e.Victim == null) { return; } KillEvent killEvent = new KillEvent(Parser.IngameTick) { Weapon = new Weapon(e.Weapon) }; bool killerIsBot = false; bool victimIsBot = false; bool assisterIsBot = false; if (e.Killer.SteamID == 0) { killerIsBot = true; } if (e.Victim.SteamID == 0) { victimIsBot = true; } if (e.Assister != null && e.Assister.SteamID == 0) { assisterIsBot = true; } // Human killed human if (!killerIsBot && !victimIsBot) { killEvent.DeathPerson = Demo.Players.FirstOrDefault(player => player.SteamId == e.Victim.SteamID); if (killEvent.DeathPerson != null) { killEvent.DeathPerson.IsAlive = false; } killEvent.Killer = Demo.Players.FirstOrDefault(player => player.SteamId == e.Killer.SteamID); if (killEvent.DeathPerson != null && killEvent.Killer != null) { // TK if (killEvent.Killer.Team == killEvent.DeathPerson.Team) { killEvent.Killer.TeamKillCount++; killEvent.Killer.KillsCount--; if (killEvent.Killer.HeadshotCount > 0) { killEvent.Killer.HeadshotCount--; } killEvent.DeathPerson.DeathCount++; } else { // Regular kill if (!killEvent.Killer.IsControllingBot) { killEvent.Killer.KillsCount++; if (e.Headshot) { killEvent.Killer.HeadshotCount++; } } if (!killEvent.DeathPerson.IsControllingBot) { killEvent.DeathPerson.DeathCount++; } } } } // Human killed a bot if (!killerIsBot && victimIsBot) { killEvent.Killer = Demo.Players.FirstOrDefault(player => player.SteamId == e.Killer.SteamID); if (killEvent.Killer != null) { // TK if (killEvent.Killer.Team == e.Victim.Team) { killEvent.Killer.TeamKillCount++; killEvent.Killer.KillsCount--; } else { // Regular kill if (!killEvent.Killer.IsControllingBot) { killEvent.Killer.KillsCount++; if (e.Headshot) { killEvent.Killer.HeadshotCount++; } } } } } // A bot killed a human if (killerIsBot && !victimIsBot) { killEvent.DeathPerson = Demo.Players.FirstOrDefault(player => player.SteamId == e.Victim.SteamID); // TK or not we add a death to the human if (killEvent.DeathPerson != null) { killEvent.DeathPerson.DeathCount++; } } // Add assist if there was one if (e.Assister != null && !assisterIsBot && e.Assister.Team != e.Victim.Team) { killEvent.Assister = Demo.Players.FirstOrDefault(player => player.SteamId == e.Assister.SteamID); if (killEvent.Assister != null) { killEvent.Assister.AssistCount++; } } // If the killer isn't a bot we can update individual kill, open and entry kills if (killEvent.Killer != null && !killEvent.Killer.IsControllingBot) { if (!KillsThisRound.ContainsKey(e.Killer)) { KillsThisRound[e.Killer] = 0; } KillsThisRound[e.Killer]++; ProcessOpenAndEntryKills(killEvent); } ProcessClutches(); if (AnalyzeHeatmapPoint) { killEvent.Point = new HeatmapPoint { X = e.Victim.Position.X, Y = e.Victim.Position.Y, Round = CurrentRound, Player = killEvent.Killer, Team = e.Killer.Team }; } Demo.Kills.Add(killEvent); CurrentRound.Kills.Add(killEvent); if (AnalyzePlayersPosition) { PositionPoint positionPoint = new PositionPoint { X = e.Victim.Position.X, Y = e.Victim.Position.Y, Player = Demo.Players.First(p => p.SteamId == e.Killer.SteamID), Team = e.Killer.Team, Event = killEvent, Round = CurrentRound }; Demo.PositionsPoint.Add(positionPoint); } }