public static void Postfix(ref SpawnableTeamType __result) { if (__result == SpawnableTeamType.ChaosInsurgency) { Extensions.CalculateChance(); } }
/// <summary> /// Initializes a new instance of the <see cref="RespawningTeamEventArgs"/> class. /// </summary> /// <param name="players"><inheritdoc cref="Players"/></param> /// <param name="maxRespawn"><inheritdoc cref="MaximumRespawnAmount"/></param> /// <param name="nextKnownTeam"><inheritdoc cref="NextKnownTeam"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public RespawningTeamEventArgs(List <Player> players, int maxRespawn, SpawnableTeamType nextKnownTeam, bool isAllowed = true) { Players = players; MaximumRespawnAmount = Mathf.Min(maxRespawn, nextKnownTeam == SpawnableTeamType.ChaosInsurgency ? RespawnWaveGenerator.GetConfigLimit("maximum_CI_respawn_amount", 15) : RespawnWaveGenerator.GetConfigLimit("maximum_MTF_respawn_amount", 15)); this.nextKnownTeam = nextKnownTeam; IsAllowed = isAllowed; }
public static void Postfix(RespawnManager __instance, SpawnableTeamType teamToSpawn) { int counter = 0; foreach (Player Ply in Player.List) { if (Ply.Role.IsNotHuman(true)) { counter++; } } if (CreativeToolbox.ConfigRef.Config.EnableRandomChaosInsurgencyAnnouncementChance) { NewChance = CIAnnouncementChance.Next(0, 100); if (NewChance < CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementChance) { if (CreativeToolbox.ConfigRef.Config.EnableCustomAnnouncements && teamToSpawn == SpawnableTeamType.ChaosInsurgency) { NineTailedFoxAnnouncer.singleton.ServerOnlyAddGlitchyPhrase(CreativeToolboxEventHandler.FormatMessage(CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncement, counter), CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementGlitchChance * 0.01f, CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementJamChance * 0.01f); } } } else if (CreativeToolbox.ConfigRef.Config.EnableCustomAnnouncements && teamToSpawn == SpawnableTeamType.ChaosInsurgency) { NineTailedFoxAnnouncer.singleton.ServerOnlyAddGlitchyPhrase(CreativeToolboxEventHandler.FormatMessage(CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncement, counter), CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementGlitchChance * 0.01f, CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementJamChance * 0.01f); } }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { if (!((CommandSender)sender).CheckPermission("fctrl.respawn")) { response = "Access denied."; return(false); } if (arguments.Count() < 1) { response = "Proper usage: \"forcerespawn (mtf/chaos)\""; return(false); } if (arguments.At(0).ToLower() != "mtf" && arguments.At(0).ToLower() != "chaos") { response = "Provided argument must be \"mtf\" or \"chaos\"."; return(false); } SpawnableTeamType spawningTeam = (arguments.At(0).ToLower() == "mtf" ? SpawnableTeamType.NineTailedFox : SpawnableTeamType.ChaosInsurgency); float length = (spawningTeam == SpawnableTeamType.NineTailedFox ? 18f : 13f); RespawnManager.Singleton.RestartSequence(); // Prevent the opposite team from spawning while the forced team's animation is playing. RespawnEffectsController.ExecuteAllEffects(RespawnEffectsController.EffectType.Selection, spawningTeam); Timing.CallDelayed(length, () => { RespawnManager.Singleton.ForceSpawnTeam(spawningTeam); }); response = $"Forcing {spawningTeam} spawn..."; return(true); }
/// <summary> /// Initializes a new instance of the <see cref="RespawningTeamEventArgs"/> class. /// </summary> /// <param name="players"><inheritdoc cref="Players"/></param> /// <param name="maxRespawn"><inheritdoc cref="MaximumRespawnAmount"/></param> /// <param name="nextKnownTeam"><inheritdoc cref="NextKnownTeam"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public RespawningTeamEventArgs(List <Player> players, int maxRespawn, SpawnableTeamType nextKnownTeam, bool isAllowed = true) { Players = players; MaximumRespawnAmount = maxRespawn; NextKnownTeam = nextKnownTeam; IsAllowed = isAllowed; }
/// <summary> /// Forces a spawn of the given <see cref="SpawnableTeamType"/>. /// </summary> /// <param name="team">The <see cref="SpawnableTeamType"/> to spawn.</param> /// <param name="playEffects">Whether or not effects will be played with the spawn.</param> public static void ForceWave(SpawnableTeamType team, bool playEffects = false) { RespawnManager.Singleton.ForceSpawnTeam(team); if (playEffects) { RespawnEffectsController.ExecuteAllEffects(RespawnEffectsController.EffectType.Selection, team); } }
private static bool Prefix(RespawnTickets __instance, ref SpawnableTeamType __result) { bool flag = false; foreach (KeyValuePair <GameObject, ReferenceHub> allHub in ReferenceHub.GetAllHubs()) { if ((allHub.Value.characterClassManager.CurClass == RoleType.Spectator && !allHub.Value.serverRoles.OverwatchEnabled) || API.IsGhost(Player.Get(allHub.Value))) { flag = true; break; } } if (!flag) { __result = SpawnableTeamType.None; } List <SpawnableTeamType> list1 = ListPool <SpawnableTeamType> .Shared.Rent(); List <SpawnableTeamType> list2 = ListPool <SpawnableTeamType> .Shared.Rent(); foreach (KeyValuePair <SpawnableTeamType, int> ticket in __instance._tickets) { if (ticket.Value > 0) { for (int index = 0; index < ticket.Value; ++index) { list1.Add(ticket.Key); } } else { if (ticket.Value == 0 && RespawnWaveGenerator.SpawnableTeams.TryGetValue(ticket.Key, out var spawnableTeam) && spawnableTeam.LockUponZero) { list2.Add(ticket.Key); } } } while (list2.Count > 0) { __instance._tickets[list2[0]] = -1; list2.RemoveAt(0); } int num = list1.Count == 0 ? 1 : (int)list1[Random.Range(0, list1.Count)]; ListPool <SpawnableTeamType> .Shared.Return(list1); ListPool <SpawnableTeamType> .Shared.Return(list2); __result = (SpawnableTeamType)num; return(false); }
/// <inheritdoc/> public static void Postfix(ref SpawnableTeamType __result) { try { if (__result == SpawnableTeamType.NineTailedFox) { EventHandlers.CalculateChance(); } } catch (Exception e) { Log.Error(e); } }
public static void Postfix(RespawnManager __instance, SpawnableTeamType teamToSpawn) { if (CreativeToolbox.ConfigRef.Config.EnableRandomChaosInsurgencyAnnouncementChance) { NewChance = CIAnnouncementChance.Next(0, 100); if (NewChance < CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementChance) { if (CreativeToolbox.ConfigRef.Config.EnableCustomAnnouncements && teamToSpawn == SpawnableTeamType.ChaosInsurgency) { NineTailedFoxAnnouncer.singleton.ServerOnlyAddGlitchyPhrase(CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncement, CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementGlitchChance * 0.01f, CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementJamChance * 0.01f); } } } else { if (CreativeToolbox.ConfigRef.Config.EnableCustomAnnouncements && teamToSpawn == SpawnableTeamType.ChaosInsurgency) { NineTailedFoxAnnouncer.singleton.ServerOnlyAddGlitchyPhrase(CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncement, CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementGlitchChance * 0.01f, CreativeToolbox.ConfigRef.Config.ChaosInsurgencyAnnouncementJamChance * 0.01f); } } }
private static void Postfix(RespawnManager __instance, SpawnableTeamType teamToSpawn) { int counter = 0; foreach (Player ply in Player.List) { if (ply.Team == Team.SCP) { counter++; } } if (Instance.Config.EnableRandomChaosInsurgencyAnnouncementChance) { _newChance = CiAnnouncementChance.Next(0, 100); if (!(_newChance < Instance.Config.ChaosInsurgencyAnnouncementChance)) { return; } if (Instance.Config.EnableCustomAnnouncements && teamToSpawn == SpawnableTeamType.ChaosInsurgency) { NineTailedFoxAnnouncer.singleton.ServerOnlyAddGlitchyPhrase( CreativeToolboxEventHandler.FormatMessage(Instance.Config.ChaosInsurgencyAnnouncement, counter), Instance.Config.ChaosInsurgencyAnnouncementGlitchChance * 0.01f, Instance.Config.ChaosInsurgencyAnnouncementJamChance * 0.01f); } } else if (Instance.Config.EnableCustomAnnouncements && teamToSpawn == SpawnableTeamType.ChaosInsurgency) { NineTailedFoxAnnouncer.singleton.ServerOnlyAddGlitchyPhrase( CreativeToolboxEventHandler.FormatMessage(Instance.Config.ChaosInsurgencyAnnouncement, counter), Instance.Config.ChaosInsurgencyAnnouncementGlitchChance * 0.01f, Instance.Config.ChaosInsurgencyAnnouncementJamChance * 0.01f); } }
/// <summary> /// Grants tickets to a <see cref="SpawnableTeamType"/>. /// </summary> /// <param name="team">The <see cref="SpawnableTeamType"/> to grant tickets to.</param> /// <param name="amount">The amount of tickets to grant.</param> /// <param name="overrideLocks">Whether or not to override ticket locks.</param> /// <returns>Whether or not tickets were granted successfully.</returns> public static bool GrantTickets(SpawnableTeamType team, int amount, bool overrideLocks = false) => RespawnTickets.Singleton.GrantTickets(team, amount, overrideLocks);
/// <summary> /// Initializes a new instance of the <see cref="RespawningTeamEventArgs"/> class. /// </summary> /// <param name="players"><inheritdoc cref="Players"/></param> /// <param name="maximumRespawnAmount"><inheritdoc cref="MaximumRespawnAmount"/></param> /// <param name="nextKnownTeam"><inheritdoc cref="NextKnownTeam"/></param> public RespawningTeamEventArgs(List <Player> players, int maximumRespawnAmount, SpawnableTeamType nextKnownTeam) { Players = players; MaximumRespawnAmount = maximumRespawnAmount; NextKnownTeam = nextKnownTeam; }
/// <summary> /// Initializes a new instance of the <see cref="RespawningTeamEventArgs"/> class. /// </summary> /// <param name="players"><inheritdoc cref="Players"/></param> /// <param name="nextKnownTeam"><inheritdoc cref="NextKnownTeam"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public RespawningTeamEventArgs(List <Player> players, SpawnableTeamType nextKnownTeam, bool isAllowed = true) { Players = players; NextKnownTeam = nextKnownTeam; IsAllowed = isAllowed; }