L2DoorAI.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server 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 Server 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 com.l2jserver.gameserver.ai;
  20. import com.l2jserver.gameserver.ThreadPoolManager;
  21. import com.l2jserver.gameserver.model.L2Object;
  22. import com.l2jserver.gameserver.model.Location;
  23. import com.l2jserver.gameserver.model.actor.L2Character;
  24. import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance;
  25. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  26. import com.l2jserver.gameserver.model.skills.Skill;
  27. /**
  28. * @author mkizub
  29. */
  30. public class L2DoorAI extends L2CharacterAI
  31. {
  32. public L2DoorAI(L2DoorInstance creature)
  33. {
  34. super(creature);
  35. }
  36. @Override
  37. protected void onIntentionIdle()
  38. {
  39. }
  40. @Override
  41. protected void onIntentionActive()
  42. {
  43. }
  44. @Override
  45. protected void onIntentionRest()
  46. {
  47. }
  48. @Override
  49. protected void onIntentionAttack(L2Character target)
  50. {
  51. }
  52. @Override
  53. protected void onIntentionCast(Skill skill, L2Object target)
  54. {
  55. }
  56. @Override
  57. protected void onIntentionMoveTo(Location destination)
  58. {
  59. }
  60. @Override
  61. protected void onIntentionFollow(L2Character target)
  62. {
  63. }
  64. @Override
  65. protected void onIntentionPickUp(L2Object item)
  66. {
  67. }
  68. @Override
  69. protected void onIntentionInteract(L2Object object)
  70. {
  71. }
  72. @Override
  73. protected void onEvtThink()
  74. {
  75. }
  76. @Override
  77. protected void onEvtAttacked(L2Character attacker)
  78. {
  79. ThreadPoolManager.getInstance().executeGeneral(new onEventAttackedDoorTask((L2DoorInstance) _actor, attacker));
  80. }
  81. @Override
  82. protected void onEvtAggression(L2Character target, int aggro)
  83. {
  84. }
  85. @Override
  86. protected void onEvtStunned(L2Character attacker)
  87. {
  88. }
  89. @Override
  90. protected void onEvtSleeping(L2Character attacker)
  91. {
  92. }
  93. @Override
  94. protected void onEvtRooted(L2Character attacker)
  95. {
  96. }
  97. @Override
  98. protected void onEvtReadyToAct()
  99. {
  100. }
  101. @Override
  102. protected void onEvtUserCmd(Object arg0, Object arg1)
  103. {
  104. }
  105. @Override
  106. protected void onEvtArrived()
  107. {
  108. }
  109. @Override
  110. protected void onEvtArrivedRevalidate()
  111. {
  112. }
  113. @Override
  114. protected void onEvtArrivedBlocked(Location blocked_at_loc)
  115. {
  116. }
  117. @Override
  118. protected void onEvtForgetObject(L2Object object)
  119. {
  120. }
  121. @Override
  122. protected void onEvtCancel()
  123. {
  124. }
  125. @Override
  126. protected void onEvtDead()
  127. {
  128. }
  129. private class onEventAttackedDoorTask implements Runnable
  130. {
  131. private final L2DoorInstance _door;
  132. private final L2Character _attacker;
  133. public onEventAttackedDoorTask(L2DoorInstance door, L2Character attacker)
  134. {
  135. _door = door;
  136. _attacker = attacker;
  137. }
  138. @Override
  139. public void run()
  140. {
  141. for (L2DefenderInstance guard : _door.getKnownDefenders())
  142. {
  143. if (_actor.isInsideRadius(guard, guard.getTemplate().getClanHelpRange(), false, true) && (Math.abs(_attacker.getZ() - guard.getZ()) < 200))
  144. {
  145. guard.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, _attacker, 15);
  146. }
  147. }
  148. }
  149. }
  150. }