1. You may reference vBulletin functions, but not use any of its code in your own scripts. I (personally), would get some sort of verification from Jelsoft before selling your script.
2. This is all contained in the files, just trace where everything goes, it is not very difficult. I'd suggest starting at the login form.