示例#1
0
        /// <summary>
        ///     Called when a <see cref="ServerBoundMessage"/> is received.
        /// </summary>
        internal void ServerBoundMessageReceived(ServerBoundMessage message)
        {
            LogicLong accountId = message.RemoveAccountId();

            if (!accountId.IsZero())
            {
                if (!AvatarAccountManager.TryGet(accountId, out AvatarAccount avatarAccount))
                {
                    if (NetManager.GetDocumentOwnerId(ServiceCore.ServiceNodeType, accountId) != ServiceCore.ServiceNodeId)
                    {
                        return;
                    }

                    avatarAccount = AvatarAccountManager.CreatePartyAccount(accountId);
                }
                else
                {
                    if (avatarAccount.Session != null)
                    {
                        NetAvatarSessionManager.Remove(avatarAccount.Session.SessionId);

                        avatarAccount.Session.Destruct();
                        avatarAccount.SetSession(null);
                    }
                }

                NetAvatarSession session = NetAvatarSessionManager.Create(avatarAccount, message.RemoveSessionId());

                int[] ids = message.RemoveEndPoints();

                for (int i = 0; i < 28; i++)
                {
                    if (ids[i] != -1)
                    {
                        session.SetServiceNodeId(i, ids[i]);
                    }
                }

                avatarAccount.SetSession(session);

                AskForBindServerMessage askForBindServerMessage1 = new AskForBindServerMessage();
                AskForBindServerMessage askForBindServerMessage2 = new AskForBindServerMessage();

                askForBindServerMessage1.SetServerType(10);
                askForBindServerMessage2.SetServerType(11);
                askForBindServerMessage1.SetServerId(NetManager.GetDocumentOwnerId(NetUtils.SERVICE_NODE_TYPE_ZONE_CONTAINER, accountId));
                askForBindServerMessage2.SetServerId(NetManager.GetDocumentOwnerId(NetUtils.SERVICE_NODE_TYPE_PARTY_CONTAINER, accountId));

                session.SendMessage(NetUtils.SERVICE_NODE_TYPE_PROXY_CONTAINER, askForBindServerMessage1);
                session.SendMessage(NetUtils.SERVICE_NODE_TYPE_PROXY_CONTAINER, askForBindServerMessage2);
            }
        }
示例#2
0
        /// <summary>
        ///     Called when a <see cref="AskForAvatarProfileMessage"/> is received.
        /// </summary>
        internal void AskForAvatarProfileMessageReceived(AskForAvatarProfileMessage message)
        {
            LogicLong avatarId = message.RemoveAvatarId();
            LogicLong homeId   = message.RemoveHomeId();

            if (AvatarAccountManager.TryGet(avatarId, out AvatarAccount _))
            {
                AskForAvatarProfileFullEntryMessage askForAvatarProfileFullEntryMessage = new AskForAvatarProfileFullEntryMessage();
                askForAvatarProfileFullEntryMessage.SetAvatarId(avatarId);
                askForAvatarProfileFullEntryMessage.SetHomeId(homeId ?? avatarId);
                NetMessageManager.SendMessage(NetUtils.SERVICE_NODE_TYPE_ZONE_CONTAINER, NetManager.GetDocumentOwnerId(NetUtils.SERVICE_NODE_TYPE_ZONE_CONTAINER, avatarId), this._session.SessionId, askForAvatarProfileFullEntryMessage);
            }
        }