Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2017, 11:24 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 32,925
kristhasirah
Default give names to levels

this code is just an edited version of the $gender_lookup code posted by kittyas.
and whats it does is to give a specific name to each level, so instead of displaying the numbers it will display a name:

PHP Code:
        $level_lookup $mysidia->db->select("owned_adoptables", array("currentlevel"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$level_lookup == "10") {$levels "Ancient"; } 
        if (
$level_lookup == "9") {$levels "Adult";} 
        if (
$level_lookup == "8") {$levels "Subadult";}  
        if (
$level_lookup == "7") {$levels "Juvenile";}
        if (
$level_lookup == "6") {$levels "Hatchling";} 
        if (
$level_lookup == "5") {$levels "New Born";} 
        if (
$level_lookup <= "4") {$levels "Egg";} 
my site uses a max of 10 levels for the adopts, just need to remove those that you dont need and change the number to match the levels in your site.
to display the code in your adopt profile you just need to replace {$adopt->getCurrentLevel()} with {$levels}

but if you whant to "properly" display the needed levelup points, this is mostly to "hide" the other levels... the hatched adopt need 40 points divided in 4 levels so to hide the rest of the levels and make them look like is just one level you just need to add this:
PHP Code:
        $number 40 $adopt->getTotalClicks();
        
$nextLev "(Next Stage in ".$number." more Exp)"
replace the number with the needed clicks to make the adopt hatch.
now probably most of you are using also the {$toNext} posted here to display the needed clicks for the next stage, so now we need to add this code after the $nextLev:
PHP Code:
        if($adopt->getcurrentlevel() <= "4"){$stages "{$levels}{$nextLev}";}  else {$stages "{$levels}{$toNext}";} 
and to display the info of the adopt just replace {$adopt->getCurrentLevel()} {$toNext} with {$levels}

if you are using KatFennec Public Profile Mod the needed points are displayed at top of the feed button so i did a few changes to the code and this is the edited code:
PHP Code:
public function publicprofile(){
            
$mysidia Registry::get("mysidia");
            
$adopt $this->getField("adopt");            
            
$adoptcurrentlevel $adopt->currentlevel;
            
$document $this->document;
            
$document->setTitle("Viewing {$adopt->getName()}'s profile");
            if(
$adopt->hasNextLevel()){
            
$nextLevel $adopt->getNextLevel();
            
#$requiredClicks = $nextLevel->getRequiredClicks();
$thisisauniqueid = new OwnedAdoptable($adopt->getAdoptID());
$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"; } 
$alternates_lookup $mysidia->db->select("owned_adoptables", array("usealternates"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        
$level_lookup $mysidia->db->select("owned_adoptables", array("currentlevel"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
        if (
$level_lookup == "10") {$levels "Ancient"; }
        if (
$level_lookup == "9") {$levels "Adult";} 
        if (
$level_lookup == "8") {$levels "Subadult";}
        if (
$level_lookup == "7") {$levels "Juvenile";}
        if (
$level_lookup == "6") {$levels "Hatchling";}
        if (
$level_lookup == "5") {$levels "New Born";}
        if (
$level_lookup <= "4") {$levels "egg";}
if (
$mysidia->user->username == $adopt->getOwner()){ $manage_btn "<a class='btn btn-sm btn-info' href='../../myadopts/manage/{$adopt->getAdoptID()}'><i class='fa fa-gear'></i> Manage</a>"; } else { $manage_btn ""; }

        if(
$adopt->hasNextLevel()){
        
$level $adopt->getNextLevel();
        
$levelupClicks $adopt->getLevelupClicks();
        
$toNext "(Next Stage in ".$levelupClicks." more EXP)"; } else { $toNext "(MAX)"; }
        
$number 40 $adopt->getTotalClicks();
        
$nextLev "(Next Stage in ".$number." more EXP)";  
        if(
$adopt->getcurrentlevel() <= "4"){$stages "{$levels}{$nextLev}";}  else {$stages "{$levels}{$toNext}";} 
        
$document->add(new Comment("{$stages}");
if(
$adopt->getTradeStatus() == "fortrade") { $tradestatus "<b>For Trade</b>"; } 
else { 
$tradestatus "<b>Not For Trade</b>"; }



// If you've already seen the pet today:
if ($adopt->hasVoter($mysidia->user$date)){
$document->add(new Comment("<a class='btn btn-sm btn-info disabled' href='../../levelup/click/{$adopt->getAdoptID()}'><i class='fa fa-paw'></i> Already Fed</a>"));
}
// If you haven't seen the pet today:
else {
$document->add(new Comment("<a class='btn btn-sm btn-info' href='../../levelup/click/{$adopt->getAdoptID()}'><i class='fa fa-paw'></i> Feed</a>"));
};
}
$document->add(new Comment("{$manage_btn}
<br> <br>
<img src='
{$thisisauniqueid->getImage()}'><br>"));
$adoptabletype $mysidia->db->select("adoptables", array(), "type='{$adopt->getType()}'")->fetchObject();
$diet $adoptabletype->Diet;
$level $adopt->getCurrentLevel();
$document->add(new Comment("<ul>
<li>Lives With: <a href='/profile/view/
{$adopt->getOwner()}'>{$adopt->getOwner()}</a></li>
<li>Species: 
{$adopt->getType()}</li>
<li>Gender: 
{$gender}</li>
<li>LVL: 
{$levels}</li>
<li>Total EXP: 
{$adopt->getTotalClicks()}</li> 
<li>Trade Status: 
{$tradestatus}</li>

"
));
        } 

Hope this is useful to some one ^^ the $levels don't need to be names, they can be numbers too or whatever you want

Last edited by kristhasirah; 05-30-2017 at 02:04 PM.
Reply With Quote
  #2  
Old 05-25-2017, 04:13 PM
aquapyrofan aquapyrofan is offline
Member
 
Join Date: Apr 2017
Posts: 48
Gender: Unknown/Other
Credits: 9,670
aquapyrofan is on a distinguished road
Default

You can also put them in the stats page, you just have to remove the database call and then replace "$level_lookup" with "$adopt>getCurrentLevel()".
Reply With Quote
  #3  
Old 05-26-2017, 12:43 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 32,925
kristhasirah
Default

thanks for posting changes needed to make it work in the stats page, i totally forgot about that XD as i completely removed that code form the manage adopts =p because with the profile i made for my adopts the stats page was no longer needed.

also for those that want to have the info of the needed point for the next stage, beside of the current stage just:
Delete:
PHP Code:
        $document->add(new Comment("{$stages}"); 
and replace:
PHP Code:
{$levels
with:
PHP Code:
{$stages
__________________

Last edited by kristhasirah; 05-30-2017 at 02:04 PM.
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 11:36 AM.

Currently Active Users: 1189 (0 members and 1189 guests)
Threads: 4,081, Posts: 32,032, 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