示例#1
0
 public static void RegisterAuthPackets()
 {
     connection.AppendIncomingPacketHandler <string[]>("UserLoginSucces", (header, connection, content) =>
     {
         ClientConnection conn = CCM.GetClientConnection(content[1]);
         conn.UserID           = Int32.Parse(content[0]);
         var packet            = new AuthPackets.S2CAnsLogin(true);
         packet.Send(conn.AuthConnection);
     });
 }
        internal static void OnC2SAskLogin(ByteBuffer buffer, Connection connection)
        {
            var incPacket = new AuthPackets.C2SAskLogin(buffer, connection);
            var success   = DatabaseFunctions.UserLogin(incPacket.Username, incPacket.DecPassword, out var userID);

            if (success)
            {
                //ClientManager.GetClient(connection).UserId = userID;
                ClientManager.GetClient(connection).UserId = 33;
                ClientManager.GetClient(connection).setAtZone(atZone.afterLogin);
            }
            var outPacket = new AuthPackets.S2CAnsLogin(success);

            outPacket.Send(connection);
        }