@Corsair
Try adding this to see if it'll help (make sure to define $traincost):
PHP Code:
if($mysidia->user->money < $traincost) {
$document->add(new Comment(" You don't have enough money to train your companion!"));
return;
}
Came up with a code to automatically change an adopt's stats emulating
$mysidia->user->changecash(). This should be helpful updating the db with less code. Add it to
/classes/class_ownedadoptable.php
PHP Code:
public function changestat($stat, $gainstat){
$mysidia = Registry::get("mysidia");
if(!is_numeric($gainstat)) throw new Exception('Cannot change crocuta stats by a non-numeric value!');
# Define $newstat...
if($stat == "sense"){
$newstat = $this->sense;
} elseif($stat == "strength"){
$newstat = $this->strength;
}
$newstat += $gainstat;
$profile = $mysidia->user->getprofile();
$mysidia->db->update("owned_adoptables", array("{$stat}" => $newstat), "aid = '{$profile->getFavPetID()}'");
return TRUE;
}
To use:
PHP Code:
$randgain = rand(1,20);
$favpet->changestat(strength, $randgain);