View Full Version : Target for Items not working
SilverDragonTears
04-11-2012, 03:56 PM
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:
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:
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.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.