I am still going through a very messy divorce. The best advice I was given, early on, was to disarm my stbx and her craziness (taking our child, TRO, removing all items from our house, etc.) by treating her as though I was courting her in the beginning of our relationship. Let your lawyer fight for you, let the judge hate your atty, but dont do anything to make the judge dislike you. Be overly nice to your stbx. This is a long psychological battle for your right to be a father to your children and have 50% custody.
Second bit of advice I was given: accept that 50% is generally the best you can hope for. Only extreme cases lead to mom not having 50%. These cases are not only extreme, but stbx must be caught in the act of whatever she was doing. This is not justice, but it is how it is.
Third bit of advice, my own experience: Find a good therapist. Start seeing him before your divorce. Get referrals to couples counselors. Ask what you can do to save your marriage / help your wife and family. Know that your medical records can be subpoenaed, and make sure what your therapist records cannot be used against you.