AcquireSkillInfo.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 javolution.util.FastList;
  18. /**
  19. * <code>
  20. * sample
  21. *
  22. * a4
  23. * 4d000000 01000000 98030000 Attack Aura, level 1, sp cost
  24. * 01000000 number of requirements
  25. * 05000000 47040000 0100000 000000000 1 x spellbook advanced ATTACK .
  26. * </code>
  27. *
  28. * format dddd d (ddQd)
  29. *
  30. * @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/03/27 15:29:39 $
  31. */
  32. public class AcquireSkillInfo extends L2GameServerPacket
  33. {
  34. private static final String _S__A4_AQUIRESKILLINFO = "[S] 91 AcquireSkillInfo";
  35. private List<Req> _reqs;
  36. private int _id, _level, _spCost, _mode;
  37. private class Req
  38. {
  39. public int itemId;
  40. public int count;
  41. public int type;
  42. public int unk;
  43. public Req(int pType, int pItemId, int pCount, int pUnk)
  44. {
  45. itemId = pItemId;
  46. type = pType;
  47. count = pCount;
  48. unk = pUnk;
  49. }
  50. }
  51. public AcquireSkillInfo(int id, int level, int spCost, int mode)
  52. {
  53. _reqs = new FastList<Req>();
  54. _id = id;
  55. _level = level;
  56. _spCost = spCost;
  57. _mode = mode;
  58. }
  59. public void addRequirement(int type, int id, int count, int unk)
  60. {
  61. _reqs.add(new Req(type, id, count, unk));
  62. }
  63. @Override
  64. protected final void writeImpl()
  65. {
  66. writeC(0x91);
  67. writeD(_id);
  68. writeD(_level);
  69. writeD(_spCost);
  70. writeD(_mode); //c4
  71. writeD(_reqs.size());
  72. for (Req temp : _reqs)
  73. {
  74. writeD(temp.type);
  75. writeD(temp.itemId);
  76. writeQ(temp.count);
  77. writeD(temp.unk);
  78. }
  79. }
  80. /* (non-Javadoc)
  81. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
  82. */
  83. @Override
  84. public String getType()
  85. {
  86. return _S__A4_AQUIRESKILLINFO;
  87. }
  88. }