Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   1.3.5 Alternates (http://www.mysidiaadoptables.com/forum/showthread.php?t=5704)

Abronsyth 12-29-2020 10:36 AM

1.3.5 Alternates
 
I see that when a new adoptable is inserted into the database the field "alternate" is filled in with 0. So how/when/where is the alternate form defined?

(Asking because my 1.3.4 site is heavily modified so I am upgrading in bits and pieces.)

EDIT:
Also it looks like class_breeding isn't updated for the new alternates function.

Hall of Famer 12-29-2020 01:06 PM

There is a new table called {$prefix}_alternates, which defines a list of adoptables alternate form. I will look into the breeding system and see if theres a bug I need to fix.

Abronsyth 12-30-2020 10:11 AM

I see that the alternates table stores the alternate forms for each adoptable type, but how is the chosen alternate form selected for each individual owned adoptable? I just see in the owned_adoptables table the section for alternate, but the default for when a pet is adopted is simply 0. So where/how does the script determine which alternate form is used?

And for breeding it's just in class_breeding.php the insert function is still the old version (with the "use_alternates" column for ownedadoptables.)

Hall of Famer 01-02-2021 10:09 AM

1 Attachment(s)
I've fixed the issue with alternate status in breeding. If you are using Mys v1.3.5 already, download the attachment to fix the bug. Otherwise, I will update the download links later today so this issue will go away for new users.

kristhasirah 01-04-2021 04:08 PM

I also have the same question as Abronsyth where do one set an individual adopt to be alt or not and witch one to use. Im trying to upgrade my site and most of my adopts have an alternate version, but the alt image is not showing, now all of my alternates have the default image.

edit: never mind, found where to add the alt image.

my new problem is that the last alt form don't work. my site uses 7 levels 4 for the eggs and 3 for the rest. so I have an alternate adopt at level 6 and then level the adopt to level 7 and the image reverts to the primary image...

Abronsyth 01-05-2021 05:08 PM

Where did you find that the individual pet's alt form is stored?

kristhasirah 01-06-2021 08:49 AM

when an alt is chosen the url will be written in the imageurl column and the 0 in the alternate column will be replaced with the number of the alt.
so to make an owned adoptable an alt you need to add the image url to the imageurl and add the number to the alternates column

Abronsyth 01-10-2021 02:53 PM

Quote:

Originally Posted by kristhasirah (Post 37796)
when an alt is chosen the url will be written in the imageurl column and the 0 in the alternate column will be replaced with the number of the alt.
so to make an owned adoptable an alt you need to add the image url to the imageurl and add the number to the alternates column

I understand this, but what I am trying to figure out is when/where is an alt chosen? Where's the code that changes it in the database?


I'm also having the last-alt error, puts it in as 0 even when I put a different number in. However when I got back and edit it, it updates just fine.
Edit: Nevermind, it appears to be working upon adding more. Weird.

Hall of Famer 01-13-2021 09:18 AM

Last alt works similarly as other conditions as the chance will apply. If you set the last alt field with 50 chance, then it will only be selected 1 out of 2.

parayna 02-04-2021 01:24 AM

I've been having an issue with the alts too, and on a brand new 1.3.5 website set up on mysidiahost. I'd been having an issue with it on my wamp site too, even with a fresh install to check if I'd done something wrong. It throws this error:

Fatal error: Call to undefined method Adoptable::getAltStatus() in /home/beanpets/public_html/adopt.php on line 32

So I checked adopt.php and there is this line on line 32:

$alts = $adopt->getAltStatus();

But from what I can see this is never defined in class_adoptable so I think the error is because it doesn't know what it means? If I delete that line the error goes away and allows me to adopt things, but any alt form I set in adminCP doesn't get applied so that's not a proper fix lol

This is my class_adoptable if anyone can help:

PHP Code:

<?php

use Resource\Native\String;

class 
Adoptable extends Model{

    protected 
$id;
    protected 
$type;
    protected 
$class;
    protected 
$description;
    protected 
$eggimage;
    protected 
$whenisavail;
    protected 
$alternates;
    protected 
$altoutlevel;
    protected 
$shop;
    protected 
$cost;  

    protected 
$conditions;
    protected 
$levels;    
    protected 
$alternateModels;
  
    public function 
__construct($adoptinfo){      
        
$mysidia Registry::get("mysidia");
        if(
$adoptinfo instanceof String$adoptinfo $adoptinfo->getValue();        
        
$whereClause = (is_numeric($adoptinfo))?"id ='{$adoptinfo}'":"type ='{$adoptinfo}'";
        
$row $mysidia->db->select("adoptables", array(), $whereClause)->fetchObject();
        if(!
is_object($row)) throw new AdoptNotfoundException("Adoptable {$adoptinfo} does not exist...");
        foreach(
$row as $key => $val){
            
$this->$key $val;              
        }      
    }

    public function 
getID(){
        return 
$this->id;
    }

    public function 
getType(){
        return 
$this->type;
    }

    public function 
getClass(){
        return 
$this->class;
    }
  
    public function 
getDescription(){
        return 
$this->description;
    }
    
    public function 
getEggImage($fetchMode ""){
        if(
$fetchMode == Model::GUI) return new Image($this->eggimage);
        return 
$this->eggimage;
    }
    
    public function 
getWhenAvailable(){
        return 
$this->whenisavail;
    }
    
    public function 
hasAlternates(){
        return 
$this->alternates;
    }
    
    public function 
getAltLevel(){
        return 
$this->altoutlevel;
    }
    
    public function 
getShop($fetchMode ""){
        if(
$fetchMode == Model::MODEL) return new AdoptShop($this->shop);
        else return 
$this->shop;
    }
    
    public function 
getCost(){
        return 
$this->cost;
    }
  
    public function 
getConditions(){
        if(!
$this->conditions$this->conditions = new AdoptConditions($this);
        return 
$this->conditions;     
    }
  
      public function 
getLevel($level){
        if(!
$this->levels) return new AdoptLevel($this->type$level);
        return 
$this->levels[$level];
    }
  
    public function 
getLevels(){
        if(!
$this->levels){
            
$mysidia Registry::get("mysidia");
            
$this->levels = new ArrayObject;
            
$num $mysidia->db->select("levels", array("thisislevel"), "adoptiename='{$this->type}'")->rowCount();
            for(
$i 0$i <= $num$i++){
                
$this->levels->append(new AdoptLevel($this->type$i));    
            }
        }
        return 
$this->levels;        
    }

    public function 
getAlternatesForLevel($level){ 
        if(!
$this->alternateModels){ 
            
$mysidia Registry::get("mysidia");
            
$this->alternateModels = new ArrayObject;
            
$stmt $mysidia->db->select("alternates", array(), "adopt='{$this->type}' AND level='{$level}'");
            while(
$alternate $stmt->fetchObject()){
                
$this->alternateModels->append(new AdoptAlternate($alternate));    
            }            
        }
        return 
$this->alternateModels;
    }

    protected function 
canUseAlternate($level){ 
        if(
$this->alternates == "enabled" and $level >= $this->altoutlevel) return TRUE;
        if(
$this->getAlternatesForLevel($level)->count() > 0) return TRUE
        return 
FALSE;
    }
    
    public function 
getMaxLevel(){
        return 
$this->levels->count(); 
    }
    
    public function 
getCode(){
        return 
codegen(100);
    }
    
    public function 
getGender(){
        
$genders = array('f''m');
        
$rand rand(0,1);
        return 
$genders[$rand];
    }
    
    protected function 
save($field$value){
        
$mysidia Registry::get("mysidia");
        
$mysidia->db->update("adoptables", array($field => $value), "id='{$this->id}'");
    }
}
?>

I haven't touched it other than to look inside so I've definitely not deleted anything.

Update: I tried using the 1.3.4 files adopt.php and class_adoptable.php and they both work (with a slight change to make usealternates say alternates in adopt.php). It seems the 1.3.5 class_adoptable doesn't have this section that the 1.3.4 version does.

PHP Code:

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



All times are GMT -5. The time now is 03:29 AM.

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