ExShowCropInfo.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 net.sf.l2j.gameserver.serverpackets;
  16. import javolution.util.FastList;
  17. import net.sf.l2j.gameserver.instancemanager.CastleManorManager.CropProcure;
  18. import net.sf.l2j.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 FastList<CropProcure> _crops;
  47. private int _manorId;
  48. public ExShowCropInfo(int manorId, FastList<CropProcure> crops)
  49. {
  50. _manorId = manorId;
  51. _crops = crops;
  52. if (_crops == null)
  53. {
  54. _crops = new FastList<CropProcure>();
  55. }
  56. }
  57. @Override
  58. protected void writeImpl()
  59. {
  60. writeC(0xFE); // Id
  61. writeH(0x24); // SubId
  62. writeC(0);
  63. writeD(_manorId); // Manor ID
  64. writeD(0);
  65. writeD(_crops.size());
  66. for (CropProcure crop : _crops)
  67. {
  68. writeD(crop.getId()); // Crop id
  69. writeD(crop.getAmount()); // Buy residual
  70. writeD(crop.getStartAmount()); // Buy
  71. writeD(crop.getPrice()); // Buy price
  72. writeC(crop.getReward()); // Reward
  73. writeD(L2Manor.getInstance().getSeedLevelByCrop(crop.getId())); // Seed Level
  74. writeC(1); // rewrad 1 Type
  75. writeD(L2Manor.getInstance().getRewardItem(crop.getId(),1)); // Rewrad 1 Type Item Id
  76. writeC(1); // rewrad 2 Type
  77. writeD(L2Manor.getInstance().getRewardItem(crop.getId(),2)); // Rewrad 2 Type Item Id
  78. }
  79. }
  80. @Override
  81. public String getType()
  82. {
  83. return _S__FE_1C_EXSHOWSEEDINFO;
  84. }
  85. }