Thread: Mys 1.3.3 Personality System
View Single Post
  #2  
Old 07-02-2014, 05:11 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,802
Hwona is on a distinguished road
Default Displaying Personality On Levelup Page

This post will cover how to display an adoptable's personality on its click page


1. Go to the "class_ownedadoptable.php" file(inside the "classes" folder). There, at the top, there's a bunch of "protected" variables. Add this below them:
protected $adoptablepersonality;
Add this function to the list of functions below:
public function getAdoptPersonality(){
return $this->personality;
}

2. Got to the "levelup.php" file. On line 29, there should be something like this:
$ip = secure($_SERVER['REMOTE_ADDR']);
Under that with this:
$adoptablepersonality = $this->adopt->getAdoptPersonality();
On line 33, there's a piece of code like this:
PHP Code:
$message = ($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest
Replace that with:
PHP Code:
$message "<div id='personality'>Personality: {$adoptablepersonality}</div>";
$message $message .= (($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest); 
Replace lines 38 and 39, which should contain something like this:
PHP Code:
$document->setTitle($mysidia->lang->frozen_title);
            
$document->addLangvar($mysidia->lang->frozen); 
With:
PHP Code:
    $message $message .= "
<div id='stats'>
Personality: 
{$adoptablepersonality}
</div><br>
We're sorry, but you cannot add clicks to this adoptable at this time because its owner has chosen to freeze it.  Frozen adoptables do not accept new clicks and do not level up.  Thanks anyway for the click though, but the owner of this adoptable wants to keep this adoptable young so it will not be counted."
;
            
$document->setTitle($mysidia->lang->frozen_title);
            
$document->addLangvar($message); 
On line 41, there should be:
else{
Under that, put:
PHP Code:
$message $message .= "<br><text align ='center'><div id='clickpagelink'><a href='{$mysidia->path->getAbsolute()}levelup/click/{$this->adopt->getAdoptID()}'>Click here to visit {$adoptablename}</a><br></div>"
On line 67, there should be something like this:
$document->add($summary);
Under that, put:
$document->addLangvar($message);

I plan on editing the code to allow different personalities to have different chances of being selected. :3
__________________

Last edited by Hwona; 07-02-2014 at 05:18 PM.
Reply With Quote