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 12-09-2012, 02:25 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,504
Hall of Famer is on a distinguished road
Default Itemdrop Mod for Mys v1.3.2

Well I've decided to take a break from working on Mys v1.3.3's GUI system, and instead I ended up with this plugin. It is called Itemdrop, which allows your user to gain random items by clicking on pets. This way it motivates them to exchange clicks more than simply leveling up. This feature is only available for members, guests wont get items however they try.

You can assign either one or multiple items to an adoptables species, which will drop items based on their item drop-rate. For instance, if an adoptable has drop-rate of 30, your user will have 30% chance to get an item by clicking on this pet. If you assign two or three items to this species, each of them will have 15% or 10% chance to come out. Unfortunately there's no way to 'discriminate' among items for a given adoptable, a probability system is way too complicated for me to work with at this point.

So if you have just completed a fresh installation of Mys v1.3.2, you may just download the compressed .rar file in this thread. Upload the files to their corresponding directories. Run the install_itemdrop.php script once and ONLY ONCE, and you are good to go.

If you have modified your levelup.php and admincp/adopt.php, however, you will have to install this Mod manually. Its quite simple though, I will show you how to do this step by step:


Step 1:
Go to PHPMyadmin, in table prefix.adoptables, add the two following columns after cost:
PHP Code:
dropitemvarchar(100), default NULL;
droprateint(11), default 0
Step 2:
Open admincp/adopt.php, find this section of code:
PHP Code:
<p>The alternate outcome has a chance of 1 in <input name='altchance' type='text' id='altchance' size='6' maxlength='6'>of being selected.<br />
                                   (
Here you can select the chance that the alternate images for this adoptable are used
                                   
So, for an equal chance of using say male or female imagesput 2 in the box to have a 1 out of 2 or 50chance of using the alternate image
                                   If 
you want to have the alternate images be rare images, use a higher number
                                   
like 100 for a 1 out of 100 chance of using the alternates.)</p></fieldset
add below:
PHP Code:
<fieldset><legend>Item Drop Settings</legend>
                                   <
p>Items dropped by clicking this adopt: (if multiple items are possibleseparate them by comma)</p>
                                   <
input name='dropitem' type='text' id='dropitem'></p>
                                   <
p>Items dropped rate: (must be somewhere between 0 and 100)
                                   <
p><input name='droprate' type='text' id='droprate'></p></fieldset
Then browse a little bit up and locate this line:
PHP Code:
$mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"), "alternates" => $mysidia->input->post("alternates"), 
                                                     
"altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"))); 
replace with:
PHP Code:
$mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"), "alternates" => $mysidia->input->post("alternates"), 
                                                     
"altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"), "dropitem" => $mysidia->input->post("dropitem"), "droprate" => $mysidia->input->post("droprate"))); 
Now that we are done with admincp modification, it is time for the real fun. Open the file levelup.php in your adoptables root directory and search for these:
PHP Code:
         // At the very last, give the user some money for clicking adoptables
         
$mysidia->page->settitle("{$lang->gave} {$adopt->name} one {$lang->unit}"); 
Then add this block of code above these two lines:
PHP Code:
        // Now let's take care of the itemdrop plugin.
         
$plugin $mysidia->db->select("acp_hooks", array(), "pluginname = 'itemdrop' and pluginstatus = 1")->fetchObject();
         if(
$mysidia->user instanceof Member and is_object($plugin)){
             
$item $mysidia->db->select("adoptables", array("dropitem""droprate"), "type = '{$adopt->type}'")->fetchObject();
             if(!empty(
$item->dropitem) and $item->droprate 0){
                 
$candrop "yes";
                 
$droprand mt_rand(099);
                 if(
$droprand $item->droprate){
                     
// Item has dropped, now process the event!
                     
$itemrand explode(","$item->dropitem);
                     
$num count($itemrand);

                     if(
count($itemrand) == 1$actualitem $itemrand[0];
                     else{
                         
$actualrand mt_rand(0$num 1);
                         
$actualitem $itemrand[$actualrand];
                     }

                     
$newitem = new StockItem($actualitem1);
                     
$newitem->assign($mysidia->user->username);
                     
$newitem->append(1); 
                     
$dropstatus "<br>Congratulations, you have acquired an item {$actualitem} by clicking this adoptable.";
                 }
                 else 
$dropstatus "<br>Unfortunately no item is dropped from this adoptable this time, you have to try something else.";
             }    
         } 
You are getting close, now locate this very line of code near the bottom of levelup.php:
PHP Code:
         $mysidia->page->addcontent("<div align='center'><br />You have earned {$reward} {$mysidia->settings->cost} for leveling up this adoptable. <br />You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}</div>"); 
Add below:
PHP Code:
if($candrop == "yes"$mysidia->page->addcontent($dropstatus); 
At the very last, insert a row into table prefix.acp_hooks. This can be done in PHPMyadmin, or you can download the script file install_itemdrop.php and executes it on your site.

PHP Code:
"id" => NULL
"linktext" => "Item Drop Plugin v1.3.2 by Hall of Famer"
"linkurl" => "http://www.mysidiaadoptables.com/forum/showthread.php?p=25214"
"pluginname" => "itemdrop"
"pluginstatus" => 
Well done, it is just so simple isnt it? Congratulations, you have now added an interesting tiny little feature to your site. Hopefully your members will love it, although you need to be careful with the drop-rate of each adoptable. To low drop-rate frustrates your members, while too high drop-rate makes this entire thing pointless. Good luck.

Hall of Famer
Attached Files
File Type: rar itemdrop mod v1.3.2.rar (10.9 KB, 18 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 12-09-2012, 02:26 AM
LucasA33's Avatar
LucasA33 LucasA33 is offline
Member
 
Join Date: Jul 2011
Posts: 144
Gender: Male
Credits: 12,242
LucasA33 is on a distinguished road
Default

This is completely what I have been looking for!
Thanks! :)
__________________
Reply With Quote
  #3  
Old 12-09-2012, 02:30 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,504
Hall of Famer is on a distinguished road
Default

Wow you were quick, I hadnt even finished uploading the files and you already posted a reply lol. Good luck using this Mod though, dont overdo it or you may end up killing the fun for your members.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 12-09-2012, 01:32 PM
LucasA33's Avatar
LucasA33 LucasA33 is offline
Member
 
Join Date: Jul 2011
Posts: 144
Gender: Male
Credits: 12,242
LucasA33 is on a distinguished road
Default

Yea, when I saw you making this, I was like:
"omahgawd it's something i've always wanted on my site".

I haven't even configured it yet.
__________________
Reply With Quote
  #5  
Old 12-09-2012, 01:34 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,504
Hall of Famer is on a distinguished road
Default

Oh great, glad it actually could be of some help for certain people. I actually tried it on a beta site with fresh installation, it worked as nice as a charm. Not sure with Mys v1.3.1 upgraded site though, hopefully it will run smoothly.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 12-09-2012, 08:27 PM
LucasA33's Avatar
LucasA33 LucasA33 is offline
Member
 
Join Date: Jul 2011
Posts: 144
Gender: Male
Credits: 12,242
LucasA33 is on a distinguished road
Default

I'm currently getting this error:
Fatal error: Uncaught exception 'Exception' with message 'Database error 1054 - Unknown column 'droprate' in 'field list'' in /home/mineedit/public_html/game/classes/class_database.php:161 Stack trace: #0 /home/mineedit/public_html/game/classes/class_database.php(81): Database->_query('adoptables', Array, 'select', 'type = 'Meowly'') #1 /home/mineedit/public_html/game/levelup.php(72): Database->select('adoptables', Array, 'type = 'Meowly'') #2 {main} thrown in /home/mineedit/public_html/game/classes/class_database.php on line 161
__________________
Reply With Quote
  #7  
Old 12-09-2012, 08:28 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,504
Hall of Famer is on a distinguished road
Default

You need to add the column droprate to the table prefix.adoptables, it is the very last column after cost and dropitem.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #8  
Old 12-09-2012, 08:32 PM
LucasA33's Avatar
LucasA33 LucasA33 is offline
Member
 
Join Date: Jul 2011
Posts: 144
Gender: Male
Credits: 12,242
LucasA33 is on a distinguished road
Default

How do I do that :C
__________________
Reply With Quote
  #9  
Old 12-09-2012, 08:48 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,504
Hall of Famer is on a distinguished road
Default

Did you run the install_itemdrop.php script? If not, you may give a try. If that doesnt work, go to phpmyadmin and table prefix.adoptables. You can add new columns there.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #10  
Old 12-09-2012, 09:10 PM
LucasA33's Avatar
LucasA33 LucasA33 is offline
Member
 
Join Date: Jul 2011
Posts: 144
Gender: Male
Credits: 12,242
LucasA33 is on a distinguished road
Default

I ran the script the first time, guess it didn't add it.
Well, I added it manually, and it works.

Thank you.
__________________
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
Mys v1.3.4 Itemdrop Mod for Mys v1.3.4 Hall of Famer Mys v1.3.x Mods 41 05-08-2017 09:30 AM
Mys v1.3.3 Itemdrop Mod for Mys v1.3.3 Hall of Famer Mys v1.3.x Mods 8 06-14-2016 04:50 PM


All times are GMT -5. The time now is 02:30 PM.

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