there's an old thread here with a code doing what you want, but you will need to edit it so it can work with the new script:
http://mysidiaadoptables.com/forum/s...ead.php?t=3527
I manage to make it work, so is not that hard ^^ you just need to add a new row in the database in the adopt_adoptables called rarity and made the changes to the code so it can appear
PHP Code:
$adoptform = "<form name='form1' method='post' action='$adopt'><table id='adoptdark' name='adopt' class='adopt'>";
$common = 0;
$uncommon = rand(1,50);
$rare = rand(1,100);
$ultrarare = rand(1,200);
$legendary = rand(1,300);
if ($uncommon==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($rare==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($ultrarare==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($legendary==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else{
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";
}
$stmt = $mysidia->db->query($query);
while($row = $stmt->fetchObject()) {
$adoptform .= "<td width='25%' VALIGN='center'><div align=center><img src='http://127.0.0.1/pokeupdate/picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></td>";
}
$common = 0;
$uncommon = rand(1,50);
$rare = rand(1,100);
$ultrarare = rand(1,200);
$legendary = rand(1,300);
if ($uncommon==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($rare==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($ultrarare==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($legendary==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else{
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";
}
$stmt = $mysidia->db->query($query);
while($row = $stmt->fetchObject()) {
$adoptform2 .= "<td width='25%' VALIGN='center'><div align=center><img src='http://127.0.0.1/pokeupdate/picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></div></td>";
}
$common = 0;
$uncommon = rand(1,50);
$rare = rand(1,100);
$ultrarare = rand(1,200);
$legendary = rand(1,300);
if ($uncommon==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($rare==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($ultrarare==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else if ($legendary==1 && $onlyone==0){
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 1";
$onlyone = 1;
}
else{
$query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";
}
$stmt = $mysidia->db->query($query);
while($row = $stmt->fetchObject()) {
$adoptform3 .= "<td width='25%' VALIGN='center'><div align=center><img src='http://127.0.0.1/pokeupdate/picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></div></td>";
}
$document->add(new Comment("{$adoptform}{$adoptform2}{$adoptform3}"));
probably is not the best way of doing it, but it works for me ^^
I have mine below the lines:
PHP Code:
$document->addLangvar((!$mysidia->user->isloggedin)?$mysidia->lang->guest:$mysidia->lang->member);
$adoptForm = new Form("form", "adopt", "post");
$adoptTitle = new Comment("Available Adoptables");
$adoptTitle->setHeading(3);
$adoptForm->add($adoptTitle);
$adoptTable = new Table("table", "", FALSE);
and above the lines:
PHP Code:
$adoptForm->add($adoptTable);
$adoptForm->add(new Button("Adopt Me", "submit", "submit"));
$document->add($adoptForm);
}
}
}
?>
this part of the code:
PHP Code:
$document->add(new Comment("{$adoptform}{$adoptform2}{$adoptform3}"));
replaces the
PHP Code:
$document->add(new Comment($adoptform));
cant post my full adoptview.php file because is very modified.
hope this can be use full for you^^
this code shows 3 eggs at the same time.