return source;
}
private static SourceObject createSourceForContainedItem(final RPAction action, final Player player) {
SourceObject source;
final Entity parent = EquipUtil.getEntityFromId(player, action.getInt(EquipActionConsts.BASE_OBJECT));
if (!isValidParent(parent, player)) {
return invalidSource;
}
final String slotName = action.get(EquipActionConsts.BASE_SLOT);
if (!parent.hasSlot(slotName)) {
player.sendPrivateText("Source " + slotName + " does not exist");
logger.error(player.getName() + " tried to use non existing slot " + slotName + " of " + parent
+ " as source. player zone: " + player.getZone() + " object zone: " + parent.getZone());
return invalidSource;
}
final RPSlot baseSlot = ((EntitySlot) parent.getSlot(slotName)).getWriteableSlot();
if (!isValidBaseSlot(player, baseSlot)) {
return invalidSource;
}
final RPObject.ID baseItemId = new RPObject.ID(action.getInt(EquipActionConsts.BASE_ITEM), "");
if (!baseSlot.has(baseItemId)) {
logger.debug("Base item(" + parent + ") doesn't contain item(" + baseItemId + ") on given slot(" + slotName
+ ")");
// Remove message as discussed on #arianne 2010-04-25
// player.sendPrivateText("There is no such item in the " + slotName + " of "
// + parent.getDescriptionName(true));
return invalidSource;
}
final Entity entity = (Entity) baseSlot.get(baseItemId);
if (!(entity instanceof Item)) {
player.sendPrivateText("Oh, that " + entity.getDescriptionName(true)
+ " is not an item and therefore cannot be equipped");
return invalidSource;
}
if (parent instanceof Corpse) {