예제 #1
0
        private void DoNoAuthLogin(INetworkConnection con, Packet pMsg)
        {
            try
            {
                PacketLoginRequest p = pMsg as PacketLoginRequest;
                ServerUser.AccountName  = Guid.NewGuid().ToString(); // assign random session name
                ServerUser.OwningServer = MyServer.ServerUserID;
                Log1.Logger("LoginServer.Inbound.Login").Info("No-auth assigned user name " + ServerUser.AccountName + " from " + RemoteIP + " is attempting login...");
                Log1.Logger("LoginServer.UserIPMap").Info("User [" + p.AccountName + "] from [" + RemoteIP + "] is attempting login.");
                string msg = "";

                PacketLoginResult result = CreateLoginResultPacket();
                if (result.ReplyCode == ReplyType.OK)
                {
                    ServerUser.AuthTicket      = Guid.NewGuid();
                    ServerUser.IsAuthenticated = true;
                    ServerUser.ID = Guid.NewGuid(); // generate random ID for this session

                    ServerUser.Profile.UserRoles = new string[0];
                    result.Parms.SetProperty("AccountName", ServerUser.AccountName);
                    result.Parms.SetProperty(-1, ServerUser.Profile.UserRoles);
                    result.Parms.SetProperty(-2, ServerUser.Profile.MaxCharacters);
                    ConnectionManager.AuthorizeUser(ServerUser);
                }
                pMsg.ReplyPacket = result;
                Log1.Logger("LoginServer.Inbound.Login").Info("Game client *" + ServerUser.AccountName + "* authentication: " + result.ReplyCode.ToString() + ". " + result.ReplyMessage);
            }
            catch (Exception e)
            {
                Log1.Logger("LoginServer.Inbound.Login").Error("Exception thrown whilst player attempted login. " + e.Message, e);
                KillConnection("Error logging in.");
            }
        }
예제 #2
0
        /// <summary>
        /// Sends the target connection a listing and status of all game server clusters that this login server knows about.
        /// This is the listing that the client should allow the player too choose from in the UI.
        /// Returns false if currently no servers are available for service.
        /// </summary>
        /// <param name="con"></param>
        protected virtual PacketLoginResult CreateLoginResultPacket()
        {
            // send login result
            PacketLoginResult lr = (PacketLoginResult)CreatePacket((int)PacketType.LoginResult, 0, true, true);

            lr.ReplyCode = ReplyType.OK;
            return(lr);
        }