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 01-24-2016, 04:50 AM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 51,270
tahbikat is on a distinguished road
Default Getting adopt's stats to display at certain level?

I wish I wasn't so helpless, but alas, I am. ;-;

I was wondering if there's an easy way to get an adopt's public stats on its levelup.php page to display only if it's a certain level?

So for example:
IF adopt is level 2 or below, then display certain stats (basically everything excluding gender, magic skill, and personality)
ELSE IF adopt is level 3 or 4, display all stats

- - - The reason I want this is because I want users to hatch their eggs first being being able to see its magic skill, personality, gender, etc. I'll still need to figure out a way to code out genders from elsewhere (my adopts page, etc) but yea.

Here's my levelup page function click:

PHP Code:
public function click(){
    
$mysidia Registry::get("mysidia");
    
$date = new DateTime;
    
$ip secure($_SERVER['REMOTE_ADDR']);

    
/*... First check if the system to levelup pets is enabled ...*/
    
if($this->settings->system != "enabled") { throw new NoPermissionException("disabled"); }

    
/*... Then check if the user has already visited the pet today ...*/
    
elseif($this->adopt->hasVoter($mysidia->user$date)){
        if(
$this->adopt->hasNextLevel()){
            
$nextLevel $this->adopt->getNextLevel();
            
$requiredClicks $nextLevel->getRequiredClicks();
        }

        
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$this->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 = '{$this->adopt->getAdoptID()}'")->fetchColumn();
        if (
$alternates_lookup == "yes") { $usealternates "Variant"; } else { $usealternates "Normal"; }

        if (
$mysidia->user->username == $this->adopt->getOwner()){ $manage_btn "<i><a href='../../myadopts/manage/{$this->adopt->getAdoptID()}'> Manage {$this->adopt->getName()}</a></i><br /><br />"; } else { $manage_btn ""; }

        if(
$this->adopt->hasNextLevel()){
            
$level $this->adopt->getNextLevel();
            
$levelupClicks $this->adopt->getLevelupClicks();
            
$toNext "(LVL ".$level->getLevel()." in ".$levelupClicks." more EXP)"
        } 
        else { 
$toNext "(MAX)"; }

        if(
$this->adopt->getTradeStatus() == "fortrade") { $tradestatus "For Trade"; } 
        else { 
$tradestatus "Not For Trade"; }

        
$message "<div class='adopt_profile'>    <h2>{$this->adopt->getName()}</h2>    ";
        
        
// If you've already seen the pet today:
        
if ($this->adopt->hasVoter($mysidia->user$date)){
            
$message .= "<div class='already-seen-msg'><b>Thanks!</b>  You already visited this creature today!</div>";
        }
        
// If you haven't seen the pet today:
        
if (!$this->adopt->hasVoter($mysidia->user$date)){
            
$message .= "<div style='display: inline;'><span class='button'>Click</span></div>";
        }
            
$message .= "<div class='pet-img'>{$manage_btn}
            <img src='
{$this->adopt->getImage()}'/><br /><br />
            <img src='/picuploads/
{$this->adopt->getRarity()}.png' title='{$this->adopt->getRarity()} Species, {$usealternates}' style='margin-right: -3px;' /> <img src='/picuploads/{$usealternates}.png' title='{$this->adopt->getRarity()} Species, {$usealternates}' />
            </div>
            <div class='pet-stats'>
                        <ul class='profile-list'>
                        <li class='statsFloat'><b>Owner</b>: <a href='/profile/view/
{$this->adopt->getOwner()}'>{$this->adopt->getOwner()}</a></li>
                        <li class='statsFloat'><b>Personality</b>: 
{$this->adopt->getAdoptPersonality()}</li>
                        <li class='statsFloat'><b>Species</b>: 
{$this->adopt->getType()}</li>
                        <li class='statsFloat'><b>Magic Skill</b>: 
{$this->adopt->getMagic()}/100</li>
                        <li class='statsFloat'><b>Gender</b>: 
{$gender}</li>
                        <li class='statsFloat'><b>Obtained From</b>: 
{$this->adopt->getObtainedFrom()}</li>
                        <li class='statsFloat'><b>Total Points</b>: 
{$this->adopt->getTotalClicks()}</li>
                        <li class='statsFloat'><b>Obtained On</b>: 
{$this->adopt->getObtainedOn()}</li>
                        <li class='statsFloat'><b>Level</b>: 
{$this->adopt->getCurrentLevel()}</li>
                        <li class='statsFloat'><b>Trade Status</b>: 
{$tradestatus}</li> 

                        </ul>
                        <b>Description</b>: 
{$this->adopt->getAdultDescription()}<br /><br />
                        </div>"
;

        throw new 
LevelupException($message);
    } 

    
/*... But do this if the pet is frozen! ...*/
    
elseif($this->adopt->isFrozen() == "yes") { throw new LevelupException("frozen"); }

    
/*... This one, if enabled, would prevent users from visiting a pet too much a day ...*/
    # elseif($mysidia->user->getVotes() > $this->settings->number) { throw new LevelupException("number"); }

    /*... If this setting were on in the backend, it would prevent the users from visiting their own pets ...*/
    # elseif($this->settings->owner == "disabled" and $this->adopt->getOwner() == $mysidia->user->username){ throw new LevelupException("owner");}
    
    /*... If the visitor has not seen the pet today, this will be displayed and the pet will level up! ...*/
    
else{
        
$newClicks $this->adopt->getTotalClicks() + 1;
        
$this->adopt->setTotalClicks($newClicks"update");
        
$mysidia->db->insert("vote_voters", array("void" => NULL"date" => $date->format('Y-m-d'), "username" => $mysidia->user->username"ip" => $ip"adoptableid" => $mysidia->input->get("aid")));         
        
        
$ago date('Y-m-d'strtotime('-40 days'));
        
$mysidia->db->delete("vote_voters""date < '{$ago}'");    

        if(
$this->adopt->hasNextLevel()){
            
$nextLevel $this->adopt->getNextLevel();
            
$requiredClicks $nextLevel->getRequiredClicks();
            if(
$requiredClicks and $newClicks >= $requiredClicks) { $this->adopt->setCurrentLevel($nextLevel->getLevel(), "update"); }
        }
        
        
$reward $mysidia->user->clickreward($this->settings->reward);
        
$mysidia->user->changecash($reward);            
        
$this->setField("adopt"$this->adopt);
        
$this->setField("reward", new Integer($reward));            
    }

Reply With Quote
  #2  
Old 01-24-2016, 04:12 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 91,452
Kyttias is on a distinguished road
Default

PHP Code:
if ($this->adopt->getCurrentLevel() < 3){
/*if current level is less than three do this*/
} else {
/*well else it must be three or greater, so do this*/

Is this enough to help?

The property for finding the current level is already in the code you had, it just requires a basic if/else statement so I'm not sure what else you're looking for?
__________________
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
  #3  
Old 01-24-2016, 05:03 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 51,270
tahbikat is on a distinguished road
Default

That's perfect, thank you! Ugh, so simple. I still don't have a solid understanding of PHP yet. ;-;
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 02:37 AM.

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