PartySpelled.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.model.actor.L2Character;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
  19. import com.l2jserver.gameserver.model.actor.instance.L2SummonInstance;
  20. import javolution.util.FastList;
  21. /**
  22. * This class ...
  23. *
  24. * @version $Revision: 1.3.2.1.2.3 $ $Date: 2005/03/27 15:29:39 $
  25. */
  26. public class PartySpelled extends L2GameServerPacket
  27. {
  28. private static final String _S__EE_PartySpelled = "[S] f4 PartySpelled";
  29. private List<Effect> _effects;
  30. private L2Character _activeChar;
  31. private class Effect
  32. {
  33. protected int _skillId;
  34. protected int _dat;
  35. protected int _duration;
  36. public Effect(int pSkillId, int pDat, int pDuration)
  37. {
  38. _skillId = pSkillId;
  39. _dat = pDat;
  40. _duration = pDuration;
  41. }
  42. }
  43. public PartySpelled(L2Character cha)
  44. {
  45. _effects = new FastList<Effect>();
  46. _activeChar = cha;
  47. }
  48. @Override
  49. protected final void writeImpl()
  50. {
  51. writeC(0xf4);
  52. writeD(_activeChar instanceof L2SummonInstance ? 2 : _activeChar instanceof L2PetInstance ? 1 : 0);
  53. writeD(_activeChar.getObjectId());
  54. writeD(_effects.size());
  55. for (Effect temp : _effects)
  56. {
  57. writeD(temp._skillId);
  58. writeH(temp._dat);
  59. writeD(temp._duration / 1000);
  60. }
  61. }
  62. public void addPartySpelledEffect(int skillId, int dat, int duration)
  63. {
  64. _effects.add(new Effect(skillId, dat, duration));
  65. }
  66. /* (non-Javadoc)
  67. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
  68. */
  69. @Override
  70. public String getType()
  71. {
  72. return _S__EE_PartySpelled;
  73. }
  74. }