GatekeeperSpirit.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (C) 2004-2015 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.npc.Teleports.GatekeeperSpirit;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.SevenSigns;
  22. import com.l2jserver.gameserver.model.Location;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. /**
  26. * Gatekeeper Spirit AI.
  27. * @author Zoey76
  28. */
  29. public final class GatekeeperSpirit extends AbstractNpcAI
  30. {
  31. // NPCs
  32. private static final int GATEKEEPER_SPIRIT_ENTER = 31111;
  33. private static final int GATEKEEPER_SPIRIT_EXIT = 31112;
  34. private static final int LILITH = 25283;
  35. private static final int ANAKIM = 25286;
  36. // Exit gatekeeper spawn locations
  37. private static final Location SPAWN_LILITH_GATEKEEPER = new Location(184410, -10111, -5488);
  38. private static final Location SPAWN_ANAKIM_GATEKEEPER = new Location(184410, -13102, -5488);
  39. // Teleport
  40. private static final Location TELEPORT_DUSK = new Location(184464, -13104, -5504);
  41. private static final Location TELEPORT_DAWN = new Location(184448, -10112, -5504);
  42. private static final Location EXIT = new Location(182960, -11904, -4897);
  43. private GatekeeperSpirit()
  44. {
  45. super(GatekeeperSpirit.class.getSimpleName(), "ai/npc/Teleports");
  46. addStartNpc(GATEKEEPER_SPIRIT_ENTER, GATEKEEPER_SPIRIT_EXIT);
  47. addFirstTalkId(GATEKEEPER_SPIRIT_ENTER, GATEKEEPER_SPIRIT_EXIT);
  48. addTalkId(GATEKEEPER_SPIRIT_ENTER, GATEKEEPER_SPIRIT_EXIT);
  49. addKillId(LILITH, ANAKIM);
  50. }
  51. @Override
  52. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  53. {
  54. String htmltext = null;
  55. switch (event)
  56. {
  57. case "ANAKIM":
  58. {
  59. addSpawn(GATEKEEPER_SPIRIT_EXIT, SPAWN_ANAKIM_GATEKEEPER, false, 900000);
  60. break;
  61. }
  62. case "LILITH":
  63. {
  64. addSpawn(GATEKEEPER_SPIRIT_EXIT, SPAWN_LILITH_GATEKEEPER, false, 900000);
  65. break;
  66. }
  67. case "TeleportIn":
  68. {
  69. final int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId());
  70. final int sealOfAvariceOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_AVARICE);
  71. final int compWinner = SevenSigns.getInstance().getCabalHighestScore();
  72. if (!SevenSigns.getInstance().isSealValidationPeriod())
  73. {
  74. htmltext = "31111-no.html";
  75. }
  76. else if ((compWinner == SevenSigns.CABAL_DUSK) && (playerCabal == SevenSigns.CABAL_DUSK) && (sealOfAvariceOwner == SevenSigns.CABAL_DUSK))
  77. {
  78. player.teleToLocation(TELEPORT_DUSK, false);
  79. }
  80. else if ((compWinner == SevenSigns.CABAL_DAWN) && (playerCabal == SevenSigns.CABAL_DAWN) && (sealOfAvariceOwner == SevenSigns.CABAL_DAWN))
  81. {
  82. player.teleToLocation(TELEPORT_DAWN, false);
  83. }
  84. else
  85. {
  86. htmltext = "31111-no.html";
  87. }
  88. break;
  89. }
  90. case "TeleportOut":
  91. {
  92. player.teleToLocation(EXIT, true);
  93. break;
  94. }
  95. }
  96. return htmltext;
  97. }
  98. @Override
  99. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  100. {
  101. switch (npc.getId())
  102. {
  103. case ANAKIM:
  104. {
  105. startQuestTimer("ANAKIM", 10000, npc, killer);
  106. break;
  107. }
  108. case LILITH:
  109. {
  110. startQuestTimer("LILITH", 10000, npc, killer);
  111. break;
  112. }
  113. }
  114. return super.onKill(npc, killer, isSummon);
  115. }
  116. public static void main(String[] args)
  117. {
  118. new GatekeeperSpirit();
  119. }
  120. }