/// <summary>
 /// sets the match timer to update every 60 seconds
 /// </summary>
 private void LoadMatchTimer()
 {
     if (MatchTimer.IsEnabled)
     {
         MatchTimer.Stop();
     }
     MatchTimer          = new DispatcherTimer();
     MatchTimer.Interval = TimeSpan.FromSeconds(60);
     MatchTimer.Tick    += MatchTimer_Tick;
     MatchTimer.Start();
 }
Exemple #2
0
        public void EndDeathmatch(bool worldLoaded)
        {
            if (m_MatchTimer != null)
            {
                m_MatchTimer.Stop();
            }

            PvpCore.RemoveRunningDM();
            CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "A deathmatch has ended");

            if (m_ScoreTable != null && m_ScoreTable.Count > 0)
            {
                List <ScoreKeeper> scoreKeeperList = new List <ScoreKeeper>(m_ScoreTable.Values);

                scoreKeeperList.Sort();

                if (scoreKeeperList[0] != null && worldLoaded)
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, String.Format("{0} has won the deathmatch!", scoreKeeperList[0].Player.Name));
                    RewardPlayers(scoreKeeperList);
                }
            }

            if (Contestants != null && Contestants.Count > 0)
            {
                List <Mobile> removeList = new List <Mobile>(Contestants);
                foreach (Mobile m in removeList)
                {
                    ShowScore(m);
                    RemovePlayer(m, false);
                }
            }

            m_Started = false;
            m_AcceptingContestants = false;

            m_ScoreTable       = new Dictionary <Serial, ScoreKeeper>();
            m_LatestSpawnPoint = new Dictionary <Serial, DMSpawnPoint>();
            Contestants        = new List <Mobile>();

            if (EndlessMatches)
            {
                Started = true;
            }
        }