예제 #1
0
        public string ParseBodyReport()
        {
            String roleName = "Crewmate";

            if (TryGetSpecialRole <Role>(DeadPlayer.Victim.PlayerId, out var roleKvp))
            {
                roleName = roleKvp.name;
            }
            else if (DeadPlayer.Killer.Data.IsImpostor)
            {
                roleName = "Impostor";
            }

            List <string> hints = new List <string>()
            {
                $"The player was killed {Math.Round(KillAge / 1000)}s ago",
                $"The killer seems to have the Letter \"{Killer.name[Rng.Next(0, Killer.name.Length)]}\" in their name.",
                $"The Kill seems to be of a {_colors[Killer.Data.ColorId]} color",
                $"The Killer seems to have already killed {KilledPlayers.Count(x => x.Killer.PlayerId == Killer.PlayerId) - 1} other Crewmates.",
                $"It seems like the Victim had the role \"{roleName}\"",
                $"The last words of the Victim were: \"{_lastWords[Rng.Next(0, _lastWords.Count)]}\"",
                "Well, there goes my lunch...",
                "Urgs, a corpse!"
            };

            return(hints[Rng.Next(0, hints.Count)]);
        }
예제 #2
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();
            }
        }
예제 #3
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);
                }
            }