Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 05-23-2012, 05:42 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,016
SilverDragonTears is on a distinguished road
Default

Can you post your breeding script for me?
__________________

Check out SilvaTales
Reply With Quote
  #12  
Old 05-23-2012, 05:53 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,221
kristhasirah
Default

sure: this is the edited code, and i only edited the area with the gender.
Code:
//***************//
//  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);

if($isloggedin == "yes" and $userstatus['canbreed'] == "yes"){
    if ($breed != 'yes'){ // if they have not chosen which pets to breed yet, we let them choose
        $article_content .= "<p>Select the two adoptables that you'd like to breed:</p><form method='post'>"; 
		$lastweek = time() - ((grabanysetting('breedinginterval')) * 24 * 60 * 60);
		
		// show all available female adoptables
        $stmt = $adopts->select("owned_adoptables", array(), "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 adoptables can breed at the time.</p>";
		}
		
		// show all available male adoptables
		$stmt = $adopts->select("owned_adoptables", array(), "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 adoptables can breed at the time.</p>";
		}
        $article_content .= "<input type='hidden' name='breed' value='yes'><input type='submit' value='Breed It'></form>";
    } 
    else {
		$female = $adopts->select("owned_adoptables", array(), "aid = '{$femaleid}'")->fetchObject();	
		$female_species = $adopts->select("adoptables", array(), "type = '{$female->type}'")->fetchObject();	
        $female_class = explode(",",$female_species->class);
		
		$male = $adopts->select("owned_adoptables", array(), "aid = '{$maleid}'")->fetchObject();	
		$male_species = $adopts->select("adoptables", array(), "type = '{$male->type}'")->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
           $ban = banuser($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
           $ban = banuser($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
			$genderratio = ($typerand == 0)?$female_species->genderratio:$male_species->genderratio;
			$tempgender = rand(0, 99);
            if($tempgender < $genderratio){
               $gender = "f";
            unset($tempgender);
            }
            else {
                $gender = "m";
                unset($tempgender);
            }				
            $code = codegen(10, 0);

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

			$time = time();
	        $adopts->insert("owned_adoptables", array("aid" => NULL, "type" => $types[$typerand], "name" => $types[$typerand], "owner" => $loggedinname, "currentlevel" => 0, "totalclicks" => 0, "code" => $code, 
			                "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $genders[$genderrand], "lastbred" => 0));
						
			$article_content = "Congratulations! Breeding is successful, you have acquired a baby {$types[$typerand]} from breeding center.
            <br><a href='myadopts.php'>Manage your new {$types[$typerand]} now!</a></p>";

			$adopts->update("owned_adoptables", array("lastbred" => $time), "aid = '{$femaleid}'");
			$adopts->update("owned_adoptables", array("lastbred" => $time), "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);

?>
__________________
Reply With Quote
  #13  
Old 05-23-2012, 07:38 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,016
SilverDragonTears is on a distinguished road
Default

Change this:
Code:
$adopts->insert("owned_adoptables", array("aid" => NULL, "type" => $types[$typerand], "name" => $types[$typerand], "owner" => $loggedinname, "currentlevel" => 0, "totalclicks" => 0, "code" => $code, 
			                "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $genders[$genderrand], "lastbred" => 0));
to this:
Code:
$adopts->insert("owned_adoptables", array("aid" => NULL, "type" => $types[$typerand], "name" => $types[$typerand], "owner" => $loggedinname, "currentlevel" => 0, "totalclicks" => 0, "code" => $code, 
			                "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $gender, "lastbred" => 0));
__________________

Check out SilvaTales
Reply With Quote
  #14  
Old 05-24-2012, 11:09 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,221
kristhasirah
Default

THANK YOU! everything is working perfectly now! =D
__________________
Reply With Quote
  #15  
Old 08-15-2012, 10:30 AM
quirkii's Avatar
quirkii quirkii is offline
Member
 
Join Date: Jul 2012
Posts: 11
Gender: Female
Credits: 3,512
quirkii is on a distinguished road
Default

Hi, there seems to be a problem with the gender ratio mod. Everything worked great and all, except that it seemed to have caused some redirecting errors after adopting a pet.

Usually, after the adoption; users would be redirected to a page where they'll be told to either manage or feed their adoptables. Prior to installing the gender ratio mod, this part had no problems. But after installing it- this error message saying "invalid adoptable id specifiedThe ID specified does not match any adoptable in our system. Sorry. If you wish, you can adopt a pet." appears instead. The url, which usually displays the id number of the adoptable- did not generate. What I mean by that is that it turns out like this>> "website.com/myadopts.php?act=manage&id=" when it should have been "website.com/myadopts.php?act=manage&id=1" (example).

Can anyone provide a fix to this problem?
Reply With Quote
  #16  
Old 08-17-2012, 03:25 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 329,538
Hall of Famer is on a distinguished road
Default

I see, it appears that the adoptables id is not loaded correctly. I do not think anyone else has reported this problem a few months ago, so there's a good chance that you installed the mod incorrectly. Would you mind showing me your doadopt.php file after installing this mod? I can fix it for you then.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
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
Mys v1.3.4 Gender Ratio Mod for Mys v1.3.4 Hall of Famer Mys v1.3.x Mods 14 06-17-2020 07:20 PM
Mys v1.3.3 Gender Ratio Mod for Mys v1.3.3 Hall of Famer Mys v1.3.x Mods 17 05-23-2019 03:34 PM
Mys v1.3.2 Gender Ratio Mod for Mys v1.3.2 Hall of Famer Mys v1.3.x Mods 6 01-08-2013 02:02 PM
Hall of Famer's Gender Ratio Mod v1.2 Hall of Famer Mys v1.2.x Mods 45 04-02-2012 12:42 PM
gender ratio script maximillion Questions and Supports 16 06-27-2011 11:59 AM


All times are GMT -5. The time now is 05:39 PM.

Currently Active Users: 467 (0 members and 467 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