/// <summary> /// Sends a <see cref="LoginClientFailedMessage"/> to the specified server. /// </summary> internal void SendLoginClientFailedMessage(int errorCode, byte[] sessionId, NetSocket socket, string reason = null, int remainingTime = -1) { LoginClientFailedMessage message = new LoginClientFailedMessage(); message.SetErrorCode(errorCode); message.SetReason(reason); message.SetRemainingTime(remainingTime); NetMessageManager.SendMessage(socket, sessionId, message); }
/// <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); } }
/// <summary> /// Sends the specified <see cref="NetMessage"/> to the service. /// </summary> public void SendMessage(int serviceNodeType, NetMessage message) { NetSocket socket = this._serviceNodeSockets[serviceNodeType]; if (socket != null) { NetMessageManager.SendMessage(socket, this.SessionId, message); } else { Logging.Warning("NetSession::sendMessage server is not set, nodeType: " + serviceNodeType); } }
/// <summary> /// Forwards the specified <see cref="PiranhaMessage"/> to the service. /// </summary> public void SendPiranhaMessage(int serviceNodeType, PiranhaMessage message) { NetSocket socket = this._serviceNodeSockets[serviceNodeType]; if (socket != null) { if (message.GetEncodingLength() == 0) { message.Encode(); } ForwardPiranhaMessage forwardPiranhaMessage = new ForwardPiranhaMessage(); forwardPiranhaMessage.SetPiranhaMessage(message); NetMessageManager.SendMessage(socket, this.SessionId, forwardPiranhaMessage); } }
/// <summary> /// Sends the response <see cref="NetMessage"/> to the requester. /// </summary> internal static void SendResponseMessage(NetMessage requestMessage, NetMessage responseMessage) { NetMessageManager.SendMessage(requestMessage.GetServiceNodeType(), requestMessage.GetServiceNodeId(), requestMessage.GetSessionId(), responseMessage); }