View Single Post
  #10  
Old 04-14-2016, 05:21 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 50,845
tahbikat is on a distinguished road
Default

Okidokes, here's the two other item functions to remove companions and items without giving new ones. I named the functions "unbindingcompanion"/"unbindingitem", so if you want to name it something else just change that and be sure to match up everything else.

Add in functions_items.php:
PHP Code:
function items_unbindingcompanion($item$adopt){
  
$mysidia Registry::get("mysidia");
  
  if (
$adopt->companion != "nocompanion") {  
    
$itemgive = new StockItem($adopt->companion);  
    
$itemgive->append(1$mysidia->user->username);  
    } 

  
$mysidia->db->update("owned_adoptables", array("companion" => 'nocompanion'), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
  
$note "You use the <b>{$item->itemname}</b> on your pet, breaking the bond between it and its companion. The companion has been returned to your inventory!<br /><br /> <a href='/inventory'><button type='button'>Return to Inventory</button></a><br>";
  
//Update item quantity...
  
$delitem $item->remove(); 
  return 
$note;



function 
items_unbindingitem($item$adopt){
  
$mysidia Registry::get("mysidia");
  
  if (
$adopt->item != "noitem") {  
    
$itemgive = new StockItem($adopt->item);  
    
$itemgive->append(1$mysidia->user->username);  
    } 

  
$mysidia->db->update("owned_adoptables", array("item" => 'noitem'), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
  
$note "You use the <b>{$item->itemname}</b> on your pet, breaking the bond between it and its held item. The held item has been returned to your inventory!<br /><br /> <a href='/inventory'><button type='button'>Return to Inventory</button></a><br>";
  
//Update item quantity...
  
$delitem $item->remove(); 
  return 
$note;

Add in class_privateitem.php:
PHP Code:
         case "UnbindingCompanion":
            
$message items_unbindingcompanion($this$owned_adoptable);
            break; 
         case 
"UnbindingItem":
            
$message items_unbindingitem($this$owned_adoptable);
            break; 
Then add the new functions to your database prefix_items_functions like you did for the companion and held item functions. That's it! Then just create the items and select the new functions.
Reply With Quote