Dummy.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (C) 2004-2013 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.skillhandlers;
  20. import com.l2jserver.gameserver.handler.ISkillHandler;
  21. import com.l2jserver.gameserver.instancemanager.HandysBlockCheckerManager;
  22. import com.l2jserver.gameserver.instancemanager.HandysBlockCheckerManager.ArenaParticipantsHolder;
  23. import com.l2jserver.gameserver.model.L2Object;
  24. import com.l2jserver.gameserver.model.ShotType;
  25. import com.l2jserver.gameserver.model.actor.L2Character;
  26. import com.l2jserver.gameserver.model.actor.instance.L2BlockInstance;
  27. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  28. import com.l2jserver.gameserver.model.skills.L2Skill;
  29. import com.l2jserver.gameserver.model.skills.L2SkillType;
  30. /**
  31. * @version $Revision: 1.1.2.5.2.4 $ $Date: 2005/04/03 15:55:03 $
  32. */
  33. public class Dummy implements ISkillHandler
  34. {
  35. private static final L2SkillType[] SKILL_IDS =
  36. {
  37. L2SkillType.DUMMY
  38. };
  39. @Override
  40. public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
  41. {
  42. switch (skill.getId())
  43. {
  44. case 5852:
  45. case 5853:
  46. {
  47. final L2Object obj = targets[0];
  48. if (obj != null)
  49. {
  50. useBlockCheckerSkill(activeChar.getActingPlayer(), skill, obj);
  51. }
  52. break;
  53. }
  54. default:
  55. {
  56. if (skill.hasEffects())
  57. {
  58. for (L2Character cha : (L2Character[]) targets)
  59. {
  60. skill.getEffects(activeChar, cha);
  61. }
  62. }
  63. break;
  64. }
  65. }
  66. if (skill.useSpiritShot())
  67. {
  68. activeChar.setChargedShot(activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false);
  69. }
  70. }
  71. @Override
  72. public L2SkillType[] getSkillIds()
  73. {
  74. return SKILL_IDS;
  75. }
  76. private final void useBlockCheckerSkill(L2PcInstance activeChar, L2Skill skill, L2Object target)
  77. {
  78. if (!(target instanceof L2BlockInstance))
  79. {
  80. return;
  81. }
  82. L2BlockInstance block = (L2BlockInstance) target;
  83. final int arena = activeChar.getBlockCheckerArena();
  84. if (arena != -1)
  85. {
  86. final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena);
  87. if (holder == null)
  88. {
  89. return;
  90. }
  91. final int team = holder.getPlayerTeam(activeChar);
  92. final int color = block.getColorEffect();
  93. if ((team == 0) && (color == 0x00))
  94. {
  95. block.changeColor(activeChar, holder, team);
  96. }
  97. else if ((team == 1) && (color == 0x53))
  98. {
  99. block.changeColor(activeChar, holder, team);
  100. }
  101. }
  102. }
  103. }