View Single Post
  #8  
Old 04-13-2016, 03:53 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,905
tahbikat is on a distinguished road
Default

OK WOW I figured out what the issue is after taking a break and coming back to this. I'm so dumb lol

Here's the modified code:

PHP Code:
function items_companion($item$adopt){
  
$mysidia Registry::get("mysidia");
  
  if (
$adopt->companion != "nocompanion") {  
    
$itemgive = new StockItem($adopt->companion);  
    
$itemgive->append(1$mysidia->user->username);  
    } 
    
  
$companion $item->itemname;
  
$mysidia->db->update("owned_adoptables", array("companion" => $companion), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
  
$note "You have given your pet a <b>{$item->itemname}</b>! It will now show up in your pet's profile. <br /><br /> <a href='http://mysgardia.com/inventory'><button type='button'>Return to Inventory</button></a><br>";
  
//Update item quantity...
  
$delitem $item->remove(); 
  return 
$note;

Just had to change $item to $itemgive, because doi, it was conflicting with the already set $item variable.

I also made two new item functions that remove the companion/held item and replaces it with the default text. So if a user just wants to remove the item without giving a new one they can do so. Will get first post edited soon.
Reply With Quote