OutpostCaptain.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package ai.individual;
  16. import com.l2jserver.gameserver.datatables.DoorTable;
  17. import com.l2jserver.gameserver.instancemanager.HellboundManager;
  18. import com.l2jserver.gameserver.model.actor.L2Npc;
  19. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. import com.l2jserver.gameserver.model.quest.Quest;
  22. /**
  23. * @author DS
  24. */
  25. public class OutpostCaptain extends Quest
  26. {
  27. private static final int CAPTAIN = 18466;
  28. private static final int[] DEFENDERS =
  29. {
  30. 22357, 22358
  31. };
  32. private static final int DOORKEEPER = 32351;
  33. @Override
  34. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  35. {
  36. if (event.equalsIgnoreCase("level_up"))
  37. {
  38. npc.deleteMe();
  39. HellboundManager.getInstance().setLevel(9);
  40. }
  41. return null;
  42. }
  43. @Override
  44. public final String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  45. {
  46. if (HellboundManager.getInstance().getLevel() == 8)
  47. {
  48. addSpawn(DOORKEEPER, npc.getSpawn().getSpawnLocation(), false, 0, false);
  49. }
  50. return super.onKill(npc, killer, isPet);
  51. }
  52. @Override
  53. public final String onSpawn(L2Npc npc)
  54. {
  55. npc.setIsNoRndWalk(true);
  56. if (npc.getNpcId() == CAPTAIN)
  57. {
  58. L2DoorInstance door = DoorTable.getInstance().getDoor(20250001);
  59. if (door != null)
  60. {
  61. door.closeMe();
  62. }
  63. }
  64. else if (npc.getNpcId() == DOORKEEPER)
  65. {
  66. startQuestTimer("level_up", 3000, npc, null);
  67. }
  68. return super.onSpawn(npc);
  69. }
  70. public OutpostCaptain(int questId, String name, String descr)
  71. {
  72. super(questId, name, descr);
  73. addKillId(CAPTAIN);
  74. addSpawnId(CAPTAIN);
  75. addSpawnId(DOORKEEPER);
  76. for (int i : DEFENDERS)
  77. {
  78. addSpawnId(i);
  79. }
  80. }
  81. public static void main(String[] args)
  82. {
  83. new OutpostCaptain(-1, OutpostCaptain.class.getSimpleName(), "ai");
  84. }
  85. }