Пример #1
0
        /// <summary>
        /// Removes GuildMember from the guild
        /// </summary>
        /// <param name="member">member to remove</param>
        /// <param name="update">if false, changes to the guild will not be promoted anymore (used when the Guild is being disbanded)</param>
        public bool RemoveMember(GuildMember member, bool update)
        {
            OnRemoveMember(member);

            if (update && member == m_leader)
            {
                Disband();
                return(true);
            }

            using (syncRoot.Enter())
            {
                if (!Members.Remove(member.Id))
                {
                    return(false);
                }
            }

            if (update)
            {
                EventLog.AddLeaveEvent(member.Id);
                GuildHandler.SendEventToGuild(this, GuildEvents.LEFT, member);
            }

            RealmServer.IOQueue.AddMessage(() =>
            {
                member.Delete();
                if (update)
                {
                    Update();
                }
            });
            return(true);
        }
Пример #2
0
        /// <summary>
        /// Removes GuildMember from the guild
        /// </summary>
        /// <param name="member">member to remove</param>
        /// <param name="update">if false, changes to the guild will not be promoted anymore (used when the Guild is being disbanded)</param>
        public bool RemoveMember(GuildMember member, bool update, bool kicked = false)
        {
            AddHistoryMessage(kicked ? Asda2GuildHistoryType.Kicked : Asda2GuildHistoryType.Left, 0, member.Name, DateTime.Now.ToLongTimeString());
            if (member.Character != null)
            {
                foreach (var activeSkill in ActiveSkills)
                {
                    activeSkill.RemoveFromCharacter(member.Character);
                }
            }
            if (update)
            {
                EventLog.AddLeaveEvent(member.Id);
                Asda2GuildHandler.SendGuildNotificationResponse(this, kicked ? GuildNotificationType.Kicked : GuildNotificationType.Left, member);
                //GuildHandler.SendEventToGuild(this, GuildEvents.LEFT, member);
            }
            OnRemoveMember(member);

            if (update && member == m_leader)
            {
                Disband();
                return(true);
            }

            /*using (syncRoot.Enter())
             * {*/
            lock (this)
            {
                if (!Members.Remove(member.Id))
                {
                    return(false);
                }
            }
            //}



            RealmServer.IOQueue.AddMessage(() =>
            {
                member.Delete();
                if (update)
                {
                    Update();
                }
            });
            return(true);
        }