示例#1
0
        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();
            }
        }
示例#2
0
        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();
            }
        }
示例#3
0
        public void SendLoginNotification(LoginStatus loginStatus, long accountID, long role)
        {
            if (loginStatus == LoginStatus.Success)
            {
                // We should check for a exact number of nodes here when we have the needed infraestructure
                if (this.ConnectionManager.NodesCount > 0)
                {
                    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       = this.ConnectionManager.ClientsCount;
                    rsp.proxy_nodeid            = 0; // ProxyNodeID is 0
                    rsp.user_logonqueueposition = 1;
                    rsp.challenge_responsehash  = "55087";

                    rsp.macho_version = Game.MACHO_VERSION;
                    rsp.boot_version  = Game.VERSION;
                    rsp.boot_build    = Game.BUILD;
                    rsp.boot_codename = Game.CODENAME;
                    rsp.boot_region   = Game.REGION;

                    // setup session
                    this.Session["userType"] = AccountType.USER;
                    this.Session["userid"]   = accountID;
                    this.Session["role"]     = role;
                    // move the connection to the authenticated user list
                    this.ConnectionManager.RemoveUnauthenticatedClientConnection(this);
                    this.ConnectionManager.AddAuthenticatedClientConnection(this);
                    // send the login response
                    this.Socket.Send(rsp);
                    // set second to last packet handler
                    this.Socket.SetReceiveCallback(ReceiveLoginResultResponse);
                    // set our NodeID to something sensible
                    this.NodeID = this.ConnectionManager.Nodes.Keys.First();
                }
                else
                {
                    // Pretty funny, "AutClusterStarting" maybe they mean "AuthClusterStarting"
                    this.Socket.Send(new GPSTransportClosed("AutClusterStarting"));

                    Log.Trace("Rejected by server; cluster is starting");

                    this.AbortConnection();
                }
            }
            else if (loginStatus == LoginStatus.Failed)
            {
                this.Socket.Send(new GPSTransportClosed("LoginAuthFailed"));
                this.AbortConnection();
            }
        }
示例#4
0
        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();
            }
        }