To get a pet's info from the database, you would need to get the ID of the pet somehow. In the case of items, items get the ID of a pet like this:
in functions_items.php. (Which is where you define what a certain item does)
I haven't tried, but I'm assuming $adopt->getType(); or $adopt->getType would still work. This is because items already call the pet that it's about to be used on so you don't have to use the whole database call to get it. From there, the code should still work the same.