}
}
synchronized(player.getInventory())
{
L2RecipeComponent[] recipes = recipeList.getRecipes();
Inventory inventory = player.getInventory();
for(L2RecipeComponent recipe : recipes)
{
if(recipe.getQuantity() == 0)
{
continue;
}
if(Config.ALT_GAME_UNREGISTER_RECIPE && ItemTable.getInstance().getTemplate(recipe.getItemId()).getItemType() == EtcItemType.RECIPE)
{
L2Recipe rp = RecipeController.getInstance().getRecipeByRecipeItem(recipe.getItemId());
if(player.hasRecipe(rp))
{
continue;
}
player.sendPacket(Msg.NOT_ENOUGH_MATERIALS, new RecipeItemMakeInfo(recipeList.getId(), player, 0));
return;
}
L2ItemInstance invItem = inventory.getItemByItemId(recipe.getItemId());
if(invItem == null || recipe.getQuantity() > invItem.getCount())
{
player.sendPacket(Msg.NOT_ENOUGH_MATERIALS, new RecipeItemMakeInfo(recipeList.getId(), player, 0));
return;
}
}
player.reduceCurrentMp(recipeList.getMpCost(), null);
for(L2RecipeComponent recipe : recipes)
{
if(recipe.getQuantity() != 0)
{
L2ItemInstance invItem = inventory.getItemByItemId(recipe.getItemId());
if(Config.ALT_GAME_UNREGISTER_RECIPE && ItemTable.getInstance().getTemplate(recipe.getItemId()).getItemType() == EtcItemType.RECIPE)
{
player.unregisterRecipe(RecipeController.getInstance().getRecipeByRecipeItem(recipe.getItemId()).getId());
}
else
{
inventory.destroyItem(invItem, recipe.getQuantity(), false);
player.sendPacket(SystemMessage.removeItems(invItem.getItemId(), recipe.getQuantity()));
}
}
}
}