public void OnRoundEnd(EndingRoundEventArgs ev)
 {
     foreach (CoroutineHandle handle in Coroutines)
     {
         Timing.KillCoroutines(handle);
     }
 }
Example #2
0
        public void RoundEnding(EndingRoundEventArgs ev)
        {
            if (ev.IsAllowed == false)
            {
                return;
            }

            if (ev.IsAllowed && plugin.Config.Debug)
            {
                Log.Debug("List of teams:", this.plugin.Config.Debug);
                foreach (KeyValuePair <Player, AdvancedTeam> t in teamedPlayers)
                {
                    Log.Debug(t.Value.Name + " : " + t.Key, this.plugin.Config.Debug);
                }
            }

            // This prevents to finish the round if any team has an active requeriment
            foreach (AdvancedTeam tm in teamedPlayers.Values)
            {
                foreach (AdvancedTeam team in teamedPlayers.Values)
                {
                    if (tm.Requirements.Contains(team.Name))
                    {
                        ev.IsAllowed = false;
                        return;
                    }
                }
            }
        }
Example #3
0
 public void OnCheckRoundEnd(EndingRoundEventArgs ev)
 {
     if (Blackout.active && !isRoundStarted)
     {
         ev.IsAllowed = false;
     }
 }
Example #4
0
 internal void CheckRoundEnd(EndingRoundEventArgs ev)
 {
     if (Player.List.Any(v => v.Team == Team.CHI) && Player.List.Any(b => b.Team == Team.SCP))
     {
         ev.IsAllowed = false;
     }
 }
Example #5
0
 public void AnnonceRestart(EndingRoundEventArgs ev)
 {
     if (IsRestarting)
     {
         Map.Broadcast(10, config.RoundEndText);
     }
 }
Example #6
0
        public void OnEndingRound(EndingRoundEventArgs ev)
        {
            bool mtfAlive        = Extensions.CountRoles(Team.MTF) > 0;
            bool ciAlive         = Extensions.CountRoles(Team.CHI) > 0;
            bool scpAlive        = Extensions.CountRoles(Team.SCP) + Extensions.GetScp035s().Count > 0;
            bool dclassAlive     = Extensions.CountRoles(Team.CDP) > 0;
            bool scientistsAlive = Extensions.CountRoles(Team.RSC) > 0;
            bool shAlive         = API.GetSHPlayers().Count > 0;

            if (shAlive && ((ciAlive && !config.SerpentsHandModifiers.ScpsWinWithChaos) || dclassAlive || mtfAlive || scientistsAlive))
            {
                ev.IsAllowed = false;
            }
            else if (shAlive && scpAlive && !mtfAlive && !dclassAlive && !scientistsAlive)
            {
                if (!config.SerpentsHandModifiers.ScpsWinWithChaos)
                {
                    if (!ciAlive)
                    {
                        ev.LeadingTeam  = LeadingTeam.Anomalies;
                        ev.IsAllowed    = true;
                        ev.IsRoundEnded = true;
                    }
                }
                else
                {
                    ev.LeadingTeam  = LeadingTeam.Anomalies;
                    ev.IsAllowed    = true;
                    ev.IsRoundEnded = true;
                }
            }
        }
Example #7
0
 public void OnRoundEnd(EndingRoundEventArgs ev)
 {
     if (ev.IsRoundEnded == true)
     {
         features.Log.Info($"{ev.LeadingTeam} was the leading team.");
     }
 }
Example #8
0
        private void OnEndingRound(EndingRoundEventArgs ev)
        {
            // https://github.com/Exiled-Team/EXILED/blob/dev/Exiled.Events/Patches/Events/Server/RoundEnd.cs#L90-L129
            RoundSummary.SumInfo_ClassList classList = new RoundSummary.SumInfo_ClassList
            {
                chaos_insurgents    = ev.ClassList.chaos_insurgents,
                class_ds            = ev.ClassList.class_ds - scp343Role.TrackedPlayers.Count,
                mtf_and_guards      = ev.ClassList.mtf_and_guards,
                scientists          = ev.ClassList.scientists,
                scps_except_zombies = ev.ClassList.scps_except_zombies + (scp343Role.RoundCondition.IsScp ? scp343Role.TrackedPlayers.Count : 0),
                time          = ev.ClassList.time,
                warhead_kills = ev.ClassList.warhead_kills,
                zombies       = ev.ClassList.zombies,
            };

            int num1 = classList.mtf_and_guards + classList.scientists;
            int num2 = classList.chaos_insurgents + classList.class_ds;
            int num3 = classList.scps_except_zombies + classList.zombies;
            int num4 = classList.class_ds + RoundSummary.EscapedClassD;
            int num5 = classList.scientists + RoundSummary.EscapedScientists;

            if (classList.class_ds == 0 && num1 == 0)
            {
                ev.IsRoundEnded = true;
            }
            else
            {
                int num8 = 0;
                if (num1 > 0)
                {
                    num8++;
                }
                if (num2 > 0)
                {
                    num8++;
                }
                if (num3 > 0)
                {
                    num8++;
                }
                if (num8 <= 1)
                {
                    ev.IsRoundEnded = true;
                }
            }

            if (num1 > 0 && num5 > 0)
            {
                ev.LeadingTeam = LeadingTeam.FacilityForces;
            }
            else if (num4 > 0)
            {
                ev.LeadingTeam = LeadingTeam.ChaosInsurgency;
            }
            else if (num3 > 0)
            {
                ev.LeadingTeam = LeadingTeam.Anomalies;
            }
        }
Example #9
0
        /// <inheritdoc cref="Events.Handlers.Server.OnEndingRound(EndingRoundEventArgs)"/>
        public void OnEndingRound(EndingRoundEventArgs ev)
        {
            Log.Warn($"The actual leading team is: {ev.LeadingTeam}");

            if (ev.LeadingTeam == RoundSummary.LeadingTeam.Draw)
            {
                ev.IsAllowed = false;
            }
        }
Example #10
0
        /// <inheritdoc cref="Exiled.Events.Handlers.Server.OnEndingRound(EndingRoundEventArgs)"/>
        public void OnEndingRound(EndingRoundEventArgs ev)
        {
            Log.Debug($"The round is ending, fetching leading team...");

            if (ev.LeadingTeam == LeadingTeam.Draw)
            {
                Log.Error($"The round has ended in a draw!");
            }
            else
            {
                Log.Info($"The leading team is actually: {ev.LeadingTeam}.");
            }
        }
Example #11
0
 public void OnRoundEnding(EndingRoundEventArgs ev)
 {
     foreach (Player player in Player.List)
     {
         if (player.HasExtraClass())
         {
             if (!player.GetExtraClass().CanRoundBeEnded(ev.ClassList))
             {
                 ev.IsRoundEnded = false;
                 break;
             }
         }
     }
 }
Example #12
0
 public void CheckRoundEnd(EndingRoundEventArgs ev)
 {
     /*	WIP
      *	int iCheckChaos = 0;
      *      int iCheckClassD = 0;
      *      int iCheckSCP = 0;
      *      int iCheckSci = 0;
      *      int iCheckMTFGuard = 0;
      *
      *      if (ev.Allow)
      *      {
      *              foreach (ReferenceHub hub in Player.GetHubs())
      *              {
      *                      if (hub != null)
      *                      {
      *                              // Count spawned players and add to global variables.
      *                              switch (hub.characterClassManager.CurClass)
      *                              {
      *                                      case RoleType.ChaosInsurgency:
      *                                              iCheckChaos++;
      *                                              break;
      *                                      case RoleType.ClassD:
      *                                              iCheckClassD++;
      *                                              break;
      *                                      case RoleType.Scientist:
      *                                              iCheckSci++;
      *                                              break;
      *                                      case RoleType.Scp049:
      *                                      case RoleType.Scp0492:
      *                                      case RoleType.Scp079:
      *                                      case RoleType.Scp106:
      *                                      case RoleType.Scp173:
      *                                      case RoleType.Scp096:
      *                                      case RoleType.Scp93953:
      *                                      case RoleType.Scp93989:
      *                                              iCheckSCP++;
      *                                              break;
      *                                      case RoleType.FacilityGuard:
      *                                      case RoleType.NtfCadet:
      *                                      case RoleType.NtfLieutenant:
      *                                      case RoleType.NtfCommander:
      *                                      case RoleType.NtfScientist:
      *                                              iCheckMTFGuard++;
      *                                              break;
      *                              }
      *                      }
      *              }
      *      }*/
 }
        public void RoundEnding(EndingRoundEventArgs ev)
        {
            if (AllowNormalRoundEnd && this.plugin.Config.Debug)
            {
                Log.Debug("List of teams:", this.plugin.Config.Debug);
                foreach (KeyValuePair <Player, string> t in teamedPlayers)
                {
                    Log.Debug(t.Value + " : " + t.Key, this.plugin.Config.Debug);
                }
            }

            ev.IsAllowed    = AllowNormalRoundEnd;
            ev.IsRoundEnded = AllowNormalRoundEnd;
            ev.LeadingTeam  = leadingTeam;
        }
Example #14
0
 public void OnEndingRound(EndingRoundEventArgs ev)
 {
     if (scp372.Count > 0)
     {
         if (Player.Get(Team.CDP).ToList().Count == 0 && Player.Get(Team.MTF).ToList().Count == 0 && Player.Get(Team.RSC).ToList().Count == 0)
         {
             ev.LeadingTeam  = LeadingTeam.Anomalies;
             ev.IsRoundEnded = true;
         }
         else
         {
             ev.IsAllowed = false;
         }
     }
 }
Example #15
0
        /// <inheritdoc cref="Exiled.Events.Handlers.Server.OnEndingRound(EndingRoundEventArgs)"/>
        public static void OnEndingRound(EndingRoundEventArgs ev)
        {
            if (!Config.AllowDefaultEndConditions)
            {
                ev.IsAllowed    = false;
                ev.IsRoundEnded = false;
            }

            if (Warhead.IsDetonated && Config.EndOnDetonation)
            {
                Log.Debug("Ending the round via warhead detonation.", Config.AllowDebug);
                EndGame(ev, Config.DetonationWinner);
                return;
            }

            EscapeTracking["-classd"]  = RoundSummary.escaped_ds == 0;
            EscapeTracking["+classd"]  = RoundSummary.escaped_ds > 0;
            EscapeTracking["-science"] = RoundSummary.escaped_scientists == 0;
            EscapeTracking["+science"] = RoundSummary.escaped_scientists > 0;

            IEnumerable <string> roles = GetRoles();

            // Pull all the lists from the core dictionary and check em
            foreach (Condition condition in Conditions.Where(condition => !roles.Except(condition.RoleConditions).Any()))
            {
                Log.Debug($"Using conditions from condition name: '{condition.Name}'", Config.AllowDebug);

                // Check escape conditions
                List <string> failedConditions = ListPool <string> .Shared.Rent(condition.EscapeConditions.Where(cond => !EscapeTracking[cond]));

                if (failedConditions.Count > 0)
                {
                    Log.Debug($"Escape conditions failed at: {string.Join(", ", failedConditions)}", Config.AllowDebug);
                    ListPool <string> .Shared.Return(failedConditions);

                    continue;
                }

                Log.Debug($"Escape checks passed: {string.Join(", ", condition.EscapeConditions)}", Config.AllowDebug);
                ListPool <string> .Shared.Return(failedConditions);

                EndGame(ev, condition.LeadingTeam);
                return;
            }
        }
Example #16
0
        internal static void OnRoundEnding(EndingRoundEventArgs ev)
        {
            if (!ev.IsAllowed || !ev.IsRoundEnded)
            {
                return;
            }

            DidRoundEnd = true;

            HatCommand.HatPlayers.Clear();

            StatHandler.SendRequest(RequestType.RoundEnd);

            Timing.KillCoroutines(coroutines.ToArray());
            coroutines.Clear();

            SpawnsDone.Clear();
        }
Example #17
0
        public void OnCheckRoundEnd(EndingRoundEventArgs ev)
        {
            Player scp035 = null;

            if (SerpentsHand.isScp035)
            {
                scp035 = TryGet035();
            }

            bool MTFAlive        = CountRoles(Team.MTF) > 0;
            bool CiAlive         = CountRoles(Team.CHI) > 0;
            bool ScpAlive        = CountRoles(Team.SCP) + (scp035 != null && scp035.Role != RoleType.Spectator ? 1 : 0) > 0;
            bool DClassAlive     = CountRoles(Team.CDP) > 0;
            bool ScientistsAlive = CountRoles(Team.RSC) > 0;
            bool SHAlive         = shPlayers.Count > 0;

            if (SHAlive && ((CiAlive && !SerpentsHand.instance.Config.ScpsWinWithChaos) || DClassAlive || MTFAlive || ScientistsAlive))
            {
                ev.IsAllowed = false;
                test         = true;
            }
            else if (SHAlive && ScpAlive && !MTFAlive && !DClassAlive && !ScientistsAlive)
            {
                if (!SerpentsHand.instance.Config.ScpsWinWithChaos)
                {
                    if (!CiAlive)
                    {
                        ev.LeadingTeam  = Exiled.API.Enums.LeadingTeam.Anomalies;
                        ev.IsAllowed    = true;
                        ev.IsRoundEnded = true;
                    }
                }
                else
                {
                    ev.LeadingTeam  = Exiled.API.Enums.LeadingTeam.Anomalies;
                    ev.IsAllowed    = true;
                    ev.IsRoundEnded = true;
                }
            }
            else
            {
                test = false;
            }
        }
Example #18
0
        private static void EndGame(EndingRoundEventArgs ev, LeadingTeam leadingTeam)
        {
            ev.LeadingTeam  = leadingTeam;
            ev.IsAllowed    = true;
            ev.IsRoundEnded = true;

            // Force end because people bothered me to put this in
            Round.ForceEnd();

            API.BlacklistedPlayers.Clear();
            API.ModifiedRoles.Clear();

            Log.Debug($"Force ending with {ev.LeadingTeam} as the lead team.", Config.AllowDebug);

            if (Config.RoundEndFf)
            {
                foreach (var player in Player.List)
                {
                    player.IsFriendlyFireEnabled = true;
                }
            }
        }
        private static void ServerEvents_EndingRound(EndingRoundEventArgs ev)
        {
            var classList = ev.ClassList;

            // If Round ending from external source
            if (ev.IsRoundEnded)
            {
                // Make sure it's not because all players are dead.
                if (0 == classList.class_ds +
                    classList.mtf_and_guards +
                    classList.scientists)
                {
                    ev.IsRoundEnded = false;
                }
            }

            // SCP win if lives run out
            if (!ev.IsRoundEnded && LivesLeft <= 0)
            {
                ev.IsRoundEnded = true;
                ev.LeadingTeam  = LeadingTeam.Anomalies;
            }
        }
Example #20
0
        private static IEnumerator <float> Process(RoundSummary roundSummary)
        {
            while (roundSummary != null)
            {
                while (RoundSummary.RoundLock || !RoundSummary.RoundInProgress() || (roundSummary._keepRoundOnOne && PlayerManager.players.Count < 2))
                {
                    yield return(0.0f);
                }
                yield return(0.0f);

                RoundSummary.SumInfo_ClassList newList = default;
                foreach (GameObject player in PlayerManager.players)
                {
                    if (!(player == null))
                    {
                        CharacterClassManager component = player.GetComponent <CharacterClassManager>();
                        if (component.Classes.CheckBounds(component.CurClass))
                        {
                            switch (component.Classes.SafeGet(component.CurClass).team)
                            {
                            case Team.SCP:
                                if (component.CurClass == RoleType.Scp0492)
                                {
                                    ++newList.zombies;
                                    continue;
                                }

                                ++newList.scps_except_zombies;
                                continue;

                            case Team.MTF:
                                ++newList.mtf_and_guards;
                                continue;

                            case Team.CHI:
                                ++newList.chaos_insurgents;
                                continue;

                            case Team.RSC:
                                ++newList.scientists;
                                continue;

                            case Team.CDP:
                                ++newList.class_ds;
                                continue;

                            default:
                                continue;
                            }
                        }
                    }
                }

                newList.warhead_kills = AlphaWarheadController.Host.detonated ? AlphaWarheadController.Host.warheadKills : -1;
                yield return(float.NegativeInfinity);

                newList.time = (int)Time.realtimeSinceStartup;
                yield return(float.NegativeInfinity);

                RoundSummary.roundTime = newList.time - roundSummary.classlistStart.time;
                int   num1 = newList.mtf_and_guards + newList.scientists;
                int   num2 = newList.chaos_insurgents + newList.class_ds;
                int   num3 = newList.scps_except_zombies + newList.zombies;
                float num4 = roundSummary.classlistStart.class_ds == 0 ? 0.0f : (RoundSummary.escaped_ds + newList.class_ds) / roundSummary.classlistStart.class_ds;
                float num5 = roundSummary.classlistStart.scientists == 0 ? 1f : (RoundSummary.escaped_scientists + newList.scientists) / roundSummary.classlistStart.scientists;

                if (newList.class_ds == 0 && num1 == 0)
                {
                    roundSummary._roundEnded = true;
                }
                else
                {
                    int num6 = 0;
                    if (num1 > 0)
                    {
                        ++num6;
                    }
                    if (num2 > 0)
                    {
                        ++num6;
                    }
                    if (num3 > 0)
                    {
                        ++num6;
                    }
                    if (num6 <= 1)
                    {
                        roundSummary._roundEnded = true;
                    }
                }

                var endingRoundEventArgs = new EndingRoundEventArgs(LeadingTeam.Draw, newList, roundSummary._roundEnded);

                if (num1 > 0)
                {
                    if (RoundSummary.escaped_ds == 0 && RoundSummary.escaped_scientists != 0)
                    {
                        endingRoundEventArgs.LeadingTeam = LeadingTeam.FacilityForces;
                    }
                }
                else
                {
                    endingRoundEventArgs.LeadingTeam = RoundSummary.escaped_ds != 0 ? LeadingTeam.ChaosInsurgency : LeadingTeam.Anomalies;
                }

                Server.OnEndingRound(endingRoundEventArgs);

                roundSummary._roundEnded = endingRoundEventArgs.IsRoundEnded && endingRoundEventArgs.IsAllowed;

                if (roundSummary._roundEnded)
                {
                    FriendlyFireConfig.PauseDetector = true;
                    string str = "Round finished! Anomalies: " + num3 + " | Chaos: " + num2 + " | Facility Forces: " + num1 + " | D escaped percentage: " + num4 + " | S escaped percentage: : " + num5;
                    Console.AddLog(str, Color.gray, false);
                    ServerLogs.AddLog(ServerLogs.Modules.Logger, str, ServerLogs.ServerLogType.GameEvent);
                    byte i1;
                    for (i1 = 0; i1 < 75; ++i1)
                    {
                        yield return(0.0f);
                    }
                    int timeToRoundRestart = Mathf.Clamp(ConfigFile.ServerConfig.GetInt("auto_round_restart_time", 10), 5, 1000);

                    if (roundSummary != null)
                    {
                        newList.scps_except_zombies -= newList.zombies;

                        var roundEndedEventArgs = new RoundEndedEventArgs(endingRoundEventArgs.LeadingTeam, newList, timeToRoundRestart);

                        Server.OnRoundEnded(roundEndedEventArgs);

                        roundSummary.RpcShowRoundSummary(roundSummary.classlistStart, roundEndedEventArgs.ClassList, (RoundSummary.LeadingTeam)roundEndedEventArgs.LeadingTeam, RoundSummary.escaped_ds, RoundSummary.escaped_scientists, RoundSummary.kills_by_scp, roundEndedEventArgs.TimeToRestart);
                    }

                    for (int i2 = 0; i2 < 50 * (timeToRoundRestart - 1); ++i2)
                    {
                        yield return(0.0f);
                    }
                    roundSummary.RpcDimScreen();
                    for (i1 = 0; i1 < 50; ++i1)
                    {
                        yield return(0.0f);
                    }
                    PlayerManager.localPlayer.GetComponent <PlayerStats>().Roundrestart();
                    yield break;
                }
            }
        }
Example #21
0
 /// <summary>
 /// Called before ending a round.
 /// </summary>
 /// <param name="ev">The <see cref="EndingRoundEventArgs"/> instance.</param>
 public static void OnEndingRound(EndingRoundEventArgs ev) => EndingRound.InvokeSafely(ev);
Example #22
0
        private static IEnumerator <float> Process(RoundSummary roundSummary)
        {
            float time = Time.unscaledTime;

            while (roundSummary != null)
            {
                yield return(Timing.WaitForSeconds(2.5f));

                while (RoundSummary.RoundLock || !RoundSummary.RoundInProgress() || Time.unscaledTime - time < 15f || (roundSummary._keepRoundOnOne && PlayerManager.players.Count < 2))
                {
                    yield return(Timing.WaitForOneFrame);
                }

                RoundSummary.SumInfo_ClassList newList = default;
                foreach (KeyValuePair <GameObject, ReferenceHub> keyValuePair in ReferenceHub.GetAllHubs())
                {
                    if (keyValuePair.Value == null)
                    {
                        continue;
                    }

                    CharacterClassManager component = keyValuePair.Value.characterClassManager;
                    if (component.Classes.CheckBounds(component.CurClass))
                    {
                        switch (component.CurRole.team)
                        {
                        case Team.SCP:
                            if (component.CurClass == RoleType.Scp0492)
                            {
                                newList.zombies++;
                            }
                            else
                            {
                                newList.scps_except_zombies++;
                            }
                            continue;

                        case Team.MTF:
                            newList.mtf_and_guards++;
                            continue;

                        case Team.CHI:
                            newList.chaos_insurgents++;
                            continue;

                        case Team.RSC:
                            newList.scientists++;
                            continue;

                        case Team.CDP:
                            newList.class_ds++;
                            continue;

                        default:
                            continue;
                        }
                    }
                }

                yield return(Timing.WaitForOneFrame);

                newList.warhead_kills = AlphaWarheadController.Host.detonated ? AlphaWarheadController.Host.warheadKills : -1;
                yield return(Timing.WaitForOneFrame);

                newList.time = (int)Time.realtimeSinceStartup;
                yield return(Timing.WaitForOneFrame);

                RoundSummary.roundTime = newList.time - roundSummary.classlistStart.time;
                int   num1 = newList.mtf_and_guards + newList.scientists;
                int   num2 = newList.chaos_insurgents + newList.class_ds;
                int   num3 = newList.scps_except_zombies + newList.zombies;
                int   num4 = newList.class_ds + RoundSummary.EscapedClassD;
                int   num5 = newList.scientists + RoundSummary.EscapedScientists;
                float num6 = (roundSummary.classlistStart.class_ds == 0) ? 0f : (num4 / roundSummary.classlistStart.class_ds);
                float num7 = (roundSummary.classlistStart.scientists == 0) ? 1f : (num5 / roundSummary.classlistStart.scientists);

                if (newList.class_ds == 0 && num1 == 0)
                {
                    roundSummary.RoundEnded = true;
                }
                else
                {
                    int num8 = 0;
                    if (num1 > 0)
                    {
                        num8++;
                    }
                    if (num2 > 0)
                    {
                        num8++;
                    }
                    if (num3 > 0)
                    {
                        num8++;
                    }
                    if (num8 <= 1)
                    {
                        roundSummary.RoundEnded = true;
                    }
                }

                EndingRoundEventArgs endingRoundEventArgs = new EndingRoundEventArgs(LeadingTeam.Draw, newList, roundSummary.RoundEnded);

                if (num1 > 0)
                {
                    if (num5 > 0)
                    {
                        endingRoundEventArgs.LeadingTeam = LeadingTeam.FacilityForces;
                    }
                }
                else if (num4 > 0)
                {
                    endingRoundEventArgs.LeadingTeam = LeadingTeam.ChaosInsurgency;
                }
                else if (num3 > 0)
                {
                    endingRoundEventArgs.LeadingTeam = LeadingTeam.Anomalies;
                }

                Server.OnEndingRound(endingRoundEventArgs);

                roundSummary.RoundEnded = endingRoundEventArgs.IsRoundEnded && endingRoundEventArgs.IsAllowed;

                if (roundSummary.RoundEnded)
                {
                    FriendlyFireConfig.PauseDetector = true;
                    string str = "Round finished! Anomalies: " + num3 + " | Chaos: " + num2 + " | Facility Forces: " + num1 + " | D escaped percentage: " + num6 + " | S escaped percentage: : " + num7;
                    Console.AddLog(str, Color.gray, false);
                    ServerLogs.AddLog(ServerLogs.Modules.Logger, str, ServerLogs.ServerLogType.GameEvent);
                    yield return(Timing.WaitForSeconds(1.5f));

                    int timeToRoundRestart = Mathf.Clamp(ConfigFile.ServerConfig.GetInt("auto_round_restart_time", 10), 5, 1000);

                    if (roundSummary != null)
                    {
                        RoundEndedEventArgs roundEndedEventArgs = new RoundEndedEventArgs(endingRoundEventArgs.LeadingTeam, newList, timeToRoundRestart);

                        Server.OnRoundEnded(roundEndedEventArgs);

                        roundSummary.RpcShowRoundSummary(roundSummary.classlistStart, roundEndedEventArgs.ClassList, (RoundSummary.LeadingTeam)roundEndedEventArgs.LeadingTeam, RoundSummary.EscapedClassD, RoundSummary.EscapedScientists, RoundSummary.KilledBySCPs, roundEndedEventArgs.TimeToRestart);
                    }

                    yield return(Timing.WaitForSeconds(timeToRoundRestart - 1));

                    roundSummary.RpcDimScreen();
                    yield return(Timing.WaitForSeconds(1f));

                    RoundRestart.InitiateRoundRestart();
                    yield break;
                }
            }
        }
Example #23
0
 public void EndRoundCheck(EndingRoundEventArgs ev)
 {
     if (plugin.canBuy)
     {
         ev.IsAllowed    = false;
         ev.IsRoundEnded = false;
         return;
     }
     CI  = Player.List.Where(p => p.Role == plugin.Config.CIRole).Count();
     NTF = Player.List.Where(p => p.Role == plugin.Config.NTFRole).Count();
     if (NTF == 0)
     {
         /*foreach (var plr in Player.List)
          * {
          *  if (plr.Role != plugin.Config.CIRole)
          *  {
          *      plr.Kill();
          *  }
          * }*/
         Map.Broadcast(10, plugin.Config.RoundCIWin);
         ev.IsAllowed    = true;
         ev.IsRoundEnded = true;
         ev.LeadingTeam  = RoundSummary.LeadingTeam.ChaosInsurgency;
         AddMoney(plugin.Config.RoundWinMoney, CIList);
         AddMoney(plugin.Config.RoundLoseMoney, NTFList);
         Timing.RunCoroutine(SaveInventory());
     }
     else if (CI == 0 && bombPlanted && bombTimer > 0f)
     {
         ev.IsAllowed    = false;
         ev.IsRoundEnded = false;
     }
     else if (CI == 0 && !bombPlanted)
     {
         /*foreach (var plr in Player.List)
          * {
          *  if (plr.Role != plugin.Config.NTFRole)
          *  {
          *      plr.Kill();
          *  }
          * }*/
         Map.Broadcast(5, plugin.Config.RoundNTFWin);
         ev.IsAllowed    = true;
         ev.IsRoundEnded = true;
         ev.LeadingTeam  = RoundSummary.LeadingTeam.FacilityForces;
         AddMoney(plugin.Config.RoundWinMoney, NTFList);
         AddMoney(plugin.Config.RoundLoseMoney, CIList);
         Timing.RunCoroutine(SaveInventory());
     }
     else if (timeLeft <= 0f)
     {
         /*foreach (var plr in Player.List)
          * {
          *  plr.Kill();
          * }*/
         Map.Broadcast(10, plugin.Config.RoundNTFWin);
         ev.IsAllowed    = true;
         ev.IsRoundEnded = true;
         ev.LeadingTeam  = RoundSummary.LeadingTeam.FacilityForces;
         AddMoney(plugin.Config.RoundWinMoney, NTFList);
         AddMoney(plugin.Config.RoundLoseMoney, CIList);
         Timing.RunCoroutine(SaveInventory());
     }
     else if (bombTimer <= 0f && bombPlanted)
     {
         try
         {
             foreach (var plr in Player.List)
             {
                 if (Vector3.Distance(plr.Position, bomb.Networkposition) <= plugin.Config.BombExplodeDistance)
                 {
                     plr.Kill();
                 }
             }
         }
         catch (Exception e)
         {
             Exiled.API.Features.Log.Error(e);
         }
         Map.Broadcast(10, plugin.Config.BombExplodeText);
         ev.IsAllowed    = true;
         ev.IsRoundEnded = true;
         ev.LeadingTeam  = RoundSummary.LeadingTeam.ChaosInsurgency;
         AddMoney(plugin.Config.RoundWinMoney, CIList);
         AddMoney(plugin.Config.RoundLoseMoney, NTFList);
         Timing.RunCoroutine(SaveInventory());
     }
     else if (bombDiffused)
     {
         /*foreach (var plr in Player.List)
          * {
          *  if (plr.Role != plugin.Config.NTFRole)
          *  {
          *      plr.Kill();
          *  }
          * }*/
         Map.Broadcast(5, plugin.Config.BombDiffuseText);
         ev.IsAllowed    = true;
         ev.IsRoundEnded = true;
         ev.LeadingTeam  = RoundSummary.LeadingTeam.FacilityForces;
         AddMoney(plugin.Config.RoundWinMoney, NTFList);
         AddMoney(plugin.Config.RoundLoseMoney, CIList);
         Timing.RunCoroutine(SaveInventory());
     }
     else
     {
         ev.IsAllowed    = false;
         ev.IsRoundEnded = false;
     }
 }
 public void onRoundEnd(EndingRoundEventArgs ev)
 {
     Server.FriendlyFire = true;
 }