Edit rarity code for 1.3.2 to the 1.3.3 script

Forum
Last Post
Threads / Messages

kristhasirah

Member
Member
Joined
Jan 22, 2010
Messages
197
Points
16
Location
In middle of the nothingness
Mysidian Dollar
20,995
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);
 
Well your raw html code should still work with this:

PHP:
$document->addLangvar($html);
// or:
$document->add(new Comment($html));
Though its more recommended to make use of the GUI package since it is more professional and flexible. One reason is that the form's action(redirect page) can be an issue if you are using relative url.
 
believe me if i knew how to make use of the GUI package i would use it, but i have 0% of knowledge when it comes to coding, the only thing i can do is make small edits to the codes or add mods and nothing else, i din't make the rarity code, i got it from a post in here... that's why i was asking if there was a way to edit it to make it available for the new script.

and now here comes some questions... where should i add the code? or how should i add it? im kind of lost here =(
 
Well for this... Change this line below:

PHP:
$mysidia->page->addcontent($adoptform);

to:

PHP:
$document->add(new Comment($adoptform));

Also change the form action form 'doadopt.php' to 'adopt' since doadopt.php no longer exists.
 
Thanks for your help HoF, sadly din't manage to make it work, i guess i wont be able to upgrade my site, because my site depends completly in the rarity code
thats the adopt page-> I will wait for 1.4.x version and see if the random generated egg is added to the script, or if someone manage to make something similar to the rarity code for this version
 
Just to inform... after a year of waiting and a day of being bored, i manage to understand what you told me HoF, now i have the rarity code working for the v1.3.4 ^^
the code dont look pretty... but now i have dancing eggs XD
adopttiny.png
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top