Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 02-13-2016, 04:59 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 117,987
Abronsyth is on a distinguished road
Default

Nope, still refuses to work (though that tip does make sense, thank you!)

PHP Code:
<?php

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

class 
MaoController 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(); 
            
$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"lastbred" => 0"originalowner" => $mysidia->user->username"birthday" => date("F jS, Y")  )); 
            
$cost $mysidia->db->select("adoptables", array("cost"), "type='{$adopt->getType()}'")->fetchColumn();
            
$mysidia->user->changecash(-$cost);               
            
$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;
        }  
        
        
$mysidia->session->assign("adopt"1TRUE);
        
$ids $mysidia->db->select("adoptables", array("id"), "shop='Mao Cats'")->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);
    }
}
?>
Don't know what I'm doing wrong at this point @_@
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #12  
Old 02-13-2016, 05:22 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 91,552
Kyttias is on a distinguished road
Default

Very odd... I mean... they do get the pet, right, it just doesn't take out money?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #13  
Old 02-16-2016, 09:50 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 117,987
Abronsyth is on a distinguished road
Default

Yep, the pet is added to the account just fine, but it doesn't subtract any currency.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #14  
Old 02-16-2016, 11:41 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 91,552
Kyttias is on a distinguished road
Default

Okay, get this: If you delete the line that inserts the pet into the database in mao.php, it still gets added. Something tells me it's still using the original adopt.php to do it's work. This is because it's still sending the form data to it!

In view/maoview.php find:
PHP Code:
$adoptForm = new Form("form""adopt""post"); 
And change it to:
PHP Code:
$adoptForm = new Form("form""mao""post"); 
The currency is then going down, but you have to go to another page to see that.


(Still using this:)
PHP Code:
$cost $mysidia->db->select("adoptables", array("cost"), "type='{$adopt->getType()}'")->fetchColumn();
$mysidia->user->changecash(-$cost); 
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 02-16-2016 at 11:56 AM.
Reply With Quote
  #15  
Old 02-16-2016, 12:44 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 117,987
Abronsyth is on a distinguished road
Default

-throws hands into the air and starts dancing-

Yes! Brilliant! It's working now! Thank you so, so much, Kyttias! You've saved Catisserie's entire economy, haha! I figured it had something to do with the form, but I was looking at the submit action, and not that part.

Thank you so much! Seriously, please let me know if there's ever anything at all I can help you with because you've done so much to help!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
Reply


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 04:19 AM.

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