Esempio n. 1
0
        public override async Task <Demo> AnalyzeDemoAsync()
        {
            Parser.ParseHeader();

            await Task.Run(() => Parser.ParseToEnd());

            Application.Current.Dispatcher.Invoke(delegate
            {
                Demo.MostHeadshotPlayer    = Demo.Players.OrderByDescending(x => x.HeadshotPercent).First();
                Demo.MostBombPlantedPlayer = Demo.Players.OrderByDescending(x => x.BombPlantedCount).First();
                Demo.MostEntryKillPlayer   = Demo.Players.MaxBy(p => p.EntryKills.Count);
                var weapons = Demo.Kills.GroupBy(k => k.Weapon).Select(weap => new
                {
                    Weapon = weap.Key,
                    Count  = weap.Count()
                }).OrderByDescending(w => w.Count);
                Demo.MostKillingWeapon = weapons.Select(w => w.Weapon).First();
            });

            if (AnalyzePlayersPosition)
            {
                LastPlayersFireEndedMolotov.Clear();
            }

            return(Demo);
        }
Esempio n. 2
0
        public override async Task <Demo> AnalyzeDemoAsync(CancellationToken token)
        {
            Parser.ParseHeader();

            await Task.Run(() => Parser.ParseToEnd(token), token);

            Application.Current.Dispatcher.Invoke(delegate
            {
                Demo.Winner = Demo.ScoreTeam1 > Demo.ScoreTeam2 ? Demo.TeamCT : Demo.TeamT;

                // As round_officialy_ended isn't raised we add the last round / OT after the analyze
                if (Demo.Rounds.Count < Demo.ScoreTeam1 + Demo.ScoreTeam2)
                {
                    if (Demo.Players.Any())
                    {
                        UpdateKillsCount();
                        UpdatePlayerScore();
                    }
                    Demo.Rounds.Add(CurrentRound);
                    // Add last overtime if there was an overtime at the end
                    if (IsOvertime)
                    {
                        Demo.Overtimes.Add(CurrentOvertime);
                    }
                }
                if (Demo.Players.Any())
                {
                    Demo.MostHeadshotPlayer    = Demo.Players.OrderByDescending(x => x.HeadshotPercent).First();
                    Demo.MostBombPlantedPlayer = Demo.Players.OrderByDescending(x => x.BombPlantedCount).First();
                    Demo.MostEntryKillPlayer   = Demo.Players.MaxBy(p => p.EntryKills.Count);
                }
                if (Demo.Kills.Any())
                {
                    var weapons = Demo.Kills.GroupBy(k => k.Weapon).Select(weap => new
                    {
                        Weapon = weap.Key,
                        Count  = weap.Count()
                    }).OrderByDescending(w => w.Count);
                    if (weapons.Any())
                    {
                        Demo.MostKillingWeapon = weapons.Select(w => w.Weapon).First();
                    }
                }
                if (AnalyzePlayersPosition)
                {
                    LastPlayersFireEndedMolotov.Clear();
                }
            });

            return(Demo);
        }
Esempio n. 3
0
        public override async Task <Demo> AnalyzeDemoAsync(CancellationToken token)
        {
            Parser.ParseHeader();

            await Task.Run(() => Parser.ParseToEnd(token), token);

            Application.Current.Dispatcher.Invoke(delegate
            {
                if (Demo.Players.Any())
                {
                    ProcessPlayersRating();
                    Demo.MostHeadshotPlayer    = Demo.Players.OrderByDescending(x => x.HeadshotPercent).First();
                    Demo.MostBombPlantedPlayer = Demo.Players.OrderByDescending(x => x.BombPlantedCount).First();
                    Demo.MostEntryKillPlayer   = Demo.Players.MaxBy(p => p.EntryKills.Count);
                }
                if (Demo.Kills.Any())
                {
                    var weapons = Demo.Kills.GroupBy(k => k.Weapon).Select(weap => new
                    {
                        Weapon = weap.Key,
                        Count  = weap.Count()
                    }).OrderByDescending(w => w.Count);
                    if (weapons.Any())
                    {
                        Demo.MostKillingWeapon = weapons.Select(w => w.Weapon).First();
                    }
                }
                if (AnalyzePlayersPosition)
                {
                    LastPlayersFireEndedMolotov.Clear();
                }
                Demo.Winner = Demo.ScoreTeam1 > Demo.ScoreTeam2 ? Demo.TeamCT : Demo.TeamT;
            });

            return(Demo);
        }