Beispiel #1
0
        public static void MakeButtons(HudManager hm)
        {
            morphButton = new CustomButton(
                () =>
            {
                if (!isMorph)
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.mimicMorph, Hazel.SendOption.Reliable, -1);
                    writer.Write(PlayerControl.LocalPlayer.PlayerId);
                    writer.Write(MimicK.allPlayers.FirstOrDefault().PlayerId);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.mimicMorph(PlayerControl.LocalPlayer.PlayerId, MimicK.allPlayers.FirstOrDefault().PlayerId);
                }
                else
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.mimicResetMorph, Hazel.SendOption.Reliable, -1);
                    writer.Write(PlayerControl.LocalPlayer.PlayerId);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.mimicResetMorph(PlayerControl.LocalPlayer.PlayerId);
                }
            },
                () => { return(PlayerControl.LocalPlayer.isRole(RoleType.MimicA) && PlayerControl.LocalPlayer.isAlive() && MimicK.isAlive()); },
                () => { return(PlayerControl.LocalPlayer.CanMove); },
                () =>
            {
            },
                getMorphButtonSprite(),
                new Vector3(-1.8f, -0.06f, 0),
                hm,
                hm.UseButton,
                KeyCode.Q,
                false
                );
            morphButton.buttonText = "";

            adminButton = new CustomButton(
                () => {
                PlayerControl.LocalPlayer.NetTransform.Halt();
                Action <MapBehaviour> tmpAction = (MapBehaviour m) => { m.ShowCountOverlay(); };
                DestroyableSingleton <HudManager> .Instance.ShowMap(tmpAction);
                if (PlayerControl.LocalPlayer.AmOwner)
                {
                    PlayerControl.LocalPlayer.MyPhysics.inputHandler.enabled = true;
                    ConsoleJoystick.SetMode_Task();
                }
            },
                () => {
                return(PlayerControl.LocalPlayer.isRole(RoleType.MimicA) &&
                       PlayerControl.LocalPlayer.isAlive() &&
                       MimicK.isAlive());
            },
                () => { return(PlayerControl.LocalPlayer.CanMove); },
                () => {},
                EvilHacker.getButtonSprite(),
                new Vector3(0f, 1.0f, 0),
                hm,
                hm.KillButton,
                KeyCode.F,
                false);
            adminButton.buttonText = DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.Admin);

            adminButton.MaxTimer = adminButton.Timer = 0;
        }
Beispiel #2
0
        public static void eraseAllRoles(this PlayerControl player)
        {
            foreach (var t in RoleData.allRoleTypes)
            {
                t.Value.GetMethod("eraseRole", BindingFlags.Public | BindingFlags.Static)?.Invoke(null, new object[] { player });
            }

            // Crewmate roles
            if (player.isRole(RoleType.Mayor))
            {
                Mayor.clearAndReload();
            }
            if (player.isRole(RoleType.Engineer))
            {
                Engineer.clearAndReload();
            }
            if (player.isRole(RoleType.Detective))
            {
                Detective.clearAndReload();
            }
            if (player.isRole(RoleType.TimeMaster))
            {
                TimeMaster.clearAndReload();
            }
            if (player.isRole(RoleType.Medic))
            {
                Medic.clearAndReload();
            }
            if (player.isRole(RoleType.Shifter))
            {
                Shifter.clearAndReload();
            }
            if (player.isRole(RoleType.Seer))
            {
                Seer.clearAndReload();
            }
            if (player.isRole(RoleType.Hacker))
            {
                Hacker.clearAndReload();
            }
            if (player.isRole(RoleType.Tracker))
            {
                Tracker.clearAndReload();
            }
            if (player.isRole(RoleType.Snitch))
            {
                Snitch.clearAndReload();
            }
            if (player.isRole(RoleType.Swapper))
            {
                Swapper.clearAndReload();
            }
            if (player.isRole(RoleType.Spy))
            {
                Spy.clearAndReload();
            }
            if (player.isRole(RoleType.SecurityGuard))
            {
                SecurityGuard.clearAndReload();
            }
            if (player.isRole(RoleType.Bait))
            {
                Bait.clearAndReload();
            }
            if (player.isRole(RoleType.Medium))
            {
                Medium.clearAndReload();
            }

            // Impostor roles
            if (player.isRole(RoleType.Morphling))
            {
                Morphling.clearAndReload();
            }
            if (player.isRole(RoleType.Camouflager))
            {
                Camouflager.clearAndReload();
            }
            if (player.isRole(RoleType.Godfather))
            {
                Godfather.clearAndReload();
            }
            if (player.isRole(RoleType.Mafioso))
            {
                Mafioso.clearAndReload();
            }
            if (player.isRole(RoleType.Janitor))
            {
                Janitor.clearAndReload();
            }
            if (player.isRole(RoleType.Vampire))
            {
                Vampire.clearAndReload();
            }
            if (player.isRole(RoleType.Eraser))
            {
                Eraser.clearAndReload();
            }
            if (player.isRole(RoleType.Trickster))
            {
                Trickster.clearAndReload();
            }
            if (player.isRole(RoleType.Cleaner))
            {
                Cleaner.clearAndReload();
            }
            if (player.isRole(RoleType.Warlock))
            {
                Warlock.clearAndReload();
            }
            if (player.isRole(RoleType.Witch))
            {
                Witch.clearAndReload();
            }
            if (player.isRole(RoleType.Assassin))
            {
                Assassin.clearAndReload();
            }
            if (player.isRole(RoleType.EvilHacker))
            {
                EvilHacker.clearAndReload();
            }

            // Other roles
            if (player.isRole(RoleType.Jester))
            {
                Jester.clearAndReload();
            }
            if (player.isRole(RoleType.Arsonist))
            {
                Arsonist.clearAndReload();
            }
            if (player.isRole(RoleType.Sidekick))
            {
                Sidekick.clearAndReload();
            }
            if (player.isRole(RoleType.BountyHunter))
            {
                BountyHunter.clearAndReload();
            }
            if (player.isRole(RoleType.Vulture))
            {
                Vulture.clearAndReload();
            }
            if (player.isRole(RoleType.Lawyer))
            {
                Lawyer.clearAndReload();
            }
            if (player.isRole(RoleType.Pursuer))
            {
                Pursuer.clearAndReload();
            }
            if (Guesser.isGuesser(player.PlayerId))
            {
                Guesser.clear(player.PlayerId);
            }


            if (player.isRole(RoleType.Jackal))
            { // Promote Sidekick and hence override the the Jackal or erase Jackal
                if (Sidekick.promotesToJackal && Sidekick.sidekick != null && Sidekick.sidekick.isAlive())
                {
                    RPCProcedure.sidekickPromotes();
                }
                else
                {
                    Jackal.clearAndReload();
                }
            }
        }