I'm glad we were able to help ^^ Adding the following will let you check if the adoptable is at level 10:
PHP Code:
//rest of your code here
$type = $mysidia -> db -> select ("owned_adoptables", array("type"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();
$currentLevel = $adopt->currentlevel;//add this
if($type == "Moonlight Fairy Dragon") {
//The adoptable is already a Moonlight Fairy Dragon
$note = "Your adoptable is a Moonlight Fairy Dragon.";
}
//add these three lines:
else if($currentLevel < 10){
$note = "Your adoptable is not at level 10 yet.";
}
//rest of your code here
That version in that thread ended up being a bit messy due to repeated comparisons xD This is a clean version if you prefer to use it:
PHP Code:
function items_Type($item, $adopt){
$mysidia = Registry:: get("mysidia");
$type = $adopt->type;
$currentLevel = $adopt->currentlevel;
//Let's check if the adoptable is a Moonlight Fairy Dragon.
if($type == "Moonlight Fairy Dragon") {
//The adoptable is already a Moonlight Fairy Dragon
$note = "Your adoptable is a Moonlight Fairy Dragon.";
}
//Let's check if the adoptable is below level 10.
else if($currentLevel < 10){
$note = "Your adoptable is not at level 10 yet.";
}
//Adoptable has all the requirements, let's update it
else{
$mysidia -> db -> update("owned_adoptables", array("type" => 'Moonlight Fairy Dragon'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");
$note = "Your adoptable {$adopt->name} is now a Moonlight Fairy Dragon.";
//Update item quantity...
$delitem = $item->remove();
}
return $note;
}