View Single Post
  #26  
Old 12-07-2014, 09:43 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 89,171
Kyttias is on a distinguished road
Default

Well looking for $genders = array('f', 'm'); was definitely key, still! It's also in classes/class_promocode.php and classes/class_stockadopt.php, of course, for adoptables acquired through promo codes and shops. Take note, where you found it in classes/class_adoptables.php has it inside a function. This function is being run in adopt.php - and this is where we'll have to implement the changes for this particular type of acquiring a pet (from the /adopts page, where available pets are shown).

So let's get started!

Alternate Gender Mod for Mysidia v1.3.4
We're going to opening up adopt.php first. Inside the index function, after $gender = $adopt->getGender(); add:
PHP Code:
switch($gender){
                case 
"m"
                    
$alts "yes";
                    break;
                default: 
                    
$alts "no";
            } 
That's all you need to do here, since it's using the function in classes/class_adoptables.php. However, these next two pages don't, so they'll require an extra couple steps.

Now in classes/class_stockadopt.php, inside function append($owner = ""), find $rand = rand(0,1), and afterward add in -
PHP Code:
$petgender $genders[$rand];
    switch(
$petgender){
                case 
"m"
                  
$alts "yes";
                    break;
                default: 
                    
$alts "no";
            } 
Immediately after this is where the data is being entered into the database. Find inside this $mysidia->db->insert query "gender" => $genders[$rand] and change it to:
PHP Code:
"gender" => $petgender 
Of course, make sure there is still a comma after it. Wouldn't want any errors, would we? ^^;

Now go do exactly the same thing you just did above inside classes/class_promocode.php as well! This time you can find the $rand to add code after inside function execute().

All done.

But please pay attention to two details, as seen here when creating an adoptable:


Changing this number will not change the gender ratio, as the gender is determined at birth with a random generator. There is no 'chance' of alternates happening now, they will only happen based on gender at the pet's creation.

If you make a gender changing potion, this will not change the pet's image. So if you plan on making a function for such an item, remember to change the alt image, not just the gender marker. Check out this mod for further instructions.

Keep in mind that this gender alternate image mod cannot affect the EGG or LEVEL 0 image. My pets do not hatch from eggs, so I must keep this in mind and supply a neutral, gender-less image for tiny baby pets, that will last at least until their first click/visit.

Lastly, the code is currently set for the "default" gender to be female. So, if female, use the base image. If male, use the alternate image. If you want this to be the other way around, change case "m": to case "f": in all three switch statements. This is universal for all pets!

ALSO!!!! Hey HoF/IntoRain, if you stop by this thread -- what would have to be done to make these changes go through immediately at egg/0 level?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 12-09-2014 at 11:38 PM.
Reply With Quote