View Single Post
  #12  
Old 12-26-2015, 07:23 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 126,631
Kyttias is on a distinguished road
Default

I did some thinking on this today. You can find this line in levelup.php and comment it out (just make it so this whole elseif clause doesn't fire) -
PHP Code:
elseif($this->adopt->isFrozen() == "yes") { throw new LevelupException("frozen"); } 
to
PHP Code:
// elseif($this->adopt->isFrozen() == "yes") { throw new LevelupException("frozen"); } 
Or, hey, delete it if you're feeling safe with that, whatever.

Instead, we're going to pop on back up to where we checked if the pet had been visited today or not. This line opens up this clause:
PHP Code:
elseif($this->adopt->hasVoter($mysidia->user$date)){ 
We're going to modify it so it also fires when the pet is frozen. This is probably the most important part. Make it this:
PHP Code:
elseif($this->adopt->hasVoter($mysidia->user$date) || ($this->adopt->isFrozen() == "yes")){ 
Inside this, we can nest another if statement that can show a message that will say that the pet is frozen/locked:
PHP Code:
if (!$this->adopt->hasVoter($mysidia->user$date)){
    
$message .= "<b>This pet is frozen!</b>";

Setting a variable with 'dot equals' (.=) adds to the existing variable, appends to it - I think the technical term is that it concatenates to the existing variable.

Okay, so, ACTUALLY, if you used the code I gave originally without modifying it much, you'll see that I already did included something to happen if you're somehow on the page but hadn't visited the pet - the word 'Play' instead of the thankyou message. (To be honest I want to eventually create a feature so pet's aren't automatically counted as being clicked/visited as soon as the page loads, but wait until a button is pressed, so that's why it's there - well that doesn't work like that, and I haven't invented such a thing yet.) Regardless, here's that bit of code how I gave it in the original post:
PHP Code:
// If you haven't seen the pet today:
if (!$this->adopt->hasVoter($mysidia->user$date)){
        
$message .= "<div style='display: inline;'><span class='button'><i class='fa fa-paw'></i> Play</span></div>";

So go ahead and modify/use that. It'll show when you visit the page but the pet is frozen. Rest assured, pets will be treated as if they've already been seen for the day, and won't add on a new click.
__________________
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; 12-26-2015 at 07:28 PM.
Reply With Quote