Q00636_TruthBeyond.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 quests.Q00636_TruthBeyond;
  20. import com.l2jserver.gameserver.model.actor.L2Character;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. import com.l2jserver.gameserver.model.zone.L2ZoneType;
  27. /**
  28. * The Truth Beyond the Gate (636)<br>
  29. * Original Jython script by Polo, BiTi and DrLecter.
  30. * @author DS
  31. */
  32. public final class Q00636_TruthBeyond extends Quest
  33. {
  34. private static final int ELIYAH = 31329;
  35. private static final int FLAURON = 32010;
  36. private static final int ZONE = 30100;
  37. private static final int VISITOR_MARK = 8064;
  38. private static final int FADED_MARK = 8065;
  39. private static final int MARK = 8067;
  40. public Q00636_TruthBeyond()
  41. {
  42. super(636, Q00636_TruthBeyond.class.getSimpleName(), "The Truth Beyond the Gate");
  43. addStartNpc(ELIYAH);
  44. addTalkId(ELIYAH, FLAURON);
  45. addEnterZoneId(ZONE);
  46. }
  47. @Override
  48. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. final QuestState st = getQuestState(player, false);
  51. if (st == null)
  52. {
  53. return null;
  54. }
  55. if ("31329-04.htm".equals(event))
  56. {
  57. st.startQuest();
  58. }
  59. else if ("32010-02.htm".equals(event))
  60. {
  61. st.giveItems(VISITOR_MARK, 1);
  62. st.exitQuest(true, true);
  63. }
  64. return event;
  65. }
  66. @Override
  67. public final String onEnterZone(L2Character character, L2ZoneType zone)
  68. {
  69. // QuestState already null on enter because quest is finished
  70. if (character.isPlayer())
  71. {
  72. if (character.getActingPlayer().destroyItemByItemId("Mark", VISITOR_MARK, 1, character, false))
  73. {
  74. character.getActingPlayer().addItem("Mark", FADED_MARK, 1, character, true);
  75. }
  76. }
  77. return null;
  78. }
  79. @Override
  80. public final String onTalk(L2Npc npc, L2PcInstance player)
  81. {
  82. final QuestState st = getQuestState(player, true);
  83. if (st == null)
  84. {
  85. return getNoQuestMsg(player);
  86. }
  87. if (npc.getId() == ELIYAH)
  88. {
  89. if (st.hasQuestItems(VISITOR_MARK) || st.hasQuestItems(FADED_MARK) || st.hasQuestItems(MARK))
  90. {
  91. st.exitQuest(true);
  92. return "31329-mark.htm";
  93. }
  94. if (st.getState() == State.CREATED)
  95. {
  96. if (player.getLevel() > 72)
  97. {
  98. return "31329-02.htm";
  99. }
  100. st.exitQuest(true);
  101. return "31329-01.htm";
  102. }
  103. else if (st.getState() == State.STARTED)
  104. {
  105. return "31329-05.htm";
  106. }
  107. }
  108. else if (st.getState() == State.STARTED) // Flauron only
  109. {
  110. if (st.isCond(1))
  111. {
  112. return "32010-01.htm";
  113. }
  114. st.exitQuest(true);
  115. return "32010-03.htm";
  116. }
  117. return getNoQuestMsg(player);
  118. }
  119. }