Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Suggestions and Feature Requests (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=21)
-   -   Alternate Images for Genders (http://www.mysidiaadoptables.com/forum/showthread.php?t=2296)

draugluin 11-01-2012 01:38 PM

@ HoF

aaaaah, that's it. I've got it. Cool... thank you :meow:

draugluin 06-03-2013 03:46 AM

Is it possible, to write this function for Mys 1.3.3 ?
This would be very, very nice :)

I think, I have to study this new (cyrillic :bucktard:) version :happyc:

Thanks a lot :jay:

AndromedaKerova 11-11-2014 05:45 PM

Is this modification compatible with 1.3.4?

AndromedaKerova 11-12-2014 10:23 PM

I had a go at this but there seems to be no doadopt.php in 1.3.4.

I found something similar to the code inside classes/class_adoptable.php

PHP Code:

    public function getGender(){
        
$genders = array('f''m');
        
$rand rand(0,1);
        return 
$genders[$rand];
    } 

But there was no:
// Adoption complete, show the user a confirmation screen...

I kept looking and finally found something close to that line in view/adoptview.php

I'm not sure if the code should go here or in class_adoptable.

AndromedaKerova 11-23-2014 02:21 PM

Ok, I've given up after over a week of failing. If someone could get this working for 1.3.4, that would be awesome.

Kyttias 12-07-2014 09:43 PM

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:
http://fc03.deviantart.net/fs70/f/20...as-d8932pq.png

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?

Hall of Famer 12-08-2014 07:23 PM

Oh so Kyttias is giving a try on this idea, sounds intriguing. ^^ I replied to your message on AIM, it will be easy and possible to edit the alternate image system so it will start to work at lv.0. I think there is a method in class Adoptable that generates an owned adoptable's primary or alternate form, you can try applying this method when an owned adoptable is adopted at the first place, rather than when it hits lv.1.


All times are GMT -5. The time now is 08:19 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.