コード例 #1
0
        /// <summary>Called when the given member is added</summary>
        protected virtual void OnAddMember(GroupMember member)
        {
            ++m_Count;
            Character character = member.Character;

            if (character != null)
            {
                character.GroupMember = member;
            }
            if (m_firstMember == null)
            {
                m_firstMember = m_lastMember = member;
            }
            else
            {
                m_lastMember.Next = member;
                m_lastMember      = member;
            }

            GroupMemberHandler memberAdded = MemberAdded;

            if (memberAdded == null)
            {
                return;
            }
            memberAdded(member);
        }
コード例 #2
0
        /// <summary>
        /// Called before the given member is removed to clean up everything related to the given member
        /// </summary>
        protected void OnMemberRemoved(GroupMember member)
        {
            Character chr = member.Character;

            if (chr != null && chr.IsInWorld)
            {
                if (!chr.IsInContext)
                {
                    chr.ExecuteInContext(() => OnMemberRemoved(member));
                    return;
                }

                GroupMemberHandler memberRemoved = MemberRemoved;
                if (memberRemoved != null)
                {
                    memberRemoved(member);
                }
                --m_Count;
                SendEmptyUpdate(chr);
                chr.GroupMember = null;
                GroupHandler.SendResult(chr.Client, GroupResult.NoError);
                member.SubGroup.RemoveMember(member);
                member.Character = null;
                if (chr.Map is BaseInstance)
                {
                    BaseInstance instance = (BaseInstance)chr.Map;
                    chr.Map.CallDelayed(GroupInstanceKickDelayMillis, () =>
                    {
                        if (!chr.IsInWorld || chr.Map != instance || instance.CanEnter(chr))
                        {
                            return;
                        }
                        chr.TeleportToNearestGraveyard();
                    });
                }
            }
            else
            {
                GroupMemberHandler memberRemoved = MemberRemoved;
                if (memberRemoved != null)
                {
                    memberRemoved(member);
                }
                --m_Count;
                Singleton <GroupMgr> .Instance.OfflineChars.Remove(member.Id);

                member.m_subGroup = null;
            }

            member.m_nextMember = null;
        }