PartyOther.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package handlers.targethandlers;
  20. import com.l2jserver.gameserver.handler.ITargetTypeHandler;
  21. import com.l2jserver.gameserver.model.L2Object;
  22. import com.l2jserver.gameserver.model.actor.L2Character;
  23. import com.l2jserver.gameserver.model.skills.Skill;
  24. import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
  25. import com.l2jserver.gameserver.network.SystemMessageId;
  26. /**
  27. * @author UnAfraid
  28. */
  29. public class PartyOther implements ITargetTypeHandler
  30. {
  31. @Override
  32. public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
  33. {
  34. if ((target != null) && (target != activeChar) && activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId()))
  35. {
  36. if (!target.isDead())
  37. {
  38. if (target.isPlayer())
  39. {
  40. switch (skill.getId())
  41. {
  42. // FORCE BUFFS may cancel here but there should be a proper condition
  43. case 426:
  44. if (!target.getActingPlayer().isMageClass())
  45. {
  46. return new L2Character[]
  47. {
  48. target
  49. };
  50. }
  51. return EMPTY_TARGET_LIST;
  52. case 427:
  53. if (target.getActingPlayer().isMageClass())
  54. {
  55. return new L2Character[]
  56. {
  57. target
  58. };
  59. }
  60. return EMPTY_TARGET_LIST;
  61. }
  62. }
  63. return new L2Character[]
  64. {
  65. target
  66. };
  67. }
  68. return EMPTY_TARGET_LIST;
  69. }
  70. activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  71. return EMPTY_TARGET_LIST;
  72. }
  73. @Override
  74. public Enum<L2TargetType> getTargetType()
  75. {
  76. return L2TargetType.PARTY_OTHER;
  77. }
  78. }