ExShowCropInfo.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.List;
  17. import com.l2jserver.gameserver.instancemanager.CastleManorManager.CropProcure;
  18. import com.l2jserver.gameserver.model.L2Manor;
  19. /**
  20. * Format: ch cddd[ddddcdcdcd]
  21. * c - id (0xFE)
  22. * h - sub id (0x1D)
  23. *
  24. * c
  25. * d - manor id
  26. * d
  27. * d - size
  28. * [
  29. * d - crop id
  30. * d - residual buy
  31. * d - start buy
  32. * d - buy price
  33. * c - reward type
  34. * d - seed level
  35. * c - reward 1 items
  36. * d - reward 1 item id
  37. * c - reward 2 items
  38. * d - reward 2 item id
  39. * ]
  40. *
  41. * @author l3x
  42. */
  43. public class ExShowCropInfo extends L2GameServerPacket
  44. {
  45. private static final String _S__FE_1C_EXSHOWSEEDINFO = "[S] FE:24 ExShowCropInfo";
  46. private List<CropProcure> _crops;
  47. private int _manorId;
  48. public ExShowCropInfo(int manorId, List<CropProcure> crops)
  49. {
  50. _manorId = manorId;
  51. _crops = crops;
  52. }
  53. @Override
  54. protected void writeImpl()
  55. {
  56. writeC(0xFE); // Id
  57. writeH(0x24); // SubId
  58. writeC(0);
  59. writeD(_manorId); // Manor ID
  60. writeD(0);
  61. if (_crops == null)
  62. {
  63. writeD(0);
  64. return;
  65. }
  66. writeD(_crops.size());
  67. for (CropProcure crop : _crops)
  68. {
  69. writeD(crop.getId()); // Crop id
  70. writeQ(crop.getAmount()); // Buy residual
  71. writeQ(crop.getStartAmount()); // Buy
  72. writeQ(crop.getPrice()); // Buy price
  73. writeC(crop.getReward()); // Reward
  74. writeD(L2Manor.getInstance().getSeedLevelByCrop(crop.getId())); // Seed Level
  75. writeC(1); // rewrad 1 Type
  76. writeD(L2Manor.getInstance().getRewardItem(crop.getId(),1)); // Rewrad 1 Type Item Id
  77. writeC(1); // rewrad 2 Type
  78. writeD(L2Manor.getInstance().getRewardItem(crop.getId(),2)); // Rewrad 2 Type Item Id
  79. }
  80. }
  81. @Override
  82. public String getType()
  83. {
  84. return _S__FE_1C_EXSHOWSEEDINFO;
  85. }
  86. }