RequestDispel.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.L2Skill;
  19. import com.l2jserver.gameserver.model.actor.L2Summon;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. *
  23. * @author KenM
  24. */
  25. public class RequestDispel extends L2GameClientPacket
  26. {
  27. private int _objectId;
  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. _objectId = readD();
  37. _skillId = readD();
  38. _skillLevel = readD();
  39. }
  40. /**
  41. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#runImpl()
  42. */
  43. @Override
  44. protected void runImpl()
  45. {
  46. if (_skillId <= 0 || _skillLevel <= 0)
  47. return;
  48. final L2PcInstance activeChar = getClient().getActiveChar();
  49. if (activeChar == null)
  50. return;
  51. L2Skill skill = SkillTable.getInstance().getInfo(_skillId, _skillLevel);
  52. if (skill == null)
  53. return;
  54. if (!skill.canBeDispeled() || skill.isStayAfterDeath() || skill.isDebuff())
  55. return;
  56. if (skill.getTransformId() > 0) // transformation
  57. return;
  58. if (skill.isDance() && !Config.DANCE_CANCEL_BUFF)
  59. return;
  60. if (activeChar.getObjectId() == _objectId)
  61. activeChar.stopSkillEffects(_skillId);
  62. else
  63. {
  64. final L2Summon pet = activeChar.getPet();
  65. if (pet != null && pet.getObjectId() == _objectId)
  66. pet.stopSkillEffects(_skillId);
  67. }
  68. }
  69. /**
  70. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#getType()
  71. */
  72. @Override
  73. public String getType()
  74. {
  75. return "[C] D0:4E RequestDispel";
  76. }
  77. }