Package l2p.gameserver.clientpackets

Source Code of l2p.gameserver.clientpackets.RequestRecipeItemDelete

package l2p.gameserver.clientpackets;

import l2p.gameserver.RecipeController;
import l2p.gameserver.model.L2Player;
import l2p.gameserver.model.L2Recipe;
import l2p.gameserver.serverpackets.RecipeBookItemList;

public class RequestRecipeItemDelete extends L2GameClientPacket
{
  // Format: cd
  private int _RecipeID;

  @Override
  public void readImpl()
  {
    _RecipeID = readD();
  }

  @Override
  public void runImpl()
  {
    L2Player activeChar = getClient().getActiveChar();
    if(activeChar == null)
    {
      return;
    }
    L2Recipe rp = RecipeController.getInstance().getRecipeByRecipeId(_RecipeID);
    if(rp == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    activeChar.unregisterRecipe(_RecipeID);
    RecipeBookItemList response = new RecipeBookItemList(rp.isDwarvenRecipe(), (int) activeChar.getCurrentMp());
    response.setRecipes(activeChar.getDwarvenRecipeBook());
    activeChar.sendPacket(response);
  }
}
TOP

Related Classes of l2p.gameserver.clientpackets.RequestRecipeItemDelete

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.