tahbikat
01-13-2016, 04:03 PM
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/forum/showpost.php?p=33218&postcount=2
Previews:
http://i.imgur.com/q0tFjfy.png
http://i.imgur.com/0Pmyu12.png
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 - http://i.imgur.com/SdlBHhs.png
Uncommon.png - http://i.imgur.com/E19PtN0.png
Rare.png - http://i.imgur.com/ZrSc8mM.png
Variant.png - http://i.imgur.com/LUXmawR.png
Normal.png (this is simply a 10x10 transparent image) - http://i.imgur.com/bGsab9U.png 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.
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.
$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:
<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/forum/showpost.php?p=33513&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!
Previews:
http://i.imgur.com/q0tFjfy.png
http://i.imgur.com/0Pmyu12.png
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 - http://i.imgur.com/SdlBHhs.png
Uncommon.png - http://i.imgur.com/E19PtN0.png
Rare.png - http://i.imgur.com/ZrSc8mM.png
Variant.png - http://i.imgur.com/LUXmawR.png
Normal.png (this is simply a 10x10 transparent image) - http://i.imgur.com/bGsab9U.png 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.
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.
$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:
<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/forum/showpost.php?p=33513&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!