There are so many variables here that they don't permit even the semblance of an answer. Your safest bet would be to consult with an intellectual property attorney, who would be able to advise you after analysis of all the specific facts.
Disclaimer: This answer is provided as a public service and as a general response to a general question, it is not meant, and should not be relied upon as specific legal advice, nor does it create an attorney-client relationship.Ask a similar question
Erik is absolutely right. There is no way to answer to your question w/o more facts -- and even then the answer will not be certain.
It sounds as if you've researched the subject of fan fiction a bit. An article that you may enjoy -- but which will NOT answer your particular questions -- is available at http://tinyurl.com/c6vnfj .
As Erik notes, if you intend to write a book based on a pre-existing work, you will need to discuss the matter with an intellectual property attorney. If you cannot afford one, then call your local law school and ask whether it has a "business clinic" that may help you or reach out to a friendly intellectual property law professor who may lend you a hand.Ask a similar question