Esempio n. 1
0
        static void Postfix(PlayerControl __instance, GameData.PlayerInfo CAKODNGLPDF)
        {
            if (__instance == null || PlayerControl.LocalPlayer == null || KilledPlayers.Count <= 0)
            {
                return;
            }

            DeadPlayer killed = KilledPlayers?.FirstOrDefault(x => x.Victim?.PlayerId == CAKODNGLPDF?.PlayerId);

            if (killed == null)
            {
                return;
            }

            if (!TryGetSpecialRole(PlayerControl.LocalPlayer.PlayerId, out Detective _))
            {
                return;
            }

            Detective detective = GetSpecialRole <Detective>(PlayerControl.LocalPlayer.PlayerId);

            if (detective == null)
            {
                return;
            }

            if (__instance.PlayerId != detective.player.PlayerId || !detective.showReport)
            {
                return;
            }

            BodyReport br = new BodyReport();

            br.Killer     = killed.Killer;
            br.DeadPlayer = killed;
            br.KillAge    = (float)(DateTime.UtcNow - killed.KillTime).TotalMilliseconds;

            var reportMsg = br.ParseBodyReport();

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

            if (AmongUsClient.Instance.AmClient && DestroyableSingleton <HudManager> .Instance)
            {
                DestroyableSingleton <HudManager> .Instance.Chat.AddChat(PlayerControl.LocalPlayer, reportMsg);
            }
            if (reportMsg.IndexOf("who", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                DestroyableSingleton <Telemetry> .Instance.SendWho();
            }
        }
Esempio n. 2
0
            //handle the murder after it's ran
            public static void Postfix(PlayerControl __instance, PlayerControl CAKODNGLPDF)
            {
                PlayerControl current = __instance;
                PlayerControl target  = CAKODNGLPDF;

                DeadPlayer deadPlayer = new DeadPlayer(current, target, DateTime.UtcNow);

                if (TryGetSpecialRole(current.PlayerId, out Detective _))
                {
                    current.Data.IsImpostor = false;
                }
                KilledPlayers.Add(deadPlayer);

                if (TryGetSpecialRole(PlayerControl.LocalPlayer.PlayerId, out Seer seer) && target != seer.player)
                {
                    seer.SendChatMessage(Seer.MessageType.Died);
                }
            }