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
  #1  
Old 11-22-2012, 11:32 PM
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: 486,969
Hall of Famer is on a distinguished road
Default Gender Ratio Mod for Mys v1.3.2

Well my old gender ratio script is not compatible with the new script, so I decide to make a new one. It really isnt complicated, just a few minor edits and its up and running.

I've provided a zip file that contains all necessary modifications to make in your script file in order to get this to work. Incase you have a highly customized site, you may install this Mod manually by following the instruction below. To begin with, insert a new column into table prefix.adoptables as usual:

PHP Code:
'genderratio'INT11 ), default 50 
Since admin.php file does not exist nowadays, you need to go to the file /admincp/adopt.php to modify the form. To add the input field Genderratio into adoptables creation form, find the following code below:

PHP Code:
                                                      </fieldset>    
                                   <
p><input name='page' type='hidden' id='page' value='adopt'>
                                   <
input name='action' type='hidden' id='action' value='add'>
                                   <
input type='submit' name='submit' value='Create This Adoptable'></p></form>"; 
Add above

PHP Code:
      <p>The Gender Ratio of your adoptable is 
             
<input name='genderratio' type='text' id='genderratio' size='6' maxlength='6'> </p
Continue in this script file, find these lines below:

PHP Code:
            $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"))); 
Replace with:

PHP Code:
            $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"), "genderratio => $mysidia->input->post("genderratio")")); 
The next thing to do, of course, is to manually update our beloved doadopt.php file to enable gender ratio to work while a user is trying to adopt a pet. Find these lines that determine adoptables gender:

PHP Code:
         $genders = array('f''m');
         
$rand rand(0,1);
         
$mysidia->user->changecash(-$row->cost);
         
$mysidia->page->settitle("{$name} adopted successfully");
         
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0)); 
Replace by the gender ratio generation code:
PHP Code:
     $tempgender rand(099);
      if(
$tempgender $row->genderratio){
         
$gender "f";
         unset(
$tempgender);
      }
      else {
         
$gender "m";
         unset(
$tempgender);
      }  
         
$mysidia->user->changecash(-$row->cost);
         
$mysidia->page->settitle("{$name} adopted successfully");
         
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"lastbred" => 0)); 
If you want the gender ratio script to work with breeding, you will have to do one last task. The below edit is not required, but for those who want pets gender ratio to take effect on breeding. To do this, you need to go to breeding.php and find the following lines:

PHP Code:
       $genders = array('f''m');
       
$genderrand rand(0,1);    

       
// Get other related information       
       
$code codegen(100);
       
$alts getaltstatus($female_species->id00);
       
$time time();
       
       
// Insert a baby adoptable to the database
       
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $types[$typerand], "name" => $types[$typerand], "owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                      
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$genderrand], "lastbred" => 0)); 
Replace with:

PHP Code:
    $genderratio = ($typerand == 0)?$female_species->genderratio:$male_species->genderratio;
    
$tempgender rand(099);
    if(
$tempgender $genderratio){
        
$gender "f";
        unset(
$tempgender);
    }
    else {
       
$gender "m";
       unset(
$tempgender);
    }    

       
// Get other related information       
       
$code codegen(100);
       
$alts getaltstatus($female_species->id00);
       
$time time();
       
       
// Insert a baby adoptable to the database
        
$mysidia->db->insert("owned_adoptables", array("aid" =>  NULL"type" => $types[$typerand], "name" => $types[$typerand],  "owner" => $mysidia->user->username"currentlevel" => 0,  "totalclicks" => 0"code" => $code
                                                       
"imageurl" => NULL,  "usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen"  => 'no'"gender" => $gender"lastbred" => 0)); 
Now we are all done, it is just this simple isnt it? Like I mentioned earlier I've uploaded a zip file containing all modified scripts for those who are running a fresh installation of Mysidia Adoptables. Note you can only use them if you have not heavily modified your script files. The install_genderratio.php file needs to be executed to insert the column genderratio(INT 11) automatically to your database, although you can again do it manually. Enjoy!
Attached Files
File Type: rar gender ratio mod v1.3.2.rar (8.1 KB, 5 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 12-29-2012, 03:18 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,007
Abronsyth is on a distinguished road
Default

Hey, HoF, I installed this (all went well), but I was just wondering how I actually set the ratio..? I know I set it when creating a new adoptable, but what is the format..? I mean, how do I type in the ratio..? I'm wanting it to be 1 male for every 4 females...so, how do I put this in..?

Thanks!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #3  
Old 12-29-2012, 03:53 PM
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: 486,969
Hall of Famer is on a distinguished road
Default

To set the ratio, enter a number between 0 to 100. 0 means 100% male, 100 means 100% female, the default value is 50.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 12-29-2012, 05:19 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,007
Abronsyth is on a distinguished road
Default

Er, okay...so 75 would make it 25% male..? (Or rather, 75% female..?)
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #5  
Old 12-29-2012, 05:27 PM
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: 486,969
Hall of Famer is on a distinguished road
Default

Correct, you get the idea.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 01-08-2013, 12:34 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,007
Abronsyth is on a distinguished road
Default

Okay...so I'd like to use both this mod and your Item Drop mod...however I noticed that both edit the adopt.php file, so do you know how I'd go about making it so I can use both on my site?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #7  
Old 01-08-2013, 03:02 PM
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: 486,969
Hall of Famer is on a distinguished road
Default

Well they do not really bar each other. You need to create one new column for gender ratio and two columns for itemdrop. In adopt.php, the sql insert line will become something like this(assuming you add gender ratio column first):

PHP Code:
 $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"), 
                                                     
"genderratio" => $mysidia->input->post("genderratio"), "dropitem" => $mysidia->input->post("dropitem"), "droprate" => $mysidia->input->post("droprate"))); 
Of course you still need to modify the adoptable creation form, this should be easy.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
Reply


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 08: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 04:34 PM
Mys v1.3.1 Gender Ratio Mod for v1.3.1 Hall of Famer Mys v1.3.x Mods 15 08-17-2012 04:25 AM
Hall of Famer's Gender Ratio Mod v1.2 Hall of Famer Mys v1.2.x Mods 45 04-02-2012 01:42 PM
gender ratio script maximillion Questions and Supports 16 06-27-2011 12:59 PM


All times are GMT -5. The time now is 12:34 AM.

Currently Active Users: 868 (0 members and 868 guests)
Threads: 4,081, Posts: 32,029, 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