public static void clearAndReloadRoles()
 {
     Jester.clearAndReload();
     Mayor.clearAndReload();
     Engineer.clearAndReload();
     Sheriff.clearAndReload();
     Lighter.clearAndReload();
     Godfather.clearAndReload();
     Mafioso.clearAndReload();
     Janitor.clearAndReload();
     Detective.clearAndReload();
     TimeMaster.clearAndReload();
     Medic.clearAndReload();
     Shifter.clearAndReload();
     Swapper.clearAndReload();
     Lovers.clearAndReload();
     Seer.clearAndReload();
     Morphling.clearAndReload();
     Camouflager.clearAndReload();
     Hacker.clearAndReload();
     Child.clearAndReload();
     Tracker.clearAndReload();
     Vampire.clearAndReload();
     Snitch.clearAndReload();
     Jackal.clearAndReload();
     Sidekick.clearAndReload();
     Eraser.clearAndReload();
     Spy.clearAndReload();
     Trickster.clearAndReload();
 }
        static void addSwapperSwapButtons(MeetingHud __instance)
        {
            if (Swapper.swapper == null || PlayerControl.LocalPlayer != Swapper.swapper || Swapper.swapper.IDOFAMCIJKE.FGNJJFABIHJ)
            {
                return;
            }

            selections = new bool[__instance.DHCOPOOJCLN.Length];
            renderers  = new SpriteRenderer[__instance.DHCOPOOJCLN.Length];

            for (int i = 0; i < __instance.DHCOPOOJCLN.Length; i++)
            {
                PlayerVoteArea playerVoteArea = __instance.DHCOPOOJCLN[i];
                GameObject     template       = playerVoteArea.Buttons.transform.Find("CancelButton").gameObject;
                GameObject     checkbox       = UnityEngine.Object.Instantiate(template);
                checkbox.transform.SetParent(playerVoteArea.transform);
                checkbox.transform.position      = template.transform.position;
                checkbox.transform.localPosition = new Vector3(0f, 0.03f, template.transform.localPosition.z);
                SpriteRenderer renderer = checkbox.GetComponent <SpriteRenderer>();
                renderer.sprite = Swapper.getCheckSprite();
                renderer.color  = Color.red;

                PassiveButton button = checkbox.GetComponent <PassiveButton>();
                button.OnClick.RemoveAllListeners();
                int copiedIndex = i;
                button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() => onClick(copiedIndex, __instance)));



                selections[i] = false;
                renderers[i]  = renderer;
            }
        }
Example #3
0
        public static void clearAndReloadRoles()
        {
            Morphling.clearAndReload();
            Camouflager.clearAndReload();
            Shifter.clearAndReload();
            Swapper.clearAndReload();
            GM.clearAndReload();

            Lovers.Clear();
            Opportunist.Clear();
            Ninja.Clear();
            Madmate.Clear();
            CreatedMadmate.Clear();
            PlagueDoctor.Clear();
            Lighter.Clear();
            SerialKiller.Clear();
            Fox.Clear();
            Immoralist.Clear();
            FortuneTeller.Clear();
            LastImpostor.Clear();
            SoulPlayer.Clear();
            Munou.Clear();
            SchrodingersCat.Clear();
            Trapper.Clear();
            BomberA.Clear();
            BomberB.Clear();
            EvilTracker.Clear();
            Puppeteer.Clear();
            MimicK.Clear();
            MimicA.Clear();
            Mini.Clear();
            AntiTeleport.Clear();
            Role.ClearAll();
        }
Example #4
0
        static void populateButtonsPostfix(MeetingHud __instance)
        {
            // Reposition button if there are more than 10 players
            float scale = 5f / 8f; // 8 rows are needed instead of 5

            if (__instance.GBKFCOAKLAH != null && __instance.GBKFCOAKLAH.Length > 10)
            {
                for (int i = 0; i < __instance.GBKFCOAKLAH.Length; i++)
                {
                    PlayerVoteArea area   = __instance.GBKFCOAKLAH[i];
                    bool           isLeft = i % 2 == 0;
                    int            num2   = i / 2;
                    area.transform.localPosition = __instance.VoteOrigin + new Vector3(isLeft ? 1f : 3.9f, __instance.VoteButtonOffsets.y * (float)num2 * scale, area.transform.localPosition.z);
                    area.transform.localScale    = new Vector3(area.transform.localScale.x * scale, area.transform.localScale.y * scale, area.transform.localScale.z);
                }
            }

            // Add Swapper Buttons
            if (Swapper.swapper == null || PlayerControl.LocalPlayer != Swapper.swapper || Swapper.swapper.PPMOEEPBHJO.IAGJEKLJCCI)
            {
                return;
            }
            selections = new bool[__instance.GBKFCOAKLAH.Length];
            renderers  = new SpriteRenderer[__instance.GBKFCOAKLAH.Length];

            for (int i = 0; i < __instance.GBKFCOAKLAH.Length; i++)
            {
                PlayerVoteArea playerVoteArea = __instance.GBKFCOAKLAH[i];
                GameObject     template       = playerVoteArea.Buttons.transform.Find("CancelButton").gameObject;
                GameObject     checkbox       = UnityEngine.Object.Instantiate(template);
                checkbox.transform.SetParent(playerVoteArea.transform);
                checkbox.transform.position      = template.transform.position;
                checkbox.transform.localPosition = new Vector3(0f, 0.03f, template.transform.localPosition.z);
                SpriteRenderer renderer = checkbox.GetComponent <SpriteRenderer>();
                renderer.sprite = Swapper.getCheckSprite();
                renderer.color  = Color.red;

                PassiveButton button = checkbox.GetComponent <PassiveButton>();
                button.OnClick.RemoveAllListeners();
                int copiedIndex = i;
                button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() => onClick(copiedIndex, __instance)));



                selections[i] = false;
                renderers[i]  = renderer;
            }
        }
        static void populateButtonsPostfix(MeetingHud __instance)
        {
            // Change buttons if there are more than 10 players
            if (__instance.playerStates != null && __instance.playerStates.Length > 10)
            {
                PlayerVoteArea[] playerStates = __instance.playerStates.OrderBy((PlayerVoteArea p) => p.isDead ? 50 : 0)
                                                .ThenBy((PlayerVoteArea p) => p.TargetPlayerId)
                                                .ToArray <PlayerVoteArea>();
                for (int i = 0; i < playerStates.Length; i++)
                {
                    PlayerVoteArea area = playerStates[i];

                    int row = i / 3, col = i % 3;

                    // Update scalings
                    area.Overlay.transform.localScale    = area.PlayerButton.transform.localScale = new Vector3(1, 1 / scale, 1);
                    area.NameText.transform.localScale   = new Vector3(1 / scale, 1 / scale, 1);
                    area.gameObject.transform.localScale = new Vector3(scale, scale, 1);
                    GameObject megaphoneWrapper = new GameObject();
                    megaphoneWrapper.transform.SetParent(area.transform);
                    megaphoneWrapper.transform.localScale = Vector3.one * 1 / scale;
                    area.Megaphone.transform.SetParent(megaphoneWrapper.transform);

                    // Update positions
                    area.Megaphone.transform.localPosition += Vector3.left * 0.1f;
                    area.NameText.transform.localPosition  += new Vector3(0.25f, 0.043f, 0f);
                    area.transform.localPosition            = new Vector3(-3.63f + 2.43f * col, 1.5f - 0.76f * row, -0.9f - 0.01f * row);
                }
            }

            // Add Swapper Buttons
            if (Swapper.swapper == null || PlayerControl.LocalPlayer != Swapper.swapper || Swapper.swapper.Data.IsDead)
            {
                return;
            }
            selections = new bool[__instance.playerStates.Length];
            renderers  = new SpriteRenderer[__instance.playerStates.Length];

            for (int i = 0; i < __instance.playerStates.Length; i++)
            {
                PlayerVoteArea playerVoteArea = __instance.playerStates[i];
                GameObject     template       = playerVoteArea.Buttons.transform.Find("CancelButton").gameObject;
                GameObject     checkbox       = UnityEngine.Object.Instantiate(template);
                checkbox.transform.SetParent(playerVoteArea.transform);
                checkbox.transform.position      = template.transform.position;
                checkbox.transform.localPosition = new Vector3(0f, 0.03f, template.transform.localPosition.z);
                SpriteRenderer renderer = checkbox.GetComponent <SpriteRenderer>();
                renderer.sprite = Swapper.getCheckSprite();
                renderer.color  = Color.red;

                PassiveButton button = checkbox.GetComponent <PassiveButton>();
                button.OnClick.RemoveAllListeners();
                int copiedIndex = i;
                button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() => onClick(copiedIndex, __instance)));



                selections[i] = false;
                renderers[i]  = renderer;
            }
        }
Example #6
0
        public static void erasePlayerRole(byte playerId)
        {
            PlayerControl player = Helpers.playerById(playerId);

            if (player == null)
            {
                return;
            }

            // Crewmate roles
            if (player == Mayor.mayor)
            {
                Mayor.clearAndReload();
            }
            if (player == Engineer.engineer)
            {
                Engineer.clearAndReload();
            }
            if (player == Sheriff.sheriff)
            {
                Sheriff.clearAndReload();
            }
            if (player == Lighter.lighter)
            {
                Lighter.clearAndReload();
            }
            if (player == Detective.detective)
            {
                Detective.clearAndReload();
            }
            if (player == TimeMaster.timeMaster)
            {
                TimeMaster.clearAndReload();
            }
            if (player == Medic.medic)
            {
                Medic.clearAndReload();
            }
            if (player == Shifter.shifter)
            {
                Shifter.clearAndReload();
            }
            if (player == Seer.seer)
            {
                Seer.clearAndReload();
            }
            if (player == Hacker.hacker)
            {
                Hacker.clearAndReload();
            }
            if (player == Child.child)
            {
                Child.clearAndReload();
            }
            if (player == Tracker.tracker)
            {
                Tracker.clearAndReload();
            }
            if (player == Snitch.snitch)
            {
                Snitch.clearAndReload();
            }
            if (player == Swapper.swapper)
            {
                Swapper.clearAndReload();
            }
            if (player == Spy.spy)
            {
                Spy.clearAndReload();
            }

            // Impostor roles
            if (player == Morphling.morphling)
            {
                Morphling.clearAndReload();
            }
            if (player == Camouflager.camouflager)
            {
                Camouflager.clearAndReload();
            }
            if (player == Godfather.godfather)
            {
                Godfather.clearAndReload();
            }
            if (player == Mafioso.mafioso)
            {
                Mafioso.clearAndReload();
            }
            if (player == Janitor.janitor)
            {
                Janitor.clearAndReload();
            }
            if (player == Vampire.vampire)
            {
                Vampire.clearAndReload();
            }
            if (player == Eraser.eraser)
            {
                Eraser.clearAndReload();
            }
            if (player == Trickster.trickster)
            {
                Trickster.clearAndReload();
            }
            if (player == Cleaner.cleaner)
            {
                Cleaner.clearAndReload();
            }
            if (player == Warlock.warlock)
            {
                Warlock.clearAndReload();
            }

            // Other roles
            if (player == Jester.jester)
            {
                Jester.clearAndReload();
            }
            if (player == Lovers.lover1 || player == Lovers.lover2)   // The whole Lover couple is being erased
            {
                Lovers.clearAndReload();
            }
            if (player == Jackal.jackal)   // Promote Sidekick and hence override the the Jackal or erase Jackal
            {
                if (Sidekick.promotesToJackal && Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead)
                {
                    RPCProcedure.sidekickPromotes();
                }
                else
                {
                    Jackal.clearAndReload();
                }
            }
            if (player == Sidekick.sidekick)
            {
                Sidekick.clearAndReload();
            }
        }
Example #7
0
        public static void jackalCreatesSidekick(byte targetId)
        {
            foreach (PlayerControl player in PlayerControl.AllPlayerControls)
            {
                if (player.PlayerId == targetId)
                {
                    if (!Jackal.canCreateSidekickFromImpostor && player.Data.IsImpostor)
                    {
                        Jackal.fakeSidekick = player;
                        return;
                    }
                    Sidekick.sidekick = player;
                    player.RemoveInfected();

                    // Crewmate roles
                    if (player == Jester.jester)
                    {
                        Jester.clearAndReload();
                    }
                    if (player == Mayor.mayor)
                    {
                        Mayor.clearAndReload();
                    }
                    if (player == Engineer.engineer)
                    {
                        Engineer.clearAndReload();
                    }
                    if (player == Sheriff.sheriff)
                    {
                        Sheriff.clearAndReload();
                    }
                    if (player == Lighter.lighter)
                    {
                        Lighter.clearAndReload();
                    }
                    if (player == Detective.detective)
                    {
                        Detective.clearAndReload();
                    }
                    if (player == TimeMaster.timeMaster)
                    {
                        TimeMaster.clearAndReload();
                    }
                    if (player == Medic.medic)
                    {
                        Medic.clearAndReload();
                    }
                    if (player == Shifter.shifter)
                    {
                        Shifter.clearAndReload();
                    }
                    if (player == Seer.seer)
                    {
                        Seer.clearAndReload();
                    }
                    if (player == Spy.spy)
                    {
                        Spy.clearAndReload();
                    }
                    if (player == Child.child)
                    {
                        Child.clearAndReload();
                    }
                    if (player == Tracker.tracker)
                    {
                        Tracker.clearAndReload();
                    }
                    if (player == BountyHunter.bountyHunter)
                    {
                        BountyHunter.clearAndReload();
                    }
                    if (player == Snitch.snitch)
                    {
                        Snitch.clearAndReload();
                    }
                    if (player == Swapper.swapper)
                    {
                        Swapper.clearAndReload();
                    }

                    // Impostor roles
                    if (player == Morphling.morphling)
                    {
                        Morphling.clearAndReload();
                    }
                    if (player == Camouflager.camouflager)
                    {
                        Camouflager.clearAndReload();
                    }
                    if (player == Godfather.godfather)
                    {
                        Godfather.clearAndReload();
                    }
                    if (player == Mafioso.mafioso)
                    {
                        Mafioso.clearAndReload();
                    }
                    if (player == Janitor.janitor)
                    {
                        Janitor.clearAndReload();
                    }
                    if (player == Vampire.vampire)
                    {
                        Vampire.clearAndReload();
                    }

                    // The Sidekick stays a part of the lover couple!

                    if (PlayerControl.LocalPlayer == null)
                    {
                        return;
                    }
                    if (PlayerControl.LocalPlayer == player)
                    {
                        //Only the Lover keeps his ImportantTextTask
                        Helpers.removeTasksFromPlayer(player, player != Lovers.lover1 && player != Lovers.lover2);

                        var task = new GameObject("RoleTask").AddComponent <ImportantTextTask>();
                        task.transform.SetParent(player.transform, false);
                        task.Text = "[00B4EBFF]Sidekick: Help your Jackal to kill everyone";
                        player.myTasks.Insert(0, task);
                    }

                    return;
                }
            }
        }
Example #8
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();
                }
            }
        }