Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Reply
 
Thread Tools Display Modes
  #11  
Old 02-17-2016, 01:44 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 996
Gender: Male
Credits: 40,684
Abronsyth is on a distinguished road
Default

And what is the exact file name of the main file for it (the one in the home directory)? If that one is Leopardview.php, then the other should be Leopard.php

And, if possible, please show me your Leopard.php file (in php tags) and your Leopardview.php file.
Reply With Quote
  #12  
Old 02-17-2016, 01:52 PM
gunpowdercat gunpowdercat is offline
Member
 
Join Date: Feb 2016
Posts: 29
Gender: Female
Credits: 621
gunpowdercat is on a distinguished road
Default

Putting the names in lowercase worked, Thanks. You might wanna put in the main post that the thing is a picky eater... lol...
Reply With Quote
  #13  
Old 02-17-2016, 02:02 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 35,979
Kyttias is on a distinguished road
Default

PHP is a picky language in general (I'd say all programming languages are case-sensitive). But I went ahead and added it to my custom page guide as a general note.
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.

Last edited by Kyttias; 02-17-2016 at 02:07 PM.
Reply With Quote
  #14  
Old 02-17-2016, 02:08 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 996
Gender: Male
Credits: 40,684
Abronsyth is on a distinguished road
Default

Ah, so that was the problem! I copied the general layout of the other files (which are lowercase) for the sake of organization. It didn't even occur to me that changing the case would present problems since I've never done that, haha.

I'm glad you got it working, though!
Reply With Quote
  #15  
Old 02-17-2016, 04:38 PM
gunpowdercat gunpowdercat is offline
Member
 
Join Date: Feb 2016
Posts: 29
Gender: Female
Credits: 621
gunpowdercat is on a distinguished road
Default

Found a bug. if you do not have enough currency to purchase the adopt; it will tell you you can't, but the adopt still goes into their myadopts.php, and subtract no currency.
Reply With Quote
  #16  
Old 02-17-2016, 10:13 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 35,979
Kyttias is on a distinguished road
Default

Aaack, I meant to mention this on the original thread but now I can't even find the if statement I wrote up. This can definitely be easily fixed.

Here's the file with changes:
PHP Code:
<?php

use Resource\Native\Integer;
use 
Resource\Native\String;
use 
Resource\Native\Arrays;
use 
Resource\Native\Null;

class 
NAMEController extends AppController{

    public function 
__construct(){
        
parent::__construct("member");
        
$mysidia Registry::get("mysidia");
        if(
$mysidia->usergroup->getpermission("canadopt") != "yes"){
            throw new 
NoPermissionException("permission");
        }    
    }
    
    public function 
index(){ 
        
$mysidia Registry::get("mysidia");         
        if(
$mysidia->input->post("submit")){ 
            
$this->access "member"
            
$this->handleAccess(); 
            
$id $mysidia->input->post("id"); 
            if(
$mysidia->session->fetch("adopt") != or !$id) throw new InvalidIDException("global_id");             
             
            
$adopt = new Adoptable($id); 
            
$conditions $adopt->getConditions(); 
            if(!
$conditions->checkConditions()) throw new NoPermissionException("condition"); 
             
            
$name = (!$mysidia->input->post("name"))?"Unnamed":$mysidia->input->post("name"); 
            
$alts $adopt->getAltStatus(); 
            
$code $adopt->getCode(); 
            
$gender $adopt->getGender(); 


            
$cost $mysidia->db->select("adoptables", array("cost"), "type='{$adopt->getType()}'")->fetchColumn();
            
$moneyleft $mysidia->user->money $cost;

            if(
$moneyleft >= 0){ 
                
$mysidia->user->changecash(-$cost);
                
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code,  
                                                                   
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'notfortrade'"isfrozen" => 'no'"gender" => $gender"offsprings" => 0  )); 
                    
                
$aid $mysidia->db->select("owned_adoptables", array("aid"), "code='{$code}' and owner='{$mysidia->user->username}'")->fetchColumn(); 
                
$this->setField("aid", new Integer($aid)); 
                
$this->setField("name", new String($name));             
                
$this->setField("eggImage", new String($adopt->getEggImage()));  

                 return 
TRUE;           
            }
          else throw new 
InvalidActionException("Sorry, you cannot afford this transaction.");
        }  
        
        
$mysidia->session->assign("adopt"1TRUE);
        
$ids $mysidia->db->select("adoptables", array("id"), "shop='NAME'")->fetchAll(PDO::FETCH_COLUMN);
        
$total = ($ids)?count($ids):0;
        
        if(
$total == 0$adopts = new Null;
        else{        
            
$adopts = new Arrays($total);
            
$available 0;
            
            foreach(
$ids as $id){
                
$adopt = new Adoptable($id);
                
$conditions $adopt->getConditions();    
                  if(
$conditions->checkConditions()) $adopts[$available++] = $adopt;    
            }
            
            if(
$available == 0$adopts = new Null;
            else 
$adopts->setSize($available);            
        }        
        if(
$adopts instanceof Null) throw new InvalidActionException("adopt_none");
        
$this->setField("adopts"$adopts);
    }
}
?>
(*Remember to change the two instances of NAME.)

What I modified specifically:
PHP Code:
$cost $mysidia->db->select("adoptables", array("cost"), "type='{$adopt->getType()}'")->fetchColumn();
$moneyleft $mysidia->user->money $cost;

if(
$moneyleft >= 0){ 
    
$mysidia->user->changecash(-$cost);
    
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code,  
                                                       
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'notfortrade'"isfrozen" => 'no'"gender" => $gender"offsprings" => 0  )); 
        
    
$aid $mysidia->db->select("owned_adoptables", array("aid"), "code='{$code}' and owner='{$mysidia->user->username}'")->fetchColumn(); 
    
$this->setField("aid", new Integer($aid)); 
    
$this->setField("name", new String($name));             
    
$this->setField("eggImage", new String($adopt->getEggImage()));  

     return 
TRUE;           
}
else throw new 
InvalidActionException("Sorry, you cannot afford this transaction."); 
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.

Last edited by Kyttias; 02-17-2016 at 10:24 PM.
Reply With Quote
  #17  
Old 02-17-2016, 10:30 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 996
Gender: Male
Credits: 40,684
Abronsyth is on a distinguished road
Default

Oop, good catch! I've gone ahead and updated the attachment (thank you, Kyttias!)!
Reply With Quote
  #18  
Old 02-18-2016, 08:49 AM
gunpowdercat gunpowdercat is offline
Member
 
Join Date: Feb 2016
Posts: 29
Gender: Female
Credits: 621
gunpowdercat is on a distinguished road
Default

Thanks, Kyttias! a few of my users were being quite the pain with this lol...
Reply With Quote
  #19  
Old 02-18-2016, 12:38 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 996
Gender: Male
Credits: 40,684
Abronsyth is on a distinguished road
Default

I am glad you find the mod useful :)
Reply With Quote
  #20  
Old 12-02-2017, 05:57 PM
gwynmil's Avatar
gwynmil gwynmil is offline
Member
 
Join Date: Sep 2017
Location: UK
Posts: 24
Gender: Female
Credits: 1,120
gwynmil is on a distinguished road
Default

This mod works perfectly, thank you! :D

I have a question though. Is it possible for one breed (adopt type) to be available from multiple shops?

Most of my griffins have randomly generated hex colours and, well, you can imagine how hideous it gets haha. So I'd like to have shops selling preset white/black/brown versions of most breeds, to help players get started in their selective breeding goals. Setting up each shop to generate its own colour scheme is no problem, but I'm stuck on how to actually make the breeds available... ^^' Any ideas?

edit: oh, noticed these lines, 54-57

PHP Code:
        $mysidia->session->assign("adopt"1TRUE);
        
$ids $mysidia->db->select("adoptables", array("id"), "shop='pale'")->fetchAll(PDO::FETCH_COLUMN);
        
$total = ($ids)?count($ids):0
If I'm reading it correctly, it scans the table to pick up breeds with that shop assigned. Would it be a wise idea to manually write an array of desired breed IDs here, instead? Or would it mess something up?

Last edited by gwynmil; 12-02-2017 at 06:38 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

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 07:22 AM.

Currently Active Users: 231 (1 members and 230 guests)
Threads: 3,947, Posts: 31,433, Members: 15,534
Welcome to our newest members, w3st0on5.
BER





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636