Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 02-04-2021, 01:24 AM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 30,129
parayna is on a distinguished road
Default

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";
    } 
__________________
It's been a long time. I had so much fun making a site back in 2016 that recently, when I started thinking about it again, I decided to come back and work on something small. It'll probably just be a personal project but who knows? We'll see, anyway.

Reply With Quote
 


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


All times are GMT -5. The time now is 08:48 PM.

Currently Active Users: 1966 (0 members and 1966 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636