View Single Post
  #18  
Old 05-23-2019, 03:34 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,036
kristhasirah
Default

it works you just make sure you have inserted the correct info to your table prefix.adoptables.: http://www.mysidiaadoptables.com/for...57&postcount=1
and how it shoud look: http://www.mysidiaadoptables.com/for...40&postcount=5
if you have a new install here is the page of the mod for the Mys v1.3.4: http://www.mysidiaadoptables.com/for...15&postcount=1
that have all the files needed for a fresh install.
the rest of the code you need to separate it in parts:
in /admincp/view/adoptview.php find:
PHP Code:
        $adoptForm->add($basicInfo);
        
$adoptForm->add($shopSettings);
        
$adoptForm->add($conditions);
        
$adoptForm->add($miscellaneous);
        
$adoptForm->add(new Button("Create this Adoptable""submit""submit"));
        
$document->add($adoptForm); 
after that paste:
PHP Code:
        $miscellaneous->add(new Comment("The Gender Ratio of your adoptable is "FALSE));
        
$miscellaneous->add(new TextField("genderratio"50)); 
then in /admincp/adopt.php find:
PHP Code:
            $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"))); 
and replace with this one:
PHP Code:
            $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"), "genderratio" => $mysidia->input->post("genderratio"))); 
if you have already edited that part of the code and added some other things then you just need to add this part to the code you have:
PHP Code:
"genderratio" => $mysidia->input->post("genderratio"
then in classes/class_adoptable.php find this:
PHP Code:
    protected $id;
    protected 
$type;
    protected 
$class;
    protected 
$description;
    protected 
$eggimage;
    protected 
$whenisavail;
    protected 
$alternates;
    protected 
$altoutlevel;
    protected 
$altchance;
    protected 
$shop;
    protected 
$cost;  
    protected 
$conditions;
    protected 
$levels
and add this:
PHP Code:
    protected $genderratio
then search for this code:
PHP Code:
    public function getGender(){
        
$genders = array('f''m');
        
$rand rand(0,1);
        return 
$genders[$rand];
    } 
and replace with:
PHP Code:
    public function getGenderRatio(){
        return 
$this->genderratio;
    }
    
    public function 
getGender(){        
        
$genderNumber rand(099);
        if(
$genderNumber $this->genderratio$gender "f";
        else 
$gender "m";
        return 
$gender;        
    } 
save the file, now go to classes/class_stockadopt.php
after
PHP Code:
  public $owner
add:
PHP Code:
  public $genderratio
then search for:
PHP Code:
public function append($owner ""){
      
// This method adds items to user inventory
  
      
$mysidia Registry::get("mysidia");
      
$this->owner = (!empty($owner))?$owner:$this->owner;
      
$alts $this->getaltstatus(0);
      
$code codegen(100);
      
$genders = array('f''m'); 
replace $genders = array('f','m'); with:
PHP Code:
      $genderNumber rand(099);
if(
$genderNumber $this->genderratio$gender "f";
else 
$gender "m"
then in
PHP Code:
      $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->type"name" => $this->type"owner" => $this->owner,
                                                     
"currentlevel" => 0"totalclicks" => 0"code" => $code"imageurl" => """usealternates" => $alts
                                                     
"tradestatus" => "fortrade""isfrozen" => "no""gender" => $genders[$rand],
                                                     
"offsprings" => 0"lastbred" => 0)); 
replace : "gender" => $genders[$rand], with:
PHP Code:
"gender" => $gender 
and you should have a working mod =)
__________________

Last edited by kristhasirah; 05-23-2019 at 03:40 PM.
Reply With Quote