Well, I can tell you that it will be rather tricky to convert from a clicks based system to a time-based one, simply because the script wasn't designed for time-based leveling. Here's the code though that controls when an adoptable levels up...
In levelup.php:
PHP Code:
//Check and see if we need a level up...
$levelup = checklevel($totalclicks);
if($levelup > $currentlevel){
//The creature needs to level up
//Check if we are at max level
$query = "SELECT * FROM adoptable_rankimages WHERE name = '$type'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$l1i=@mysql_result($result,$i,"l1i");
$l2i=@mysql_result($result,$i,"l2i");
$l3i=@mysql_result($result,$i,"l3i");
$l4i=@mysql_result($result,$i,"l4i");
$l5i=@mysql_result($result,$i,"l5i");
$l6i=@mysql_result($result,$i,"l6i");
$l7i=@mysql_result($result,$i,"l7i");
$l8i=@mysql_result($result,$i,"l8i");
$i++;
}
$mymax = 8;
if($l1i == "" || l1i == NULL){
$mymax = 0;
$img = $l1i;
}
else if($l2i == "" || l2i == NULL){
$mymax = 1;
$img = $l2i;
}
else if($l3i == "" || l3i == NULL){
$mymax = 2;
$img = $l3i;
}
else if($l4i == "" || l4i == NULL){
$mymax = 3;
$img = $l4i;
}
else if($l5i == "" || l5i == NULL){
$mymax = 4;
$img = $l5i;
}
else if($l6i == "" || l6i == NULL){
$mymax = 5;
$img = $l6i;
}
else if($l7i == "" || l7i == NULL){
$mymax = 6;
$img = $l7i;
}
else if($l8i == "" || l8i == NULL){
$mymax = 7;
$img = $l8i;
}
if($currentlevel < $mymax){
//Not at max level, rank them up
if($levelup == "1" and $mymax >= $levelup){
$img = $l1i;
}
if($levelup == "2" and $mymax >= $levelup){
$img = $l2i;
}
if($levelup == "3" and $mymax >= $levelup){
$img = $l3i;
}
if($levelup == "4" and $mymax >= $levelup){
$img = $l4i;
}
if($levelup == "5" and $mymax >= $levelup){
$img = $l5i;
}
if($levelup == "6" and $mymax >= $levelup){
$img = $l6i;
}
if($levelup == "7" and $mymax >= $levelup){
$img = $l7i;
}
if($levelup == "8" and $mymax >= $levelup){
$img = $l8i;
}
mysql_query("UPDATE owned_adoptables SET currentlevel='".$levelup."' WHERE uid='".$id."'");
mysql_query("UPDATE owned_adoptables SET imageurl='".$img."' WHERE uid='".$id."'");
$flag = 1;
$currentlevel = $levelup;
}
}
There are two versions of that code in levelup.php, one for registered users and one for guests.
I would wait though until the new version comes out in a week or two before changing anything as the new version is a major rewrite. :)