Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Target for Items not working (http://www.mysidiaadoptables.com/forum/showthread.php?t=3579)

SilverDragonTears 04-11-2012 03:56 PM

Target for Items not working
 
For instance, with alts1, I set it to an adopt id and it won't work but then when I set target to all, it works.

Hall of Famer 04-11-2012 04:25 PM

I see, thanks for bringing this up. The problem is that the method checktarget() accepts the owned_adoptables id, not the adoptables species id. For this reason it is working out in somewhat of a weird way. To fix this, find these lines in class_item.php:

PHP Code:

  public function checktarget($aid){
      
// This method checks if the item is usable
      
$item_usable FALSE;
      switch(
$this->target){
         case 
"all":
            
$item_usable TRUE;
            break;
         case 
"user":
            
$item_usable TRUE;
            break;
         default:
            
$target explode(",",$this->target);
            foreach(
$target as $temp){
               if(
$temp == $aid$item_usable TRUE
            }            
      }
      return 
$item_usable;
  } 

Replace by:

PHP Code:

public function checktarget($aid){
      
// This method checks if the item is usable
      
$id converttypetoparentid(convertidtotype($aid));
      
$item_usable FALSE;
      switch(
$this->target){
         case 
"all":
            
$item_usable TRUE;
            break;
         case 
"user":
            
$item_usable TRUE;
            break;
         default:
            
$target explode(",",$this->target);
            if(
in_array($id$target)) $item_usable TRUE;            
      }
      return 
$item_usable;
  } 


SilverDragonTears 04-11-2012 04:55 PM

Beautiful!!! Thanks!

Hall of Famer 04-12-2012 04:17 AM

You are very welcome, glad it works.


All times are GMT -5. The time now is 07:28 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.