lol
Breeding adoptables has changed a lot so a lot of the code has moved or straight up been changed... for example, there is a function in model/domainmodel/adoptable.php for giving an adopt to a user.
PHP:
public function makeOwnedAdopt($owner, $name = NULL){
$mysidia = Registry::get("mysidia");
if(!$name) $name = $this->type;
$code = $this->generateCode();
$gender = $this->getGender();
$mysidia->db->insert("owned_adoptables", ["aid" => NULL, "adopt" => $this->id, "name" => $name, "owner" => $owner, "currentlevel" => 0,
"totalclicks" => 0, "code" => $code, "imageurl" => "", "alternate" => 0, "tradestatus" => "fortrade",
"isfrozen" => "no", "gender" => $gender, "offsprings" => 0, "lastbred" => 0]);
$aid = $mysidia->db->lastInsertId();
if(!$aid) return NULL;
return new OwnedAdoptable($aid);
}
Then in breedingservice.php there's this:
PHP:
public function breed(){
$mysidia = Registry::get("mysidia");
foreach($this->offsprings as $adopt){
$adopt->makeOwnedAdopt($mysidia->user->getID());
}
$this->validator->setStatus("complete");
}
That essentially uses $adopt->makeOwnedAdopt($mysidia->user->getID()); to give the adopt to a user, and there's no direct insert like there used to be. So unfortunately adding stats while breeding will be a bit more complicated.
That being said, I have given it a shot and managed to get it working.
1) Open service/applicationservice/breedingservice.php. Add this:
PHP:
public function getBabyStrength(){
$femaleStrength = $this->female->getStrength();
$maleStrength = $this->male->getStrength();
$parentStrength = $femaleStrength + $maleStrength;
$strength = $parentStrength / 2;
return $strength;
}
2) Scroll to the bottom breed function and replace it with this:
PHP:
public function breed(){
$mysidia = Registry::get("mysidia");
foreach($this->offsprings as $adopt){
$adopt->makeOwnedAdopt($mysidia->user->getID(), $this->getBabyStrength());
}
$this->validator->setStatus("complete");
}
3) Open model/domainmodel/adoptable.php. Find the makeOwnedAdopt function and replace it with this:
PHP:
public function makeOwnedAdopt($owner, $strength, $name = NULL){
$mysidia = Registry::get("mysidia");
if(!$name) $name = $this->type;
$code = $this->generateCode();
$gender = $this->getGender();
$mysidia->db->insert("owned_adoptables", ["aid" => NULL, "adopt" => $this->id, "name" => $name, "owner" => $owner, "currentlevel" => 0, "totalclicks" => 0, "code" => $code, "imageurl" => "", "alternate" => 0, "tradestatus" => "fortrade", "isfrozen" => "no", "gender" => $gender, "offsprings" => 0,"strength" => $strength, "lastbred" => 0]);
$aid = $mysidia->db->lastInsertId();
if(!$aid) return NULL;
return new OwnedAdoptable($aid);
}
If you want the strength to be randomised between the two parents instead, use this in breedingservice:
PHP:
public function getBabyStrength(){
$femaleStrength = $this->female->getStrength();
$maleStrength = $this->male->getStrength();
$strength = rand($femaleStrength, $maleStrength);
return $strength;
}
Top 2 are parents, others are children (from 2 breedings):
View attachment 632
If you want the strength to have a random chance to get a small boost you can use something like:
PHP:
public function getBabyStrength(){
$femaleStrength = $this->female->getStrength();
$maleStrength = $this->male->getStrength();
$boostChance = rand(1,100);
$boostAmount = rand(1,10);
if($boostChance <= 10){
$strength = rand($femaleStrength, $maleStrength) + $boostAmount;
}
else{
$strength = rand($femaleStrength, $maleStrength);
}
return $strength;
}
That essentially randomises the baby's strength between the two parents and then there is a 10% chance the baby gets a 1-10 boost. To change the values just change
if($boostChance <= 10) to whatever chance you want. It basically means if the random value out of 100 lands on 1-10, they get the boost. And then $boostAmount is the two values the boost can be between.
With the above random + boost, this is what I got:
View attachment 633
Then if you want to add MORE stats you basically need to repeat the steps and in
public function breed you need to make this line have all the other stats:
PHP:
$adopt->makeOwnedAdopt($mysidia->user->getID(), $this->getBabyStrength());
So something like:
PHP:
$adopt->makeOwnedAdopt($mysidia->user->getID(), $this->getBabyStrength(), $this->getBabySpeed(), $this->getBabyStamina());
And also make sure to change:
PHP:
public function makeOwnedAdopt($owner, $strength, $name = NULL)
To also have the new values, like:
PHP:
public function makeOwnedAdopt($owner, $strength, $speed, $stamina, $name = NULL)
And don't forget the insert needs to include the new stats too.
Hopefully that was clear enough haha!