ExShowSeedInfo.java 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.SeedProduction;
  18. import net.sf.l2j.gameserver.model.L2Manor;
  19. /**
  20. * format(packet 0xFE)
  21. * ch ddd [dddddcdcd]
  22. * c - id
  23. * h - sub id
  24. *
  25. * d - manor id
  26. * d
  27. * d - size
  28. *
  29. * [
  30. * d - seed id
  31. * d - left to buy
  32. * d - started amount
  33. * d - sell price
  34. * d - seed level
  35. * c
  36. * d - reward 1 id
  37. * c
  38. * d - reward 2 id
  39. * ]
  40. *
  41. * @author l3x
  42. */
  43. public class ExShowSeedInfo extends L2GameServerPacket {
  44. private static final String _S__FE_1C_EXSHOWSEEDINFO = "[S] FE:23 ExShowSeedInfo";
  45. private FastList<SeedProduction> _seeds;
  46. private int _manorId;
  47. public ExShowSeedInfo(int manorId, FastList<SeedProduction> seeds)
  48. {
  49. _manorId = manorId;
  50. _seeds = seeds;
  51. if (_seeds == null)
  52. {
  53. _seeds = new FastList<SeedProduction>();
  54. }
  55. }
  56. @Override
  57. protected void writeImpl()
  58. {
  59. writeC(0xFE); // Id
  60. writeH(0x23); // SubId
  61. writeC(0);
  62. writeD(_manorId); // Manor ID
  63. writeD(0);
  64. writeD(_seeds.size());
  65. for (SeedProduction seed : _seeds)
  66. {
  67. writeD(seed.getId()); // Seed id
  68. writeD(seed.getCanProduce()); // Left to buy
  69. writeD(seed.getStartProduce()); // Started amount
  70. writeD(seed.getPrice()); // Sell Price
  71. writeD(L2Manor.getInstance().getSeedLevel(seed.getId())); // Seed Level
  72. writeC(1); // reward 1 Type
  73. writeD(L2Manor.getInstance().getRewardItemBySeed(seed.getId(),1)); // Reward 1 Type Item Id
  74. writeC(1); // reward 2 Type
  75. writeD(L2Manor.getInstance().getRewardItemBySeed(seed.getId(),2)); // Reward 2 Type Item Id
  76. }
  77. }
  78. @Override
  79. public String getType()
  80. {
  81. return _S__FE_1C_EXSHOWSEEDINFO;
  82. }
  83. }