RequestDispel.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.clientpackets;
  16. import com.l2jserver.Config;
  17. import com.l2jserver.gameserver.datatables.SkillTable;
  18. import com.l2jserver.gameserver.model.L2Effect;
  19. import com.l2jserver.gameserver.model.L2Skill;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. import com.l2jserver.gameserver.templates.skills.L2EffectType;
  22. /**
  23. *
  24. * @author KenM
  25. */
  26. public class RequestDispel extends L2GameClientPacket
  27. {
  28. private int _skillId;
  29. private int _skillLevel;
  30. /**
  31. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#readImpl()
  32. */
  33. @Override
  34. protected void readImpl()
  35. {
  36. _skillId = readD();
  37. _skillLevel = readD();
  38. }
  39. /**
  40. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#runImpl()
  41. */
  42. @Override
  43. protected void runImpl()
  44. {
  45. L2PcInstance activeChar = getClient().getActiveChar();
  46. if (activeChar == null)
  47. return;
  48. L2Skill skill = SkillTable.getInstance().getInfo(_skillId, _skillLevel);
  49. if (skill != null && (!skill.isDance() || Config.DANCE_CANCEL_BUFF) && !skill.isDebuff() && skill.canBeDispeled())
  50. {
  51. for (L2Effect e : activeChar.getAllEffects())
  52. {
  53. if (e != null && e.getSkill() == skill && e.getEffectType() != L2EffectType.TRANSFORMATION)
  54. e.exit();
  55. }
  56. }
  57. }
  58. /**
  59. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#getType()
  60. */
  61. @Override
  62. public String getType()
  63. {
  64. return "[C] D0:4E RequestDispel";
  65. }
  66. }