You'll need to carefully examine the condition of the sails to see if they have been used a lot. Some sails could be old, but unused and still decent. If you need to replace, I'm guessing around $2500 +/- for a name brand dacron sail for a 31ft boat. Your mast shouldn't need replacing unless it is showing severe corrosion and is in danger of snapping at the spreaders. My Tartan 37mast is original and still looking good after 34 years.
"They" say you should replace your standing rigging every ten years, but realistically, you should get many more years than that out of your rigging. If you race, then you may want to stick to a more conservative schedule.
I replaced my rigging myself using StaLok terminals for the lowers and swagged terminals for the upper connection, new turnbuckles and I think it was around $2K (?). My memory isn't coming up with a figure, but I think it was near that. On a 31 ft'r I'm sure it would be less by a few hundred.
Bottom paint for your boat, your looking at $70-$250/gal depending if it's a name brand vs store brand, ablative vs hard, single season vs multi-season.
Your boat probably only needs one gallon. Some boat yards do not allow you to paint your own bottom, so you'll need to check their policies.
Did you get a good surveyor to check this vessel over? If not, you should....money well spent.
Good luck and fair winds.