slot--;
if(_henna[slot] == null)
{
return false;
}
final L2HennaInstance henna = _henna[slot];
final short dyeID = henna.getItemIdDye();
// Added by Tempy - 10 Aug 05
// Gives amount equal to half of the dyes needed for the henna back.
final L2ItemInstance hennaDyes = ItemTable.getInstance().createItem(dyeID);
hennaDyes.setCount(henna.getAmountDyeRequire() / 2);
_henna[slot] = null;
ThreadConnection con = null;
FiltredPreparedStatement statement = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("DELETE FROM character_hennas where char_obj_id=? and slot=? and class_index=?");
statement.setInt(1, getObjectId());
statement.setInt(2, slot + 1);
statement.setInt(3, getActiveClassId());
statement.execute();
}
catch(final Exception e)
{
_log.warning("could not remove char henna: " + e);
}
finally
{
DatabaseUtils.closeDatabaseCS(con, statement);
}
// Calculate Henna modifiers of this L2Player
recalcHennaStats();
// Send Server->Client HennaInfo packet to this L2Player
sendPacket(new HennaInfo(this));
// Send Server->Client UserInfo packet to this L2Player
sendUserInfo(false);
// Add the recovered dyes to the player's inventory and notify them.
getInventory().addItem(hennaDyes);
sendPacket(SystemMessage.obtainItems(henna.getItemIdDye(), henna.getAmountDyeRequire() / 2, 0));
return true;
}