RecipeItemMakeInfo.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.network.serverpackets;
  16. import java.util.logging.Logger;
  17. import com.l2jserver.Config;
  18. import com.l2jserver.gameserver.RecipeController;
  19. import com.l2jserver.gameserver.model.L2RecipeList;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. *
  23. *
  24. *
  25. * format dddd
  26. *
  27. * @version $Revision: 1.1.2.1.2.3 $ $Date: 2005/03/27 15:29:57 $
  28. */
  29. public class RecipeItemMakeInfo extends L2GameServerPacket
  30. {
  31. private static final String _S__D7_RECIPEITEMMAKEINFO = "[S] dd RecipeItemMakeInfo";
  32. private static Logger _log = Logger.getLogger(RecipeItemMakeInfo.class.getName());
  33. private int _id;
  34. private L2PcInstance _activeChar;
  35. private boolean _success;
  36. public RecipeItemMakeInfo(int id, L2PcInstance player, boolean success)
  37. {
  38. _id = id;
  39. _activeChar = player;
  40. _success = success;
  41. }
  42. public RecipeItemMakeInfo(int id, L2PcInstance player)
  43. {
  44. _id = id;
  45. _activeChar = player;
  46. _success = true;
  47. }
  48. @Override
  49. protected final void writeImpl()
  50. {
  51. L2RecipeList recipe = RecipeController.getInstance().getRecipeList(_id);
  52. if (recipe != null)
  53. {
  54. writeC(0xdd);
  55. writeD(_id);
  56. writeD(recipe.isDwarvenRecipe() ? 0 : 1); // 0 = Dwarven - 1 = Common
  57. writeD((int) _activeChar.getCurrentMp());
  58. writeD(_activeChar.getMaxMp());
  59. writeD(_success ? 1 : 0); // item creation success/failed
  60. }
  61. else if (Config.DEBUG) _log.info("No recipe found with ID = " + _id);
  62. }
  63. /* (non-Javadoc)
  64. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
  65. */
  66. @Override
  67. public String getType()
  68. {
  69. return _S__D7_RECIPEITEMMAKEINFO;
  70. }
  71. }