OutpostCaptain.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (C) 2004-2014 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 hellbound.AI;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.datatables.DoorTable;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import hellbound.HellboundEngine;
  26. /**
  27. * Outpost Captain's AI.
  28. * @author DS
  29. */
  30. public final class OutpostCaptain extends AbstractNpcAI
  31. {
  32. // NPCs
  33. private static final int CAPTAIN = 18466;
  34. private static final int[] DEFENDERS =
  35. {
  36. 22357, // Enceinte Defender
  37. 22358, // Enceinte Defender
  38. };
  39. private static final int DOORKEEPER = 32351;
  40. public OutpostCaptain()
  41. {
  42. super(OutpostCaptain.class.getSimpleName(), "hellbound/AI");
  43. addKillId(CAPTAIN);
  44. addSpawnId(CAPTAIN, DOORKEEPER);
  45. addSpawnId(DEFENDERS);
  46. }
  47. @Override
  48. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. if (event.equalsIgnoreCase("LEVEL_UP"))
  51. {
  52. npc.deleteMe();
  53. HellboundEngine.getInstance().setLevel(9);
  54. }
  55. return super.onAdvEvent(event, npc, player);
  56. }
  57. @Override
  58. public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  59. {
  60. if (HellboundEngine.getInstance().getLevel() == 8)
  61. {
  62. addSpawn(DOORKEEPER, npc.getSpawn().getLocation(), false, 0, false);
  63. }
  64. return super.onKill(npc, killer, isSummon);
  65. }
  66. @Override
  67. public final String onSpawn(L2Npc npc)
  68. {
  69. npc.setIsNoRndWalk(true);
  70. if (npc.getId() == CAPTAIN)
  71. {
  72. final L2DoorInstance door = DoorTable.getInstance().getDoor(20250001);
  73. if (door != null)
  74. {
  75. door.closeMe();
  76. }
  77. }
  78. else if (npc.getId() == DOORKEEPER)
  79. {
  80. startQuestTimer("LEVEL_UP", 3000, npc, null);
  81. }
  82. return super.onSpawn(npc);
  83. }
  84. }