PDA

View Full Version : Removal Mod for Item Add Mod [Part Two]


Missy Master
05-10-2015, 08:43 PM
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.


This is the 'mate' to the Item Add Mod. This is for 1.3.4.

First .. backup the database and download the sql. Then backup ALL files you are going to be modifying before you do that. I think I have this right but I would hate to see anyone lose their Site workability!

Note: I am working on a way to just remove one Item at a time, and also a way to place it back into the User's inventory!


1. This will remove all the items on a Pet, it will be called RemovAll here, you can name it what you wish.

Note this below assumes you have five item slots. Add or subtract as needed!


In functions_items add:



function items_click9($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}'");
$mysidia->db->update("owned_adoptables", array("toy_2" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'");
$mysidia->db->update("owned_adoptables", array("toy_3" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'");
$mysidia->db->update("owned_adoptables", array("toy_4" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'");
$mysidia->db->update("owned_adoptables", array("toy_5" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'");


$note = "You used a {$item->itemname}, and the Pet has just used {$item->value} and had all items removed<br>";
//Now lets check if the adoptable has reached a new level.



//Update item quantity...
$delitem = $item->remove();
return $note;
}





2. in class_privateitem add where you see the list of those like this:

case "Click9":
$message = items_click9($this, $owned_adoptable);
break;


3. Go in and create an item called RemovAll [ or whatever you like ] and select function Click9 --- VALUE is Empty -- nothing else, just the word Empty -- this will kick up the Empty.png for you to use to replace all the item images, so it will appear as if there is nothing there again.

***Note: be sure you have a TRANSPARENT .png called Empty.png in the picuploads folder!

This should be the same size as your Pet images, or as large as the largest of them.

Do not confuse the image for the Item with the Empty.png itself. One is for your inventory and the shop, and the other is the actual item itself.


itemname RemovAll
description Removes Items
imageurl URL where the image for this item lives : ie http://pet-sim.com/Canidae/images/Removeall.png

function Click9
target all
value Empty
shop Wherever you are selling it
price Price
chance 100
cap
tradable yes
consumable yes


Okay I think I have this right, and if I have omitted something please forgive me. The files for my class_privateitem and functions_items are uploaded on the Add Item Mod, if you need them.

Good luck and as always, BACK IT ALL UP! :)