Q636_TruthBeyond.java 3.7 KB

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