You're asking about a thing called the "Character Test".
Have a read of this.
Then book yourself an appointment with a lawyer who is also a Registered Migration Agent.
A layman RMA can't give you the legal advice you'll need to negotiate what can be a complex path.