public static void SendLoginNotification(LoginStatus loginStatus, Connection connection) { if (loginStatus == LoginStatus.Sucess) { // We should check for a exact number of nodes here when we have the needed infraestructure if (ConnectionManager.NodesCount > 0) { connection.NodeID = ConnectionManager.RandomNode; AuthenticationRsp rsp = new AuthenticationRsp(); // String "None" marshaled byte[] func_marshaled_code = new byte[] { 0x74, 0x04, 0x00, 0x00, 0x00, 0x4E, 0x6F, 0x6E, 0x65 }; rsp.serverChallenge = ""; rsp.func_marshaled_code = func_marshaled_code; rsp.verification = false; rsp.cluster_usercount = ConnectionManager.ClientsCount + 1; // We're not in the list yet rsp.proxy_nodeid = connection.NodeID; rsp.user_logonqueueposition = 1; rsp.challenge_responsehash = "55087"; rsp.macho_version = Common.Constants.Game.machoVersion; rsp.boot_version = Common.Constants.Game.version; rsp.boot_build = Common.Constants.Game.build; rsp.boot_codename = Common.Constants.Game.codename; rsp.boot_region = Common.Constants.Game.region; // Setup session connection.Session.SetString("address", connection.Address); connection.Session.SetString("languageID", connection.LanguageID); connection.Session.SetInt("userType", Common.Constants.AccountType.User); connection.Session.SetLong("userid", connection.AccountID); connection.Session.SetLong("role", connection.Role); // Update the connection, so it gets added to the clients correctly ConnectionManager.UpdateConnection(connection); connection.Send(rsp.Encode()); } else { // Pretty funny, "AutClusterStarting" maybe they mean "AuthClusterStarting" GPSTransportClosed ex = new GPSTransportClosed("AutClusterStarting"); connection.Send(ex.Encode()); Log.Trace("Client", "Rejected by server; cluster is starting"); connection.EndConnection(); } } else if (loginStatus == LoginStatus.Failed) { GPSTransportClosed ex = new GPSTransportClosed("LoginAuthFailed"); connection.Send(ex.Encode()); connection.EndConnection(); } }
public void SendLoginNotification(LoginStatus loginStatus) { if (loginStatus == LoginStatus.Sucess) { AuthenticationRsp rsp = new AuthenticationRsp(); // String "None" marshaled byte[] func_marshaled_code = new byte[] { 0x74, 0x04, 0x00, 0x00, 0x00, 0x4E, 0x6F, 0x6E, 0x65 }; rsp.serverChallenge = ""; rsp.func_marshaled_code = func_marshaled_code; rsp.verification = false; rsp.cluster_usercount = ClientManager.GetClientsCount() + 1; // We're not in the list yet rsp.proxy_nodeid = 1; rsp.user_logonqueueposition = 1; rsp.challenge_responsehash = "55087"; rsp.macho_version = Common.Constants.Game.machoVersion; rsp.boot_version = Common.Constants.Game.version; rsp.boot_build = Common.Constants.Game.build; rsp.boot_codename = Common.Constants.Game.codename; rsp.boot_region = Common.Constants.Game.region; // Setup session session.SetString("address", socket.GetAddress()); session.SetString("languageID", request.user_languageid); session.SetInt("userType", Common.Constants.AccountType.User); session.SetInt("userid", accountid); session.SetInt("role", role); // We should check for a exact number of nodes here when we have the needed infraestructure if (NodeManager.nodes.Count > 0) { nodeID = NodeManager.GetRandomNode(); Send(rsp.Encode()); } else { GPSTransportClosed ex = new GPSTransportClosed("AutClusterStarting"); Send(ex.Encode()); Close(); } } else if (loginStatus == LoginStatus.Failed) { GPSTransportClosed ex = new GPSTransportClosed("LoginAuthFailed"); Send(ex.Encode()); Close(); } }