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 03-16-2013, 10:23 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: 489,134
Hall of Famer is on a distinguished road
Default Itemdrop Mod for Mys v1.3.3

Another Mod I decided to revise for Mys v1.3.3 is this Itemdrop Mod, which should be perfectly compatible with the new version. With this plugin, users have a chance to get a specific item by clicking on a certain species of adoptable. It may help with users exchange clicks, but do not abuse this feature so users get way too many important items.

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.

Assuming you have a fresh installation of Mys v1.3.3, you can simply download the .rar files I upload myself, then go to /install/genderratio.php to execute the file to install the Mod. If your site is heavily customized, you'd have to install manually, which should not be difficult anyway. The manual installation steps are explained as below:


To begin with, insert two columns in table prefix.adoptables:
PHP Code:
dropitemvarchar(100), default NULL;
droprateint(11), default 10
Next, open /admincp/adopt.php on your server and find the following lines:
PHP Code:
        $adoptForm->add(new Button("Create this Adoptable""submit""submit"));
        
$document->add($adoptForm); 
Replace them with:
PHP Code:
        $itemdrop = new FieldSetBuilder("Item Drop Settings");
        
$itemdrop->add(new Comment("Items dropped by clicking this adopt: (if multiple items are possible, separate them by comma)"));
        
$itemdrop->add(new TextField("dropitem"));
        
$itemdrop->add(new Comment("Items dropped rate: (must be somewhere between 0 and 100"));
        
$itemdrop->add(new TextField("droprate"));
        
$adoptForm->add($itemdrop);
        
$adoptForm->add(new Button("Create this Adoptable""submit""submit"));
        
$document->add($adoptForm); 
This should make the itemdrop field to appear in ACP, still we need to do one more thing before closing this file. Find the SQL insert query for prefix.adoptables at:
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"))); 
And again replace this chunk of code 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"))); 
We are now done with /admincp/adopt.php. It is time to open levelup.php and finish up our tasks. At levelup.php, find the following lines:
PHP Code:
            $summary = new Division;
            
$summary->setAlign(new Align("center"));
            
$summary->add($image);    
            
$summary->add(new Comment("{$mysidia->lang->gave}{$this->adopt->getName()} one {$mysidia->lang->unit}."));
            
$summary->add(new Comment($mysidia->lang->encourage));
            
$summary->add(new Comment("<br>"));
            
$summary->add(new Comment(" You have earned {$reward} {$mysidia->settings->cost} for leveling up this adoptable. "));
            
$summary->add(new Comment("You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}"));
            
$document->add($summary); 
Replace them all by:
PHP Code:
            $summary = new Division;
            
$summary->setAlign(new Align("center"));
            
$summary->add($image);    
            
$summary->add(new Comment("{$mysidia->lang->gave}{$this->adopt->getName()} one {$mysidia->lang->unit}."));
            
$summary->add(new Comment($mysidia->lang->encourage));
            
$summary->add(new Comment("<br>"));
            
            
// 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 = '{$this->adopt->getType()}'")->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.";
                }    
            }  
            
            
$summary->add(new Comment(" You have earned {$reward} {$mysidia->settings->cost} for leveling up this adoptable. "));
            
$summary->add(new Comment("You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}"));
            if(
$candrop == "yes"$document->addLangvar($dropstatus);  
            
$document->add($summary); 
At the very last, do not forget to insert a row into the table prefix.acp_hooks, the row should look like this below:
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.
Attached Files
File Type: rar Itemdrop Mod v1.3.3.rar (7.9 KB, 17 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 04-05-2013, 08:08 AM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 78,034
AlexC is an unknown quantity at this point
Default

I am getting the following error when attempting to install this plugin;


Warning: require(../inc/config.php) [function.require]: failed to open stream: No such file or directory in /home/ratties/public_html/classes/class_initializer.php on line 94

Warning: require(../inc/config.php) [function.require]: failed to open stream: No such file or directory in /home/ratties/public_html/classes/class_initializer.php on line 94

Fatal error: require() [function.require]: Failed opening required '../inc/config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ratties/public_html/classes/class_initializer.php on line 94
__________________
Reply With Quote
  #3  
Old 04-05-2013, 08:19 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: 489,134
Hall of Famer is on a distinguished road
Default

umm you are trying to run the installer arent you? If so, you should upload the installer to the /install folder since otherwise the script url redirect will prevent it from installing. Anyway you can always try adding/removing fields directly in PHPMyadmin.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 04-05-2013, 08:21 AM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 78,034
AlexC is an unknown quantity at this point
Default

I did use the install folder. I could try adding it manually later, but I don't have the time now.

EDIT: I went to check the coding - everything seemed good (was all changed) but for some reason when I checked the database, I saw there was no droprate column, only dropitem. Added that in and this seems to have solved the problem - program is working fine, tested and all.
__________________

Last edited by AlexC; 04-05-2013 at 08:53 AM.
Reply With Quote
  #5  
Old 04-05-2013, 09:21 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: 489,134
Hall of Famer is on a distinguished road
Default

I see, it was my mistake lol. Heres why droprate aint inserted:

PHP Code:
$adopts->query("ALTER TABLE ".constant("PREFIX")."adoptables ADD column droprate INT DEFAULT 0 AFTER droprate"); 
Altering the table by inserting a field 'droprate' right after 'droprate', you see where the problem is.

I've uploaded a new installer file, it should work fine this time.
Attached Files
File Type: php itemdrop.php (888 Bytes, 4 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 06-02-2013, 04:46 AM
Alaric Alaric is offline
Mod
 
Join Date: Nov 2011
Posts: 112
Gender: Male
Credits: 315,053
Alaric is on a distinguished road
Default

Keep getting this error :

__________________
Reply With Quote
  #7  
Old 06-13-2016, 10:34 PM
Suzanne Suzanne is offline
Member
 
Join Date: Jun 2016
Posts: 11
Gender: Female
Credits: 1,537
Suzanne is on a distinguished road
Default

I installed this on 1.3.4 and I got it working - except after they click the page goes blank instead of displaying the reward they just got. The database gets updated with the item so that part works perfectly.

It is the levelup.php/levelupview.php file I am having trouble configuring. Has anyone got this working on 1.3.4? If so could you share what you changed in the levelup file(s).

Thank you,
Suzanne
Reply With Quote
  #8  
Old 06-14-2016, 12:17 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: 489,134
Hall of Famer is on a distinguished road
Default

There is a Mys v1.3.4 version available, you installed the wrong version.
http://mysidiaadoptables.com/forum/s...ead.php?t=4362
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #9  
Old 06-14-2016, 05:50 PM
Suzanne Suzanne is offline
Member
 
Join Date: Jun 2016
Posts: 11
Gender: Female
Credits: 1,537
Suzanne is on a distinguished road
Default

Oops I missed the other thread. Sorry about that.

Thank you for letting me know,
Suzanne
Reply With Quote
Reply


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 10:30 AM
Mys v1.3.2 Itemdrop Mod for Mys v1.3.2 Hall of Famer Mys v1.3.x Mods 29 03-11-2013 03:44 PM


All times are GMT -5. The time now is 12:37 PM.

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