if (!(base instanceof Entity)) {
// Shouldn't really happen because everything is an entity
return null;
}
final Entity baseEntity = (Entity) base;
if (baseEntity.hasSlot(action.get(ATTR_BASESLOT))) {
final RPSlot slot = baseEntity.getSlot(action.get(ATTR_BASESLOT));
if (!(slot instanceof EntitySlot)) {
return null;
}
return (EntitySlot) slot;
}
} else if (action.has(TARGET)) {
String target = action.get(TARGET);
if ((target.length() > 1) && (target.charAt(0) == '#')
&& Character.isDigit(target.charAt(1))) {
final int objectId = Integer.parseInt(target.substring(1));
Entity entity = entityFromZoneByID(objectId, zone);
if ((entity != null) && (entity instanceof Item)) {
return new GroundSlot(zone, (Item) entity);
} else {
return null;
}