public new void Spawn() { if (RespawnManagerCrap.blockRespawns) { return; } RespawnManagerCrap.isCI = NextKnownTeam == SpawnableTeamType.ChaosInsurgency; orig_Spawn(); try { Base.Debug("Triggering RespawnEvent"); PluginManager.TriggerEvent <IEventHandlerRespawn>(new RespawnEvent(RespawnManagerCrap.isCI)); } catch (Exception e) { Base.Error($"Error triggering RespawnEvent: {e.InnerException}"); } if (Commands.LightsoutCommand.isLightsout) { RespawnManagerCrap.TorchSpawnerReplacementDueToShittyCode(); } if (RespawnManagerCrap.isCI && PMConfigFile.announceChaos) { RespawnEffectsController.PlayCassieAnnouncement(PMConfigFile.chaosAnnouncement, false, true); } }
/// <summary> /// Reproduce a non-glitched C.A.S.S.I.E message with a possibility to custom the subtitles. /// </summary> /// <param name="message">The message to be reproduced.</param> /// <param name="translation">The translation should be show in the subtitles.</param> /// <param name="isHeld">Indicates whether C.A.S.S.I.E has to hold the message.</param> /// <param name="isNoisy">Indicates whether C.A.S.S.I.E has to make noises or not during the message.</param> /// <param name="isSubtitles">Indicates whether C.A.S.S.I.E has to make subtitles.</param> public static void MessageTranslated(string message, string translation, bool isHeld = false, bool isNoisy = true, bool isSubtitles = true) { StringBuilder annoucement = new(); string[] cassies = message.Split('\n'); string[] translations = translation.Split('\n'); for (int i = 0; i < cassies.Count(); i++) { annoucement.Append($"{translations[i].Replace(' ', ' ')}<alpha=#00> {cassies[i]} </alpha><split>"); } RespawnEffectsController.PlayCassieAnnouncement(annoucement.ToString(), isHeld, isNoisy, isSubtitles); }
public IEnumerator <float> RunBlackoutTimer() { yield return(Timing.WaitForSeconds(Config.InitialDelay)); for (;;) { RespawnEffectsController.PlayCassieAnnouncement(Config.CassieMessageStart, false, true); if (Config.DisableTeslas) { EventHandlers.TeslasDisabled = true; } TimerOn = true; yield return(Timing.WaitForSeconds(8.7f)); float blackoutDur = Config.DurationMax; if (Config.RandomEvents) { blackoutDur = (float)Gen.NextDouble() * (Config.DurationMax - Config.DurationMin) + Config.DurationMin; } if (Config.EnableKeter) { EventHandlers.Coroutines.Add(Timing.RunCoroutine(Keter(blackoutDur), "keter")); } Generator079.Generators[0].ServerOvercharge(blackoutDur, Config.OnlyHeavy); if (Config.Voice) { RespawnEffectsController.PlayCassieAnnouncement(Config.CassieKeter, false, false); } yield return(Timing.WaitForSeconds(blackoutDur - 8.7f)); RespawnEffectsController.PlayCassieAnnouncement(Config.CassieMessageEnd, false, true); yield return(Timing.WaitForSeconds(8.7f)); Timing.KillCoroutines("keter"); EventHandlers.TeslasDisabled = false; TimerOn = false; if (Config.RandomEvents) { yield return(Timing.WaitForSeconds(Gen.Next(Config.DelayMin, Config.DelayMax))); } else { yield return(Timing.WaitForSeconds(Config.InitialDelay)); } } }
public static IEnumerator <float> InitBlackout() { yield return(Timing.WaitForSeconds(10f)); Methods.SendSubtitle(SanyaPlugin.Instance.Translation.BlackoutInit, 20); RespawnEffectsController.PlayCassieAnnouncement("warning . facility power system has been attacked . all most containment zones light does not available until generator activated .", false, true); foreach (var x in FlickerableLightController.Instances) { x.ServerFlickerLights(5f); } yield return(Timing.WaitForSeconds(3f)); foreach (var i in FlickerableLightController.Instances.Where(x => x.transform.root?.name != "Outside")) { i.Network_warheadLightOverride = true; i.Network_warheadLightColor = new Color(0f, 0f, 0f); } yield break; }
public new void ServerOnlyAddGlitchyPhrase(string tts, float glitchChance, float jamChance) { if (PMConfigFile.cassieGlitch || (PMConfigFile.cassieGlitchDetonation && AlphaWarheadController.Host.detonated)) { string[] array = tts.Split(' '); List <string> newWords = new List <string>(); newWords.EnsureCapacity(array.Length); for (int i = 0; i < array.Length; i++) { newWords.Add(array[i]); if (i < array.Length - 1) { if (PMConfigFile.cassieGlitch || PMConfigFile.cassieGlitchDetonation && AlphaWarheadController.Host.detonated) { if (UnityEngine.Random.value < glitchChance * 2) { newWords.Add(".G" + UnityEngine.Random.Range(1, 7)); } if (UnityEngine.Random.value < jamChance * 2) { newWords.Add(string.Concat(new object[] { "JAM_", UnityEngine.Random.Range(0, 70).ToString("000"), "_", UnityEngine.Random.Range(2, 6) })); } } } } tts = ""; foreach (string str in newWords) { tts = tts + str + " "; } } RespawnEffectsController.PlayCassieAnnouncement(tts, false, true); }
/// <summary> /// Reproduce a C.A.S.S.I.E message after a certain amount of seconds. /// </summary> /// <param name="message">The message to be reproduced.</param> /// <param name="delay">The seconds that have to pass, before reproducing the message.</param> /// <param name="isHeld">Indicates whether C.A.S.S.I.E has to hold the message.</param> /// <param name="isNoisy">Indicates whether C.A.S.S.I.E has to make noises or not during the message.</param> public static void DelayedMessage(string message, float delay, bool isHeld = false, bool isNoisy = true) { Timing.CallDelayed(delay, () => RespawnEffectsController.PlayCassieAnnouncement(message, isHeld, isNoisy)); }
/// <summary> /// Reproduce a C.A.S.S.I.E message. /// </summary> /// <param name="message">The message to be reproduced.</param> /// <param name="isHeld">Indicates whether C.A.S.S.I.E has to hold the message.</param> /// <param name="isNoisy">Indicates whether C.A.S.S.I.E has to make noises or not during the message.</param> public static void Message(string message, bool isHeld = false, bool isNoisy = true) => RespawnEffectsController.PlayCassieAnnouncement(message, isHeld, isNoisy);
/*internal void ConsoleCmd(ConsoleCommandEvent ev) * { * if (ev.Player.GetRole() == RoleType.Scp079) * { * string[] args = ev.Command.Split(' '); * if (args[0].Equals(plugin.CommandPrefix)) * { * if (args.Length == 2) * { * if (args[1].ToLower().Equals("help") || args[1].ToLower().Equals("commands") || args[1].ToLower().Equals("?")) * { * ev.ReturnMessage = plugin.HelpMsgTitle + "\n" + * "\"." + plugin.CommandPrefix + " a1\" - " + plugin.HelpMsgA1 + " - " + plugin.A1Power + "+ AP - Tier " + (plugin.A1Tier + 1) + "+\n" + * "\"." + plugin.CommandPrefix + " a2\" - " + plugin.HelpMsgA2 + " - " + plugin.A2Power + "+ AP - Tier " + (plugin.A2Tier + 1) + "+\n" + * "\"." + plugin.CommandPrefix + " a3\" - " + plugin.HelpMsgA3 + " - " + plugin.A3Power + "+ AP - Tier " + (plugin.A3Tier + 1) + "+\n" + * "\"." + plugin.CommandPrefix + " a4\" - " + plugin.HelpMsgA4 + " - " + plugin.A4Power + "+ AP - Tier " + (plugin.A4Tier + 1) + "+\n"; * return; * } * * if (args[1].ToLower().Equals("a1")) * { * if (ev.Player.scp079PlayerScript.NetworkcurLvl < plugin.A1Tier) * { * ev.ReturnMessage = plugin.TierRequiredMsg.Replace("$tier", "" + (plugin.A1Tier + 1)); * return; * } * if (ev.Player.scp079PlayerScript.NetworkcurMana >= plugin.A1Power) * { * ev.Player.scp079PlayerScript.NetworkcurMana -= plugin.A1Power; * } * else * { * ev.ReturnMessage = plugin.NoPowerMsg; * return; * } * var cams = GetSCPCameras(); * if (cams.Count > 0) * { * Camera079 cam = cams[UnityEngine.Random.Range(0, cams.Count)]; * ev.Player.scp079PlayerScript.CmdSwitchCamera(cam.cameraId, false); * ev.ReturnMessage = plugin.RunA1Msg; * return; * } * else * { * ev.ReturnMessage = plugin.FailA1Msg; * ev.Player.scp079PlayerScript.NetworkcurMana += plugin.A1Power; * return; * } * } * * if (args[1].ToLower().Equals("a2")) * { * if (ev.Player.scp079PlayerScript.NetworkcurLvl < plugin.A2Tier) * { * ev.ReturnMessage = plugin.TierRequiredMsg.Replace("$tier", "" + (plugin.A2Tier + 1)); * return; * } * if (ev.Player.scp079PlayerScript.NetworkcurMana >= plugin.A2Power) * { * ev.Player.scp079PlayerScript.NetworkcurMana -= plugin.A2Power; * } * else * { * ev.ReturnMessage = plugin.NoPowerMsg; * return; * } * if (Time.timeSinceLevelLoad - a2cooldown < plugin.A2Cooldown) * { * ev.Player.scp079PlayerScript.NetworkcurMana += plugin.A2Power; * ev.ReturnMessage = plugin.FailA2Msg; * return; * } * Room room = SCP079Room(ev.Player); * if (room == null) * { * ev.Player.scp079PlayerScript.NetworkcurMana += plugin.A2Power; * ev.ReturnMessage = plugin.FailA2Msg; * return; * } * if (room.Zone == ZoneType.Surface) * { * ev.Player.scp079PlayerScript.NetworkcurMana += plugin.A2Power; * ev.ReturnMessage = plugin.FailA2Msg; * return; * } * foreach (var item in plugin.A2BlacklistRooms) * { * if (room.Name.ToLower().Contains(item.ToLower())) * { * ev.Player.scp079PlayerScript.NetworkcurMana += plugin.A2Power; * ev.ReturnMessage = plugin.FailA2Msg; * return; * } * } * Timing.RunCoroutine(GasRoom(room, ev.Player)); * ev.ReturnMessage = plugin.RunA2Msg; * return; * } * * if (args[1].ToLower().Equals("a3")) * { * if (ev.Player.scp079PlayerScript.NetworkcurLvl < plugin.A3Tier) * { * ev.ReturnMessage = plugin.TierRequiredMsg.Replace("$tier", "" + (plugin.A3Tier + 1)); * return; * } * if (ev.Player.scp079PlayerScript.NetworkcurMana >= plugin.A3Power) * { * ev.Player.scp079PlayerScript.NetworkcurMana -= plugin.A3Power; * } * else * { * ev.ReturnMessage = plugin.NoPowerMsg; * return; * } * Generator079.Generators[0].RpcCustomOverchargeForOurBeautifulModCreators(plugin.A3Timer, false); * ev.ReturnMessage = plugin.RunA3Msg; * return; * } * * if (args[1].ToLower().Equals("a4")) * { * if (ev.Player.scp079PlayerScript.NetworkcurLvl < plugin.A4Tier) * { * ev.ReturnMessage = plugin.TierRequiredMsg.Replace("$tier", "" + (plugin.A4Tier + 1)); * return; * } * if (ev.Player.scp079PlayerScript.NetworkcurMana >= plugin.A4Power) * { * ev.Player.scp079PlayerScript.NetworkcurMana -= plugin.A4Power; * } * else * { * ev.ReturnMessage = plugin.NoPowerMsg; * return; * } * var pos = ev.Player.scp079PlayerScript.currentCamera.transform.position; * GrenadeManager gm = ev.Player.GetComponent<GrenadeManager>(); * GrenadeSettings settings = gm.availableGrenades.FirstOrDefault(g => g.inventoryID == ItemType.GrenadeFlash); * FlashGrenade flash = GameObject.Instantiate(settings.grenadeInstance).GetComponent<FlashGrenade>(); * flash.fuseDuration = 0.5f; * flash.InitData(gm, Vector3.zero, Vector3.zero, 1f); * flash.transform.position = pos; * NetworkServer.Spawn(flash.gameObject); * ev.ReturnMessage = plugin.RunA4Msg; * return; * } * ev.ReturnMessage = plugin.HelpMsg.Replace("$prefix", "" + plugin.CommandPrefix); * return; * } * ev.ReturnMessage = plugin.HelpMsg.Replace("$prefix", "" + plugin.CommandPrefix); * return; * } * } * }*/ public static IEnumerator <float> GasRoom(Room room, ReferenceHub scp) { a2cooldown = Time.timeSinceLevelLoad; if (!Better079Plugin.instance.Config.b079_a2_disable_cassie) { string str = ".g4 "; for (int i = Better079Plugin.instance.Config.b079_a2_timer; i > 0f; i--) { str += ". .g4 "; } RespawnEffectsController.PlayCassieAnnouncement(str, false, false); } List <Door> doors = Map.Doors.FindAll((d) => Vector3.Distance(d.transform.position, room.Position) <= 20f); foreach (var item in doors) { item.NetworkisOpen = true; item.Networklocked = true; } for (int i = Better079Plugin.instance.Config.b079_a2_timer; i > 0f; i--) { foreach (var ply in PlayerManager.players) { var player = new Player(ply); if (player.Team != Team.SCP && player.CurrentRoom != null && player.CurrentRoom.Transform == room.Transform) { player.ReferenceHub.hints.Show(new TextHint(Better079Plugin.instance.Config.b079_msg_a2_warn.Replace("$seconds", "" + i), new HintParameter[] { new StringHintParameter("") }, new HintEffect[] { HintEffectPresets.TrailingPulseAlpha(0.5f, 1f, 0.5f, 2f, 0f, 3) }, 1f)); //player.ClearBroadcasts(); //player.Broadcast(1, plugin.A2WarnMsg.Replace("$seconds", "" + i), true); //PlayerManager.localPlayer.GetComponent<MTFRespawn>().RpcPlayCustomAnnouncement(".g3", false, false); } } yield return(Timing.WaitForSeconds(1f)); } foreach (var item in doors) { item.NetworkisOpen = false; item.Networklocked = true; } foreach (var ply in PlayerManager.players) { var player = new Player(ply); if (player.Team != Team.SCP && player.CurrentRoom != null && player.CurrentRoom.Transform == room.Transform) { player.ReferenceHub.hints.Show(new TextHint(Better079Plugin.instance.Config.b079_msg_a2_active, new HintParameter[] { new StringHintParameter("") }, new HintEffect[] { HintEffectPresets.TrailingPulseAlpha(0.5f, 1f, 0.5f, 2f, 0f, 3) }, 5f)); } } for (int i = 0; i < Better079Plugin.instance.Config.b079_a2_gas_timer * 2; i++) { foreach (var ply in PlayerManager.players) { var player = new Player(ply); if (player.Team != Team.SCP && player.Role != RoleType.Spectator && player.CurrentRoom != null && player.CurrentRoom.Transform == room.Transform) { player.ReferenceHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(10f, "WORLD", DamageTypes.Decont, 0), player.ReferenceHub.gameObject); if (player.Role == RoleType.Spectator) { scp.scp079PlayerScript.AddExperience(Better079Plugin.instance.Config.b079_a2_exp); } } } yield return(Timing.WaitForSeconds(0.5f)); } foreach (var item in doors) { item.Networklocked = false; } }