2
0

AbnormalStatusUpdate.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 java.util.List;
  17. import javolution.util.FastList;
  18. /**
  19. *
  20. * MagicEffectIcons
  21. * format h (dhd)
  22. *
  23. * @version $Revision: 1.3.2.1.2.6 $ $Date: 2005/04/05 19:41:08 $
  24. */
  25. public class AbnormalStatusUpdate extends L2GameServerPacket
  26. {
  27. private static final String _S__97_ABNORMALSTATUSUPDATE = "[S] 85 AbnormalStatusUpdate";
  28. private List<Effect> _effects;
  29. private class Effect
  30. {
  31. protected int _skillId;
  32. protected int _level;
  33. protected int _duration;
  34. public Effect(int pSkillId, int pLevel, int pDuration)
  35. {
  36. _skillId = pSkillId;
  37. _level = pLevel;
  38. _duration = pDuration;
  39. }
  40. }
  41. public AbnormalStatusUpdate()
  42. {
  43. _effects = new FastList<Effect>();
  44. }
  45. public void addEffect(int skillId, int level, int duration)
  46. {
  47. if (skillId == 2031 ||skillId == 2032 ||skillId == 2037)
  48. return;
  49. _effects.add(new Effect(skillId, level, duration));
  50. }
  51. @Override
  52. protected final void writeImpl()
  53. {
  54. writeC(0x85);
  55. writeH(_effects.size());
  56. for (Effect temp : _effects)
  57. {
  58. writeD(temp._skillId);
  59. writeH(temp._level);
  60. if (temp._duration == -1)
  61. writeD(-1);
  62. else
  63. writeD(temp._duration / 1000);
  64. }
  65. }
  66. /* (non-Javadoc)
  67. * @see net.sf.l2j.gameserver.serverpackets.ServerBasePacket#getType()
  68. */
  69. @Override
  70. public String getType()
  71. {
  72. return _S__97_ABNORMALSTATUSUPDATE;
  73. }
  74. }