Пример #1
0
        public static String GetRolesString(PlayerControl p, bool useColors, RoleType[] excludeRoles = null, bool includeHidden = false, string joinSeparator = " ") {
            if (p?.Data?.Disconnected != false) return "";

            var roleInfo = getRoleInfoForPlayer(p, excludeRoles, includeHidden);
            string roleName = String.Join(joinSeparator, roleInfo.Select(x => useColors ? Helpers.cs(x.color, x.name) : x.name).ToArray());
            if (Lawyer.target != null && p?.PlayerId == Lawyer.target.PlayerId && PlayerControl.LocalPlayer != Lawyer.target) roleName += (useColors ? Helpers.cs(Pursuer.color, " §") : " §");

            if (p.hasModifier(ModifierType.Madmate) || p.hasModifier(ModifierType.CreatedMadmate))
            {
                // Madmate only
                if (roleInfo.Contains(crewmate))
                {
                    roleName = useColors ? Helpers.cs(Madmate.color, Madmate.fullName) : Madmate.fullName;
                }
                else
                {
                    string prefix = useColors ? Helpers.cs(Madmate.color, Madmate.prefix) : Madmate.prefix;
                    roleName = String.Join(joinSeparator, roleInfo.Select(x => useColors ? Helpers.cs(Madmate.color, x.name) : x.name).ToArray());
                    roleName = prefix + roleName;
                }
            }

            if (p.hasModifier(ModifierType.LastImpostor))
            {
                if (roleInfo.Contains(impostor))
                {
                    roleName = useColors ? Helpers.cs(LastImpostor.color, LastImpostor.fullName) : LastImpostor.fullName;
                }
                else
                {
                    string postfix = useColors ? Helpers.cs(LastImpostor.color, LastImpostor.postfix) : LastImpostor.postfix;
                    roleName = String.Join(joinSeparator, roleInfo.Select(x => useColors? Helpers.cs(x.color, x.name)  : x.name).ToArray());
                    roleName = roleName + postfix;
                }
            }


            if(p.hasModifier(ModifierType.Munou))
            {
                if(PlayerControl.LocalPlayer.Data.IsDead || Munou.endGameFlag)
                {
                    string postfix = useColors ? Helpers.cs(Munou.color, Munou.postfix) : Munou.postfix;
                    // roleName = String.Join(joinSeparator, roleInfo.Select(x => useColors? Helpers.cs(x.color, x.name)  : x.name).ToArray());
                    roleName = roleName + postfix;
                }
            }

            if(p.hasModifier(ModifierType.AntiTeleport))
            {
                string postfix = useColors ? Helpers.cs(AntiTeleport.color, AntiTeleport.postfix) : AntiTeleport.postfix;
                // roleName = String.Join(joinSeparator, roleInfo.Select(x => useColors? Helpers.cs(x.color, x.name)  : x.name).ToArray());
                roleName = roleName + postfix;
            }

            return roleName;
        }
Пример #2
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();
            }
            if (player == SecurityGuard.securityGuard)
            {
                SecurityGuard.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();
            }
        }
Пример #3
0
 public static void setFutureShifted(byte playerId)
 {
     Shifter.futureShift = Helpers.playerById(playerId);
 }
Пример #4
0
        public static void shifterShift(byte targetId)
        {
            PlayerControl oldShifter = Shifter.shifter;
            PlayerControl player     = Helpers.playerById(targetId);

            if (player == null || oldShifter == null)
            {
                return;
            }

            Shifter.futureShift = null;
            Shifter.clearAndReload();

            // Suicide (exile) when impostor or impostor variants
            if (player.Data.IsImpostor || player == Jackal.jackal || player == Sidekick.sidekick)
            {
                oldShifter.Exiled();
                return;
            }

            // Switch shield
            if (Medic.shielded != null && Medic.shielded == player)
            {
                Medic.shielded = oldShifter;
            }
            else if (Medic.shielded != null && Medic.shielded == oldShifter)
            {
                Medic.shielded = player;
            }

            // Shift role
            if (Jester.jester != null && Jester.jester == player)
            {
                Jester.jester = oldShifter;
            }
            else if (Mayor.mayor != null && Mayor.mayor == player)
            {
                Mayor.mayor = oldShifter;
            }
            else if (Engineer.engineer != null && Engineer.engineer == player)
            {
                Engineer.engineer = oldShifter;
            }
            else if (Sheriff.sheriff != null && Sheriff.sheriff == player)
            {
                Sheriff.sheriff = oldShifter;
            }
            else if (Lighter.lighter != null && Lighter.lighter == player)
            {
                Lighter.lighter = oldShifter;
            }
            else if (Detective.detective != null && Detective.detective == player)
            {
                Detective.detective = oldShifter;
            }
            else if (TimeMaster.timeMaster != null && TimeMaster.timeMaster == player)
            {
                TimeMaster.timeMaster = oldShifter;
            }
            else if (Medic.medic != null && Medic.medic == player)
            {
                Medic.medic = oldShifter;
            }
            else if (Swapper.swapper != null && Swapper.swapper == player)
            {
                Swapper.swapper = oldShifter;
            }
            else if (Lovers.lover1 != null && Lovers.lover1 == player)
            {
                Lovers.lover1 = oldShifter;
            }
            else if (Lovers.lover2 != null && Lovers.lover2 == player)
            {
                Lovers.lover2 = oldShifter;
            }
            else if (Seer.seer != null && Seer.seer == player)
            {
                Seer.seer = oldShifter;
            }
            else if (Hacker.hacker != null && Hacker.hacker == player)
            {
                Hacker.hacker = oldShifter;
            }
            else if (Child.child != null && Child.child == player)
            {
                Child.child = oldShifter;
            }
            else if (Tracker.tracker != null && Tracker.tracker == player)
            {
                Tracker.tracker = oldShifter;
            }
            else if (Snitch.snitch != null && Snitch.snitch == player)
            {
                Snitch.snitch = oldShifter;
            }
            else if (Spy.spy != null && Spy.spy == player)
            {
                Spy.spy = oldShifter;
            }
            else if (SecurityGuard.securityGuard != null && SecurityGuard.securityGuard == player)
            {
                SecurityGuard.securityGuard = oldShifter;
            }
            else     // Crewmate
            {
            }

            // Set cooldowns to max for both players
            if (PlayerControl.LocalPlayer == oldShifter || PlayerControl.LocalPlayer == player)
            {
                CustomButton.ResetAllCooldowns();
            }
        }