protected void HandleFlashNadeExploded(object sender, FlashEventArgs e)
        {
            if (!isMatchStarted || e.ThrownBy == null || currentRoundNumber > stopRoundNumber)
            {
                return;
            }

            sbNade.AppendLine(parser.CurrentTick + "," + e.ThrownBy.SteamID + "," + e.ThrownBy.Name + "," + (int)e.NadeType + "," + (int)ActionEnum.HurtByNade + "," + e.Position.X + "," + e.Position.Y + "," + e.Position.Z);
        }
Exemple #2
0
        private void HandleFlashNadeExploded(object sender, FlashEventArgs e)
        {
            FlashNadeExplodedEvent newEvent = new FlashNadeExplodedEvent()
            {
                ThrownBySteamID = e.ThrownBy.SteamID,
                NadeType        = (Models.EquipmentElement)((int)e.NadeType),
                Position        = new Models.Vector(e.Position.X, e.Position.Y, e.Position.Z)
            };

            CurrentTick.Events.Add(newEvent);
        }
    private void CurrentDemoParser_FlashNadeExploded(object sender, FlashEventArgs e)
    {
        string playersEffected = "";

        if (e.FlashedPlayers != null)
        {
            foreach (var player in e.FlashedPlayers)
            {
                playersEffected += " " + (player != null ? player.Name : "nobody");
            }
        }
        SteamController.LogToConsole(e.NadeType + " that was thrown by " + (e.ThrownBy != null ? e.ThrownBy.Name : "nobody") + " exploded at " + e.Position + " and affected" + playersEffected);
    }
Exemple #4
0
        void FlashNadeExploded_Event(object sender, FlashEventArgs e)
        {
            if (e.ThrownBy != null)
            {
                CurrentRound.Players[e.ThrownBy.SteamID].PlayerRoundGrenade.Flashes.Add(new FlashGrenade {
                    StartTick = parser.CurrentTick, StartTime = parser.CurrentTime, Type = (int)e.NadeType, PlayersFlashed = e.FlashedPlayers.Where(i => i.SteamID != 0).ToList().Select(i => CurrentRound.Players[i.SteamID]).ToList()
                });

                if (MatchData.Players[e.ThrownBy.SteamID].Team == 0)
                {
                    CurrentRound.Team1.FlashesThrown += 1;
                }
                else
                {
                    CurrentRound.Team2.FlashesThrown += 1;
                }
            }
        }
        internal NadeEvents assembleNade(NadeEventArgs e, string eventname)
        {
            if (e.GetType() == typeof(FlashEventArgs)) //Exception for FlashEvents -> we need flashed players
            {
                FlashEventArgs f = e as FlashEventArgs;
                return(new FlashNade
                {
                    GameeventType = eventname,
                    Actor = AssemblePlayer(e.ThrownBy),
                    nadetype = e.NadeType.ToString(),
                    position = new Point3D(e.Position.X, e.Position.Y, e.Position.Z),
                    Flashedplayers = AssembleFlashedPlayers(f.FlashedPlayers)
                });
            }

            return(new NadeEvents
            {
                GameeventType = eventname,
                Actor = AssemblePlayer(e.ThrownBy),
                nadetype = e.NadeType.ToString(),
                position = new Point3D(e.Position.X, e.Position.Y, e.Position.Z),
            });
        }
Exemple #6
0
        void HandleFlashNadeExploded(object sender, FlashEventArgs e)
        {
            if (e.ThrownBy == null)
            {
                return;
            }

            int flashedCTs = e.FlashedPlayers.Count(a => a.IsAlive && a.Team == Team.CounterTerrorist);
            int flashedTs  = e.FlashedPlayers.Count(a => a.IsAlive && a.Team == Team.Terrorist);

            if (e.ThrownBy.Team == Team.CounterTerrorist)
            {
                CTFlashes.AddPoint(MapPoint(e.Position, e.ThrownBy));

                if (flashedTs > 0)
                {
                    CTGoodFlashes.AddPoint(MapPoint(e.Position, e.ThrownBy));
                }
                else
                {
                    CTBadFlashes.AddPoint(MapPoint(e.Position, e.ThrownBy));
                }
            }
            else
            {
                TFlashes.AddPoint(MapPoint(e.Position, e.ThrownBy));

                if (flashedCTs > 0)
                {
                    TGoodFlashes.AddPoint(MapPoint(e.Position, e.ThrownBy));
                }
                else
                {
                    TBadFlashes.AddPoint(MapPoint(e.Position, e.ThrownBy));
                }
            }
        }
Exemple #7
0
        private void flashElf(object sender, FlashEventArgs e)
        {
            if (e.Device != null)
            {
                StatusWrite("Preparing to flash...");
                HidStream hidStream;
                if (e.Device.TryOpen(out hidStream))
                {
                    using (hidStream)
                    {
                        StatusWrite("Writing flash...");
                        hidStream.SetFeature(new byte[] { 0, 0x20 });

                        byte[] output = new byte[65];
                        for (int i = 0; i < elfData.Length; i += 64)
                        {
                            Array.Copy(elfData, i, output, 1, 64);
                            hidStream.Write(output);
                        }

                        StatusWrite("Closing flash...");
                        hidStream.SetFeature(new byte[] { 0, 0x21 });

                        StatusWrite("Resetting to application...");
                        hidStream.SetFeature(new byte[] { 0, 0x11 });
                    }

                    waitingForBootloader = false;
                    serialForBootloader  = "";
                }
                else
                {
                    StatusWrite("Failed to open bootloader. Please unplug it and try again.");
                }
            }
        }