Q00006_StepIntoTheFuture.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.Q00006_StepIntoTheFuture;
  20. import com.l2jserver.gameserver.enums.Race;
  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. /**
  27. * Step Into the Future (6)
  28. * @author malyelfik
  29. */
  30. public class Q00006_StepIntoTheFuture extends Quest
  31. {
  32. // NPCs
  33. private static final int ROXXY = 30006;
  34. private static final int BAULRO = 30033;
  35. private static final int SIR_COLLIN = 30311;
  36. // Items
  37. private static final int BAULRO_LETTER = 7571;
  38. private static final int SCROLL_OF_ESCAPE_GIRAN = 7559;
  39. private static final int MARK_OF_TRAVELER = 7570;
  40. // Misc
  41. private static final int MIN_LEVEL = 3;
  42. public Q00006_StepIntoTheFuture()
  43. {
  44. super(6, Q00006_StepIntoTheFuture.class.getSimpleName(), "Step Into the Future");
  45. addStartNpc(ROXXY);
  46. addTalkId(ROXXY, BAULRO, SIR_COLLIN);
  47. registerQuestItems(BAULRO_LETTER);
  48. }
  49. @Override
  50. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  51. {
  52. final QuestState st = getQuestState(player, false);
  53. if (st == null)
  54. {
  55. return null;
  56. }
  57. String htmltext = event;
  58. switch (event)
  59. {
  60. case "30006-03.htm":
  61. st.startQuest();
  62. break;
  63. case "30006-06.html":
  64. st.giveItems(SCROLL_OF_ESCAPE_GIRAN, 1);
  65. st.giveItems(MARK_OF_TRAVELER, 1);
  66. st.exitQuest(false, true);
  67. break;
  68. case "30033-02.html":
  69. st.setCond(2, true);
  70. st.giveItems(BAULRO_LETTER, 1);
  71. break;
  72. case "30311-02.html":
  73. if (!st.hasQuestItems(BAULRO_LETTER))
  74. {
  75. return "30311-03.html";
  76. }
  77. st.takeItems(BAULRO_LETTER, -1);
  78. st.setCond(3, true);
  79. break;
  80. default:
  81. htmltext = null;
  82. break;
  83. }
  84. return htmltext;
  85. }
  86. @Override
  87. public String onTalk(L2Npc npc, L2PcInstance player)
  88. {
  89. String htmltext = getNoQuestMsg(player);
  90. final QuestState st = getQuestState(player, true);
  91. if (st == null)
  92. {
  93. return htmltext;
  94. }
  95. switch (npc.getId())
  96. {
  97. case ROXXY:
  98. switch (st.getState())
  99. {
  100. case State.CREATED:
  101. htmltext = ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL)) ? "30006-02.htm" : "30006-01.html";
  102. break;
  103. case State.STARTED:
  104. if (st.isCond(1))
  105. {
  106. htmltext = "30006-04.html";
  107. }
  108. else if (st.isCond(3))
  109. {
  110. htmltext = "30006-05.html";
  111. }
  112. break;
  113. case State.COMPLETED:
  114. htmltext = getAlreadyCompletedMsg(player);
  115. break;
  116. }
  117. break;
  118. case BAULRO:
  119. if (st.isStarted())
  120. {
  121. if (st.isCond(1))
  122. {
  123. htmltext = "30033-01.html";
  124. }
  125. else if (st.isCond(2))
  126. {
  127. htmltext = "30033-03.html";
  128. }
  129. }
  130. break;
  131. case SIR_COLLIN:
  132. if (st.isStarted())
  133. {
  134. if (st.isCond(2))
  135. {
  136. htmltext = "30311-01.html";
  137. }
  138. else if (st.isCond(3))
  139. {
  140. htmltext = "30311-04.html";
  141. }
  142. }
  143. break;
  144. }
  145. return htmltext;
  146. }
  147. }