Пример #1
0
        static void Postfix(PlayerControl __instance, GameData.PlayerInfo CAKODNGLPDF)
        {
            System.Console.WriteLine("Report Body!");
            var        matches = killedPlayers.Where(x => x.PlayerId == CAKODNGLPDF.PlayerId).ToArray();
            DeadPlayer killer  = null;

            if (matches.Length > 0)
            {
                killer = matches[0];
            }

            if (killer == null)
            {
                return;
            }
            var isMedicAlive      = __instance.isPlayerRole("Medic");
            var areReportsEnabled = Main.Config.showReport;

            if (!isMedicAlive || !areReportsEnabled)
            {
                return;
            }

            var isUserMedic = PlayerControl.LocalPlayer.isPlayerRole("Medic");

            if (!isUserMedic)
            {
                return;
            }

            var br = new BodyReport
            {
                Killer      = PlayerTools.getPlayerById(killer.KillerId),
                Reporter    = __instance,
                KillAge     = (float)(DateTime.UtcNow - killer.KillTime).TotalMilliseconds,
                DeathReason = killer.DeathReason
            };

            var reportMsg = BodyReport.ParseBodyReport(br);

            if (string.IsNullOrWhiteSpace(reportMsg))
            {
                return;
            }

            if (AmongUsClient.Instance.AmClient && DestroyableSingleton <HudManager> .Instance)
            {
                // Send the message through chat only visible to the medic
                DestroyableSingleton <HudManager> .Instance.Chat.AddChat(PlayerControl.LocalPlayer, reportMsg);
            }

            if (reportMsg.IndexOf("who", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                // Really did not understand this
                DestroyableSingleton <Telemetry> .Instance.SendWho();
            }
        }
Пример #2
0
        public static void Postfix(PlayerControl __instance, PlayerControl CAKODNGLPDF)
        {
            var DeadBody = new DeadPlayer {
                PlayerId    = CAKODNGLPDF.PlayerId,
                KillerId    = __instance.PlayerId,
                KillTime    = DateTime.UtcNow,
                DeathReason = DeathReason.Kill
            };

            foreach (var Role in Role.ROLES)
            {
                Role.PostMurderPlayer(__instance, CAKODNGLPDF, DeadBody);
            }

            ExtraRoles.KilledPlayers.Add(DeadBody);
        }
Пример #3
0
        static void Postfix(PlayerControl __instance, GameData.PlayerInfo CAKODNGLPDF)
        {
            System.Console.WriteLine("Report Body!");
            DeadPlayer[] matches = killedPlayers.Where(x => x.PlayerId == CAKODNGLPDF.PlayerId).ToArray();
            DeadPlayer   killer  = null;

            if (matches.Length > 0)
            {
                killer = matches[0];
            }

            if (killer != null)
            {
                // If there is a Medic alive and Medic reported and reports are enabled
                if (__instance.isPlayerRole("Medic") && Main.Config.showReport)
                {
                    // If the user is the medic
                    if (PlayerControl.LocalPlayer.isPlayerRole("Medic"))
                    {
                        // Create Body Report
                        BodyReport br = new BodyReport();
                        br.Killer      = PlayerTools.getPlayerById(killer.KillerId);
                        br.Reporter    = __instance;
                        br.KillAge     = (float)(DateTime.UtcNow - killer.KillTime).TotalMilliseconds;
                        br.DeathReason = killer.DeathReason;
                        // Generate message
                        var reportMsg = BodyReport.ParseBodyReport(br);

                        // If message is not empty
                        if (!string.IsNullOrWhiteSpace(reportMsg))
                        {
                            if (AmongUsClient.Instance.AmClient && DestroyableSingleton <HudManager> .Instance)
                            {
                                // Send the message through chat only visible to the medic
                                DestroyableSingleton <HudManager> .Instance.Chat.AddChat(PlayerControl.LocalPlayer, reportMsg);
                            }
                            if (reportMsg.IndexOf("who", StringComparison.OrdinalIgnoreCase) >= 0)
                            {
                                // Really did not understand this
                                DestroyableSingleton <Telemetry> .Instance.SendWho();
                            }
                        }
                    }
                }
            }
        }
        static void Postfix(PlayerControl __instance, GameData.PlayerInfo __0)
        {
            System.Console.WriteLine("Report Body!");
            byte       reporterId = __instance.PlayerId;
            DeadPlayer killer     = killedPlayers.Where(x => x.PlayerId == __0.PlayerId).FirstOrDefault();

            if (killer != null)
            {
                // If there is a Medic alive and Medic reported and reports are enabled
                if (PlayerControl.LocalPlayer.isPlayerRole(Role.Medic) && Main.Config.showReport)
                {
                    // If the user is the medic
                    if (PlayerControl.LocalPlayer.isPlayerRole(Role.Medic))
                    {
                        // Create Body Report
                        BodyReport br = new BodyReport();
                        br.Killer      = PlayerTools.getPlayerById(killer.KillerId);
                        br.Reporter    = br.Killer = PlayerTools.getPlayerById(killer.KillerId);
                        br.KillAge     = (float)(DateTime.UtcNow - killer.KillTime).TotalMilliseconds;
                        br.DeathReason = killer.DeathReason;
                        // Generate message
                        var reportMsg = BodyReport.ParseBodyReport(br);

                        // If message is not empty
                        if (!string.IsNullOrWhiteSpace(reportMsg))
                        {
                            if (AmongUsClient.Instance.AmClient && DestroyableSingleton <HudManager> .Instance)
                            {
                                // Send the message through chat only visible to the medic
                                DestroyableSingleton <HudManager> .Instance.Chat.AddChat(PlayerControl.LocalPlayer, reportMsg);
                            }
                        }
                    }
                }
            }
        }