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
  #1  
Old 06-27-2017, 12:42 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,596
Dinocanid is on a distinguished road
Default Public breeding - need some help

I think I've gotten really close to some sort of public breeding system that I'm looking forward to share, but I've run into a problem. Currently, you can reach the page through "site.com/levelup/breed/insertaid", which runs well and good, until you actually press the breed button; then you get this error:
Quote:
Adoptable ID breeding does not exist or does not belong to the owner specified...
After clicking the button, the url becomes "site.com/levelup/breed/breeding", and of course "breeding" is not a valid adopt id. Is there any way to make it "site.com/levelup/breed/insertaid/breeding" or "site.com/levelup/breeding"?

This is what it looks like:
PHP Code:
public function breed(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;
        
        if(
$mysidia->input->post("submit")){
            
$links $this->getField("links"); 
            if(
$links instanceof LinkedList){
                
$breeding $this->getField("breeding");
                
$document->setTitle("Breeding is Successful!");
                
$document->add(new Comment("Congratulations! Breeding is successful, you have acquired {$breeding->countOffsprings()} baby adoptables from breeding center."));
                
$document->add(new Comment("Click on one of the links below to manage your adoptables now!"));
                
$iterator $links->iterator();
                while(
$iterator->hasNext()) $document->add($iterator->next());            
            }
            else{
                
$document->setTitle("Fail!");
                
$document->addLangvar("Why it failed goes here");
            }            
            return;
        }
        
        
$adopt $this->getField("adopt");
        
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$gender_lookup == "m") { $gender "Male"$pronoun "him"; } else { $gender "Female"$pronoun "her"; }
        
        
$cost $this->getField("cost")->getValue();
        
$femaleMap $this->getField("femaleMap");
        
$maleMap $this->getField("maleMap");
        
$document->setTitle("Breeding Center");
        
$document->add(new Comment("<font color=red><h2>This is currently being tested! It doesn't work yet! </h2></font>"));
        
$document->add(new Comment("<img src='{$adopt->getImage()}'>"));
        
        
$document->add(new Comment("You currently have $ {$mysidia->user->getcash()}, the cost of breeding is: "));
        
$document->addLangvar(" $ {$settings->cost}");
        
        
$breedingForm = new Form("breedingform""breeding""post");
        
//If the requested pet is male!
        
        
if($gender == "Male"){
        
// $breedingForm->add(new Comment("<div class='besideright'>"));
        
if($femaleMap instanceof LinkedHashMap){
               
$female = new DropdownList("female");
            
$female->add(new Option("None Selected""none"FALSE));            
            
$female->fill($femaleMap);
            
        }
        else 
$female = new Comment(" None of your female adoptables can breed at the time.");
        
$breedingForm->add($female);
    
        }
        
        
//If the requested pet is female!    
        
if($gender == "Female"){
            
          if(
$maleMap instanceof LinkedHashMap){
            
$male = new DropdownList("male");
            
$male->add(new Option("None Selected""none"FALSE));
            
$male->fill($maleMap);
        }
        else 
$male = new Comment(" None of your male adoptables can breed at the time."FALSE);
        
$breedingForm->add($male);
            
        }
        
            
$breedingForm->add(new Comment("<br></br>"));
        
$breedingForm->add(new PasswordField("hidden""breed""yes"));
        
$breedingForm->add(new Button("Breed""submit""submit"));
        
$document->add($breedingForm);    
    } 
(levelupview)

PHP Code:
public function breed(){
        
$mysidia Registry::get("mysidia");
        
$this->setField("adopt"$this->adopt);
        
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$this->adopt->getAdoptID()}'")->fetchColumn();
        if (
$gender_lookup == "m") { $gender "Male";} else { $gender "Female";}
        
$settings = new BreedingSetting($mysidia->db);
        
$userStatus $mysidia->user->getstatus();
        if(
$settings->system != "enabled") throw new InvalidActionException("system");
        if(
$userStatus->canbreed == "no") throw new NoPermissionException("permission");
        
        
//If the requested pet is male!
        
if($gender "Male"){
        if(
$mysidia->input->post("submit")){
            if(
$mysidia->input->post("female") == "none"){
                  throw new 
InvalidIDException("none_select");
            }
            
            try{
                
$female = new OwnedAdoptable($mysidia->input->post("female"), $mysidia->user->username);
                
$male = new OwnedAdoptable($this->adopt->getAdoptID());
                
$breeding = new Breeding($female$male$settings); 
                
$validator $breeding->getValidator("fcase");
                
$validator->validate();
            }
            catch(
AdoptNotfoundException $ane){
                throw new 
InvalidIDException("none_exist");
            }
            catch(
BreedingException $bre){                
                
$status $bre->getmessage();
                
$validator->setStatus($status);
                throw new 
InvalidActionException($status);
            }
            
            if(
$settings->method == "advanced"$species $breeding->getBabySpecies();
            
$breeding->getBabyAdopts($species);
            
$breeding->breed($adopts);
            
$num $breeding->countOffsprings();
                        
            if(
$num 0){
                
$offsprings $breeding->getOffsprings();
                
$offspringID $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num 1
                
$links = new LinkedList;
                foreach(
$offsprings as $offspring){
                    
$image $offspring->getEggImage("gui");
                    
$links->add(new Link("myadopts/manage/{$offspringID}"$image));
                    
$offspringID++;
                }
                
$this->setField("links"$links);
            }
            else 
$this->setField("links", new Null);
            
$this->setField("breeding"$breeding);        
            return;
        }
    }
        
        
//If the requested pet is female!
        
if($gender "Female"){
        if(
$mysidia->input->post("submit")){
            if(
$mysidia->input->post("female") == "none"){
                  throw new 
InvalidIDException("none_select");
            }
            
            try{
                
$male = new OwnedAdoptable($mysidia->input->post("male"), $mysidia->user->username);
                
$female = new OwnedAdoptable($this->adopt->getAdoptID());
                
$breeding = new Breeding($female$male$settings); 
                
$validator $breeding->getValidator("mcase");
                
$validator->validate();
            }
            catch(
AdoptNotfoundException $ane){
                throw new 
InvalidIDException("none_exist");
            }
            catch(
BreedingException $bre){                
                
$status $bre->getmessage();
                
$validator->setStatus($status);
                throw new 
InvalidActionException($status);
            }
            
            if(
$settings->method == "advanced"$species $breeding->getBabySpecies();
            
$breeding->getBabyAdopts($species);
            
$breeding->breed($adopts);
            
$num $breeding->countOffsprings();
                        
            if(
$num 0){
                
$offsprings $breeding->getOffsprings();
                
$offspringID $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num 1
                
$links = new LinkedList;
                foreach(
$offsprings as $offspring){
                    
$image $offspring->getEggImage("gui");
                    
$links->add(new Link("myadopts/manage/{$offspringID}"$image));
                    
$offspringID++;
                }
                
$this->setField("links"$links);
            }
            else 
$this->setField("links", new Null);
            
$this->setField("breeding"$breeding);        
            return;
        }
        
//Stop here!!
            
        
}

        
$this->setField("cost", new Integer($breedcost));
        
$current = new DateTime;
        
$lasttime $current->getTimestamp() - (($settings->interval) * 24 60 60);
                
        
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND gender = 'f' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'");
        
$female = ($stmt->rowcount() == 0)?new Null:$mysidia->db->fetchMap($stmt);
        
$this->setField("femaleMap"$female);
  
        
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND gender = 'm' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'");
        
$male = ($stmt->rowcount() == 0)?new Null:$mysidia->db->fetchMap($stmt);
        
$this->setField("maleMap"$male);
    } 
(levelup)
__________________
Reply With Quote
  #2  
Old 10-19-2018, 03:23 AM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,744
draugluin is on a distinguished road
Default

Quote:
After clicking the button, the url becomes "site.com/levelup/breed/breeding", and of course "breeding" is not a valid adopt id. Is there any way to make it "site.com/levelup/breed/insertaid/breeding" or "site.com/levelup/breeding"?
hmmmm ....

maybe ... try this

PHP Code:

$breedingForm 
= new Form("breedingform""/{$adopt->getAdoptID()}/breeding""post"); 
__________________

Last edited by draugluin; 10-19-2018 at 04:30 AM.
Reply With Quote
  #3  
Old 08-27-2019, 08:27 AM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,744
draugluin is on a distinguished road
Default

This mod looks so good ! Have you gotten anywhere with it?
__________________
Reply With Quote
  #4  
Old 07-15-2020, 12:25 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,507
Missy Master is an unknown quantity at this point
Default

This is exactly what I am desperate for, myself, a way to have public breeding.

Few people will want to breed exclusively with their own, they'll want a way to breed with popular etc pets, special ones.
Reply With Quote
  #5  
Old 07-15-2020, 05:50 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,507
Missy Master is an unknown quantity at this point
Default

I think the error may lie in:

"owner = '{$mysidia->user->username}'


Somewhere, it's calling up who owns the pet and saying nope. I've fiddled with several places and pages (view, class, etc) and can't get rid of the invalid ID, even when I can get the males to show from other members in the list. Beats me, I am stumped.
Reply With Quote
  #6  
Old 10-02-2020, 09:26 AM
Jeremydepp50 Jeremydepp50 is offline
Member
 
Join Date: Sep 2020
Posts: 1
Gender: Male
Credits: 450
Jeremydepp50 is on a distinguished road
Default

Quote:
Originally Posted by Dinocanid View Post
I think I've gotten really close to some sort of public breeding system that I'm looking forward to share, but I've run into a problem. Currently, you can reach the page through "site.com/levelup/breed/insertaid", which runs well and good, until you actually press the breed button; then you get this error:


After clicking the button, the url becomes "site.com/levelup/breed/breeding", and of course "breeding" is not a valid adopt id. Is there any way to make it "site.com/levelup/breed/insertaid/breeding" or "site.com/levelup/breeding"?

This is what it looks like:
PHP Code:
public function breed(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;
        
        if(
$mysidia->input->post("submit")){
            
$links $this->getField("links"); 
            if(
$links instanceof LinkedList){
                
$breeding $this->getField("breeding");
                
$document->setTitle("Breeding is Successful!");
                
$document->add(new Comment("Congratulations! Breeding is successful, you have acquired {$breeding->countOffsprings()} baby adoptables from breeding center."));
                
$document->add(new Comment("Click on one of the links below to manage your adoptables now!"));
                
$iterator $links->iterator();
                while(
$iterator->hasNext()) $document->add($iterator->next());            
            }
            else{
                
$document->setTitle("Fail!");
                
$document->addLangvar("Why it failed goes here");
            }            
            return;
        }
        
        
$adopt $this->getField("adopt");
        
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$gender_lookup == "m") { $gender "Male"$pronoun "him"; } else { $gender "Female"$pronoun "her"; }
        
        
$cost $this->getField("cost")->getValue();
        
$femaleMap $this->getField("femaleMap");
        
$maleMap $this->getField("maleMap");
        
$document->setTitle("Breeding Center");
        
$document->add(new Comment("<font color=red><h2>This is currently being tested! It doesn't work yet! </h2></font>"));
        
$document->add(new Comment("<img src='{$adopt->getImage()}'>"));
        
        
$document->add(new Comment("You currently have $ {$mysidia->user->getcash()}, the cost of breeding is: "));
        
$document->addLangvar(" $ {$settings->cost}");
        
        
$breedingForm = new Form("breedingform""breeding""post");
        
//If the requested pet is male!
        
        
if($gender == "Male"){
        
// $breedingForm->add(new Comment("<div class='besideright'>"));
        
if($femaleMap instanceof LinkedHashMap){
               
$female = new DropdownList("female");
            
$female->add(new Option("None Selected""none"FALSE));            
            
$female->fill($femaleMap);
            
        }
        else 
$female = new Comment(" None of your female adoptables can breed at the time.");
        
$breedingForm->add($female);
    
        }
        
        
//If the requested pet is female!    
        
if($gender == "Female"){
            
          if(
$maleMap instanceof LinkedHashMap){
            
$male = new DropdownList("male");
            
$male->add(new Option("None Selected""none"FALSE));
            
$male->fill($maleMap);
        }
        else 
$male = new Comment(" None of your male adoptables can breed at the time."FALSE);
        
$breedingForm->add($male);
            
        }
        
            
$breedingForm->add(new Comment("<br></br>"));
        
$breedingForm->add(new PasswordField("hidden""breed""yes"));
        
$breedingForm->add(new Button("Breed""submit""submit"));
        
$document->add($breedingForm);    
    } 
(levelupview)
https://boathousegear.com/www-stapleseasyrebates-com-rebatecard-staples-easy-rebate-center/
PHP Code:
public function breed(){
        
$mysidia Registry::get("mysidia");
        
$this->setField("adopt"$this->adopt);
        
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$this->adopt->getAdoptID()}'")->fetchColumn();
        if (
$gender_lookup == "m") { $gender "Male";} else { $gender "Female";}
        
$settings = new BreedingSetting($mysidia->db);
        
$userStatus $mysidia->user->getstatus();
        if(
$settings->system != "enabled") throw new InvalidActionException("system");
        if(
$userStatus->canbreed == "no") throw new NoPermissionException("permission");
        
        
//If the requested pet is male!
        
if($gender "Male"){
        if(
$mysidia->input->post("submit")){
            if(
$mysidia->input->post("female") == "none"){
                  throw new 
InvalidIDException("none_select");
            }
            
            try{
                
$female = new OwnedAdoptable($mysidia->input->post("female"), $mysidia->user->username);
                
$male = new OwnedAdoptable($this->adopt->getAdoptID());
                
$breeding = new Breeding($female$male$settings); 
                
$validator $breeding->getValidator("fcase");
                
$validator->validate();
            }
            catch(
AdoptNotfoundException $ane){
                throw new 
InvalidIDException("none_exist");
            }
            catch(
BreedingException $bre){                
                
$status $bre->getmessage();
                
$validator->setStatus($status);
                throw new 
InvalidActionException($status);
            }
            
            if(
$settings->method == "advanced"$species $breeding->getBabySpecies();
            
$breeding->getBabyAdopts($species);
            
$breeding->breed($adopts);
            
$num $breeding->countOffsprings();
                        
            if(
$num 0){
                
$offsprings $breeding->getOffsprings();
                
$offspringID $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num 1
                
$links = new LinkedList;
                foreach(
$offsprings as $offspring){
                    
$image $offspring->getEggImage("gui");
                    
$links->add(new Link("myadopts/manage/{$offspringID}"$image));
                    
$offspringID++;
                }
                
$this->setField("links"$links);
            }
            else 
$this->setField("links", new Null);
            
$this->setField("breeding"$breeding);        
            return;
        }
    }
        
        
//If the requested pet is female!
        
if($gender "Female"){
        if(
$mysidia->input->post("submit")){
            if(
$mysidia->input->post("female") == "none"){
                  throw new 
InvalidIDException("none_select");
            }
            
            try{
                
$male = new OwnedAdoptable($mysidia->input->post("male"), $mysidia->user->username);
                
$female = new OwnedAdoptable($this->adopt->getAdoptID());
                
$breeding = new Breeding($female$male$settings); 
                
$validator $breeding->getValidator("mcase");
                
$validator->validate();
            }
            catch(
AdoptNotfoundException $ane){
                throw new 
InvalidIDException("none_exist");
            }
            catch(
BreedingException $bre){                
                
$status $bre->getmessage();
                
$validator->setStatus($status);
                throw new 
InvalidActionException($status);
            }
            
            if(
$settings->method == "advanced"$species $breeding->getBabySpecies();
            
$breeding->getBabyAdopts($species);
            
$breeding->breed($adopts);
            
$num $breeding->countOffsprings();
                        
            if(
$num 0){
                
$offsprings $breeding->getOffsprings();
                
$offspringID $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num 1
                
$links = new LinkedList;
                foreach(
$offsprings as $offspring){
                    
$image $offspring->getEggImage("gui");
                    
$links->add(new Link("myadopts/manage/{$offspringID}"$image));
                    
$offspringID++;
                }
                
$this->setField("links"$links);
            }
            else 
$this->setField("links", new Null);
            
$this->setField("breeding"$breeding);        
            return;
        }
        
//Stop here!!
            
        
}

        
$this->setField("cost", new Integer($breedcost));
        
$current = new DateTime;
        
$lasttime $current->getTimestamp() - (($settings->interval) * 24 60 60);
                
        
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND gender = 'f' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'");
        
$female = ($stmt->rowcount() == 0)?new Null:$mysidia->db->fetchMap($stmt);
        
$this->setField("femaleMap"$female);

        
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND gender = 'm' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'");
        
$male = ($stmt->rowcount() == 0)?new Null:$mysidia->db->fetchMap($stmt);
        
$this->setField("maleMap"$male);
    } 
(levelup)
Your way of telling everything in this article is truly pleasant, every one be capable of easily be aware of it, Thanks a lot.
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 04:46 AM.

Currently Active Users: 452 (0 members and 452 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