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 02-09-2016, 01:24 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,783
Abronsyth is on a distinguished road
Default Mys 1.3.4 Pet Lineages?

I understand, I think, the rough basics for how this would need to be done if I wanted to create lineages that could be displayed on a pets page...I know you'd need probably 2 new columns in the owned_adopts table, one for each parent. I know in the database the default could be set to "Unknown" so 1st gen pets simply have "unknown" parents...now my main issue that I don't know how to figure out is how to actually take the information, when two pets are bred, and record it in the database, and then display that information in a pedigree fashion on the pets page.

I imagine you'd need two new variables, such as $mother and $father...and then edit in class_breeding.php to insert the parental data into the database;
PHP Code:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => "Unnamed""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"), "mother" => $mother"father" => $father   )); 
Then of course you should be able to display the parents on the pet's page like so;
{$adopt->mother} or {$this->adopt->mother}, etc.

Now when defining the parent variables I want to include both the IDs of the parents, and the names. The ID is important because it can then be used to link to the parent's page (so then you can actually follow the family tree back to f0). So the database itself should store the parent's ID, not the name, and then we can just use the ID of the parent to find the name for the sake of displaying it.

So I think my main issue is actually recording the information of the parents. In the breeding files I see the variables $male and $female are used to determine the parents...which means that I can probably use this somehow, but I'm not sure how, because I don't see where the parent's data is summoned.

Now as for displaying an adoptable's offspring on it's profile...I have no idea. There's the getOffspring function, but does anyone know what that actually does?

I know this post is a big mess of my theories and rambling, but does anything think they could shed light on this a bit? In theory it really shouldn't be that difficult, I don't think.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 02-09-2016, 02:38 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 87,061
Kyttias is on a distinguished road
Default

Try storing $this->female->getAdoptID() for the mother and $this->male->getAdoptID() for the father.

Once that information exists in the database for a pet, you can also lookup grandparents. (Without calling getAdoptID() again, actually, because it's just pulling the information from a column in the database with the names of whatever you store the mother/father data as. If you store it in the database as 'mother' and 'father' you'll want to pull $this->female->mother, $this->female->father, for example, to get the grandparents on the mother's side.) And then you can store information about the grandparents, too.

PHP Code:
                "mother" => $this->female->getAdoptID(), 
                
"father" => $this->male->getAdoptID(),
                
"grandmotherA" => $this->female->mother
                
"grandmotherB" => $this->female->father,
                
"grandfatherA" => $this->male->mother
                
"grandfatherB" => $this->male->father 
Allow them to store as 'NULL' in the database if those values don't exist.

On your pet profiles, this will create links to the parents by the names (and if no parent, "---" and it will link to the same pet that it's currently on). I've actually got this sitting in a function in class_ownedadoptable.php, but it shouldn't be too bad to move around elsewhere? (The $this may need to change.)
PHP Code:
$p1name "---";
$p2name "---";
if (
$this->mother != NULL) { $mother = new OwnedAdoptable($this->mother); $p1name $mother->name$p1id $mother->aid; } else { $p1id $this->aid; }
if (
$this->father != NULL) { $father = new OwnedAdoptable($this->father); $p2name $father->name$p2id $father->aid; } else { $p2id $this->aid; } 
Code:
Parents: <a href='../../levelup/click/".$p1id."'>".$p1name."</a> and <a href='../../levelup/click/".$p2id."'>".$p2name."</a>
For displaying children...
PHP Code:
        $children "";
        
$babies = array();
        
$offsprings explode(","$this->offsprings);
        if (
$offsprings != ""){
            foreach(
$offsprings as $offspring){
                if (
$offspring != 0){
                    
$child = new OwnedAdoptable($offspring);
                    
$babies[] = "<a href='../../levelup/click/".$offspring."'>".$child->name."</a>";
                }
            }
            
$children implode(", ",$babies);
            if (empty(
$children)){ $children ""; } else {$children "<br/>Children: ".$children; }
        } 
Just add the $children variable wherever you want it, I suggest off the end of parents.

I haven't gotten around to displaying grandparents yet, but it's pretty much the same as for the parents.

(edit: I woke up a few hours later and changed a couple things. Btw, that last chunk of code is hilarious to read out loud when you're super tired.)

(edit later: If using this in myadoptsview.php instead of making a function to call in class_ownedadoptable.php, change every instance of $this-> to $adopt-> and that's the only difference.)
__________________
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-11-2016 at 11:39 PM.
Reply With Quote
  #3  
Old 02-11-2016, 04:50 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,783
Abronsyth is on a distinguished road
Default

I have the parents/etc working perfectly now, but I'm not super sure where I should be putting that bit of code for the children?

---

OK, so in my view/myadoptsview.php, where I am currently displaying this information, I have this so far for displaying parents and grandparents (please note my set-up for managing pets is modified):
PHP Code:
        $mother $mysidia->db->select("owned_adoptables", array("mother"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$mother == NULL) { $motherview "Unknown"; } else { $motherview "<a href='../../levelup/click/{$mother}'><img src='http://catisserie.net/levelup/siggy/{$mother}' width='25%'/></a>"; }
        
$father $mysidia->db->select("owned_adoptables", array("father"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$father == NULL) { $fatherview "Unknown"; } else { $fatherview "<a href='../../levelup/click/{$father}'><img src='http://catisserie.net/levelup/siggy/{$father}' width='25%'/></a>"; }
        
$grandmotherA $mysidia->db->select("owned_adoptables", array("grandmotherA"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$grandmotherA == NULL) { $grandmotherAview "Unknown"; } else { $grandmotherAview "<a href='../../levelup/click/{$grandmotherA}'><img src='http://catisserie.net/levelup/siggy/{$grandmotherA}' width='12%' /></a>"; }
        
$grandmotherB $mysidia->db->select("owned_adoptables", array("grandmotherB"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$grandmotherB == NULL) { $grandmotherBview "Unknown"; } else { $grandmotherBview "<a href='../../levelup/click/{$grandmotherB}'><img src='http://catisserie.net/levelup/siggy/{$grandmotherB}' width='12%' /></a>"; }
        
$grandfatherA $mysidia->db->select("owned_adoptables", array("grandfatherA"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$grandfatherA == NULL) { $grandfatherAview "Unknown"; } else { $grandfatherAview "<a href='../../levelup/click/{$grandfatherA}'><img src='http://catisserie.net/levelup/siggy/{$grandfatherA}' width='12%' /></a>"; }
        
$grandfatherB $mysidia->db->select("owned_adoptables", array("grandfatherB"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$grandfatherB == NULL) { $grandfatherBview "Unknown"; } else { $grandfatherBview "<a href='../../levelup/click/{$grandfatherB}'><img src='http://catisserie.net/levelup/siggy/{$grandfatherB}' width='12%'/></a>"; } 
And then I display this information like so;
PHP Code:
<center><strong>Family Tree</strong><br>
<
table border='0'>
    <
tr>
        <
td></td>
        <
td></td>
        <
td>{$grandmotherAview}</td>
    </
tr>
    <
tr>
        <
td></td>
        <
td>{$motherview}</td>
        <
td>{$grandfatherAview}</td>
    </
tr>
    <
tr>
        <
td>{$name}</td>
        <
td></td>
        <
td></td>
    </
tr>
    <
tr>
        <
td></td>
        <
td>{$fatherview}</td>
        <
td>{$grandmotherBview}</td>
    </
tr>
    <
tr>
        <
td></td>
        <
td></td>
        <
td>{$grandfatherBview}</td>
    </
tr>
</
table>
</
center><br
And as you can see it's working splendidly!
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-12-2016 at 12:37 PM.
Reply With Quote
  #4  
Old 02-11-2016, 11:13 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 87,061
Kyttias is on a distinguished road
Default

Oh, um, put it wherever you like/need to? In my version, it also happens to contain 'Children:' beforehand but takes into account whether or not they have any before displaying the text at all. My code as it is currently just loops through a list of text names, whereas yours are images.

So let's start again, now that I see what you have. ^^;;;

You really shouldn't need to access the database over and over again as you are, the variables that hold the id# of the the parents and grandparents are now literally part of the current pet's object in the same way their species type, gender, and the personality/stat mod is. So, try just {$adopt->grandfatherB} for example, rather than making a database call?

Actually, here:
PHP Code:
if ($adopt->mother == NULL) { $motherview "Unknown"; } else { $motherview "<a href='../../levelup/click/{$adopt->mother}'><img src='../../levelup/siggy/{$adopt->mother}' width='25%' height='25%'/></a>"; }
if (
$adopt->father == NULL) { $fatherview "Unknown"; } else { $fatherview "<a href='../../levelup/click/{$adopt->father}'><img src='../../levelup/siggy/{$adopt->father}' width='25%' height='25%'/></a>"; }
if (
$adopt->grandmotherA == NULL) { $grandmotherAview "Unknown"; } else { $grandmotherAview "<a href='../../levelup/click/{$adopt->grandmotherA}'><img src='../../levelup/siggy/{$adopt->grandmotherA}' width='12%' height='12%'/></a>"; }
if (
$adopt->grandmotherB == NULL) { $grandmotherBview "Unknown"; } else { $grandmotherBview "<a href='../../levelup/click/{$adopt->grandmotherB}'><img src='../../levelup/siggy/{$adopt->grandmotherB}' width='12%' height='12%'/></a>"; }
if (
$adopt->grandfatherA == NULL) { $grandfatherAview "Unknown"; } else { $grandfatherAview "<a href='../../levelup/click/{$adopt->grandfatherA}'><img src='../../levelup/siggy/{$adopt->grandfatherA}' width='12%' height='12%'/></a>"; }
if (
$adopt->grandfatherB == NULL) { $grandfatherBview "Unknown"; } else { $grandfatherBview "<a href='../../levelup/click/{$adopt->grandfatherB}'><img src='../../levelup/siggy/{$adopt->grandfatherB}' width='12%' height='12%'/></a>"; } 
Also, try this for establishing children instead (so it works on the myadoptsview.php page and uses just images):
PHP Code:
$babies = array();
$offsprings explode(","$adopt->offsprings);
if (
$offsprings != ""){
    foreach(
$offsprings as $offspring){
        if (
$offspring != 0){
            
$babies[] = "<a href='../../levelup/click/{$offspring}'><img src='../../levelup/siggy/{$offspring}' width='12%' height='12%'/></a>";
        }
    }
    
$children implode(""$babies);
    if (empty(
$children)){ $children "None"; } 

Use {$children} just like you're using things like {$grandfatherBview} in your table.
__________________
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-12-2016 at 12:19 AM.
Reply With Quote
  #5  
Old 02-12-2016, 12:36 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,783
Abronsyth is on a distinguished road
Default

Oh man, that's so much less messy, haha, thank you.

Hmmm...my site is cheerfully throwing this at me;
Code:
Fatal error: Cannot access protected property OwnedAdoptable::$offsprings in /home/arieng/catisserie.net/view/myadoptsview.php on line 295
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #6  
Old 02-12-2016, 02:25 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 87,061
Kyttias is on a distinguished road
Default

In classes/class_ownedadoptable.php make offsprings a public property instead of a protected one. If you ever have any variable that gives that error, find the class and change it to public. I didn't have this error because I must have changed mine a long time ago, I guess?
__________________
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
  #7  
Old 02-12-2016, 02:56 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,783
Abronsyth is on a distinguished road
Default

OK, it seems pretty confused about what pets it should be displaying for offspring. I've got it showing the parents of 2nd, 3rd, etc generation then it shows the mother of the adoptable. If look at the 1st generation it shows one of the pets that cat has been bred with before.

Edit: Actually it just seems to be displaying a random pet that is somehow connected to that cat (for example displaying the mother of the cat that the one I am viewing has mated with).
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-12-2016 at 03:00 PM.
Reply With Quote
  #8  
Old 02-12-2016, 03:58 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 87,061
Kyttias is on a distinguished road
Default

Inside the database the field 'offsprings' contains an array of id numbers - this array has new babies added to it every time a pet is bred. All we're doing is looping through it.

Check in the database to see if the offspring being rendered are correct?

However, there really isn't a system in place that prevents children from breeding with their parents? That I know of? A pet's parent can also be their grandparent.
__________________
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
  #9  
Old 02-12-2016, 06:02 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,783
Abronsyth is on a distinguished road
Default

Ok, this is odd. Apparently none of the data that should be added to the table adopts_breeding is actually being added to it. It's 100% empty. Breeding is fully functional on the site, though at one point one of my users mentioned that it seemed the breeding cooldown wasn't working.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #10  
Old 02-12-2016, 08:23 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 87,061
Kyttias is on a distinguished road
Default

The offsprings data I'm referring to is stored with the parents inside adopts_owned_adoptables, it should be the thirteen column or so!

If you've never made any adopts that only obtainable through breeding, then, yeah, adopts_breeding is going to be empty - it has contents in the STRUCTURE tab, no actual rows, because you have none made! Mine is also "empty" because I haven't made any of that type yet. It appears adopts_breeding holds species-specific information - for pets that can only be obtained BY breeding that are NEVER available in shops or for free.

Anyway, yeah, make a species available through "/admincp/breeding/add" to see data inside adopts_breeding. This would be good for 'chimera' pets like... if species was tigers and species was lions, you'd enter in that data and force the system to give ligers instead of either parent if they're bred together. You can have this result appear ALL the time, or, only sometimes. So, 'if parents are X,Y, babies will come out as Z' whatever the percent is set. (Actually to be honest I don't know if we're supposed to enter in species type numbers from the adopts_adoptables columns or their names.) You can also have things like 'anytime the mother is an X, there is a 90 percent chance the babies will also be an X' even though ordinarily, results are always 50-50 during breeding.

To be honest, I forgot Mysidia even offered such a thing, as it's been a while since I've been through the AdminCP.

Sorry to cause panic!
__________________
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-12-2016 at 08:43 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 09:59 AM.

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