Esempio n. 1
0
        /// <summary>
        /// Removes ArenaTeamMember from the arena team
        /// </summary>
        /// <param name="member">member to remove</param>
        /// <param name="update">if false, changes to the team will not be promoted anymore (used when the team is being disbanded)</param>
        public bool RemoveMember(ArenaTeamMember member, bool update)
        {
            OnRemoveMember(member);

            if (update && member == m_leader)
            {
                OnLeaderDeleted();
            }

            if (m_leader == null)
            {
                // Team has been disbanded
                return(true);
            }

            m_syncRoot.Enter();
            try
            {
                if (!Members.Remove(member.Id))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                LogUtil.ErrorException(e, string.Format("Could not delete member {0} from arena team {1}", member.Name,
                                                        this));
                return(false);
            }
            finally
            {
                m_syncRoot.Exit();
            }

            if (update)
            {
                //ArenaTeamHandler.SendEventToTeam(this, ArenaTeamEvents.LEAVED_SS, member);
            }

            RealmServer.IOQueue.AddMessage(() =>
            {
                member.Delete();
                if (update)
                {
                    Update();
                }
            });
            return(true);
        }
Esempio n. 2
0
        /// <summary>Removes ArenaTeamMember from the arena team</summary>
        /// <param name="member">member to remove</param>
        /// <param name="update">if false, changes to the team will not be promoted anymore (used when the team is being disbanded)</param>
        public bool RemoveMember(ArenaTeamMember member, bool update)
        {
            this.OnRemoveMember(member);
            if (update && member == this.m_leader)
            {
                this.OnLeaderDeleted();
            }
            if (this.m_leader == null)
            {
                return(true);
            }
            this.m_syncRoot.Enter();
            try
            {
                if (!this.Members.Remove(member.Id))
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogUtil.ErrorException(ex,
                                       string.Format("Could not delete member {0} from arena team {1}", (object)member.Name,
                                                     (object)this), new object[0]);
                return(false);
            }
            finally
            {
                this.m_syncRoot.Exit();
            }

            int num = update ? 1 : 0;

            ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() =>
            {
                member.Delete();
                if (!update)
                {
                    return;
                }
                this.Update();
            }));

            return(true);
        }