Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2014, 12:55 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,191
Hwona is on a distinguished road
Default 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:

Press go. Then you'll come to a page that looks like this:

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.
__________________

Last edited by Hwona; 07-02-2014 at 02:49 PM.
Reply With Quote
  #2  
Old 06-29-2014, 12:56 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,191
Hwona is on a distinguished road
Default 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".
__________________

Last edited by Hwona; 07-02-2014 at 10:03 AM.
Reply With Quote
  #3  
Old 06-29-2014, 12:57 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,191
Hwona is on a distinguished road
Default 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:

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!
__________________

Last edited by Hwona; 07-01-2014 at 12:32 PM.
Reply With Quote
  #4  
Old 06-29-2014, 08:35 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,556
Missy Master is an unknown quantity at this point
Default

**Squees **

Okay gonna try this out, thank you soooooooo much for this!!! :)
Reply With Quote
  #5  
Old 06-29-2014, 09:15 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,556
Missy Master is an unknown quantity at this point
Default

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 !

Last edited by Missy Master; 06-29-2014 at 09:22 AM.
Reply With Quote
  #6  
Old 06-29-2014, 09:40 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,191
Hwona is on a distinguished road
Default 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:

Press go. Then you'll come to a page that looks like this:

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.
__________________

Last edited by Hwona; 07-01-2014 at 05:52 PM.
Reply With Quote
  #7  
Old 06-29-2014, 09:55 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,556
Missy Master is an unknown quantity at this point
Default

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 :)
Reply With Quote
  #8  
Old 06-29-2014, 09:57 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,191
Hwona is on a distinguished road
Default 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
__________________

Last edited by Hwona; 07-02-2014 at 10:52 AM.
Reply With Quote
  #9  
Old 06-29-2014, 10:09 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,556
Missy Master is an unknown quantity at this point
Default

Oh sure I can test it out for you! No problem! :)
Reply With Quote
  #10  
Old 06-29-2014, 10:16 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,191
Hwona is on a distinguished road
Default

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

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trade System Kyttias Questions and Supports 4 05-29-2016 12:29 AM
Making v.1.3.3 Stat Mod Compatible with V.1.3.4 Hwona Questions and Supports 0 07-08-2014 01:37 PM
Stat Inheritance Mod * thanks to Wallie! * Missy Master Mys v1.3.x Mods 0 06-30-2014 02:23 PM
Anyone Want to Have a Stat System Hwona Feedback and Suggestions 12 06-30-2014 09:30 AM
Basic Stat System Hedgen Questions and Supports 3 03-10-2013 02:47 PM


All times are GMT -5. The time now is 11:00 AM.

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