View Single Post
  #1  
Old 03-20-2013, 05:46 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 37,328
kristhasirah
Default Edit rarity code for 1.3.2 to the 1.3.3 script

just like the title says, im using the rarity code in my site, and is very useful, because i can hide some eggs from public view and show more some types than others, but i have no idea how i can edit the code to make it compatible with the new script =(

this is the code im using:
Code:
   $adoptform = "<form name='form1' method='post' action='doadopt.php'><h3>Available Adoptables</h3><table width='500' height='130' background='http://pokepony.x10.mx/picuploads/deserty1.png' class='adopt'>";
    $onlyone = 0; 
    $uncommon = rand(1,50);   
    $rare = rand(1,100);   
    $ultrarare = rand(1,200);
    $legendary = rand(1,300);
    $legendary2 = rand(1,250);   

    if ($uncommon==1 && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='11' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }   
    else if ($rare==1 && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='12' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }       
    else if ($ultrarare==1  && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='13' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }  
    else if ($legendary==1  && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
}  
    else if ($legendary2==1  && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='14' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }         
    else{   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='10' ORDER BY RAND() LIMIT 4";   
    }   
    $stmt = $mysidia->db->query($query);  
   

    while($row = $stmt->fetchObject()) {
 	  // Call a function to check if we have the proper privledge level to adopt this pet
	  $canadopt = canadopt($aid, "showing", "none", $row); // Feed an adoptable ID and showing, to show the adopt to guests...

	  if($canadopt == "yes"){
			//If we can adopt the adoptable, show the image and adoption link...
			$adoptform .= "<td  width='25%' VALIGN='center'><div align=center><img src='http://www.pokepony.x10.mx/picuploads/png/ee15a8cd09e9cde3a34896e250ece23d.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>";
	  }
   } // End the loop  
   
   $adoptform .= "</table><h3>Adopt</h3>
			     <p>Adoptable Name: <input name='name' type='text' id='name' />
			     <p><input type='submit' name='Submit' value='Adopt Me'></p></form>";
   $mysidia->page->addcontent($adoptform);
__________________
Reply With Quote