示例#1
0
        /// <summary>
        /// Plays a CASSIE announcement based off of the configuration of a <see cref="IAnnouncement"/>.
        /// </summary>
        /// <param name="announcement">The announcement to play.</param>
        /// <param name="overrideMessage">The message to override the <see cref="IAnnouncement.Message"/>. Ignored if null or empty.</param>
        public static void PlayAnnouncement(IAnnouncement announcement, string overrideMessage = null)
        {
            string message = announcement.Message;

            if (!string.IsNullOrEmpty(overrideMessage))
            {
                message = overrideMessage;
            }

            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            message = GetVariableMessage(message);
            if (announcement.IsGlitchy)
            {
                Cassie.DelayedGlitchyMessage(message, announcement.Delay, announcement.GlitchChance * 0.01f, announcement.JamChance * 0.01f);
            }
            else
            {
                Cassie.DelayedMessage(message, announcement.Delay, isNoisy: announcement.IsNoisy);
            }
        }
        public void OnRespawning(RespawningTeamEventArgs ev)
        {
            // Need this, because ev.Players isn't working for methods
            List <Player> tempPlayers = new List <Player>();

            foreach (Player i in ev.Players)
            {
                if (i.IsOverwatchEnabled == false)
                {
                    tempPlayers.Add(i);
                }
            }

            if (ForcedTeam && HasReference)
            {
                ForcedTeam = false;

                ev.NextKnownTeam = chosenTeam.SpawnTypes.FirstOrDefault();

                if (MainPlugin.assemblyUIU)
                {
                    if (Methods.IsUIU())
                    {
                        Methods.SpawneableUIUToFalse();
                    }
                }

                if (MainPlugin.assemblySerpentHands)
                {
                    if (Methods.IsSerpentHand())
                    {
                        Methods.SpawneableSerpentToFalse();
                    }
                }
            }

            if (MainPlugin.assemblyUIU == true)
            {
                if (Methods.IsUIU())
                {
                    MainPlugin.Singleton.TmMethods.RemoveTeamReference();
                    coroutineHandle.Add(Timing.CallDelayed(0.2f, () =>
                    {
                        TeamConvert.SetPlayerTeamName(tempPlayers, "uiu");
                    }));

                    return;
                }
            }

            if (MainPlugin.assemblySerpentHands == true)
            {
                if (Methods.IsSerpentHand())
                {
                    MainPlugin.Singleton.TmMethods.RemoveTeamReference();
                    coroutineHandle.Add(Timing.CallDelayed(0.2f, () =>
                    {
                        TeamConvert.SetPlayerTeamName(tempPlayers, "serpentshand");
                    }));

                    return;
                }
            }

            if (!HasReference)
            {
                MainPlugin.Singleton.TmMethods.RefNextTeamSpawn(ev.NextKnownTeam);
                Log.Debug("Possible admin spawn due to No Team Reference yet", this.plugin.Config.Debug);
            }

            spawnableTeamType = ev.NextKnownTeam;

            if (ev.NextKnownTeam == Respawning.SpawnableTeamType.NineTailedFox)
            {
                respawns++;
            }

            if (chosenTeam != null)
            {
                Log.Debug("Spawned " + chosenTeam.Name, this.plugin.Config.Debug);

                coroutineHandle.Add(Timing.CallDelayed(0.2f, () => MainPlugin.Singleton.TmMethods.ChangePlysToTeam(tempPlayers, chosenTeam)));

                if (random.Next(0, 100) <= chosenTeam.CassieMessageChaosAnnounceChance && ev.NextKnownTeam == Respawning.SpawnableTeamType.ChaosInsurgency)
                {
                    Cassie.DelayedGlitchyMessage(chosenTeam.CassieMessageChaosMessage, 0, 0.25f, 0.25f);
                }
            }

            MainPlugin.Singleton.TmMethods.RemoveTeamReference();
        }
示例#3
0
        public void OnRespawning(RespawningTeamEventArgs ev)
        {
            if (ev.IsAllowed == false)
            {
                return;
            }

            // Need this, because ev.Players isn't working for methods
            List <Player> tempPlayers = new List <Player>(ev.Players);

            if (teamedPlayers.Count == 0)
            {
                TeamMethods.RemoveTeamReference();
                return;
            }

            if (ForcedTeam && HasReference)
            {
                ForcedTeam = false;

                ev.NextKnownTeam = chosenTeam.SpawnTypes.FirstOrDefault();

                if (assemblyUIU)
                {
                    if (Methods.IsUIU())
                    {
                        Methods.SpawneableUIUToFalse();
                    }
                }

                if (assemblySerpentHands)
                {
                    if (Methods.IsSerpentHand())
                    {
                        Methods.SpawneableSerpentToFalse();
                    }
                }
            }

            if (ev.NextKnownTeam == Respawning.SpawnableTeamType.NineTailedFox)
            {
                respawns++;
            }

            if (assemblyUIU)
            {
                if (Methods.IsUIU())
                {
                    if (plugin.Config.DominantPlugin)
                    {
                        Methods.SpawneableUIUToFalse();
                    }
                    else
                    {
                        TeamMethods.RemoveTeamReference();
                        coroutineHandle.Add(Timing.CallDelayed(0.2f, () =>
                        {
                            Extensions.SetAdvancedTeam(tempPlayers, Methods.UiUTeam);
                        }));
                        return;
                    }
                }
            }

            if (assemblySerpentHands == true)
            {
                if (Methods.IsSerpentHand())
                {
                    if (plugin.Config.DominantPlugin)
                    {
                        Methods.SpawneableSerpentToFalse();
                    }
                    else
                    {
                        TeamMethods.RemoveTeamReference();
                        coroutineHandle.Add(Timing.CallDelayed(0.2f, () =>
                        {
                            Extensions.SetAdvancedTeam(tempPlayers, Methods.SerpentHandsTeam);
                        }));
                        return;
                    }
                }
            }

            if (!HasReference)
            {
                TeamMethods.RefNextTeamSpawn(ev.NextKnownTeam);
                Log.Debug("Possible admin spawn due to No Team Reference yet", this.plugin.Config.Debug);
            }

            latestSpawn       = chosenTeam;
            spawnableTeamType = ev.NextKnownTeam;
            if (chosenTeam != null)
            {
                Log.Debug("Spawned " + chosenTeam.Name, this.plugin.Config.Debug);

                coroutineHandle.Add(Timing.CallDelayed(0.01f, () => TeamMethods.ChangePlysToTeam(tempPlayers, chosenTeam)));

                if (Rand.Next(0, 100) <= chosenTeam.CassieMessageChaosAnnounceChance && ev.NextKnownTeam == Respawning.SpawnableTeamType.ChaosInsurgency)
                {
                    Cassie.DelayedGlitchyMessage(chosenTeam.CassieMessageChaosMessage, 0, 0.25f, 0.25f);
                }
            }

            TeamMethods.RemoveTeamReference();
        }