Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Mys v1.3.x Stat/SKill System (http://www.mysidiaadoptables.com/forum/showthread.php?t=4563)

Hwona 06-29-2014 12:55 AM

Stat/Skill System(Tested with V.1.3.3)
 
Please pardon my poor explanation skills, but here's a quick guide to creating random-generated stats for adoptables. Please save back ups before beginning as this works perfectly for my site but I don't know what may happen with yours. Hence, please don't unleash your anger on me if there is anything amiss. :3

This first post shall cover assigning stats to created adoptables.

1. Go to PHPMyAdmin->your site's database->prefix_owned_adoptables
Once there, there should be a "structure" tab at the top of the screen - click that and then scroll to the bottom of the page until you find:
http://i1290.photobucket.com/albums/...pse6034c19.png
Press go. Then you'll come to a page that looks like this:
http://i1290.photobucket.com/albums/...psa2d07fcb.png
There, set the values to match those in the example and press "save".

2. In the "adopt.php" file, there should be something like this from lines 29 to 32:
PHP Code:

            $name = (!$mysidia->input->post("name"))?$adopt->getType():$mysidia->input->post("name");
            
$alts $adopt->getAltStatus();
            
$code $adopt->getCode();
            
$gender $adopt->getGender(); 

Below that, add:
$statname = rand(minimum value,maximum value);
Then find this on lines 33 to 34:
PHP Code:

            $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"lastbred" => 0)); 

Replace that with (See what was changed?):
PHP Code:

            $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"statname" => $statname"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"lastbred" => 0)); 

3. Go to the "breeding.php" file and find this on line 52:
PHP Code:

 $offspringID $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num 1

Below that, add:
$statname = rand(minimum value,maximum value) ;
and
PHP Code:

$mysidia->db->update("owned_adoptables",array("statname" => $statname),"aid = $offspringID"); 

3. Go to the "shop.php" file. You should find this line on line 73:
elseif($mysidia->input->post("shoptype") == "adoptshop"){
Put this under that:
$statname = rand(minimum value,maximum value) ;
And put this under that:
PHP Code:

$mysidia->db->update("owned_adoptables",array("statname" => $statname),"aid = $offspringID"); 

4. Go to your "class_promocode.php" file in your "classes" folder. Find this piece of code:
PHP Code:

 $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->reward"name" => $this->reward"owner" => $this->user"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => 'no'"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0)); 

Replace it with:
$statname = rand(minimum value,maximum value) ;
Put this under that:
PHP Code:

 $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->reward"name" => $this->reward"owner" => $this->user"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => 'no'"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0"statname" => $statname)); 

5. Now, read carefully! IF there are existing adoptables on the site, go back to the "adopt.php" file. I couldn't figure out how to give adoptables that were created prior to the addition of the modification their own unique values, but I decided to set the existing adoptables' values to half of the maximum initial value. Right below the edits just made to that file, add:
$mysidia->db->update("owned_adoptables",array("statname" => "value"),"") ;
Once that is done, save all changes to the file but don't close it. After that, go to your site and create a quick free adoptable. Adopt that adoptable once. This will update all adoptables in the database to have the set stat.
Go back to the "adopt.php" file and delete what you just added or right-click and select "undo".

Tada! Please contact me or post in the thread if you have any questions! This includes adding extra stats. The next section shall cover how to display those stats on an adoptable's levelup page.

Hwona 06-29-2014 12:56 AM

Displaying Stats On Levelup Page
 
This post will cover how to display stats on an adoptable's 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 $statname;
Add this function to the list of functions below:
public function getAdoptstatname(){
return $this->statname;
}

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:
$adoptablestatname = $this->adopt->getAdoptstatname();
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='stats'>Statname: {$adoptablestatname}</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'>
Statname: 
{$adoptablestatname}
</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);

Tada! The next section will go over the "stat-raising system".

Hwona 06-29-2014 12:57 AM

Creating Items to Raise Stats
 
This post will explain how to create items to raise an adoptable's stats.


1. Go to the “item_functions” table in your database. Once there, click the “insert” tab at the top of the page. You should arrive at a page like this:
http://i1290.photobucket.com/albums/...ps899d22a0.png
Fill out the values to match those in the example and then press “Go”.

2.Go to the “functions_items.php” file in the “functions” folder. Add this item function to the list:
PHP Code:

function items_statname($item$adopt){ $mysidia Registry::get("mysidia"); $newstatname $adopt->statname $item->value$mysidia->db->update("owned_adoptables", array("statname" => $newstatname), "aid='{$adopt->aid}'and owner='{$item->owner}'"); $note "By using {$item->itemname}, the adoptable's Statname raised by {$item->value}!"$delitem $item->remove(); return $note; } 

3. Go to your “class_privateitem.php” file in the “classes’ folder. See all that case-break stuff? Add this to the list:
PHP Code:

case "Statname":
            
$message items_Statname($this$owned_adoptable);
            break; 

4. Go to your ACP and create a “Statname” item. Make your you allow it to be consumed!

Tada! The next post shall cover the award system!

Missy Master 06-29-2014 08:35 AM

**Squees **

Okay gonna try this out, thank you soooooooo much for this!!! :)

Missy Master 06-29-2014 09:15 AM

Would you possibly be able to just upload your modded levelup file? I keep getting errors on that part of the changeover of code!


**Also, is there any way to just get the code for your brilliant and beautiful layout? I really am dying to see this as part of my display, it's gorgeous!!



Thank you !

Hwona 06-29-2014 09:40 AM

Award System
 
Allowing pets to earn "awards" through training.


1. Go to PHPMyAdmin->your site's database->prefix_owned_adoptables
Once there, there should be a "structure" tab at the top of the screen - click that and then scroll to the bottom of the page until you find:
http://i1290.photobucket.com/albums/...pse6034c19.png
Press go. Then you'll come to a page that looks like this:
http://i1290.photobucket.com/albums/...ps25a230e7.png
Set the values to match the example shown above and press "save".

2. Remember the item function we made earlier in the "functions_items.php" file? Go there and replace that part of the code with this:
PHP Code:

 function items_statname($item$adopt){
  
$mysidia Registry::get("mysidia");
  
$newstatname $adopt->statname $item->value;
  
$mysidia->db->update("owned_adoptables", array("statname" => $newstatname), "aid='{$adopt->aid}'and owner='{$item->owner}'");
  
$note "By using {$item->itemname}, the adoptable's statname raised by {$item->value}!<br>";
  
$note2 "By using {$item->itemname}, the adoptable's statname raised by {$item->value}! It now has 1 statname medal!<br>";
    if(
$newstatname >= 150) {
  
$mysidia->db->update("owned_adoptables", array("statnamemedalstatus" => 'yes'), "aid='{$adopt->aid}'and owner='{$item->owner}'");
  
$delitem $item->remove(); 
  return 
$note2;
  }
  else{
   
$delitem $item->remove(); 
  return 
$note;
  }
  } 

3. Go to your "class_ownedadoptable.php" file. Add this to the "protected" list:
protected $statnamemedalstatus;
Add this to the list of functions:
public function getAdoptObedienceMedalStatus(){
return $this->obediencemedalstatus;
}

4. Go to "levelup.php" and find this piece of code:
$adoptablestatname = $this->adopt->getAdoptstatname();
Under that, put:
$statnamemedalstatus = $this->adopt->getAdoptStatNameMedalStatus();
PHP Code:

$message $message .= "
<div id='stats'>
Statname: 
{$adoptablestatname}
</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); 

Right after:
<div id='stats'>
Statname: {$adoptablestatname}
</div><br>
Add:
<div id ='trainingawards'><img src='{$mysidia->path->getAbsolute()}picuploads/awards/statnamemedalstatus{$statnamemedalstatus}.png'></div>

5. Awards Folder(Zipped)
to your picuploads folder and unzip it.
Here are some Photoshop bases you can color if you want to swap out the images provided in the folder:
Trophy Base
Ribbon Base
Medal Base
If you need non-photshop bases, please tell me.



That's done! Now, you may have noticed that the levelup page might not look as visually-appealing as you want it to be. The next post will take care of that.

Missy Master 06-29-2014 09:55 AM

I'm not sure :3

I will take another crack at this today, but I got a white screen when I did the edits on levelup ... maybe someone else can try and see what you get?

Might be error on my part pretty easy heheh :)

Hwona 06-29-2014 09:57 AM

Styling The Levelup Page
 
Styling the levelup page

Ok... just a heads up, I don't really know how to explain this, but I'll give it a shot!


So, do you all remember the "div id" stuff we added to the levelup page earlier on?:
PHP Code:

$message $message .= 
<div id='stats'> 
Statname: 
{$adoptablestatname} 
</div><br><div id ='trainingawards'><img src='
{$mysidia->path->getAbsolute()}picuploads/awards/statnamemedalstatus{$statnamemedalstatus}.png'></div> 
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."


Go to the CSS stylesheet for your themes and add this:
#stats {
}
#trainingawards {

}
Add CSS code between those brackets to style the boxes the stats and awards are in! I'll make a custom them just for this. :3

Go to this thread for a CSS theme with levelup page styling: Spring Theme

Missy Master 06-29-2014 10:09 AM

Oh sure I can test it out for you! No problem! :)

Hwona 06-29-2014 10:16 AM

^Thanks a bunch! Ehh... it doesn't say what version you're using? Do you think this would work for earlier and later versions?


All times are GMT -5. The time now is 08:32 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.