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 06-30-2014, 06:39 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,500
Missy Master is an unknown quantity at this point
Default 1.3.4 Item Add Mod To Pets: Reworked [Part One]

Before you start:

One complication is that all your pets -- those from adoptions, breeding, whatever --will need an imageurl in their owned_adoptables table. Still working on how to ensure that, so .. I'd say that needs to be next to make this a finished solution that all may use.



I have re worked this, and attached my files for my heavily modded site, so if there is any question that might help. ALL credit goes to Kyttias for her help in coding all this!! :)

I may have missed something, or made a mistake somewhere, or omitted something. In case I have ...be sure to back up ALL PAGES AND the SQL!

This gives you a way to add item 'slots' that will show items/toys/whatever in front of your Pets. I am working on one that will add backgrounds right now too.

This is for 1.3.4 !!


First : BACK UP all pages and the database --- preferably leave ALL pages open you are modding so you can do an undo if you have to do it!

I had this code much more difficult than it needed to be. Here's a far more streamlined version!



1. In functions_items.php in your functions section. We need to add a function for each item slot we are adding.

Replicate this code, and change the name for each slot, and you can have as many as you like! [ don't forget to add the actual fields in owned_adoptables!! ]

Add this code for the new function - for every field you want to add for this, in other words, how many 'slots' you want to add for plushes/items/toys etc to be added to your Pets - you will add another of this code, the only difference will be you will name them something different - ie, toy_2, toy_3 and so on. You can have as many as you want, really, but remember to update the breeding and adopt insert and update statements, basically anywhere the owned adopts table gets added to, you want to be sure you allow for the new fields!

For me, I have toy_1 all the way to toy_5 and it works really great.

I simply named this function click5, and then added 6, 7 etc. You can call them whatever you want, but you will need a new function for each item slot you want to add!



Code:
function items_click5($item, $adopt){
  $mysidia = Registry::get("mysidia");
  $newclicks = $item->value;


  $mysidia->db->update("owned_adoptables", array("toy_1" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'");
  $note = "You added a {$item->itemname}, and the Pet has just received a {$item->value}<br>";
  
  
   //Update item quantity...
  $delitem = $item->remove(); 
  return $note;
}

2.

Then in class_ownedadoptable.php :

ADD [ near the very top ]:


Code:
protected $toy_1;
Add one of these for each item slot you are adding.

then ADD:


Code:
public function getToy_1(){

	    return $this->toy_1;

	}
Add this for every item Slot!!

RIGHT UNDER THAT --- ADD THIS! ***Please note: This assumes you create five item slots --- if you want more or less, just omit the lines for the extras --- or add MORE!!

Code:
public function getImage($fetchMode = ""){
    $mysidia = Registry::get("mysidia");
    if($this->currentlevel == 0) return $this->getEggImage($fetchMode);
    
       
    if ( $this->toy_1 ){ $toy_1 = "<img class='layer' src='{$mysidia->path->getAbsolute()}picuploads/{$this->toy_1}.png'>"; } 
    if ( $this->toy_2 ){ $toy_2 = "<img class='layer' src='{$mysidia->path->getAbsolute()}picuploads/{$this->toy_2}.png'>"; }
    if ( $this->toy_3){ $toy_3 = "<img class='layer' src='{$mysidia->path->getAbsolute()}picuploads/{$this->toy_3}.png'>"; } 
if ( $this->toy_4){ $toy_4 = "<img class='layer' src='{$mysidia->path->getAbsolute()}picuploads/{$this->toy_4}.png'>"; } 
    if ( $this->toy_5){ $toy_5 = "<img class='layer' src='{$mysidia->path->getAbsolute()}picuploads/{$this->toy_5}.png'>"; } 
    $layers = "<div class='petcontainer'>
        
        <img class='layer' src='{$this->imageurl}'>

".$toy_1."
".$toy_2."
".$toy_3."
".$toy_4."
".$toy_5."

        </div>";

    return $layers;            
}

Remember, toy_1 is the extra field we will are adding in the database for owned_adoptables. You can call it anything you like, and you can add several of these fields, just add more of the above code here ( toy_2, toy_3 etc ) and add as needs be to breeding.php and adopt.php --- ANY where that there is an insert for owned_adoptables that needs to reflect the new fields.


3.

In phpmyadmin, add in owned_adoptables :

toy_1 varchar (100) Not Null

Repeat for as many 'slots' as you want. Add ten for tons of items and toys slots for each pet! :)


4.

In class_breeding.php and adopt.php, add in to the insert statements :

"toy_1" => '',

If you add more than one, add as you need.


"toy_1" => '',"toy_2" => '',"toy_3" => '',"toy_4" => '',"toy_5" => etc



5. In picuploads folder, upload the images you will be using for your toys or rewards or whatever.

They ALL need to be .png

Add a TRANSPARENT image and call Empty.png. It needs to be the square shape of your largest Pet image. Easiest way to create it is just use the image or your largest Pet and then create it out of that. Upload that to picuploads and images folders.

6. Go to class_privateitem.php, and add this where you see all the others like this [ around line 55 ]:


Code:
case "Click5":
             $message = items_click5($this, $owned_adoptable);
             break;


7. Create the toy/reward/item for a Pet in the Item Create.

Name it whatever you wish, remember it needs to be a .png.

Item image: the full exact url of the image location.
Function: Click5, Click6, etc
Target: All
Value : Whatever the name is of the image.

If it's Kittycat.png, you will put Kittycat for value. Not with .png, just Kittycat.

YES the item can be traded.

YES the item can be consumed. ( otherwise it won't allow you to use it )


Create the new item, and then do a run through of buying it and equipping to a Pet. If all goes well you will see it added to the Pet in its Profile! :)
Attached Files
File Type: php class_privateitem.php (6.4 KB, 3 views)
File Type: php class_ownedadoptable.php (8.8 KB, 6 views)
File Type: php functions_items.php (13.2 KB, 3 views)

Last edited by Missy Master; 05-10-2015 at 09:57 PM.
Reply With Quote
  #2  
Old 06-30-2014, 06:51 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,500
Missy Master is an unknown quantity at this point
Default



This is to give you an idea what your stats should give you ....she has her cute little plushie (courtesy of Wallie!! ) down there in his collection ...
Reply With Quote
  #3  
Old 06-30-2014, 07:02 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,500
Missy Master is an unknown quantity at this point
Default

I am currently working on how to insert more toys in successive slots --- will update.
Reply With Quote
  #4  
Old 06-30-2014, 08:52 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 58,395
Hwona is on a distinguished road
Default

Ooh, this looks really interesting... is it like a trinket system?
Edit: DO you know which versions this is compatible with. :3
__________________

Last edited by Hwona; 06-30-2014 at 08:59 PM.
Reply With Quote
  #5  
Old 06-30-2014, 09:38 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,500
Missy Master is an unknown quantity at this point
Default

You can add literally anything ...rewards, pets for pets, toys, jewels .. and this is for 1.3.4 but it might work for 1.3.3 ?

I'd say try it carefully!


If you mess with where it's set out as a .png file expected, I bet you can use .gif too for animated goodies!
Reply With Quote
  #6  
Old 06-30-2014, 10:25 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 58,395
Hwona is on a distinguished road
Default

Oh, if you'd like, I can make some trinket images for users to use on this mod. :3
__________________
Reply With Quote
  #7  
Old 06-30-2014, 11:16 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,500
Missy Master is an unknown quantity at this point
Default

Oh that would be wonderful!!! :) Cant wait to see them!!
Reply With Quote
  #8  
Old 07-01-2014, 12:51 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 58,395
Hwona is on a distinguished road
Default

Oh right! I wanted to suggest adding an "empty item" like when no item i present, showing another image. Then, provide that item free in a shop. :3

Edit: Oh! One more thing, I caught a problem! If you want to use "click5' for the name, every appearance of "click2" needs to be changed. The last part of the mod changes the name from "click" to "click5".
__________________

Last edited by Hwona; 07-01-2014 at 10:49 AM.
Reply With Quote
  #9  
Old 07-01-2014, 10:53 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,500
Missy Master is an unknown quantity at this point
Default

Oh okay, I will check that out, thanks!! :) And yeah I'd like to have something for the empty slots instead of a broken image icon ... not sure how to code that yet.
Reply With Quote
  #10  
Old 07-01-2014, 11:42 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 58,395
Hwona is on a distinguished road
Default

Could I try to build off of this mod? I'm probably going to fail, but... :3
__________________
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 Item Shop Mod(s): NPC + Item Display + Tooltips Kyttias Mys v1.3.x Mods 55 06-19-2020 12:21 PM
Removal Mod for Item Add Mod [Part Two] Missy Master Mys v1.3.x Mods 0 05-10-2015 09:43 PM
Buy X of Item A to receive X of Item B AndromedaKerova Suggestions and Feature Requests 0 11-09-2014 09:17 PM
What do this part of the config mean? LilPixie Questions and Supports 13 02-09-2009 02:15 PM


All times are GMT -5. The time now is 02:06 AM.

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