PDA

View Full Version : Custom design pets


Chibi_Chicken
06-11-2011, 06:28 AM
Custom Pet Mod for Mysidia Adoptables v1.2.1

This mod will allow users to pick the background color of the pet that they adopt, and as the adopt levels up their color choice will effect that level as well.

Demo: http://www.plumagedoom.com/cpet/petdemo.php?id=3
Download: http://www.plumagedoom.com/cpet/Cpet-v1-Installation.zip

Installation Notes:
I have put this mod on to a fresh copy of Mysidia v1.2.1 after installing the basic script run the installer install.php in the main folder. You will need to be logged in as a admin to install it. This will add in the needed two tables and update the apc hooks; Remember to remove the install.php!

Now that you have installed Cpets create any adoptable like you would normally do however when making an adoptable do not use Alternate Outcomes Settings** after adding in adopts and any levels for it go to the Site Settings page and in the Plugin Settings use the Custom Pet Admin to add the needed layers for the adopt and its levels.
You have just added a new custom adopt for users to play with.
**Alternate Outcomes Settings has not been tested with this mod, I am not sure how it will handle it. what I think will happen is when any of the scripts call for the image of the pet it will find that alter images is on and will use that image instead of the one on the owned_adoptables.imageurl

Custom Pet Admin Notes:
At the moment you have two choices; add in a new image and delete an image (manage image layer.)
When you chose to upload an image you will need:

Layer name: This can be a readable name used when you want to manage the image at a latter time
Body or Lines: This will set up what type of layer it will be. If you were to add in more than one of either type the likely thing that would happen is the script will grab them and what ever one was sorted (added?) last will be used.
Pet ID: Pick what pet this layer is for.
Pet Level: Add in the level that this is for, note that level 0 is the egg level or first level that you make for an adoptable.
File to Upload: The image you want to use for the layer effect.
Image Requirements: The image must me less than 150kb.
It must be PNG-8 file, this script will allow gifs to load however the image functions will only handle pngs right now so it will just give you errors for trying to use gifs.
Body layers can be any color(s) the scrip will just go in and replace any value it finds. it handles transparency with the alpha channel.

Adding Cpets to a pre-existing install:

If you want to install this code to an already installed copy of Mysidia Adoptables, run the install.php script to add in the tables and apc hook. For the pages look for:
#//----------
#custom pet mod
#//----------
this is the start of the new code that I have added in, I tried not to alter any code outside of this. The exceptions are in adopt.php I relinked from doadopt.php to customadopt.php, this also doesnt have the custom pet mod comments.

Here is the list of the files.
inc/functions.php //added in link to the cpet functions forgot to add in the comment however it is basically the third line.
adopt.php //redirected page and clear out/build a new variable in the session
breeding.php //added in section for the pet to breed with the custom background. note: I just had it pick a color randomly for the new adoptable.
doadopt.php //added in section to add the info from the custom pet session pet save it. Then build the image and save that to the adoptable.
levelup.php //added in find the parent id then level up the adoptable, level up rebuilds and saves the image again.

Altered
myadopts.php //altered how the image is taken from the db and displayed.
stats.php //altered how the image is taken from the db and displayed. Note: I missed a spot when the code get a random set of adoptable, it shows the egg image instead.

New Files
preview.php //used to display the new colors. Note: This may have caching issues with some browsers, I am not sure.
customadopt.php //form used to build the new pet.
cpetadmin.php //admin that manages the image assets for the custom adopts.
custompet_functions.php //core engine of the custom adopts does stuff minus toast.

Please leave any comments and questions in this thread.
[original post]

I have been working on this on and off for months now. i am at a point were i can show an example of what i am building

this mod will allow users to pick a pet type and then pick the color of the body also add in different effects. then when the pet levels or breeds the effects stick with it and can be passed on to the offspring.

so far this all i have gotten done :displeased:
http://plumagedoom.com/cpet/petdemo.php

I am still learning how the different scripts work with each other.

any comments or interest is welcomed.

PokePets
06-11-2011, 08:57 AM
This could be nice for kecleon @ Pokemon sites :P

Inf3rnal
06-11-2011, 09:22 AM
Looks quite amazing.

Basically using GD to generate a color for specified areas?

or by having the bg color magenta and having whatever color specified replace the magenta?

Either way I can't wait to mess with that code. :3

Hall of Famer
06-11-2011, 02:12 PM
Sounds promising, but I hate to be the bad guy to tell you that this forum is only for mods/addons that are already completed and ready for users to download. For ideas or projects you are currently working on, post in Questions & Support forum so members can have a preview of your script.

Chibi_Chicken
06-11-2011, 07:26 PM
Looks quite amazing.

Basically using GD to generate a color for specified areas?

or by having the bg color magenta and having whatever color specified replace the magenta?

Either way I can't wait to mess with that code. :3

it basically takes the template png image and replaces the color but it still saves the alpha channel so you can get a blending effect when you add more than just one layer.

Sounds promising, but I hate to be the bad guy to tell you that this forum is only for mods/addons that are already completed and ready for users to download. For ideas or projects you are currently working on, post in Questions & Support forum so members can have a preview of your script.

ok, wasn't to sure were it went, please move it to the right place, thank you.

Teshia
06-11-2011, 11:41 PM
I think its friggin awesome. ^^

But then, I'm a bit biased. XD
<3

Rozel
06-12-2011, 12:52 PM
This is awesome! It could work pretty cool with breeding sites, if possible I think it would be cool to also be able to have it get markings and such kind of like Wajas. But first things first, of course. :3 It looks great.

Kaeliah
06-12-2011, 10:24 PM
Yeah I've been doing stuff with GD for awhile. It's hard to get it generic enough for others to use though. That's my opinion anyway.

Teshia
06-13-2011, 03:01 AM
Its a complex script. Your average newbie would get frustrated with it rather quickly. It will be a long way off before it could be edited from the admin panel, if at all. We do most of our editing directly in the database, so admin is kinda useless.

Rozel
06-13-2011, 10:05 AM
Well, I'm sure if you make a little guide you can explain to people how to edit from the database, rather then go through the trouble of coding more. By now I'm used to a database so I think I'd be fine with a little instruction. I don't know about other people though. :o

Hall of Famer
06-13-2011, 01:09 PM
Alright, thanks for understanding. Will you continue to develop this product? And is it going to be completed soon? If so, I will leave it here as it is.

Chibi_Chicken
06-13-2011, 02:29 PM
It will be a long way off before it could be edited from the admin panel, if at all. We do most of our editing directly in the database, so admin is kinda useless.


well at the moment i am working on the admin panel for custom pet. I need a page that lets me upload images and put the needed info in to a table with as few user errors as i can get.

I have also finished the adoption process, so after a user has picked their color for their pet they can adopt it with the doadopt. it saves the file and inserts it to the owned_adoptables under image url. however most pages when they load the images for the pets they just grab the default image instead of checking for a custom image.


Alright, thanks for understanding. Will you continue to develop this product? And is it going to be completed soon? If so, I will leave it here as it is.

I intend to release at least a beta of it; as for completion i can give the estimate of up to 3-4 months. i am focusing a lot of energy to it right now but i have a lot of pending/partial projects that might come up.

Teshia
06-13-2011, 03:48 PM
well at the moment i am working on the admin panel for custom pet. I need a page that lets me upload images and put the needed info in to a table with as few user errors as i can get.

I have also finished the adoption process, so after a user has picked their color for their pet they can adopt it with the doadopt. it saves the file and inserts it to the owned_adoptables under image url. however most pages when they load the images for the pets they just grab the default image instead of checking for a custom image.

My bad, I thought you didn't like the admin page.

Chibi_Chicken
06-13-2011, 04:22 PM
That was when i was working with Rusnak Ver 1 and even then i didnt look at the admin page too much. I have found the admin plug in system will work for the basic add or delete of image layers.

Teshia
06-13-2011, 05:30 PM
^^ Very cool. You'll have to show it to me next time I see you.

Nemesis
06-13-2011, 09:56 PM
yeah that's pretty neat. Hope to see it as an added standard feature

Kaeliah
06-14-2011, 12:25 AM
Its a complex script. Your average newbie would get frustrated with it rather quickly. It will be a long way off before it could be edited from the admin panel, if at all. We do most of our editing directly in the database, so admin is kinda useless.

I know what you mean. I have to remember to offer clients who hire me to add admin functions for their new upgrades because I almost prefer doing everything in the phpMyAdmin. XD

Teshia
06-14-2011, 01:21 AM
You took the words right out of my mouth. I used to love the admin panel, but after doing everything in the database you really have so much more control.

Cindykt
06-20-2011, 03:06 AM
OMG that is so good!

Chibi_Chicken
06-20-2011, 04:02 PM
Update:

so i have gotten all of the basic custom pet functions working with the needed php pages: adopt.php, breeding.php doadopt.php levelup.php

their is minor items like displaying the pet on pages like stats.php and myadopts.php (when you click on the individual pet it will show the image) that need to be worked on.

i need to also check and see if the admin functions will bug up any of this as well.

so i can release it soon however i am unsure how i should do that; just have one zip file with all of the modded files, as a fresh install with the mod added to it or a list of were to make the changes in the different files.

AlexC
06-22-2011, 08:44 AM
Jesus, this is an AMAZING script! I would totally add this to my site as a "bonus pet". Question - does this pet change colors as it changes images/levels?

And I think you should do both - offer the files and make a list.

Chibi_Chicken
06-22-2011, 06:37 PM
Jesus, this is an AMAZING script! I would totally add this to my site as a "bonus pet". Question - does this pet change colors as it changes images/levels?

And I think you should do both - offer the files and make a list.

Yes, when the adoptable reaches a new level and it has done a check to see if their is a new level their. it will then update it self and use the same color that you picked when you adopted it.

I released the code, i put the link and info on my first post.

AlexC
06-23-2011, 02:29 PM
I have tried installing the script in my site, but appear to be having troubles with it. The egg image is stretched, and when I try to change the color on the adopt page it's not working. And the image isn't showing up anyway. In the myadopts page, the admin center, nowhere. :/

I think something may have gone wrong while I was setting up my adoptables - can you maybe do a screenshot guide, your writing is a bit confusing. (no offense - I have dyslexia and some memory problems. Anything that isn't laid out very plain and simple, and in complete and proper English I can't read or even compute in some cases.

Chibi_Chicken
06-23-2011, 04:20 PM
The egg image is stretched


In customadopt.php line 146

repace <img height='284' alt='Dynamically generated image' src='preview.php' width='88'>
with <img alt='Dynamically generated image' src='preview.php' >


First start with your image prep. I am going to use Teshia Elefunions they are pngs and have transparency.

I will need to build a body layer. So open it up in an image editing software (in my case old copy of PS.) With the magic of the magic wand and the select->inverse I have a body layer.
http://www.plumagedoom.com/cpet/cpet/01-ps.png

Now save it out as a png-8 File->Save as.
When I name my file I want a unique name. So when I upload it to the script it wont have problems, due to it naming convention of the script.

I will also make an preview image that is displayed when the user wants to pick from the different adopts. the image is simply the body and lines combined.

Now create a new adopt in the admin page, I have used the Change Adoptables->Upload a new Adoptable Image for the preview image.
Now I will create a new adoptable Elefunions setting up the Basic Information, and Adoption Information and Conditions. I do not add anything to Alternate Outcomes Settings.


In the Admin Center in Site Settings at the bottom, is the plug-in Custom Pet Admin or you can just go to it directly by cpetadmin.php.
http://www.plumagedoom.com/cpet/cpet/03-admin.jpg

Here click on upload an image layer and set up your layers.
Remember to change from lines to body when uploading the different layers!
http://www.plumagedoom.com/cpet/cpet/05-upload.jpg

You can now have an Elefunion.
Here are the images that I used:
http://www.plumagedoom.com/cpet/cpet/E-body-1.pnghttp://www.plumagedoom.com/cpet/cpet/e-lines-0.pnghttp://www.plumagedoom.com/cpet/cpet/egg-image.png

ruletka
06-23-2011, 06:02 PM
This is great :) Thanks for sharing this. It works perfectly for me.

Teshia
06-23-2011, 11:41 PM
<3 Absolutely brilliant Chibi. I'm glad its finally finished.

Hall of Famer
06-24-2011, 03:59 PM
I am glad its been working perfectly for you guys/gals too. Best luck to whoever use Chibi's script(not to be confused with ChibiKawaii).

AlexC
07-12-2011, 04:55 PM
sorry to bother you yet again... ^.^; the adopts aren't showing up anywhere? It was showing up on customadopt.php page, but when I look elsewhere, it doesn't. The preview image isn't either. In the admin center, on my profile, nowhere. o.O

Chibi_Chicken
07-12-2011, 10:19 PM
no worries about bothering me just working in my chicken coop of Science!

so the new adopt doesnt show up at all except the customadopt.php with the preview image?

what changes have you made to to the script?

After adopting a new pet the image is saved and the link to the url is in the owned_adoptables image url field and the the way it is pulled is with the function getcurrentimage(id of adoptable)

if you are not seeing a preview image but just "Dynamically generated image"
right click on it and "view image" and it should come up with some error.

Nemesis
07-27-2011, 12:00 PM
Your instructions for installing this mod on an already established site are,

If you want to install this code to an already installed copy of Mysidia Adoptables, run the install.php script to add in the tables and apc hook. For the pages look for:
#//----------
#custom pet mod
#//----------
this is the start of the new code that I have added in, I tried not to alter any code outside of this. The exceptions are in adopt.php I relinked from doadopt.php to customadopt.php, this also doesnt have the custom pet mod comments.

Here is the list of the files.
inc/functions.php //added in link to the cpet functions forgot to add in the comment however it is basically the third line.
adopt.php //redirected page and clear out/build a new variable in the session
breeding.php //added in section for the pet to breed with the custom background. note: I just had it pick a color randomly for the new adoptable.
doadopt.php //added in section to add the info from the custom pet session pet save it. Then build the image and save that to the adoptable.
levelup.php //added in find the parent id then level up the adoptable, level up rebuilds and saves the image again.

Altered
myadopts.php //altered how the image is taken from the db and displayed.
stats.php //altered how the image is taken from the db and displayed. Note: I missed a spot when the code get a random set of adoptable, it shows the egg image instead.

New Files
preview.php //used to display the new colors. Note: This may have caching issues with some browsers, I am not sure.
customadopt.php //form used to build the new pet.
cpetadmin.php //admin that manages the image assets for the custom adopts.
custompet_functions.php //core engine of the custom adopts does stuff minus toast.

Please leave any comments and questions in this thread.

so Basically for my clients if i were to add this to their sites i would need to run the install script, then over write the existing files with the changed ones and it should work? Also adding in the new files. thanks for help.

Chibi_Chicken
07-28-2011, 12:59 AM
yes as long as their isnt any other modifications made to those pages it will work.
please let me know if their was any problems or fixes you found for the next update of this script.

Nemesis
07-28-2011, 10:04 AM
ok well im doing it the easier way, just going to do a complete re-install using your already modified version. Thanks for reply, and this is for cindykt so I won't be able to report any problems.

MichaelCrystal
08-05-2011, 09:00 PM
This could be very helpful to my site! I am very interested in where this is going! Great Work!

izzyrocks09
12-21-2012, 09:23 AM
The link does not work when I try to download it :cfrown:...Does anyone have a working link? I would really like to download this mod!

Missy Master
03-11-2013, 09:58 AM
Does anyone have a copy of the finished script? This looks like something I'd really like to try, but the download is defunct!