Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2016, 04:03 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 48,789
tahbikat is on a distinguished road
Default Species Rarities with images!

Firstly, you should probably have some sort of public profile in place for your creatures. See this post by Kyttias to get that in place: http://www.mysidiaadoptables.com/for...18&postcount=2

Previews:





Directions

Let's start with adding the database column first. Go to your phpMyAdmin, click on your prefix_adoptables database, and create a new column called "rarity", type varchar (40), collation latin1_swedish_ci, default can be set to Common (just in case you forget to update the species, at least they'll have a star).

With that finished, save these provided stars and names. Be sure to use the names I've provided! Upload them to your picuploads folder. Feel free to use your own custom images too if you'd rather have something else displayed instead of stars! Just keep the names.

Common.png -
Uncommon.png -
Rare.png -
Variant.png -
Normal.png (this is simply a 10x10 transparent image) - http://i.imgur.com/bGsab9U.png

Next, go to your class_adoptables.php in your classes folder and add this code under the public function getGender.
PHP Code:
        public function getRarity(){
        return 
$this->rarity;
    } 
Finally, if you've used Kyttias' public profile mod, put this bit of code under the $gender_lookup part.
PHP Code:
        $alternates_lookup $mysidia->db->select("owned_adoptables", array("usealternates"), "aid = '{$this->adopt->getAdoptID()}'")->fetchColumn();
        if (
$alternates_lookup == "yes") { $usealternates "Variant"; } else { $usealternates "Normal"; } 
Then, wherever you have your adopts' stats displayed, you can display the stars with this code:
PHP Code:
<img src='/picuploads/{$this->adopt->getRarity()}.png' title='{$this->adopt->getRarity()} Species, {$usealternates}' style='margin-right: -3px;' /> <img src='/picuploads/{$usealternates}.png' title='{$this->adopt->getRarity()} Species, {$usealternates}' /> 
EDIT: As an additional step, if you'd like to add the field to your AdminCP when creating an adoptable, see Abronsyth's post #4: http://www.mysidiaadoptables.com/for...13&postcount=3

Now you have some species rarity stars in place! Hopefully I've explained this well enough. The red star will only display if the adoptable is using its variant form. If it isn't using the variant form, the 10x10 transparent image will display, which appears as nothing to a user. Keep in mind, whenever you create a new adoptable species, you will need to manually edit its rarity field in your prefix_adoptables database, as by default, "Common" will always be used.

You can tinker with the code parts in order to include the stars on the myadopts.php and manage adopt pages.

You can also add more rarity options, and simply recolor the stars and upload them. This can be useful if you have quest, event, and/or holiday species. You could also even do away with rarities altogether and have element types, power types, etc! It's all up to you, go ahead and experiment!

Last edited by tahbikat; 03-02-2016 at 11:40 PM.
Reply With Quote
  #2  
Old 01-15-2016, 04:52 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,039
Hwona is on a distinguished road
Default >^.^<

Thank you so much for this! I plan to start using a slightly tweaked version. The concept is really cute!
__________________

Last edited by Hwona; 01-15-2016 at 05:06 AM.
Reply With Quote
  #3  
Old 01-15-2016, 08:14 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,381
Abronsyth is on a distinguished road
Default

Ooh, this is brilliant! My users have been asking about something like this! Thank you for sharing <3

I'm going to play around and see if I can incorporate this in the ACP :)
Edit:
That was actually way easier than I thought it'd be!

Only need to add some minor things;
.../admincp/adopt.php
Around line 52 you should see something starting with $mysidia->db->insert, the first of 3 that are right there. Add this into that string somewhere;
PHP Code:
"rarity" => $mysidia->input->post("rarity"
Now go to .../admincp/view/adoptview.php
Now find where you see a bunch of strings starting with $basicInfo and insert this chunk somewhere (I added mine right under the class section):
PHP Code:
        $basicInfo->add(new Comment("Adoptable Rarity: "FALSE));
        
$basicInfo->add(new TextField("rarity"));
        
$basicInfo->add(new Comment("The rarity level for this adoptable (Common, Uncommon, or Rare)")); 
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 01-15-2016 at 05:00 PM.
Reply With Quote
  #4  
Old 01-15-2016, 10:45 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 48,789
tahbikat is on a distinguished road
Default

No problem guys! ^^ Glad you find it useful! Abron, it would probably look so cute with some little fish instead of stars for your site. <3 Just my opinion though!

And awesomeness! I'll add this to the parent post if you don't mind? (:
Reply With Quote
  #5  
Old 01-15-2016, 11:44 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,381
Abronsyth is on a distinguished road
Default

That's totally fine! And oh my, tiny fish would be absolutely perfect, thank you for that idea :D
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #6  
Old 03-02-2016, 06:41 PM
Corsair's Avatar
Corsair Corsair is offline
Member
 
Join Date: Jan 2012
Posts: 128
Gender: Female
Credits: 11,204
Corsair is on a distinguished road
Default

I have two questions.

1. Can you have the rarity displayed as text as well? I tried but got a error.

2. How does it know which image to use? To be more specific does the image name have to be the same as the rarity name including casing?
Reply With Quote
  #7  
Old 03-02-2016, 11:21 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 48,789
tahbikat is on a distinguished road
Default

1.) If you'd like text only, then leave out the part where you add the <img src> code and instead just put {$this->adopt->getRarity()} and {$usealternates} (if you want variant text to display) or {$adopt->getRarity()} (I think this second one is for levelupview.php, someone wanna verify?)

2.) Yes, basically whatever you're calling your rarities in the database table is what you need to name your images. So if you have a rarity called "Fairy" then name your image "Fairy.png". Not sure if it's case sensitive but usually everything involving PHP is case sensitive. Though you can ignore this altogether if you aren't using images.
Reply With Quote
  #8  
Old 03-27-2016, 12:33 PM
Pear's Avatar
Pear Pear is offline
Woah man.
 
Join Date: Dec 2013
Location: The Underworld
Posts: 169
Gender: Female
Credits: 45,346
Pear is on a distinguished road
Default

"wherever you have your adopts' stats displayed"? I don't know what this means..haha where would it be located in a basic Mys 1.3.4 file? c:
__________________
Noot noot! Gotta get a new signooture. >->
Reply With Quote
  #9  
Old 03-28-2016, 10:44 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 48,789
tahbikat is on a distinguished road
Default

Quote:
Originally Posted by Pear View Post
"wherever you have your adopts' stats displayed"? I don't know what this means..haha where would it be located in a basic Mys 1.3.4 file? c:
If you have public pet pages made, then pretty much wherever the adopt's stats (name, gender, personality, clicks, etc) are displayed, though really you could display it anywhere. If you don't have Kyttias's profile mod in place then this mod is kinda obsolete unless you're using it elsewhere (manage page for instance).
Reply With Quote
  #10  
Old 03-29-2016, 12:53 PM
Pear's Avatar
Pear Pear is offline
Woah man.
 
Join Date: Dec 2013
Location: The Underworld
Posts: 169
Gender: Female
Credits: 45,346
Pear is on a distinguished road
Default

@tahbikat - Ah, alright. c: <3 Thanks ^-^
__________________
Noot noot! Gotta get a new signooture. >->
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


All times are GMT -5. The time now is 03:57 AM.

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