Thread: Mys 1.3.4 Multiple Alternate Images
View Single Post
  #2  
Old 02-27-2018, 04:23 AM
goofyunicorn's Avatar
goofyunicorn goofyunicorn is offline
Kelpie
 
Join Date: Feb 2018
Location: Unicorn Land
Posts: 101
Gender: Female
Credits: 12,804
goofyunicorn is on a distinguished road
Default

Quote:
Originally Posted by Dinocanid View Post
(Warning: Under construction! It should work as is, but I have yet to cover the ACP portion)

Multiple Alternate Images Mod for v1.3.4
Description: I stumbled upon this today and decided to share it. It's how I turned my spaniel flan into a berry flan:
  Spoiler: Screenshot 

This works just fine with the Alternate Gender Image mod, though I don't cover how to make an alternate for each gender here.

-Step 1-
Go into phpMyAdmin and create a new column in owned_adoptables:


Now go to levels and create a new column:


Finally, go into adoptables and create a new column:


-Step 2-
Go into class_adoptable.php and add this:
PHP Code:
protected $rarealts;

public function 
hasRareAlternates(){
        return 
$this->rarealts;
    } 
Now go into class_adoptlevel.php:
PHP Code:
protected $rarealternateimage;

public function 
getRareAlternateImage($fetchMode ""){
        if(
$fetchMode == Model::GUI) return new Image($this->rarealternateimage);
        return 
$this->rarealternateimage;
    } 
Now class_ownedadoptable...
PHP Code:
protected $userarealternates;

public function 
useRareAlternates(){
        return 
$this->userarealternates;
    }

public function 
getRareAltStatus(){
        if(
$this->rarealts == "enabled" and $this->currentlevel == $this->altoutlevel){
            
$rand mt_rand(1$this->altchance);
            if(
$rand == 1) return "yes";            
        }
        return 
"no";
    }

public function 
getRareAltImage($fetchMode ""){
        if(
$this->imageurl) return $this->getImageUrl($fetchMode);
        if(
$this->currentlevel == 0) return $this->getEggImage($fetchMode);
        
        
$mysidia Registry::get("mysidia");        
        
$level $this->getCurrentLevel("model");
         return 
$level->getRareAlternateImage($fetchMode);            
    } 
Replace public function getImage with this:
PHP Code:
public function getImage($fetchMode ""){
        if(
$this->imageurl) return $this->getImageUrl($fetchMode);
        if(
$this->currentlevel == 0) return $this->getEggImage($fetchMode);
        
        
$mysidia Registry::get("mysidia");        
        
$level $this->getCurrentLevel("model");
        
$type $this->getType();
        if(
$this->useAlternates() == "yes") return $level->getAlternateImage($fetchMode);
        elseif(
$this->useRareAlternates() == "yes") return $level->getRareAlternateImage($fetchMode);
        else return 
$level->getPrimaryImage($fetchMode);            
    } 
-Step 3-
ACP stuff goes here momentarily...

-Notes-
Now it should work if you fill in the rare alternate image value in phpMyAdmin. This method can be used however many times you want depending on how many alternate images you want. (For me I have the gender images, rare image, and gold image)

Did you work an ACP version? :)
Reply With Quote