OutpostCaptain.java 2.5 KB

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