This is a straightforward problem.
1. Idle control valve and its switch. Remove the valve, clean it out thoroughly with carb cleaner, clean the switch connection, spray the cleaner on the switch's leads as well, give it ten minutes to dry, reinstall and replug.
2. Vacuum leaks. When the car is running, spray carb cleaner everywhere around the intake, the air box, the air bellows/air hose leading to the throttle body and the air flow sensor, the throttle body area where it joins the manifold, the manifold at the area where it joins the cylinder head. If the idle suddenly improves, you've found your vacuum leak. What's happening is that the carb cleaner is being sucked into the leak by the engine's vacuum. It goes into the combustion chamber together with the regular airflow and combusts with the fuel. Excess fuel does not generate rough idling, only excess/unpredictable air flow does. So that's how that works.
3. Faulty air mass sensor. This is easily diagnosed. Just unplug the sensor and restart the engine. If the idle improves, then you've found your culprit. You'll either need to tune your car using a computer (if that function is available for it) or you'll need to replace the maf and clear the error codes that would've been logged on the car's computer.
4. Do the stomp test and/or otherwise pull out the error codes on your car. That could lead you to the problem straightaway.
5. #2 and 3 can be tested within 5 minutes. Try that. Then, do No 4, and then no 1. This would be in its rising order of difficulty.
6. You've just bought this car. There are many things you'll need to go through to thoroughly check out, revive and tune it up to normal. You'll have to assume its been abused. All of that will cost you money. But not to worry....pretty much everything that you do, you'll have to do anyway to keep your car in tip top shape, and if you intend to keep it for the long term. And its performance will definitely improve as a result of your thorough tuneup.
7. There are other things you can do for this car that would be classified as preventive action, which would assure you that you'll not encounter a situation where the car refuses to start and you're stuck somewhere. Basically, you'll have to replace the fuel pump, the crank sensor, the cam sensor if you have one and the relays for the dme, fuel pump and O2 sensors. This stuff could cost some money but we've found good sources on Ebay so you won't burn a hole in your pocket for the parts at least. You can keep the old ones as working spares.
8. Is your car an automatic? If so, take a sample of the transmission oil and tell us about it, but don't change it out completely yet. There are precautionary issues involved with end-of-life trannys.
Good luck and congrats on your buy. btw what was your winning bid for the car?