Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-25-2012, 02:33 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 81,204
SilverDragonTears is on a distinguished road
Default Random breeding outcome/ rare breeding

Ok so this was working for my fox site but when I try it on my dragon site for some reason it won't work...

Here is the whole script.
PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"functions/functions_adopts.php");
include(
"inc/lang.php");

//***************//
//  START SCRIPT //
//***************//

$breedinglevel grabanysetting('breedinglevel');

$article_title "Breeding System"
$article_content "<p>You may breed your adoptables here. They must be at least a level {$breedinglevel} to be able to breed.</p>"

$femaleid $_POST['female'];
$maleid $_POST['male'];
$breed $_POST['breed'];
$userstatus getuserstatus($loggedinname);
$date date("M j, Y");
// $date = "March 23, 2010";

if($isloggedin == "yes" and $userstatus['canbreed'] == "yes"){

$stmt $adopts->query("SELECT * FROM ".$prefix."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel<='3' AND isfrozen='no'");
$data $stmt->fetchAll();
$num count($data);

if(
$num >= 5){ 
$canadopt "no"
$article_title "Too many eggs!"$article_content "You already have too many eggs to take care of! Come back once you have hatched an egg!"
}
        else 
    if (
$breed != 'yes'){ // if they have not chosen which pets to breed yet, we let them choose
        
$article_content .= "<p>Select the two dragons that you'd like to breed:</p><form method='post'>"
        
$lastweek time() - ((grabanysetting('breedinginterval')) * 24 60 60);
        
        
// show all available female adoptables
        
$stmt $adopts->query("SELECT * FROM {$prefix}owned_adoptables WHERE owner = '{$loggedinname}' AND gender = 'f' AND currentlevel >= {$breedinglevel} AND lastbred <= '{$lastweek}'");
        
$row $stmt->fetchObject();
        if (
is_object($row)) {
            
//Fetch the first row...
            
$article_content .= "<p>Female: <select name='female'>
            <option value='
{$row->aid}'>{$row->name} ({$row->type})</option>";

            
// Continue to fetch more rows...
            
while ($row $stmt->fetchObject()) {
                
$article_content .= "<option value='{$row->aid}'>{$row->name} ({$row->type})</option>";
            }
            
$article_content .= "</select></p>";
        }
        else {
            
$article_content .= "<p>None of your female dragons can breed at the time.</p>";
        }
        
        
// show all available male adoptables
        
$stmt $adopts->query("SELECT * FROM {$prefix}owned_adoptables WHERE owner = '{$loggedinname}' AND gender = 'm' AND currentlevel >= {$breedinglevel} AND lastbred <= '{$lastweek}'");
        
$row $stmt->fetchObject();
        if (
is_object($row)) {
            
$article_content .= "<p>Male: <select name='male'>
                                 <option value='
{$row->aid}'>{$row->name} ({$row->type})</option>";
            while (
$row $stmt->fetchObject()) {
                
$article_content .= "<option value='{$row->aid}'>{$row->name} ({$row->type})</option>";
            }
            
$article_content .= "</select></p>";
        }
        else {
            
$article_content .= "<p>None of your male dragons can breed at the time.</p>";
        }
        
$article_content .= "<input type='hidden' name='breed' value='yes'><input type='submit' value='Breed It'></form>";
    } 
    else {
        
$stmt $adopts->query("SELECT * FROM {$prefix}owned_adoptables WHERE aid = '{$femaleid}'");
        
$female $stmt->fetchObject();

                
$female_type = @mysql_result($result,0,'type'); 
                
$female_name = @mysql_result($result,0,'name');

        
$stmt $adopts->query("SELECT * FROM {$prefix}adoptables WHERE type = '{$female->type}'") ;
        
$female_species $stmt->fetchObject();
        
$female_class explode(",",$female_species->class);
        
        
$stmt $adopts->query("SELECT * FROM {$prefix}owned_adoptables WHERE aid = '{$maleid}'") ;
        
$male $stmt->fetchObject();

                
$male_type = @mysql_result($result,0,'type'); 
                
$male_name = @mysql_result($result,0,'name');

        
$stmt $adopts->query("SELECT * FROM {$prefix}adoptables WHERE type = '{$male->type}'") ;
        
$male_species $stmt->fetchObject();
        
$male_class explode(",",$male_species->class);

        
// let's check the requirements first.
        
if(classcheck($female_class$male_class) == "no"){//check if the male and female belong to the same breeding class
            
$article_content "Sorry, it seems that your two adoptables do not belong to the same breeding class.";
        }
        elseif((
$female->currentlevel < (grabanysetting('breedinglevel'))) OR ($male->currentlevel < (grabanysetting('breedinglevel')))){ // check the adoptables' levels
            
$article_content .= "Sorry, one of your adoptables don't have the minimum level to breed. Keep getting clicks for them so they can grow.";    
        }
        elseif(
$female->owner != $loggedinname or $male->owner != $loggedinname){
           
// The adoptables do not belong to the owner... This user has apparently modified the content of drop-down form, and thus deserves his/her punishment
           
$adopts->query("UPDATE {$prefix}users SET usergroup=5 WHERE username='{$loggedinname}'");
           
$adopts->query("UPDATE {$prefix}users_status SET canbreed='no' WHERE username='{$loggedinname}'");
           
$article_title "An error has occurred";    
           
$article_content "It appears that at least one of the adoptables selected do not belong to yours. You have been banned for this action, please contact site administrator for more info.";
        }
        elseif(
$female->gender != "f" or $male->gender != "m"){
           
// The female's gender is male or male's gender is female? This user has apparently modified the content of drop-down form, and thus deserves his/her punishment
           
$adopts->query("UPDATE {$prefix}users SET usergroup=5 WHERE username='{$loggedinname}'");
           
$adopts->query("UPDATE {$prefix}users_status SET canbreed='no' WHERE username='{$loggedinname}'");
           
$article_title "An error has occurred";    
           
$article_content "It appears that the female and/or male adoptables gender's have been modified. You have been banned for this action, please contact site administrator for more info.";              
        }  
        else {
            
// we choose the type!
            
$types = array($female->type$male->type);
            
$typerand rand(0,1);        
            
            
// we choose the gender
$salt passgenerator(100);
$aid passgenerator(50);
                        
$code rand(1,20000);
                        
$tempgender rand(099);
                        if(
$tempgender $row->genderratio) {
                        
$gender "f";
                        
$alts "yes";    
                        unset(
$tempgender);
                        }
                        else {
                        
$gender "m";
                        
$alts "no";          
                        unset(
$tempgender);
                        }

            
// MESSY - I'm blanking out on how to find the actual alt status stuff right now, any help would be lovely.
            
$alts getaltstatus($aid00);

            
$time time();

            
$bredtemp rand(0,100);
            if(
$bredtemp <= $bredchance){

            
$article_content "<center>
<img src='http://silvadopts.com/get/"
.$maleid.".gif'><br>
<img src='http://silvadopts.com/get/"
.$femaleid.".gif'><br>
These two don't seem very interested in each other right now. Try again in a week."

    
}    
else{
            
$newquery "INSERT INTO {$prefix}owned_adoptables (aid, type, name, owner, currentlevel, totalclicks, code, imageurl, usealternates, tradestatus, isfrozen, gender, lastbred, date, father, mother)
                                VALUES ('
$aid', '$types[$typerand]', '$aid', '$loggedinname', '0', '0', '$code', '', '$alts', 'fortrade', 'no', '$gender', '', '$date', '$maleid', '$femaleid')";
            
$adopts->query($newquery);
            
             

            
$article_content "
            <center>
<img src='http://taleofdragons.net/get/"
.$maleid.".gif'><br>
<img src='http://taleofdragons.net/get/"
.$femaleid.".gif'></center><br>Congratulations! Breeding is successful,  you have acquired a baby ".$types[$typerand]." from breeding center.<br>
<a href='myadopts.php?act=stats&id="
.$aid."'><img src='http://taleofdragons.net/get/".$aid.".gif'></a></p>";

}

            
$adopts->query("UPDATE {$prefix}owned_adoptables SET lastbred = '$time' WHERE aid = '{$femaleid}'");
            
$adopts->query("UPDATE {$prefix}owned_adoptables SET lastbred = '$time' WHERE aid = '{$maleid}'");
        
        } 
// we end the place where it goes on if the levels are ok
    
//this bracket ends the else where we find the male/female id's
}// this is the end of if($isloggedin == "yes")
elseif($isloggedin == "yes" and $userstatus['canbreed'] == "no"){
    
$article_content .= "It appears that you have been banned from breeding your adoptables. Please contact an administrator for assistance.";   
}
else {
    
$article_content .= "You are not logged in. Please log in to use this feature.";
}

//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title$article_content$date);

?>
And the bredchance snippet which makes successful breeding 50/50
PHP Code:

            $bredtemp 
rand(0,100);
            if(
$bredtemp <= $bredchance){

            
$article_content "<center>
<img src='http://silvadopts.com/get/"
.$maleid.".gif'><br>
<img src='http://silvadopts.com/get/"
.$femaleid.".gif'><br>
These two don't seem very interested in each other right now. Try again in a week."

    
}    
else{
            
$newquery "INSERT INTO {$prefix}owned_adoptables (aid, type, name, owner, currentlevel, totalclicks, code, imageurl, usealternates, tradestatus, isfrozen, gender, lastbred, date, father, mother)
                                VALUES ('
$aid', '$types[$typerand]', '$aid', '$loggedinname', '0', '0', '$code', '', '$alts', 'fortrade', 'no', '$gender', '', '$date', '$maleid', '$femaleid')";
            
$adopts->query($newquery);
            
             

            
$article_content "
            <center>
<img src='http://taleofdragons.net/get/"
.$maleid.".gif'><br>
<img src='http://taleofdragons.net/get/"
.$femaleid.".gif'></center><br>Congratulations! Breeding is successful,  you have acquired a baby ".$types[$typerand]." from breeding center.<br>
<a href='myadopts.php?act=stats&id="
.$aid."'><img src='http://taleofdragons.net/get/".$aid.".gif'></a></p>";


Next question is how can I make my rares rarely breed? It doesn't work even if I put 99 as there breed chance.
__________________

Check out SilvaTales
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Breeding Bug? Need help :) Missy Master Questions and Supports 7 08-14-2014 02:29 PM
Random Breeding SilverDragonTears Questions and Supports 6 09-18-2011 11:49 PM
Make Breeding Random? SilverDragonTears Suggestions and Feature Requests 7 08-25-2011 04:58 AM
No breeding RoconzaArt Questions and Supports 15 01-24-2011 02:48 PM
Breeding Arianna Questions and Supports 27 10-30-2009 01:12 PM


All times are GMT -5. The time now is 06:04 AM.

Currently Active Users: 451 (0 members and 451 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636