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 04-20-2015, 01:40 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 111,370
Kyttias is on a distinguished road
Arrow Display Pet's Birthday / Original Owner

This mod could also be used for other things. The basic concept is that you have some bit of information you need associated with a pet but that bit of information needs to be attached to them when they are born or otherwise created by the system.

Database
Open up phpMyAdmin so you have access to your database, and open up the owned_adoptables table. We're going to create two new columns.

You can add these columns by pressing Structure and, at the bottom of that page, observing where you can type in '2' to add 2 columns at the end of the table, and pressing 'Go'.

Both will be stored as the VARCHAR type, originalowner with a length of 20, birthday with a length of 30. I recommend you fill birthday with a default value formatted such as "April 20th, 2015" and all existing pets will have this date set as their birthday. You can do the similar with originalowner, but if it's more fitting for your needs, leave it blank.

Alternatively, you can instead use the following query by opening the SQL tab instead of the Structure tab:
Code:
ALTER TABLE adopts_owned_adoptables ADD `originalowner` varchar(20) NOT NULL  DEFAULT '',
ALTER TABLE adopts_owned_adoptables ADD `birthday` varchar(20) NOT NULL  DEFAULT 'April 20th, 2015'
If your default prefix for your database is not adopts_, you'll need to edit the code above first!
Pet Creation Areas
Pets can be created through five different means so code needs to be changed in each place. In classes/class_stockadopt.php pets are created for adoptable shops, in classes/class_promocode.php, pets are created from user entered promo-codes, in classes/class_breeding, pets are created via two pets being bred together to make offspring, in adopt.php the pets are created from a list of always available pets for free, and finally, in admincp/ownedadopt.php you can, as admin, give new pets directly to members. Open all of these files up and look for this, it only happens once in each of these five files (be sure not to miss a single file):

PHP Code:
$mysidia->db->insert("owned_adoptables", array( 
Make sure that it does say insert, not update. We're only looking to make additions to the insert function. Observe this line and try to wrap your head around what's going on -- that's right, these correspond directly with the column names in the database.

Alright, anywhere in these lines, I prefer at the end, we're going to add references to our new database columns and what we want to be in these fields.

PHP Code:
"originalowner" => $mysidia->user->username"birthday" => date("F jS, Y"
Psst, an example of how the birthday field will display itself is "April 20th, 2015". If you'd like to store data differently, look into how PHP formats dates.
Displaying Information
Unfortunately, the method I'm using on my own site is kind of hack-y and simply rewrites the error page announcing "you've already clicked this pet today". This isn't the most desirable nor elegant approach. So this is not a guide to making profile pages for your pets as I have done on my own site.

However, sticking with the original framework, pet stats can be found from a pet's management page where only the current owner can find this information. If you open up classes/class_ownedadoptable.php and find public function getStats() you'll be able to add information in this location, for example, by modifying the $adoptStats variable to include references to $this->originalowner and $this->birthday which each correspond to the values found in the columns we added to the database:

PHP Code:
$adoptStats "<br>Original Owner: {$this->originalowner}<br>Birthday: {$this->birthday}<br>Trade Status: {$this->tradestatus}<br> Current Level: {$this->currentlevel}<br>Next Level: {$nextLevel}</b>"
This mod is very similar to Wallie's Pet Stats/Skills mod which is the same basic concept - adding columns to the database to hold new pet information, making sure this information is created when the pets are created, and displaying it. Wallie's thread attempts to go into detail about displaying pet information in other ways, and I based my own pet profile pages after what I learned there, so it may or may not be of help - it depends on how well you can wrap your head around code. However, Wallie's version is specific to v1.3.3, and some things have changed slightly.
__________________
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
  #2  
Old 11-19-2015, 12:07 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,530
Abronsyth is on a distinguished road
Default

(Super late reply but oh well)

This is splendid! Thank you for sharing :) I really appreciate the little tips and clues you include in all of your mod posts, as well!

(Now to figure out how to give pets public profiles, haha!)
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #3  
Old 01-15-2017, 10:03 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,328
SilverDragonTears is on a distinguished road
Default

It's giving my adopts a birthday a day ahead of what it really is. Suggestions?
__________________

Check out SilvaTales
Reply With Quote
  #4  
Old 01-16-2017, 07:51 AM
Silver_Brick Silver_Brick is offline
Designer || Coder
 
Join Date: Oct 2016
Location: In Earth
Posts: 205
Gender: Male
Credits: 31,314
Silver_Brick is on a distinguished road
Default

did you added the Database correctly i am sure the mistake is in database because i was also getting same problem but it is solved now by just re doing the things
Reply With Quote
  #5  
Old 01-16-2017, 09:46 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,328
SilverDragonTears is on a distinguished road
Default

Quote:
Originally Posted by Silver_Brick View Post
did you added the Database correctly i am sure the mistake is in database because i was also getting same problem but it is solved now by just re doing the things
I did that as well and it's still not working.
__________________

Check out SilvaTales
Reply With Quote
  #6  
Old 01-16-2017, 10:06 AM
Silver_Brick Silver_Brick is offline
Designer || Coder
 
Join Date: Oct 2016
Location: In Earth
Posts: 205
Gender: Male
Credits: 31,314
Silver_Brick is on a distinguished road
Default

then i think its your website timing problem and i think it is using your computer time or any think maybe you can search the forum and find the thread by kyttias where they posted about website timing maybe it will help :)
Reply With Quote
  #7  
Old 01-16-2017, 10:28 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,328
SilverDragonTears is on a distinguished road
Default

Thank you :) I will do that.
__________________

Check out SilvaTales
Reply With Quote
  #8  
Old 03-03-2017, 06:14 PM
KrinklyKrisps KrinklyKrisps is offline
The Bit Ranch Leader
 
Join Date: Mar 2017
Posts: 6
Gender: Male
Credits: 1,301
KrinklyKrisps is on a distinguished road
Default

so cool dude
__________________
| AwesomeAdopt Thread | some random text | sample text | Dinocanid is my HERO
Reply With Quote
Reply

Tags
birthday, original owner


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
Original Fiction Tequila Fanfics and Free Writing 11 05-28-2022 04:28 AM
PokePets mods! NEW Orginal Owner mod! PokePets Mys v1.1.x Mods 34 04-20-2015 02:13 AM
A newbie with a new question, how original! Gelliebeen Newcomer Center 12 04-29-2013 10:27 AM
Birthday!!! (you'll never guess who!) PTGigi Other Chat 9 02-11-2011 07:56 PM
Show off your Original Characters! Tequila Art Gallery 6 01-22-2011 01:14 AM


All times are GMT -5. The time now is 07:04 PM.

Currently Active Users: 737 (0 members and 737 guests)
Threads: 4,081, Posts: 32,032, 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