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-15-2016, 10:27 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,647
tahbikat is on a distinguished road
Default Need help fixing a bug?

Okay, so something weird is happening.

This is my levelup page's code. Frozen creatures of any level have certain stats that won't display because they're frozen. They also have a little comment saying "This creature's frozen"

So oddly enough, certain frozen creatures are just like, bypassing this and displaying like normal, even though they are definitely frozen.

Someone help? ;-; It was working fine before. I did make some changes to other pages and added a db column under owned_adopts. I just don't understand why some of the frozen adopts' stats are displaying correctly, and others aren't. If anything else is needed let me know!

EDIT: It seems like maybe it's something to do with newly frozen creatures... I think... All my creatures that I froze days and weeks ago are fine. The new ones are the ones that kind of just ignore the whole function.

PHP Code:
<?php

use Resource\Native\Integer;
use 
Resource\Collection\ArrayList;
use 
Resource\Utility\Curl;

class 
LevelupController extends AppController{

    const 
PARAM "aid";
    private 
$adopt;
    private 
$settings;

    public function 
__construct(){
        
parent::__construct();
        
$this->settings = new LevelSetting;
        
$mysidia Registry::get("mysidia");

        if(
$mysidia->input->action() == "click" or $mysidia->input->action() == "siggy"$this->adopt = new OwnedAdoptable($mysidia->input->get("aid"));
        if(
$mysidia->user instanceof Member){
            
$status $mysidia->user->getstatus();   
            if(
$status->canlevel == "no") throw new InvalidActionException("banned");
        }    
    }
    
    public function 
index(){
        throw new 
InvalidActionException("global_action");
    }
    
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 class='btn btn-sm btn-info' 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()} (#{$this->adopt->getAdoptID()})</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'>Play</span></div>";
        }
        if (
$this->adopt->getCurrentLevel() == 0){
        
/*if current level is less than three do this*/
            
$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, ???' style='margin-right: -3px;' /><br /><br />
            
            <hr id='pethr'>
            <p style='text-align: left;'><b>
{$this->adopt->getName()}'s Bio:</b> Not available until hatched.</p>
            </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>Species</b>: 
{$this->adopt->getType()}</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->getDescription()}<br /><br />
                        </div>"
;

        throw new 
LevelupException($message);
        }
                if (
$this->adopt->getCurrentLevel() == 1){
        
/*if current level is less than three do this*/
            
$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, ???' style='margin-right: -3px;' /><br /><br />
            
            <hr id='pethr'>
            <p style='text-align: left;'><b>
{$this->adopt->getName()}'s Bio:</b> Not available until hatched.</p>
            </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>Species</b>: 
{$this->adopt->getType()}</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->getDescription()} It has started to shake! It must be very close to hatching.<br /><br />
                        </div>"
;

        throw new 
LevelupException($message);
        }
         if (
$this->adopt->getCurrentLevel() == 2){
        
/*if current level is less than three do this*/ 
            
$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}' /><br /><br />
            
            <hr id='pethr'>
            <p style='text-align: left;'><b>
{$this->adopt->getName()}'s Bio:</b> {$this->adopt->getPetBio()}</p>
            <p style='text-align: right; margin: 0; padding: 0;'><a href='' class='reportexclam'><img src='/picuploads/reportimg.png' title='Report this bio' /></a></p>
            </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>: Oh look! Your egg has hatched into a little creature. 
{$this->adopt->getHatchyDescription()}<br /><br />
                        </div>"
;
              
        throw new 
LevelupException($message);
        }else {
/*well else it must be three or greater, so do this*/
            
$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}' /><br /><br />
            
            <hr id='pethr'>
            <p style='text-align: left;'><b>
{$this->adopt->getName()}'s Bio:</b> {$this->adopt->getPetBio()}</p>
            <p style='text-align: right; margin: 0; padding: 0;'><a href='' class='reportexclam'><img src='/picuploads/reportimg.png' title='Report this bio' /></a></p>
            </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") {  $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 class='btn btn-sm btn-info' href='../../myadopts/manage/{$this->adopt->getAdoptID()}'> Manage {$this->adopt->getName()}</a></i><br /><br />"; } else { $manage_btn ""; }
        
        if(
$this->adopt->getTradeStatus() == "fortrade") { $tradestatus "For Trade"; } 
        else { 
$tradestatus "Not For Trade"; }
        
        
$message "<div class='adopt_profile'>    <h2>{$this->adopt->getName()} (#{$this->adopt->getAdoptID()})</h2>    ";
        
$message .= "<div class='already-seen-msg'><img src='/picuploads/yes.png' /> This creature is frozen, your click has not been counted.</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}' /><br /><br />
            
            <hr id='pethr'>
            <p style='text-align: left;'><b>
{$this->adopt->getName()}'s Bio:</b> Not available when frozen.</p>
            </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>Species</b>: 
{$this->adopt->getType()}</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>

                        </div>"
;
                        
                        throw new 
LevelupException($message);
                        }
                        

    
/*... 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));            
    }
}  

    public function 
siggy(){
        
$mysidia Registry::get("mysidia");
        
// The adoptable is available, let's collect its info
        
$usingimage "no";
        
$image $this->adopt->getImage(); 
      
        
$usegd $mysidia->settings->gdimages;
        
$imageinfo = @getimagesize($image);
        
$imagemime $imageinfo["mime"]; // Mime type of the image file, should be a .gif file...

        
if(function_exists('imagegif') and $usegd == "yes" and $imagemime == "image/gif"){
            
$usingimage "yes"//Turn the template system off
            
$type $this->adopt->getType();
            list(
$width$height$type$attr) = getimagesize($image); // The size of the original adoptable image

            // Lets create the new target image, with a size big enough for the text for the adoptable
            
$newheight $height 72;
            
$newwidth = ($newwidth 250)?250:$width;
            
$img_temp imagecreatetruecolor($newwidth$newheight); 
            
$alphablending true;  
         
            
// Lets create the image and save its transparency  
            
$img_old = @imagecreatefromgif($image);  
            
imagealphablending($img_oldtrue);  
            
imagesavealpha($img_oldtrue);
   
            
// Lets copy the old image into the new image with  
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);    
            
$textheight $width 2;
            
$image $img_temp;
            
$bgi imagecreatetruecolor($newwidth$newheight);
            
$color imagecolorallocate($bgi515151);
         
            
// Build text for siggy
            
$str1 "Name: ".$this->adopt->getName();
            
$str2 "Owner: ".$this->adopt->getOwner();
            
$str3 "Click Here to Feed Me!";
            
$str4 "More Adopts at:";
            
$str5 "www.".constant("DOMAIN");

            
// Renger Image
            
imagestring ($image120$textheight,  $str1$color);
            
imagestring ($image120$textheight 13,  $str2$color);
            
imagestring ($image120$textheight 26,  $str3$color);
            
imagestring ($image120$textheight 42,  $str4$color);
            
imagestring ($image120$textheight 55,  $str5$color);
            
$background imagecolorallocate($image000);  
            
ImageColorTransparent($image$background);  
 
            
// At the very last, let's clean up temporary files
            
header("Content-Type: image/GIF");
            
ImageGif ($image);
            
imagedestroy($image);
            
imagedestroy($img_temp);
            
imagedestroy($img_old);
            
imagedestroy($bgi);

        }
        else{      
                
// We are going to try and get this image the old fashioned way...
            
$extList = array();
            
$extList['gif'] = 'image/gif';
            
$extList['jpg'] = 'image/jpeg';
            
$extList['jpeg'] = 'image/jpeg';
            
$extList['png'] = 'image/png';

            
//Define the output file type
            
$contentType 'Content-type: '.$extList$imageinfo['extension'] ];

            if(
$imageinfo['extension'] =! "image/gif" and $imageinfo['extension'] =! "image/jpeg" and $imageinfo['extension'] =! "image/png"){             
                throw new 
InvalidIDException("The file Extension is not allowed!");
            }
            else{
                
// File type is allowed, so proceed
                
$status "";
                
header($contentType);
                
$curl = new Curl($image);
                
$curl->setHeader();
                
$curl->exec();
                
$curl->close();
            } 
        }
    }
    
    public function 
daycare(){        
        
$daycare = new Daycare;
        
$adopts $daycare->getAdopts();
        
$this->setField("daycare"$daycare);
    }
}
?>

Last edited by tahbikat; 02-15-2016 at 10:59 PM.
Reply With Quote
  #2  
Old 02-15-2016, 11:48 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,356
Kyttias is on a distinguished road
Default

Can you link a few examples of frozen pets that aren't displaying properly versus ones that are? Do they appear any different in the database?
__________________
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 02-15-2016, 11:52 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,647
tahbikat is on a distinguished road
Default

Not that I can see. :c The database has them as frozen. They even show the little frozen icon I've added when viewing from the user's profile page.

After clicking, refresh them to see the actual profile.
Frozen without stats (correct): http://mysgardia.com/levelup/click/518
Frozen with stats (wut r u doin): http://mysgardia.com/levelup/click/3299


Now that I think of it, I'd actually like to have the stats displayed, but only for creatures that are level 2 and higher. Pretty sure I can do this, but I still need to fix the present issue though before I can or it won't even work.
Reply With Quote
  #4  
Old 02-15-2016, 11:57 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,356
Kyttias is on a distinguished road
Default



???
__________________
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
  #5  
Old 02-16-2016, 12:04 AM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,647
tahbikat is on a distinguished road
Default

So confused...

Could it be something to do with cookies? Or guests vs members viewing?
This is what I get ;-;

EDIT: Maybe it's just me. One of my members said they can't see the stats. Why can I? Ohhh it's gonna drive me crazy lol


Last edited by tahbikat; 02-16-2016 at 12:11 AM.
Reply With Quote
  #6  
Old 02-17-2016, 01:10 AM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,647
tahbikat is on a distinguished road
Default

Ok... it's not doing it anymore... so maybe just some weird thing with cookies or browser/site settings or... idk, but okay haha!
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 08:11 AM.

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