I
think I fixed the problem. Try this:
PHP Code:
function items_health($item, $adopt){
$mysidia = Registry::get("mysidia");
$health = $mysidia->db->select("owned_adoptables", array("health"), "aid ='{$adopt->aid}'")->fetchObject();
$addHealth = $adopt->health + $item->value;
//Check if the adoptable's health is already at maximum.
if($adopt->health >= 100){
$note = "Your gryphon is already fully healed! The {$item->itemname} was not used.";
}
//Not at maximum, but don't go overboard!
elseif($addHealth > 100){
$mysidia->db->update("owned_adoptables", array("health" => 100), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note = "The {$item->itemname} fully healed your gryphon!";
$delitem = $item->remove();
}
//Not at maximum, won't go overboard. Proceed.
else{
$mysidia->db->update("owned_adoptables", array("health" => $addHealth), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note = "The {$item->itemname} raised your gryphon's health by {$item->value}! Their health is now at {$addHealth}.";
$delitem = $item->remove();
}
return $note;
}
This part:
PHP Code:
$health = $mysidia->db->select("owned_adoptables", array("health"), "aid ='{$adopt->aid}'")->fetchObject();
Probably isn't needed, it's just there from my debugging.
Looking back on this code, I can't really see what's different about it, but it apparently works on my end now? Let me know if it doesn't.