Exemple #1
0
        public override void OnDelete()
        {
            Queue m_TeamsQueue       = new Queue();
            Queue m_ParticipantQueue = new Queue();

            foreach (ArenaTeam arenaTeam in m_Teams)
            {
                if (arenaTeam == null)
                {
                    continue;
                }

                m_TeamsQueue.Enqueue(arenaTeam);

                foreach (ArenaParticipant participant in arenaTeam.m_Participants)
                {
                    if (participant == null)
                    {
                        continue;
                    }

                    m_ParticipantQueue.Enqueue(participant);

                    if (participant.m_Player != null)
                    {
                        participant.m_Player.m_ArenaPlayerSettings.m_ArenaMatch = null;
                    }
                }
            }

            while (m_ParticipantQueue.Count > 0)
            {
                ArenaParticipant arenaParticipant = (ArenaParticipant)m_ParticipantQueue.Dequeue();

                arenaParticipant.Delete();
            }

            while (m_TeamsQueue.Count > 0)
            {
                ArenaTeam arenaTeam = (ArenaTeam)m_TeamsQueue.Dequeue();

                arenaTeam.Delete();
            }

            if (m_ArenaGroupController != null)
            {
                if (m_ArenaGroupController.m_MatchListings.Contains(this))
                {
                    m_ArenaGroupController.m_MatchListings.Remove(this);
                }
            }

            if (m_ArenaMatchResultEntry != null)
            {
                m_ArenaMatchResultEntry.Delete();
            }

            base.OnDelete();
        }
Exemple #2
0
        public void CancelMatch()
        {
            BroadcastMessage("The current arena match you were in has been canceled.", 1256);

            List <PlayerMobile> m_Players = new List <PlayerMobile>();

            Queue m_TeamsQueue       = new Queue();
            Queue m_ParticipantQueue = new Queue();

            foreach (ArenaTeam arenaTeam in m_Teams)
            {
                if (arenaTeam == null)
                {
                    continue;
                }

                m_TeamsQueue.Enqueue(arenaTeam);

                foreach (ArenaParticipant participant in arenaTeam.m_Participants)
                {
                    if (participant == null)
                    {
                        continue;
                    }

                    m_ParticipantQueue.Enqueue(participant);

                    if (participant.m_Player != null)
                    {
                        m_Players.Add(participant.m_Player);
                    }

                    if (participant.m_Player != null)
                    {
                        participant.m_Player.m_ArenaPlayerSettings.m_ArenaMatch = null;
                    }
                }
            }

            while (m_ParticipantQueue.Count > 0)
            {
                ArenaParticipant arenaParticipant = (ArenaParticipant)m_ParticipantQueue.Dequeue();

                arenaParticipant.Delete();
            }

            while (m_TeamsQueue.Count > 0)
            {
                ArenaTeam arenaTeam = (ArenaTeam)m_TeamsQueue.Dequeue();

                arenaTeam.Delete();
            }

            Delete();

            foreach (PlayerMobile player in m_Players)
            {
                if (player.HasGump(typeof(ArenaGump)) && player.m_ArenaGumpObject != null)
                {
                    player.CloseGump(typeof(ArenaGump));
                    player.SendGump(new ArenaGump(player, player.m_ArenaGumpObject));
                }
            }
        }
Exemple #3
0
        public void LeaveMatch(PlayerMobile player, bool broadcast, bool gumpUpdateParticipants)
        {
            if (!IsValidArenaMatch(this, null, false))
            {
                return;
            }

            if (player == null)
            {
                return;
            }

            string playerName = player.RawName;

            ArenaTeam        playerTeam        = null;
            ArenaParticipant playerParticipant = null;

            foreach (ArenaTeam team in m_Teams)
            {
                if (team == null)
                {
                    continue;
                }
                if (team.Deleted)
                {
                    continue;
                }

                foreach (ArenaParticipant participant in team.m_Participants)
                {
                    if (participant == null)
                    {
                        continue;
                    }
                    if (participant.Deleted)
                    {
                        continue;
                    }
                    if (participant.m_Player == null)
                    {
                        continue;
                    }

                    if (participant.m_Player == player)
                    {
                        playerTeam        = team;
                        playerParticipant = participant;

                        break;
                    }
                }
            }

            if (playerTeam != null && playerParticipant != null)
            {
                if (playerTeam.m_Participants.Contains(playerParticipant))
                {
                    playerTeam.m_Participants.Remove(playerParticipant);
                }

                playerParticipant.Delete();

                player.m_ArenaPlayerSettings.m_ArenaMatch = null;
            }

            if (player == m_Creator)
            {
                CancelMatch();
            }

            else
            {
                if (broadcast)
                {
                    BroadcastMessage(playerName + " has left the match.", 0);
                }
            }

            if (gumpUpdateParticipants)
            {
                ParticipantsForceGumpUpdate();
            }
        }