I can't fully test this, but it's worth a shot. On the 'view' version of whatever explore area, we're going to create a new function that'll post an invisible form -- all you'll see is the button. It'll be easy to call, so we're doing it with a function to save time later.
PHP Code:
public function pickupPet($species){
$document = $this->document;
$document->add(new Comment("
<form id='pickup_pet' action='explore' name='pickup_pet' method='post' role='form'>
<input id='pet_found' name='pet_found' type='hidden' value='{$species}'>
<button id='acquire' value='species' name='acquire' type='submit'>
Pick up this {$species}?
</button>
</form>
", FALSE));
return;
}
It'll be called like this (so wherever you put this line, the button will appear):
PHP Code:
$this->pickupPet("Dezh"); // one of my species is a Dezh, for example
When the form is submitted, it'll bounce back to this page. We want the page to do something when it detects form data has been submitted!
PHP Code:
if($mysidia->input->post("pet_found")){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$species = $mysidia->input->post("pet_found");
$this->givePet($species);
$document->setTitle("Pet Acquired!");
$document->add(new Comment("You've collected a {$species}!. "));
}
Okay, but now need to include the function that'll actually give the pet to the user.
PHP Code:
public function givePet($species){
$mysidia = Registry::get("mysidia");
$newadopt = new StockAdopt($species);
$newadopt->append($mysidia->user->username);
return;
}
Unfortunately, I'm out the door so I can't explain better. D; Hope some of this helps!
edit: Lots of bugs I fixed when I arrived home. -u- Hope you didn't find it in the hour meanwhile. Still untested.