Example #1
0
        /// <summary>
        /// Adds a new guild member
        /// Calls GuildMgr.OnJoinGuild
        /// </summary>
        /// <param name="chr">character to add</param>
        /// <param name="update">if true, sends event to the guild</param>
        /// <returns>GuildMember of new member</returns>
        public GuildMember AddMember(CharacterRecord chr)
        {
            GuildMember newMember;

            /*using (syncRoot.Enter())
             * {*/
            lock (this)
            {
                if (Members.TryGetValue(chr.EntityLowId, out newMember))
                {
                    return(newMember);
                }
                newMember = new GuildMember(chr, this, m_ranks.Last());
                Members.Add(newMember.Id, newMember);
                newMember.Create();
            }
            /*}*/

            GuildMgr.Instance.RegisterGuildMember(newMember);

            EventLog.AddJoinEvent(newMember.Id);
            GuildHandler.SendEventToGuild(this, GuildEvents.JOINED, newMember);
            var character = World.GetCharacterByAccId((uint)chr.AccountId);

            foreach (var activeSkill in ActiveSkills)
            {
                activeSkill.ApplyToCharacter(character);
            }
            character.GuildMember = newMember;
            Asda2GuildHandler.SendGuildNotificationResponse(this, GuildNotificationType.Joined, newMember);
            Asda2GuildHandler.SendGuildMembersInfoResponse(character.Client, this);
            AddHistoryMessage(Asda2GuildHistoryType.Joined, 0, chr.Name, DateTime.Now.ToLongTimeString());
            return(newMember);
        }
Example #2
0
        /// <summary>
        /// Adds a new guild member
        /// Calls GuildMgr.OnJoinGuild
        /// </summary>
        /// <param name="chr">character to add</param>
        /// <param name="update">if true, sends event to the guild</param>
        /// <returns>GuildMember of new member</returns>
        public GuildMember AddMember(CharacterRecord chr)
        {
            GuildMember guildMember;

            lock (this)
            {
                if (Members.TryGetValue(chr.EntityLowId, out guildMember))
                {
                    return(guildMember);
                }
                guildMember = new GuildMember(chr, this, m_ranks.Last());
                Members.Add(guildMember.Id, guildMember);
                guildMember.Create();
            }

            Singleton <GuildMgr> .Instance.RegisterGuildMember(guildMember);

            EventLog.AddJoinEvent(guildMember.Id);
            GuildHandler.SendEventToGuild(this, GuildEvents.JOINED, guildMember);
            Character characterByAccId = World.GetCharacterByAccId((uint)chr.AccountId);

            foreach (GuildSkill activeSkill in ActiveSkills)
            {
                activeSkill.ApplyToCharacter(characterByAccId);
            }
            characterByAccId.GuildMember = guildMember;
            Asda2GuildHandler.SendGuildNotificationResponse(this, GuildNotificationType.Joined, guildMember);
            Asda2GuildHandler.SendGuildMembersInfoResponse(characterByAccId.Client, this);
            AddHistoryMessage(Asda2GuildHistoryType.Joined, 0, chr.Name, DateTime.Now.ToLongTimeString());
            return(guildMember);
        }
Example #3
0
        /// <summary>
        /// Adds a new guild member
        /// Calls GuildMgr.OnJoinGuild
        /// </summary>
        /// <param name="chr">character to add</param>
        /// <param name="update">if true, sends event to the guild</param>
        /// <returns>GuildMember of new member</returns>
        public GuildMember AddMember(CharacterRecord chr)
        {
            GuildMember newMember;

            using (syncRoot.Enter())
            {
                if (Members.TryGetValue(chr.EntityLowId, out newMember))
                {
                    return(newMember);
                }
                newMember = new GuildMember(chr, this, m_ranks.Last());
                Members.Add(newMember.Id, newMember);
                newMember.Create();
            }

            GuildMgr.Instance.RegisterGuildMember(newMember);

            EventLog.AddJoinEvent(newMember.Id);
            GuildHandler.SendEventToGuild(this, GuildEvents.JOINED, newMember);

            return(newMember);
        }